ai-helper-agent 1.17.4 → 1.17.5

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.
@@ -2485,7 +2485,7 @@ Sessions using this assistant will revert to the default assistant.`,deleteAgent
2485
2485
  <button data-act="delete" class="danger">${i(`schedPanel.delete`)}</button>
2486
2486
  </div>
2487
2487
  </div>
2488
- `}).join(``)}l.addEventListener(`click`,async e=>{let t=e.target.closest(`button[data-act]`);if(!t)return;let n=t.closest(`.sched-item`),r=n?.dataset.id;if(!r)return;let a=t.dataset.act;if(a===`toggle`){let e=(await E())[r];if(!e)return;await gA({type:`SCHEDULED_TASK_TOGGLE`,id:r,enabled:!e.enabled}),C()}else if(a===`run`){let e=await gA({type:`SCHEDULED_TASK_RUN_NOW`,id:r});e?.success?(U(i(`schedPanel.runNowToast`),`success`),wA(e.sessionId),setTimeout(C,1500)):U(e?.error||i(`schedPanel.createFailed`),`error`)}else if(a===`history`){let e=n.querySelector(`[data-history]`);e&&(e.style.display=e.style.display===`none`?``:`none`)}else if(a===`edit`)D((await E())[r]);else if(a===`delete`){let e=(await E())[r];await window.showCustomConfirm(i(`schedPanel.deleteConfirmMsg`,{name:e?.name||``}),i(`schedPanel.deleteConfirmTitle`))&&(await gA({type:`SCHEDULED_TASK_DELETE`,id:r}),U(i(`schedPanel.deleted`),`success`),C())}});async function E(){let e=await gA({type:`SCHEDULED_TASK_LIST`}),t={};return(e?.tasks||[]).forEach(e=>{t[e.id]=e}),t}async function D(e){b=e||null,d.textContent=i(e?`schedPanel.editTitle`:`schedPanel.newTask`),document.getElementById(`schedFormName`).value=e?.name||``,document.getElementById(`schedFormDesc`).value=e?.description||``,document.getElementById(`schedFormPrompt`).value=e?.prompt||``,document.getElementById(`schedFormUrl`).value=e?.contextUrl||``,m.value=e?.schedule?.type||`interval`,g.value=e?.schedule?.onceMode||`relative`,x(),h.value=e?.schedule?.value||``,document.getElementById(`schedFormContextMode`).value=e?.contextMode||`fetch`,document.getElementById(`schedFormMaxRuns`).value=e?.maxRuns??``,document.getElementById(`schedFormEndAt`).value=e?.endAt?bA(e.endAt):``;let t=document.getElementById(`schedFormSession`),n=`<option value="">${i(`schedPanel.sessionAuto`)}</option>`;try{let{list:t}=await A(),r=[...t].sort((e,t)=>{let n=e.order??0,r=t.order??0;return n===r?new Date(t.createdAt||0)-new Date(e.createdAt||0):r-n});for(let t of r){let r=e?.sessionId===t.id?`selected`:``,i=W(t.title||t.id);n+=`<option value="${W(t.id)}" ${r}>${i}</option>`}}catch{}t.innerHTML=n,u.classList.add(`open`)}function O(){u.classList.remove(`open`),b=null}async function k(){let e=document.getElementById(`schedFormName`).value.trim(),t=document.getElementById(`schedFormPrompt`).value.trim(),n=m.value,r=h.value.trim();if(!e){U(i(`schedPanel.nameRequired`),`warning`);return}if(!t){U(i(`schedPanel.promptRequired`),`warning`);return}if(!r){U(i(`schedPanel.scheduleRequired`),`warning`);return}let a=n===`interval`&&parseInt(document.getElementById(`schedFormMaxRuns`).value,10)||null,o=n===`interval`?document.getElementById(`schedFormEndAt`).value:``,s=o?new Date(o).getTime():null,c={name:e,description:document.getElementById(`schedFormDesc`).value.trim(),prompt:t,schedule:n===`once`?{type:n,value:r,onceMode:g.value}:{type:n,value:r},contextUrl:document.getElementById(`schedFormUrl`).value.trim()||null,contextMode:document.getElementById(`schedFormContextMode`).value||`fetch`,sessionId:document.getElementById(`schedFormSession`).value||null,maxRuns:a,endAt:s,enabled:!b||b.enabled};try{let e=await gA({type:b?`SCHEDULED_TASK_UPDATE`:`SCHEDULED_TASK_CREATE`,task:b?{...c,id:b.id}:c});e?.success?(U(i(`schedPanel.saved`),`success`),O(),C()):U(e?.error||i(`schedPanel.createFailed`),`error`)}catch(e){U(e?.message||i(`schedPanel.createFailed`),`error`)}}chrome.runtime.onMessage.addListener(e=>{e.type===`SCHEDULED_TASK_RUN_STATE`&&e.taskId&&(e.running?a.add(e.taskId):a.delete(e.taskId),o())}),chrome.runtime.onMessage.addListener(e=>{e.type===`SCHEDULED_SESSION_UPDATED`&&(r.classList.contains(`open`)&&C().catch(()=>{}),e.sessionId&&e.sessionId===z.activeSessionId&&setTimeout(CA,600))}),x(),S(!1),C().catch(()=>{})}var EA={version:`1.17.3`,tag:`v1.17.3`,commitId:`2fe94fbb5d170b30b862b9eecde0a4dc7370c797`,publishedAt:`2026-10-06T10:01:29.000Z`},DA=`—`,OA=[{labelKey:`versionInfo.githubRepo`,url:`https://github.com/xiweicheng/ai-helper`,icon:`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 .5C5.73.5.5 5.73.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.28-.01-1.02-.02-2-3.2.7-3.88-1.54-3.88-1.54-.52-1.33-1.28-1.69-1.28-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.68 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 012.9-.39c.98 0 1.97.13 2.9.39 2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.41-2.69 5.38-5.25 5.67.41.35.78 1.05.78 2.12 0 1.53-.01 2.76-.01 3.14 0 .31.21.68.8.56A11.51 11.51 0 0023.5 12C23.5 5.73 18.27.5 12 .5z"/></svg>`},{labelKey:`versionInfo.giteeRepo`,url:`https://gitee.com/xiweicheng/ai-helper`,icon:`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M11.984 0A12 12 0 000 12a12 12 0 0012 12 12 12 0 0012-12A12 12 0 0012 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 01-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 00-.592-.593h-4.15a.592.592 0 01-.592-.592v-1.482a.593.593 0 01.593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 01-4 4H8.444a3.556 3.556 0 01-3.555-3.556V8.89a3.556 3.556 0 013.555-3.556h9.63z"/></svg>`}];function kA(e){let t=e=>typeof e==`string`?e.trim():``,n=e&&typeof e==`object`?e:{};return{version:t(n.version),tag:t(n.tag),commitId:t(n.commitId),publishedAt:t(n.publishedAt)}}function AA(e){if(!e)return DA;let t=Date.parse(e);return Number.isNaN(t)?DA:new Date(t).toLocaleString()}function jA(e){let t=kA(EA),n=[{label:i(`versionInfo.version`),value:t.version?`v${t.version}`:DA},{label:i(`versionInfo.tag`),value:t.tag||DA},{label:i(`versionInfo.commit`),value:t.commitId?t.commitId.slice(0,8):DA,title:t.commitId,mono:!0},{label:i(`versionInfo.publishedAt`),value:AA(t.publishedAt)}];e.textContent=``;for(let t of n){let n=document.createElement(`div`);n.className=`version-info-row`;let r=document.createElement(`div`);r.className=`version-info-label`,r.textContent=t.label;let i=document.createElement(`div`);i.className=t.mono?`version-info-value mono`:`version-info-value`,i.textContent=t.value,t.title&&(i.title=t.title),n.appendChild(r),n.appendChild(i),e.appendChild(n)}}function MA(e){e.textContent=``;for(let t of OA){let n=document.createElement(`div`);n.className=`version-info-link`,n.title=t.url;let r=document.createElement(`span`);r.className=`version-info-link-icon`,r.innerHTML=t.icon;let a=document.createElement(`span`);a.className=`version-info-link-label`,a.textContent=i(t.labelKey);let o=document.createElement(`span`);o.className=`version-info-link-arrow`,o.textContent=`↗`,n.appendChild(r),n.appendChild(a),n.appendChild(o),n.addEventListener(`click`,()=>{chrome.tabs.create({url:t.url})}),e.appendChild(n)}}function NA(){let e=kA(EA);return[`AI Helper v${e.version||DA}`,`${i(`versionInfo.tag`)}: ${e.tag||DA}`,`${i(`versionInfo.commit`)}: ${e.commitId||DA}`,`${i(`versionInfo.publishedAt`)}: ${AA(e.publishedAt)}`].join(`
2488
+ `}).join(``)}l.addEventListener(`click`,async e=>{let t=e.target.closest(`button[data-act]`);if(!t)return;let n=t.closest(`.sched-item`),r=n?.dataset.id;if(!r)return;let a=t.dataset.act;if(a===`toggle`){let e=(await E())[r];if(!e)return;await gA({type:`SCHEDULED_TASK_TOGGLE`,id:r,enabled:!e.enabled}),C()}else if(a===`run`){let e=await gA({type:`SCHEDULED_TASK_RUN_NOW`,id:r});e?.success?(U(i(`schedPanel.runNowToast`),`success`),wA(e.sessionId),setTimeout(C,1500)):U(e?.error||i(`schedPanel.createFailed`),`error`)}else if(a===`history`){let e=n.querySelector(`[data-history]`);e&&(e.style.display=e.style.display===`none`?``:`none`)}else if(a===`edit`)D((await E())[r]);else if(a===`delete`){let e=(await E())[r];await window.showCustomConfirm(i(`schedPanel.deleteConfirmMsg`,{name:e?.name||``}),i(`schedPanel.deleteConfirmTitle`))&&(await gA({type:`SCHEDULED_TASK_DELETE`,id:r}),U(i(`schedPanel.deleted`),`success`),C())}});async function E(){let e=await gA({type:`SCHEDULED_TASK_LIST`}),t={};return(e?.tasks||[]).forEach(e=>{t[e.id]=e}),t}async function D(e){b=e||null,d.textContent=i(e?`schedPanel.editTitle`:`schedPanel.newTask`),document.getElementById(`schedFormName`).value=e?.name||``,document.getElementById(`schedFormDesc`).value=e?.description||``,document.getElementById(`schedFormPrompt`).value=e?.prompt||``,document.getElementById(`schedFormUrl`).value=e?.contextUrl||``,m.value=e?.schedule?.type||`interval`,g.value=e?.schedule?.onceMode||`relative`,x(),h.value=e?.schedule?.value||``,document.getElementById(`schedFormContextMode`).value=e?.contextMode||`fetch`,document.getElementById(`schedFormMaxRuns`).value=e?.maxRuns??``,document.getElementById(`schedFormEndAt`).value=e?.endAt?bA(e.endAt):``;let t=document.getElementById(`schedFormSession`),n=`<option value="">${i(`schedPanel.sessionAuto`)}</option>`;try{let{list:t}=await A(),r=[...t].sort((e,t)=>{let n=e.order??0,r=t.order??0;return n===r?new Date(t.createdAt||0)-new Date(e.createdAt||0):r-n});for(let t of r){let r=e?.sessionId===t.id?`selected`:``,i=W(t.title||t.id);n+=`<option value="${W(t.id)}" ${r}>${i}</option>`}}catch{}t.innerHTML=n,u.classList.add(`open`)}function O(){u.classList.remove(`open`),b=null}async function k(){let e=document.getElementById(`schedFormName`).value.trim(),t=document.getElementById(`schedFormPrompt`).value.trim(),n=m.value,r=h.value.trim();if(!e){U(i(`schedPanel.nameRequired`),`warning`);return}if(!t){U(i(`schedPanel.promptRequired`),`warning`);return}if(!r){U(i(`schedPanel.scheduleRequired`),`warning`);return}let a=n===`interval`&&parseInt(document.getElementById(`schedFormMaxRuns`).value,10)||null,o=n===`interval`?document.getElementById(`schedFormEndAt`).value:``,s=o?new Date(o).getTime():null,c={name:e,description:document.getElementById(`schedFormDesc`).value.trim(),prompt:t,schedule:n===`once`?{type:n,value:r,onceMode:g.value}:{type:n,value:r},contextUrl:document.getElementById(`schedFormUrl`).value.trim()||null,contextMode:document.getElementById(`schedFormContextMode`).value||`fetch`,sessionId:document.getElementById(`schedFormSession`).value||null,maxRuns:a,endAt:s,enabled:!b||b.enabled};try{let e=await gA({type:b?`SCHEDULED_TASK_UPDATE`:`SCHEDULED_TASK_CREATE`,task:b?{...c,id:b.id}:c});e?.success?(U(i(`schedPanel.saved`),`success`),O(),C()):U(e?.error||i(`schedPanel.createFailed`),`error`)}catch(e){U(e?.message||i(`schedPanel.createFailed`),`error`)}}chrome.runtime.onMessage.addListener(e=>{e.type===`SCHEDULED_TASK_RUN_STATE`&&e.taskId&&(e.running?a.add(e.taskId):a.delete(e.taskId),o())}),chrome.runtime.onMessage.addListener(e=>{e.type===`SCHEDULED_SESSION_UPDATED`&&(r.classList.contains(`open`)&&C().catch(()=>{}),e.sessionId&&e.sessionId===z.activeSessionId&&setTimeout(CA,600))}),x(),S(!1),C().catch(()=>{})}var EA={version:`1.17.5`,tag:`v1.17.5`,commitId:`b7cf7b692570ef4f9a077e76e191a0b242f98ffb`,publishedAt:`2026-10-06T12:58:10.565Z`},DA=`—`,OA=[{labelKey:`versionInfo.githubRepo`,url:`https://github.com/xiweicheng/ai-helper`,icon:`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 .5C5.73.5.5 5.73.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.28-.01-1.02-.02-2-3.2.7-3.88-1.54-3.88-1.54-.52-1.33-1.28-1.69-1.28-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.68 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 012.9-.39c.98 0 1.97.13 2.9.39 2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.41-2.69 5.38-5.25 5.67.41.35.78 1.05.78 2.12 0 1.53-.01 2.76-.01 3.14 0 .31.21.68.8.56A11.51 11.51 0 0023.5 12C23.5 5.73 18.27.5 12 .5z"/></svg>`},{labelKey:`versionInfo.giteeRepo`,url:`https://gitee.com/xiweicheng/ai-helper`,icon:`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M11.984 0A12 12 0 000 12a12 12 0 0012 12 12 12 0 0012-12A12 12 0 0012 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 01-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 00-.592-.593h-4.15a.592.592 0 01-.592-.592v-1.482a.593.593 0 01.593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 01-4 4H8.444a3.556 3.556 0 01-3.555-3.556V8.89a3.556 3.556 0 013.555-3.556h9.63z"/></svg>`}];function kA(e){let t=e=>typeof e==`string`?e.trim():``,n=e&&typeof e==`object`?e:{};return{version:t(n.version),tag:t(n.tag),commitId:t(n.commitId),publishedAt:t(n.publishedAt)}}function AA(e){if(!e)return DA;let t=Date.parse(e);return Number.isNaN(t)?DA:new Date(t).toLocaleString()}function jA(e){let t=kA(EA),n=[{label:i(`versionInfo.version`),value:t.version?`v${t.version}`:DA},{label:i(`versionInfo.tag`),value:t.tag||DA},{label:i(`versionInfo.commit`),value:t.commitId?t.commitId.slice(0,8):DA,title:t.commitId,mono:!0},{label:i(`versionInfo.publishedAt`),value:AA(t.publishedAt)}];e.textContent=``;for(let t of n){let n=document.createElement(`div`);n.className=`version-info-row`;let r=document.createElement(`div`);r.className=`version-info-label`,r.textContent=t.label;let i=document.createElement(`div`);i.className=t.mono?`version-info-value mono`:`version-info-value`,i.textContent=t.value,t.title&&(i.title=t.title),n.appendChild(r),n.appendChild(i),e.appendChild(n)}}function MA(e){e.textContent=``;for(let t of OA){let n=document.createElement(`div`);n.className=`version-info-link`,n.title=t.url;let r=document.createElement(`span`);r.className=`version-info-link-icon`,r.innerHTML=t.icon;let a=document.createElement(`span`);a.className=`version-info-link-label`,a.textContent=i(t.labelKey);let o=document.createElement(`span`);o.className=`version-info-link-arrow`,o.textContent=`↗`,n.appendChild(r),n.appendChild(a),n.appendChild(o),n.addEventListener(`click`,()=>{chrome.tabs.create({url:t.url})}),e.appendChild(n)}}function NA(){let e=kA(EA);return[`AI Helper v${e.version||DA}`,`${i(`versionInfo.tag`)}: ${e.tag||DA}`,`${i(`versionInfo.commit`)}: ${e.commitId||DA}`,`${i(`versionInfo.publishedAt`)}: ${AA(e.publishedAt)}`].join(`
2489
2489
  `)}function PA(){let e=document.getElementById(`versionInfoBtn`),t=document.getElementById(`versionInfoModal`),n=document.getElementById(`versionInfoCloseBtn`),r=document.getElementById(`versionInfoCopyBtn`),a=document.getElementById(`versionInfoList`),o=document.getElementById(`versionInfoLinks`);if(!e||!t||!a)return;let s=()=>{t.style.display=`none`};e.addEventListener(`click`,e=>{e.stopPropagation();let n=document.getElementById(`headerMoreDropdown`);n&&n.classList.remove(`show`),jA(a),o&&MA(o),t.style.display=`flex`}),n&&n.addEventListener(`click`,s),t.addEventListener(`click`,e=>{e.target===t&&s()}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&t.style.display===`flex`&&s()}),r&&r.addEventListener(`click`,async()=>{try{await navigator.clipboard.writeText(NA()),U(i(`common.copySuccess`),`success`)}catch{U(i(`common.copyFailed`),`error`)}})}var FA=null;function IA(){if(!FA)return;FA.classList.remove(`open`);let e=FA.parentElement?FA.parentElement.querySelector(`.section-select-row`):null;e&&e.classList.remove(`open`),FA=null}document.addEventListener(`click`,e=>{let t=e.target.closest(`.section-select-row`);if(t){let e=t.parentElement.querySelector(`.section-select-list`);if(!e)return;e===FA?IA():(IA(),e.classList.add(`open`),t.classList.add(`open`),FA=e);return}FA&&!FA.parentElement.contains(e.target)&&IA()});var LA=!1;async function RA(){document.getElementById(`providerList`)&&(LA||(LA=!0,VA(),HA()),await zA())}async function zA(){let e=document.getElementById(`providerList`),t=document.getElementById(`providerSelectValue`),n=document.getElementById(`providerSelectHost`);if(!e)return;let r=await xe(),i=r.profiles.find(e=>e.id===r.activeProfileId)||r.profiles[0];t&&(t.textContent=i?i.name:``),n&&(n.textContent=i?ye(i.apiBase):``),e.innerHTML=``;for(let t of r.profiles){let n=!!i&&t.id===i.id,r=document.createElement(`div`);r.className=`provider-option`+(n?` selected`:``),r.dataset.value=t.id;let a=document.createElement(`span`);a.className=`provider-option-check`,a.textContent=n?`✓`:``,r.appendChild(a);let o=document.createElement(`span`);o.className=`provider-option-left`,o.textContent=t.name,r.appendChild(o);let s=ye(t.apiBase);if(s){let e=document.createElement(`span`);e.className=`provider-option-right`,e.textContent=s,r.appendChild(e)}r.addEventListener(`click`,e=>{e.stopPropagation(),IA(),BA(t.id)}),e.appendChild(r)}}async function BA(e){if(e===(await xe()).activeProfileId)return;let t=await Se(e);t&&(await zA(),o.debug(`[SidePanel] provider switched:`,t.name))}function VA(){let e=document.getElementById(`providerManageBtn`);e&&e.addEventListener(`click`,async e=>{e.stopPropagation();let t=chrome.runtime.getURL(`options.html#basic`),n=await chrome.tabs.query({url:chrome.runtime.getURL(`options.html`)});n.length>0?await chrome.tabs.update(n[0].id,{active:!0,url:t}):await chrome.tabs.create({url:t})})}function HA(){chrome.storage.onChanged.addListener((e,t)=>{t===`local`&&(e.modelProfiles||e.activeProfileId)&&zA()})}r(`zh`,{clarify:{remainingTimeDynamic:`剩余时间: {time}`,timeoutSoon:`时间即将耗尽`,sessionNameTitle:`当前会话名称`,sessionNameId:`会话 ID: {id}`,recommended:`推荐`,otherOption:`其他选项`,timedOut:`已超时`}}),r(`en`,{clarify:{remainingTimeDynamic:`Remaining time: {time}`,timeoutSoon:`Time is almost up`,sessionNameTitle:`Current session name`,sessionNameId:`Session ID: {id}`,recommended:`Recommended`,otherOption:`Other options`,timedOut:`Timed out`}});function UA(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function WA(e=`default`){try{let t=new(window.AudioContext||window.webkitAudioContext),n=t.createOscillator(),r=t.createGain();n.connect(r),r.connect(t.destination);let i={default:{frequency:800,duration:.3},success:{frequency:523,duration:.2},warning:{frequency:440,duration:.4},error:{frequency:220,duration:.5}},a=i[e]||i.default;n.frequency.value=a.frequency,n.type=`sine`,r.gain.setValueAtTime(.3,t.currentTime),r.gain.exponentialRampToValueAtTime(.01,t.currentTime+a.duration),n.start(t.currentTime),n.stop(t.currentTime+a.duration),o.debug(`[SidePanel] soundplay:`,e)}catch(e){o.error(`[SidePanel] play sound failed:`,e.message)}}function GA(e,t){let n=document.getElementById(`clarifyTimer`),r=document.getElementById(`clarifyTimerText`);if(!n||!r)return;r.textContent=i(`clarify.remainingTimeDynamic`,{time:UA(e)});let a=e/t*100;n.classList.remove(`warning`,`critical`),e<=10?(n.classList.add(`critical`),r.textContent=i(`clarify.timeoutSoon`,{time:UA(e)})):(e<=30||a<=15)&&n.classList.add(`warning`),e===30&&WA(`warning`)}function KA(e){qA(),z.clarifyTimeoutValue=e;let t=Math.ceil(e/1e3),n=t;GA(n,t),z.clarifyTimerInterval=setInterval(()=>{n--,n<=0?qA():GA(n,t)},1e3)}function qA(){z.clarifyTimerInterval&&(clearInterval(z.clarifyTimerInterval),z.clarifyTimerInterval=null)}function JA(e){o.debug(`[SidePanel] showclarification dialog:`,e);let{question:t,recommendedOption:n,allowCustomInput:r=!0,allowAdditionalInfo:a=!0,toolCallId:s,timeout:c=3e5,sessionId:l}=e,u=Array.isArray(e.options)?e.options:e.options?[String(e.options)]:[];z.currentClarifyToolCallId=s,z.currentClarifySessionId=l||null;let d=document.getElementById(`clarifySessionName`);if(d){if(l&&z.sessions){let e=z.sessions.find(e=>e.id===l);e?(d.textContent=i(`clarify.sessionNameTitle`,{title:e.title}),d.style.display=`block`):(d.textContent=i(`clarify.sessionNameId`,{id:l.substring(0,8)}),d.style.display=`block`)}else d.textContent=``,d.style.display=`none`}let f=n!==void 0&&n>=0?n:0,p=[f],m=f,h=document.getElementById(`clarifyQuestion`);h&&(h.textContent=t);let g=document.getElementById(`clarifyOptionsList`);if(g&&(document.querySelectorAll(`.clarify-option-item`).forEach(e=>{e.remove()}),u.forEach((e,t)=>{let n=p.includes(t),r=document.createElement(`div`);r.className=`clarify-option-item ${m===t?`selected`:``} ${n?`recommended`:``}`,r.dataset.index=t,r.innerHTML=`
2490
2490
  <div class="clarify-option-radio"></div>
2491
2491
  <div class="clarify-option-content">${e}${n?`<span class="clarify-option-badge">${i(`clarify.recommended`)}</span>`:``}</div>
@@ -2699,4 +2699,4 @@ Are you sure you want to stop the agent service? You will not be able to connect
2699
2699
  </td>
2700
2700
  <td style="padding: 6px 10px; text-align: right; border-bottom: 1px solid #eee; color: #888; font-size: 12px;">${s}</td>
2701
2701
  </tr>`}).join(``),_t()}function _t(){let{column:e,asc:t}=mt,n=[`name`,`callCount`,`successCount`,`successRate`,`duration`],r={name:`sortByName`,callCount:`sortByCallCount`,successCount:`sortBySuccessCount`,successRate:`sortBySuccessRate`,duration:`sortByDuration`};n.forEach(n=>{let i=document.getElementById(r[n]);if(!i)return;let a=i.querySelector(`.sort-indicator`);a&&(n===e?(a.textContent=t?`▲`:`▼`,a.style.color=`#667eea`):(a.textContent=``,a.style.color=``))})}document.querySelectorAll(`#toolStatsTable th[data-sort]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.dataset.sort;mt.column===t?mt.asc=!mt.asc:(mt.column=t,mt.asc=!1),ht()})}),at.addEventListener(`click`,()=>{uD()}),ot.addEventListener(`click`,()=>{uD(),cD()});let vt=document.getElementById(`confirmModal`);vt.addEventListener(`click`,e=>{e.target===vt&&uD()});let yt=document.getElementById(`selectionClose`);yt&&yt.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),o.debug(`[SidePanel] user clickcloseselected content by button`),tD(),window.hideFloatingMenu(),z.lastSelectedText=``,z.currentSelectionRange=null}),t.addEventListener(`input`,()=>{})}),qe().then(()=>{Cj(),CD(z.chatConfig.showMessageTimestamp!==!1)}),document.addEventListener(`DOMContentLoaded`,()=>{Tj()}),document.addEventListener(`DOMContentLoaded`,gt),document.addEventListener(`DOMContentLoaded`,zk),document.addEventListener(`DOMContentLoaded`,Aj),document.addEventListener(`DOMContentLoaded`,Pj),document.addEventListener(`DOMContentLoaded`,async()=>{ft(),await xc(),kc(),nA(),TA(),Qj(),Mb(),PA();let{updateBookmarkButtons:e,updateBookmarkBadge:t}=await B(async()=>{let{updateBookmarkButtons:e,updateBookmarkBadge:t}=await Promise.resolve().then(()=>Oc);return{updateBookmarkButtons:e,updateBookmarkBadge:t}},void 0);e(),t()}),document.addEventListener(`DOMContentLoaded`,lO),document.addEventListener(`DOMContentLoaded`,wO),document.addEventListener(`DOMContentLoaded`,DO),document.addEventListener(`DOMContentLoaded`,RO),document.addEventListener(`DOMContentLoaded`,KT),document.addEventListener(`DOMContentLoaded`,$A),document.addEventListener(`DOMContentLoaded`,oj),document.addEventListener(`DOMContentLoaded`,Qa),document.addEventListener(`DOMContentLoaded`,Jo),document.addEventListener(`DOMContentLoaded`,()=>VO()),document.addEventListener(`DOMContentLoaded`,async()=>{let{refreshAgentNames:e,initScrollToBottomBtn:t}=await B(async()=>{let{refreshAgentNames:e,initScrollToBottomBtn:t}=await Promise.resolve().then(()=>dE);return{refreshAgentNames:e,initScrollToBottomBtn:t}},void 0);e(),t()}),document.addEventListener(`DOMContentLoaded`,()=>{let e=new URLSearchParams(window.location.search).has(`popup`),t=document.getElementById(`detachBtn`),n=document.getElementById(`attachBtn`),r=e?n:t;e?n&&(n.style.display=`flex`):t&&(t.style.display=`flex`);let a=()=>{if(!r)return;let t=z.pendingCallApiSessionIds&&z.pendingCallApiSessionIds.size>0;r.disabled=t,r.style.opacity=t?`0.35`:``,r.style.cursor=t?`not-allowed`:`pointer`,r.title=i(t?`detach.taskRunning`:e?`header.attachTitle`:`header.detachTitle`)};a(),document.addEventListener(`generating-state-changed`,a),t&&t.addEventListener(`click`,async()=>{if(z.pendingCallApiSessionIds&&z.pendingCallApiSessionIds.size>0){U(i(`detach.taskRunning`),`warning`);return}try{if((await chrome.runtime.sendMessage({type:`DETACH_SIDEPANEL`,width:window.innerWidth}))?.success)try{window.close()}catch{}}catch(e){o.warn(`[SidePanel] detach failed:`,e?.message)}}),n&&n.addEventListener(`click`,async()=>{if(z.pendingCallApiSessionIds&&z.pendingCallApiSessionIds.size>0){U(i(`detach.taskRunning`),`warning`);return}try{let e=(await chrome.windows.getCurrent()).id;await chrome.runtime.sendMessage({type:`ATTACH_SIDEPANEL`,windowId:e});try{window.close()}catch{}}catch(e){o.warn(`[SidePanel] attach failed:`,e?.message)}})});
2702
- //# sourceMappingURL=side_panel-DZT5O8Az.js.map
2702
+ //# sourceMappingURL=side_panel-UjlvXm_4.js.map