dsh-thoughtdag 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist-app/assets/{canonical-Bu0lc0IS.js → canonical-DyO4cfs8.js} +2 -2
  2. package/dist-app/assets/{canvas-record-CmXFsOEP.js → canvas-record-B106EgJV.js} +1 -1
  3. package/dist-app/assets/claude-code-session-COqNVArs.js +8 -0
  4. package/dist-app/assets/codex-session-CVhXEocv.js +12 -0
  5. package/dist-app/assets/{dsh-session-DcFBMiBo.js → dsh-session-y6pdDHlg.js} +3 -3
  6. package/dist-app/assets/{experiment-loop-DLwE-thH.js → experiment-loop-Bj2wGvJp.js} +1 -1
  7. package/dist-app/assets/{http-bridge-C9WCIcet.js → http-bridge-TYkQm1R3.js} +1 -1
  8. package/dist-app/assets/{index-sZcnNAul.js → index-BZP0zxsA.js} +3 -3
  9. package/dist-app/assets/{index-DdyOBAYQ.js → index-BndAg25p.js} +1 -1
  10. package/dist-app/assets/index-CqebPxzE.css +1 -0
  11. package/dist-app/assets/{index-DIJtOJxk.js → index-D2RofBbL.js} +1 -1
  12. package/dist-app/assets/index-DR0C_9n-.js +912 -0
  13. package/dist-app/assets/pi-session-fSCIsceL.js +14 -0
  14. package/dist-app/assets/{sensitive-scan-brovGPLt.js → sensitive-scan-_-YPfT-P.js} +1 -1
  15. package/dist-app/assets/{session-handoff-rMaxWoB9.js → session-handoff-rVZFB7ll.js} +2 -2
  16. package/dist-app/assets/shared-svBDp9_R.js +10 -0
  17. package/dist-app/assets/{turndown-plugin-gfm.cjs-D9apJuex.js → turndown-plugin-gfm.cjs-DBiLx1SX.js} +1 -1
  18. package/dist-app/assets/{update-check-D1_48OBp.js → update-check-n2hvSdhA.js} +1 -1
  19. package/dist-app/index.html +2 -2
  20. package/lib/runtime/agents/README.md +1 -1
  21. package/lib/runtime/agents/claude.cjs +13 -14
  22. package/lib/runtime/agents/codex.cjs +13 -14
  23. package/lib/runtime/agents/pi.cjs +14 -27
  24. package/lib/runtime/agents/where.cjs +99 -0
  25. package/lib/why.mjs +101 -7
  26. package/package.json +1 -1
  27. package/dist-app/assets/claude-code-session-B0xfEAeh.js +0 -7
  28. package/dist-app/assets/codex-session-DGckD5vR.js +0 -12
  29. package/dist-app/assets/index-8PjAYhti.js +0 -904
  30. package/dist-app/assets/index-Lvtth6pP.css +0 -1
  31. package/dist-app/assets/pi-session-DA_RmEVw.js +0 -14
  32. package/dist-app/assets/shared-DJOVlRHh.js +0 -10
