dsh-thoughtdag 0.4.19 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist-app/assets/canonical-mCpjqoou.js +2 -0
- package/dist-app/assets/{canvas-record-6cBZqSEI.js → canvas-record-di62TikJ.js} +1 -1
- package/dist-app/assets/{claude-code-session-D7tlxs4D.js → claude-code-session-DJkcGfvB.js} +1 -1
- package/dist-app/assets/{codex-session-DJn3XLgK.js → codex-session-Crw7-bHo.js} +1 -1
- package/dist-app/assets/{dsh-session-DWyrhHLx.js → dsh-session-DbEtbF5u.js} +1 -1
- package/dist-app/assets/{experiment-loop-BB8N8okB.js → experiment-loop-CkNvS6b1.js} +1 -1
- package/dist-app/assets/http-bridge-CJvoQLgy.js +1 -0
- package/dist-app/assets/index-B-DuMDps.css +1 -0
- package/dist-app/assets/{index-DRLN4EE4.js → index-B6lBI8ja.js} +1 -1
- package/dist-app/assets/{index-DWMhL6gr.js → index-BMFFskkL.js} +141 -141
- package/dist-app/assets/{index-DLrvVMFh.js → index-CT3R4H-W.js} +1 -1
- package/dist-app/assets/{index-BGRoRzbH.js → index-ZITmlOUw.js} +3 -3
- package/dist-app/assets/live-mirror-D-eP76Rm.js +2 -0
- package/dist-app/assets/{pi-session-5Tb178Vi.js → pi-session-CBjuXvCc.js} +1 -1
- package/dist-app/assets/{sensitive-scan-DoCoBRf1.js → sensitive-scan-CjmPZxkv.js} +1 -1
- package/dist-app/assets/{session-handoff-BssCXpUd.js → session-handoff-DGfX02CE.js} +2 -2
- package/dist-app/assets/{shared-CDDxGtwj.js → shared-z6Es4wHy.js} +1 -1
- package/dist-app/assets/{turndown-plugin-gfm.cjs-CyxpTA69.js → turndown-plugin-gfm.cjs-KFp3duAG.js} +1 -1
- package/dist-app/assets/{update-check-CwxfRcEJ.js → update-check-D5kNTq-_.js} +1 -1
- package/dist-app/index.html +2 -2
- package/lib/client.js +34 -7
- package/lib/runtime/agents/http.cjs +0 -5
- package/lib/runtime/agents/ops.cjs +1 -35
- package/package.json +3 -2
- package/dist-app/assets/canonical-C8GEhZR5.js +0 -2
- package/dist-app/assets/http-bridge-DqMM7zer.js +0 -1
- package/dist-app/assets/index-C9qk6fjz.css +0 -1
- package/dist-app/assets/live-mirror-DLoRGse9.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{y as Os,z as pn,A as Is}from"./index-
|
|
1
|
+
import{y as Os,z as pn,A as Is}from"./index-BMFFskkL.js";function Ns(e,n){for(var t=0;t<n.length;t++){const r=n[t];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in e)){const i=Object.getOwnPropertyDescriptor(r,c);i&&Object.defineProperty(e,c,i.get?i:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ze={},Ii="1.13.8",Fa=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},nr=Array.prototype,Ni=Object.prototype,Ca=typeof Symbol<"u"?Symbol.prototype:null,Ls=nr.push,dt=nr.slice,it=Ni.toString,Ms=Ni.hasOwnProperty,$c=typeof ArrayBuffer<"u",qs=typeof DataView<"u",Ps=Array.isArray,Sa=Object.keys,Ba=Object.create,ka=$c&&ArrayBuffer.isView,zs=isNaN,js=isFinite,Yc=!{toString:null}.propertyIsEnumerable("toString"),Wa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xs=Math.pow(2,53)-1;function ze(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),r=Array(t),c=0;c<t;c++)r[c]=arguments[c+n];switch(n){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var i=Array(n+1);for(c=0;c<n;c++)i[c]=arguments[c];return i[n]=r,e.apply(this,i)}}function bn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Kc(e){return e===null}function Li(e){return e===void 0}function Mi(e){return e===!0||e===!1||it.call(e)==="[object Boolean]"}function Qc(e){return!!(e&&e.nodeType===1)}function Pe(e){var n="[object "+e+"]";return function(t){return it.call(t)===n}}const tr=Pe("String"),qi=Pe("Number"),Jc=Pe("Date"),eu=Pe("RegExp"),nu=Pe("Error"),Pi=Pe("Symbol"),zi=Pe("ArrayBuffer");var tu=Pe("Function"),Vs=Fa.document&&Fa.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof Vs!="function"&&(tu=function(e){return typeof e=="function"||!1});const qe=tu,ru=Pe("Object");var iu=qs&&(!/\[native code\]/.test(String(DataView))||ru(new DataView(new ArrayBuffer(8)))),ji=typeof Map<"u"&&ru(new Map),Hs=Pe("DataView");function Gs(e){return e!=null&&qe(e.getInt8)&&zi(e.buffer)}const at=iu?Gs:Hs,yn=Ps||Pe("Array");function Dn(e,n){return e!=null&&Ms.call(e,n)}var Ri=Pe("Arguments");(function(){Ri(arguments)||(Ri=function(e){return Dn(e,"callee")})})();const rr=Ri;function au(e){return!Pi(e)&&js(e)&&!isNaN(parseFloat(e))}function Xi(e){return qi(e)&&zs(e)}function Vi(e){return function(){return e}}function ou(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Xs}}function cu(e){return function(n){return n?.[e]}}const Yt=cu("byteLength"),Zs=ou(Yt);var $s=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Ys(e){return ka?ka(e)&&!at(e):Zs(e)&&$s.test(it.call(e))}const Hi=$c?Ys:Vi(!1),Me=cu("length");function Ks(e){for(var n={},t=e.length,r=0;r<t;++r)n[e[r]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function uu(e,n){n=Ks(n);var t=Wa.length,r=e.constructor,c=qe(r)&&r.prototype||Ni,i="constructor";for(Dn(e,i)&&!n.contains(i)&&n.push(i);t--;)i=Wa[t],i in e&&e[i]!==c[i]&&!n.contains(i)&&n.push(i)}function Oe(e){if(!bn(e))return[];if(Sa)return Sa(e);var n=[];for(var t in e)Dn(e,t)&&n.push(t);return Yc&&uu(e,n),n}function su(e){if(e==null)return!0;var n=Me(e);return typeof n=="number"&&(yn(e)||tr(e)||rr(e))?n===0:Me(Oe(e))===0}function Gi(e,n){var t=Oe(n),r=t.length;if(e==null)return!r;for(var c=Object(e),i=0;i<r;i++){var a=t[i];if(n[a]!==c[a]||!(a in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Ii;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Ra(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Yt(e))}var Oa="[object DataView]";function du(e,n){for(var t=[{a:e,b:n}],r=[],c=[];t.length;){var i=t.pop();if(i===!0){r.pop(),c.pop();continue}if(e=i.a,n=i.b,e===n){if(e!==0||1/e===1/n)continue;return!1}if(e==null||n==null)return!1;if(e!==e){if(n!==n)continue;return!1}var a=typeof e;if(a!=="function"&&a!=="object"&&typeof n!="object")return!1;e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var o=it.call(e);if(o!==it.call(n))return!1;if(iu&&o=="[object Object]"&&at(e)){if(!at(n))return!1;o=Oa}switch(o){case"[object RegExp]":case"[object String]":if(""+e==""+n)continue;return!1;case"[object Number]":t.push({a:+e,b:+n});continue;case"[object Date]":case"[object Boolean]":if(+e==+n)continue;return!1;case"[object Symbol]":if(Ca.valueOf.call(e)===Ca.valueOf.call(n))continue;return!1;case"[object ArrayBuffer]":case Oa:t.push({a:Ra(e),b:Ra(n)});continue}var u=o==="[object Array]";if(!u&&Hi(e)){var h=Yt(e);if(h!==Yt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof n!="object")return!1;var b=e.constructor,m=n.constructor;if(b!==m&&!(qe(b)&&b instanceof b&&qe(m)&&m instanceof m)&&"constructor"in e&&"constructor"in n)return!1}for(var g=r.length;g--;)if(r[g]===e){if(c[g]===n)break;return!1}if(!(g>=0))if(r.push(e),c.push(n),t.push(!0),u){if(g=e.length,g!==n.length)return!1;for(;g--;)t.push({a:e[g],b:n[g]})}else{var f=Oe(e),y;if(g=f.length,Oe(n).length!==g)return!1;for(;g--;){if(y=f[g],!Dn(n,y))return!1;t.push({a:e[y],b:n[y]})}}}return!0}function jn(e){if(!bn(e))return[];var n=[];for(var t in e)n.push(t);return Yc&&uu(e,n),n}function Zi(e){var n=Me(e);return function(t){if(t==null)return!1;var r=jn(t);if(Me(r))return!1;for(var c=0;c<n;c++)if(!qe(t[e[c]]))return!1;return e!==hu||!qe(t[$i])}}var $i="forEach",lu="has",Yi=["clear","delete"],fu=["get",lu,"set"],Qs=Yi.concat($i,fu),hu=Yi.concat(fu),Js=["add"].concat(Yi,$i,lu);const pu=ji?Zi(Qs):Pe("Map"),gu=ji?Zi(hu):Pe("WeakMap"),mu=ji?Zi(Js):Pe("Set"),bu=Pe("WeakSet");function kn(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=e[n[c]];return r}function yu(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=[n[c],e[n[c]]];return r}function Ki(e){for(var n={},t=Oe(e),r=0,c=t.length;r<c;r++)n[e[t[r]]]=t[r];return n}function ot(e){var n=[];for(var t in e)qe(e[t])&&n.push(t);return n.sort()}function Qi(e,n){return function(t){var r=arguments.length;if(n&&(t=Object(t)),r<2||t==null)return t;for(var c=1;c<r;c++)for(var i=arguments[c],a=e(i),o=a.length,u=0;u<o;u++){var h=a[u];(!n||t[h]===void 0)&&(t[h]=i[h])}return t}}const Ji=Qi(jn),Pn=Qi(Oe),ea=Qi(jn,!0);function ed(){return function(){}}function Du(e){if(!bn(e))return{};if(Ba)return Ba(e);var n=ed();n.prototype=e;var t=new n;return n.prototype=null,t}function vu(e,n){var t=Du(e);return n&&Pn(t,n),t}function xu(e){return bn(e)?yn(e)?e.slice():Ji({},e):e}function _u(e,n){return n(e),e}function na(e){return yn(e)?e:[e]}Ae.toPath=na;function lt(e){return Ae.toPath(e)}function ta(e,n){for(var t=n.length,r=0;r<t;r++){if(e==null)return;e=e[n[r]]}return t?e:void 0}function ra(e,n,t){var r=ta(e,lt(n));return Li(r)?t:r}function Uu(e,n){n=lt(n);for(var t=n.length,r=0;r<t;r++){var c=n[r];if(!Dn(e,c))return!1;e=e[c]}return!!t}function ir(e){return e}function Bn(e){return e=Pn({},e),function(n){return Gi(n,e)}}function ar(e){return e=lt(e),function(n){return ta(n,e)}}function ft(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(r){return e.call(n,r)};case 3:return function(r,c,i){return e.call(n,r,c,i)};case 4:return function(r,c,i,a){return e.call(n,r,c,i,a)}}return function(){return e.apply(n,arguments)}}function Tu(e,n,t){return e==null?ir:qe(e)?ft(e,n,t):bn(e)&&!yn(e)?Bn(e):ar(e)}function or(e,n){return Tu(e,n,1/0)}Ae.iteratee=or;function je(e,n,t){return Ae.iteratee!==or?Ae.iteratee(e,n):Tu(e,n,t)}function wu(e,n,t){n=je(n,t);for(var r=Oe(e),c=r.length,i={},a=0;a<c;a++){var o=r[a];i[o]=n(e[o],o,e)}return i}function ia(){}function Eu(e){return e==null?ia:function(n){return ra(e,n)}}function Au(e,n,t){var r=Array(Math.max(0,e));n=ft(n,t,1);for(var c=0;c<e;c++)r[c]=n(c);return r}function Kt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const zn=Date.now||function(){return new Date().getTime()};function Fu(e){var n=function(i){return e[i]},t="(?:"+Oe(e).join("|")+")",r=RegExp(t),c=RegExp(t,"g");return function(i){return i=i==null?"":""+i,r.test(i)?i.replace(c,n):i}}const Cu={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Su=Fu(Cu),nd=Ki(Cu),Bu=Fu(nd),ku=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Fr=/(.)^/,td={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},rd=/\\|'|\r|\n|\u2028|\u2029/g;function id(e){return"\\"+td[e]}var ad=/^\s*(\w|\$)+\s*$/;function Wu(e,n,t){!n&&t&&(n=t),n=ea({},n,Ae.templateSettings);var r=RegExp([(n.escape||Fr).source,(n.interpolate||Fr).source,(n.evaluate||Fr).source].join("|")+"|$","g"),c=0,i="__p+='";e.replace(r,function(h,b,m,g,f){return i+=e.slice(c,f).replace(rd,id),c=f+h.length,b?i+=`'+
|
|
2
2
|
((__t=(`+b+`))==null?'':_.escape(__t))+
|
|
3
3
|
'`:m?i+=`'+
|
|
4
4
|
((__t=(`+m+`))==null?'':__t)+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/claude-code-session-
|
|
2
|
-
import{_ as e}from"./index-
|
|
3
|
-
`);n=w.pop()??"";for(const l of w)r.feedLine(l),a.feedLine(l),c.feedLine(l),o.feedLine(l)}return n&&(r.feedLine(n),a.feedLine(n),c.feedLine(n),o.feedLine(n)),r.toConversation()??a.toConversation()??c.toConversation()??o.toConversation()}async function f(s,i){const{claudeCodeSessionAsBranch:_}=await e(async()=>{const{claudeCodeSessionAsBranch:n}=await import("./claude-code-session-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/claude-code-session-DJkcGfvB.js","assets/index-BMFFskkL.js","assets/index-B-DuMDps.css","assets/shared-z6Es4wHy.js","assets/codex-session-Crw7-bHo.js","assets/dsh-session-DbEtbF5u.js","assets/pi-session-CBjuXvCc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e}from"./index-BMFFskkL.js";async function S(s){const{claudeCodeSessionConversation:i}=await e(async()=>{const{claudeCodeSessionConversation:o}=await import("./claude-code-session-DJkcGfvB.js");return{claudeCodeSessionConversation:o}},__vite__mapDeps([0,1,2,3])),_=i(s);if(_)return _;const{codexSessionConversation:u}=await e(async()=>{const{codexSessionConversation:o}=await import("./codex-session-Crw7-bHo.js");return{codexSessionConversation:o}},__vite__mapDeps([4,1,2,3])),d=u(s);if(d)return d;const{dshSessionConversation:r}=await e(async()=>{const{dshSessionConversation:o}=await import("./dsh-session-DbEtbF5u.js");return{dshSessionConversation:o}},__vite__mapDeps([5,1,2,3])),a=r(s);if(a)return a;const{piSessionConversation:c}=await e(async()=>{const{piSessionConversation:o}=await import("./pi-session-CBjuXvCc.js");return{piSessionConversation:o}},__vite__mapDeps([6,1,2,3]));return c(s)}async function E(s){const{ClaudeSessionCollector:i}=await e(async()=>{const{ClaudeSessionCollector:t}=await import("./claude-code-session-DJkcGfvB.js");return{ClaudeSessionCollector:t}},__vite__mapDeps([0,1,2,3])),{CodexSessionCollector:_}=await e(async()=>{const{CodexSessionCollector:t}=await import("./codex-session-Crw7-bHo.js");return{CodexSessionCollector:t}},__vite__mapDeps([4,1,2,3])),{DshSessionCollector:u}=await e(async()=>{const{DshSessionCollector:t}=await import("./dsh-session-DbEtbF5u.js");return{DshSessionCollector:t}},__vite__mapDeps([5,1,2,3])),{PiSessionCollector:d}=await e(async()=>{const{PiSessionCollector:t}=await import("./pi-session-CBjuXvCc.js");return{PiSessionCollector:t}},__vite__mapDeps([6,1,2,3])),r=new i,a=new _,c=new u,o=new d;let n="";for(let t=await s();t!==null;t=await s()){if(!t)continue;const w=(n+t).split(`
|
|
3
|
+
`);n=w.pop()??"";for(const l of w)r.feedLine(l),a.feedLine(l),c.feedLine(l),o.feedLine(l)}return n&&(r.feedLine(n),a.feedLine(n),c.feedLine(n),o.feedLine(n)),r.toConversation()??a.toConversation()??c.toConversation()??o.toConversation()}async function f(s,i){const{claudeCodeSessionAsBranch:_}=await e(async()=>{const{claudeCodeSessionAsBranch:n}=await import("./claude-code-session-DJkcGfvB.js");return{claudeCodeSessionAsBranch:n}},__vite__mapDeps([0,1,2,3])),u=_(s,i);if(u)return u;const{codexSessionAsBranch:d}=await e(async()=>{const{codexSessionAsBranch:n}=await import("./codex-session-Crw7-bHo.js");return{codexSessionAsBranch:n}},__vite__mapDeps([4,1,2,3])),r=d(s,i);if(r)return r;const{dshSessionAsBranch:a}=await e(async()=>{const{dshSessionAsBranch:n}=await import("./dsh-session-DbEtbF5u.js");return{dshSessionAsBranch:n}},__vite__mapDeps([5,1,2,3])),c=a(s,i);if(c)return c;const{piSessionAsBranch:o}=await e(async()=>{const{piSessionAsBranch:n}=await import("./pi-session-CBjuXvCc.js");return{piSessionAsBranch:n}},__vite__mapDeps([6,1,2,3]));return o(s,i)}export{f as anyRunnerSessionAsBranch,S as anyRunnerSessionConversation,E as streamRunnerConversation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BMFFskkL.js","assets/index-B-DuMDps.css","assets/experiment-loop-CkNvS6b1.js","assets/index-ZITmlOUw.js","assets/canonical-mCpjqoou.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as l,i as b,t as p,a as h,f as A}from"./index-BMFFskkL.js";function K(d,S){return d.find(y=>(y.rel.split("/").pop()??y.rel).includes(S))}let j=!1,O=null;function H(){O?.()}function z(){const d=window.desktopSessions;if(!d||j)return;j=!0,d.watchStart();let S=!1,y=null;const g=async s=>{if(S){y=s;return}S=!0;try{window.dispatchEvent(new CustomEvent("td:sessions-changed"));const{useProjects:a,subscribedSessionIds:i}=await l(async()=>{const{useProjects:w,subscribedSessionIds:E}=await import("./index-BMFFskkL.js").then(D=>D.H);return{useProjects:w,subscribedSessionIds:E}},__vite__mapDeps([0,1])),{activeId:c,projects:o}=a.getState(),f=o.find(w=>w.id===c),t=await d.head(s.rootKey,s.rel,262144).catch(()=>"");if(!t)return;const e=b(t);if(!e)return;const m=!!f&&i(f).includes(e);let r=null;if(!m){if(o.some(v=>i(v).includes(e)))return;const{useStore:E}=await l(async()=>{const{useStore:v}=await import("./index-BMFFskkL.js").then(R=>R.G);return{useStore:v}},__vite__mapDeps([0,1]));if(!E.getState().nodes.some(v=>v.data.importSource?.sessionId===e)){const{parseAnchor:v}=await l(async()=>{const{parseAnchor:k}=await import("./experiment-loop-CkNvS6b1.js");return{parseAnchor:k}},__vite__mapDeps([2,0,1])),R=v(t);if(!R||!o.some(k=>k.id===R.project))return;if(r=R.project,r!==c){p("info",h("atlas.mountPending"),9e3);return}}}const{streamRunnerConversation:n}=await l(async()=>{const{streamRunnerConversation:w}=await import("./index-ZITmlOUw.js");return{streamRunnerConversation:w}},__vite__mapDeps([3,0,1])),{importOrAppendConversation:u,shellSessionReader:_}=await l(async()=>{const{importOrAppendConversation:w,shellSessionReader:E}=await import("./canonical-mCpjqoou.js");return{importOrAppendConversation:w,shellSessionReader:E}},__vite__mapDeps([4,0,1])),V=await n(_(s.rootKey,s.rel)).catch(()=>null),P=await u(V,{focusOnRefresh:!1});P?.kind==="appended"?p("success",A(h("atlas.liveAppended"),{n:P.turns}),8e3):P?.kind==="mounted"&&p("success",A(h(P.mode==="continue"?"atlas.mountedChapter":"atlas.mountedBranch"),{n:P.turns}),9e3)}finally{if(S=!1,y){const a=y;y=null,g(a)}}};d.onSessionsChanged(s=>{g(s)});const C=async s=>{if(!s)return;const{useStore:a}=await l(async()=>{const{useStore:o}=await import("./index-BMFFskkL.js").then(f=>f.G);return{useStore:o}},__vite__mapDeps([0,1])),{useUiStore:i}=await l(async()=>{const{useUiStore:o}=await import("./index-BMFFskkL.js").then(f=>f.D);return{useUiStore:o}},__vite__mapDeps([0,1])),c=a.getState().nodes.find(o=>o.data.importSource?.itemIds?.includes(s));c&&i.getState().setArrivalFocusNodeId(c.id)},T=async(s,a)=>{const{useProjects:i,switchProject:c}=await l(async()=>{const{useProjects:e,switchProject:m}=await import("./index-BMFFskkL.js").then(r=>r.H);return{useProjects:e,switchProject:m}},__vite__mapDeps([0,1])),o=i.getState().projects,f=o.filter(e=>e.name===s),t=o.find(e=>e.id===s)??(f.length===1?f[0]:void 0);if(!t){p("error",h("handoff.deeplinkMiss"));return}if(await c(t.id),a){const{useStore:e}=await l(async()=>{const{useStore:r}=await import("./index-BMFFskkL.js").then(n=>n.G);return{useStore:r}},__vite__mapDeps([0,1])),{useUiStore:m}=await l(async()=>{const{useUiStore:r}=await import("./index-BMFFskkL.js").then(n=>n.D);return{useUiStore:r}},__vite__mapDeps([0,1]));e.getState().nodes.some(r=>r.id===a)&&m.getState().setArrivalFocusNodeId(a)}},I=async s=>{let a="",i="";try{const n=new URL(s),u=n.searchParams.get("canvas");if(u){await T(u,n.searchParams.get("node")??"");return}a=n.searchParams.get("session")??"",i=n.searchParams.get("turn")??""}catch{return}if(!/^[A-Za-z0-9_-]{8,}$/.test(a))return;/^[A-Za-z0-9_-]*$/.test(i)||(i="");const c=await d.roots().catch(()=>[]);let o=null;for(const n of c){const u=await d.list(n.key).catch(()=>[]),_=K(u,a);if(_){o={rootKey:n.key,rel:_.rel};break}}if(!o){const n=[];for(const u of c)for(const _ of await d.list(u.key).catch(()=>[]))n.push({rootKey:u.key,rel:_.rel,mtime:_.mtime});n.sort((u,_)=>_.mtime-u.mtime);for(const u of n.slice(0,40)){const _=await d.head(u.rootKey,u.rel,262144).catch(()=>"");if(_&&b(_)===a){o=u;break}}}if(!o){p("error",h("handoff.deeplinkMiss"));return}const{streamRunnerConversation:f}=await l(async()=>{const{streamRunnerConversation:n}=await import("./index-ZITmlOUw.js");return{streamRunnerConversation:n}},__vite__mapDeps([3,0,1])),{importOrAppendConversation:t,shellSessionReader:e}=await l(async()=>{const{importOrAppendConversation:n,shellSessionReader:u}=await import("./canonical-mCpjqoou.js");return{importOrAppendConversation:n,shellSessionReader:u}},__vite__mapDeps([4,0,1])),m=await f(e(o.rootKey,o.rel)).catch(()=>null),r=await t(m);r?r.kind==="appended"?p("success",A(h("atlas.liveAppended"),{n:r.turns}),8e3):r.kind==="mounted"?p("success",A(h(r.mode==="continue"?"atlas.mountedChapter":"atlas.mountedBranch"),{n:r.turns}),9e3):r.kind==="imported"&&p("success",A(h("toast.importedChats"),{n:1,m:r.nodeCount}),8e3):p("error",h("handoff.notASession")),r&&i&&await C(i)};d.onDeepLink?.(s=>{I(s)}),(async()=>{const{bootProjects:s}=await l(async()=>{const{bootProjects:i}=await import("./index-BMFFskkL.js").then(c=>c.H);return{bootProjects:i}},__vite__mapDeps([0,1]));await s();const a=await d.pendingDeepLink?.().catch(()=>null);a&&I(a)})();const L="thoughtdag.atlas.sweepmark";O=async()=>{const{bootProjects:s}=await l(async()=>{const{bootProjects:t}=await import("./index-BMFFskkL.js").then(e=>e.H);return{bootProjects:t}},__vite__mapDeps([0,1]));await s();const a=await d.roots().catch(()=>[]),i=[];for(const t of a){const e=await d.list(t.key).catch(()=>[]);for(const m of e)i.push({rootKey:t.key,rel:m.rel,mtime:m.mtime,size:m.size})}let c={};try{c=JSON.parse(localStorage.getItem(L)??"{}")}catch{}const o=Object.keys(c).length===0;i.sort((t,e)=>e.mtime-t.mtime);const f=i.filter((t,e)=>{const m=`${t.mtime}|${t.size}`;return c[`${t.rootKey}|${t.rel}`]===m?!1:o?e<30:!0});for(const t of f)await g({rootKey:t.rootKey,rel:t.rel});for(const t of i)c[`${t.rootKey}|${t.rel}`]=`${t.mtime}|${t.size}`;localStorage.setItem(L,JSON.stringify(c))},O()}export{K as pickSessionFile,z as startLiveMirror,H as sweepRecentSessions};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as w,B as x,o as T}from"./index-
|
|
1
|
+
import{v as w,B as x,o as T}from"./index-BMFFskkL.js";import{t as A,a as I,e as l,d as C,T as L,A as h,g as m,f as O,s as S}from"./shared-z6Es4wHy.js";const f=r=>typeof r=="string"?r:Array.isArray(r)?r.filter(t=>t&&t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
|
|
2
2
|
`):"";function b(r,t){const s=t&&typeof t=="object"?t:{},e=I(r),n=typeof s.path=="string"&&s.path&&(e==="read"||e==="edit"||e==="write")?[s.path]:[];let o;if(e==="read"&&(typeof s.offset=="number"||typeof s.limit=="number")){const c=Math.max(1,typeof s.offset=="number"?s.offset:1),d=typeof s.limit=="number"?c+Math.max(0,s.limit)-1:c;o={lines:[c,Math.max(c,d)]}}if(e==="write"&&typeof s.content=="string")return{...l(`${s.path??""}
|
|
3
3
|
|
|
4
4
|
${s.content}`,h),paths:n};if(e==="edit"){const c=Array.isArray(s.edits)?s.edits:typeof s.newText=="string"?[{oldText:s.oldText,newText:s.newText}]:[];if(c.length){const d=c.map(i=>`${s.path??""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as c,a,w as g}from"./index-
|
|
1
|
+
import{f as c,a,w as g}from"./index-BMFFskkL.js";const k=[{kind:"sk-… key",re:/\bsk-[A-Za-z0-9_-]{16,}\b/g},{kind:"GitHub token",re:/\bgh[pousr]_[A-Za-z0-9]{20,}\b/g},{kind:"AWS access key",re:/\bAKIA[0-9A-Z]{16}\b/g},{kind:"Slack token",re:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{kind:"Google API key",re:/\bAIza[0-9A-Za-z_-]{35}\b/g},{kind:"JWT",re:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}\b/g},{kind:"private key block",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/g},{kind:"token assignment",re:/\b(?:API_KEY|APIKEY|SECRET|TOKEN|PASSWORD|ACCESS_KEY|AUTH_TOKEN)[A-Z_]*\s*[=:]\s*['"]?[A-Za-z0-9_/+-]{16,}/g},{kind:"HuggingFace token",re:/\bhf_[A-Za-z0-9]{30,}\b/g},{kind:"npm token",re:/\bnpm_[A-Za-z0-9]{30,}\b/g}],f=t=>t.length<=10?`${t.slice(0,4)}…`:`${t.slice(0,6)}…${t.slice(-2)}`;function o(t,e,s){if(t)for(const{kind:i,re:n}of k){n.lastIndex=0;const r=n.exec(t);if(r&&s.push({where:e,kind:i,sample:f(r[0])}),s.length>=20)return}}function l(t){const e=[];for(const s of t){const i=(s.data.question||s.data.summaries?.[0]||s.id).replace(/\s+/g," ").slice(0,28);o(s.data.question,i,e);for(const n of s.data.responses??[])o(n,i,e);for(const n of s.data.attachments??[])n.type.startsWith("image/")||o(n.content,`${i} · ${n.name}`,e);if(e.length>=20)break}return e}async function b(t){const e=l(t);if(e.length===0)return!0;const s=e.slice(0,5).map(n=>`· ${n.where} — ${n.kind}(${n.sample})`).join(`
|
|
2
2
|
`),i=e.length>5?`
|
|
3
3
|
${c(a("sensitive.more"),{n:e.length-5})}`:"";return g({title:a("sensitive.title"),message:`${c(a("sensitive.body"),{n:e.length})}
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/canonical-
|
|
2
|
-
import{t as n,a as e,_ as p,f as a,u as h}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/canonical-mCpjqoou.js","assets/index-BMFFskkL.js","assets/index-B-DuMDps.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as n,a as e,_ as p,f as a,u as h}from"./index-BMFFskkL.js";const l=/^http:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?\//i;async function w(){const s=window.location.hash,r=s.match(/[#&]import-url=([^&]+)/);if(!r)return;const c=/[#&]mode=harvest\b/.test(s);history.replaceState(null,"",window.location.pathname+window.location.search);const i=decodeURIComponent(r[1]);if(!l.test(i)){n("error",e("handoff.notLoopback"),9e3);return}try{const o=await fetch(i);if(!o.ok)throw new Error(`HTTP ${o.status}`);const d=await o.text(),{importOrAppendSession:f}=await p(async()=>{const{importOrAppendSession:u}=await import("./canonical-mCpjqoou.js");return{importOrAppendSession:u}},__vite__mapDeps([0,1,2])),t=await f(d);if(!t)throw new Error(e("handoff.notASession"));t.kind==="appended"?n("success",a(e("atlas.appended"),{n:t.turns}),9e3):t.kind==="mounted"?n("success",a(e(t.mode==="continue"?"atlas.mountedChapter":"atlas.mountedBranch"),{n:t.turns}),12e3):t.kind==="opened"?n("info",e("atlas.upToDate"),6e3):n("info",a(e("handoff.saved"),{n:t.nodeCount}),12e3,{label:e("handoff.backupAction"),run:()=>h.getState().setBackupDialogOpen(!0)})}catch(o){n("error",a(e("handoff.failed"),{msg:o instanceof Error?o.message:String(o)}),12e3)}}export{w as consumeSessionHandoff};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as m,o as p,B as h,C as g}from"./index-
|
|
1
|
+
import{v as m,o as p,B as h,C as g}from"./index-BMFFskkL.js";const _=[[/^(Read|NotebookRead|read_file|view_image)$/i,"read"],[/^(Write|write_file)$/i,"write"],[/^(Edit|MultiEdit|NotebookEdit|apply_patch)$/i,"edit"],[/^(Bash|BashOutput|Shell|exec_command|local_shell|write_stdin)$/i,"run"],[/^(Grep|Glob|LS|Search|WebSearch|web_search)$/i,"search"],[/^(WebFetch|Fetch)$/i,"fetch"],[/^(Task|Agent)$/i,"agent"]];function y(e){return _.find(([t])=>t.test(e))?.[1]??"other"}const x=800,O=32e3,S=4e3,I=(e,t)=>e.length>t?{text:`${e.slice(0,t)}
|
|
2
2
|
…[truncated, ${e.length} chars total]`,truncated:!0}:{text:e,truncated:!1},$=["<command-name>/thoughtdag</command-name>","[[thoughtdag:command]]"];function M(e){return e.filter(t=>!$.some(n=>t.question.includes(n)))}function w(e){e.width=460}function b(e){const t=g(e.data.response,90);t&&(e.data.summaries=[t])}function L(e){return e.tools.map(t=>({id:p(),name:`tool: ${t.name}${t.truncated?" (truncated)":""}`,type:"text/plain",size:t.call.length+t.result.length,content:`[call] ${t.call}
|
|
3
3
|
[result]
|
|
4
4
|
${t.result}`,...t.paths?.length?{paths:t.paths}:{},...t.op?{op:t.op}:{}}))}function k(e,t,n,s,i){if(e.length===0)return null;const r=[],l=[];let u={id:s.id};for(const o of e){const a=m(o.question||"(tool-only turn)",o.response,!1);a.data.importSource={runner:n,sessionId:t,itemIds:o.itemIds,...i?{cwd:i}:{}},a.data.source={question:a.data.question,response:a.data.response},a.data.attachments=L(o),b(a),r.length===0&&(a.data.isBranch=!0),r.push(a),l.push({id:p(),source:u.id,target:a.id,type:"smoothstep"}),u=a}const c=h(r,l.filter(o=>o.source!==s.id)),f=Math.min(...c.map(o=>o.position.x)),d=Math.min(...c.map(o=>o.position.y));for(const o of c)o.position={x:o.position.x-f+s.x+560,y:o.position.y-d+s.y};return{nodes:c,edges:l,turnCount:e.length}}function A(e){const t=e??{},n={};typeof t.url=="string"&&/^https?:\/\//.test(t.url)&&(n.url=t.url);const s={};if(typeof t.pages=="string"&&t.pages.trim()&&(s.pages=t.pages.trim()),typeof t.offset=="number"||typeof t.limit=="number"){const i=Math.max(1,typeof t.offset=="number"?t.offset:1),r=typeof t.limit=="number"?i+Math.max(0,t.limit)-1:i;s.lines=[i,Math.max(i,r)]}return Object.keys(s).length&&(n.locator=s),n}function C(e){const t=e??{},n=t.file_path??t.notebook_path;return typeof n=="string"&&n?[n]:[]}function q(e,t){const n=t??{},s=y(e);return s==="write"&&typeof n.content=="string"?`${n.file_path??""}
|
package/dist-app/assets/{turndown-plugin-gfm.cjs-CyxpTA69.js → turndown-plugin-gfm.cjs-KFp3duAG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as W}from"./index-
|
|
1
|
+
import{A as W}from"./index-BMFFskkL.js";function Y(d,p){for(var g=0;g<p.length;g++){const s=p[g];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in d)){const o=Object.getOwnPropertyDescriptor(s,c);o&&Object.defineProperty(d,c,o.get?o:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}))}var u={},E;function J(){if(E)return u;E=1,Object.defineProperty(u,"__esModule",{value:!0});var d=/highlight-(?:text|source)-([a-z0-9]+)/;function p(t){t.addRule("highlightedCodeBlock",{filter:function(e){var r=e.firstChild;return e.nodeName==="DIV"&&d.test(e.className)&&r&&r.nodeName==="PRE"},replacement:function(e,r,n){var l=r.className||"",i=(l.match(d)||[null,""])[1];return`
|
|
2
2
|
|
|
3
3
|
`+n.fence+i+`
|
|
4
4
|
`+r.firstChild.textContent+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as u,a as n,f}from"./index-
|
|
1
|
+
import{t as u,a as n,f}from"./index-BMFFskkL.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};
|
package/dist-app/index.html
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
<meta name="twitter:title" content="ThoughtDAG — Your thinking deserves a map" />
|
|
23
23
|
<meta name="twitter:description" content="Wires are the context: an infinite canvas where LLM conversations grow into an editable thought graph. No signup; the example canvas needs no key." />
|
|
24
24
|
<meta name="twitter:image" content="https://app.thoughtdag.workers.dev/og-twitter.jpg" />
|
|
25
|
-
<script type="module" crossorigin src="/thoughtdag/assets/index-
|
|
26
|
-
<link rel="stylesheet" crossorigin href="/thoughtdag/assets/index-
|
|
25
|
+
<script type="module" crossorigin src="/thoughtdag/assets/index-BMFFskkL.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/thoughtdag/assets/index-B-DuMDps.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
package/lib/client.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
// "思维图", shows a full-screen SAME-ORIGIN iframe at /thoughtdag/ (the SPA
|
|
4
4
|
// is served by the host half on the same web server — no CORS, no second
|
|
5
5
|
// origin). The switch floats on purpose: it is there before any session is
|
|
6
|
-
// open
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// open (0.4.18 moved it into the session header, which hid it on the empty
|
|
7
|
+
// page; withdrawn in 0.4.19). While the canvas is up, the SPA shows the same
|
|
8
|
+
// switch in its own top bar, next to the canvas chip, so nothing floats over
|
|
9
|
+
// the canvas toolbar at any width: the pill hides once the SPA has booted
|
|
10
|
+
// and comes back when the canvas closes (0.4.20). All conversation smarts live inside the ThoughtDAG app; this file
|
|
9
11
|
// only opens the door and forwards the current session id so the canvas can
|
|
10
12
|
// offer to mirror it.
|
|
11
13
|
//
|
|
@@ -18,7 +20,9 @@ window.__ModuleLoader__.load({
|
|
|
18
20
|
factory: () => {
|
|
19
21
|
const module = { exports: {} }
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
// uiWorkspace: the harness's directory picker (the OS dialog when the
|
|
24
|
+
// harness runs on this machine, its in-app browser when reached remotely)
|
|
25
|
+
module.exports.inject = ['sessions', 'uiWorkspace']
|
|
22
26
|
module.exports.apply = ctx => {
|
|
23
27
|
const currentSession = () => {
|
|
24
28
|
const snapshot = ctx.sessions.list.getSnapshot()
|
|
@@ -29,7 +33,7 @@ window.__ModuleLoader__.load({
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
const style = document.createElement('style')
|
|
32
|
-
style.textContent = '.dsh-td-switch{position:fixed;z-index:120;top:12px;left:50%;display:flex;gap:2px;transform:translateX(-50%);border:1px solid #d1d5db;border-radius:999px;background:rgba(255,255,255,.96);padding:3px;backdrop-filter:blur(10px)}.dsh-td-switch button{height:28px;border:0;border-radius:999px;background:transparent;padding:0 11px;color:#6b7280;font:600 12px Inter,system-ui,sans-serif;cursor:pointer;white-space:nowrap}.dsh-td-switch button:hover{background:#f3f4f6;color:#111827}.dsh-td-switch button.active{background:#111827;color:#fff}.dsh-td-overlay{position:fixed;z-index:100;inset:0;background:#faf9f7}.dsh-td-overlay[hidden]{display:none}.dsh-td-overlay iframe{display:block;width:100%;height:100%;border:0}'
|
|
36
|
+
style.textContent = '.dsh-td-switch{position:fixed;z-index:120;top:12px;left:50%;display:flex;gap:2px;transform:translateX(-50%);border:1px solid #d1d5db;border-radius:999px;background:rgba(255,255,255,.96);padding:3px;backdrop-filter:blur(10px)}.dsh-td-switch button{height:28px;border:0;border-radius:999px;background:transparent;padding:0 11px;color:#6b7280;font:600 12px Inter,system-ui,sans-serif;cursor:pointer;white-space:nowrap}.dsh-td-switch button:hover{background:#f3f4f6;color:#111827}.dsh-td-switch button.active{background:#111827;color:#fff}.dsh-td-switch[hidden]{display:none}.dsh-td-overlay{position:fixed;z-index:100;inset:0;background:#faf9f7}.dsh-td-overlay[hidden]{display:none}.dsh-td-overlay iframe{display:block;width:100%;height:100%;border:0}'
|
|
33
37
|
document.head.append(style)
|
|
34
38
|
|
|
35
39
|
const host = document.createElement('div')
|
|
@@ -40,6 +44,8 @@ window.__ModuleLoader__.load({
|
|
|
40
44
|
let pluginVersion = null
|
|
41
45
|
fetch('/thoughtdag/api/version').then(r => (r.ok ? r.json() : null)).then(j => { if (j && typeof j.version === 'string') pluginVersion = j.version }).catch(() => {})
|
|
42
46
|
|
|
47
|
+
const switchEl = host.querySelector('.dsh-td-switch')
|
|
48
|
+
let spaReady = false
|
|
43
49
|
const dialogBtn = host.querySelector('[data-view="dialog"]')
|
|
44
50
|
const mapBtn = host.querySelector('[data-view="map"]')
|
|
45
51
|
const overlay = host.querySelector('.dsh-td-overlay')
|
|
@@ -51,7 +57,7 @@ window.__ModuleLoader__.load({
|
|
|
51
57
|
mapBtn.classList.toggle('active', map)
|
|
52
58
|
mapBtn.setAttribute('aria-pressed', String(map))
|
|
53
59
|
}
|
|
54
|
-
const close = () => { overlay.hidden = true; setView(false); send('td:view', { shown: false }) }
|
|
60
|
+
const close = () => { overlay.hidden = true; switchEl.hidden = false; setView(false); send('td:view', { shown: false }) }
|
|
55
61
|
const send = (type, payload) => frame.contentWindow?.postMessage({ source: 'dsh-thoughtdag', type, ...payload }, location.origin)
|
|
56
62
|
|
|
57
63
|
const syncCurrent = () => {
|
|
@@ -62,6 +68,7 @@ window.__ModuleLoader__.load({
|
|
|
62
68
|
mapBtn.addEventListener('click', () => {
|
|
63
69
|
overlay.hidden = false
|
|
64
70
|
setView(true)
|
|
71
|
+
if (spaReady) switchEl.hidden = true
|
|
65
72
|
// the SPA boots on first open, never while hidden: a canvas that
|
|
66
73
|
// measures itself inside a display:none frame fits its view to a 0×0
|
|
67
74
|
// box and shows nothing when revealed
|
|
@@ -76,7 +83,27 @@ window.__ModuleLoader__.load({
|
|
|
76
83
|
window.addEventListener('message', event => {
|
|
77
84
|
if (event.origin !== location.origin || event.data?.source !== 'dsh-thoughtdag') return
|
|
78
85
|
if (event.data.type === 'td:close') return close()
|
|
79
|
-
|
|
86
|
+
// the canvas asks for a working directory: open the harness's own
|
|
87
|
+
// picker and hand the path back (null when cancelled; unsupported
|
|
88
|
+
// when this runtime has no picker, so the canvas shows a typed field)
|
|
89
|
+
if (event.data.type === 'td:pick-cwd') {
|
|
90
|
+
const requestId = event.data.requestId
|
|
91
|
+
const pick = ctx.uiWorkspace?.pickDirectory
|
|
92
|
+
if (typeof pick !== 'function') return send('td:picked-cwd', { requestId, path: null, unsupported: true })
|
|
93
|
+
// null = cancelled; a throw = this harness has no OS dialog to show
|
|
94
|
+
// (reached remotely, its picker is the in-app browse kind): the
|
|
95
|
+
// canvas then offers a typed path instead
|
|
96
|
+
Promise.resolve(pick.call(ctx.uiWorkspace))
|
|
97
|
+
.then(path => send('td:picked-cwd', { requestId, path: typeof path === 'string' ? path : null }))
|
|
98
|
+
.catch(() => send('td:picked-cwd', { requestId, path: null, unsupported: true }))
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
if (event.data.type === 'td:request-current') {
|
|
102
|
+
// the SPA has booted and shows its own switch: the pill steps aside
|
|
103
|
+
spaReady = true
|
|
104
|
+
if (!overlay.hidden) switchEl.hidden = true
|
|
105
|
+
return syncCurrent()
|
|
106
|
+
}
|
|
80
107
|
// the canvas forked or continued a session: stage it and go back to the
|
|
81
108
|
// chat, which now shows exactly the context the canvas produced
|
|
82
109
|
if (event.data.type === 'td:select-session' && typeof event.data.session === 'string') {
|
|
@@ -77,11 +77,6 @@ function createAgentsHttp({ workspaceRoot = path.join(os.homedir(), '.thoughtdag
|
|
|
77
77
|
const id = String(body?.runId ?? '');
|
|
78
78
|
return json(res, 200, { ok: runtime(owners.get(id)).answer(id, String(body?.requestId ?? ''), body?.response) }), true;
|
|
79
79
|
}
|
|
80
|
-
if (p === '/agents/dirs' && method === 'GET') {
|
|
81
|
-
// the directory browser's one level; a bad path is a 404 the client shows in place
|
|
82
|
-
try { return json(res, 200, await ops.listDirectory(url.searchParams.get('path') ?? '')), true; }
|
|
83
|
-
catch (e) { return json(res, 404, { error: String(e?.message ?? e) }), true; }
|
|
84
|
-
}
|
|
85
80
|
if (p === '/agents/workspace' && method === 'POST') return json(res, 200, { dir: await ops.workspaceFor(workspaceRoot, String(body?.canvasId ?? 'default')) }), true;
|
|
86
81
|
if (p === '/agents/guard' && method === 'POST') return json(res, 200, { ok: await ops.writeGuard(String(body?.cwd ?? ''), body?.config) }), true;
|
|
87
82
|
if (p === '/agents/materials' && method === 'POST') return json(res, 200, await ops.writeMaterials(String(body?.cwd ?? ''), body?.files)), true;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// the harness plugin host and the local server alike.
|
|
5
5
|
'use strict';
|
|
6
6
|
const path = require('node:path');
|
|
7
|
-
const os = require('node:os');
|
|
8
7
|
const fsp = require('node:fs/promises');
|
|
9
8
|
|
|
10
9
|
const WORKSPACE_ID = /^[\w.-]{1,80}$/;
|
|
@@ -52,37 +51,4 @@ async function writeGuard(cwd, config) {
|
|
|
52
51
|
return true;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
* name-sorted tail and the listing says it was cut. */
|
|
57
|
-
const DIR_LIST_LIMIT = 400;
|
|
58
|
-
|
|
59
|
-
/** One level of the host's filesystem, for a browser the person walks to
|
|
60
|
-
* pick a working directory: the directory itself, its ancestry as crumbs
|
|
61
|
-
* (every one a jump target), its child directories name-sorted (symlinks
|
|
62
|
-
* to directories included, hidden ones flagged and left to the client),
|
|
63
|
-
* and the home directory to root a "Home" crumb. No path given lists the
|
|
64
|
-
* home directory; an unreadable or missing one throws. */
|
|
65
|
-
async function listDirectory(target) {
|
|
66
|
-
const home = os.homedir();
|
|
67
|
-
const dir = path.resolve(typeof target === 'string' && target.trim() ? target.trim() : home);
|
|
68
|
-
const st = await fsp.stat(dir);
|
|
69
|
-
if (!st.isDirectory()) throw new Error('not a directory');
|
|
70
|
-
const crumbs = [];
|
|
71
|
-
for (let cur = dir; ; cur = path.dirname(cur)) {
|
|
72
|
-
const parent = path.dirname(cur);
|
|
73
|
-
crumbs.unshift({ name: parent === cur ? cur : path.basename(cur), path: cur, hidden: false });
|
|
74
|
-
if (parent === cur) break;
|
|
75
|
-
}
|
|
76
|
-
const dirents = await fsp.readdir(dir, { withFileTypes: true });
|
|
77
|
-
const entries = [];
|
|
78
|
-
for (const d of dirents) {
|
|
79
|
-
let isDir = d.isDirectory();
|
|
80
|
-
if (!isDir && d.isSymbolicLink()) { try { isDir = (await fsp.stat(path.join(dir, d.name))).isDirectory(); } catch { isDir = false; } }
|
|
81
|
-
if (isDir) entries.push({ name: d.name, path: path.join(dir, d.name), hidden: d.name.startsWith('.') });
|
|
82
|
-
}
|
|
83
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
84
|
-
const truncated = entries.length > DIR_LIST_LIMIT;
|
|
85
|
-
return { path: dir, home, crumbs, entries: truncated ? entries.slice(0, DIR_LIST_LIMIT) : entries, truncated };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
module.exports = { workspaceFor, writeMaterials, writeGuard, listDirectory };
|
|
54
|
+
module.exports = { workspaceFor, writeMaterials, writeGuard };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-thoughtdag",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
4
4
|
"description": "ThoughtDAG for DeepSeek Harness: turn the current DSH session into an editable thought graph on an infinite canvas.",
|
|
5
5
|
"author": "Xia Chen",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"inject": [
|
|
43
43
|
"@deepseek-ai/dsh-client-modules",
|
|
44
44
|
"@deepseek-ai/dsh-api-session-controller",
|
|
45
|
-
"@deepseek-ai/dsh-client-connection"
|
|
45
|
+
"@deepseek-ai/dsh-client-connection",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-workspace"
|
|
46
47
|
],
|
|
47
48
|
"immediately": false
|
|
48
49
|
},
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGRoRzbH.js","assets/index-DWMhL6gr.js","assets/index-C9qk6fjz.css","assets/experiment-loop-BB8N8okB.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as N,b as y,_ as E,p as q,r as M,h as O,a as H,u as j,j as B,s as Q,k as z,l as $,f as U,m as W,n as Y,t as Z,o as F,q as tt,v as et}from"./index-DWMhL6gr.js";const st=190;async function at(o){const{anyRunnerSessionConversation:n}=await E(async()=>{const{anyRunnerSessionConversation:a}=await import("./index-BGRoRzbH.js");return{anyRunnerSessionConversation:a}},__vite__mapDeps([0,1,2])),e=await n(o);return V(e)}function ct(o,n){let a=0,s=!1;return async()=>{if(s)return null;const c=await window.desktopSessions.readRange(o,n,a,8388608);return a=c.nextStart,c.eof&&(s=!0),c.text}}function L(o){if(!o)return null;for(const n of N.getState().projects){const e=n.sourceSession;if(!e)continue;if(e.sessionId===o)return{project:n,entry:e};const a=e.chapters?.find(c=>c.sessionId===o);if(a)return{project:n,entry:a};const s=e.branches?.find(c=>c.sessionId===o);if(s)return{project:n,entry:s}}return null}function K(o,n,e,a,s){const c=a.position.x+(s?560:0),m=c-40,d=c+580,t=o.nodes.reduce((w,I)=>{const x=I.width??I.measured?.width??540;if(I.position.x+x<m||I.position.x>d)return w;const f=I.height??I.measured?.height??300;return Math.max(w,I.position.y+f)},s?a.position.y-300:a.position.y+(a.height??140)),u=c-n[0].position.x,l=Math.max(t+st,s?a.position.y:-1/0)-n[0].position.y,i=n.map(w=>({...w,position:{x:w.position.x+u,y:w.position.y+l}})),h=[{id:F(),source:a.id,target:i[0].id,type:"smoothstep"},...e];return{moved:i,edges:h}}async function V(o){if(!o)return null;const n=o.build(),e=n.nodes.filter(m=>m.data.importSource),a=e.at(-1)?.id??n.nodes.at(-1)?.id??"";if(n.nodes.length===0)return null;const s=L(o.sessionId);if(s)return G(o,n,e,a,s);if(o.sessionId){const m=await ot(o.sessionId);if(m){let d=-1,t="";if(e.forEach((u,l)=>{const i=u.data.importSource?.itemIds?.[0],h=i?m.byFirstId.get(i):void 0;h&&(d=l,t=h)}),d>=0){await M(m.projectId,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:d+1,tailNodeId:t});const u=L(o.sessionId);if(u)return G(o,n,e,a,u)}}}if(o.sessionId&&e.length>0){const{parseAnchor:m}=await E(async()=>{const{parseAnchor:t}=await import("./experiment-loop-BB8N8okB.js");return{parseAnchor:t}},__vite__mapDeps([3,1,2])),d=m(e[0].data.question??"");if(d&&N.getState().projects.some(t=>t.id===d.project)){await O(d.project);const t=y.getState(),u=N.getState().projects.find(i=>i.id===d.project);let l=t.nodes.find(i=>i.id===d.node)??null;if(!l&&d.mode==="continue"&&u.sourceSession?.sessionId){const i=u.sourceSession;l=t.nodes.find(h=>h.id===i.tailNodeId)??t.nodes.filter(h=>h.data.importSource?.sessionId===i.sessionId).at(-1)??null}if(l){const i=n.nodes.find(f=>f.data.importSource&&f.data.stepKind!=="note");if(i&&m(i.data.question??"")){const f=H("exp.openerMark");i.data={...i.data,question:f,source:i.data.source?{...i.data.source,question:f}:i.data.source}}const h=new Set(n.nodes.map(f=>f.id)),w=n.edges.filter(f=>h.has(f.source)&&h.has(f.target)),I=d.mode!=="continue",x=K(t,n.nodes,w,l,I);if(I){const f=x.moved.find(_=>_.data.importSource&&_.data.stepKind!=="note");f&&(f.data={...f.data,isBranch:!0})}return t.pushHistory(),y.setState(f=>({nodes:[...f.nodes,...x.moved],edges:[...f.edges,...x.edges]})),await M(d.project,I?"branch":"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a,anchorNodeId:l.id}),j.getState().setArrivalFocusNodeId(x.moved[x.moved.length-1].id),{kind:"mounted",mode:I?"branch":"continue",turns:e.length}}}}const c=crypto.randomUUID();return await B(q(c),JSON.stringify({state:{nodes:Q(n.nodes),edges:n.edges},version:1})),j.getState().setArrivalFocusNodeId(n.nodes[n.nodes.length-1].id),await z(c,o.title.slice(0,60),"chat",o.sessionId?{sourceSession:{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a}}:void 0),{kind:"imported",nodeCount:n.nodes.length}}async function ut(o,n){if(!o||!o.sessionId)return null;if(L(o.sessionId))return V(o);const e=o.build(),a=e.nodes.filter(i=>i.data.importSource);if(e.nodes.length===0)return null;await O(n);const s=y.getState(),c=N.getState().projects.find(i=>i.id===n);if(!c)return null;const m=c.sourceSession,d=(m?.sessionId?s.nodes.find(i=>i.id===m.tailNodeId)??s.nodes.filter(i=>i.data.importSource?.sessionId===m.sessionId).at(-1):null)??s.nodes.at(-1)??null;if(!d)return null;const t=new Set(e.nodes.map(i=>i.id)),u=e.edges.filter(i=>t.has(i.source)&&t.has(i.target)),l=K(s,e.nodes,u,d,!1);return s.pushHistory(),y.setState(i=>({nodes:[...i.nodes,...l.moved],edges:[...i.edges,...l.edges]})),await M(n,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:a.length,tailNodeId:a.at(-1)?.id??e.nodes.at(-1).id,anchorNodeId:d.id}),j.getState().setArrivalFocusNodeId(l.moved[l.moved.length-1].id),{kind:"mounted",mode:"continue",turns:a.length}}async function ot(o){const{projects:n,activeId:e}=N.getState(),a=[...n].sort((s,c)=>s.id===e?-1:c.id===e?1:c.updatedAt-s.updatedAt);for(const s of a){if(s.id!==e&&s.provenanceSessions&&!s.provenanceSessions.includes(o))continue;let c;if(s.id===e)c=y.getState().nodes;else try{const{get:d}=await E(async()=>{const{get:l}=await import("./index-DWMhL6gr.js").then(i=>i.F);return{get:l}},__vite__mapDeps([1,2])),t=await d(q(s.id));c=(typeof t=="string"?JSON.parse(t):t)?.state?.nodes??[]}catch{continue}if(s.id!==e&&!s.provenanceSessions){const d=[...new Set(c.map(t=>t.data.importSource?.sessionId).filter(t=>!!t))];N.setState(t=>({projects:t.projects.map(u=>u.id===s.id?{...u,provenanceSessions:d}:u)}))}const m=new Map;for(const d of c)if(d.data.importSource?.sessionId===o&&d.data.stepKind!=="note"){const t=d.data.importSource.itemIds?.[0];t&&m.set(t,d.id)}if(m.size>0)return{projectId:s.id,byFirstId:m}}return null}async function G(o,n,e,a,s){await O(s.project.id);const c=y.getState(),m=c.nodes.filter(p=>p.data.importSource?.sessionId===o.sessionId),d=c.nodes.find(p=>p.id===s.entry.tailNodeId)??m.at(-1)??null,t=s.entry.importedCount>0&&e.length>=s.entry.importedCount?e[s.entry.importedCount-1]:null;if(t){const p=t.data.importSource?.itemIds?.[0],r=p?m.find(C=>C.data.importSource?.itemIds?.[0]===p):void 0,g=r?.data.source,k=!!g&&r.data.question===g.question&&(r.data.response??"")===(g.response??""),S=t.data,J=!!r&&(S.response??"").trim()===""&&(r.data.response??"").trim()!=="",D=!!r&&!J&&(S.question!==r.data.question||(S.response??"")!==(r.data.response??"")),A=r?.data.attachments??[],T=S.attachments??[],X=!!r&&T.length>A.length&&A.every((C,R)=>T[R]?.name===C.name);if(r&&k&&(D||X)){const C=D?S.attachments:[...A,...T.slice(A.length)];y.setState(R=>({nodes:R.nodes.map(P=>P.id===r.id?{...P,data:{...P.data,question:S.question,response:S.response,responses:S.responses,responseIndex:S.responseIndex,tokenCount:S.tokenCount,attachments:C,importSource:S.importSource,source:S.source}}:P)})),y.getState().recomputeStaleness()}}if(e.length<=s.entry.importedCount)return j.getState().setArrivalFocusNodeId(d?.id??null),{kind:"opened"};const u=e[s.entry.importedCount],l=n.nodes.findIndex(p=>p.id===u.id),i=n.nodes.slice(l),h=new Set(i.map(p=>p.id)),w=n.edges.filter(p=>h.has(p.source)&&h.has(p.target)),I=new Map;for(const p of m){const r=p.data.importSource?.itemIds?.[0];r&&I.set(r,p.id)}const x=new Map;for(const p of n.nodes){const r=p.data.importSource?.itemIds?.[0];r&&!h.has(p.id)&&x.set(p.id,r)}const f=[];for(const p of n.edges){if(!h.has(p.target)||h.has(p.source))continue;const r=x.get(p.source),g=r?I.get(r):void 0;g&&f.push({...p,id:F(),source:g})}const _=new Set(f.map(p=>p.target));let v,b;if(d){const p=K(c,i,w,d,!1);v=p.moved;const r=new Set(w.map(g=>g.target));b=p.edges.filter(g=>!(g.source===d.id&&_.has(g.target)));for(const g of v)g.id!==v[0].id&&!r.has(g.id)&&!_.has(g.id)&&g.data.stepKind!=="note"&&b.push({id:F(),source:d.id,target:g.id,type:"smoothstep"});b=[...b,...f]}else{const r=(c.nodes.length?Math.max(...c.nodes.map(S=>S.position.x)):0)+560-i[0].position.x,g=-i[0].position.y;v=i.map(S=>({...S,position:{x:S.position.x+r,y:S.position.y+g}}));const k=it(nt(e.length-s.entry.importedCount),v[0]);v=[k,...v],b=[{id:F(),source:k.id,target:v[1].id,type:"smoothstep"},...w]}return c.pushHistory(),y.setState(p=>({nodes:[...p.nodes,...v],edges:[...p.edges,...b]})),await tt(s.project.id,o.sessionId,{importedCount:e.length,tailNodeId:a}),j.getState().setArrivalFocusNodeId(v[d?0:1].id),{kind:"appended",turns:e.length-s.entry.importedCount}}function nt(o){return`[Mirror] The source session grew by ${o} turn(s); the earlier mirrored turns were removed from this canvas by hand, so the new turns land here on their own.`}function it(o,n){const e=et(o,"",!1);return e.data.stepKind="note",e.data.importSource=n.data.importSource?{...n.data.importSource,itemIds:[]}:void 0,e.width=460,e.position={x:n.position.x-520,y:n.position.y},e}async function pt(o){const{projects:n,activeId:e}=N.getState(),a=n.find(t=>t.id===o);if(!a?.sourceSession)return"native";if((a.sourceSession.chapters?.length??0)>0||(a.sourceSession.branches?.length??0)>0)return"diverged-mirror";let s;if(o===e)s=y.getState().nodes;else{const{get:t}=await E(async()=>{const{get:l}=await import("./index-DWMhL6gr.js").then(i=>i.F);return{get:l}},__vite__mapDeps([1,2])),u=await t(q(o));try{s=(typeof u=="string"?JSON.parse(u):u)?.state?.nodes??[]}catch{return"diverged-mirror"}}const c=a.sourceSession.sessionId,m=s.filter(t=>t.data.importSource?.sessionId===c);return s.some(t=>!t.data.importSource)||s.some(t=>t.data.importSource&&t.data.importSource.sessionId!==c)||m.filter(t=>t.data.source).length<a.sourceSession.importedCount||m.some(t=>t.data.source&&(t.data.question!==t.data.source.question||t.data.response!==t.data.source.response))?"diverged-mirror":"pristine-mirror"}async function mt(){const{bootProjects:o}=await E(async()=>{const{bootProjects:u}=await import("./index-DWMhL6gr.js").then(l=>l.H);return{bootProjects:u}},__vite__mapDeps([1,2]));await o();const{projects:n,activeId:e}=N.getState(),a=n.find(u=>u.id===e);if(!a?.sourceSession)return;const s=W(a);if(s.length===0)return;const c=new Set;for(const u of y.getState().nodes){const l=u.data.importSource?.sessionId;l&&c.add(l)}const m=s.filter(u=>!c.has(u));if(m.length===0)return;for(const u of m)await Y(a.id,u);const t=N.getState().projects.find(u=>u.id===a.id)?.sourceSession?"toast.unsubscribed":"toast.unsubscribedNative";Z("info",U(H(t),{n:m.length}),8e3)}async function lt(o,n){const e=o.filter(d=>!!d&&!!d.sessionId);if(e.length===0)return null;const a=n??await $(U(H("atlas.mergedName"),{title:e[0].title.slice(0,24),n:e.length}));await O(a),y.getState().pushHistory();let s=0,c=0;for(const d of e){const t=d.sessionId;if(L(t)){c++;continue}const u=d.build();if(u.nodes.length===0){c++;continue}const l=u.nodes.filter(r=>r.data.importSource),i=y.getState().nodes,h=i.reduce((r,g)=>Math.max(r,g.position.x+(g.width??g.measured?.width??540)),-1/0),w=i.reduce((r,g)=>Math.min(r,g.position.y),1/0),I=Math.min(...u.nodes.map(r=>r.position.x)),x=Math.min(...u.nodes.map(r=>r.position.y)),f=(Number.isFinite(h)?h+180:0)-I,_=(Number.isFinite(w)?w:0)-x,v=u.nodes.map(r=>({...r,position:{x:r.position.x+f,y:r.position.y+_}})),b=new Set(v.map(r=>r.id)),p=u.edges.filter(r=>b.has(r.source)&&b.has(r.target));y.setState(r=>({nodes:[...r.nodes,...v],edges:[...r.edges,...p]})),await M(a,"chapter",{sessionId:t,runner:d.source,importedCount:l.length,tailNodeId:l.at(-1)?.id??v[v.length-1].id}),s++}y.getState().pushHistory();const m=y.getState().nodes.at(-1);return s>0&&m&&j.getState().setArrivalFocusNodeId(m.id),{mounted:s,skipped:c,projectId:a}}export{pt as canvasUniqueness,V as importOrAppendConversation,at as importOrAppendSession,lt as mergeSessionsIntoProject,ut as mountConversationToProject,ct as shellSessionReader,W as subscribedSessionIds,mt as unsubscribeOrphanedSessions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
async function w(l){if(window.desktopAgents)return!0;const s=l.replace(/\/+$/,"");let o;try{const e=await fetch(s+"/agents/available",{credentials:"same-origin"});if(!e.ok)return!1;o=await e.json()}catch{return!1}const n=async(e,t)=>{const a=await fetch(s+e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t??{})});if(!a.ok)throw new Error(`${e}: ${a.status}`);return a.json()},i=[];let r=null;const c=()=>{r||(r=new EventSource(s+"/agents/events"),r.onmessage=e=>{try{const t=JSON.parse(e.data);for(const a of i)a(t)}catch{}})};return window.desktopAgents={capabilities:{nativePicker:!1},available:async()=>o,models:async e=>(await fetch(s+"/agents/models"+(e?`?runtime=${encodeURIComponent(e)}`:""),{credentials:"same-origin"})).json(),run:async e=>(c(),(await n("/agents/run",e)).runId),abort:async e=>(await n("/agents/abort",{runId:e})).ok,answer:async(e,t,a)=>(await n("/agents/answer",{runId:e,requestId:t,response:a})).ok,workspace:async e=>(await n("/agents/workspace",{canvasId:e})).dir,pickCwd:async()=>null,listDirectory:async e=>{const t=await fetch(s+"/agents/dirs"+(e?`?path=${encodeURIComponent(e)}`:""),{credentials:"same-origin"});if(!t.ok)throw new Error((await t.json().catch(()=>null))?.error??`${t.status}`);return t.json()},guardWrite:async(e,t)=>(await n("/agents/guard",{cwd:e,config:t})).ok,writeMaterials:async(e,t)=>n("/agents/materials",{cwd:e,files:t}),onEvent:e=>{i.push(e),c()}},!0}export{w as installAgentsHttpBridge};
|