glenn-code 1.0.35 → 1.0.37
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/adapters/signalr/index.js +50 -50
- package/dist/cli.js +50 -50
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1374,7 +1374,7 @@ ${a("dim","\u2192 Answers sent, agent continuing...")}
|
|
|
1374
1374
|
`)}function De(){console.log(a("dim",`
|
|
1375
1375
|
`+"\u2500".repeat(50)+`
|
|
1376
1376
|
`))}function xt(e,t){let n="";if(typeof t=="string")n=le(t,100);else if(Array.isArray(t)){let s=t.find(o=>typeof o=="object"&&o!==null&&o.type==="text");if(s&&typeof s=="object"){let o=s.text;if(typeof o=="string"){let r=o.split(`
|
|
1377
|
-
`).filter(i=>i.trim());r.length>3?n=r.slice(0,3).join(" \u21B5 ")+` (+${r.length-3} more lines)`:n=r.join(" \u21B5 "),n=le(n,100)}}}console.log(n?` ${a("dim","\u2190")} ${a("gray",n)}`:` ${a("dim","\u2190")} ${a("green","done")}`)}function It(e){return{onAssistantText:St,onAssistantToolUse:(t,n)=>{if(vt(t,n),["Write","Edit","MultiEdit"].includes(t)){let s=n,o=s.file_path||s.target_file;o&&e.onFileModified(o)}},onAssistantToolResult:xt,onResult:(t,n)=>{e.onCostUpdate(n),Tt(t,n)},onError:Ct,onAborted:Et,onSystemInit:t=>{e.sessionId||(e.onSessionInit(t),console.log(` Session: ${t.slice(0,12)}...`))}}}import x from"inquirer";import*as M from"fs";import*as Ue from"path";var{Separator:wn}=x,kn=".sdd/api-config.json";function Qe(){return Ue.join(process.cwd(),kn)}function _n(){let e=Ue.dirname(Qe());M.existsSync(e)||M.mkdirSync(e,{recursive:!0})}function Sn(){try{let e=Qe();if(!M.existsSync(e))return null;let t=M.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function vn(e){_n();let t={...e,lastUsedAt:new Date().toISOString()};M.writeFileSync(Qe(),JSON.stringify(t,null,2))}async function Rt(){let{options:e}=await x.prompt([{type:"checkbox",name:"options",message:"Session options:",choices:[{name:"\u{1F50D} Auto-typecheck (self-correcting mode)",value:"typecheck"},{name:"\u{1F4E6} Auto-commit & push",value:"autoCommit"}]}]),{model:t}=await x.prompt([{type:"list",name:"model",message:"Select Claude model:",choices:[{name:"\u{1F916} Auto (let Claude choose)",value:"auto"},{name:"\u{1F9E0} Opus 4.6 (most capable)",value:"claude-opus-4-6"},{name:"\u26A1 Sonnet 4.5 (fast & capable)",value:"claude-sonnet-4-
|
|
1377
|
+
`).filter(i=>i.trim());r.length>3?n=r.slice(0,3).join(" \u21B5 ")+` (+${r.length-3} more lines)`:n=r.join(" \u21B5 "),n=le(n,100)}}}console.log(n?` ${a("dim","\u2190")} ${a("gray",n)}`:` ${a("dim","\u2190")} ${a("green","done")}`)}function It(e){return{onAssistantText:St,onAssistantToolUse:(t,n)=>{if(vt(t,n),["Write","Edit","MultiEdit"].includes(t)){let s=n,o=s.file_path||s.target_file;o&&e.onFileModified(o)}},onAssistantToolResult:xt,onResult:(t,n)=>{e.onCostUpdate(n),Tt(t,n)},onError:Ct,onAborted:Et,onSystemInit:t=>{e.sessionId||(e.onSessionInit(t),console.log(` Session: ${t.slice(0,12)}...`))}}}import x from"inquirer";import*as M from"fs";import*as Ue from"path";var{Separator:wn}=x,kn=".sdd/api-config.json";function Qe(){return Ue.join(process.cwd(),kn)}function _n(){let e=Ue.dirname(Qe());M.existsSync(e)||M.mkdirSync(e,{recursive:!0})}function Sn(){try{let e=Qe();if(!M.existsSync(e))return null;let t=M.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function vn(e){_n();let t={...e,lastUsedAt:new Date().toISOString()};M.writeFileSync(Qe(),JSON.stringify(t,null,2))}async function Rt(){let{options:e}=await x.prompt([{type:"checkbox",name:"options",message:"Session options:",choices:[{name:"\u{1F50D} Auto-typecheck (self-correcting mode)",value:"typecheck"},{name:"\u{1F4E6} Auto-commit & push",value:"autoCommit"}]}]),{model:t}=await x.prompt([{type:"list",name:"model",message:"Select Claude model:",choices:[{name:"\u{1F916} Auto (let Claude choose)",value:"auto"},{name:"\u{1F9E0} Opus 4.6 (most capable)",value:"claude-opus-4-6"},{name:"\u26A1 Sonnet 4.5 (fast & capable)",value:"claude-sonnet-4-6-20250929"},{name:"\u{1F4A8} Haiku 4.5 (fastest)",value:"claude-haiku-4-5-20251001"}],default:"auto"}]);return{typecheck:e.includes("typecheck"),autoCommit:e.includes("autoCommit"),model:t}}async function Ot(){let e=Ye();if(e.length===0){let{prompt:r}=await x.prompt([{type:"input",name:"prompt",message:"What would you like to build?"}]);return{sessionId:null,firstPrompt:r,isResume:!1,existingTurnCount:0}}let t=[{name:"\u{1F195} Start new session",value:"new"},new wn("\u2500\u2500\u2500 Previous Sessions \u2500\u2500\u2500"),...e.map(r=>({name:wt(r),value:r.sessionId}))],{selection:n}=await x.prompt([{type:"select",name:"selection",message:"Select a session:",choices:t}]);if(n==="new"){let{prompt:r}=await x.prompt([{type:"input",name:"prompt",message:"What would you like to build?"}]);return{sessionId:null,firstPrompt:r,isResume:!1,existingTurnCount:0}}let s=e.find(r=>r.sessionId===n);console.log(`
|
|
1378
1378
|
\u{1F4C2} Resuming session: ${s.firstPrompt.slice(0,50)}...`);let{prompt:o}=await x.prompt([{type:"input",name:"prompt",message:"Continue with:"}]);return{sessionId:s.sessionId,firstPrompt:s.firstPrompt,isResume:!0,existingTurnCount:s.turnCount||0}}async function Fe(){let{action:e}=await x.prompt([{type:"select",name:"action",message:"What would you like to do?",choices:[{name:"\u{1F4DD} Send follow-up message",value:"followup"},{name:"\u{1F6AA} Exit",value:"exit"}]}]);if(e==="exit")return null;let{prompt:t}=await x.prompt([{type:"input",name:"prompt",message:"Your message:"}]);return t}async function Dt(){let{action:e}=await x.prompt([{type:"select",name:"action",message:"What would you like to do?",choices:[{name:"Continue with a new prompt",value:"continue"},{name:"Exit (session saved)",value:"exit"}]}]);return e}async function Ut(){let e=process.env.API_URL||process.env.MASTER_URL,t=process.env.PROJECT_ID,n=Sn();if(n&&!e&&!t){console.log(`
|
|
1379
1379
|
\u{1F4CB} Previous API Configuration Found
|
|
1380
1380
|
`),console.log(` \u{1F517} API URL: ${n.apiUrl}`),console.log(` \u{1F194} Project ID: ${n.projectId}`);let{action:r}=await x.prompt([{type:"select",name:"action",message:"What would you like to do?",choices:[{name:"\u2705 Proceed with saved configuration",value:"proceed"},{name:"\u{1F504} Override with new configuration",value:"override"}]}]);if(r==="proceed")return{apiUrl:n.apiUrl,projectId:n.projectId}}let s=await x.prompt([{type:"input",name:"apiUrl",message:"API URL (backend endpoint):",default:e||n?.apiUrl||"http://localhost:5338",validate:r=>{if(!r.trim())return"API URL is required";try{return new URL(r),!0}catch{return"Please enter a valid URL"}}},{type:"input",name:"projectId",message:"Project ID:",default:t||n?.projectId,validate:r=>r.trim()?!0:"Project ID is required"}]),o={apiUrl:s.apiUrl,projectId:s.projectId};return vn(o),o}async function Ft(e,t){if(t.size===0)return console.log(`
|
|
@@ -1402,7 +1402,7 @@ File paths like "src/..." are relative to the package directory shown in parenth
|
|
|
1402
1402
|
`),de.abort()):(console.log(`
|
|
1403
1403
|
`),process.exit(0))});async function Le(e,t={}){let{serviceManager:n,gitManager:s}=t,o=null,r,i,l=0,h=0,m=t.typecheck??!1,g=t.autoCommit??!1,v=t.model;if(e)r=e,i=e;else{let C=await Rt();n&&(m=C.typecheck),s&&(g=C.autoCommit),t.skipModelPrompt||(v=C.model);let S=await Ot();o=S.sessionId,r=S.firstPrompt,l=S.existingTurnCount,i=S.isResume&&await Fe()||r}for(Tn(m,g,!!n,!!s,v);;){l++,console.log(`
|
|
1404
1404
|
Turn ${l}`),De();let C=new Set;de=new AbortController;let S=await Ae(i,{model:v==="auto"?void 0:v,sessionId:o,projectId:process.env.PROJECT_ID||null,debugLog:!0,abortController:de,callbacks:It({sessionId:o,onSessionInit:y=>{o=y},onCostUpdate:y=>{h+=y},onFileModified:y=>{C.add(y)}})});if(console.log("after runAgent"),de=null,S.sessionId&&(o=S.sessionId),S.cost&&(h=S.cost),console.log("after result"),En(o,r,l),console.log("after saveSessionIfNeeded"),S.aborted){if(await new Promise(L=>setTimeout(L,100)),De(),h>0&&console.log(` \u{1F4B0} Session cost so far: $${h.toFixed(4)}
|
|
1405
|
-
`),await Dt()==="exit")break;let R=await Fe();if(!R)break;i=R;continue}if(console.log("after abort"),o){let y=oe(o);if(y&&y.length>0){At();let R=await Re(y);i=Pe(R),Pt();continue}}if(console.log("after pending questions"),m&&n){let y=await Ft(n,C);if(!y.passed&&y.errorPrompt){i=y.errorPrompt;continue}}if(console.log("after typecheck"),g&&s){let y=S.aborted||!!S.error;await Lt(s,r,y)}console.log("after auto-commit"),De();let I=await Fe();if(!I)break;i=I}Cn(o,h)}function Tn(e,t,n,s,o){Ke("\u{1F680} Agent Started"),console.log(" \u{1F4DD} Debug logs \u2192 /tmp/agent-debug/"),o&&console.log(` \u{1F916} Model: ${o==="auto"?"Auto":o==="claude-opus-4-6"?"Opus 4.6":o==="claude-sonnet-4-
|
|
1405
|
+
`),await Dt()==="exit")break;let R=await Fe();if(!R)break;i=R;continue}if(console.log("after abort"),o){let y=oe(o);if(y&&y.length>0){At();let R=await Re(y);i=Pe(R),Pt();continue}}if(console.log("after pending questions"),m&&n){let y=await Ft(n,C);if(!y.passed&&y.errorPrompt){i=y.errorPrompt;continue}}if(console.log("after typecheck"),g&&s){let y=S.aborted||!!S.error;await Lt(s,r,y)}console.log("after auto-commit"),De();let I=await Fe();if(!I)break;i=I}Cn(o,h)}function Tn(e,t,n,s,o){Ke("\u{1F680} Agent Started"),console.log(" \u{1F4DD} Debug logs \u2192 /tmp/agent-debug/"),o&&console.log(` \u{1F916} Model: ${o==="auto"?"Auto":o==="claude-opus-4-6"?"Opus 4.6":o==="claude-sonnet-4-6"?"Sonnet 4.5":o==="claude-haiku-4-5-20251001"?"Haiku 4.5":"Unknown"}`),e&&n&&console.log(" \u{1F50D} Auto-typecheck enabled (self-correcting mode)"),t&&s&&console.log(" \u{1F4E6} Auto-commit enabled"),console.log(` \u{1F4A1} Press Ctrl+C to stop the agent
|
|
1406
1406
|
`)}function Cn(e,t){Ke("\u2705 Session Complete"),e&&console.log(" \u{1F4BE} Session saved - you can resume it next time"),t>0&&console.log(` \u{1F4B0} Total cost: $${t.toFixed(4)}`),console.log()}function En(e,t,n){e&&bt({sessionId:e,firstPrompt:t,createdAt:new Date().toISOString(),lastUsedAt:new Date().toISOString(),turnCount:n})}process.env.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT=process.env.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT||"60000";async function An(){let e=process.env.API_URL||process.env.MASTER_URL,t=process.env.PROJECT_ID,n=e,s=t;if(!e||!t){console.log(`
|
|
1407
1407
|
\u{1F4CB} API Configuration Required
|
|
1408
1408
|
`);let m=await Ut();n=m.apiUrl,s=m.projectId}process.env.API_URL=n,process.env.PROJECT_ID=s;let o=process.env.WORKSPACE_DIR||process.cwd(),r=xe({workspaceDir:o}),i=Ie(o),l=se(o);he(r),me(l),await Le(void 0,{serviceManager:r,gitManager:i})}An().catch(e=>{console.error("Fatal error:",e),process.exit(1)});
|