dsh-thoughtdag 0.5.5 → 0.5.6
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.
- package/dist-app/assets/{canonical-DyO4cfs8.js → canonical-CSoZNuPg.js} +2 -2
- package/dist-app/assets/{canvas-record-B106EgJV.js → canvas-record-wnrN3Xiq.js} +1 -1
- package/dist-app/assets/{claude-code-session-COqNVArs.js → claude-code-session-Cjh9ZQd-.js} +1 -1
- package/dist-app/assets/{codex-session-CVhXEocv.js → codex-session-Dgq2Nsm-.js} +1 -1
- package/dist-app/assets/{dsh-session-y6pdDHlg.js → dsh-session-B9EsawUx.js} +1 -1
- package/dist-app/assets/{experiment-loop-Bj2wGvJp.js → experiment-loop-CW1DebVY.js} +1 -1
- package/dist-app/assets/{http-bridge-TYkQm1R3.js → http-bridge-DG_nZVjI.js} +1 -1
- package/dist-app/assets/index-B1IC85BS.js +914 -0
- package/dist-app/assets/index-CgnmeNGy.css +1 -0
- package/dist-app/assets/{index-BndAg25p.js → index-D7EuGCbC.js} +1 -1
- package/dist-app/assets/{index-D2RofBbL.js → index-Fb-Q079K.js} +1 -1
- package/dist-app/assets/{index-BZP0zxsA.js → index-rGP3NmkV.js} +3 -3
- package/dist-app/assets/local-ladder.worker-Dj3KyWai.js +1 -0
- package/dist-app/assets/{pi-session-fSCIsceL.js → pi-session-1yVM3dMC.js} +1 -1
- package/dist-app/assets/{sensitive-scan-_-YPfT-P.js → sensitive-scan-CROt_JlT.js} +1 -1
- package/dist-app/assets/{session-handoff-rVZFB7ll.js → session-handoff-r3h38IOI.js} +2 -2
- package/dist-app/assets/{shared-svBDp9_R.js → shared-ABEucpDy.js} +1 -1
- package/dist-app/assets/{turndown-plugin-gfm.cjs-DBiLx1SX.js → turndown-plugin-gfm.cjs-C6ig148J.js} +1 -1
- package/dist-app/assets/update-check-Bo9R7uYE.js +1 -0
- package/dist-app/index.html +2 -2
- package/lib/client.js +33 -8
- package/lib/index.js +183 -11
- package/lib/why.mjs +56 -0
- package/package.json +1 -1
- package/dist-app/assets/index-CqebPxzE.css +0 -1
- package/dist-app/assets/index-DR0C_9n-.js +0 -912
- package/dist-app/assets/local-ladder.worker-BkmzXrqq.js +0 -1
- package/dist-app/assets/update-check-n2hvSdhA.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){"use strict";const C=s=>/[-ヿ㐀-鿿]/.test(s),E=s=>s.replace(/\[([^\]]+)\]\((?:https?:)?[^)]*\)/g,"$1").replace(/\(?https?:\/\/\S+\)?/g,"").replace(/\*\*|__|`|^#+[ \t]*|^[ \t]*[-*•][ \t]+|^[ \t]*\d+[.)][ \t]+/gm,"").replace(/(^|[\s((])[*_](?=\S)/g,"$1").replace(new RegExp("(?<=\\S)[*_](?=$|[\\s,.;:!?),。;:!?)])","g"),"").replace(/[ \t]+/g," ");function L(s){return E(s.replace(/\r/g,"")).split(new RegExp('\\n+|(?<=[。!?;])|(?<=[.!?])\\s+(?=[A-Z"“])')).map(o=>o.trim()).filter(o=>o.length>=4)}const T={},A=s=>T[s]??=new Intl.Segmenter(s==="zh"?"zh":"en",{granularity:"word"});function f(s,o){const r=A(o),a=[];for(const{segment:e}of r.segment(s)){if(/^\s+$/.test(e)){a.length&&(a[a.length-1].space=!0);continue}a.push({t:e})}return a}const N=s=>s==="zh"?{brief:80,takeaway:28,topic:6,unit:"characters"}:{brief:40,takeaway:14,topic:3,unit:"words"},g=(s,o)=>o==="zh"?[...s.replace(/[\s\p{P}\p{S}]/gu,"")].length:s.split(/\s+/).filter(r=>/\w/.test(r)).length,P=/^(结论|所以|因此|总之|简言之|一句话|答案是|建议|So|Therefore|In short|The answer|Bottom line|Decision|Verdict)/i,j=new Set(["the","a","an","of","to","in","is","are","and","or","that","this","it","for","on","with","as","be","的","了","是","在","和","与","或","这","那","就","也","都","而","及"]),u=(s,o)=>{if(o==="zh"){const r=s.replace(/[\s\p{P}\p{S}]/gu,""),a=[];for(let e=0;e+1<r.length;e++)a.push(r.slice(e,e+2));return a}return s.toLowerCase().split(/[^a-z0-9]+/).filter(r=>r.length>1&&!j.has(r))};function B(s,o,r,a){const e=C(s+o.slice(0,200))?"zh":"en",m=L(o);if(m.length<2)return null;const h=new Set(u(r??s,e)),d=N(e),w=[...m.map((t,n)=>{const i=u(t,e),y=i.filter(p=>h.has(p)).length,S=g(t,e);let c=y/Math.sqrt(Math.max(4,i.length))+(n===0?.25:0)+(P.test(t)?.5:0);return S<6&&(c-=.6),S>d.brief*1.6&&(c-=.3),{i:n,text:t,score:c,len:S}})].sort((t,n)=>n.score-t.score).slice(0,4).sort((t,n)=>t.i-n.i),K=w.map(t=>t.text).join(e==="zh"?"":" "),l=[],M=new Map,O=new Map;w.forEach((t,n)=>{const i=f(t.text,e);M.set(t.i,l.length),O.set(t.i,i.length),n>0&&e!=="zh"&&l.length&&(l[l.length-1].space=!0),l.push(...i)});const _=[...w].sort((t,n)=>n.score-t.score),b=_.find(t=>t.len<=d.brief)??_[0],R=M.get(b.i)??0,q=O.get(b.i)??0,I=Array.from({length:q},(t,n)=>R+n).filter(t=>t<l.length),D=t=>{const n=t.split(/[,,;;::。.!?!?]/).map(c=>c.replace(/^\s*(\d+[.)、]?|[-*•])\s*/,"").trim()).filter(Boolean),i=n.filter(c=>g(c,e)>=(e==="zh"?4:3)&&!/^(是的|好的|对的?|嗯|可以|没错|yes|ok(ay)?|sure|right|indeed)$/i.test(c));if(!i.length)return n.slice(0,2).join(e==="zh"?",":", ")||t;const y=new Set(u(s,e));return i.map((c,p)=>({c,s:u(c,e).filter(J=>y.has(J)).length+(g(c,e)<=d.takeaway?.5:0)-p*.05})).sort((c,p)=>p.s-c.s)[0].c},z=(r??"").trim()||D(b.text),$=f(z,e).map(t=>t.t+(t.space?" ":""));let k=(a??"").trim();if(!k){let t="";for(const n of f(z,e)){if(g(t+n.t,e)>d.topic)break;t+=n.t+(n.space&&e!=="zh"?" ":"")}k=t.trim()||z}const G=f(k,e).map(t=>t.t+(t.space?" ":""));return!I.length||!$.length?null:{tokens:l,abstract:K,sentences:w.map(t=>t.i),brief:I,takeaway:$,topic:G,model:"local"}}self.onmessage=s=>{const{id:o,question:r,response:a,takeaway:e,topic:m}=s.data;let h=null;try{h=B(r,a,e,m)}catch{h=null}self.postMessage({id:o,ladder:h})}})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as u,a as n,f}from"./index-DR0C_9n-.js";const h=15*6e4;let i=!1;const d=new URLSearchParams(window.location.search),s=d.get("dv"),p=d.get("su")==="1",w=30*6e4;let c=!1,r=0;async function a(){if(!(!s||p||c)&&!(Date.now()-r<w)){r=Date.now();try{const t=await fetch("https://api.github.com/repos/chenxiachan/thoughtdag/releases?per_page=1");if(!t.ok)return;const o=(await t.json())?.[0]?.tag_name?.replace(/^v/,"");if(!o||o===s)return;c=!0,u("info",f(n("update.desktopAvailable"),{v:o}),0,{label:n("update.desktopDownload"),run:()=>window.open("https://chenxiachan.github.io/thoughtdag/#download","_blank")})}catch{}}}function v(){for(const t of document.querySelectorAll("script[src]")){const e=t.src.match(/assets\/index-[^/?#]+\.js/);if(e)return e[0]}return null}async function m(){try{const t=await fetch(`${window.location.pathname}?u=${Date.now()}`,{cache:"no-store"});if(!t.ok)return null;const e=(await t.text()).match(/assets\/index-[^"'?#]+\.js/);return e?e[0]:null}catch{return null}}async function l(){if(i)return;const t=v();if(!t)return;const e=await m();e&&e!==t&&(i=!0,u("info",n("update.available"),0,{label:n("update.refresh"),run:()=>window.location.reload()}))}function b(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(l(),a())}),setInterval(()=>{l(),a()},h),s&&setTimeout(()=>{a()},5e3)}export{b as bootUpdateCheck};
|