@nostop/page 0.1.0-rc.6 → 0.1.0-rc.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.
@@ -226,9 +226,9 @@ The \`done\` action is your opportunity to terminate and share your findings wit
226
226
  <reasoning_rules>
227
227
  Exhibit the following reasoning patterns to successfully achieve the <user_request>:
228
228
 
229
- - Reason about <agent_history> to track progress and context toward <user_request>.
230
- - Analyze the most recent "Next Goal" and "Action Result" in <agent_history> and clearly state what you previously tried to achieve.
231
- - Analyze all relevant items in <agent_history> and <browser_state> to understand your state.
229
+ - Reason about <agent_history> to track progress and context toward <user_request>. Observations that start with "User said while the task was running" are mid-task voice or typed notes: treat them as new instructions for the current request.
230
+ - Analyze the most recent "Next Goal" and "Action Result" in <agent_history> and clearly state what you previously tried to achieve. Reuse facts already in memory and history; do not re-search the page for something you already found unless the page changed.
231
+ - Analyze all relevant items in <agent_history> and <browser_state> to understand your state. When <browser_state> is large, call get_context on the band you need instead of ignoring prior context.
232
232
  - Explicitly judge success/failure/uncertainty of the last action. Never assume an action succeeded just because it appears to be executed in your last step in <agent_history>. If the expected change is missing, mark the last action as failed (or uncertain) and plan a recovery.
233
233
  - Analyze whether you are stuck, e.g. when you repeat the same actions multiple times without any progress. Then consider alternative approaches e.g. scrolling for more context or ask user for help.
234
234
  - Ask user for help if you have any difficulty. Keep user in the loop.
@@ -353,26 +353,27 @@ class PaCapture extends AudioWorkletProcessor {
353
353
  }
354
354
  }
355
355
  registerProcessor('pa-capture', PaCapture);
356
- `,GeminiLiveClient=class{#e;#t=null;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=!1;#c=null;#l=newSendState();#u=[];#d=0;#f=!1;#p=[];#m=0;#h=!0;constructor(e){this.#e=e}async connect(e){try{await this.#_(e.apiKey,e.settings),this.#n=new AudioContext({sampleRate:CAPTURE_RATE}),await this.#n.resume(),this.#r=new AudioContext,await this.#r.resume(),this.#n.state!==`running`&&await this.#n.resume(),this.#r.state!==`running`&&await this.#r.resume(),await this.#b(e.track)}catch(e){throw this.close(),e}await this.#g}#g=Promise.resolve();#_(e,t){let n=new WebSocket(liveUrl(e));return n.binaryType=`blob`,this.#t=n,this.#g=new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`session timeout`)),READY_TIMEOUT_MS$1);this.#c=()=>{clearTimeout(n),e()}}),n.onmessage=e=>void this.#v(e.data),n.onclose=()=>{this.#s||this.#e.onClosed()},new Promise((e,r)=>{n.onopen=()=>{n.send(geminiSetup(t)),e()},n.onerror=()=>r(Error(`connection failed`))})}async#v(e){let t=e instanceof Blob?await e.text():String(e),n;try{n=JSON.parse(t)}catch{return}for(let e of parseGeminiMessage(n))this.#y(e)}#y(e){switch(e.type){case`audio`:this.#S(e.data),this.#f||(this.#f=!0,this.#e.onEvent({type:`response_started`}));return;case`turn_complete`:this.#f=!1,this.#C(!0),this.#h=!0,this.#e.onEvent({type:`response_done`});return;case`speech_started`:this.#w(),this.#f=!1,this.#e.onEvent({type:`speech_started`});return;case`ready`:this.#c?.(),this.#e.onEvent({type:`ready`});return;case`tool_call`:this.#l.callNames.set(e.callId,e.name),this.#e.onEvent(e);return;default:this.#e.onEvent(e)}}send(e){if(this.#t?.readyState===WebSocket.OPEN){JSON.parse(e).type===`response.cancel`&&this.#w();for(let t of translateCommand(e,this.#l))this.#t.send(JSON.stringify(t))}}async replaceTrack(e){if(!e){this.#o=!1,this.#a?.disconnect(),this.#a=null;return}await this.#b(e)}close(){this.#s=!0,this.#t?.close(),this.#w(),this.#a?.disconnect(),this.#i?.disconnect(),this.#n?.close(),this.#r?.close(),this.#r=null,this.#t=null,this.#n=null,this.#i=null,this.#a=null,this.#o=!1}async#b(e){let t=this.#n;if(t){if(!this.#i){let e=URL.createObjectURL(new Blob([CAPTURE_WORKLET],{type:`application/javascript`}));await t.audioWorklet.addModule(e),URL.revokeObjectURL(e);let n=new AudioWorkletNode(t,`pa-capture`),r=new GainNode(t,{gain:0});n.connect(r),r.connect(t.destination),n.port.onmessage=e=>this.#x(e.data),this.#i=n}this.#a?.disconnect(),this.#a=t.createMediaStreamSource(new MediaStream([e])),this.#a.connect(this.#i),this.#o=!0}}#x(e){this.#o&&this.#t?.readyState===WebSocket.OPEN&&this.#t.send(JSON.stringify({realtimeInput:{audio:{data:floatToPcm16Base64(e),mimeType:`audio/pcm;rate=${CAPTURE_RATE}`}}}))}#S(e){this.#r&&(this.#p.push(pcm16Base64ToFloat(e)),this.#m+=this.#p[this.#p.length-1].length,this.#m>=BLOCK_SAMPLES&&this.#C(!1))}#C(e){let t=this.#r;if(!t||this.#m===0)return;let n=new Float32Array(this.#m),r=0;for(let e of this.#p)n.set(e,r),r+=e.length;this.#p=[],this.#m=0,this.#h&&fadeIn(n,PLAYBACK_RATE,EDGE_FADE_MS),e&&fadeOut(n,PLAYBACK_RATE,EDGE_FADE_MS),this.#h=!1;let i=t.createBuffer(1,n.length,PLAYBACK_RATE);i.getChannelData(0).set(n);let a=t.createBufferSource();a.buffer=i,a.connect(t.destination);let o=t.currentTime;this.#d<=o&&(this.#d=o+.05);let s=this.#d;a.start(s),this.#d=s+i.duration,this.#u.push(a),a.onended=()=>{this.#u=this.#u.filter(e=>e!==a)}}#w(){for(let e of this.#u)try{e.stop()}catch{}this.#u=[],this.#p=[],this.#m=0,this.#h=!0,this.#d=this.#r?.currentTime??0}},CALLS_URL=`https://api.openai.com/v1/realtime/calls`,READY_TIMEOUT_MS=1e4,RealtimeClient=class{#e;#t=null;#n=null;#r=null;constructor(e){this.#e=e}async connect(e){let t=new RTCPeerConnection;this.#t=t;let n=document.createElement(`audio`);n.autoplay=!0,n.setAttribute(`playsinline`,`true`),n.playsInline=!0,n.setAttribute(`aria-hidden`,`true`),n.style.display=`none`,document.body.appendChild(n),this.#r=n,t.ontrack=e=>{n.srcObject=e.streams[0]??null,n.play().catch(e=>{console.warn(`[page-agent voice] remote audio playback blocked`,e)})},t.addTrack(e.track);let r=t.createDataChannel(`oai-events`);this.#n=r;let i=new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`session timeout`)),READY_TIMEOUT_MS);r.onmessage=t=>{let r=parseServerEvent(String(t.data));r.type===`ready`&&(clearTimeout(n),e()),this.#e.onEvent(r)}});r.onclose=()=>this.#e.onClosed();let a=await t.createOffer();await t.setLocalDescription(a);let o=new FormData;o.set(`sdp`,a.sdp??``),o.set(`session`,callSessionConfig(e.settings));let s=await fetch(CALLS_URL,{method:`POST`,headers:{Authorization:`Bearer ${e.apiKey}`},body:o});if(!s.ok)throw Error(`realtime call failed: ${s.status}`);await t.setRemoteDescription({type:`answer`,sdp:await s.text()}),await i}send(e){this.#n?.readyState===`open`&&this.#n.send(e)}async replaceTrack(e){await(this.#t?.getSenders().find(e=>e.track===null||e.track.kind===`audio`))?.replaceTrack(e)}close(){this.#n?.close(),this.#t?.close(),this.#r?.remove(),this.#n=null,this.#t=null,this.#r=null}},voice_default=`You are the voice of a web assistant that works on the website the user is looking at. You talk with the user; the page agent carries out page tasks.
356
+ `,GeminiLiveClient=class{#e;#t=null;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=!1;#c=null;#l=newSendState();#u=[];#d=0;#f=!1;#p=[];#m=0;#h=!0;constructor(e){this.#e=e}async connect(e){try{await this.#_(e.apiKey,e.settings),this.#n=new AudioContext({sampleRate:CAPTURE_RATE}),await this.#n.resume(),this.#r=new AudioContext,await this.#r.resume(),this.#n.state!==`running`&&await this.#n.resume(),this.#r.state!==`running`&&await this.#r.resume(),await this.#x(e.track)}catch(e){throw this.close(),e}await this.#g}#g=Promise.resolve();#_(e,t){let n=new WebSocket(liveUrl(e));return n.binaryType=`blob`,this.#t=n,this.#g=new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`session timeout`)),READY_TIMEOUT_MS$1);this.#c=()=>{clearTimeout(n),e()}}),n.onmessage=e=>void this.#v(e.data),n.onclose=()=>{this.#s||this.#e.onClosed()},new Promise((e,r)=>{n.onopen=()=>{n.send(geminiSetup(t)),e()},n.onerror=()=>r(Error(`connection failed`))})}async#v(e){let t=e instanceof Blob?await e.text():String(e),n;try{n=JSON.parse(t)}catch{return}for(let e of parseGeminiMessage(n))this.#y(e)}#y(e){switch(e.type){case`audio`:this.#C(e.data),this.#f||(this.#f=!0,this.#e.onEvent({type:`response_started`}));return;case`turn_complete`:this.#f=!1,this.#w(!0),this.#h=!0,this.#b(),this.#e.onEvent({type:`response_done`});return;case`speech_started`:this.#T(),this.#f=!1,this.#b(),this.#e.onEvent({type:`speech_started`});return;case`ready`:this.#c?.(),this.#b(),this.#e.onEvent({type:`ready`});return;case`tool_call`:this.#l.callNames.set(e.callId,e.name),this.#b(),this.#e.onEvent(e);return;default:this.#e.onEvent(e)}}async#b(){try{this.#n&&this.#n.state!==`running`&&await this.#n.resume(),this.#r&&this.#r.state!==`running`&&await this.#r.resume()}catch{}}send(e){if(this.#t?.readyState===WebSocket.OPEN){JSON.parse(e).type===`response.cancel`&&this.#T();for(let t of translateCommand(e,this.#l))this.#t.send(JSON.stringify(t))}}async replaceTrack(e){if(!e){this.#o=!1,this.#a?.disconnect(),this.#a=null;return}await this.#x(e)}close(){this.#s=!0,this.#t?.close(),this.#T(),this.#a?.disconnect(),this.#i?.disconnect(),this.#n?.close(),this.#r?.close(),this.#r=null,this.#t=null,this.#n=null,this.#i=null,this.#a=null,this.#o=!1}async#x(e){let t=this.#n;if(t){if(!this.#i){let e=URL.createObjectURL(new Blob([CAPTURE_WORKLET],{type:`application/javascript`}));await t.audioWorklet.addModule(e),URL.revokeObjectURL(e);let n=new AudioWorkletNode(t,`pa-capture`),r=new GainNode(t,{gain:0});n.connect(r),r.connect(t.destination),n.port.onmessage=e=>this.#S(e.data),this.#i=n}this.#a?.disconnect(),this.#a=t.createMediaStreamSource(new MediaStream([e])),this.#a.connect(this.#i),this.#o=!0}}#S(e){this.#o&&this.#t?.readyState===WebSocket.OPEN&&this.#t.send(JSON.stringify({realtimeInput:{audio:{data:floatToPcm16Base64(e),mimeType:`audio/pcm;rate=${CAPTURE_RATE}`}}}))}#C(e){this.#r&&(this.#p.push(pcm16Base64ToFloat(e)),this.#m+=this.#p[this.#p.length-1].length,this.#m>=BLOCK_SAMPLES&&this.#w(!1))}#w(e){let t=this.#r;if(!t||this.#m===0)return;let n=new Float32Array(this.#m),r=0;for(let e of this.#p)n.set(e,r),r+=e.length;this.#p=[],this.#m=0,this.#h&&fadeIn(n,PLAYBACK_RATE,EDGE_FADE_MS),e&&fadeOut(n,PLAYBACK_RATE,EDGE_FADE_MS),this.#h=!1;let i=t.createBuffer(1,n.length,PLAYBACK_RATE);i.getChannelData(0).set(n);let a=t.createBufferSource();a.buffer=i,a.connect(t.destination);let o=t.currentTime;this.#d<=o&&(this.#d=o+.05);let s=this.#d;a.start(s),this.#d=s+i.duration,this.#u.push(a),a.onended=()=>{this.#u=this.#u.filter(e=>e!==a)}}#T(){for(let e of this.#u)try{e.stop()}catch{}this.#u=[],this.#p=[],this.#m=0,this.#h=!0,this.#d=this.#r?.currentTime??0}},CALLS_URL=`https://api.openai.com/v1/realtime/calls`,READY_TIMEOUT_MS=1e4,RealtimeClient=class{#e;#t=null;#n=null;#r=null;constructor(e){this.#e=e}async connect(e){let t=new RTCPeerConnection;this.#t=t;let n=document.createElement(`audio`);n.autoplay=!0,n.setAttribute(`playsinline`,`true`),n.playsInline=!0,n.setAttribute(`aria-hidden`,`true`),n.style.display=`none`,document.body.appendChild(n),this.#r=n,t.ontrack=e=>{n.srcObject=e.streams[0]??null,n.play().catch(e=>{console.warn(`[page-agent voice] remote audio playback blocked`,e)})},t.addTrack(e.track);let r=t.createDataChannel(`oai-events`);this.#n=r;let i=new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`session timeout`)),READY_TIMEOUT_MS);r.onmessage=t=>{let r=parseServerEvent(String(t.data));r.type===`ready`&&(clearTimeout(n),e()),this.#e.onEvent(r)}});r.onclose=()=>this.#e.onClosed();let a=await t.createOffer();await t.setLocalDescription(a);let o=new FormData;o.set(`sdp`,a.sdp??``),o.set(`session`,callSessionConfig(e.settings));let s=await fetch(CALLS_URL,{method:`POST`,headers:{Authorization:`Bearer ${e.apiKey}`},body:o});if(!s.ok)throw Error(`realtime call failed: ${s.status}`);await t.setRemoteDescription({type:`answer`,sdp:await s.text()}),await i}send(e){this.#n?.readyState===`open`&&this.#n.send(e)}async replaceTrack(e){await(this.#t?.getSenders().find(e=>e.track===null||e.track.kind===`audio`))?.replaceTrack(e)}close(){this.#n?.close(),this.#t?.close(),this.#r?.remove(),this.#n=null,this.#t=null,this.#r=null}},voice_default=`You are the voice of a web assistant that works on the website the user is looking at. You talk with the user; the page agent carries out page tasks.
357
357
 
358
358
  - Reply in the language set by the panel, in short sentences.
359
359
  - Answer greetings, small talk and anything you can answer without the page. Do not use a tool for them.
360
360
  - Before you call a tool, say nothing. After a tool result, say only its result in one short sentence.
361
- - To skim the page tree in pieces, call get_context with optional y_min/y_max (document Y in CSS pixels) or query. Omit both Y bounds to read the current viewport band.
361
+ - To skim the page tree in pieces, call get_context with optional y_min/y_max (document Y in CSS pixels) or query. Omit both Y bounds to read the current viewport band. Prefer a narrow band or a query over a huge slice. get_context also returns the active task and recent steps — use that before guessing.
362
362
  - To check or change the page yourself with a script, write ONE execute_javascript script that does the whole job. Prefer get_context for reading. \`await agent.pageController.getState()\` reads the page only when it was never read or the last read is older than 10 seconds.
363
363
  - For any task that changes the page or needs several steps, call run_task with the user's request exactly as the user said it. Do not rewrite it, do not add context, do not interpret it. The agent understands the request and asks the user when it needs more.
364
364
  - Never call agent.execute yourself.
365
365
  - When the agent asks a question (report kind question), speak that question. When the user answers, call answer_question with their answer exactly (or the chosen option label). Do not call run_task for that answer.
366
- - After run_task starts, do not use execute_javascript on the page until the agent reports a result. get_context and answer_question remain allowed. Tell the user the task started; do not say it finished.
367
- - If a tool says the agent is busy, say so and suggest trying again when the task ends.
366
+ - After run_task starts, do not use execute_javascript on the page until the agent reports a result. get_context and answer_question remain allowed. If the user speaks a correction or extra detail while a task is running and there is no pending question, call run_task with their words exactly — the panel delivers it as a note to the running agent.
367
+ - If a tool says the agent is busy, say so once. Do not keep calling tools in a loop.
368
368
  - If the user asks to stop, tell them to press the stop button in the panel.
369
369
  - When the agent reports a result, say it in one sentence, without technical details, element indexes or markers such as [End of page].
370
370
  - Never say an action was done or a check passed unless a tool result or the agent reported it.
371
- `;function languageRule(e){return`Always reply in ${e===`pt-BR`?`Brazilian Portuguese`:`English`}, whatever language the user speaks. The panel's language is fixed.`}function resolveVoicePrompt(e,t=!1){let n=e?.trim();return n?t?n:`${voice_default}\n\n${n}`:voice_default}var BUSY_OUTPUT=`O agente está ocupado com outra tarefa. Avise o usuário e não repita o pedido agora.`,STARTED_OUTPUT=`Tarefa iniciada no agente. Confirme ao usuário em uma frase.`,NO_PENDING_QUESTION_OUTPUT=`Não há pergunta pendente do agente. Se o usuário pediu uma tarefa, use run_task.`,ANSWERED_OUTPUT=`Resposta enviada ao agente. Confirme ao usuário em uma frase.`;function isHarmlessCancelError(e){return/cancel/i.test(e)}var VoiceSession=class{#e;#t=`off`;#n=null;#r=null;#i=!1;#a=[];constructor(e){this.#e=e}get state(){return this.#t}get error(){return this.#n}get muted(){return this.#t===`muted`}async enable(){let{apiKey:e,mic:t}=this.#e;if(!e)return this.#f(`no-key`);if(this.#i=!0,this.#n=null,this.#p(`connecting`),await t.enable(),!this.#i)return;if(t.state===`denied`)return this.#f(`mic-denied`);if(t.state===`busy`)return this.#f(`mic-busy`);if(t.state===`unsupported`)return this.#f(`mic-unsupported`);let n=t.stream?.getAudioTracks()[0];if(!n)return this.#f(`mic-denied`);let r=this.#e.createClient({onEvent:e=>this.#o(e),onClosed:()=>this.#f(`connect-failed`)});this.#r=r;try{await r.connect({apiKey:e,settings:this.#e.settings,track:n})}catch{this.#r=null,this.#f(`connect-failed`);return}this.#i&&this.#t===`connecting`&&this.#p(`listening`)}async changeInput(){if(this.#t!==`listening`&&this.#t!==`speaking`&&this.#t!==`connecting`||!await this.#e.mic.cycleInput())return!1;let e=this.#e.mic.stream?.getAudioTracks()[0];return e?(await this.#r?.replaceTrack(e),this.#e.onChange(),!0):(this.#f(`mic-denied`),!1)}disable(){this.#i=!1,this.#a=[],this.#r?.close(),this.#r=null,this.#e.mic.disable(),this.#n=null,this.#p(`off`)}async setMuted(e){if(e){this.#t===`speaking`&&this.#r?.send(cancelResponseCommand()),this.#a=[],this.#e.mic.setMuted(!0),await this.#r?.replaceTrack(null),this.#p(`muted`);return}this.#e.mic.setMuted(!1),await this.#e.mic.enable();let t=this.#e.mic.stream?.getAudioTracks()[0];t&&await this.#r?.replaceTrack(t),this.#p(`listening`)}report(e){if(!(!this.#r||this.#t!==`listening`&&this.#t!==`speaking`)&&e.text.trim()){if(this.#t===`speaking`){this.#a.push(e);return}this.#r.send(reportCommand(e)),this.#p(`speaking`)}}#o(e){if(this.#t!==`off`&&this.#t!==`muted`)switch(e.type){case`ready`:this.#t===`connecting`&&this.#p(`listening`);return;case`transcript`:return;case`speech_started`:return;case`response_started`:this.#p(`speaking`);return;case`response_done`:this.#d();return;case`tool_call`:this.#s(e.name,e.callId,e.args);return;case`error`:if(isHarmlessCancelError(e.message))return;this.#f(`connect-failed`);return;default:return}}#s(e,t,n){if(e===`answer_question`){let e=typeof n.answer==`string`?n.answer.trim():``;if(!e)return;let r=this.#e.onAnswer?.(e)??!1;this.#l(t,r?ANSWERED_OUTPUT:NO_PENDING_QUESTION_OUTPUT);return}if(e===`run_task`){let e=typeof n.task==`string`?n.task.trim():``;if(!e)return;if(this.#e.isWaitingForAnswer?.()){let n=this.#e.onAnswer?.(e)??this.#e.onTask(e);this.#l(t,n?ANSWERED_OUTPUT:NO_PENDING_QUESTION_OUTPUT);return}this.#l(t,this.#e.onTask(e)?STARTED_OUTPUT:BUSY_OUTPUT);return}if(e===`get_context`){if(!this.#e.onGetContext){this.#l(t,`get_context is not available in this session.`);return}this.#c(t,n);return}if(e===`execute_javascript`){let e=typeof n.script==`string`?n.script:``;if(!this.#e.onScript){this.#l(t,`Running scripts is not available in this session.`);return}if(!e){this.#l(t,`No script was given.`);return}this.#u(t,e)}}async#c(e,t){let n=this.#r,r=this.#e.onGetContext;if(!n||!r)return;let i=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,a;try{a=await r({yMin:i(t.y_min),yMax:i(t.y_max),maxLines:i(t.max_lines),query:typeof t.query==`string`?t.query:void 0})}catch(e){a=`get_context failed: ${e instanceof Error?e.message:`unknown error`}`}this.#r===n&&this.#l(e,a.slice(0,2500))}#l(e,t){for(let n of toolResultCommands(e,t))this.#r?.send(n);this.#p(`speaking`)}async#u(e,t){let n=this.#r,r=this.#e.onScript;if(!n||!r)return;let i;try{i=await r(t)}catch(e){i=`The script failed: ${e instanceof Error?e.message:`unknown error`}`}this.#r===n&&this.#l(e,i)}#d(){if(this.#t!==`speaking`)return;let e=this.#a.shift();if(e){this.#r?.send(reportCommand(e));return}this.#p(`listening`)}#f(e){this.#n=e,this.#i=!1,this.#a=[],this.#r?.close(),this.#r=null,this.#e.mic.disable(),this.#p(`error`)}#p(e){this.#t!==e&&(this.#t=e,this.#e.onChange())}};function truncate(e,t){return e.length>t?e.substring(0,t)+`...`:e}var wrapper=`_wrapper_1jypc_3`,collapsed=`_collapsed_1jypc_80`,feedWrap=`_feedWrap_1jypc_80`,followBar=`_followBar_1jypc_85`,followBarBody=`_followBarBody_1jypc_95`,followBarStatus=`_followBarStatus_1jypc_110`,followBarLens=`_followBarLens_1jypc_120`,voiceActions=`_voiceActions_1jypc_130`,header=`_header_1jypc_148`,brand=`_brand_1jypc_161`,titleBlock=`_titleBlock_1jypc_185`,title=`_title_1jypc_185`,status=`_status_1jypc_200`,controls=`_controls_1jypc_208`,iconButton=`_iconButton_1jypc_214`,stopButton=`_stopButton_1jypc_232`,feed=`_feed_1jypc_80`,rail=`_rail_1jypc_263`,railThumb=`_railThumb_1jypc_294`,railMark=`_railMark_1jypc_303`,divider=`_divider_1jypc_373`,peek=`_peek_1jypc_393`,peekIn=`_peekIn_1jypc_1`,peekHead=`_peekHead_1jypc_421`,peekText=`_peekText_1jypc_436`,pin=`_pin_1jypc_449`,jump=`_jump_1jypc_482`,jumpIn=`_jumpIn_1jypc_1`,empty=`_empty_1jypc_523`,enter=`_enter_1jypc_531`,bubble=`_bubble_1jypc_546`,line$1=`_line_1jypc_556`,reflection=`_reflection_1jypc_563`,observation=`_observation_1jypc_568`,warning=`_warning_1jypc_572`,live=`_live_1jypc_576`,pulse=`_pulse_1jypc_1`,tool=`_tool_1jypc_605`,toolHead=`_toolHead_1jypc_622`,toolDot=`_toolDot_1jypc_628`,toolLabel$1=`_toolLabel_1jypc_636`,toolDetail=`_toolDetail_1jypc_641`,spinner$1=`_spinner_1jypc_649`,spin=`_spin_1jypc_649`,question=`_question_1jypc_667`,questionTag=`_questionTag_1jypc_672`,questionText=`_questionText_1jypc_680`,result=`_result_1jypc_685`,resultText=`_resultText_1jypc_712`,composer=`_composer_1jypc_720`,answerContext=`_answerContext_1jypc_729`,choiceRow=`_choiceRow_1jypc_738`,choiceChip=`_choiceChip_1jypc_744`,choiceConfirm=`_choiceConfirm_1jypc_769`,box=`_box_1jypc_788`,actions=`_actions_1jypc_827`,attachList=`_attachList_1jypc_833`,attachChip=`_attachChip_1jypc_840`,attachName=`_attachName_1jypc_852`,attachRemove=`_attachRemove_1jypc_859`,attachError=`_attachError_1jypc_883`,roundButton=`_roundButton_1jypc_889`,send=`_send_1jypc_907`,studio=`_studio_1jypc_920`,studioHeader=`_studioHeader_1jypc_930`,studioTitle=`_studioTitle_1jypc_937`,studioTabs=`_studioTabs_1jypc_942`,studioTab=`_studioTab_1jypc_942`,studioBody=`_studioBody_1jypc_964`,studioHint=`_studioHint_1jypc_973`,studioToolbar=`_studioToolbar_1jypc_980`,studioToolButton=`_studioToolButton_1jypc_986`,studioStatus=`_studioStatus_1jypc_1012`,studioAsk=`_studioAsk_1jypc_1032`,studioSteps=`_studioSteps_1jypc_1050`,studioCatalog=`_studioCatalog_1jypc_1051`,studioStep=`_studioStep_1jypc_1050`,studioCatalogRow=`_studioCatalogRow_1jypc_1063`,studioWatchers=`_studioWatchers_1jypc_1078`,studioWatchersHead=`_studioWatchersHead_1jypc_1088`,studioWatchersTitle=`_studioWatchersTitle_1jypc_1095`,studioWatchersEmpty=`_studioWatchersEmpty_1jypc_1103`,studioWatchersList=`_studioWatchersList_1jypc_1109`,studioWatcherChip=`_studioWatcherChip_1jypc_1118`,studioWatcherLabel=`_studioWatcherLabel_1jypc_1131`,studioWatcherMeta=`_studioWatcherMeta_1jypc_1139`,studioStepBody=`_studioStepBody_1jypc_1162`,studioCatalogBody=`_studioCatalogBody_1jypc_1163`,studioStepKind=`_studioStepKind_1jypc_1168`,studioStepMeta=`_studioStepMeta_1jypc_1180`,studioCatalogMeta=`_studioCatalogMeta_1jypc_1181`,studioStepActions=`_studioStepActions_1jypc_1186`,studioCatalogActions=`_studioCatalogActions_1jypc_1187`,studioPreviewLabel=`_studioPreviewLabel_1jypc_1230`,studioPreview=`_studioPreview_1jypc_1230`,voice=`_voice_1jypc_130`,voiceMeta=`_voiceMeta_1jypc_1268`,lens=`_lens_1jypc_1276`,breathe=`_breathe_1jypc_1`,voiceText=`_voiceText_1jypc_1320`,micDevice=`_micDevice_1jypc_1329`,textButton=`_textButton_1jypc_1358`,fab=`_fab_1jypc_1377`,fabLeft=`_fabLeft_1jypc_1421`,tip=`_tip_1jypc_1427`,tipUp=`_tipUp_1jypc_1450`,code=`_code_1jypc_1820`,codeHead=`_codeHead_1jypc_1838`,codeTitle=`_codeTitle_1jypc_1845`,codeMeta=`_codeMeta_1jypc_1850`,codeStatus=`_codeStatus_1jypc_1860`,codeBadge=`_codeBadge_1jypc_1870`,codeSection=`_codeSection_1jypc_1880`,codeLabel=`_codeLabel_1jypc_1885`,clip=`_clip_1jypc_1894`,codeBlock$1=`_codeBlock_1jypc_1899`,resultBlock=`_resultBlock_1jypc_1900`,clipBody=`_clipBody_1jypc_1917`,clipToggle=`_clipToggle_1jypc_1940`,tkComment=`_tkComment_1jypc_1959`,tkString=`_tkString_1jypc_1964`,tkNumber=`_tkNumber_1jypc_1968`,tkKeyword=`_tkKeyword_1jypc_1972`,tkName=`_tkName_1jypc_1976`,tkPunct=`_tkPunct_1jypc_1980`,tkKey=`_tkKey_1jypc_1972`,tkBool=`_tkBool_1jypc_1988`,foldHead=`_foldHead_1jypc_2000`,foldBody=`_foldBody_1jypc_2023`,foldInner=`_foldInner_1jypc_2029`,fold=`_fold_1jypc_2000`,toolState=`_toolState_1jypc_2043`,codeRunning=`_codeRunning_1jypc_2057`,codeDot=`_codeDot_1jypc_2058`,pop=`_pop_1jypc_1`,toolChip=`_toolChip_1jypc_2154`,toolSummary=`_toolSummary_1jypc_2165`,Panel_module_default={wrapper,collapsed,feedWrap,followBar,followBarBody,followBarStatus,followBarLens,voiceActions,header,brand,titleBlock,title,status,controls,iconButton,stopButton,feed,rail,railThumb,railMark,divider,peek,peekIn,peekHead,peekText,pin,jump,jumpIn,empty,enter,bubble,line:line$1,reflection,observation,warning,live,pulse,tool,toolHead,toolDot,toolLabel:toolLabel$1,toolDetail,spinner:spinner$1,spin,question,questionTag,questionText,result,resultText,composer,answerContext,choiceRow,choiceChip,choiceConfirm,box,actions,attachList,attachChip,attachName,attachRemove,attachError,roundButton,send,studio,studioHeader,studioTitle,studioTabs,studioTab,studioBody,studioHint,studioToolbar,studioToolButton,studioStatus,studioAsk,studioSteps,studioCatalog,studioStep,studioCatalogRow,studioWatchers,studioWatchersHead,studioWatchersTitle,studioWatchersEmpty,studioWatchersList,studioWatcherChip,studioWatcherLabel,studioWatcherMeta,studioStepBody,studioCatalogBody,studioStepKind,studioStepMeta,studioCatalogMeta,studioStepActions,studioCatalogActions,studioPreviewLabel,studioPreview,voice,voiceMeta,lens,breathe,voiceText,micDevice,textButton,fab,fabLeft,tip,tipUp,code,codeHead,codeTitle,codeMeta,codeStatus,codeBadge,codeSection,codeLabel,clip,codeBlock:codeBlock$1,resultBlock,clipBody,clipToggle,tkComment,tkString,tkNumber,tkKeyword,tkName,tkPunct,tkKey,tkBool,foldHead,foldBody,foldInner,fold,toolState,codeRunning,codeDot,pop,toolChip,toolSummary},openCards=new Set;function foldable(e,t,n,r){let i=document.createElement(`div`);i.className=r;let a=openCards.has(n);i.dataset.open=String(a),e.classList.add(Panel_module_default.foldHead),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-expanded`,String(a));let o=()=>{let t=i.dataset.open!==`true`;i.dataset.open=String(t),e.setAttribute(`aria-expanded`,String(t)),t?openCards.add(n):openCards.delete(n)};e.addEventListener(`click`,o),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())});let s=document.createElement(`div`);s.className=Panel_module_default.foldInner,s.append(t);let c=document.createElement(`div`);return c.className=Panel_module_default.foldBody,c.append(s),i.append(e,c),i}var PATHS={code:`<path d="M8 8l-4 4 4 4"/><path d="M16 8l4 4-4 4"/><path d="M14 5l-4 14"/>`,scroll:`<path d="M12 4v16"/><path d="M8 8l4-4 4 4"/><path d="M8 16l4 4 4-4"/>`,clock:`<circle cx="12" cy="12" r="8"/><path d="M12 8v4l2.5 2"/>`,check:`<path d="M5 12.5l4.5 4.5L19 7.5"/>`,question:`<circle cx="12" cy="12" r="8"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.4-1 .9-1 1.7"/><path d="M12 17h.01"/>`,list:`<path d="M9 6h11M9 12h11M9 18h11"/><path d="M4 6h.01M4 12h.01M4 18h.01"/>`,cursor:`<path d="M4 4l6.5 16 2.5-6.5L19.5 11z"/>`,cursorOff:`<path d="M4 4l6.5 16 2.5-6.5L19.5 11z"/><path d="M3 3l18 18"/>`,chevronUp:`<path d="M6 15l6-6 6 6"/>`,chevronDown:`<path d="M6 9l6 6 6-6"/>`,close:`<path d="M6 6l12 12M18 6L6 18"/>`,stop:`<rect x="6" y="6" width="12" height="12" rx="2"/>`,mic:`<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>`,micOff:`<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/><path d="M3 3l18 18"/>`,keyboard:`<rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10"/>`,send:`<path d="M12 19V5"/><path d="M5 12l7-7 7 7"/>`,arrowDown:`<path d="M12 5v14"/><path d="M6 13l6 6 6-6"/>`,bookmark:`<path d="M6 3h12v18l-6-4-6 4z"/>`,download:`<path d="M12 4v11"/><path d="M7 10l5 5 5-5"/><path d="M5 20h14"/>`,paperclip:`<path d="M15.5 7.5l-6.8 6.8a2.5 2.5 0 0 0 3.5 3.5l7.2-7.2a4 4 0 0 0-5.7-5.7L6.2 12.4a5.5 5.5 0 0 0 7.8 7.8l6-6"/>`,skills:`<path d="M12 3l2.2 4.5L19 9l-3.5 3.4L16.4 18 12 15.6 7.6 18l.9-5.6L5 9l4.8-1.5L12 3z"/><circle cx="12" cy="12" r="2"/>`,spark:`<path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z"/>`};function icon(e){return`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${PATHS[e]}</svg>`}var JS_KEYWORDS=new Set(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.function.if.import.in.instanceof.let.new.of.return.switch.throw.try.typeof.var.void.while.yield.true.false.null.undefined.this`.split(`.`)),JS_TOKEN=/\/\/[^\n]*|\/\*[\s\S]*?(?:\*\/|$)|'(?:[^'\\\n]|\\.)*'?|"(?:[^"\\\n]|\\.)*"?|`(?:[^`\\]|\\.)*`?|\d+(?:\.\d+)?|[A-Za-z_$][\w$]*|\s+|[\s\S]/g;function jsTokens(e){let t=[];for(let n of e.matchAll(JS_TOKEN)){let e=n[0];t.push({kind:classifyJs(e),text:e})}return t}function classifyJs(e){if(e.startsWith(`//`)||e.startsWith(`/*`))return`comment`;let t=e[0];return t===`'`||t===`"`||t==="`"?`string`:/^\d/.test(e)?`number`:/^[A-Za-z_$]/.test(e)?JS_KEYWORDS.has(e)?`keyword`:`name`:/^\s+$/.test(e)?`plain`:`punct`}var JSON_TOKEN=/"(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null|\s+|[\s\S]/g;function jsonTokens(e){let t;try{t=JSON.parse(e)}catch{return null}let n=JSON.stringify(t,null,2)??`undefined`,r=[];for(let e of n.matchAll(JSON_TOKEN)){let t=e[0],i=(e.index??0)+t.length;r.push({kind:classifyJson(t,n.slice(i)),text:t})}return r}function classifyJson(e,t){return e.startsWith(`"`)?/^\s*:/.test(t)?`key`:`string`:e===`true`||e===`false`?`bool`:e===`null`?`null`:/^-?\d/.test(e)?`number`:/^\s+$/.test(e)?`plain`:`punct`}function plainTokens(e){return[{kind:`plain`,text:e}]}var OK_PREFIX=`✅ Executed JavaScript. Result: `,ERROR_PREFIX=`❌ Error executing JavaScript: `,TOKEN_CLASS={plain:``,comment:Panel_module_default.tkComment,string:Panel_module_default.tkString,number:Panel_module_default.tkNumber,keyword:Panel_module_default.tkKeyword,name:Panel_module_default.tkName,punct:Panel_module_default.tkPunct,key:Panel_module_default.tkKey,bool:Panel_module_default.tkBool,null:Panel_module_default.tkBool};function parseScriptOutput(e){return e.startsWith(OK_PREFIX)?{ok:!0,value:e.slice(31)}:e.startsWith(ERROR_PREFIX)?{ok:!1,value:e.slice(30)}:{ok:!0,value:e}}function codeBlock(e,t){let n=document.createElement(`pre`);n.className=t;for(let t of e){let e=TOKEN_CLASS[t.kind];if(!e){n.append(t.text);continue}let r=document.createElement(`span`);r.className=e,r.textContent=t.text,n.append(r)}return n}function previewBlock(e,t,n){let r=document.createElement(`div`);r.className=Panel_module_default.clip,r.dataset.open=`false`;let i=codeBlock(e,`${t} ${Panel_module_default.clipBody}`),a=document.createElement(`button`);a.type=`button`,a.className=Panel_module_default.clipToggle,a.hidden=!0,a.textContent=n(`ui.panel.codeShowMore`);let o=()=>{let e=r.dataset.open!==`true`;r.dataset.open=String(e),a.textContent=n(e?`ui.panel.codeShowLess`:`ui.panel.codeShowMore`)};return i.addEventListener(`click`,o),a.addEventListener(`click`,o),r.append(i,a),requestAnimationFrame(()=>{let e=i.scrollHeight>i.clientHeight+1;r.dataset.clipped=String(e),a.hidden=!e}),r}function section(e,t){let n=document.createElement(`div`);n.className=Panel_module_default.codeSection;let r=document.createElement(`small`);return r.className=Panel_module_default.codeLabel,r.textContent=e,n.append(r,t),n}function scriptCard(e){let{script:t,output:n,t:r,source:i=`agent`,refused:a=!1,time:o,key:s}=e,c=n===void 0?null:parseScriptOutput(n),l=a?`refused`:c===null?`running`:c.ok?`done`:`error`,u=document.createElement(`div`);u.className=Panel_module_default.codeHead;let d=document.createElement(`span`);d.className=Panel_module_default.codeTitle,d.textContent=r(`ui.panel.codeTitle`);let f=document.createElement(`span`);if(f.className=Panel_module_default.codeMeta,i===`voice`){let e=document.createElement(`span`);e.className=Panel_module_default.codeBadge,e.textContent=r(`ui.panel.codeVoice`),f.append(e)}o&&f.append(o);let p=document.createElement(`span`);p.className=Panel_module_default.codeStatus,p.textContent=r(l===`running`?`ui.panel.codeRunning`:l===`done`?`ui.panel.codeDone`:l===`refused`?`ui.panel.codeRefused`:`ui.panel.codeFailed`);let m=document.createElement(`span`);m.className=Panel_module_default.toolChip,m.innerHTML=icon(`code`),u.append(m,d,f,p);let h=document.createElement(`div`);if(h.append(section(r(`ui.panel.codeScript`),previewBlock(jsTokens(t),Panel_module_default.codeBlock,r))),a&&n!==void 0)h.append(section(r(`ui.panel.codeRefused`),previewBlock(plainTokens(n),Panel_module_default.resultBlock,r)));else if(c){let e=c.value,t=c.ok?jsonTokens(e)??plainTokens(e):plainTokens(e),n=r(c.ok?`ui.panel.codeResult`:`ui.panel.codeError`);h.append(section(n,previewBlock(t,Panel_module_default.resultBlock,r)))}let g=foldable(u,h,s,Panel_module_default.code);return g.dataset.status=l,g.dataset.tone=`js`,g}var textOf=e=>typeof e==`string`||typeof e==`number`?String(e):``,indexOf=e=>{let t=e?.index;return typeof t==`number`?`#${t}`:``};function toolVisual(e,t,n){let r=t??{};switch(e){case`execute_javascript`:return{icon:`code`,tone:`js`,summary:``};case`run_task`:return{icon:`spark`,tone:`task`,summary:truncate(textOf(r.task),32)};case`scroll`:{let e=/([\d.]+)px/.exec(n??``)?.[1];return{icon:`scroll`,tone:`move`,summary:e?`${Math.round(Number(e))} px`:``}}case`click_element_by_index`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`hover_element`:return{icon:`cursor`,tone:`move`,summary:indexOf(t)};case`double_click_element`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`press_key`:return{icon:`keyboard`,tone:`act`,summary:truncate(textOf(r.key),24)};case`focus_element`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`set_checked`:return{icon:`check`,tone:`act`,summary:`${indexOf(t)} ${r.checked===!1?`off`:`on`}`.trim()};case`set_range`:return{icon:`list`,tone:`act`,summary:`${indexOf(t)} ${textOf(r.value)}`.trim()};case`scroll_into_view`:return{icon:`scroll`,tone:`move`,summary:indexOf(t)};case`wheel`:return{icon:`scroll`,tone:`move`,summary:textOf(r.delta_y)||indexOf(t)};case`drag_element`:{let e=t?.source_index,n=t?.target_index;return{icon:`cursor`,tone:`move`,summary:typeof e==`number`&&typeof n==`number`?`#${e} → #${n}`:``}}case`input_text`:return{icon:`keyboard`,tone:`act`,summary:indexOf(t)};case`select_dropdown_option`:return{icon:`list`,tone:`act`,summary:truncate(textOf(r.text),24)};case`wait`:return{icon:`clock`,tone:`time`,summary:textOf(r.seconds)?`${textOf(r.seconds)}s`:``};case`done`:return{icon:`check`,tone:`done`,summary:r.success===!1?`não`:`ok`};case`ask_user`:return{icon:`question`,tone:`ask`,summary:truncate(textOf(r.question),32)};case`get_context`:{let e=textOf(r.y_min),t=textOf(r.y_max);return{icon:`list`,tone:`generic`,summary:truncate(e||t?`${e||`0`}–${t||`…`}`:`viewport`,24)}}default:return{icon:`spark`,tone:`generic`,summary:``}}}function localizeCore(e,t){let n;return e===`Task aborted`?t(`ui.panel.msgAborted`):e===`Task completed`?t(`ui.panel.msgCompleted`):e===`Step count exceeded maximum limit`?t(`ui.panel.msgStepLimit`):(n=/^LLM retry attempt (\d+) of (\d+)$/.exec(e))?t(`ui.panel.msgRetry`,{attempt:n[1],max:n[2]}):(n=/^Page navigated to → (.*)$/.exec(e))?t(`ui.panel.msgNavigated`,{url:n[1]}):(n=/^You have waited (\d+) seconds accumulatively/.exec(e))?t(`ui.panel.msgWaited`,{seconds:n[1]}):(n=/^⚠️ Only (\d+) steps remaining/.exec(e))?t(`ui.panel.msgStepsLeft`,{count:n[1]}):(n=/^⚠️ Critical: Only (\d+) steps left/.exec(e))?t(`ui.panel.msgStepsCritical`,{count:n[1]}):e}function node(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}function spinner(){return node(`span`,Panel_module_default.spinner)}function toolLabel(e,t,n){let r=t??{};switch(e){case`click_element_by_index`:return n(`ui.tools.clicking`,{index:r.index});case`input_text`:return n(`ui.tools.inputting`,{index:r.index});case`select_dropdown_option`:return n(`ui.tools.selecting`,{text:r.text});case`scroll`:return n(`ui.tools.scrolling`);case`wait`:return n(`ui.tools.waiting`,{seconds:r.seconds});case`ask_user`:return n(`ui.tools.askingUser`);case`done`:return n(`ui.tools.done`);default:return n(`ui.tools.executing`,{toolName:e})}}function stepPrefix(e,t){return e.type===`step`&&e.stepIndex!==void 0?t(`ui.panel.step`,{number:String(e.stepIndex+1)}):void 0}function userBubble(e){return node(`div`,Panel_module_default.bubble,e)}function line(e,t=``){return node(`div`,`${Panel_module_default.line} ${t}`.trim(),e)}function toolCard(e,t,n,r,i={icon:`spark`,tone:`generic`,summary:``}){let a=node(`span`,Panel_module_default.toolChip);a.innerHTML=icon(i.icon);let o=node(`div`,Panel_module_default.toolHead);o.append(a,node(`span`,Panel_module_default.toolLabel,e),node(`span`,Panel_module_default.toolSummary,i.summary),n===`running`?spinner():node(`span`,Panel_module_default.toolState,n===`error`?`!`:`✓`));let s=node(`div`,``);t&&s.append(node(`div`,Panel_module_default.toolDetail,truncate(t,240)));let c=foldable(o,s,r,Panel_module_default.tool);return c.dataset.status=n,c.dataset.tone=i.tone,c}function questionCard(e,t,n){let r=node(`div`,Panel_module_default.question);return r.dataset.pending=String(n),r.append(node(`small`,Panel_module_default.questionTag,t(`ui.panel.questionTitle`)),node(`p`,Panel_module_default.questionText,e)),r}function markedQuestion(e,t,n){let r=questionCard(e,t,n);return r.dataset.mark=`question`,r}function resultCard(e,t,n){let r={done:`ui.panel.resultDone`,notDone:`ui.panel.resultNotDone`,stopped:`ui.panel.resultStopped`,error:`ui.panel.resultError`},i=node(`div`,Panel_module_default.result);return i.dataset.kind=e,i.append(node(`strong`,``,n(r[e]))),t&&i.append(node(`div`,Panel_module_default.resultText,localizeCore(t,n))),i}function buildFeed(e,t){let n=[];if(e.task){let t=userBubble(e.task);t.dataset.mark=`turn`,n.push(t)}let r=e.key??`current`;for(let[i,a]of e.history.entries()){let e=stepPrefix(a,t);if(a.type===`step`){let o=a.reflection;if(o){let e=[];o.evaluation_previous_goal&&e.push(`${t(`ui.panel.evaluation`)}: ${o.evaluation_previous_goal}`),o.memory&&e.push(`${t(`ui.panel.memory`)}: ${o.memory}`),o.next_goal&&e.push(`${t(`ui.panel.nextGoal`)}: ${o.next_goal}`),e.length&&n.push(line(e.join(`
371
+ `;function languageRule(e){return`Always reply in ${e===`pt-BR`?`Brazilian Portuguese`:`English`}, whatever language the user speaks. The panel's language is fixed.`}function resolveVoicePrompt(e,t=!1){let n=e?.trim();return n?t?n:`${voice_default}\n\n${n}`:voice_default}var BUSY_OUTPUT=`O agente está ocupado com outra tarefa. Avise o usuário e não repita o pedido agora.`,STARTED_OUTPUT=`Tarefa iniciada no agente. Confirme ao usuário em uma frase.`,NOTE_OUTPUT=`Mensagem do usuário entregue ao agente em execução. Confirme ao usuário em uma frase.`,NO_PENDING_QUESTION_OUTPUT=`Não há pergunta pendente do agente. Se o usuário pediu uma tarefa, use run_task.`,ANSWERED_OUTPUT=`Resposta enviada ao agente. Confirme ao usuário em uma frase.`,EMPTY_TASK_OUTPUT=`No task was given. Ask the user what to do, then call run_task.`,EMPTY_ANSWER_OUTPUT=`No answer was given. Ask the user again, then call answer_question with their reply.`,DEFAULT_CONTEXT_TIMEOUT_MS=8e3;function isHarmlessCancelError(e){return/cancel/i.test(e)}var VoiceSession=class{#e;#t=`off`;#n=null;#r=null;#i=!1;#a=[];constructor(e){this.#e=e}get state(){return this.#t}get error(){return this.#n}get muted(){return this.#t===`muted`}async enable(){let{apiKey:e,mic:t}=this.#e;if(!e)return this.#f(`no-key`);if(this.#i=!0,this.#n=null,this.#p(`connecting`),await t.enable(),!this.#i)return;if(t.state===`denied`)return this.#f(`mic-denied`);if(t.state===`busy`)return this.#f(`mic-busy`);if(t.state===`unsupported`)return this.#f(`mic-unsupported`);let n=t.stream?.getAudioTracks()[0];if(!n)return this.#f(`mic-denied`);let r=this.#e.createClient({onEvent:e=>this.#o(e),onClosed:()=>this.#f(`connect-failed`)});this.#r=r;try{await r.connect({apiKey:e,settings:this.#e.settings,track:n})}catch{this.#r=null,this.#f(`connect-failed`);return}this.#i&&this.#t===`connecting`&&this.#p(`listening`)}async changeInput(){if(this.#t!==`listening`&&this.#t!==`speaking`&&this.#t!==`connecting`||!await this.#e.mic.cycleInput())return!1;let e=this.#e.mic.stream?.getAudioTracks()[0];return e?(await this.#r?.replaceTrack(e),this.#e.onChange(),!0):(this.#f(`mic-denied`),!1)}disable(){this.#i=!1,this.#a=[],this.#r?.close(),this.#r=null,this.#e.mic.disable(),this.#n=null,this.#p(`off`)}async setMuted(e){if(e){this.#t===`speaking`&&this.#r?.send(cancelResponseCommand()),this.#a=[],this.#e.mic.setMuted(!0),await this.#r?.replaceTrack(null),this.#p(`muted`);return}this.#e.mic.setMuted(!1),await this.#e.mic.enable();let t=this.#e.mic.stream?.getAudioTracks()[0];t&&await this.#r?.replaceTrack(t),this.#p(`listening`)}report(e){if(!(!this.#r||this.#t!==`listening`&&this.#t!==`speaking`)&&e.text.trim()){if(this.#t===`speaking`){this.#a.push(e);return}this.#r.send(reportCommand(e)),this.#p(`speaking`)}}#o(e){if(this.#t!==`off`&&this.#t!==`muted`)switch(e.type){case`ready`:this.#t===`connecting`&&this.#p(`listening`);return;case`transcript`:return;case`speech_started`:return;case`response_started`:this.#p(`speaking`);return;case`response_done`:this.#d();return;case`tool_call`:this.#s(e.name,e.callId,e.args);return;case`error`:if(isHarmlessCancelError(e.message))return;this.#f(`connect-failed`);return;default:return}}#s(e,t,n){if(e===`answer_question`){let e=typeof n.answer==`string`?n.answer.trim():``;if(!e){this.#l(t,EMPTY_ANSWER_OUTPUT);return}let r=this.#e.onAnswer?.(e)??!1;this.#l(t,r?ANSWERED_OUTPUT:NO_PENDING_QUESTION_OUTPUT);return}if(e===`run_task`){let e=typeof n.task==`string`?n.task.trim():``;if(!e){this.#l(t,EMPTY_TASK_OUTPUT);return}if(this.#e.isWaitingForAnswer?.()){let n=this.#e.onAnswer?.(e)??this.#e.onTask(e);this.#l(t,n?ANSWERED_OUTPUT:NO_PENDING_QUESTION_OUTPUT);return}if(this.#e.onTask(e)){this.#l(t,STARTED_OUTPUT);return}if(this.#e.onNote?.(e)){this.#l(t,NOTE_OUTPUT);return}this.#l(t,BUSY_OUTPUT);return}if(e===`get_context`){if(!this.#e.onGetContext){this.#l(t,`get_context is not available in this session.`);return}this.#c(t,n);return}if(e===`execute_javascript`){let e=typeof n.script==`string`?n.script:``;if(!this.#e.onScript){this.#l(t,`Running scripts is not available in this session.`);return}if(!e){this.#l(t,`No script was given.`);return}this.#u(t,e);return}this.#l(t,`Unknown tool ${e}.`)}async#c(e,t){let n=this.#r,r=this.#e.onGetContext;if(!n||!r){this.#l(e,`get_context is not available in this session.`);return}let i=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,a=Math.max(50,this.#e.contextTimeoutMs??8e3),o;try{let e=r({yMin:i(t.y_min),yMax:i(t.y_max),maxLines:i(t.max_lines),query:typeof t.query==`string`?t.query:void 0});o=await Promise.race([e,new Promise(e=>setTimeout(()=>e(`get_context timed out. Tell the user briefly and try a smaller y band or query.`),a))])}catch(e){o=`get_context failed: ${e instanceof Error?e.message:`unknown error`}`}this.#r===n&&this.#l(e,o.slice(0,2500))}#l(e,t){for(let n of toolResultCommands(e,t))this.#r?.send(n);this.#p(`speaking`)}async#u(e,t){let n=this.#r,r=this.#e.onScript;if(!n||!r){this.#l(e,`Running scripts is not available in this session.`);return}let i;try{i=await r(t)}catch(e){i=`The script failed: ${e instanceof Error?e.message:`unknown error`}`}this.#r===n&&this.#l(e,i)}#d(){if(this.#t!==`speaking`)return;let e=this.#a.shift();if(e){this.#r?.send(reportCommand(e));return}this.#p(`listening`)}#f(e){this.#n=e,this.#i=!1,this.#a=[],this.#r?.close(),this.#r=null,this.#e.mic.disable(),this.#p(`error`)}#p(e){this.#t!==e&&(this.#t=e,this.#e.onChange())}};function truncate(e,t){return e.length>t?e.substring(0,t)+`...`:e}var wrapper=`_wrapper_1jypc_3`,collapsed=`_collapsed_1jypc_80`,feedWrap=`_feedWrap_1jypc_80`,followBar=`_followBar_1jypc_85`,followBarBody=`_followBarBody_1jypc_95`,followBarStatus=`_followBarStatus_1jypc_110`,followBarLens=`_followBarLens_1jypc_120`,voiceActions=`_voiceActions_1jypc_130`,header=`_header_1jypc_148`,brand=`_brand_1jypc_161`,titleBlock=`_titleBlock_1jypc_185`,title=`_title_1jypc_185`,status=`_status_1jypc_200`,controls=`_controls_1jypc_208`,iconButton=`_iconButton_1jypc_214`,stopButton=`_stopButton_1jypc_232`,feed=`_feed_1jypc_80`,rail=`_rail_1jypc_263`,railThumb=`_railThumb_1jypc_294`,railMark=`_railMark_1jypc_303`,divider=`_divider_1jypc_373`,peek=`_peek_1jypc_393`,peekIn=`_peekIn_1jypc_1`,peekHead=`_peekHead_1jypc_421`,peekText=`_peekText_1jypc_436`,pin=`_pin_1jypc_449`,jump=`_jump_1jypc_482`,jumpIn=`_jumpIn_1jypc_1`,empty=`_empty_1jypc_523`,enter=`_enter_1jypc_531`,bubble=`_bubble_1jypc_546`,line$1=`_line_1jypc_556`,reflection=`_reflection_1jypc_563`,observation=`_observation_1jypc_568`,warning=`_warning_1jypc_572`,live=`_live_1jypc_576`,pulse=`_pulse_1jypc_1`,tool=`_tool_1jypc_605`,toolHead=`_toolHead_1jypc_622`,toolDot=`_toolDot_1jypc_628`,toolLabel$1=`_toolLabel_1jypc_636`,toolDetail=`_toolDetail_1jypc_641`,spinner$1=`_spinner_1jypc_649`,spin=`_spin_1jypc_649`,question=`_question_1jypc_667`,questionTag=`_questionTag_1jypc_672`,questionText=`_questionText_1jypc_680`,result=`_result_1jypc_685`,resultText=`_resultText_1jypc_712`,composer=`_composer_1jypc_720`,answerContext=`_answerContext_1jypc_729`,choiceRow=`_choiceRow_1jypc_738`,choiceChip=`_choiceChip_1jypc_744`,choiceConfirm=`_choiceConfirm_1jypc_769`,box=`_box_1jypc_788`,actions=`_actions_1jypc_827`,attachList=`_attachList_1jypc_833`,attachChip=`_attachChip_1jypc_840`,attachName=`_attachName_1jypc_852`,attachRemove=`_attachRemove_1jypc_859`,attachError=`_attachError_1jypc_883`,roundButton=`_roundButton_1jypc_889`,send=`_send_1jypc_907`,studio=`_studio_1jypc_920`,studioHeader=`_studioHeader_1jypc_930`,studioTitle=`_studioTitle_1jypc_937`,studioTabs=`_studioTabs_1jypc_942`,studioTab=`_studioTab_1jypc_942`,studioBody=`_studioBody_1jypc_964`,studioHint=`_studioHint_1jypc_973`,studioToolbar=`_studioToolbar_1jypc_980`,studioToolButton=`_studioToolButton_1jypc_986`,studioStatus=`_studioStatus_1jypc_1012`,studioAsk=`_studioAsk_1jypc_1032`,studioSteps=`_studioSteps_1jypc_1050`,studioCatalog=`_studioCatalog_1jypc_1051`,studioStep=`_studioStep_1jypc_1050`,studioCatalogRow=`_studioCatalogRow_1jypc_1063`,studioWatchers=`_studioWatchers_1jypc_1078`,studioWatchersHead=`_studioWatchersHead_1jypc_1088`,studioWatchersTitle=`_studioWatchersTitle_1jypc_1095`,studioWatchersEmpty=`_studioWatchersEmpty_1jypc_1103`,studioWatchersList=`_studioWatchersList_1jypc_1109`,studioWatcherChip=`_studioWatcherChip_1jypc_1118`,studioWatcherLabel=`_studioWatcherLabel_1jypc_1131`,studioWatcherMeta=`_studioWatcherMeta_1jypc_1139`,studioStepBody=`_studioStepBody_1jypc_1162`,studioCatalogBody=`_studioCatalogBody_1jypc_1163`,studioStepKind=`_studioStepKind_1jypc_1168`,studioStepMeta=`_studioStepMeta_1jypc_1180`,studioCatalogMeta=`_studioCatalogMeta_1jypc_1181`,studioStepActions=`_studioStepActions_1jypc_1186`,studioCatalogActions=`_studioCatalogActions_1jypc_1187`,studioPreviewLabel=`_studioPreviewLabel_1jypc_1230`,studioPreview=`_studioPreview_1jypc_1230`,voice=`_voice_1jypc_130`,voiceMeta=`_voiceMeta_1jypc_1268`,lens=`_lens_1jypc_1276`,breathe=`_breathe_1jypc_1`,voiceText=`_voiceText_1jypc_1320`,micDevice=`_micDevice_1jypc_1329`,textButton=`_textButton_1jypc_1358`,fab=`_fab_1jypc_1377`,fabLeft=`_fabLeft_1jypc_1421`,tip=`_tip_1jypc_1427`,tipUp=`_tipUp_1jypc_1450`,code=`_code_1jypc_1820`,codeHead=`_codeHead_1jypc_1838`,codeTitle=`_codeTitle_1jypc_1845`,codeMeta=`_codeMeta_1jypc_1850`,codeStatus=`_codeStatus_1jypc_1860`,codeBadge=`_codeBadge_1jypc_1870`,codeSection=`_codeSection_1jypc_1880`,codeLabel=`_codeLabel_1jypc_1885`,clip=`_clip_1jypc_1894`,codeBlock$1=`_codeBlock_1jypc_1899`,resultBlock=`_resultBlock_1jypc_1900`,clipBody=`_clipBody_1jypc_1917`,clipToggle=`_clipToggle_1jypc_1940`,tkComment=`_tkComment_1jypc_1959`,tkString=`_tkString_1jypc_1964`,tkNumber=`_tkNumber_1jypc_1968`,tkKeyword=`_tkKeyword_1jypc_1972`,tkName=`_tkName_1jypc_1976`,tkPunct=`_tkPunct_1jypc_1980`,tkKey=`_tkKey_1jypc_1972`,tkBool=`_tkBool_1jypc_1988`,foldHead=`_foldHead_1jypc_2000`,foldBody=`_foldBody_1jypc_2023`,foldInner=`_foldInner_1jypc_2029`,fold=`_fold_1jypc_2000`,toolState=`_toolState_1jypc_2043`,codeRunning=`_codeRunning_1jypc_2057`,codeDot=`_codeDot_1jypc_2058`,pop=`_pop_1jypc_1`,toolChip=`_toolChip_1jypc_2154`,toolSummary=`_toolSummary_1jypc_2165`,Panel_module_default={wrapper,collapsed,feedWrap,followBar,followBarBody,followBarStatus,followBarLens,voiceActions,header,brand,titleBlock,title,status,controls,iconButton,stopButton,feed,rail,railThumb,railMark,divider,peek,peekIn,peekHead,peekText,pin,jump,jumpIn,empty,enter,bubble,line:line$1,reflection,observation,warning,live,pulse,tool,toolHead,toolDot,toolLabel:toolLabel$1,toolDetail,spinner:spinner$1,spin,question,questionTag,questionText,result,resultText,composer,answerContext,choiceRow,choiceChip,choiceConfirm,box,actions,attachList,attachChip,attachName,attachRemove,attachError,roundButton,send,studio,studioHeader,studioTitle,studioTabs,studioTab,studioBody,studioHint,studioToolbar,studioToolButton,studioStatus,studioAsk,studioSteps,studioCatalog,studioStep,studioCatalogRow,studioWatchers,studioWatchersHead,studioWatchersTitle,studioWatchersEmpty,studioWatchersList,studioWatcherChip,studioWatcherLabel,studioWatcherMeta,studioStepBody,studioCatalogBody,studioStepKind,studioStepMeta,studioCatalogMeta,studioStepActions,studioCatalogActions,studioPreviewLabel,studioPreview,voice,voiceMeta,lens,breathe,voiceText,micDevice,textButton,fab,fabLeft,tip,tipUp,code,codeHead,codeTitle,codeMeta,codeStatus,codeBadge,codeSection,codeLabel,clip,codeBlock:codeBlock$1,resultBlock,clipBody,clipToggle,tkComment,tkString,tkNumber,tkKeyword,tkName,tkPunct,tkKey,tkBool,foldHead,foldBody,foldInner,fold,toolState,codeRunning,codeDot,pop,toolChip,toolSummary},openCards=new Set;function foldable(e,t,n,r){let i=document.createElement(`div`);i.className=r;let a=openCards.has(n);i.dataset.open=String(a),e.classList.add(Panel_module_default.foldHead),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-expanded`,String(a));let o=()=>{let t=i.dataset.open!==`true`;i.dataset.open=String(t),e.setAttribute(`aria-expanded`,String(t)),t?openCards.add(n):openCards.delete(n)};e.addEventListener(`click`,o),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())});let s=document.createElement(`div`);s.className=Panel_module_default.foldInner,s.append(t);let c=document.createElement(`div`);return c.className=Panel_module_default.foldBody,c.append(s),i.append(e,c),i}var PATHS={code:`<path d="M8 8l-4 4 4 4"/><path d="M16 8l4 4-4 4"/><path d="M14 5l-4 14"/>`,scroll:`<path d="M12 4v16"/><path d="M8 8l4-4 4 4"/><path d="M8 16l4 4 4-4"/>`,clock:`<circle cx="12" cy="12" r="8"/><path d="M12 8v4l2.5 2"/>`,check:`<path d="M5 12.5l4.5 4.5L19 7.5"/>`,question:`<circle cx="12" cy="12" r="8"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.4-1 .9-1 1.7"/><path d="M12 17h.01"/>`,list:`<path d="M9 6h11M9 12h11M9 18h11"/><path d="M4 6h.01M4 12h.01M4 18h.01"/>`,cursor:`<path d="M4 4l6.5 16 2.5-6.5L19.5 11z"/>`,cursorOff:`<path d="M4 4l6.5 16 2.5-6.5L19.5 11z"/><path d="M3 3l18 18"/>`,chevronUp:`<path d="M6 15l6-6 6 6"/>`,chevronDown:`<path d="M6 9l6 6 6-6"/>`,close:`<path d="M6 6l12 12M18 6L6 18"/>`,stop:`<rect x="6" y="6" width="12" height="12" rx="2"/>`,mic:`<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>`,micOff:`<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/><path d="M3 3l18 18"/>`,keyboard:`<rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10"/>`,send:`<path d="M12 19V5"/><path d="M5 12l7-7 7 7"/>`,arrowDown:`<path d="M12 5v14"/><path d="M6 13l6 6 6-6"/>`,bookmark:`<path d="M6 3h12v18l-6-4-6 4z"/>`,download:`<path d="M12 4v11"/><path d="M7 10l5 5 5-5"/><path d="M5 20h14"/>`,paperclip:`<path d="M15.5 7.5l-6.8 6.8a2.5 2.5 0 0 0 3.5 3.5l7.2-7.2a4 4 0 0 0-5.7-5.7L6.2 12.4a5.5 5.5 0 0 0 7.8 7.8l6-6"/>`,skills:`<path d="M12 3l2.2 4.5L19 9l-3.5 3.4L16.4 18 12 15.6 7.6 18l.9-5.6L5 9l4.8-1.5L12 3z"/><circle cx="12" cy="12" r="2"/>`,spark:`<path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z"/>`};function icon(e){return`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${PATHS[e]}</svg>`}var JS_KEYWORDS=new Set(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.function.if.import.in.instanceof.let.new.of.return.switch.throw.try.typeof.var.void.while.yield.true.false.null.undefined.this`.split(`.`)),JS_TOKEN=/\/\/[^\n]*|\/\*[\s\S]*?(?:\*\/|$)|'(?:[^'\\\n]|\\.)*'?|"(?:[^"\\\n]|\\.)*"?|`(?:[^`\\]|\\.)*`?|\d+(?:\.\d+)?|[A-Za-z_$][\w$]*|\s+|[\s\S]/g;function jsTokens(e){let t=[];for(let n of e.matchAll(JS_TOKEN)){let e=n[0];t.push({kind:classifyJs(e),text:e})}return t}function classifyJs(e){if(e.startsWith(`//`)||e.startsWith(`/*`))return`comment`;let t=e[0];return t===`'`||t===`"`||t==="`"?`string`:/^\d/.test(e)?`number`:/^[A-Za-z_$]/.test(e)?JS_KEYWORDS.has(e)?`keyword`:`name`:/^\s+$/.test(e)?`plain`:`punct`}var JSON_TOKEN=/"(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null|\s+|[\s\S]/g;function jsonTokens(e){let t;try{t=JSON.parse(e)}catch{return null}let n=JSON.stringify(t,null,2)??`undefined`,r=[];for(let e of n.matchAll(JSON_TOKEN)){let t=e[0],i=(e.index??0)+t.length;r.push({kind:classifyJson(t,n.slice(i)),text:t})}return r}function classifyJson(e,t){return e.startsWith(`"`)?/^\s*:/.test(t)?`key`:`string`:e===`true`||e===`false`?`bool`:e===`null`?`null`:/^-?\d/.test(e)?`number`:/^\s+$/.test(e)?`plain`:`punct`}function plainTokens(e){return[{kind:`plain`,text:e}]}var OK_PREFIX=`✅ Executed JavaScript. Result: `,ERROR_PREFIX=`❌ Error executing JavaScript: `,TOKEN_CLASS={plain:``,comment:Panel_module_default.tkComment,string:Panel_module_default.tkString,number:Panel_module_default.tkNumber,keyword:Panel_module_default.tkKeyword,name:Panel_module_default.tkName,punct:Panel_module_default.tkPunct,key:Panel_module_default.tkKey,bool:Panel_module_default.tkBool,null:Panel_module_default.tkBool};function parseScriptOutput(e){return e.startsWith(OK_PREFIX)?{ok:!0,value:e.slice(31)}:e.startsWith(ERROR_PREFIX)?{ok:!1,value:e.slice(30)}:{ok:!0,value:e}}function codeBlock(e,t){let n=document.createElement(`pre`);n.className=t;for(let t of e){let e=TOKEN_CLASS[t.kind];if(!e){n.append(t.text);continue}let r=document.createElement(`span`);r.className=e,r.textContent=t.text,n.append(r)}return n}function previewBlock(e,t,n){let r=document.createElement(`div`);r.className=Panel_module_default.clip,r.dataset.open=`false`;let i=codeBlock(e,`${t} ${Panel_module_default.clipBody}`),a=document.createElement(`button`);a.type=`button`,a.className=Panel_module_default.clipToggle,a.hidden=!0,a.textContent=n(`ui.panel.codeShowMore`);let o=()=>{let e=r.dataset.open!==`true`;r.dataset.open=String(e),a.textContent=n(e?`ui.panel.codeShowLess`:`ui.panel.codeShowMore`)};return i.addEventListener(`click`,o),a.addEventListener(`click`,o),r.append(i,a),requestAnimationFrame(()=>{let e=i.scrollHeight>i.clientHeight+1;r.dataset.clipped=String(e),a.hidden=!e}),r}function section(e,t){let n=document.createElement(`div`);n.className=Panel_module_default.codeSection;let r=document.createElement(`small`);return r.className=Panel_module_default.codeLabel,r.textContent=e,n.append(r,t),n}function scriptCard(e){let{script:t,output:n,t:r,source:i=`agent`,refused:a=!1,time:o,key:s}=e,c=n===void 0?null:parseScriptOutput(n),l=a?`refused`:c===null?`running`:c.ok?`done`:`error`,u=document.createElement(`div`);u.className=Panel_module_default.codeHead;let d=document.createElement(`span`);d.className=Panel_module_default.codeTitle,d.textContent=r(`ui.panel.codeTitle`);let f=document.createElement(`span`);if(f.className=Panel_module_default.codeMeta,i===`voice`){let e=document.createElement(`span`);e.className=Panel_module_default.codeBadge,e.textContent=r(`ui.panel.codeVoice`),f.append(e)}o&&f.append(o);let p=document.createElement(`span`);p.className=Panel_module_default.codeStatus,p.textContent=r(l===`running`?`ui.panel.codeRunning`:l===`done`?`ui.panel.codeDone`:l===`refused`?`ui.panel.codeRefused`:`ui.panel.codeFailed`);let m=document.createElement(`span`);m.className=Panel_module_default.toolChip,m.innerHTML=icon(`code`),u.append(m,d,f,p);let h=document.createElement(`div`);if(h.append(section(r(`ui.panel.codeScript`),previewBlock(jsTokens(t),Panel_module_default.codeBlock,r))),a&&n!==void 0)h.append(section(r(`ui.panel.codeRefused`),previewBlock(plainTokens(n),Panel_module_default.resultBlock,r)));else if(c){let e=c.value,t=c.ok?jsonTokens(e)??plainTokens(e):plainTokens(e),n=r(c.ok?`ui.panel.codeResult`:`ui.panel.codeError`);h.append(section(n,previewBlock(t,Panel_module_default.resultBlock,r)))}let g=foldable(u,h,s,Panel_module_default.code);return g.dataset.status=l,g.dataset.tone=`js`,g}var textOf=e=>typeof e==`string`||typeof e==`number`?String(e):``,indexOf=e=>{let t=e?.index;return typeof t==`number`?`#${t}`:``};function toolVisual(e,t,n){let r=t??{};switch(e){case`execute_javascript`:return{icon:`code`,tone:`js`,summary:``};case`run_task`:return{icon:`spark`,tone:`task`,summary:truncate(textOf(r.task),32)};case`scroll`:{let e=/([\d.]+)px/.exec(n??``)?.[1];return{icon:`scroll`,tone:`move`,summary:e?`${Math.round(Number(e))} px`:``}}case`click_element_by_index`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`hover_element`:return{icon:`cursor`,tone:`move`,summary:indexOf(t)};case`double_click_element`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`press_key`:return{icon:`keyboard`,tone:`act`,summary:truncate(textOf(r.key),24)};case`focus_element`:return{icon:`cursor`,tone:`act`,summary:indexOf(t)};case`set_checked`:return{icon:`check`,tone:`act`,summary:`${indexOf(t)} ${r.checked===!1?`off`:`on`}`.trim()};case`set_range`:return{icon:`list`,tone:`act`,summary:`${indexOf(t)} ${textOf(r.value)}`.trim()};case`scroll_into_view`:return{icon:`scroll`,tone:`move`,summary:indexOf(t)};case`wheel`:return{icon:`scroll`,tone:`move`,summary:textOf(r.delta_y)||indexOf(t)};case`drag_element`:{let e=t?.source_index,n=t?.target_index;return{icon:`cursor`,tone:`move`,summary:typeof e==`number`&&typeof n==`number`?`#${e} → #${n}`:``}}case`input_text`:return{icon:`keyboard`,tone:`act`,summary:indexOf(t)};case`select_dropdown_option`:return{icon:`list`,tone:`act`,summary:truncate(textOf(r.text),24)};case`wait`:return{icon:`clock`,tone:`time`,summary:textOf(r.seconds)?`${textOf(r.seconds)}s`:``};case`done`:return{icon:`check`,tone:`done`,summary:r.success===!1?`não`:`ok`};case`ask_user`:return{icon:`question`,tone:`ask`,summary:truncate(textOf(r.question),32)};case`get_context`:{let e=textOf(r.y_min),t=textOf(r.y_max);return{icon:`list`,tone:`generic`,summary:truncate(e||t?`${e||`0`}–${t||`…`}`:`viewport`,24)}}default:return{icon:`spark`,tone:`generic`,summary:``}}}function localizeCore(e,t){let n;return e===`Task aborted`?t(`ui.panel.msgAborted`):e===`Task completed`?t(`ui.panel.msgCompleted`):e===`Step count exceeded maximum limit`?t(`ui.panel.msgStepLimit`):(n=/^LLM retry attempt (\d+) of (\d+)$/.exec(e))?t(`ui.panel.msgRetry`,{attempt:n[1],max:n[2]}):(n=/^Page navigated to → (.*)$/.exec(e))?t(`ui.panel.msgNavigated`,{url:n[1]}):(n=/^You have waited (\d+) seconds accumulatively/.exec(e))?t(`ui.panel.msgWaited`,{seconds:n[1]}):(n=/^⚠️ Only (\d+) steps remaining/.exec(e))?t(`ui.panel.msgStepsLeft`,{count:n[1]}):(n=/^⚠️ Critical: Only (\d+) steps left/.exec(e))?t(`ui.panel.msgStepsCritical`,{count:n[1]}):e}function node(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}function spinner(){return node(`span`,Panel_module_default.spinner)}function toolLabel(e,t,n){let r=t??{};switch(e){case`click_element_by_index`:return n(`ui.tools.clicking`,{index:r.index});case`input_text`:return n(`ui.tools.inputting`,{index:r.index});case`select_dropdown_option`:return n(`ui.tools.selecting`,{text:r.text});case`scroll`:return n(`ui.tools.scrolling`);case`wait`:return n(`ui.tools.waiting`,{seconds:r.seconds});case`ask_user`:return n(`ui.tools.askingUser`);case`done`:return n(`ui.tools.done`);default:return n(`ui.tools.executing`,{toolName:e})}}function stepPrefix(e,t){return e.type===`step`&&e.stepIndex!==void 0?t(`ui.panel.step`,{number:String(e.stepIndex+1)}):void 0}function userBubble(e){return node(`div`,Panel_module_default.bubble,e)}function line(e,t=``){return node(`div`,`${Panel_module_default.line} ${t}`.trim(),e)}function toolCard(e,t,n,r,i={icon:`spark`,tone:`generic`,summary:``}){let a=node(`span`,Panel_module_default.toolChip);a.innerHTML=icon(i.icon);let o=node(`div`,Panel_module_default.toolHead);o.append(a,node(`span`,Panel_module_default.toolLabel,e),node(`span`,Panel_module_default.toolSummary,i.summary),n===`running`?spinner():node(`span`,Panel_module_default.toolState,n===`error`?`!`:`✓`));let s=node(`div`,``);t&&s.append(node(`div`,Panel_module_default.toolDetail,truncate(t,240)));let c=foldable(o,s,r,Panel_module_default.tool);return c.dataset.status=n,c.dataset.tone=i.tone,c}function questionCard(e,t,n){let r=node(`div`,Panel_module_default.question);return r.dataset.pending=String(n),r.append(node(`small`,Panel_module_default.questionTag,t(`ui.panel.questionTitle`)),node(`p`,Panel_module_default.questionText,e)),r}function markedQuestion(e,t,n){let r=questionCard(e,t,n);return r.dataset.mark=`question`,r}function resultCard(e,t,n){let r={done:`ui.panel.resultDone`,notDone:`ui.panel.resultNotDone`,stopped:`ui.panel.resultStopped`,error:`ui.panel.resultError`},i=node(`div`,Panel_module_default.result);return i.dataset.kind=e,i.append(node(`strong`,``,n(r[e]))),t&&i.append(node(`div`,Panel_module_default.resultText,localizeCore(t,n))),i}function buildFeed(e,t){let n=[];if(e.task){let t=userBubble(e.task);t.dataset.mark=`turn`,n.push(t)}let r=e.key??`current`;for(let[i,a]of e.history.entries()){let e=stepPrefix(a,t);if(a.type===`step`){let o=a.reflection;if(o){let e=[];o.evaluation_previous_goal&&e.push(`${t(`ui.panel.evaluation`)}: ${o.evaluation_previous_goal}`),o.memory&&e.push(`${t(`ui.panel.memory`)}: ${o.memory}`),o.next_goal&&e.push(`${t(`ui.panel.nextGoal`)}: ${o.next_goal}`),e.length&&n.push(line(e.join(`
372
372
  `),Panel_module_default.reflection))}let s=a.action;if(!s||s.name===`done`)continue;if(s.name===`ask_user`){let e=s.input?.question??``;n.push(markedQuestion(e,t,!1));let r=s.output.replace(/^User answered:\s*/i,``);r&&n.push(userBubble(r));continue}if(s.name===`execute_javascript`){let a=s.input?.script??``;n.push(scriptCard({script:a,output:s.output,t,key:`${r}:${i}`})),e&&(n[n.length-1].dataset.step=e);continue}n.push(toolCard(toolLabel(s.name,s.input,t),s.output,`done`,`${r}:${i}`,toolVisual(s.name,s.input,s.output))),e&&(n[n.length-1].dataset.step=e)}else a.type===`observation`?a.content&&n.push(line(localizeCore(a.content,t),Panel_module_default.observation)):a.type===`user_takeover`?n.push(line(t(`ui.panel.userTakeover`),Panel_module_default.observation)):a.type===`retry`?n.push(line(localizeCore(a.message??``,t),Panel_module_default.warning)):a.type===`error`&&n.push(toolCard(localizeCore(a.message??`Error`,t),``,`error`,`${r}:${i}`))}let i=e.live;if(i?.type===`thinking`&&n.push(line(t(`ui.panel.thinking`),Panel_module_default.live)),i?.type===`executing`&&i.tool===`execute_javascript`?n.push(scriptCard({script:i.input?.script??``,t,key:`${r}:live`})):i?.type===`executing`&&n.push(toolCard(toolLabel(i.tool,i.input,t),``,`running`,`${r}:live`,toolVisual(i.tool,i.input,void 0))),i?.type===`retrying`&&n.push(line(t(`ui.panel.statusRetrying`,{attempt:String(i.attempt),max:String(i.maxAttempts)}),Panel_module_default.live)),e.question&&n.push(markedQuestion(e.question,t,!0)),e.result){let r=resultCard(e.result.kind,e.result.text,t);r.dataset.mark=`result`,n.push(r)}for(let e of n)e.classList.add(Panel_module_default.enter);return n}function lastOutcomeText(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`step`&&n.action?.name===`done`)return n.action.input?.text||n.action.output||``;if(n.type===`error`&&n.message)return n.message}return``}function micPreferenceScore(e){let t=e.toLowerCase();return/bluetooth|airpods|headset|hands[- ]?free|\bwh-|\bbuds\b|galaxy buds|freebuds/.test(t)?0:/default|communications/.test(t)?1:/built-?in|internal|iphone|android|pixel|samsung|macbook|realtek|microphone \(/.test(t)?3:/microphone|mic/.test(t)?2:1}var MicrophoneControl=class{#e=null;#t=`off`;#n=!1;#r=0;#i=null;#a=``;#o=!1;#s;#c=[];constructor(e){this.#s=e}get state(){return this.#t}get stream(){return this.#e}get label(){return this.#a}get deviceId(){return this.#i}get hardwareMuted(){return this.#o}async listInputs(){return navigator.mediaDevices?.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`&&e.deviceId).map(e=>({deviceId:e.deviceId,label:e.label||`Microphone ${e.deviceId.slice(0,6)}`})):[]}async enable(e){this.#n=!0;let t=++this.#r;if(!navigator.mediaDevices?.getUserMedia){this.#p(`unsupported`);return}let n=e??this.#i??void 0;try{let e=await navigator.mediaDevices.getUserMedia({audio:audioConstraints(n)});if(t!==this.#r||!this.#n){stopTracks(e);return}if(this.#l(e),!n){let n=await this.#u(e);if(n&&n!==this.#i&&t===this.#r&&this.#n){let r=await navigator.mediaDevices.getUserMedia({audio:audioConstraints(n)});if(t!==this.#r||!this.#n){stopTracks(r);return}stopTracks(e),this.#l(r)}}this.#p(`active`)}catch(e){if(t!==this.#r)return;this.#p(classifyGetUserMediaError(e))}}async cycleInput(){let e=await this.listInputs();if(e.length<2)return!1;let t=this.#i??e[0].deviceId,n=e[(Math.max(0,e.findIndex(e=>e.deviceId===t))+1)%e.length];return n.deviceId===t||(this.#i=n.deviceId,!this.#n||this.#t===`muted`||this.#t===`off`)?!1:(await this.enable(n.deviceId),this.#t===`active`&&this.#i===n.deviceId)}setMuted(e){if(e){this.#r++,this.#f(),this.#p(`muted`);return}this.enable(this.#i??void 0)}disable(){this.#n=!1,this.#r++,this.#f(),this.#p(`off`)}#l(e){this.#d(),this.#e=e;let t=e.getAudioTracks()[0];if(!t){this.#a=``,this.#i=null,this.#o=!1;return}this.#a=t.label||this.#a;let n=t.getSettings?.()??{};typeof n.deviceId==`string`&&n.deviceId&&(this.#i=n.deviceId),this.#o=t.muted;let r=()=>{this.#o=!0,this.#s()},i=()=>{this.#o=!1,this.#s()},a=()=>{this.#e===e&&(this.#f(),this.#n&&this.#p(`unsupported`))};t.addEventListener(`mute`,r),t.addEventListener(`unmute`,i),t.addEventListener(`ended`,a),this.#c.push(()=>{t.removeEventListener(`mute`,r),t.removeEventListener(`unmute`,i),t.removeEventListener(`ended`,a)})}async#u(e){let t=await this.listInputs();if(t.length<2)return null;let n=e.getAudioTracks()[0]?.getSettings?.().deviceId??this.#i??t[0].deviceId,r=t.find(e=>e.deviceId===n)?.label??e.getAudioTracks()[0]?.label??``,i=[...t].sort((e,t)=>micPreferenceScore(t.label)-micPreferenceScore(e.label))[0];return micPreferenceScore(i.label)<=micPreferenceScore(r)||i.deviceId===n?null:i.deviceId}#d(){for(let e of this.#c)e();this.#c=[]}#f(){this.#d(),this.#e&&stopTracks(this.#e),this.#e=null,this.#o=!1}#p(e){this.#t!==e&&(this.#t=e,this.#s())}};function audioConstraints(e){let t={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0};return e&&(t.deviceId={exact:e}),t}function classifyGetUserMediaError(e){let t=e instanceof DOMException?e.name:``;return t===`NotAllowedError`||t===`SecurityError`?`denied`:t===`NotReadableError`||t===`AbortError`?`busy`:`unsupported`}function stopTracks(e){for(let t of e.getTracks())t.stop()}var KEY=`page-agent-panel-recovery-v1`,sensitive=/password|passwd|secret|token|api.?key|authorization|cookie/i;function redact(e,t=0){return t>8?`[omitted]`:Array.isArray(e)?e.map(e=>redact(e,t+1)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,sensitive.test(e)?`[hidden]`:redact(n,t+1)])):e}function cleanEvent(e){return{type:e.type,...e.stepIndex===void 0?{}:{stepIndex:e.stepIndex},...e.reflection?{reflection:e.reflection}:{},...e.action?{action:{name:e.action.name,input:redact(e.action.input),output:e.action.output}}:{},...e.content===void 0?{}:{content:e.content},...e.attempt===void 0?{}:{attempt:e.attempt},...e.maxAttempts===void 0?{}:{maxAttempts:e.maxAttempts},...e.message===void 0?{}:{message:e.message}}}function createPanelRecovery(e,t=KEY){return{load(){let n=e.getItem(t);if(n===null)return[];let r=JSON.parse(n);if(!r||typeof r!=`object`||!(`version`in r)||r.version!==1||!(`runs`in r)||!Array.isArray(r.runs))throw Error(`Invalid recovery data`);for(let e of r.runs)if(!e||typeof e!=`object`||typeof e.task!=`string`||!Array.isArray(e.history)||!Array.isArray(e.voiceRuns)||e.history.some(e=>!e||typeof e!=`object`||!(`type`in e)||![`step`,`observation`,`user_takeover`,`retry`,`error`].includes(String(e.type)))||e.voiceRuns.some(e=>!e||typeof e!=`object`||!(`id`in e)||!(`script`in e)||!(`status`in e)||!(`at`in e))||e.result!==null&&(!e.result||typeof e.result!=`object`||![`done`,`notDone`,`stopped`,`error`].includes(e.result.kind)||typeof e.result.text!=`string`))throw Error(`Invalid recovery run`);return r.runs},save(n){let r=n.map(e=>({...e,history:e.history.map(cleanEvent)}));e.setItem(t,JSON.stringify({version:1,runs:r}))},clear(){e.removeItem(t)}}}function formatTrace(e,t,n){let r=[`NoStop log ${n.toISOString()}`];return e.forEach((e,n)=>{r.push(``,`== ${t(`ui.panel.logTask`)} ${n+1}: ${e.task}`);for(let n of e.history)if(n.type===`step`){let e=n.stepIndex===void 0?`step`:`step ${n.stepIndex+1}`,i=n.reflection;if(i?.evaluation_previous_goal&&r.push(`${e} | ${t(`ui.panel.evaluation`)}: ${i.evaluation_previous_goal}`),i?.memory&&r.push(`${e} | ${t(`ui.panel.memory`)}: ${i.memory}`),i?.next_goal&&r.push(`${e} | ${t(`ui.panel.nextGoal`)}: ${i.next_goal}`),n.action){let i=JSON.stringify(n.action.input??{});r.push(`${e} | ${t(`ui.panel.logAction`)}: ${n.action.name} ${i} -> ${n.action.output??``}`)}}else n.type===`observation`?r.push(`obs | ${n.content??``}`):n.type===`retry`?r.push(`retry | ${n.message??``} (${n.attempt}/${n.maxAttempts})`):n.type===`error`?r.push(`error | ${n.message??``}`):n.type===`user_takeover`&&r.push(`user | ${t(`ui.panel.userTakeover`)}`);e.outcome&&r.push(`${t(`ui.panel.logResult`)}: ${e.outcome}`)}),r.join(`
373
373
  `)+`
374
- `}var VoiceRuns=class{#e=[];#t=1;get list(){return this.#e}start(e,t){let n={id:this.#t++,script:e,status:`running`,at:t};return this.#e.push(n),n}finish(e,t){let n=this.#e.find(t=>t.id===e);n&&(n.status=`done`,n.output=t)}refuse(e,t,n){this.#e.push({id:this.#t++,script:e,output:t,status:`refused`,at:n})}takeAll(){let e=this.#e;return this.#e=[],e}},DRAG_KEY=`page-agent-panel-position`,FAB_KEY=`page-agent-fab-corner`,FAB_MARGIN=16,CORNERS=[`left-top`,`right-top`,`left-bottom`,`right-bottom`];function excerptOf(e,t){if(t)return t;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`step`&&n.action?.output)return n.action.output;if(n.type===`observation`&&n.content)return n.content}return``}function fillBrand(e){e.textContent=``;let t=document.querySelector(`link[rel~="icon"][href]`);if(!t){e.innerHTML=icon(`spark`);return}let n=document.createElement(`img`);n.alt=``,n.src=t.href,n.onerror=()=>{e.innerHTML=icon(`spark`)},e.append(n)}function setButton(e,t,n){e.innerHTML=icon(t),e.dataset.tip=n,e.setAttribute(`aria-label`,n),e.removeAttribute(`title`)}var CURSOR_ATTR=`data-pa-cursor-hidden`,PIN_PX=72,INTENT_MS=600,FOLLOW_CYCLE_MQ=`(max-width: 480px)`,Panel=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=null;#d=null;#f=null;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S=``;#C=`record`;#w=``;#T=``;#E=``;#D=``;#O=!1;#k=null;#A=[];#j=[];#M=!1;#N=!1;#P=`expanded`;#F;#I=`text`;#L=`text`;#R=new MicrophoneControl(()=>this.#Ve());#z;#B=!1;#V=null;#H=null;#U=null;#W;#G;#K;#q;#J=!0;#Y=0;#X=0;#Z=!1;#Q=0;#$=[];#ee=null;#te=!1;#ne=new VoiceRuns;#re=``;#ie=0;#ae=new Set;#oe;#se;#ce=null;#le=!1;#ue=()=>{this.#Ne(),this.#Ve()};#de=()=>{this.#V?.type===`executing`&&(this.#V=null),this.#Ve()};#fe=e=>{this.#V=e.detail,this.#Ve()};#pe=()=>this.dispose();#me=e=>{if(this.#qe(),e.type===`skills:watch-fired`){let t=e.detail,n=t?.message?.trim()||t?.skillId||`ok`;this.#Ue(this.#r.t(`ui.panel.skillsStudioWatchFired`,{message:n}),`ok`)}this.#I===`skills-studio`&&this.#Ze()};get wrapper(){return this.#e}constructor(e,t={}){if(this.#t=e,this.#n=t,this.#r=new I18n(t.language??`en-US`),t.sessionRecovery===!0)try{this.#ee=createPanelRecovery(window.sessionStorage,t.sessionRecoveryKey),this.#$=this.#ee.load()}catch(e){this.#ee=null,console.warn(`[page-agent] Conversation recovery unavailable`,e)}this.#t.onAskUser=(e,t)=>this.#Oe(e,t),this.#e=this.#At(),this.#i=this.#e.querySelector(`[data-role="feed"]`),typeof ResizeObserver<`u`&&new ResizeObserver(()=>{this.#J&&(this.#i.scrollTop=this.#i.scrollHeight)}).observe(this.#i),this.#a=this.#e.querySelector(`[data-role="status"]`),this.#o=this.#e.querySelector(`[data-role="input"]`),this.#s=this.#e.querySelector(`[data-role="answer-context"]`),this.#c=this.#e.querySelector(`[data-role="send"]`),this.#l=this.#e.querySelector(`[data-role="mic"]`),this.#u=this.#e.querySelector(`[data-role="attach"]`),this.#d=this.#e.querySelector(`[data-role="attach-input"]`),this.#f=this.#e.querySelector(`[data-role="attach-list"]`),this.#p=this.#e.querySelector(`[data-role="composer"]`),this.#m=this.#e.querySelector(`[data-role="voice"]`),this.#h=this.#e.querySelector(`[data-role="skills-studio"]`),this.#_=this.#e.querySelector(`[data-role="feed-wrap"]`),this.#g=this.#e.querySelector(`[data-role="skills"]`),this.#v=this.#e.querySelector(`[data-role="action"]`),this.#y=this.#e.querySelector(`[data-role="collapse"]`),this.#b=this.#e.querySelector(`[data-role="cursor"]`),this.#x=this.#e.querySelector(`[data-role="export"]`),this.#F=this.#e.querySelector(`[data-role="follow-bar"]`),this.#x.addEventListener(`click`,e=>{e.stopPropagation(),this.#bt()}),this.#t.addEventListener(`statuschange`,this.#ue),this.#t.addEventListener(`historychange`,this.#de),this.#t.addEventListener(`activity`,this.#fe),this.#t.addEventListener(`dispose`,this.#pe),this.#t.addEventListener(`skills:watch-armed`,this.#me),this.#t.addEventListener(`skills:watch-fired`,this.#me),this.#t.addEventListener(`skills:watch-stopped`,this.#me),this.#z=this.#Ie(),this.#Mt(),this.#ge(),this.#Pt(),this.#qe(),this.#Ve(),this.#Nt(),this.hide()}show(){this.#P===`fab`&&(this.#P=`expanded`,this.#N=!1),this.#W.hidden=!0,this.wrapper.dataset.follow=this.#P,this.wrapper.style.display=`flex`,this.wrapper.getBoundingClientRect(),this.wrapper.style.opacity=`1`,this.wrapper.style.transform=`translateY(0)`,this.#Ve()}hide(){this.#P=`fab`,this.#N=!0,this.wrapper.dataset.follow=`fab`,this.wrapper.style.opacity=`0`,this.wrapper.style.transform=`translateY(20px)`,this.wrapper.style.display=`none`,this.#W.hidden=!1,this.#St()}reset(){this.#H=null,this.#V=null,this.#I=`text`,this.#P=`bar`,this.#N=!0,this.#Ve()}expand(){this.#Ct(`expanded`)}collapse(){this.#Ct(`bar`)}dispose(){this.#We(),this.#t.isSkillRecording?.()&&this.#t.stopSkillRecording?.(),this.#z.disable(),this.#W.remove(),this.#t.removeEventListener(`statuschange`,this.#ue),this.#t.removeEventListener(`historychange`,this.#de),this.#t.removeEventListener(`activity`,this.#fe),this.#t.removeEventListener(`dispose`,this.#pe),this.#t.removeEventListener(`skills:watch-armed`,this.#me),this.#t.removeEventListener(`skills:watch-fired`,this.#me),this.#t.removeEventListener(`skills:watch-stopped`,this.#me),this.#H=null,this.wrapper.remove()}#he(){let e=this.#i,t=this.#t.history.length,n=Math.max(0,t-this.#X);if(this.#X=t,this.#H&&(this.#J=!0),this.#Z){this.#Z=!1;let t=e.querySelectorAll(`[data-mark="turn"]`),n=t[t.length-1];n&&(this.#J=!1,e.scrollTop=n.offsetTop-12)}else this.#J?e.scrollTop=e.scrollHeight:(n>0||this.#H)&&(this.#Y+=n);this.#be(),this.#ye()}#ge(){let e=this.#r.t.bind(this.#r);this.#e.setAttribute(`data-lenis-prevent`,``);let t=e=>e.stopPropagation();this.#e.addEventListener(`wheel`,t,{passive:!0}),this.#e.addEventListener(`touchmove`,t,{passive:!0}),this.#G=this.#e.querySelector(`[data-role="rail"]`),this.#K=this.#e.querySelector(`[data-role="thumb"]`),this.#q=this.#e.querySelector(`[data-role="jump"]`);let n=this.#i,r=()=>{this.#Q=performance.now()+INTENT_MS};n.addEventListener(`wheel`,r,{passive:!0}),n.addEventListener(`touchstart`,r,{passive:!0}),n.addEventListener(`mousedown`,r),n.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)&&r(),(e.key===`Home`||e.key===`End`)&&(e.preventDefault(),this.#ve(e.key===`End`?`end`:`start`))}),n.addEventListener(`scroll`,()=>{n.scrollHeight-n.scrollTop-n.clientHeight<PIN_PX?(this.#J=!0,this.#Y=0):performance.now()<this.#Q&&(this.#J=!1),this.#ye()}),new ResizeObserver(()=>{this.#be(),this.#ye()}).observe(n),this.#q.addEventListener(`click`,()=>this.#ve(`end`)),this.#oe=this.#e.querySelector(`[data-role="peek"]`),this.#G.addEventListener(`pointerover`,e=>{let t=e.target.closest(`[data-mark-dot]`);t&&this.#xe(t)}),this.#G.addEventListener(`pointerleave`,()=>this.#Se()),this.#oe.addEventListener(`pointerenter`,()=>clearTimeout(this.#se)),this.#oe.addEventListener(`pointerleave`,()=>this.#Se()),this.#oe.addEventListener(`click`,e=>{let t=e.target.closest(`[data-role="pin"]`);if(!t)return;let n=Number(t.dataset.run);this.#ae.has(n)?this.#ae.delete(n):this.#ae.add(n),this.#oe.hidden=!0,this.#Ve()}),this.#q.setAttribute(`aria-label`,e(`ui.panel.jumpLatest`)),this.#G.addEventListener(`click`,e=>{let t=e.target.closest(`[data-target]`);if(!t)return;let r=n.querySelector(`[data-id="${t.dataset.target}"]`);r&&(this.#J=!1,n.scrollTo({top:r.offsetTop-12,behavior:this.#_e()}))})}#_e(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}#ve(e){let t=this.#i;this.#J=e===`end`,e===`end`&&(this.#Y=0),t.scrollTo({top:e===`end`?t.scrollHeight:0,behavior:this.#_e()}),this.#ye()}#ye(){let e=this.#r.t.bind(this.#r),t=this.#i,n=t.scrollHeight-t.clientHeight,r=n>4,i=t.scrollTop>8,a=n-t.scrollTop>8,o=r?`linear-gradient(to bottom, ${i?`transparent 0, #000 24px`:`#000 0`}, ${a?`#000 calc(100% - 24px), transparent 100%`:`#000 100%`})`:`none`;t.style.maskImage=o,t.style.webkitMaskImage=o,this.#G.hidden=!r;let s=t.querySelectorAll(`[data-mark="turn"]`),c=``;if(s.forEach(e=>{e.offsetTop<=t.scrollTop+48&&(c=e.dataset.id??``)}),this.#G.querySelectorAll(`[data-mark-dot]`).forEach(e=>{e.dataset.active=String(e.dataset.target===c)}),r){let e=t.clientHeight/t.scrollHeight,n=this.#G.clientHeight;this.#K.style.height=`${Math.max(24,e*n)}px`,this.#K.style.top=`${t.scrollTop/t.scrollHeight*n}px`}let l=!this.#J&&(this.#Y>0||this.#H!==null||r&&a);this.#q.hidden=!l,l&&(this.#q.innerHTML=`${icon(`arrowDown`)}<span>${this.#Y>0?e(`ui.panel.newCount`,{count:String(this.#Y)}):e(`ui.panel.jumpLatest`)}</span>`)}#be(){let e=this.#r.t.bind(this.#r),t=this.#i,n=this.#G.clientHeight;this.#G.querySelectorAll(`[data-mark-dot]`).forEach(e=>e.remove()),t.querySelectorAll(`[data-mark]`).forEach((r,i)=>{let a=`m${i}`;r.dataset.id=a;let o=r.dataset.mark??``,s=document.createElement(`button`);s.type=`button`,s.className=Panel_module_default.railMark,s.dataset.markDot=``,s.dataset.kind=o,s.dataset.target=a,s.dataset.run=r.dataset.run??``,s.dataset.pinned=r.dataset.pinned??`false`,s.dataset.title=o===`turn`?r.textContent??``:``,s.dataset.preview=r.dataset.preview??``,s.style.top=`${r.offsetTop/t.scrollHeight*n}px`,s.setAttribute(`aria-label`,o===`turn`?r.textContent??``:e(`ui.panel.step`,{number:String(i+1)})),this.#G.append(s)})}#xe(e){clearTimeout(this.#se);let t=this.#r.t.bind(this.#r),n=this.#oe,r=e.dataset.run??``;n.replaceChildren();let i=document.createElement(`div`);i.className=Panel_module_default.peekHead;let a=document.createElement(`strong`),o=e.dataset.kind===`question`?t(`ui.panel.questionTitle`):e.dataset.kind===`result`?t(`ui.panel.resultTitle`):``;if(a.textContent=e.dataset.title||o,i.append(a),r!==``){let e=document.createElement(`button`),n=this.#ae.has(Number(r));e.type=`button`,e.className=Panel_module_default.pin,e.dataset.role=`pin`,e.dataset.run=r,e.setAttribute(`aria-pressed`,String(n)),e.setAttribute(`aria-label`,t(n?`ui.panel.unpin`:`ui.panel.pin`)),e.innerHTML=icon(`bookmark`),i.append(e)}let s=document.createElement(`p`);s.className=Panel_module_default.peekText,s.textContent=localizeCore(e.dataset.preview??``,t),n.append(i,s),n.hidden=!1;let c=this.#i.parentElement.getBoundingClientRect(),l=e.getBoundingClientRect(),u=Math.min(Math.max(8,l.top-c.top-16),c.height-n.offsetHeight-8);n.style.top=`${u}px`}#Se(){clearTimeout(this.#se),this.#se=setTimeout(()=>{this.#oe.hidden=!0},140)}#Ce(e,t,n,r){let i=excerptOf(n,r?.text??``);for(let n of e)n.dataset.mark===`turn`&&(n.dataset.run=String(t),n.dataset.pinned=String(this.#ae.has(t)),n.dataset.preview=i)}#we(){if(!this.#ee)return;let e=[...this.#$];(this.#t.task||this.#t.history.length||this.#ne.list.length)&&e.push({task:this.#t.task||``,history:[...this.#t.history],result:this.#t.status===`running`?{kind:`stopped`,text:`Interrupted by reload or navigation. Actions were not replayed.`}:this.#Re(),voiceRuns:[...this.#ne.list]});try{this.#ee.save(e)}catch(e){this.#te||console.warn(`[page-agent] Could not save conversation recovery`,e),this.#te=!0}}#Te(){let e=this.#t.task||``,t=[...this.#t.history],n=this.#ne.takeAll();(e||t.length!==0||n.length!==0)&&this.#$.push({task:e,history:t,result:this.#Re(),voiceRuns:n})}#Ee(e,t){return e.map(e=>{let n=scriptCard({key:`voice-${e.id}`,script:e.script,output:e.output,t,source:`voice`,refused:e.status===`refused`,time:new Date(e.at).toLocaleTimeString()});return n.classList.add(Panel_module_default.enter),n.dataset.mark=`voice`,n})}#De(e){let t=[];return this.#$.forEach((n,r)=>{let i=buildFeed({key:`run-${r}`,task:n.task,history:n.history,live:null,question:null,result:n.result},e);this.#Ce(i,r,n.history,n.result),t.push(...i,...this.#Ee(n.voiceRuns,e));let a=document.createElement(`div`);a.className=Panel_module_default.divider,a.textContent=e(`ui.panel.newTask`),t.push(a)}),t}#Oe(e,t){return new Promise((n,r)=>{let i=(t?.choices??[]).map(e=>e.trim()).filter(Boolean),a=t?.kind??`text`;(a===`choice`||a===`multi`)&&i.length<2&&(a=`text`),this.#H={text:e.trim(),kind:a,choices:i,selected:new Set,resolve:n},this.#Tt(!1),this.#Ve();let o=a===`text`||i.length===0?``:`\nOptions (${a}): ${i.map((e,t)=>`${t+1}. ${e}`).join(`; `)}`;this.#z.report({kind:`question`,text:`${e.trim()}${o}`}),a===`text`&&this.#o.focus(),t?.signal?.addEventListener(`abort`,()=>{this.#H=null,this.#Ve(),r(t.signal.reason)},{once:!0})})}#ke(e){if(!this.#H)return!1;let t=e.trim();if(!t)return!1;let{resolve:n}=this.#H;return this.#H=null,this.#U?.remove(),this.#U=null,n(t),this.#Ve(),!0}#Ae(){let e=this.#H;if(!e||e.kind!==`choice`&&e.kind!==`multi`||e.choices.length===0){this.#U?.remove(),this.#U=null;return}let t=this.#r.t.bind(this.#r),n=this.#U;n||(n=document.createElement(`div`),n.className=Panel_module_default.choiceRow,n.dataset.role=`choice-row`,this.#s.append(n),this.#U=n),n.replaceChildren();for(let t of e.choices){let r=document.createElement(`button`);r.type=`button`,r.className=Panel_module_default.choiceChip,r.textContent=t;let i=e.selected.has(t);r.setAttribute(`aria-pressed`,String(i)),i&&(r.dataset.selected=`true`),r.addEventListener(`click`,()=>{if(this.#H){if(this.#H.kind===`choice`){this.#ke(t);return}this.#H.selected.has(t)?this.#H.selected.delete(t):this.#H.selected.add(t),this.#Ve()}}),n.append(r)}if(e.kind===`multi`){let r=document.createElement(`button`);r.type=`button`,r.className=Panel_module_default.choiceConfirm,r.textContent=t(`ui.panel.answerConfirmMulti`),r.disabled=e.selected.size===0,r.addEventListener(`click`,()=>{this.#H&&this.#H.selected.size!==0&&this.#ke([...this.#H.selected].join(`; `))}),n.append(r)}}#je(){let e=this.#o.value.trim();e&&this.#Me(e)&&(this.#o.value=``,this.#kt())}#Me(e){return this.#H?this.#ke(e):this.#t.status!==`running`&&(this.#Te(),this.#Z=!0,this.#B=!1,this.#t.execute(e),!0)}#Ne(){let e=this.#t.status;if(this.#B||e!==`completed`&&e!==`error`&&e!==`stopped`)return;this.#B=!0;let t=this.#r.t.bind(this.#r),n=this.#Re(),r={done:`ui.panel.resultDone`,notDone:`ui.panel.resultNotDone`,stopped:`ui.panel.resultStopped`,error:`ui.panel.resultError`},i=n?.kind??`stopped`;this.#z.report({kind:i===`notDone`?`not-done`:i,text:n?.text||t(r[i])})}async#Pe(e){let t=Date.now();if(this.#t.status===`running`){let n=`The agent is busy with a task, so the page cannot be changed now. Tell the user to try again when the task ends.`;return this.#ne.refuse(e,n,t),console.debug(`[page-agent voice] refused`,{script:e,reason:n}),this.#Ve(),n}let n=this.#n.runScript,r=this.#ne.start(e,t);this.#Ve();let i;try{i=n?await n(e):`Running scripts is not available in this session.`}catch(e){i=`The script failed: ${e instanceof Error?e.message:`unknown error`}`}return this.#ne.finish(r.id,i),console.debug(`[page-agent voice]`,{script:e,output:i}),this.#Ve(),i}async#Fe(e){let t=this.#n.getContext;if(!t)return`get_context is not available in this session.`;try{return await t(e)}catch(e){return`get_context failed: ${e instanceof Error?e.message:`unknown error`}`}}#Ie(){return new VoiceSession({apiKey:this.#n.voice?.apiKey,settings:{instructions:`${resolveVoicePrompt(this.#n.voice?.systemPrompt,this.#n.voice?.overrideSystemPrompt===!0)}\n\n${languageRule(this.#r.getLanguage())}`,language:this.#r.getLanguage()===`pt-BR`?`pt`:`en`},mic:this.#R,createClient:e=>this.#n.voice?.provider===`gemini`?new GeminiLiveClient(e):new RealtimeClient(e),onTask:e=>this.#Me(e),onScript:e=>this.#Pe(e),isWaitingForAnswer:()=>this.#H!==null,onAnswer:e=>this.#ke(e),onGetContext:e=>this.#Fe(e),onChange:()=>this.#Ve()})}#Le(){this.#t.status===`running`?this.#t.stop():this.hide()}#Re(){let e=this.#t.status;return e===`completed`?{kind:this.#t.lastResult?.success===!1?`notDone`:`done`,text:lastOutcomeText(this.#t.history)}:e===`error`?{kind:`error`,text:lastOutcomeText(this.#t.history)}:e===`stopped`?{kind:`stopped`,text:``}:null}#ze(){return this.#H?`waiting`:this.#t.status===`running`?`running`:this.#Re()?.kind??`idle`}#Be(){let e=this.#r.t.bind(this.#r);if(this.#H)return e(`ui.panel.statusWaiting`);if(this.#t.status===`running`)return this.#V?.type===`retrying`?e(`ui.panel.statusRetrying`,{attempt:String(this.#V.attempt),max:String(this.#V.maxAttempts)}):this.#V?.type===`executing`?toolLabel(this.#V.tool,this.#V.input,e):this.#V?.type===`thinking`?e(`ui.panel.thinking`):e(`ui.panel.statusRunning`);switch(this.#Re()?.kind){case`done`:return e(`ui.panel.statusDone`);case`notDone`:return e(`ui.panel.statusNotDone`);case`stopped`:return e(`ui.panel.statusStopped`);case`error`:return e(`ui.panel.statusError`);default:return e(`ui.panel.ready`)}}#Ve(){this.#we();let e=this.#r.t.bind(this.#r),t=this.#ze();this.#e.dataset.state=t,this.#e.dataset.mode=this.#I,this.#e.dataset.follow=this.#P,this.#e.classList.toggle(Panel_module_default.collapsed,this.#N),this.#a.textContent=this.#Be();let n=buildFeed({key:`current`,task:this.#t.task||``,history:this.#t.history,live:this.#t.status===`running`?this.#V:null,question:this.#H?.text??null,result:this.#H?null:this.#Re()},e);this.#Ce(n,this.#$.length,this.#t.history,this.#Re());let r=[...this.#De(e),...n,...this.#Ee(this.#ne.list,e)];if(r.length===0){let t=document.createElement(`div`);t.className=Panel_module_default.empty,t.textContent=e(`ui.panel.emptyHint`),r.push(t)}let i=JSON.stringify([this.#t.task,this.#t.history.length,this.#t.history.at(-1)??null,this.#t.status===`running`?this.#V:null,this.#H?{text:this.#H.text,kind:this.#H.kind,choices:this.#H.choices,selected:[...this.#H.selected]}:null,this.#H?null:this.#Re(),this.#ne.list,this.#$.length,this.#N,this.#P,this.#I]);if(i!==this.#re){this.#re=i;let e=r.length>this.#ie;r.forEach((t,n)=>{(!e||n<this.#ie)&&t.classList.remove(Panel_module_default.enter)}),this.#ie=r.length,this.#i.replaceChildren(...r)}this.#he();let a=this.#t.status===`running`,o=this.#H!==null,s=!a&&!o&&this.#Re()!==null,c=this.#I===`skills-studio`,l=this.#P===`bar`&&this.#xt(),u=s&&this.#n.promptForNextTask===!1;if(this.#_.hidden=c||l,this.#p.hidden=u||this.#I!==`text`||c||l,this.#m.hidden=this.#I!==`voice`||l,this.#h.hidden=!c||l,this.#F.hidden=!l,this.#Dt(),this.#Ot(),this.#Ze(),this.#s.hidden=!o,o&&this.#H){let t=this.#H,n=t.kind===`multi`?e(`ui.panel.answerTitleMulti`):t.kind===`choice`?e(`ui.panel.answerTitleChoice`):e(`ui.panel.answerTitle`);this.#U=null,this.#s.replaceChildren();let r=document.createElement(`div`);r.textContent=`${n}: ${t.text}`,this.#s.append(r),this.#Ae()}else this.#s.textContent=``,this.#U?.remove(),this.#U=null;let d=o&&this.#H!==null&&this.#H.kind===`choice`;this.#o.disabled=a&&!o||d,this.#o.placeholder=o?this.#H?.kind===`multi`?e(`ui.panel.composerAnswerMulti`):this.#H?.kind===`choice`?e(`ui.panel.composerAnswerChoice`):e(`ui.panel.composerAnswer`):e(a?`ui.panel.composerRunning`:`ui.panel.composerPlaceholder`),this.#c.disabled=a&&!o||d,setButton(this.#c,`send`,e(`ui.panel.send`)),setButton(this.#x,`download`,e(`ui.panel.exportLog`)),this.#x.hidden=this.#$.length===0&&this.#t.history.length===0,this.#vt(),a?setButton(this.#v,`stop`,e(`ui.panel.stop`)):setButton(this.#v,`close`,e(`ui.panel.close`));let f=this.#P===`expanded`?this.#xt()?e(`ui.panel.followModeBar`):e(`ui.panel.collapse`):this.#P===`bar`?e(`ui.panel.expand`):e(`ui.panel.expandFromFab`);setButton(this.#y,this.#P===`expanded`?`chevronUp`:`chevronDown`,f),this.#y.setAttribute(`aria-expanded`,String(this.#P===`expanded`)),setButton(this.#g,`skills`,e(`ui.panel.skillsStudio`)),this.#g.setAttribute(`aria-pressed`,String(c)),this.#g.hidden=this.#I===`voice`,this.#I===`voice`?setButton(this.#l,`keyboard`,e(`ui.panel.switchToText`)):setButton(this.#l,`mic`,e(`ui.panel.switchToVoice`)),this.#l.setAttribute(`aria-pressed`,String(this.#I===`voice`)),this.#l.hidden=c}#He(){return typeof this.#t.startSkillRecording==`function`&&typeof this.#t.listSkillsCatalog==`function`&&typeof this.#t.synthesizeSkill==`function`}#Ue(e,t=``){this.#w=e,this.#T=t}#We(){this.#k&&=(clearInterval(this.#k),null)}#Ge(){if(this.#t.isSkillRecording?.()&&this.#I===`skills-studio`){this.#k||=setInterval(()=>{if(this.#I!==`skills-studio`||!this.#t.isSkillRecording?.()){this.#We(),this.#Ze();return}this.#Ze()},400);return}this.#We()}#Ke(){try{this.#A=this.#t.listSkillsCatalog?.()??[]}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`),this.#A=[]}}#qe(){try{this.#j=this.#t.listSkillWatches?.()??[]}catch{this.#j=[]}}#Je(e){let t=new Set(e.commands.map(e=>e.name));return t.has(`check`)?`check`:t.has(`watch_reply`)?`watch_reply`:t.has(`run`)?`run`:null}#Ye(){return typeof this.#t.armSkillWatch==`function`}#Xe(){this.#t.notifySkillWatchEnter?.()}#Ze(){if(this.#I!==`skills-studio`)return;let e=this.#r.t.bind(this.#r),t=this.#He(),n=!!this.#t.isSkillRecording?.(),r=this.#t.getRecordedSteps?.()??[],i=this.#O||this.#t.status===`running`;setButton(this.#h.querySelector(`[data-role="skills-back"]`),`close`,e(`ui.panel.skillsStudioBack`));let a=this.#h.querySelectorAll(`[data-role="skills-tab"]`);for(let e of a){let t=e.dataset.tab===this.#C;e.setAttribute(`aria-selected`,String(t))}let o=this.#h.querySelectorAll(`[data-role="skills-pane"]`);for(let e of o)e.hidden=e.dataset.tab!==this.#C;let s=this.#h.querySelector(`[data-role="skills-unavailable"]`);s.hidden=t,s.textContent=e(`ui.panel.skillsStudioUnavailable`);for(let e of o)e.dataset.tab&&e.toggleAttribute(`data-disabled`,!t);let c=this.#h.querySelector(`[data-role="skills-record-status"]`),l=this.#h.querySelector(`[data-role="skills-ask-status"]`),u=this.#h.querySelector(`[data-role="skills-catalog-status"]`),d=this.#w||e(n?`ui.panel.skillsStudioRecording`:`ui.panel.skillsStudioIdle`),f=this.#w?this.#T:n?`warn`:``;for(let e of[c,l,u])e.textContent=d,f?e.dataset.tone=f:delete e.dataset.tone;let p=this.#h.querySelector(`[data-role="skills-record-start"]`),m=this.#h.querySelector(`[data-role="skills-record-stop"]`),h=this.#h.querySelector(`[data-role="skills-record-finish"]`),g=this.#h.querySelector(`[data-role="skills-record-clear"]`),_=this.#h.querySelector(`[data-role="skills-record-save"]`),v=this.#h.querySelector(`[data-role="skills-record-test"]`);p.textContent=e(`ui.panel.skillsStudioStart`),m.textContent=e(`ui.panel.skillsStudioStop`),h.textContent=e(`ui.panel.skillsStudioFinish`),g.textContent=e(`ui.panel.skillsStudioClear`),_.textContent=e(`ui.panel.skillsStudioSave`),v.textContent=e(`ui.panel.skillsStudioTest`),p.disabled=!t||i||n,m.disabled=!t||i||!n,h.disabled=!t||i||!n&&r.length===0,g.disabled=!t||i||r.length===0&&!this.#E,_.disabled=!t||i||!this.#E,v.disabled=!t||i||!this.#D;let y=this.#h.querySelector(`[data-role="skills-steps"]`),b=this.#h.querySelector(`[data-role="skills-steps-empty"]`);b.textContent=e(`ui.panel.skillsStudioEmptySteps`),b.hidden=r.length>0,y.hidden=r.length===0,y.replaceChildren();for(let e of r)y.append(this.#et(e,t&&!i));let x=this.#h.querySelector(`[data-role="skills-preview-label"]`),S=this.#h.querySelector(`[data-role="skills-preview"]`),C=this.#h.querySelector(`[data-role="skills-preview-actions"]`);x.textContent=e(`ui.panel.skillsStudioPreview`);let w=!!this.#E;x.hidden=!w,S.hidden=!w,C.hidden=!w,S.textContent=this.#E;let T=this.#h.querySelector(`[data-role="skills-ask-start"]`),E=this.#h.querySelector(`[data-role="skills-ask-input"]`);T.textContent=e(`ui.panel.skillsStudioAskStart`),T.disabled=!t||i||!E.value.trim(),E.disabled=!t||i;let D=this.#h.querySelector(`[data-role="skills-catalog-refresh"]`),O=this.#h.querySelector(`[data-role="skills-catalog-remove-agent"]`);D.textContent=e(`ui.panel.skillsStudioRefreshRemote`),O.textContent=e(`ui.panel.skillsStudioRemoveAgentSkills`);let k=this.#A.filter(e=>e.scope===`agent`);D.disabled=!t||i,O.disabled=!t||i||k.length===0;let A=this.#h.querySelector(`[data-role="skills-catalog-empty"]`),j=this.#h.querySelector(`[data-role="skills-catalog-list"]`),M=this.#h.querySelector(`[data-role="skills-catalog-count"]`);M.textContent=e(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),A.textContent=e(`ui.panel.skillsStudioEmptyCatalog`),A.hidden=this.#A.length>0,j.hidden=this.#A.length===0,j.replaceChildren();for(let e of this.#A)j.append(this.#tt(e,t&&!i));this.#Qe(t&&!i),this.#Ge()}#Qe(e){let t=this.#r.t.bind(this.#r),n=this.#h.querySelector(`[data-role="skills-watchers"]`);if(!n)return;let r=this.#Ye();if(n.hidden=!r,!r)return;this.#qe();let i=n.querySelector(`[data-role="skills-watchers-title"]`),a=n.querySelector(`[data-role="skills-watchers-empty"]`),o=n.querySelector(`[data-role="skills-watchers-list"]`);i.textContent=t(`ui.panel.skillsStudioWatchers`),a.textContent=t(`ui.panel.skillsStudioWatchEmpty`),a.hidden=this.#j.length>0,o.hidden=this.#j.length===0,o.replaceChildren();for(let t of this.#j)o.append(this.#$e(t,e))}#$e(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioWatcherChip,r.dataset.watchId=e.id;let i=document.createElement(`span`);i.className=Panel_module_default.studioWatcherLabel,i.textContent=`${e.skillId}/${e.command}`;let a=document.createElement(`span`);a.className=Panel_module_default.studioWatcherMeta,a.textContent=e.trigger;let o=document.createElement(`button`);return o.type=`button`,o.textContent=n(`ui.panel.skillsStudioDisarmWatch`),o.disabled=!t||typeof this.#t.disarmSkillWatch!=`function`,o.addEventListener(`click`,()=>this.#ft(e.id)),r.append(i,a,o),r}#et(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioStep,r.dataset.stepId=e.id;let i=document.createElement(`div`);i.className=Panel_module_default.studioStepBody;let a=document.createElement(`span`);a.className=Panel_module_default.studioStepKind,a.textContent=e.kind;let o=document.createElement(`div`),s=e.rawLabel||[e.role,e.name?`"${e.name}"`:``].filter(Boolean).join(` `)||e.kind;o.append(a,document.createTextNode(s));let c=document.createElement(`div`);c.className=Panel_module_default.studioStepMeta;let l=[e.value===void 0?``:`value=${JSON.stringify(e.value)}`,e.param?`param`:``].filter(Boolean);c.textContent=l.join(` · `),i.append(o),l.length&&i.append(c);let u=document.createElement(`div`);if(u.className=Panel_module_default.studioStepActions,e.kind===`fill`||e.kind===`select`){let r=document.createElement(`button`);r.type=`button`,r.textContent=e.param?n(`ui.panel.skillsStudioUnparam`):n(`ui.panel.skillsStudioParam`),r.disabled=!t,r.addEventListener(`click`,()=>{this.#t.toggleRecordedStepParam?.(e.id),this.#E=``,this.#D=``,this.#Ze()}),u.append(r)}let d=document.createElement(`button`);return d.type=`button`,d.textContent=n(`ui.panel.skillsStudioRemoveStep`),d.disabled=!t,d.addEventListener(`click`,()=>{this.#t.removeRecordedStep?.(e.id),this.#E=``,this.#D=``,this.#Ze()}),u.append(d),r.append(i,u),r}#tt(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioCatalogRow;let i=document.createElement(`div`);i.className=Panel_module_default.studioCatalogBody;let a=document.createElement(`div`);a.textContent=e.name||e.id;let o=document.createElement(`div`);o.className=Panel_module_default.studioCatalogMeta;let s=e.scope===`remote`?n(`ui.panel.skillsStudioScopeRemote`):n(`ui.panel.skillsStudioScopeAgent`);o.textContent=[e.id,s,e.loaded?n(`ui.panel.skillsStudioLoaded`):``,e.description].filter(Boolean).join(` · `),i.append(a,o);let c=document.createElement(`div`);if(c.className=Panel_module_default.studioCatalogActions,this.#Je(e)&&this.#Ye()){let r=document.createElement(`button`);r.type=`button`,r.dataset.variant=`accent`,r.textContent=n(`ui.panel.skillsStudioArmWatch`),r.disabled=!t,r.addEventListener(`click`,()=>void this.#dt(e)),c.append(r)}let l=document.createElement(`button`);if(l.type=`button`,l.textContent=n(`ui.panel.skillsStudioTest`),l.disabled=!t,l.addEventListener(`click`,()=>void this.#st(e.id)),c.append(l),e.scope===`agent`){let r=document.createElement(`button`);r.type=`button`,r.textContent=n(`ui.panel.skillsStudioRemoveSkill`),r.disabled=!t,r.addEventListener(`click`,()=>void this.#ut(e.id)),c.append(r)}return r.append(i,c),r}async#nt(){if(!(!this.#He()||this.#O)){this.#O=!0,this.#Ue(``),this.#Ze();try{await this.#t.startSkillRecording?.()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}}#rt(){this.#t.stopSkillRecording?.(),this.#Ue(``),this.#Ze()}#it(){if(!(!this.#He()||this.#O)){this.#t.stopSkillRecording?.();try{let e=this.#t.synthesizeSkill?.();if(!e)throw Error(`synthesizeSkill is unavailable`);this.#E=e.document,this.#D=e.manifest.id,this.#Ue(this.#r.t(`ui.panel.skillsStudioSynthesized`,{id:e.manifest.id}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}this.#Ze()}}#at(){this.#t.clearRecordedSteps?.(),this.#E=``,this.#D=``,this.#Ue(``),this.#Ze()}async#ot(){if(!(!this.#E||!this.#t.publishSkill||this.#O)){this.#O=!0,this.#Ue(``),this.#Ze();try{let e=await this.#t.publishSkill(this.#E,`studio-record`);this.#D=e.id,e.remoteError?this.#Ue(this.#r.t(`ui.panel.skillsStudioRemoteWarn`,{error:e.remoteError}),`warn`):this.#Ue(this.#r.t(`ui.panel.skillsStudioSaved`,{id:e.id,version:String(e.version)}),`ok`),this.#Ke()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}}async#st(e){if(!(!e||!this.#t.testSkill||this.#O)){this.#O=!0,this.#Ue(``),this.#Ze();try{let t=await this.#t.testSkill(e),n=t.length>180?`${t.slice(0,177)}…`:t;this.#Ue(this.#r.t(`ui.panel.skillsStudioTested`,{result:n}),`ok`),this.#Ke()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}}async#ct(){if(!this.#He()||this.#O)return;let e=this.#h.querySelector(`[data-role="skills-ask-input"]`).value.trim();if(!e)return;let t=[`You are authoring a reusable Page Agent skill for the goal below.`,`Explore the current page only as needed, then call save_skill with one complete skill Markdown document:`,`YAML frontmatter (name, description, version, id, scope: agent), a short guidance body, and exactly one skill-js fence exporting commands.`,`Keep the skill generic: parameterize values that change between runs as command inputs.`,`Do not ask the user unless you are blocked. Finish after save_skill succeeds.`,`Goal: ${e}`].join(`
375
- `);this.#Ue(this.#r.t(`ui.panel.skillsStudioAskQueued`),`warn`),this.#ht();try{await this.#t.execute(t)}finally{try{this.#Ke()}catch{}}}async#lt(){if(!(!this.#t.refreshRemoteSkills||this.#O)){this.#O=!0,this.#Ue(``),this.#Ze();try{let e=await this.#t.refreshRemoteSkills({force:!0});this.#Ke(),this.#Ue(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(e.ids.length||this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}}async#ut(e){if(!(!this.#t.removeAgentSkill||this.#O)){this.#O=!0,this.#Ue(``),this.#Ze();try{await this.#t.removeAgentSkill(e),this.#D===e&&(this.#D=``),this.#Ke(),this.#Ue(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}}async#dt(e){if(!this.#t.armSkillWatch||this.#O)return;let t=this.#Je(e);if(!t)return;let n=new Set(e.commands.map(e=>e.name)),r=`watch-${e.id}`,i,a=`interval`;if(t===`watch_reply`){let e=this.#r.t(`ui.panel.skillsStudioWatchNeedlePrompt`);i={needle:((typeof window.prompt==`function`?window.prompt(e,`reply`):null)??`reply`).trim()||`reply`}}else e.id===`on-enter`&&(a=`on-enter`);this.#O=!0,this.#Ue(``),this.#Ze();try{n.has(`snapshot`)?(await this.#t.loadSkill?.(e.id),this.#t.testSkill&&!n.has(`run`)&&await this.#t.testSkill(e.id)):await this.#t.loadSkill?.(e.id);let o=this.#t.armSkillWatch({id:r,skillId:e.id,command:t,input:i,trigger:a,everyMs:15e3});this.#qe(),this.#Ue(this.#r.t(`ui.panel.skillsStudioWatchArmed`,{id:o.id}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#Ze()}}#ft(e){if(this.#t.disarmSkillWatch){try{this.#t.disarmSkillWatch(e),this.#qe(),this.#Ue(``)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}this.#Ze()}}async#pt(){if(!this.#t.removeAgentSkill||this.#O)return;let e=this.#A.filter(e=>e.scope===`agent`).map(e=>e.id);if(e.length){this.#O=!0,this.#Ue(``),this.#Ze();try{for(let t of e)await this.#t.removeAgentSkill(t);e.includes(this.#D)&&(this.#D=``),this.#Ke(),this.#Ue(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ue(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`),this.#Ke()}finally{this.#O=!1,this.#Ze()}}}#mt(){this.#I!==`skills-studio`&&(this.#I===`voice`&&this.#z.disable(),this.#L=this.#I===`voice`?`voice`:`text`,this.#I=`skills-studio`,this.#C=`record`,this.#Ue(``),this.#He()&&(this.#Ke(),this.#qe()),this.#P=`expanded`,this.#N=!1,this.#e.dataset.follow=`expanded`,this.#Xe(),this.#Ve())}#ht(){if(this.#I!==`skills-studio`)return;this.#t.isSkillRecording?.()&&this.#t.stopSkillRecording?.(),this.#We();let e=this.#L;this.#I=e,e===`voice`&&this.#z.enable(),this.#Ve(),e===`text`&&this.#o.focus()}#gt(e){this.#C=e,e===`catalog`&&this.#He()&&this.#Ke(),this.#Ze()}#_t(){return typeof this.#t.attachTaskFile==`function`}#vt(){let e=this.#r.t.bind(this.#r),t=this.#u,n=this.#f;if(!t||!n)return;let r=this.#_t();t.hidden=!r||this.#I===`voice`,setButton(t,`paperclip`,e(`ui.panel.attachFile`)),t.disabled=!r;let i=r?this.#t.listTaskFiles?.()??[]:[];n.replaceChildren(),n.hidden=i.length===0&&!this.#S;for(let t of i){let r=document.createElement(`span`);r.className=Panel_module_default.attachChip;let i=document.createElement(`span`);if(i.className=Panel_module_default.attachName,i.textContent=t.name,r.append(i),typeof this.#t.removeTaskFile==`function`){let n=document.createElement(`button`);n.type=`button`,n.className=Panel_module_default.attachRemove,n.setAttribute(`aria-label`,e(`ui.panel.attachRemove`,{name:t.name})),n.innerHTML=icon(`close`),n.addEventListener(`click`,()=>{this.#t.removeTaskFile?.(t.id),this.#S=``,this.#vt()}),r.append(n)}n.append(r)}if(this.#S){let e=document.createElement(`span`);e.className=Panel_module_default.attachError,e.textContent=this.#S,n.append(e)}}async#yt(e){if(e?.length&&this.#t.attachTaskFile){this.#S=``;for(let t of Array.from(e))try{await this.#t.attachTaskFile(t)}catch(e){let t=e instanceof Error?e.message:String(e);this.#S=t||this.#r.t(`ui.panel.attachFailed`),console.warn(`[page-agent] attachTaskFile failed`,e);break}this.#d&&(this.#d.value=``),this.#vt()}}#bt(){let e=this.#r.t.bind(this.#r),t=this.#$.map(e=>({task:e.task,history:e.history,outcome:e.result?`${e.result.kind}: ${e.result.text}`:``}));if(this.#t.task||this.#t.history.length>0){let e=this.#Re();t.push({task:this.#t.task||``,history:[...this.#t.history],outcome:e?`${e.kind}: ${e.text}`:``})}let n=new Date,r=formatTrace(t,e,n),i=n.toISOString().replace(/[:.]/g,`-`).slice(0,19),a=URL.createObjectURL(new Blob([r],{type:`text/plain;charset=utf-8`})),o=document.createElement(`a`);o.href=a,o.download=`nostop-log-${i}.txt`,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}#xt(){return typeof window<`u`&&window.matchMedia(FOLLOW_CYCLE_MQ).matches}#St(){let e=this.#r.t(`ui.panel.expandFromFab`);this.#W.dataset.tip=e,this.#W.setAttribute(`aria-label`,e)}#Ct(e){let t=this.#N;this.#P=e,this.#N=e!==`expanded`,this.#e.dataset.follow=e,e===`fab`?(this.wrapper.style.opacity=`0`,this.wrapper.style.transform=`translateY(20px)`,this.wrapper.style.display=`none`,this.#W.hidden=!1,this.#St()):(this.#W.hidden=!0,this.wrapper.style.display===`none`&&(this.wrapper.style.display=`flex`,this.wrapper.getBoundingClientRect(),this.wrapper.style.opacity=`1`,this.wrapper.style.transform=`translateY(0)`)),t&&!this.#N&&this.#Xe(),this.#Ve()}#wt(){if(!this.#xt()){this.#Ct(this.#P===`expanded`?`bar`:`expanded`);return}this.#Ct({expanded:`bar`,bar:`fab`,fab:`expanded`}[this.#P])}#Tt(e){if(this.#xt()){e?this.#P===`expanded`?this.#Ct(`bar`):this.#Ct(`fab`):this.#Ct(`expanded`);return}this.#Ct(e?`bar`:`expanded`)}#Et(e){this.#I===`skills-studio`&&(this.#L=e),this.#I===`voice`&&e!==`voice`&&this.#z.disable(),e===`voice`?this.#z.enable():this.#z.disable(),this.#I=e,this.#Ve(),e===`text`&&this.#o.focus()}#Dt(){let e=this.#r.t.bind(this.#r),t=this.#z.state,n={"no-key":e(`ui.panel.voiceNoKey`),"mic-denied":e(`ui.panel.voiceDenied`),"mic-unsupported":e(`ui.panel.voiceUnavailable`),"mic-busy":e(`ui.panel.voiceMicBusy`),"connect-failed":e(`ui.panel.voiceConnectFailed`)},r=t===`listening`||t===`speaking`||t===`connecting`,i=r&&this.#R.hardwareMuted,a={off:e(`ui.panel.voiceOff`),connecting:e(`ui.panel.voiceConnecting`),listening:e(i?`ui.panel.voiceMicSilent`:`ui.panel.voiceListening`),speaking:e(`ui.panel.voiceSpeaking`),muted:e(`ui.panel.voiceMuted`),error:this.#z.error?n[this.#z.error]:e(`ui.panel.voiceConnectFailed`)},o={off:`off`,connecting:`active`,listening:i?`denied`:`active`,speaking:`active`,muted:`muted`,error:`denied`}[t];this.#m.dataset.voiceState=t;let s=this.#m.querySelector(`[data-role="lens"]`);s.dataset.state=o,s.innerHTML=icon(o===`active`?`mic`:`micOff`),this.#m.querySelector(`[data-role="voice-state"]`).textContent=a[t];let c=this.#m.querySelector(`[data-role="mic-device"]`),l=this.#R.label.trim();c.hidden=!l||!r&&t!==`muted`&&t!==`error`,c.textContent=l,c.disabled=!r,c.setAttribute(`aria-label`,e(`ui.panel.switchMic`)),c.dataset.tip=e(`ui.panel.switchMic`);let u=this.#m.querySelector(`[data-role="mute"]`),d=this.#z.muted;setButton(u,d?`mic`:`micOff`,e(d?`ui.panel.unmute`:`ui.panel.mute`)),u.setAttribute(`aria-pressed`,String(d)),u.disabled=t===`error`||t===`off`;let f=this.#m.querySelector(`[data-role="voice-stop"]`);if(f){let t=this.#t.status===`running`;setButton(f,t?`stop`:`close`,e(t?`ui.panel.stop`:`ui.panel.close`))}setButton(this.#m.querySelector(`[data-role="back"]`),`keyboard`,e(`ui.panel.switchToText`))}#Ot(){if(this.#P!==`bar`)return;let e=this.#r.t.bind(this.#r),t=this.#I===`voice`,n=this.#F.querySelector(`[data-role="follow-bar-status"]`),r=this.#F.querySelector(`[data-role="follow-bar-lens"]`),i=this.#F.querySelector(`[data-role="follow-bar-mute"]`),a=this.#F.querySelector(`[data-role="follow-bar-action"]`),o=this.#F.querySelector(`[data-role="follow-bar-minimize"]`);if(t){let t=this.#z.state,a=(t===`listening`||t===`speaking`||t===`connecting`)&&this.#R.hardwareMuted;n.textContent={off:e(`ui.panel.voiceOff`),connecting:e(`ui.panel.voiceConnecting`),listening:e(a?`ui.panel.voiceMicSilent`:`ui.panel.voiceListening`),speaking:e(`ui.panel.voiceSpeaking`),muted:e(`ui.panel.voiceMuted`),error:e(`ui.panel.voiceConnectFailed`)}[t];let o={off:`off`,connecting:`active`,listening:a?`denied`:`active`,speaking:`active`,muted:`muted`,error:`denied`}[t];r.hidden=!1,r.dataset.state=o,r.innerHTML=icon(o===`active`?`mic`:`micOff`),i.hidden=!1;let s=this.#z.muted;setButton(i,s?`mic`:`micOff`,e(s?`ui.panel.unmute`:`ui.panel.mute`)),i.setAttribute(`aria-pressed`,String(s)),i.disabled=t===`error`||t===`off`}else n.textContent=this.#Be(),r.hidden=!0,i.hidden=!0;let s=this.#t.status===`running`;setButton(a,s?`stop`:`close`,e(s?`ui.panel.stop`:`ui.panel.close`)),setButton(o,`chevronDown`,e(`ui.panel.followModeMinimize`))}#kt(){this.#o.style.height=`auto`,this.#o.style.height=`${Math.min(this.#o.scrollHeight,120)}px`}#At(){let e=this.#r.t.bind(this.#r),t=document.createElement(`div`);return t.id=`page-agent-runtime_agent-panel`,t.className=Panel_module_default.wrapper,t.setAttribute(`data-browser-use-ignore`,`true`),t.setAttribute(`data-page-agent-ignore`,`true`),t.dataset.state=`idle`,t.dataset.follow=`expanded`,t.innerHTML=`
374
+ `}var VoiceRuns=class{#e=[];#t=1;get list(){return this.#e}start(e,t){let n={id:this.#t++,script:e,status:`running`,at:t};return this.#e.push(n),n}finish(e,t){let n=this.#e.find(t=>t.id===e);n&&(n.status=`done`,n.output=t)}refuse(e,t,n){this.#e.push({id:this.#t++,script:e,output:t,status:`refused`,at:n})}takeAll(){let e=this.#e;return this.#e=[],e}},DRAG_KEY=`page-agent-panel-position`,FAB_KEY=`page-agent-fab-corner`,FAB_MARGIN=16,CORNERS=[`left-top`,`right-top`,`left-bottom`,`right-bottom`];function excerptOf(e,t){if(t)return t;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`step`&&n.action?.output)return n.action.output;if(n.type===`observation`&&n.content)return n.content}return``}function fillBrand(e){e.textContent=``;let t=document.querySelector(`link[rel~="icon"][href]`);if(!t){e.innerHTML=icon(`spark`);return}let n=document.createElement(`img`);n.alt=``,n.src=t.href,n.onerror=()=>{e.innerHTML=icon(`spark`)},e.append(n)}function setButton(e,t,n){e.innerHTML=icon(t),e.dataset.tip=n,e.setAttribute(`aria-label`,n),e.removeAttribute(`title`)}var CURSOR_ATTR=`data-pa-cursor-hidden`,PIN_PX=72,INTENT_MS=600,FOLLOW_CYCLE_MQ=`(max-width: 480px)`,Panel=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=null;#d=null;#f=null;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S=``;#C=`record`;#w=``;#T=``;#E=``;#D=``;#O=!1;#k=null;#A=[];#j=[];#M=!1;#N=!1;#P=`expanded`;#F;#I=`text`;#L=`text`;#R=new MicrophoneControl(()=>this.#Ue());#z;#B=!1;#V=null;#H=null;#U=null;#W;#G;#K;#q;#J=!0;#Y=0;#X=0;#Z=!1;#Q=0;#$=[];#ee=null;#te=!1;#ne=new VoiceRuns;#re=``;#ie=0;#ae=new Set;#oe;#se;#ce=null;#le=!1;#ue=()=>{this.#Pe(),this.#Ue()};#de=()=>{this.#V?.type===`executing`&&(this.#V=null),this.#Ue()};#fe=e=>{this.#V=e.detail,this.#Ue()};#pe=()=>this.dispose();#me=e=>{if(this.#Ye(),e.type===`skills:watch-fired`){let t=e.detail,n=t?.message?.trim()||t?.skillId||`ok`;this.#Ge(this.#r.t(`ui.panel.skillsStudioWatchFired`,{message:n}),`ok`)}this.#I===`skills-studio`&&this.#$e()};get wrapper(){return this.#e}constructor(e,t={}){if(this.#t=e,this.#n=t,this.#r=new I18n(t.language??`en-US`),t.sessionRecovery===!0)try{this.#ee=createPanelRecovery(window.sessionStorage,t.sessionRecoveryKey),this.#$=this.#ee.load()}catch(e){this.#ee=null,console.warn(`[page-agent] Conversation recovery unavailable`,e)}this.#t.onAskUser=(e,t)=>this.#Oe(e,t),this.#e=this.#Mt(),this.#i=this.#e.querySelector(`[data-role="feed"]`),typeof ResizeObserver<`u`&&new ResizeObserver(()=>{this.#J&&(this.#i.scrollTop=this.#i.scrollHeight)}).observe(this.#i),this.#a=this.#e.querySelector(`[data-role="status"]`),this.#o=this.#e.querySelector(`[data-role="input"]`),this.#s=this.#e.querySelector(`[data-role="answer-context"]`),this.#c=this.#e.querySelector(`[data-role="send"]`),this.#l=this.#e.querySelector(`[data-role="mic"]`),this.#u=this.#e.querySelector(`[data-role="attach"]`),this.#d=this.#e.querySelector(`[data-role="attach-input"]`),this.#f=this.#e.querySelector(`[data-role="attach-list"]`),this.#p=this.#e.querySelector(`[data-role="composer"]`),this.#m=this.#e.querySelector(`[data-role="voice"]`),this.#h=this.#e.querySelector(`[data-role="skills-studio"]`),this.#_=this.#e.querySelector(`[data-role="feed-wrap"]`),this.#g=this.#e.querySelector(`[data-role="skills"]`),this.#v=this.#e.querySelector(`[data-role="action"]`),this.#y=this.#e.querySelector(`[data-role="collapse"]`),this.#b=this.#e.querySelector(`[data-role="cursor"]`),this.#x=this.#e.querySelector(`[data-role="export"]`),this.#F=this.#e.querySelector(`[data-role="follow-bar"]`),this.#x.addEventListener(`click`,e=>{e.stopPropagation(),this.#St()}),this.#t.addEventListener(`statuschange`,this.#ue),this.#t.addEventListener(`historychange`,this.#de),this.#t.addEventListener(`activity`,this.#fe),this.#t.addEventListener(`dispose`,this.#pe),this.#t.addEventListener(`skills:watch-armed`,this.#me),this.#t.addEventListener(`skills:watch-fired`,this.#me),this.#t.addEventListener(`skills:watch-stopped`,this.#me),this.#z=this.#Re(),this.#Pt(),this.#ge(),this.#It(),this.#Ye(),this.#Ue(),this.#Ft(),this.hide()}show(){this.#P===`fab`&&(this.#P=`expanded`,this.#N=!1),this.#W.hidden=!0,this.wrapper.dataset.follow=this.#P,this.wrapper.style.display=`flex`,this.wrapper.getBoundingClientRect(),this.wrapper.style.opacity=`1`,this.wrapper.style.transform=`translateY(0)`,this.#Ue()}hide(){this.#P=`fab`,this.#N=!0,this.wrapper.dataset.follow=`fab`,this.wrapper.style.opacity=`0`,this.wrapper.style.transform=`translateY(20px)`,this.wrapper.style.display=`none`,this.#W.hidden=!1,this.#wt()}reset(){this.#H=null,this.#V=null,this.#I=`text`,this.#P=`bar`,this.#N=!0,this.#Ue()}expand(){this.#Tt(`expanded`)}collapse(){this.#Tt(`bar`)}dispose(){this.#Ke(),this.#t.isSkillRecording?.()&&this.#t.stopSkillRecording?.(),this.#z.disable(),this.#W.remove(),this.#t.removeEventListener(`statuschange`,this.#ue),this.#t.removeEventListener(`historychange`,this.#de),this.#t.removeEventListener(`activity`,this.#fe),this.#t.removeEventListener(`dispose`,this.#pe),this.#t.removeEventListener(`skills:watch-armed`,this.#me),this.#t.removeEventListener(`skills:watch-fired`,this.#me),this.#t.removeEventListener(`skills:watch-stopped`,this.#me),this.#H=null,this.wrapper.remove()}#he(){let e=this.#i,t=this.#t.history.length,n=Math.max(0,t-this.#X);if(this.#X=t,this.#H&&(this.#J=!0),this.#Z){this.#Z=!1;let t=e.querySelectorAll(`[data-mark="turn"]`),n=t[t.length-1];n&&(this.#J=!1,e.scrollTop=n.offsetTop-12)}else this.#J?e.scrollTop=e.scrollHeight:(n>0||this.#H)&&(this.#Y+=n);this.#be(),this.#ye()}#ge(){let e=this.#r.t.bind(this.#r);this.#e.setAttribute(`data-lenis-prevent`,``);let t=e=>e.stopPropagation();this.#e.addEventListener(`wheel`,t,{passive:!0}),this.#e.addEventListener(`touchmove`,t,{passive:!0}),this.#G=this.#e.querySelector(`[data-role="rail"]`),this.#K=this.#e.querySelector(`[data-role="thumb"]`),this.#q=this.#e.querySelector(`[data-role="jump"]`);let n=this.#i,r=()=>{this.#Q=performance.now()+INTENT_MS};n.addEventListener(`wheel`,r,{passive:!0}),n.addEventListener(`touchstart`,r,{passive:!0}),n.addEventListener(`mousedown`,r),n.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)&&r(),(e.key===`Home`||e.key===`End`)&&(e.preventDefault(),this.#ve(e.key===`End`?`end`:`start`))}),n.addEventListener(`scroll`,()=>{n.scrollHeight-n.scrollTop-n.clientHeight<PIN_PX?(this.#J=!0,this.#Y=0):performance.now()<this.#Q&&(this.#J=!1),this.#ye()}),new ResizeObserver(()=>{this.#be(),this.#ye()}).observe(n),this.#q.addEventListener(`click`,()=>this.#ve(`end`)),this.#oe=this.#e.querySelector(`[data-role="peek"]`),this.#G.addEventListener(`pointerover`,e=>{let t=e.target.closest(`[data-mark-dot]`);t&&this.#xe(t)}),this.#G.addEventListener(`pointerleave`,()=>this.#Se()),this.#oe.addEventListener(`pointerenter`,()=>clearTimeout(this.#se)),this.#oe.addEventListener(`pointerleave`,()=>this.#Se()),this.#oe.addEventListener(`click`,e=>{let t=e.target.closest(`[data-role="pin"]`);if(!t)return;let n=Number(t.dataset.run);this.#ae.has(n)?this.#ae.delete(n):this.#ae.add(n),this.#oe.hidden=!0,this.#Ue()}),this.#q.setAttribute(`aria-label`,e(`ui.panel.jumpLatest`)),this.#G.addEventListener(`click`,e=>{let t=e.target.closest(`[data-target]`);if(!t)return;let r=n.querySelector(`[data-id="${t.dataset.target}"]`);r&&(this.#J=!1,n.scrollTo({top:r.offsetTop-12,behavior:this.#_e()}))})}#_e(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}#ve(e){let t=this.#i;this.#J=e===`end`,e===`end`&&(this.#Y=0),t.scrollTo({top:e===`end`?t.scrollHeight:0,behavior:this.#_e()}),this.#ye()}#ye(){let e=this.#r.t.bind(this.#r),t=this.#i,n=t.scrollHeight-t.clientHeight,r=n>4,i=t.scrollTop>8,a=n-t.scrollTop>8,o=r?`linear-gradient(to bottom, ${i?`transparent 0, #000 24px`:`#000 0`}, ${a?`#000 calc(100% - 24px), transparent 100%`:`#000 100%`})`:`none`;t.style.maskImage=o,t.style.webkitMaskImage=o,this.#G.hidden=!r;let s=t.querySelectorAll(`[data-mark="turn"]`),c=``;if(s.forEach(e=>{e.offsetTop<=t.scrollTop+48&&(c=e.dataset.id??``)}),this.#G.querySelectorAll(`[data-mark-dot]`).forEach(e=>{e.dataset.active=String(e.dataset.target===c)}),r){let e=t.clientHeight/t.scrollHeight,n=this.#G.clientHeight;this.#K.style.height=`${Math.max(24,e*n)}px`,this.#K.style.top=`${t.scrollTop/t.scrollHeight*n}px`}let l=!this.#J&&(this.#Y>0||this.#H!==null||r&&a);this.#q.hidden=!l,l&&(this.#q.innerHTML=`${icon(`arrowDown`)}<span>${this.#Y>0?e(`ui.panel.newCount`,{count:String(this.#Y)}):e(`ui.panel.jumpLatest`)}</span>`)}#be(){let e=this.#r.t.bind(this.#r),t=this.#i,n=this.#G.clientHeight;this.#G.querySelectorAll(`[data-mark-dot]`).forEach(e=>e.remove()),t.querySelectorAll(`[data-mark]`).forEach((r,i)=>{let a=`m${i}`;r.dataset.id=a;let o=r.dataset.mark??``,s=document.createElement(`button`);s.type=`button`,s.className=Panel_module_default.railMark,s.dataset.markDot=``,s.dataset.kind=o,s.dataset.target=a,s.dataset.run=r.dataset.run??``,s.dataset.pinned=r.dataset.pinned??`false`,s.dataset.title=o===`turn`?r.textContent??``:``,s.dataset.preview=r.dataset.preview??``,s.style.top=`${r.offsetTop/t.scrollHeight*n}px`,s.setAttribute(`aria-label`,o===`turn`?r.textContent??``:e(`ui.panel.step`,{number:String(i+1)})),this.#G.append(s)})}#xe(e){clearTimeout(this.#se);let t=this.#r.t.bind(this.#r),n=this.#oe,r=e.dataset.run??``;n.replaceChildren();let i=document.createElement(`div`);i.className=Panel_module_default.peekHead;let a=document.createElement(`strong`),o=e.dataset.kind===`question`?t(`ui.panel.questionTitle`):e.dataset.kind===`result`?t(`ui.panel.resultTitle`):``;if(a.textContent=e.dataset.title||o,i.append(a),r!==``){let e=document.createElement(`button`),n=this.#ae.has(Number(r));e.type=`button`,e.className=Panel_module_default.pin,e.dataset.role=`pin`,e.dataset.run=r,e.setAttribute(`aria-pressed`,String(n)),e.setAttribute(`aria-label`,t(n?`ui.panel.unpin`:`ui.panel.pin`)),e.innerHTML=icon(`bookmark`),i.append(e)}let s=document.createElement(`p`);s.className=Panel_module_default.peekText,s.textContent=localizeCore(e.dataset.preview??``,t),n.append(i,s),n.hidden=!1;let c=this.#i.parentElement.getBoundingClientRect(),l=e.getBoundingClientRect(),u=Math.min(Math.max(8,l.top-c.top-16),c.height-n.offsetHeight-8);n.style.top=`${u}px`}#Se(){clearTimeout(this.#se),this.#se=setTimeout(()=>{this.#oe.hidden=!0},140)}#Ce(e,t,n,r){let i=excerptOf(n,r?.text??``);for(let n of e)n.dataset.mark===`turn`&&(n.dataset.run=String(t),n.dataset.pinned=String(this.#ae.has(t)),n.dataset.preview=i)}#we(){if(!this.#ee)return;let e=[...this.#$];(this.#t.task||this.#t.history.length||this.#ne.list.length)&&e.push({task:this.#t.task||``,history:[...this.#t.history],result:this.#t.status===`running`?{kind:`stopped`,text:`Interrupted by reload or navigation. Actions were not replayed.`}:this.#Be(),voiceRuns:[...this.#ne.list]});try{this.#ee.save(e)}catch(e){this.#te||console.warn(`[page-agent] Could not save conversation recovery`,e),this.#te=!0}}#Te(){let e=this.#t.task||``,t=[...this.#t.history],n=this.#ne.takeAll();(e||t.length!==0||n.length!==0)&&this.#$.push({task:e,history:t,result:this.#Be(),voiceRuns:n})}#Ee(e,t){return e.map(e=>{let n=scriptCard({key:`voice-${e.id}`,script:e.script,output:e.output,t,source:`voice`,refused:e.status===`refused`,time:new Date(e.at).toLocaleTimeString()});return n.classList.add(Panel_module_default.enter),n.dataset.mark=`voice`,n})}#De(e){let t=[];return this.#$.forEach((n,r)=>{let i=buildFeed({key:`run-${r}`,task:n.task,history:n.history,live:null,question:null,result:n.result},e);this.#Ce(i,r,n.history,n.result),t.push(...i,...this.#Ee(n.voiceRuns,e));let a=document.createElement(`div`);a.className=Panel_module_default.divider,a.textContent=e(`ui.panel.newTask`),t.push(a)}),t}#Oe(e,t){return new Promise((n,r)=>{let i=(t?.choices??[]).map(e=>e.trim()).filter(Boolean),a=t?.kind??`text`;(a===`choice`||a===`multi`)&&i.length<2&&(a=`text`),this.#H={text:e.trim(),kind:a,choices:i,selected:new Set,resolve:n},this.#Dt(!1),this.#Ue();let o=a===`text`||i.length===0?``:`\nOptions (${a}): ${i.map((e,t)=>`${t+1}. ${e}`).join(`; `)}`;this.#z.report({kind:`question`,text:`${e.trim()}${o}`}),a===`text`&&this.#o.focus(),t?.signal?.addEventListener(`abort`,()=>{this.#H=null,this.#Ue(),r(t.signal.reason)},{once:!0})})}#ke(e){if(!this.#H)return!1;let t=e.trim();if(!t)return!1;let{resolve:n}=this.#H;return this.#H=null,this.#U?.remove(),this.#U=null,n(t),this.#Ue(),!0}#Ae(){let e=this.#H;if(!e||e.kind!==`choice`&&e.kind!==`multi`||e.choices.length===0){this.#U?.remove(),this.#U=null;return}let t=this.#r.t.bind(this.#r),n=this.#U;n||(n=document.createElement(`div`),n.className=Panel_module_default.choiceRow,n.dataset.role=`choice-row`,this.#s.append(n),this.#U=n),n.replaceChildren();for(let t of e.choices){let r=document.createElement(`button`);r.type=`button`,r.className=Panel_module_default.choiceChip,r.textContent=t;let i=e.selected.has(t);r.setAttribute(`aria-pressed`,String(i)),i&&(r.dataset.selected=`true`),r.addEventListener(`click`,()=>{if(this.#H){if(this.#H.kind===`choice`){this.#ke(t);return}this.#H.selected.has(t)?this.#H.selected.delete(t):this.#H.selected.add(t),this.#Ue()}}),n.append(r)}if(e.kind===`multi`){let r=document.createElement(`button`);r.type=`button`,r.className=Panel_module_default.choiceConfirm,r.textContent=t(`ui.panel.answerConfirmMulti`),r.disabled=e.selected.size===0,r.addEventListener(`click`,()=>{this.#H&&this.#H.selected.size!==0&&this.#ke([...this.#H.selected].join(`; `))}),n.append(r)}}#je(){let e=this.#o.value.trim();e&&this.#Ne(e)&&(this.#o.value=``,this.#jt())}#Me(e){let t=e.trim();return!t||this.#t.status!==`running`||typeof this.#t.pushObservation!=`function`?!1:(this.#t.pushObservation(`User said while the task was running: ${t}`),this.#Ue(),!0)}#Ne(e){return this.#H?this.#ke(e):this.#t.status!==`running`&&(this.#Te(),this.#Z=!0,this.#B=!1,this.#t.execute(e),!0)}#Pe(){let e=this.#t.status;if(this.#B||e!==`completed`&&e!==`error`&&e!==`stopped`)return;this.#B=!0;let t=this.#r.t.bind(this.#r),n=this.#Be(),r={done:`ui.panel.resultDone`,notDone:`ui.panel.resultNotDone`,stopped:`ui.panel.resultStopped`,error:`ui.panel.resultError`},i=n?.kind??`stopped`;this.#z.report({kind:i===`notDone`?`not-done`:i,text:n?.text||t(r[i])})}async#Fe(e){let t=Date.now();if(this.#t.status===`running`){let n=`The agent is busy with a task, so the page cannot be changed now. Tell the user to try again when the task ends.`;return this.#ne.refuse(e,n,t),console.debug(`[page-agent voice] refused`,{script:e,reason:n}),this.#Ue(),n}let n=this.#n.runScript,r=this.#ne.start(e,t);this.#Ue();let i;try{i=n?await n(e):`Running scripts is not available in this session.`}catch(e){i=`The script failed: ${e instanceof Error?e.message:`unknown error`}`}return this.#ne.finish(r.id,i),console.debug(`[page-agent voice]`,{script:e,output:i}),this.#Ue(),i}#Ie(){let e=[],t=this.#t.status,n=this.#t.task?.trim();n?e.push(`Active task (${t}): ${n}`):e.push(`Agent status: ${t}`),this.#H&&e.push(`Pending ask (${this.#H.kind}): ${this.#H.text}`+(this.#H.choices.length?` Options: ${this.#H.choices.join(` | `)}`:``));let r=this.#t.history.slice(-6);for(let t of r){if(t.type===`observation`&&t.content){e.push(`obs: ${t.content.slice(0,180)}`);continue}if(t.type===`step`){let n=t.reflection?.next_goal?.trim(),r=t.action?.name,i=[n&&`goal=${n}`,r&&`action=${r}`].filter(Boolean).join(`, `);i&&e.push(`step: ${i}`)}}return e.join(`
375
+ `)}async#Le(e){let t=this.#Ie(),n=this.#n.getContext;if(!n)return`${t}\n\nget_context is not available in this session.`;try{return`${t}\n\n${await n(e)}`}catch(e){return`${t}\n\nget_context failed: ${e instanceof Error?e.message:`unknown error`}`}}#Re(){return new VoiceSession({apiKey:this.#n.voice?.apiKey,settings:{instructions:`${resolveVoicePrompt(this.#n.voice?.systemPrompt,this.#n.voice?.overrideSystemPrompt===!0)}\n\n${languageRule(this.#r.getLanguage())}`,language:this.#r.getLanguage()===`pt-BR`?`pt`:`en`},mic:this.#R,createClient:e=>this.#n.voice?.provider===`gemini`?new GeminiLiveClient(e):new RealtimeClient(e),onTask:e=>this.#Ne(e),onScript:e=>this.#Fe(e),isWaitingForAnswer:()=>this.#H!==null,onAnswer:e=>this.#ke(e),onNote:e=>this.#Me(e),onGetContext:e=>this.#Le(e),onChange:()=>this.#Ue()})}#ze(){this.#t.status===`running`?this.#t.stop():this.hide()}#Be(){let e=this.#t.status;return e===`completed`?{kind:this.#t.lastResult?.success===!1?`notDone`:`done`,text:lastOutcomeText(this.#t.history)}:e===`error`?{kind:`error`,text:lastOutcomeText(this.#t.history)}:e===`stopped`?{kind:`stopped`,text:``}:null}#Ve(){return this.#H?`waiting`:this.#t.status===`running`?`running`:this.#Be()?.kind??`idle`}#He(){let e=this.#r.t.bind(this.#r);if(this.#H)return e(`ui.panel.statusWaiting`);if(this.#t.status===`running`)return this.#V?.type===`retrying`?e(`ui.panel.statusRetrying`,{attempt:String(this.#V.attempt),max:String(this.#V.maxAttempts)}):this.#V?.type===`executing`?toolLabel(this.#V.tool,this.#V.input,e):this.#V?.type===`thinking`?e(`ui.panel.thinking`):e(`ui.panel.statusRunning`);switch(this.#Be()?.kind){case`done`:return e(`ui.panel.statusDone`);case`notDone`:return e(`ui.panel.statusNotDone`);case`stopped`:return e(`ui.panel.statusStopped`);case`error`:return e(`ui.panel.statusError`);default:return e(`ui.panel.ready`)}}#Ue(){this.#we();let e=this.#r.t.bind(this.#r),t=this.#Ve();this.#e.dataset.state=t,this.#e.dataset.mode=this.#I,this.#e.dataset.follow=this.#P,this.#e.classList.toggle(Panel_module_default.collapsed,this.#N),this.#a.textContent=this.#He();let n=buildFeed({key:`current`,task:this.#t.task||``,history:this.#t.history,live:this.#t.status===`running`?this.#V:null,question:this.#H?.text??null,result:this.#H?null:this.#Be()},e);this.#Ce(n,this.#$.length,this.#t.history,this.#Be());let r=[...this.#De(e),...n,...this.#Ee(this.#ne.list,e)];if(r.length===0){let t=document.createElement(`div`);t.className=Panel_module_default.empty,t.textContent=e(`ui.panel.emptyHint`),r.push(t)}let i=JSON.stringify([this.#t.task,this.#t.history.length,this.#t.history.at(-1)??null,this.#t.status===`running`?this.#V:null,this.#H?{text:this.#H.text,kind:this.#H.kind,choices:this.#H.choices,selected:[...this.#H.selected]}:null,this.#H?null:this.#Be(),this.#ne.list,this.#$.length,this.#N,this.#P,this.#I]);if(i!==this.#re){this.#re=i;let e=r.length>this.#ie;r.forEach((t,n)=>{(!e||n<this.#ie)&&t.classList.remove(Panel_module_default.enter)}),this.#ie=r.length,this.#i.replaceChildren(...r)}this.#he();let a=this.#t.status===`running`,o=this.#H!==null,s=!a&&!o&&this.#Be()!==null,c=this.#I===`skills-studio`,l=this.#P===`bar`&&this.#Ct(),u=s&&this.#n.promptForNextTask===!1;if(this.#_.hidden=c||l,this.#p.hidden=u||this.#I!==`text`||c||l,this.#m.hidden=this.#I!==`voice`||l,this.#h.hidden=!c||l,this.#F.hidden=!l,this.#kt(),this.#At(),this.#$e(),this.#s.hidden=!o,o&&this.#H){let t=this.#H,n=t.kind===`multi`?e(`ui.panel.answerTitleMulti`):t.kind===`choice`?e(`ui.panel.answerTitleChoice`):e(`ui.panel.answerTitle`);this.#U=null,this.#s.replaceChildren();let r=document.createElement(`div`);r.textContent=`${n}: ${t.text}`,this.#s.append(r),this.#Ae()}else this.#s.textContent=``,this.#U?.remove(),this.#U=null;let d=o&&this.#H!==null&&this.#H.kind===`choice`;this.#o.disabled=a&&!o||d,this.#o.placeholder=o?this.#H?.kind===`multi`?e(`ui.panel.composerAnswerMulti`):this.#H?.kind===`choice`?e(`ui.panel.composerAnswerChoice`):e(`ui.panel.composerAnswer`):e(a?`ui.panel.composerRunning`:`ui.panel.composerPlaceholder`),this.#c.disabled=a&&!o||d,setButton(this.#c,`send`,e(`ui.panel.send`)),setButton(this.#x,`download`,e(`ui.panel.exportLog`)),this.#x.hidden=this.#$.length===0&&this.#t.history.length===0,this.#bt(),a?setButton(this.#v,`stop`,e(`ui.panel.stop`)):setButton(this.#v,`close`,e(`ui.panel.close`));let f=this.#P===`expanded`?this.#Ct()?e(`ui.panel.followModeBar`):e(`ui.panel.collapse`):this.#P===`bar`?e(`ui.panel.expand`):e(`ui.panel.expandFromFab`);setButton(this.#y,this.#P===`expanded`?`chevronUp`:`chevronDown`,f),this.#y.setAttribute(`aria-expanded`,String(this.#P===`expanded`)),setButton(this.#g,`skills`,e(`ui.panel.skillsStudio`)),this.#g.setAttribute(`aria-pressed`,String(c)),this.#g.hidden=this.#I===`voice`,this.#I===`voice`?setButton(this.#l,`keyboard`,e(`ui.panel.switchToText`)):setButton(this.#l,`mic`,e(`ui.panel.switchToVoice`)),this.#l.setAttribute(`aria-pressed`,String(this.#I===`voice`)),this.#l.hidden=c}#We(){return typeof this.#t.startSkillRecording==`function`&&typeof this.#t.listSkillsCatalog==`function`&&typeof this.#t.synthesizeSkill==`function`}#Ge(e,t=``){this.#w=e,this.#T=t}#Ke(){this.#k&&=(clearInterval(this.#k),null)}#qe(){if(this.#t.isSkillRecording?.()&&this.#I===`skills-studio`){this.#k||=setInterval(()=>{if(this.#I!==`skills-studio`||!this.#t.isSkillRecording?.()){this.#Ke(),this.#$e();return}this.#$e()},400);return}this.#Ke()}#Je(){try{this.#A=this.#t.listSkillsCatalog?.()??[]}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`),this.#A=[]}}#Ye(){try{this.#j=this.#t.listSkillWatches?.()??[]}catch{this.#j=[]}}#Xe(e){let t=new Set(e.commands.map(e=>e.name));return t.has(`check`)?`check`:t.has(`watch_reply`)?`watch_reply`:t.has(`run`)?`run`:null}#Ze(){return typeof this.#t.armSkillWatch==`function`}#Qe(){this.#t.notifySkillWatchEnter?.()}#$e(){if(this.#I!==`skills-studio`)return;let e=this.#r.t.bind(this.#r),t=this.#We(),n=!!this.#t.isSkillRecording?.(),r=this.#t.getRecordedSteps?.()??[],i=this.#O||this.#t.status===`running`;setButton(this.#h.querySelector(`[data-role="skills-back"]`),`close`,e(`ui.panel.skillsStudioBack`));let a=this.#h.querySelectorAll(`[data-role="skills-tab"]`);for(let e of a){let t=e.dataset.tab===this.#C;e.setAttribute(`aria-selected`,String(t))}let o=this.#h.querySelectorAll(`[data-role="skills-pane"]`);for(let e of o)e.hidden=e.dataset.tab!==this.#C;let s=this.#h.querySelector(`[data-role="skills-unavailable"]`);s.hidden=t,s.textContent=e(`ui.panel.skillsStudioUnavailable`);for(let e of o)e.dataset.tab&&e.toggleAttribute(`data-disabled`,!t);let c=this.#h.querySelector(`[data-role="skills-record-status"]`),l=this.#h.querySelector(`[data-role="skills-ask-status"]`),u=this.#h.querySelector(`[data-role="skills-catalog-status"]`),d=this.#w||e(n?`ui.panel.skillsStudioRecording`:`ui.panel.skillsStudioIdle`),f=this.#w?this.#T:n?`warn`:``;for(let e of[c,l,u])e.textContent=d,f?e.dataset.tone=f:delete e.dataset.tone;let p=this.#h.querySelector(`[data-role="skills-record-start"]`),m=this.#h.querySelector(`[data-role="skills-record-stop"]`),h=this.#h.querySelector(`[data-role="skills-record-finish"]`),g=this.#h.querySelector(`[data-role="skills-record-clear"]`),_=this.#h.querySelector(`[data-role="skills-record-save"]`),v=this.#h.querySelector(`[data-role="skills-record-test"]`);p.textContent=e(`ui.panel.skillsStudioStart`),m.textContent=e(`ui.panel.skillsStudioStop`),h.textContent=e(`ui.panel.skillsStudioFinish`),g.textContent=e(`ui.panel.skillsStudioClear`),_.textContent=e(`ui.panel.skillsStudioSave`),v.textContent=e(`ui.panel.skillsStudioTest`),p.disabled=!t||i||n,m.disabled=!t||i||!n,h.disabled=!t||i||!n&&r.length===0,g.disabled=!t||i||r.length===0&&!this.#E,_.disabled=!t||i||!this.#E,v.disabled=!t||i||!this.#D;let y=this.#h.querySelector(`[data-role="skills-steps"]`),b=this.#h.querySelector(`[data-role="skills-steps-empty"]`);b.textContent=e(`ui.panel.skillsStudioEmptySteps`),b.hidden=r.length>0,y.hidden=r.length===0,y.replaceChildren();for(let e of r)y.append(this.#nt(e,t&&!i));let x=this.#h.querySelector(`[data-role="skills-preview-label"]`),S=this.#h.querySelector(`[data-role="skills-preview"]`),C=this.#h.querySelector(`[data-role="skills-preview-actions"]`);x.textContent=e(`ui.panel.skillsStudioPreview`);let w=!!this.#E;x.hidden=!w,S.hidden=!w,C.hidden=!w,S.textContent=this.#E;let T=this.#h.querySelector(`[data-role="skills-ask-start"]`),E=this.#h.querySelector(`[data-role="skills-ask-input"]`);T.textContent=e(`ui.panel.skillsStudioAskStart`),T.disabled=!t||i||!E.value.trim(),E.disabled=!t||i;let D=this.#h.querySelector(`[data-role="skills-catalog-refresh"]`),O=this.#h.querySelector(`[data-role="skills-catalog-remove-agent"]`);D.textContent=e(`ui.panel.skillsStudioRefreshRemote`),O.textContent=e(`ui.panel.skillsStudioRemoveAgentSkills`);let k=this.#A.filter(e=>e.scope===`agent`);D.disabled=!t||i,O.disabled=!t||i||k.length===0;let A=this.#h.querySelector(`[data-role="skills-catalog-empty"]`),j=this.#h.querySelector(`[data-role="skills-catalog-list"]`),M=this.#h.querySelector(`[data-role="skills-catalog-count"]`);M.textContent=e(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),A.textContent=e(`ui.panel.skillsStudioEmptyCatalog`),A.hidden=this.#A.length>0,j.hidden=this.#A.length===0,j.replaceChildren();for(let e of this.#A)j.append(this.#rt(e,t&&!i));this.#et(t&&!i),this.#qe()}#et(e){let t=this.#r.t.bind(this.#r),n=this.#h.querySelector(`[data-role="skills-watchers"]`);if(!n)return;let r=this.#Ze();if(n.hidden=!r,!r)return;this.#Ye();let i=n.querySelector(`[data-role="skills-watchers-title"]`),a=n.querySelector(`[data-role="skills-watchers-empty"]`),o=n.querySelector(`[data-role="skills-watchers-list"]`);i.textContent=t(`ui.panel.skillsStudioWatchers`),a.textContent=t(`ui.panel.skillsStudioWatchEmpty`),a.hidden=this.#j.length>0,o.hidden=this.#j.length===0,o.replaceChildren();for(let t of this.#j)o.append(this.#tt(t,e))}#tt(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioWatcherChip,r.dataset.watchId=e.id;let i=document.createElement(`span`);i.className=Panel_module_default.studioWatcherLabel,i.textContent=`${e.skillId}/${e.command}`;let a=document.createElement(`span`);a.className=Panel_module_default.studioWatcherMeta,a.textContent=e.trigger;let o=document.createElement(`button`);return o.type=`button`,o.textContent=n(`ui.panel.skillsStudioDisarmWatch`),o.disabled=!t||typeof this.#t.disarmSkillWatch!=`function`,o.addEventListener(`click`,()=>this.#mt(e.id)),r.append(i,a,o),r}#nt(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioStep,r.dataset.stepId=e.id;let i=document.createElement(`div`);i.className=Panel_module_default.studioStepBody;let a=document.createElement(`span`);a.className=Panel_module_default.studioStepKind,a.textContent=e.kind;let o=document.createElement(`div`),s=e.rawLabel||[e.role,e.name?`"${e.name}"`:``].filter(Boolean).join(` `)||e.kind;o.append(a,document.createTextNode(s));let c=document.createElement(`div`);c.className=Panel_module_default.studioStepMeta;let l=[e.value===void 0?``:`value=${JSON.stringify(e.value)}`,e.param?`param`:``].filter(Boolean);c.textContent=l.join(` · `),i.append(o),l.length&&i.append(c);let u=document.createElement(`div`);if(u.className=Panel_module_default.studioStepActions,e.kind===`fill`||e.kind===`select`){let r=document.createElement(`button`);r.type=`button`,r.textContent=e.param?n(`ui.panel.skillsStudioUnparam`):n(`ui.panel.skillsStudioParam`),r.disabled=!t,r.addEventListener(`click`,()=>{this.#t.toggleRecordedStepParam?.(e.id),this.#E=``,this.#D=``,this.#$e()}),u.append(r)}let d=document.createElement(`button`);return d.type=`button`,d.textContent=n(`ui.panel.skillsStudioRemoveStep`),d.disabled=!t,d.addEventListener(`click`,()=>{this.#t.removeRecordedStep?.(e.id),this.#E=``,this.#D=``,this.#$e()}),u.append(d),r.append(i,u),r}#rt(e,t){let n=this.#r.t.bind(this.#r),r=document.createElement(`li`);r.className=Panel_module_default.studioCatalogRow;let i=document.createElement(`div`);i.className=Panel_module_default.studioCatalogBody;let a=document.createElement(`div`);a.textContent=e.name||e.id;let o=document.createElement(`div`);o.className=Panel_module_default.studioCatalogMeta;let s=e.scope===`remote`?n(`ui.panel.skillsStudioScopeRemote`):n(`ui.panel.skillsStudioScopeAgent`);o.textContent=[e.id,s,e.loaded?n(`ui.panel.skillsStudioLoaded`):``,e.description].filter(Boolean).join(` · `),i.append(a,o);let c=document.createElement(`div`);if(c.className=Panel_module_default.studioCatalogActions,this.#Xe(e)&&this.#Ze()){let r=document.createElement(`button`);r.type=`button`,r.dataset.variant=`accent`,r.textContent=n(`ui.panel.skillsStudioArmWatch`),r.disabled=!t,r.addEventListener(`click`,()=>void this.#pt(e)),c.append(r)}let l=document.createElement(`button`);if(l.type=`button`,l.textContent=n(`ui.panel.skillsStudioTest`),l.disabled=!t,l.addEventListener(`click`,()=>void this.#lt(e.id)),c.append(l),e.scope===`agent`){let r=document.createElement(`button`);r.type=`button`,r.textContent=n(`ui.panel.skillsStudioRemoveSkill`),r.disabled=!t,r.addEventListener(`click`,()=>void this.#ft(e.id)),c.append(r)}return r.append(i,c),r}async#it(){if(!(!this.#We()||this.#O)){this.#O=!0,this.#Ge(``),this.#$e();try{await this.#t.startSkillRecording?.()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}}#at(){this.#t.stopSkillRecording?.(),this.#Ge(``),this.#$e()}#ot(){if(!(!this.#We()||this.#O)){this.#t.stopSkillRecording?.();try{let e=this.#t.synthesizeSkill?.();if(!e)throw Error(`synthesizeSkill is unavailable`);this.#E=e.document,this.#D=e.manifest.id,this.#Ge(this.#r.t(`ui.panel.skillsStudioSynthesized`,{id:e.manifest.id}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}this.#$e()}}#st(){this.#t.clearRecordedSteps?.(),this.#E=``,this.#D=``,this.#Ge(``),this.#$e()}async#ct(){if(!(!this.#E||!this.#t.publishSkill||this.#O)){this.#O=!0,this.#Ge(``),this.#$e();try{let e=await this.#t.publishSkill(this.#E,`studio-record`);this.#D=e.id,e.remoteError?this.#Ge(this.#r.t(`ui.panel.skillsStudioRemoteWarn`,{error:e.remoteError}),`warn`):this.#Ge(this.#r.t(`ui.panel.skillsStudioSaved`,{id:e.id,version:String(e.version)}),`ok`),this.#Je()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}}async#lt(e){if(!(!e||!this.#t.testSkill||this.#O)){this.#O=!0,this.#Ge(``),this.#$e();try{let t=await this.#t.testSkill(e),n=t.length>180?`${t.slice(0,177)}…`:t;this.#Ge(this.#r.t(`ui.panel.skillsStudioTested`,{result:n}),`ok`),this.#Je()}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}}async#ut(){if(!this.#We()||this.#O)return;let e=this.#h.querySelector(`[data-role="skills-ask-input"]`).value.trim();if(!e)return;let t=[`You are authoring a reusable Page Agent skill for the goal below.`,`Explore the current page only as needed, then call save_skill with one complete skill Markdown document:`,`YAML frontmatter (name, description, version, id, scope: agent), a short guidance body, and exactly one skill-js fence exporting commands.`,`Keep the skill generic: parameterize values that change between runs as command inputs.`,`Do not ask the user unless you are blocked. Finish after save_skill succeeds.`,`Goal: ${e}`].join(`
376
+ `);this.#Ge(this.#r.t(`ui.panel.skillsStudioAskQueued`),`warn`),this.#_t();try{await this.#t.execute(t)}finally{try{this.#Je()}catch{}}}async#dt(){if(!(!this.#t.refreshRemoteSkills||this.#O)){this.#O=!0,this.#Ge(``),this.#$e();try{let e=await this.#t.refreshRemoteSkills({force:!0});this.#Je(),this.#Ge(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(e.ids.length||this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}}async#ft(e){if(!(!this.#t.removeAgentSkill||this.#O)){this.#O=!0,this.#Ge(``),this.#$e();try{await this.#t.removeAgentSkill(e),this.#D===e&&(this.#D=``),this.#Je(),this.#Ge(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}}async#pt(e){if(!this.#t.armSkillWatch||this.#O)return;let t=this.#Xe(e);if(!t)return;let n=new Set(e.commands.map(e=>e.name)),r=`watch-${e.id}`,i,a=`interval`;if(t===`watch_reply`){let e=this.#r.t(`ui.panel.skillsStudioWatchNeedlePrompt`);i={needle:((typeof window.prompt==`function`?window.prompt(e,`reply`):null)??`reply`).trim()||`reply`}}else e.id===`on-enter`&&(a=`on-enter`);this.#O=!0,this.#Ge(``),this.#$e();try{n.has(`snapshot`)?(await this.#t.loadSkill?.(e.id),this.#t.testSkill&&!n.has(`run`)&&await this.#t.testSkill(e.id)):await this.#t.loadSkill?.(e.id);let o=this.#t.armSkillWatch({id:r,skillId:e.id,command:t,input:i,trigger:a,everyMs:15e3});this.#Ye(),this.#Ge(this.#r.t(`ui.panel.skillsStudioWatchArmed`,{id:o.id}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}finally{this.#O=!1,this.#$e()}}#mt(e){if(this.#t.disarmSkillWatch){try{this.#t.disarmSkillWatch(e),this.#Ye(),this.#Ge(``)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`)}this.#$e()}}async#ht(){if(!this.#t.removeAgentSkill||this.#O)return;let e=this.#A.filter(e=>e.scope===`agent`).map(e=>e.id);if(e.length){this.#O=!0,this.#Ge(``),this.#$e();try{for(let t of e)await this.#t.removeAgentSkill(t);e.includes(this.#D)&&(this.#D=``),this.#Je(),this.#Ge(this.#r.t(`ui.panel.skillsStudioCatalogCount`,{count:String(this.#A.length)}),`ok`)}catch(e){let t=e instanceof Error?e.message:String(e);this.#Ge(this.#r.t(`ui.panel.skillsStudioError`,{message:t}),`err`),this.#Je()}finally{this.#O=!1,this.#$e()}}}#gt(){this.#I!==`skills-studio`&&(this.#I===`voice`&&this.#z.disable(),this.#L=this.#I===`voice`?`voice`:`text`,this.#I=`skills-studio`,this.#C=`record`,this.#Ge(``),this.#We()&&(this.#Je(),this.#Ye()),this.#P=`expanded`,this.#N=!1,this.#e.dataset.follow=`expanded`,this.#Qe(),this.#Ue())}#_t(){if(this.#I!==`skills-studio`)return;this.#t.isSkillRecording?.()&&this.#t.stopSkillRecording?.(),this.#Ke();let e=this.#L;this.#I=e,e===`voice`&&this.#z.enable(),this.#Ue(),e===`text`&&this.#o.focus()}#vt(e){this.#C=e,e===`catalog`&&this.#We()&&this.#Je(),this.#$e()}#yt(){return typeof this.#t.attachTaskFile==`function`}#bt(){let e=this.#r.t.bind(this.#r),t=this.#u,n=this.#f;if(!t||!n)return;let r=this.#yt();t.hidden=!r||this.#I===`voice`,setButton(t,`paperclip`,e(`ui.panel.attachFile`)),t.disabled=!r;let i=r?this.#t.listTaskFiles?.()??[]:[];n.replaceChildren(),n.hidden=i.length===0&&!this.#S;for(let t of i){let r=document.createElement(`span`);r.className=Panel_module_default.attachChip;let i=document.createElement(`span`);if(i.className=Panel_module_default.attachName,i.textContent=t.name,r.append(i),typeof this.#t.removeTaskFile==`function`){let n=document.createElement(`button`);n.type=`button`,n.className=Panel_module_default.attachRemove,n.setAttribute(`aria-label`,e(`ui.panel.attachRemove`,{name:t.name})),n.innerHTML=icon(`close`),n.addEventListener(`click`,()=>{this.#t.removeTaskFile?.(t.id),this.#S=``,this.#bt()}),r.append(n)}n.append(r)}if(this.#S){let e=document.createElement(`span`);e.className=Panel_module_default.attachError,e.textContent=this.#S,n.append(e)}}async#xt(e){if(e?.length&&this.#t.attachTaskFile){this.#S=``;for(let t of Array.from(e))try{await this.#t.attachTaskFile(t)}catch(e){let t=e instanceof Error?e.message:String(e);this.#S=t||this.#r.t(`ui.panel.attachFailed`),console.warn(`[page-agent] attachTaskFile failed`,e);break}this.#d&&(this.#d.value=``),this.#bt()}}#St(){let e=this.#r.t.bind(this.#r),t=this.#$.map(e=>({task:e.task,history:e.history,outcome:e.result?`${e.result.kind}: ${e.result.text}`:``}));if(this.#t.task||this.#t.history.length>0){let e=this.#Be();t.push({task:this.#t.task||``,history:[...this.#t.history],outcome:e?`${e.kind}: ${e.text}`:``})}let n=new Date,r=formatTrace(t,e,n),i=n.toISOString().replace(/[:.]/g,`-`).slice(0,19),a=URL.createObjectURL(new Blob([r],{type:`text/plain;charset=utf-8`})),o=document.createElement(`a`);o.href=a,o.download=`nostop-log-${i}.txt`,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}#Ct(){return typeof window<`u`&&window.matchMedia(FOLLOW_CYCLE_MQ).matches}#wt(){let e=this.#r.t(`ui.panel.expandFromFab`);this.#W.dataset.tip=e,this.#W.setAttribute(`aria-label`,e)}#Tt(e){let t=this.#N;this.#P=e,this.#N=e!==`expanded`,this.#e.dataset.follow=e,e===`fab`?(this.wrapper.style.opacity=`0`,this.wrapper.style.transform=`translateY(20px)`,this.wrapper.style.display=`none`,this.#W.hidden=!1,this.#wt()):(this.#W.hidden=!0,this.wrapper.style.display===`none`&&(this.wrapper.style.display=`flex`,this.wrapper.getBoundingClientRect(),this.wrapper.style.opacity=`1`,this.wrapper.style.transform=`translateY(0)`)),t&&!this.#N&&this.#Qe(),this.#Ue()}#Et(){if(!this.#Ct()){this.#Tt(this.#P===`expanded`?`bar`:`expanded`);return}this.#Tt({expanded:`bar`,bar:`fab`,fab:`expanded`}[this.#P])}#Dt(e){if(this.#Ct()){e?this.#P===`expanded`?this.#Tt(`bar`):this.#Tt(`fab`):this.#Tt(`expanded`);return}this.#Tt(e?`bar`:`expanded`)}#Ot(e){this.#I===`skills-studio`&&(this.#L=e),this.#I===`voice`&&e!==`voice`&&this.#z.disable(),e===`voice`?this.#z.enable():this.#z.disable(),this.#I=e,this.#Ue(),e===`text`&&this.#o.focus()}#kt(){let e=this.#r.t.bind(this.#r),t=this.#z.state,n={"no-key":e(`ui.panel.voiceNoKey`),"mic-denied":e(`ui.panel.voiceDenied`),"mic-unsupported":e(`ui.panel.voiceUnavailable`),"mic-busy":e(`ui.panel.voiceMicBusy`),"connect-failed":e(`ui.panel.voiceConnectFailed`)},r=t===`listening`||t===`speaking`||t===`connecting`,i=r&&this.#R.hardwareMuted,a={off:e(`ui.panel.voiceOff`),connecting:e(`ui.panel.voiceConnecting`),listening:e(i?`ui.panel.voiceMicSilent`:`ui.panel.voiceListening`),speaking:e(`ui.panel.voiceSpeaking`),muted:e(`ui.panel.voiceMuted`),error:this.#z.error?n[this.#z.error]:e(`ui.panel.voiceConnectFailed`)},o={off:`off`,connecting:`active`,listening:i?`denied`:`active`,speaking:`active`,muted:`muted`,error:`denied`}[t];this.#m.dataset.voiceState=t;let s=this.#m.querySelector(`[data-role="lens"]`);s.dataset.state=o,s.innerHTML=icon(o===`active`?`mic`:`micOff`),this.#m.querySelector(`[data-role="voice-state"]`).textContent=a[t];let c=this.#m.querySelector(`[data-role="mic-device"]`),l=this.#R.label.trim();c.hidden=!l||!r&&t!==`muted`&&t!==`error`,c.textContent=l,c.disabled=!r,c.setAttribute(`aria-label`,e(`ui.panel.switchMic`)),c.dataset.tip=e(`ui.panel.switchMic`);let u=this.#m.querySelector(`[data-role="mute"]`),d=this.#z.muted;setButton(u,d?`mic`:`micOff`,e(d?`ui.panel.unmute`:`ui.panel.mute`)),u.setAttribute(`aria-pressed`,String(d)),u.disabled=t===`error`||t===`off`;let f=this.#m.querySelector(`[data-role="voice-stop"]`);if(f){let t=this.#t.status===`running`;setButton(f,t?`stop`:`close`,e(t?`ui.panel.stop`:`ui.panel.close`))}setButton(this.#m.querySelector(`[data-role="back"]`),`keyboard`,e(`ui.panel.switchToText`))}#At(){if(this.#P!==`bar`)return;let e=this.#r.t.bind(this.#r),t=this.#I===`voice`,n=this.#F.querySelector(`[data-role="follow-bar-status"]`),r=this.#F.querySelector(`[data-role="follow-bar-lens"]`),i=this.#F.querySelector(`[data-role="follow-bar-mute"]`),a=this.#F.querySelector(`[data-role="follow-bar-action"]`),o=this.#F.querySelector(`[data-role="follow-bar-minimize"]`);if(t){let t=this.#z.state,a=(t===`listening`||t===`speaking`||t===`connecting`)&&this.#R.hardwareMuted;n.textContent={off:e(`ui.panel.voiceOff`),connecting:e(`ui.panel.voiceConnecting`),listening:e(a?`ui.panel.voiceMicSilent`:`ui.panel.voiceListening`),speaking:e(`ui.panel.voiceSpeaking`),muted:e(`ui.panel.voiceMuted`),error:e(`ui.panel.voiceConnectFailed`)}[t];let o={off:`off`,connecting:`active`,listening:a?`denied`:`active`,speaking:`active`,muted:`muted`,error:`denied`}[t];r.hidden=!1,r.dataset.state=o,r.innerHTML=icon(o===`active`?`mic`:`micOff`),i.hidden=!1;let s=this.#z.muted;setButton(i,s?`mic`:`micOff`,e(s?`ui.panel.unmute`:`ui.panel.mute`)),i.setAttribute(`aria-pressed`,String(s)),i.disabled=t===`error`||t===`off`}else n.textContent=this.#He(),r.hidden=!0,i.hidden=!0;let s=this.#t.status===`running`;setButton(a,s?`stop`:`close`,e(s?`ui.panel.stop`:`ui.panel.close`)),setButton(o,`chevronDown`,e(`ui.panel.followModeMinimize`))}#jt(){this.#o.style.height=`auto`,this.#o.style.height=`${Math.min(this.#o.scrollHeight,120)}px`}#Mt(){let e=this.#r.t.bind(this.#r),t=document.createElement(`div`);return t.id=`page-agent-runtime_agent-panel`,t.className=Panel_module_default.wrapper,t.setAttribute(`data-browser-use-ignore`,`true`),t.setAttribute(`data-page-agent-ignore`,`true`),t.dataset.state=`idle`,t.dataset.follow=`expanded`,t.innerHTML=`
376
377
  <header class="${Panel_module_default.header}">
377
378
  <span class="${Panel_module_default.brand}" data-role="brand" aria-hidden="true">${icon(`spark`)}</span>
378
379
  <div class="${Panel_module_default.titleBlock}">
@@ -482,4 +483,4 @@ registerProcessor('pa-capture', PaCapture);
482
483
  <p class="${Panel_module_default.studioStatus}" data-role="skills-catalog-status"></p>
483
484
  </div>
484
485
  </section>
485
- `,t.querySelector(`[data-role="title"]`).textContent=this.#n.name?.trim()||`NoStop`,this.#jt(t),fillBrand(t.querySelector(`[data-role="brand"]`)),document.body.appendChild(t),t}#jt(e=this.#e){let t=this.#r.t.bind(this.#r);e.querySelector(`[data-role="skills-title"]`).textContent=t(`ui.panel.skillsStudio`);let n={record:t(`ui.panel.skillsStudioRecord`),ask:t(`ui.panel.skillsStudioAsk`),catalog:t(`ui.panel.skillsStudioCatalog`)};for(let t of e.querySelectorAll(`[data-role="skills-tab"]`))t.textContent=n[t.dataset.tab];e.querySelector(`[data-role="skills-record-hint"]`).textContent=t(`ui.panel.skillsStudioRecordHint`),e.querySelector(`[data-role="skills-ask-hint"]`).textContent=t(`ui.panel.skillsStudioAskHint`),e.querySelector(`[data-role="skills-ask-input"]`).placeholder=t(`ui.panel.skillsStudioAskPlaceholder`),e.querySelector(`[data-role="skills-catalog-empty"]`).textContent=t(`ui.panel.skillsStudioEmptyCatalog`)}#Mt(){this.#e.querySelector(`.${Panel_module_default.header}`).addEventListener(`click`,e=>{e.target.closest(`button`)||(this.#xt()?this.#wt():this.#Tt(!this.#N))}),this.#y.addEventListener(`click`,e=>{e.stopPropagation(),this.#xt()?this.#wt():this.#Tt(!this.#N)}),this.#v.addEventListener(`click`,e=>{e.stopPropagation(),this.#Le()}),this.#F.querySelector(`[data-role="follow-bar-body"]`).addEventListener(`click`,()=>this.#Ct(`expanded`)),this.#F.querySelector(`[data-role="follow-bar-mute"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#z.setMuted(!this.#z.muted)}),this.#F.querySelector(`[data-role="follow-bar-action"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#Le()}),this.#F.querySelector(`[data-role="follow-bar-minimize"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#Ct(`fab`)}),this.#m.querySelector(`[data-role="voice-stop"]`)?.addEventListener(`click`,()=>this.#Le()),this.#g.addEventListener(`click`,e=>{e.stopPropagation(),this.#I===`skills-studio`?this.#ht():this.#mt()}),this.#h.querySelector(`[data-role="skills-back"]`).addEventListener(`click`,()=>this.#ht());for(let e of this.#h.querySelectorAll(`[data-role="skills-tab"]`))e.addEventListener(`click`,()=>{let t=e.dataset.tab;(t===`record`||t===`ask`||t===`catalog`)&&this.#gt(t)});this.#M||(this.#M=!0,this.#h.querySelector(`[data-role="skills-record-start"]`).addEventListener(`click`,()=>void this.#nt()),this.#h.querySelector(`[data-role="skills-record-stop"]`).addEventListener(`click`,()=>this.#rt()),this.#h.querySelector(`[data-role="skills-record-finish"]`).addEventListener(`click`,()=>this.#it()),this.#h.querySelector(`[data-role="skills-record-clear"]`).addEventListener(`click`,()=>this.#at()),this.#h.querySelector(`[data-role="skills-record-save"]`).addEventListener(`click`,()=>void this.#ot()),this.#h.querySelector(`[data-role="skills-record-test"]`).addEventListener(`click`,()=>{this.#D&&this.#st(this.#D)}),this.#h.querySelector(`[data-role="skills-ask-start"]`).addEventListener(`click`,()=>void this.#ct()),this.#h.querySelector(`[data-role="skills-ask-input"]`).addEventListener(`input`,()=>this.#Ze()),this.#h.querySelector(`[data-role="skills-catalog-refresh"]`).addEventListener(`click`,()=>void this.#lt()),this.#h.querySelector(`[data-role="skills-catalog-remove-agent"]`).addEventListener(`click`,()=>void this.#pt())),this.#l.addEventListener(`click`,()=>this.#Et(this.#I===`voice`?`text`:`voice`)),this.#m.querySelector(`[data-role="mute"]`).addEventListener(`click`,()=>void this.#z.setMuted(!this.#z.muted)),this.#m.querySelector(`[data-role="mic-device"]`).addEventListener(`click`,()=>void this.#z.changeInput()),this.#e.querySelector(`[data-role="back"]`).addEventListener(`click`,()=>this.#Et(`text`)),this.#p.addEventListener(`submit`,e=>{e.preventDefault(),this.#je()}),this.#o.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this.#je())}),this.#o.addEventListener(`input`,()=>this.#kt()),this.#u?.addEventListener(`click`,()=>this.#d?.click()),this.#d?.addEventListener(`change`,()=>{this.#yt(this.#d?.files??null)})}#Nt(){let e=document.createElement(`button`);e.type=`button`,e.id=`page-agent-runtime_agent-fab`,e.className=`${Panel_module_default.fab} ${Panel_module_default.tip} ${Panel_module_default.tipUp}`,e.setAttribute(`data-browser-use-ignore`,`true`),e.setAttribute(`data-page-agent-ignore`,`true`),fillBrand(e);let t=this.#r.t(`ui.panel.open`);e.dataset.tip=t,e.setAttribute(`aria-label`,t),document.body.appendChild(e),this.#W=e;let n=t=>{let[n,r]=t.split(`-`);e.style.left=n===`left`?`${FAB_MARGIN}px`:`auto`,e.style.right=n===`right`?`${FAB_MARGIN}px`:`auto`,e.style.top=r===`top`?`${FAB_MARGIN}px`:`auto`,e.style.bottom=r===`bottom`?`${FAB_MARGIN}px`:`auto`,e.classList.toggle(Panel_module_default.fabLeft,n===`left`)},r=(()=>{try{return localStorage.getItem(FAB_KEY)}catch{return null}})();n(CORNERS.includes(r)?r:`right-bottom`);let i=null,a=!1,o=!1,s,c=()=>{s!==void 0&&clearTimeout(s),s=void 0};e.addEventListener(`pointerdown`,t=>{if(t.button!==0)return;let n=e.getBoundingClientRect();i={dx:t.clientX-n.left,dy:t.clientY-n.top},a=!1,o=!1,c(),this.#xt()&&(s=setTimeout(()=>{o=!0,this.#Ct(`bar`)},480)),e.style.transition=`none`,e.setPointerCapture(t.pointerId)}),e.addEventListener(`pointermove`,t=>{if(!i)return;a=!0,c();let n=Math.min(Math.max(0,t.clientX-i.dx),window.innerWidth-e.offsetWidth),r=Math.min(Math.max(0,t.clientY-i.dy),window.innerHeight-e.offsetHeight);e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.right=`auto`,e.style.bottom=`auto`});let l=()=>{if(c(),!i||(i=null,e.style.transition=``,!a))return;let t=e.getBoundingClientRect(),r=`${t.left+t.width/2<window.innerWidth/2?`left`:`right`}-${t.top+t.height/2<window.innerHeight/2?`top`:`bottom`}`;n(r);try{localStorage.setItem(FAB_KEY,r)}catch{}};e.addEventListener(`pointerup`,l),e.addEventListener(`pointercancel`,l),e.addEventListener(`click`,e=>{if(a||o){a=!1,o=!1,e.preventDefault();return}this.#Ct(`expanded`)})}#Pt(){let e=this.#e.querySelector(`.${Panel_module_default.header}`),t=(e,t)=>{let n=this.#e.offsetWidth||414,r=this.#e.offsetHeight||0,i=Math.min(Math.max(0,e),Math.max(0,window.innerWidth-n)),a=Math.min(Math.max(0,t),Math.max(0,window.innerHeight-r));this.#e.style.left=`${i}px`,this.#e.style.top=`${a}px`,this.#e.style.right=`auto`,this.#e.style.bottom=`auto`,this.#e.style.margin=`0`};try{let e=JSON.parse(localStorage.getItem(DRAG_KEY)??`null`);e&&typeof e.x==`number`&&typeof e.y==`number`&&e.x<window.innerWidth-60&&e.y<window.innerHeight-60&&t(e.x,e.y)}catch{}e.addEventListener(`pointerdown`,t=>{if(t.button!==0||t.target.closest(`button`))return;let n=this.#e.getBoundingClientRect();this.#ce={dx:t.clientX-n.left,dy:t.clientY-n.top},this.#le=!1,this.#e.style.transition=`none`,e.setPointerCapture(t.pointerId)}),e.addEventListener(`pointermove`,e=>{this.#ce&&(this.#le=!0,t(e.clientX-this.#ce.dx,e.clientY-this.#ce.dy))});let n=()=>{if(!this.#ce)return;this.#ce=null,this.#e.style.transition=``;let e=this.#e.getBoundingClientRect();try{localStorage.setItem(DRAG_KEY,JSON.stringify({x:e.left,y:e.top}))}catch{}};e.addEventListener(`pointerup`,n),e.addEventListener(`pointercancel`,n),e.addEventListener(`click`,e=>{this.#le&&(this.#le=!1,e.stopPropagation(),e.preventDefault())},!0);let r=this.#r.t.bind(this.#r),i=e=>{document.documentElement.toggleAttribute(CURSOR_ATTR,e),this.#b.setAttribute(`aria-pressed`,String(!e)),setButton(this.#b,e?`cursorOff`:`cursor`,r(e?`ui.panel.showCursor`:`ui.panel.hideCursor`))};i(!1),this.#b.addEventListener(`click`,e=>{e.stopPropagation(),i(!document.documentElement.hasAttribute(CURSOR_ATTR))})}},PageAgent=class extends PageAgentCore{panel;constructor(e){let t=new PageController({...e,enableMask:e.enableMask??!0});super({...e,pageController:t}),t.isBusy=()=>this.status===`running`,this.panel=new Panel(this,{language:e.language,sessionRecovery:e.sessionRecovery,sessionRecoveryKey:e.sessionRecoveryKey,promptForNextTask:e.promptForNextTask,name:e.name,voice:e.voice,runScript:e=>this.#e(e),getContext:e=>this.#t(e)})}#e(e){let t=this.tools.get(`execute_javascript`);if(!t)return Promise.resolve(`execute_javascript is not available in this session.`);let n=new AbortController,r,i=new Promise(e=>{r=setTimeout(()=>{n.abort(),e(`The script took longer than 20 seconds, so the voice stopped waiting for it.`)},2e4)}),a=t.execute.call(this,{script:e},{signal:n.signal});return Promise.race([a,i]).finally(()=>clearTimeout(r))}async#t(e){return(await this.pageController.getContext({yMin:e.yMin,yMax:e.yMax,maxLines:e.maxLines??60,query:e.query,bindIndexes:!1})).message}},currentScript=document.currentScript,currentScriptURL=currentScript?.src?new URL(currentScript.src):null,autoInit=currentScriptURL?.searchParams.get(`autoInit`)!==`false`;autoInit&&window.pageAgent&&window.pageAgent.dispose(),window.PageAgent=PageAgent,console.log(`🚀 page-agent.js loaded!`);var DEMO_MODEL=`qwen3.5-plus`,DEMO_BASE_URL=`https://page-ag-testing-ohftxirgbn.cn-shanghai.fcapp.run`,DEMO_API_KEY=`NA`;autoInit&&setTimeout(()=>{let e,t=!0;if(currentScriptURL){let n=currentScriptURL,r=n.searchParams.get(`model`)||DEMO_MODEL,i=n.searchParams.get(`baseURL`)||DEMO_BASE_URL,a=n.searchParams.get(`apiKey`)||DEMO_API_KEY,o=n.searchParams.get(`lang`)||`zh-CN`;t=(n.searchParams.get(`showPanel`)||`true`)===`true`,e={model:r,baseURL:i,apiKey:a,language:o}}else console.log(`🚀 page-agent.js no current script detected, using default demo config`),e={model:DEMO_MODEL,baseURL:DEMO_BASE_URL,apiKey:DEMO_API_KEY};window.pageAgent=new PageAgent(e),t&&window.pageAgent.panel.show(),console.log(`🚀 page-agent.js initialized with config:`,window.pageAgent.config)})})();
486
+ `,t.querySelector(`[data-role="title"]`).textContent=this.#n.name?.trim()||`NoStop`,this.#Nt(t),fillBrand(t.querySelector(`[data-role="brand"]`)),document.body.appendChild(t),t}#Nt(e=this.#e){let t=this.#r.t.bind(this.#r);e.querySelector(`[data-role="skills-title"]`).textContent=t(`ui.panel.skillsStudio`);let n={record:t(`ui.panel.skillsStudioRecord`),ask:t(`ui.panel.skillsStudioAsk`),catalog:t(`ui.panel.skillsStudioCatalog`)};for(let t of e.querySelectorAll(`[data-role="skills-tab"]`))t.textContent=n[t.dataset.tab];e.querySelector(`[data-role="skills-record-hint"]`).textContent=t(`ui.panel.skillsStudioRecordHint`),e.querySelector(`[data-role="skills-ask-hint"]`).textContent=t(`ui.panel.skillsStudioAskHint`),e.querySelector(`[data-role="skills-ask-input"]`).placeholder=t(`ui.panel.skillsStudioAskPlaceholder`),e.querySelector(`[data-role="skills-catalog-empty"]`).textContent=t(`ui.panel.skillsStudioEmptyCatalog`)}#Pt(){this.#e.querySelector(`.${Panel_module_default.header}`).addEventListener(`click`,e=>{e.target.closest(`button`)||(this.#Ct()?this.#Et():this.#Dt(!this.#N))}),this.#y.addEventListener(`click`,e=>{e.stopPropagation(),this.#Ct()?this.#Et():this.#Dt(!this.#N)}),this.#v.addEventListener(`click`,e=>{e.stopPropagation(),this.#ze()}),this.#F.querySelector(`[data-role="follow-bar-body"]`).addEventListener(`click`,()=>this.#Tt(`expanded`)),this.#F.querySelector(`[data-role="follow-bar-mute"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#z.setMuted(!this.#z.muted)}),this.#F.querySelector(`[data-role="follow-bar-action"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#ze()}),this.#F.querySelector(`[data-role="follow-bar-minimize"]`).addEventListener(`click`,e=>{e.stopPropagation(),this.#Tt(`fab`)}),this.#m.querySelector(`[data-role="voice-stop"]`)?.addEventListener(`click`,()=>this.#ze()),this.#g.addEventListener(`click`,e=>{e.stopPropagation(),this.#I===`skills-studio`?this.#_t():this.#gt()}),this.#h.querySelector(`[data-role="skills-back"]`).addEventListener(`click`,()=>this.#_t());for(let e of this.#h.querySelectorAll(`[data-role="skills-tab"]`))e.addEventListener(`click`,()=>{let t=e.dataset.tab;(t===`record`||t===`ask`||t===`catalog`)&&this.#vt(t)});this.#M||(this.#M=!0,this.#h.querySelector(`[data-role="skills-record-start"]`).addEventListener(`click`,()=>void this.#it()),this.#h.querySelector(`[data-role="skills-record-stop"]`).addEventListener(`click`,()=>this.#at()),this.#h.querySelector(`[data-role="skills-record-finish"]`).addEventListener(`click`,()=>this.#ot()),this.#h.querySelector(`[data-role="skills-record-clear"]`).addEventListener(`click`,()=>this.#st()),this.#h.querySelector(`[data-role="skills-record-save"]`).addEventListener(`click`,()=>void this.#ct()),this.#h.querySelector(`[data-role="skills-record-test"]`).addEventListener(`click`,()=>{this.#D&&this.#lt(this.#D)}),this.#h.querySelector(`[data-role="skills-ask-start"]`).addEventListener(`click`,()=>void this.#ut()),this.#h.querySelector(`[data-role="skills-ask-input"]`).addEventListener(`input`,()=>this.#$e()),this.#h.querySelector(`[data-role="skills-catalog-refresh"]`).addEventListener(`click`,()=>void this.#dt()),this.#h.querySelector(`[data-role="skills-catalog-remove-agent"]`).addEventListener(`click`,()=>void this.#ht())),this.#l.addEventListener(`click`,()=>this.#Ot(this.#I===`voice`?`text`:`voice`)),this.#m.querySelector(`[data-role="mute"]`).addEventListener(`click`,()=>void this.#z.setMuted(!this.#z.muted)),this.#m.querySelector(`[data-role="mic-device"]`).addEventListener(`click`,()=>void this.#z.changeInput()),this.#e.querySelector(`[data-role="back"]`).addEventListener(`click`,()=>this.#Ot(`text`)),this.#p.addEventListener(`submit`,e=>{e.preventDefault(),this.#je()}),this.#o.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this.#je())}),this.#o.addEventListener(`input`,()=>this.#jt()),this.#u?.addEventListener(`click`,()=>this.#d?.click()),this.#d?.addEventListener(`change`,()=>{this.#xt(this.#d?.files??null)})}#Ft(){let e=document.createElement(`button`);e.type=`button`,e.id=`page-agent-runtime_agent-fab`,e.className=`${Panel_module_default.fab} ${Panel_module_default.tip} ${Panel_module_default.tipUp}`,e.setAttribute(`data-browser-use-ignore`,`true`),e.setAttribute(`data-page-agent-ignore`,`true`),fillBrand(e);let t=this.#r.t(`ui.panel.open`);e.dataset.tip=t,e.setAttribute(`aria-label`,t),document.body.appendChild(e),this.#W=e;let n=t=>{let[n,r]=t.split(`-`);e.style.left=n===`left`?`${FAB_MARGIN}px`:`auto`,e.style.right=n===`right`?`${FAB_MARGIN}px`:`auto`,e.style.top=r===`top`?`${FAB_MARGIN}px`:`auto`,e.style.bottom=r===`bottom`?`${FAB_MARGIN}px`:`auto`,e.classList.toggle(Panel_module_default.fabLeft,n===`left`)},r=(()=>{try{return localStorage.getItem(FAB_KEY)}catch{return null}})();n(CORNERS.includes(r)?r:`right-bottom`);let i=null,a=!1,o=!1,s,c=()=>{s!==void 0&&clearTimeout(s),s=void 0};e.addEventListener(`pointerdown`,t=>{if(t.button!==0)return;let n=e.getBoundingClientRect();i={dx:t.clientX-n.left,dy:t.clientY-n.top},a=!1,o=!1,c(),this.#Ct()&&(s=setTimeout(()=>{o=!0,this.#Tt(`bar`)},480)),e.style.transition=`none`,e.setPointerCapture(t.pointerId)}),e.addEventListener(`pointermove`,t=>{if(!i)return;a=!0,c();let n=Math.min(Math.max(0,t.clientX-i.dx),window.innerWidth-e.offsetWidth),r=Math.min(Math.max(0,t.clientY-i.dy),window.innerHeight-e.offsetHeight);e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.right=`auto`,e.style.bottom=`auto`});let l=()=>{if(c(),!i||(i=null,e.style.transition=``,!a))return;let t=e.getBoundingClientRect(),r=`${t.left+t.width/2<window.innerWidth/2?`left`:`right`}-${t.top+t.height/2<window.innerHeight/2?`top`:`bottom`}`;n(r);try{localStorage.setItem(FAB_KEY,r)}catch{}};e.addEventListener(`pointerup`,l),e.addEventListener(`pointercancel`,l),e.addEventListener(`click`,e=>{if(a||o){a=!1,o=!1,e.preventDefault();return}this.#Tt(`expanded`)})}#It(){let e=this.#e.querySelector(`.${Panel_module_default.header}`),t=(e,t)=>{let n=this.#e.offsetWidth||414,r=this.#e.offsetHeight||0,i=Math.min(Math.max(0,e),Math.max(0,window.innerWidth-n)),a=Math.min(Math.max(0,t),Math.max(0,window.innerHeight-r));this.#e.style.left=`${i}px`,this.#e.style.top=`${a}px`,this.#e.style.right=`auto`,this.#e.style.bottom=`auto`,this.#e.style.margin=`0`};try{let e=JSON.parse(localStorage.getItem(DRAG_KEY)??`null`);e&&typeof e.x==`number`&&typeof e.y==`number`&&e.x<window.innerWidth-60&&e.y<window.innerHeight-60&&t(e.x,e.y)}catch{}e.addEventListener(`pointerdown`,t=>{if(t.button!==0||t.target.closest(`button`))return;let n=this.#e.getBoundingClientRect();this.#ce={dx:t.clientX-n.left,dy:t.clientY-n.top},this.#le=!1,this.#e.style.transition=`none`,e.setPointerCapture(t.pointerId)}),e.addEventListener(`pointermove`,e=>{this.#ce&&(this.#le=!0,t(e.clientX-this.#ce.dx,e.clientY-this.#ce.dy))});let n=()=>{if(!this.#ce)return;this.#ce=null,this.#e.style.transition=``;let e=this.#e.getBoundingClientRect();try{localStorage.setItem(DRAG_KEY,JSON.stringify({x:e.left,y:e.top}))}catch{}};e.addEventListener(`pointerup`,n),e.addEventListener(`pointercancel`,n),e.addEventListener(`click`,e=>{this.#le&&(this.#le=!1,e.stopPropagation(),e.preventDefault())},!0);let r=this.#r.t.bind(this.#r),i=e=>{document.documentElement.toggleAttribute(CURSOR_ATTR,e),this.#b.setAttribute(`aria-pressed`,String(!e)),setButton(this.#b,e?`cursorOff`:`cursor`,r(e?`ui.panel.showCursor`:`ui.panel.hideCursor`))};i(!1),this.#b.addEventListener(`click`,e=>{e.stopPropagation(),i(!document.documentElement.hasAttribute(CURSOR_ATTR))})}},PageAgent=class extends PageAgentCore{panel;constructor(e){let t=new PageController({...e,enableMask:e.enableMask??!0});super({...e,pageController:t}),t.isBusy=()=>this.status===`running`,this.panel=new Panel(this,{language:e.language,sessionRecovery:e.sessionRecovery,sessionRecoveryKey:e.sessionRecoveryKey,promptForNextTask:e.promptForNextTask,name:e.name,voice:e.voice,runScript:e=>this.#e(e),getContext:e=>this.#t(e)})}#e(e){let t=this.tools.get(`execute_javascript`);if(!t)return Promise.resolve(`execute_javascript is not available in this session.`);let n=new AbortController,r,i=new Promise(e=>{r=setTimeout(()=>{n.abort(),e(`The script took longer than 20 seconds, so the voice stopped waiting for it.`)},2e4)}),a=t.execute.call(this,{script:e},{signal:n.signal});return Promise.race([a,i]).finally(()=>clearTimeout(r))}async#t(e){return(await this.pageController.getContext({yMin:e.yMin,yMax:e.yMax,maxLines:e.maxLines??60,query:e.query,bindIndexes:!1})).message}},currentScript=document.currentScript,currentScriptURL=currentScript?.src?new URL(currentScript.src):null,autoInit=currentScriptURL?.searchParams.get(`autoInit`)!==`false`;autoInit&&window.pageAgent&&window.pageAgent.dispose(),window.PageAgent=PageAgent,console.log(`🚀 page-agent.js loaded!`);var DEMO_MODEL=`qwen3.5-plus`,DEMO_BASE_URL=`https://page-ag-testing-ohftxirgbn.cn-shanghai.fcapp.run`,DEMO_API_KEY=`NA`;autoInit&&setTimeout(()=>{let e,t=!0;if(currentScriptURL){let n=currentScriptURL,r=n.searchParams.get(`model`)||DEMO_MODEL,i=n.searchParams.get(`baseURL`)||DEMO_BASE_URL,a=n.searchParams.get(`apiKey`)||DEMO_API_KEY,o=n.searchParams.get(`lang`)||`zh-CN`;t=(n.searchParams.get(`showPanel`)||`true`)===`true`,e={model:r,baseURL:i,apiKey:a,language:o}}else console.log(`🚀 page-agent.js no current script detected, using default demo config`),e={model:DEMO_MODEL,baseURL:DEMO_BASE_URL,apiKey:DEMO_API_KEY};window.pageAgent=new PageAgent(e),t&&window.pageAgent.panel.show(),console.log(`🚀 page-agent.js initialized with config:`,window.pageAgent.config)})})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nostop/page",
3
3
  "private": false,
4
- "version": "0.1.0-rc.6",
4
+ "version": "0.1.0-rc.7",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/page-agent.js",
7
7
  "types": "./dist/esm/PageAgent.d.ts",