glenn-code 1.0.23 → 1.0.24
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/index.js +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1371,7 +1371,7 @@ ${a("dim","\u2192 Answers sent, agent continuing...")}
|
|
|
1371
1371
|
`)}function xe(){console.log(a("dim",`
|
|
1372
1372
|
`+"\u2500".repeat(50)+`
|
|
1373
1373
|
`))}function xt(e,t){let n="";if(typeof t=="string")n=ae(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(`
|
|
1374
|
-
`).filter(i=>i.trim());r.length>3?n=r.slice(0,3).join(" \u21B5 ")+` (+${r.length-3} more lines)`:n=r.join(" \u21B5 "),n=ae(n,100)}}}console.log(n?` ${a("dim","\u2190")} ${a("gray",n)}`:` ${a("dim","\u2190")} ${a("green","done")}`)}function Rt(e){return{onAssistantText:_t,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),Ct(t,n)},onError:Tt,onAborted:Et,onSystemInit:t=>{e.sessionId||(e.onSessionInit(t),console.log(` Session: ${t.slice(0,12)}...`))}}}import R from"inquirer";import*as j from"fs";import*as Re from"path";var{Separator:wn}=R,kn=".sdd/api-config.json";function He(){return Re.join(process.cwd(),kn)}function Sn(){let e=Re.dirname(He());j.existsSync(e)||j.mkdirSync(e,{recursive:!0})}function _n(){try{let e=He();if(!j.existsSync(e))return null;let t=j.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function vn(e){Sn();let t={...e,lastUsedAt:new Date().toISOString()};j.writeFileSync(He(),JSON.stringify(t,null,2))}async function It(){let{options:e}=await R.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 R.prompt([{type:"list",name:"model",message:"Select Claude model:",choices:[{name:"\u{1F916} Auto (let Claude choose)",value:"auto"},{name:"\u{1F9E0} Opus 4.5 (most capable)",value:"claude-opus-4-
|
|
1374
|
+
`).filter(i=>i.trim());r.length>3?n=r.slice(0,3).join(" \u21B5 ")+` (+${r.length-3} more lines)`:n=r.join(" \u21B5 "),n=ae(n,100)}}}console.log(n?` ${a("dim","\u2190")} ${a("gray",n)}`:` ${a("dim","\u2190")} ${a("green","done")}`)}function Rt(e){return{onAssistantText:_t,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),Ct(t,n)},onError:Tt,onAborted:Et,onSystemInit:t=>{e.sessionId||(e.onSessionInit(t),console.log(` Session: ${t.slice(0,12)}...`))}}}import R from"inquirer";import*as j from"fs";import*as Re from"path";var{Separator:wn}=R,kn=".sdd/api-config.json";function He(){return Re.join(process.cwd(),kn)}function Sn(){let e=Re.dirname(He());j.existsSync(e)||j.mkdirSync(e,{recursive:!0})}function _n(){try{let e=He();if(!j.existsSync(e))return null;let t=j.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function vn(e){Sn();let t={...e,lastUsedAt:new Date().toISOString()};j.writeFileSync(He(),JSON.stringify(t,null,2))}async function It(){let{options:e}=await R.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 R.prompt([{type:"list",name:"model",message:"Select Claude model:",choices:[{name:"\u{1F916} Auto (let Claude choose)",value:"auto"},{name:"\u{1F9E0} Opus 4.5 (most capable)",value:"claude-opus-4-6"},{name:"\u26A1 Sonnet 4.5 (fast & capable)",value:"claude-sonnet-4-5-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=We();if(e.length===0){let{prompt:r}=await R.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 R.prompt([{type:"select",name:"selection",message:"Select a session:",choices:t}]);if(n==="new"){let{prompt:r}=await R.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(`
|
|
1375
1375
|
\u{1F4C2} Resuming session: ${s.firstPrompt.slice(0,50)}...`);let{prompt:o}=await R.prompt([{type:"input",name:"prompt",message:"Continue with:"}]);return{sessionId:s.sessionId,firstPrompt:s.firstPrompt,isResume:!0,existingTurnCount:s.turnCount||0}}async function Ie(){let{action:e}=await R.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 R.prompt([{type:"input",name:"prompt",message:"Your message:"}]);return t}async function Dt(){let{action:e}=await R.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 Ft(){let e=process.env.API_URL||process.env.MASTER_URL,t=process.env.PROJECT_ID,n=_n();if(n&&!e&&!t){console.log(`
|
|
1376
1376
|
\u{1F4CB} Previous API Configuration Found
|
|
1377
1377
|
`),console.log(` \u{1F517} API URL: ${n.apiUrl}`),console.log(` \u{1F194} Project ID: ${n.projectId}`);let{action:r}=await R.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 R.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 Ut(e,t){if(t.size===0)return console.log(`
|
|
@@ -1399,7 +1399,7 @@ File paths like "src/..." are relative to the package directory shown in parenth
|
|
|
1399
1399
|
`),ce.abort()):(console.log(`
|
|
1400
1400
|
`),process.exit(0))});async function Oe(e,t={}){let{serviceManager:n,gitManager:s}=t,o=null,r,i,l=0,h=0,m=t.typecheck??!1,f=t.autoCommit??!1,v=t.model;if(e)r=e,i=e;else{let T=await It();n&&(m=T.typecheck),s&&(f=T.autoCommit),t.skipModelPrompt||(v=T.model);let _=await Ot();o=_.sessionId,r=_.firstPrompt,l=_.existingTurnCount,i=_.isResume&&await Ie()||r}for(Cn(m,f,!!n,!!s,v);;){l++,console.log(`
|
|
1401
1401
|
Turn ${l}`),xe();let T=new Set;ce=new AbortController;let _=await ve(i,{model:v==="auto"?void 0:v,sessionId:o,projectId:process.env.PROJECT_ID||null,debugLog:!0,abortController:ce,callbacks:Rt({sessionId:o,onSessionInit:y=>{o=y},onCostUpdate:y=>{h+=y},onFileModified:y=>{T.add(y)}})});if(console.log("after runAgent"),ce=null,_.sessionId&&(o=_.sessionId),_.cost&&(h=_.cost),console.log("after result"),En(o,r,l),console.log("after saveSessionIfNeeded"),_.aborted){if(await new Promise(U=>setTimeout(U,100)),xe(),h>0&&console.log(` \u{1F4B0} Session cost so far: $${h.toFixed(4)}
|
|
1402
|
-
`),await Dt()==="exit")break;let I=await Ie();if(!I)break;i=I;continue}if(console.log("after abort"),o){let y=te(o);if(y&&y.length>0){At();let I=await Ae(y);i=Ce(I),Pt();continue}}if(console.log("after pending questions"),m&&n){let y=await Ut(n,T);if(!y.passed&&y.errorPrompt){i=y.errorPrompt;continue}}if(console.log("after typecheck"),f&&s){let y=_.aborted||!!_.error;await Nt(s,r,y)}console.log("after auto-commit"),xe();let O=await Ie();if(!O)break;i=O}Tn(o,h)}function Cn(e,t,n,s,o){Ge("\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-
|
|
1402
|
+
`),await Dt()==="exit")break;let I=await Ie();if(!I)break;i=I;continue}if(console.log("after abort"),o){let y=te(o);if(y&&y.length>0){At();let I=await Ae(y);i=Ce(I),Pt();continue}}if(console.log("after pending questions"),m&&n){let y=await Ut(n,T);if(!y.passed&&y.errorPrompt){i=y.errorPrompt;continue}}if(console.log("after typecheck"),f&&s){let y=_.aborted||!!_.error;await Nt(s,r,y)}console.log("after auto-commit"),xe();let O=await Ie();if(!O)break;i=O}Tn(o,h)}function Cn(e,t,n,s,o){Ge("\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.5":o==="claude-sonnet-4-5-20250929"?"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
|
|
1403
1403
|
`)}function Tn(e,t){Ge("\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(`
|
|
1404
1404
|
\u{1F4CB} API Configuration Required
|
|
1405
1405
|
`);let m=await Ft();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=Te({workspaceDir:o}),i=Ee(o),l=ne(o);fe(r),ue(l),await Oe(void 0,{serviceManager:r,gitManager:i})}An().catch(e=>{console.error("Fatal error:",e),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glenn-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Glenn Code - Connect your local development environment to DNM Lab",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript": "^5.6.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
50
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.32",
|
|
51
51
|
"@microsoft/signalr": "^8.0.7",
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
53
53
|
"inquirer": "^13.1.0",
|