dsh-thoughtdag 0.5.17 → 0.5.18
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-BYB1lzcN.js → canonical-agWec4XS.js} +2 -2
- package/dist-app/assets/{canvas-record-DEyrBPBB.js → canvas-record-C2yZbu5N.js} +1 -1
- package/dist-app/assets/{claude-code-session-D_7zmlSg.js → claude-code-session-CbBcaUqO.js} +1 -1
- package/dist-app/assets/{codex-session-uM9wSh4p.js → codex-session-wxU_-LWp.js} +1 -1
- package/dist-app/assets/{dsh-session-hF4KiJEe.js → dsh-session-DmOP3XKa.js} +1 -1
- package/dist-app/assets/{experiment-loop-BpXLtMih.js → experiment-loop-XP_t_khd.js} +1 -1
- package/dist-app/assets/http-bridge-Cyr8eePQ.js +1 -0
- package/dist-app/assets/{index-BEFqbPg2.js → index-1Y_JzMpx.js} +1 -1
- package/dist-app/assets/{index-Dx__HVNV.js → index-DFZu6h8O.js} +3 -3
- package/dist-app/assets/{index-Bmw4g-fF.js → index-DWanOFbr.js} +186 -186
- package/dist-app/assets/{index-C3A0a4vg.js → index-ShRKYhWs.js} +1 -1
- package/dist-app/assets/{pi-session-Cza2Qn3S.js → pi-session-DXj3K4Qb.js} +1 -1
- package/dist-app/assets/{sensitive-scan-xUG_OUN8.js → sensitive-scan-B3jSpKVr.js} +1 -1
- package/dist-app/assets/{session-handoff-BMAOplpO.js → session-handoff-y5-kuOb1.js} +2 -2
- package/dist-app/assets/{shared-CIY4bfom.js → shared-DxaHN0fp.js} +1 -1
- package/dist-app/assets/{turndown-plugin-gfm.cjs-8Yws7MsX.js → turndown-plugin-gfm.cjs-wNy9Tytn.js} +1 -1
- package/dist-app/assets/{update-check-Bpoi6nTP.js → update-check-DyyT5hjM.js} +1 -1
- package/dist-app/index.html +1 -1
- package/lib/client.js +20 -4
- package/lib/index.js +27 -1
- package/lib/runtime/backup-write.cjs +56 -0
- package/package.json +1 -1
- package/dist-app/assets/http-bridge-CeoNZsls.js +0 -1
|
@@ -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-DWanOFbr.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,4 +1,4 @@
|
|
|
1
|
-
import{q as x,B as A,n as T}from"./index-
|
|
1
|
+
import{q as x,B as A,n as T}from"./index-DWanOFbr.js";import{t as w,a as g,f as d,d as b,T as S,A as h,i as m,g as k,s as C,h as L}from"./shared-DxaHN0fp.js";const f=i=>typeof i=="string"?i:Array.isArray(i)?i.filter(t=>t&&t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
|
|
2
2
|
`):"";function $(i,t){const s=t&&typeof t=="object"?t:{},e=g(i),r=typeof s.path=="string"&&s.path&&(e==="read"||e==="edit"||e==="write")?[s.path]:[];let n;if(e==="read"&&(typeof s.offset=="number"||typeof s.limit=="number")){const o=Math.max(1,typeof s.offset=="number"?s.offset:1),u=typeof s.limit=="number"?o+Math.max(0,s.limit)-1:o;n={lines:[o,Math.max(o,u)]}}if(e==="write"&&typeof s.content=="string")return{...d(`${s.path??""}
|
|
3
3
|
|
|
4
4
|
${s.content}`,h),paths:r};if(e==="edit"){const o=Array.isArray(s.edits)?s.edits:typeof s.newText=="string"?[{oldText:s.oldText,newText:s.newText}]:[];if(o.length){const u=o.map(a=>`${s.path??""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as c,a,v as g}from"./index-
|
|
1
|
+
import{f as c,a,v as g}from"./index-DWanOFbr.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-agWec4XS.js","assets/index-DWanOFbr.js","assets/index-YkjjqQPO.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as n,a as e,_ as p,f as a,u as h}from"./index-DWanOFbr.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-agWec4XS.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{q as d,n as p,B as _,C as y}from"./index-
|
|
1
|
+
import{q as d,n as p,B as _,C as y}from"./index-DWanOFbr.js";const I=[[/^(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 $(e){return I.find(([t])=>t.test(e))?.[1]??"other"}const T=800,k=32e3,O=4e3,x=(e,t)=>e.length>t?{text:`${e.slice(0,t)}
|
|
2
2
|
…[truncated, ${e.length} chars total]`,truncated:!0}:{text:e,truncated:!1},b=["<command-name>/thoughtdag</command-name>","[[thoughtdag:command]]"];function M(e){return e.filter(t=>!b.some(s=>t.question.includes(s)))}function q(e){e.width=460}function m(e){const t=y(e.data.response,90);t&&(e.data.summaries=[t])}function h(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 w(e,t){const s=new Set,i=(n,a)=>{s.add(a);const c=a.turns.flatMap(r=>r.tools);c.length&&(n.tools=c),n.output.trim()||(n.output=a.turns.map(r=>r.response).filter(r=>r.trim()).at(-1)??""),n.itemIds.includes(a.sessionId)||n.itemIds.push(a.sessionId),!n.at&&a.at&&(n.at=a.at)};for(const n of e)for(const a of n.subagents??[]){const c=a.match?.trim();if(!c)continue;const r=t.find(o=>!s.has(o)&&o.firstQuestion.trim()===c);r&&i(a,r)}for(const n of t){if(s.has(n)||!n.at)continue;const c=e.filter(o=>o.at&&o.at<=n.at).at(-1)??e.at(-1);if(!c)continue;const r={agent:n.runner,task:n.firstQuestion,output:"",itemIds:[n.sessionId],at:n.at};i(r,n),(c.subagents??=[]).push(r)}}function S(e,t,s,i,n,a,c){const r=[];for(const o of t.subagents??[]){const f=d(`[${o.agent}] ${o.task}`.trim(),o.output,!1);f.data.isBranch=!0,f.data.importSource={runner:n,sessionId:a,itemIds:o.itemIds,...c?{cwd:c}:{},subagent:{agent:o.agent,of:t.itemIds[0]??""}},f.data.source={question:f.data.question,response:f.data.response},o.tools?.length&&(f.data.attachments=h({question:o.task,response:o.output,itemIds:o.itemIds,tools:o.tools})),m(f),s.push(f),r.push(f),i.push({id:p(),source:e.id,target:f.id,type:"smoothstep",data:{isBranchFromSelection:!0,branchYRatio:.5}})}return r}function A(e,t,s,i,n){if(e.length===0)return null;const a=[],c=[];let r={id:i.id};for(const u of e){const l=d(u.question||"(tool-only turn)",u.response,!1);l.data.importSource={runner:s,sessionId:t,itemIds:u.itemIds,...n?{cwd:n}:{}},l.data.source={question:l.data.question,response:l.data.response},l.data.attachments=h(u),m(l),a.length===0&&(l.data.isBranch=!0),a.push(l),c.push({id:p(),source:r.id,target:l.id,type:"smoothstep"}),S(l,u,a,c,s,t,n),r=l}const o=_(a,c.filter(u=>u.source!==i.id)),f=Math.min(...o.map(u=>u.position.x)),g=Math.min(...o.map(u=>u.position.y));for(const u of o)u.position={x:u.position.x-f+i.x+560,y:u.position.y-g+i.y};return{nodes:o,edges:c,turnCount:e.length}}function B(e){const t=e??{},s={};typeof t.url=="string"&&/^https?:\/\//.test(t.url)&&(s.url=t.url);const i={};if(typeof t.pages=="string"&&t.pages.trim()&&(i.pages=t.pages.trim()),typeof t.offset=="number"||typeof t.limit=="number"){const n=Math.max(1,typeof t.offset=="number"?t.offset:1),a=typeof t.limit=="number"?n+Math.max(0,t.limit)-1:n;i.lines=[n,Math.max(n,a)]}return Object.keys(i).length&&(s.locator=i),s}function C(e){const t=e??{},s=t.file_path??t.notebook_path;return typeof s=="string"&&s?[s]:[]}function R(e,t){const s=t??{},i=$(e);return i==="write"&&typeof s.content=="string"?`${s.file_path??""}
|
package/dist-app/assets/{turndown-plugin-gfm.cjs-8Yws7MsX.js → turndown-plugin-gfm.cjs-wNy9Tytn.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as W}from"./index-
|
|
1
|
+
import{A as W}from"./index-DWanOFbr.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 s,a as o}from"./index-
|
|
1
|
+
import{t as s,a as o}from"./index-DWanOFbr.js";const r=15*6e4;let i=!1;const c=new URLSearchParams(window.location.search),u=c.get("dv");c.get("su");async function n(){}function l(){for(const e of document.querySelectorAll("script[src]")){const t=e.src.match(/assets\/index-[^/?#]+\.js/);if(t)return t[0]}return null}async function d(){try{const e=await fetch(`${window.location.pathname}?u=${Date.now()}`,{cache:"no-store"});if(!e.ok)return null;const t=(await e.text()).match(/assets\/index-[^"'?#]+\.js/);return t?t[0]:null}catch{return null}}async function a(){if(i)return;const e=l();if(!e)return;const t=await d();t&&t!==e&&(i=!0,s("info",o("update.available"),0,{label:o("update.refresh"),run:()=>window.location.reload()}))}function v(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(a(),n())}),setInterval(()=>{a(),n()},r),u&&setTimeout(()=>{n()},5e3)}export{v as bootUpdateCheck};
|
package/dist-app/index.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
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-
|
|
25
|
+
<script type="module" crossorigin src="/thoughtdag/assets/index-DWanOFbr.js"></script>
|
|
26
26
|
<link rel="stylesheet" crossorigin href="/thoughtdag/assets/index-YkjjqQPO.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
package/lib/client.js
CHANGED
|
@@ -32,7 +32,20 @@ window.__ModuleLoader__.load({
|
|
|
32
32
|
return session === undefined ? null : { id, title: session.displayTitle ?? null, cwd: session.cwd ?? null }
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// The sheet is OWNED: the host's module loader claims every untagged
|
|
36
|
+
// <style> for whichever plugin is materializing at that moment and
|
|
37
|
+
// removes it again when that plugin is replaced or reloaded; untagged,
|
|
38
|
+
// this sheet went with a stranger and the overlay collapsed into the
|
|
39
|
+
// document flow (#70). data-plugin names the owner, data-plugin-css the
|
|
40
|
+
// sheet; and apply reuses what an earlier run left, so nothing doubles.
|
|
41
|
+
const CSS_ID = 'dsh-thoughtdag/client.css'
|
|
42
|
+
let style = document.head.querySelector(`style[data-plugin-css="${CSS_ID}"]`)
|
|
43
|
+
if (!style) {
|
|
44
|
+
style = document.createElement('style')
|
|
45
|
+
style.setAttribute('data-plugin', 'dsh-thoughtdag')
|
|
46
|
+
style.setAttribute('data-plugin-css', CSS_ID)
|
|
47
|
+
document.head.append(style)
|
|
48
|
+
}
|
|
36
49
|
// The map overlay starts below the window's top strip: the desktop host
|
|
37
50
|
// publishes --dsh-frame-top-clearance on its root (48px under the
|
|
38
51
|
// hiddenInset traffic lights on macOS, the caption height on Windows,
|
|
@@ -53,11 +66,14 @@ window.__ModuleLoader__.load({
|
|
|
53
66
|
// host's session header). Centre-right keeps it clear of the host's menu on the left and the window
|
|
54
67
|
// controls on the right.
|
|
55
68
|
style.textContent = '.dsh-td-switch{position:fixed;z-index:120;top:12px;left:60%;display:flex;align-items:center;gap:2px;transform:translateX(-50%);-webkit-app-region:no-drag;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 .dsh-td-mark{display:inline-block;width:8px;height:8px;border-radius:50%;background:#6d5dfc;box-shadow:0 -7px 0 #a99cff,0 7px 0 #f0a35a;margin:0 6px 0 8px;flex:none}.dsh-td-switch[hidden]{display:none}html[data-platform] .dsh-td-switch,html[data-windows-titlebar] .dsh-td-switch{top:max(2px,calc((var(--dsh-frame-top-clearance,40px) - 36px) / 2))}.dsh-td-bar{position:fixed;z-index:121;top:0;left:0;right:0;height:var(--dsh-frame-top-clearance,0px);display:flex;align-items:center;gap:14px;padding:0 16px;box-sizing:border-box;background:#faf9f7;border-bottom:1px solid #e7e2d9;font:500 12px Inter,system-ui,sans-serif;color:#6b7280;overflow:hidden;-webkit-app-region:drag;user-select:none}.dsh-td-bar[hidden]{display:none}html[data-platform="darwin"] .dsh-td-bar{padding-left:max(var(--dsh-frame-leading-clearance,0px),84px)}html[data-windows-titlebar] .dsh-td-bar{padding-right:calc(100% - env(titlebar-area-width,100%) + 16px)}.dsh-td-bar .dsh-td-brand{display:flex;align-items:center;gap:7px;color:#111827;font-weight:600;font-size:13px;white-space:nowrap}.dsh-td-bar .dsh-td-brand i{display:inline-block;width:8px;height:8px;border-radius:50%;background:#6d5dfc;box-shadow:0 -7px 0 #a99cff,0 7px 0 #f0a35a}.dsh-td-bar .dsh-td-switch{position:static;transform:none;-webkit-app-region:no-drag}.dsh-td-bar .dsh-td-title{min-width:0;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#6b7280}.dsh-td-overlay{position:fixed;z-index:100;inset:var(--dsh-frame-top-clearance,0px) 0 0 0;background:#faf9f7}.dsh-td-overlay[hidden]{display:none}.dsh-td-overlay iframe{display:block;width:100%;height:100%;border:0}'
|
|
56
|
-
document.head.append(style)
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
let host = document.body.querySelector(':scope > [data-dsh-thoughtdag]')
|
|
71
|
+
if (!host) {
|
|
72
|
+
host = document.createElement('div')
|
|
73
|
+
host.setAttribute('data-dsh-thoughtdag', '')
|
|
74
|
+
document.body.append(host)
|
|
75
|
+
}
|
|
59
76
|
host.innerHTML = '<div class="dsh-td-switch" role="group" aria-label="view switch"><i class="dsh-td-mark" title="ThoughtDAG"></i><button type="button" data-view="dialog" class="active" aria-pressed="true">对话</button><button type="button" data-view="map" aria-pressed="false">思维图</button></div><div class="dsh-td-bar" data-window-drag hidden><span class="dsh-td-brand"><i></i>ThoughtDAG</span><div class="dsh-td-switch" role="group" aria-label="view switch"><button type="button" data-view="dialog" aria-pressed="false">对话</button><button type="button" data-view="map" class="active" aria-pressed="true">思维图</button></div><span class="dsh-td-title"></span></div><section class="dsh-td-overlay" hidden><iframe title="ThoughtDAG" data-src="/thoughtdag/"></iframe></section>'
|
|
60
|
-
document.body.append(host)
|
|
61
77
|
|
|
62
78
|
// the plugin's version, for the canvas's update dialog and release history
|
|
63
79
|
let pluginVersion = null
|
package/lib/index.js
CHANGED
|
@@ -81,6 +81,10 @@ export const inject = ['webServer', 'sessions', 'sessionController', 'agents', '
|
|
|
81
81
|
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
82
82
|
const require = createRequire(import.meta.url)
|
|
83
83
|
const APP_DIR = resolve(__dirname, '../dist-app')
|
|
84
|
+
// the path rules for the canvas's local backup (#66); the route below shells
|
|
85
|
+
// this, and it is required HERE because the handler needs it in scope — inside
|
|
86
|
+
// agentsHttp() it would be a function-local binding the handler cannot see
|
|
87
|
+
const { writeBackup, BackupRequestError } = require(resolve(__dirname, 'runtime', 'backup-write.cjs'))
|
|
84
88
|
|
|
85
89
|
// The plugin's own version travels into the canvas's URL (?dv=), so the
|
|
86
90
|
// update dialog and the release history know which release runs here, as
|
|
@@ -422,7 +426,13 @@ function contentOf(body) {
|
|
|
422
426
|
throw new HttpError(400, 'body needs text or blocks')
|
|
423
427
|
}
|
|
424
428
|
|
|
425
|
-
|
|
429
|
+
// The attribution on every message this plugin injects. The kind is this
|
|
430
|
+
// producer's OWN: the harness's v4 session format refuses the bare shared
|
|
431
|
+
// literal 'plugin' (its validator throws "format v4 message requires a
|
|
432
|
+
// producer-owned source kind" before the Session adopts the event, so the
|
|
433
|
+
// targeted turn dies and nothing is persisted, #69); only the v3→v4 migration
|
|
434
|
+
// ever rewrote it. scripts/test-inject-source.mjs holds this line to that rule.
|
|
435
|
+
const SOURCE = { kind: 'plugin:dsh-thoughtdag', plugin: 'dsh-thoughtdag' }
|
|
426
436
|
|
|
427
437
|
// ── the other agents' session files on this machine ────────────────────
|
|
428
438
|
|
|
@@ -1217,6 +1227,22 @@ export async function apply(ctx, config) {
|
|
|
1217
1227
|
const body = req.method === 'POST' ? await readJson(req, MAX_WRITE_BODY_BYTES).catch(() => null) : null
|
|
1218
1228
|
if (await agentsHttp().handle(req, res, path, body)) return
|
|
1219
1229
|
}
|
|
1230
|
+
// ── the canvas's local backup, written by THIS host (#66) ──
|
|
1231
|
+
// The File System Access API needs a directory handle, and Chromium's own
|
|
1232
|
+
// picker never returns inside the harness frame on Windows, so the canvas
|
|
1233
|
+
// cannot write the file itself there. It keeps the absolute path the
|
|
1234
|
+
// harness's own picker handed it and asks this endpoint to write instead.
|
|
1235
|
+
// The path rules live in runtime/backup-write.cjs so they can be tested
|
|
1236
|
+
// without a harness: scripts/test-backup-write.mjs.
|
|
1237
|
+
if (path === '/backup' && req.method === 'POST') {
|
|
1238
|
+
const body = await readJson(req, MAX_WRITE_BODY_BYTES).catch(() => null)
|
|
1239
|
+
try {
|
|
1240
|
+
return sendJson(res, 200, { file: await writeBackup(body) })
|
|
1241
|
+
} catch (error) {
|
|
1242
|
+
if (error instanceof BackupRequestError) return sendJson(res, 400, { error: error.message })
|
|
1243
|
+
return sendJson(res, 500, { error: 'could not write the backup: ' + (error instanceof Error ? error.message : String(error)) })
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1220
1246
|
// ── model connection (the SPA's proxy protocol, on the harness's providers) ──
|
|
1221
1247
|
if (path === '/models' && req.method === 'GET') return sendJson(res, 200, await modelsPayload(ctx, registeredProviders))
|
|
1222
1248
|
// the canvas registers its browser-stored interfaces at boot (and after a change): the list answers with them in it
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The canvas's local backup, written by the HOST (#66).
|
|
2
|
+
//
|
|
3
|
+
// The File System Access API needs a directory handle, and Chromium's own
|
|
4
|
+
// picker never returns inside the harness frame on Windows — the canvas cannot
|
|
5
|
+
// write the file itself there. So the canvas keeps the absolute path the
|
|
6
|
+
// harness's own picker handed it and asks the host to write instead.
|
|
7
|
+
//
|
|
8
|
+
// This lives beside the agent runtimes rather than inline in the plugin, so the
|
|
9
|
+
// path rules can be tested without a harness: scripts/test-backup-write.mjs.
|
|
10
|
+
// Pure Node, no harness context.
|
|
11
|
+
'use strict';
|
|
12
|
+
const { mkdir, writeFile } = require('node:fs/promises');
|
|
13
|
+
const { dirname, isAbsolute, resolve, sep } = require('node:path');
|
|
14
|
+
|
|
15
|
+
/** An error the endpoint should report as 400 rather than 500. */
|
|
16
|
+
class BackupRequestError extends Error {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Write one canvas backup under `dir`.
|
|
20
|
+
*
|
|
21
|
+
* @param {{ dir: unknown, name: unknown, json: unknown }} body the request body
|
|
22
|
+
* @returns {Promise<string>} the absolute file written
|
|
23
|
+
* @throws {BackupRequestError} when the request itself is not writable
|
|
24
|
+
*/
|
|
25
|
+
async function writeBackup(body) {
|
|
26
|
+
const dir = typeof body?.dir === 'string' ? body.dir : '';
|
|
27
|
+
const name = typeof body?.name === 'string' ? body.name : '';
|
|
28
|
+
const json = typeof body?.json === 'string' ? body.json : null;
|
|
29
|
+
// an absolute path is the whole safety property: a relative one would resolve
|
|
30
|
+
// against the plugin's cwd, which the canvas cannot know.
|
|
31
|
+
// isAbsolute, NOT resolve(dir).startsWith(sep) — on Windows a drive path
|
|
32
|
+
// starts with "C:" and would never match the separator, so that test refuses
|
|
33
|
+
// every real request there while passing on POSIX.
|
|
34
|
+
if (!dir || !isAbsolute(dir) || !name || json === null) {
|
|
35
|
+
throw new BackupRequestError('dir must be an absolute path; name and json are required');
|
|
36
|
+
}
|
|
37
|
+
// `name` is a RELATIVE path the canvas chose (native canvases at the folder
|
|
38
|
+
// root, session mirrors under cli/), so it is sanitized segment by segment
|
|
39
|
+
const parts = name.replace(/\\/g, '/').split('/').filter((p) => p && p !== '.' && p !== '..');
|
|
40
|
+
if (parts.length === 0) throw new BackupRequestError('name must have at least one path segment');
|
|
41
|
+
const last = parts[parts.length - 1].replace(/[<>:"|?*\u0000-\u001f]/g, '_').slice(0, 120);
|
|
42
|
+
if (!last) throw new BackupRequestError('name resolves to an empty file name');
|
|
43
|
+
const target = resolve(dir, ...parts.slice(0, -1), last);
|
|
44
|
+
// Belt and braces, and it has to agree with the gate above: compare against
|
|
45
|
+
// resolve(dir) — NOT resolve(dir) + sep, which would reject a Windows path
|
|
46
|
+
// for the same reason the startsWith(sep) test did.
|
|
47
|
+
const inside = resolve(dir);
|
|
48
|
+
if (target !== inside && !target.startsWith(inside.endsWith(sep) ? inside : inside + sep)) {
|
|
49
|
+
throw new BackupRequestError('name escapes the backup directory');
|
|
50
|
+
}
|
|
51
|
+
await mkdir(dirname(target), { recursive: true });
|
|
52
|
+
await writeFile(target, json, 'utf8');
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = { writeBackup, BackupRequestError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-thoughtdag",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
4
4
|
"description": "ThoughtDAG for DeepSeek Harness: turn the current DSH session into an editable thought graph on an infinite canvas. Source, releases and issues: github.com/chenxiachan/thoughtdag",
|
|
5
5
|
"author": "Xia Chen",
|
|
6
6
|
"repository": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as f}from"./index-Bmw4g-fF.js";async function y(l){if(window.desktopAgents)return!0;const r=l.replace(/\/+$/,"");let i;try{const e=await fetch(r+"/agents/available",{credentials:"same-origin"});if(!e.ok)return!1;i=await e.json()}catch{return!1}const s=async(e,t)=>{const n=await fetch(r+e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`${e}: ${n.status}`);return n.json()},c=[];let o=null;const d=()=>{o||(o=new EventSource(r+"/agents/events"),o.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of c)n(t)}catch{}})},w=f,g={nativePicker:w},p=()=>new Promise(e=>{if(!w)return e(null);const t=`cwd-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,n=u=>{const a=u.data;u.origin!==window.location.origin||a?.source!=="dsh-thoughtdag"||a.type!=="td:picked-cwd"||a.requestId!==t||(window.removeEventListener("message",n),a.unsupported&&(g.nativePicker=!1),e(typeof a.path=="string"&&a.path?a.path:null))};window.addEventListener("message",n),window.parent.postMessage({source:"dsh-thoughtdag",type:"td:pick-cwd",requestId:t},window.location.origin)});return window.desktopAgents={capabilities:g,available:async()=>i,models:async e=>(await fetch(r+"/agents/models"+(e?`?runtime=${encodeURIComponent(e)}`:""),{credentials:"same-origin"})).json(),run:async e=>(d(),(await s("/agents/run",e)).runId),abort:async e=>(await s("/agents/abort",{runId:e})).ok,answer:async(e,t,n)=>(await s("/agents/answer",{runId:e,requestId:t,response:n})).ok,workspace:async e=>(await s("/agents/workspace",{canvasId:e})).dir,pickCwd:()=>p(),guardWrite:async(e,t)=>(await s("/agents/guard",{cwd:e,config:t})).ok,writeMaterials:async(e,t)=>s("/agents/materials",{cwd:e,files:t}),onEvent:e=>{c.push(e),d()}},!0}export{y as installAgentsHttpBridge};
|