@@ -1,12 +0,0 @@
1
- import{q as p,n as d,B as m}from"./index-8PjAYhti.js";import{t as y,a as _,d as g,e as I,m as x,f as T,s as C,A as w,g as v,T as A}from"./shared-DJOVlRHh.js";function B(n){const t=[];for(const e of n.matchAll(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm))t.push(e[1].trim());return t}const h=I,L=n=>(n??[]).filter(t=>t.text&&(t.type==="input_text"||t.type==="output_text"||t.type==="text")).map(t=>t.text).join(`
2
- `),S=/^\s*<\/?[a-zA-Z_][\w-]*[^>]*>/,q=n=>S.test(n)||n.trimStart().startsWith("# AGENTS.md instructions for "),O=n=>(n??[]).filter(t=>t.text&&(t.type==="input_text"||t.type==="text")&&!q(t.text)).map(t=>t.text).join(`
3
- `),N=n=>typeof n=="string"?n:Array.isArray(n)?n.map(t=>t?.text??"").filter(Boolean).join(`
4
- `):n==null?"":JSON.stringify(n);class ${turns=[];pendingCalls=new Map;current=null;pendingCompaction;sessionId=null;cwd="";day="";sawItems=!1;firstQuestion=null;parentThreadId=null;feedLine(t){const e=t.trim();if(!e)return;let s;try{s=JSON.parse(e)}catch{return}this.feed(s)}flush(){const t=this.current;t&&(t.question||t.response||t.tools.length)&&this.turns.push(t),this.current=null}ensure(){return this.current||(this.current={question:"",response:"",itemIds:[],tools:[]},this.pendingCompaction&&(this.current.compactionBefore=this.pendingCompaction,this.pendingCompaction=void 0)),this.current}feed(t){const e=t.payload??{};if(t.type==="session_meta"&&e.id&&!this.sessionId){this.sessionId=e.id,this.cwd=e.cwd??"",this.day=e.timestamp?.slice(0,10)??"",this.parentThreadId=e.parent_thread_id??null;return}if((t.type==="response_item"||t.type==="event_msg")&&(this.sawItems=!0),t.type==="compacted"){this.flush(),this.pendingCompaction="[Compaction] The source runner compacted its history here. Everything above this point reached later turns only as a summary.";return}if(t.type==="turn_context"||t.type==="event_msg"&&e.type==="task_started"){this.flush();const s=this.ensure();e.turn_id&&s.itemIds.push(e.turn_id);return}if(t.type==="response_item"){if(e.type==="message"){if(e.role==="user"){const s=O(e.content);if(s.trim()){this.firstQuestion||(this.firstQuestion=s.trim());const o=this.ensure();!o.at&&t.timestamp&&(o.at=t.timestamp),o.question=o.question?`${o.question}
5
-
6
- ${s}`:s}}else if(e.role==="assistant"){const s=L(e.content);if(s.trim()){const o=this.ensure();o.response=o.response?`${o.response}
7
-
8
- ${s}`:s}}}else if((e.type==="function_call"||e.type==="custom_tool_call")&&e.call_id&&e.name){const s=String(e.arguments??e.input??""),o=_(e.name),i=h(s,o==="edit"||o==="write"?w:v),r=o==="read"?(()=>{try{const a=JSON.parse(s);return typeof a.path=="string"&&a.path?[a.path]:[]}catch{return[]}})():[];this.pendingCalls.set(e.call_id,{name:e.name,call:i.text,paths:o==="edit"?B(s):r,op:o})}else if((e.type==="function_call_output"||e.type==="custom_tool_call_output")&&e.call_id){const s=this.pendingCalls.get(e.call_id);if(s){const o=this.ensure(),i=h(N(e.output),A);o.tools.push({name:s.name,call:s.call,result:i.text,truncated:i.truncated,...s.paths.length?{paths:s.paths}:{},op:s.op,nativeCallId:e.call_id}),this.pendingCalls.delete(e.call_id)}}}}finish(){if(this.flush(),!this.sessionId||!this.sawItems)return null;const t=[];let e;for(const i of this.turns){const r=t[t.length-1];!i.question.trim()&&r?(i.compactionBefore&&(e=e??i.compactionBefore),i.response&&(r.response=r.response?`${r.response}
9
-
10
- ${i.response}`:i.response),r.tools.push(...i.tools),r.itemIds.push(...i.itemIds)):(e&&!i.compactionBefore&&(i.compactionBefore=e),e=void 0,t.push(i))}this.turns=t;const s=this.cwd.split("/").filter(Boolean).pop(),o=this.firstQuestion?.split(`
11
- `)[0].slice(0,60)||["codex",s,this.day].filter(Boolean).join(" · ");return{sessionId:this.sessionId,title:o,turns:g(this.turns),subagent:!!this.parentThreadId,...this.cwd?{cwd:this.cwd}:{}}}toConversation(){const t=this.finish();return!t||t.turns.length===0?null:{title:t.title,messageCount:t.turns.length,source:"codex",sessionId:t.sessionId,build:()=>j(t.turns,t.sessionId,t.cwd)}}}function f(n){const t=new $;for(const e of n.split(`
12
- `))t.feedLine(e);return t}function j(n,t,e){const s=e?{cwd:e}:{},o=[],i=[];let r=null;for(const a of n){let l=null;if(a.compactionBefore){const u=p(a.compactionBefore,"",!1);u.data.stepKind="note",u.data.importSource={runner:"codex",sessionId:t,itemIds:[],...s},x(u),o.push(u),l=u}const c=p(a.question||"(tool-only turn)",a.response,r===null);c.data.importSource={runner:"codex",sessionId:t,itemIds:a.itemIds,...s},c.data.source={question:c.data.question,response:c.data.response},c.data.attachments=T(a),C(c),o.push(c),r&&i.push({id:d(),source:r.id,target:c.id,type:"smoothstep"}),l&&i.push({id:d(),source:l.id,target:c.id,type:"smoothstep"}),r=c}return{nodes:m(o,i),edges:i}}function F(n,t){const e=f(n).finish();return e?y(e.turns,e.sessionId,"codex",t,e.cwd):null}function J(n){return f(n).toConversation()}export{$ as CodexSessionCollector,j as buildGraphFromTurns,F as codexSessionAsBranch,J as codexSessionConversation};