dsh-thoughtdag 0.4.20 → 0.5.0
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-mCpjqoou.js → canonical-BlzQbV3x.js} +2 -2
- package/dist-app/assets/canvas-record-CHx9KBrZ.js +1 -0
- package/dist-app/assets/{claude-code-session-DJkcGfvB.js → claude-code-session-BfwTY3ne.js} +4 -4
- package/dist-app/assets/{codex-session-Crw7-bHo.js → codex-session-BNnk6Ozy.js} +4 -4
- package/dist-app/assets/{dsh-session-DbEtbF5u.js → dsh-session-BXjdZH-4.js} +4 -4
- package/dist-app/assets/{experiment-loop-CkNvS6b1.js → experiment-loop-CBfcRt8t.js} +1 -1
- package/dist-app/assets/{http-bridge-CJvoQLgy.js → http-bridge-CK02uyVL.js} +1 -1
- package/dist-app/assets/index-93ujsGjx.css +1 -0
- package/dist-app/assets/index-F8ykUu-e.js +883 -0
- package/dist-app/assets/{index-CT3R4H-W.js → index-U1FDd3d6.js} +1 -1
- package/dist-app/assets/{index-ZITmlOUw.js → index-Vln2-D4p.js} +3 -3
- package/dist-app/assets/{index-B6lBI8ja.js → index-no3SFEm4.js} +1 -1
- package/dist-app/assets/{pi-session-CBjuXvCc.js → pi-session-DfX1QntM.js} +8 -8
- package/dist-app/assets/{sensitive-scan-CjmPZxkv.js → sensitive-scan-NeBfDua2.js} +1 -1
- package/dist-app/assets/{session-handoff-DGfX02CE.js → session-handoff-Bi6J6owx.js} +2 -2
- package/dist-app/assets/{shared-z6Es4wHy.js → shared-B_zE0vyL.js} +4 -4
- package/dist-app/assets/{turndown-plugin-gfm.cjs-KFp3duAG.js → turndown-plugin-gfm.cjs-t7mTv0d4.js} +3 -3
- package/dist-app/assets/{update-check-D5kNTq-_.js → update-check-CmPLQTC0.js} +1 -1
- package/dist-app/index.html +2 -2
- package/lib/index.js +50 -1
- package/lib/why.mjs +567 -16
- package/package.json +1 -1
- package/dist-app/assets/canvas-record-di62TikJ.js +0 -1
- package/dist-app/assets/index-B-DuMDps.css +0 -1
- package/dist-app/assets/index-BMFFskkL.js +0 -789
- package/dist-app/assets/live-mirror-D-eP76Rm.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as u,a as n,f}from"./index-
|
|
1
|
+
import{t as u,a as n,f}from"./index-F8ykUu-e.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-F8ykUu-e.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/thoughtdag/assets/index-93ujsGjx.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
package/lib/index.js
CHANGED
|
@@ -797,7 +797,7 @@ async function runAgentTurn(ctx, body, emit, isClosed, { answerApprovals = true
|
|
|
797
797
|
const text = blocks.filter(b => b.type === 'text').map(b => b.text).join('')
|
|
798
798
|
if (text) { fullText += text; emit({ text }) }
|
|
799
799
|
}
|
|
800
|
-
} else if (event.type === 'tool/call' || event.type === 'tool/code-dispatch-start') {
|
|
800
|
+
} else if (event.type === 'tool/call' || event.type === 'tool/code-dispatch-start' || event.type === 'tool/ptc-dispatch-start') {
|
|
801
801
|
if (event.data?.callId) turnEntry.calls.set(event.data.callId, { name: event.data?.name ?? 'tool', arguments: event.data?.arguments })
|
|
802
802
|
emit({ tool: { name: event.data?.name ?? 'tool', query: toolQuery(event.data?.name, event.data?.arguments) } })
|
|
803
803
|
} else if (event.type === 'turn/end') {
|
|
@@ -876,6 +876,9 @@ const WHY_PROMPT = `ThoughtDAG why layer. The tools why_check, why_file, why_fin
|
|
|
876
876
|
- why_find(phrase) finds where exact words were asked or answered; why_recall(session, turn) reads one turn in full.
|
|
877
877
|
Cite what you learn briefly; do not restate whole turns.`
|
|
878
878
|
|
|
879
|
+
/** the loaded why library, for the HTTP routes the canvas asks (null until installWhyLayer ran) */
|
|
880
|
+
let whyLib = null
|
|
881
|
+
|
|
879
882
|
async function installWhyLayer(ctx, config) {
|
|
880
883
|
const wantTools = config?.whyTools !== false
|
|
881
884
|
const wantPrompt = config?.whyPrompt !== false
|
|
@@ -891,6 +894,7 @@ async function installWhyLayer(ctx, config) {
|
|
|
891
894
|
return
|
|
892
895
|
}
|
|
893
896
|
whyStatus.loaded = true
|
|
897
|
+
whyLib = why
|
|
894
898
|
const ask = async (mcpName, args, cwd) => {
|
|
895
899
|
const a = { ...args }
|
|
896
900
|
for (const k of PATH_ARGS) if (typeof a[k] === 'string') a[k] = resolveAgainst(cwd, a[k])
|
|
@@ -996,6 +1000,29 @@ export async function apply(ctx, config) {
|
|
|
996
1000
|
return sendJson(res, 200, { session: sessionSummary(session) })
|
|
997
1001
|
}
|
|
998
1002
|
if (path === '/why/status' && req.method === 'GET') return sendJson(res, 200, whyStatus)
|
|
1003
|
+
// ── the why layer for the canvas: find across sessions and memories, recall one turn or entry, list the memory files ──
|
|
1004
|
+
if (path.startsWith('/why/') && req.method === 'GET') {
|
|
1005
|
+
if (!whyLib) return sendJson(res, 503, { error: 'why layer not loaded', ...whyStatus })
|
|
1006
|
+
if (path === '/why/find') {
|
|
1007
|
+
const phrase = url.searchParams.get('phrase') ?? ''
|
|
1008
|
+
const scope = url.searchParams.get('scope') ?? 'all'
|
|
1009
|
+
const limit = Number(url.searchParams.get('limit') ?? 20) || 20
|
|
1010
|
+
const cwd = url.searchParams.get('cwd') ?? undefined
|
|
1011
|
+
return sendJson(res, 200, await whyLib.findJson(phrase, { scope, limit, ...(cwd ? { cwd } : {}) }))
|
|
1012
|
+
}
|
|
1013
|
+
if (path === '/why/recall') {
|
|
1014
|
+
try { return sendJson(res, 200, await whyLib.recallJson(url.searchParams.get('session') ?? '', Number(url.searchParams.get('turn') ?? 0))) }
|
|
1015
|
+
catch (e) { return sendJson(res, 404, { error: e instanceof Error ? e.message : String(e) }) }
|
|
1016
|
+
}
|
|
1017
|
+
if (path === '/why/memories') return sendJson(res, 200, await whyLib.memoriesJson())
|
|
1018
|
+
if (path === '/why/suggest') return sendJson(res, 200, await whyLib.suggestJson(url.searchParams.get('term') ?? '', Number(url.searchParams.get('limit') ?? 8) || 8))
|
|
1019
|
+
if (path === '/why/topics') return sendJson(res, 200, await whyLib.topicsJson())
|
|
1020
|
+
if (path === '/why/by-topic') return sendJson(res, 200, await whyLib.byTopicJson((url.searchParams.get('ids') ?? '').split(',').filter(Boolean), { minP: Number(url.searchParams.get('minP') ?? 0.6) || 0.6, limit: Number(url.searchParams.get('limit') ?? 60) || 60 }))
|
|
1021
|
+
if (path === '/why/sample') return sendJson(res, 200, await whyLib.sampleQuestions(Number(url.searchParams.get('n') ?? 120) || 120))
|
|
1022
|
+
if (path === '/why/dossiers') return sendJson(res, 200, await whyLib.dossiersJson())
|
|
1023
|
+
if (path === '/why/dossier') return sendJson(res, 200, await whyLib.dossierJson(url.searchParams.get('id') ?? ''))
|
|
1024
|
+
if (path === '/why/dossier/new') return sendJson(res, 200, await whyLib.dossierNewTurns(url.searchParams.get('id') ?? '', { limit: Number(url.searchParams.get('limit') ?? 120) || 120 }))
|
|
1025
|
+
}
|
|
999
1026
|
if (path === '/version' && req.method === 'GET') return sendJson(res, 200, { version: PLUGIN_VERSION, latest: await latestPluginVersion(), checkedAt: latestLookup.at || null })
|
|
1000
1027
|
// ── the other agents' session files ──
|
|
1001
1028
|
if (path === '/roots' && req.method === 'GET') {
|
|
@@ -1020,6 +1047,28 @@ export async function apply(ctx, config) {
|
|
|
1020
1047
|
return sendJson(res, 200, await rangeOfFile(abs, url.searchParams.get('start'), url.searchParams.get('length')))
|
|
1021
1048
|
}
|
|
1022
1049
|
// ── link snapshots: the SPA's /api/fetch-url on the harness's bounded fetcher ──
|
|
1050
|
+
// ── topics: the table and the labelling job (POST) ──
|
|
1051
|
+
if (path.startsWith('/why/') && req.method === 'POST') {
|
|
1052
|
+
if (!whyLib) return sendJson(res, 503, { error: 'why layer not loaded', ...whyStatus })
|
|
1053
|
+
const body = await readJson(req)
|
|
1054
|
+
if (path === '/why/topics') return sendJson(res, 200, await whyLib.setTopics(Array.isArray(body?.topics) ? body.topics : []))
|
|
1055
|
+
if (path === '/why/label/start') { try { return sendJson(res, 200, await whyLib.labelStart(body?.call, body?.opts ?? {})) } catch (e) { return sendJson(res, 400, { error: e instanceof Error ? e.message : String(e) }) } }
|
|
1056
|
+
if (path === '/why/label/stop') return sendJson(res, 200, whyLib.labelStop())
|
|
1057
|
+
if (path === '/why/dossier') return sendJson(res, 200, await whyLib.setDossier(String(body?.id ?? ''), body?.dossier ?? {}))
|
|
1058
|
+
if (path === '/why/dossier/delete') { await whyLib.deleteDossier(String(body?.id ?? '')); return sendJson(res, 200, { ok: true }) }
|
|
1059
|
+
if (path === '/why/dossier/pending') return sendJson(res, 200, await whyLib.dossierAddPending(String(body?.id ?? ''), body?.item ?? { text: '' }))
|
|
1060
|
+
}
|
|
1061
|
+
// ── the judge (a System One decision endpoint) forwarded for the canvas; the key rides in the request ──
|
|
1062
|
+
if (path === '/judge' && req.method === 'POST') {
|
|
1063
|
+
const body = await readJson(req)
|
|
1064
|
+
const target = typeof body?.url === 'string' ? body.url.trim() : ''
|
|
1065
|
+
if (!/^https?:\/\//i.test(target)) return sendJson(res, 400, { error: 'url must be http(s)' })
|
|
1066
|
+
try {
|
|
1067
|
+
const r = await fetch(target, { method: 'POST', headers: { 'Content-Type': 'application/json', ...(body.headers && typeof body.headers === 'object' ? body.headers : {}) }, body: JSON.stringify(body.body ?? {}), signal: AbortSignal.timeout(60000) })
|
|
1068
|
+
const text = await r.text()
|
|
1069
|
+
res.writeHead(r.status, { 'content-type': 'application/json; charset=utf-8' }); res.end(text || '{}'); return
|
|
1070
|
+
} catch (error) { return sendJson(res, 502, { error: error instanceof Error ? error.message : String(error) }) }
|
|
1071
|
+
}
|
|
1023
1072
|
if (path === '/fetch-url' && req.method === 'POST') {
|
|
1024
1073
|
const body = await readJson(req)
|
|
1025
1074
|
const target = typeof body?.url === 'string' ? body.url.trim() : ''
|