@lmctl-ai/lmctl 0.1.328 → 0.1.330
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/data/price-data.json +1 -1
- package/dist/cli/index.js +2 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1512,12 +1512,12 @@ var S0=Object.defineProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var oe=(t,e)=>{f
|
|
|
1512
1512
|
|
|
1513
1513
|
--- additional response (turn ${n+1} of ${t.length}; likely an injected mid-call notification) ---
|
|
1514
1514
|
|
|
1515
|
-
`+t[n]);return e.join("")}function Bc(t={}){let e=[],n="",r=!1;return{processLine(s){if(!s.trim())return;let i;try{i=JSON.parse(s)}catch{return}t.onEvent?.(i);let o=i.type;if(o==="system"&&i.subtype==="init"&&(n=i.session_id||n),o==="assistant"){let l=i.message?.content;if(Array.isArray(l))for(let c of l)c.type==="text"&&c.text&&t.onText?.(c.text)}o==="result"&&(r=!0,e.push(i))},sawResult(){return r},finalize(){if(!r)return null;let s=Vh(e)
|
|
1515
|
+
`+t[n]);return e.join("")}function Bc(t={}){let e=[],n="",r=!1;return{processLine(s){if(!s.trim())return;let i;try{i=JSON.parse(s)}catch{return}t.onEvent?.(i);let o=i.type;if(o==="system"&&i.subtype==="init"&&(n=i.session_id||n),o==="assistant"){let l=i.message?.content;if(Array.isArray(l))for(let c of l)c.type==="text"&&c.text&&t.onText?.(c.text)}o==="result"&&(r=!0,e.push(i))},sawResult(){return r},finalize(){if(!r)return null;let s=Vh(e),i=Kh(s.resultTexts);return{result:i,sessionId:s.sessionId||n,durationMs:s.durationMs,numTurns:s.numTurns,isError:s.isError&&i.trim().length===0,errorMessage:s.errorMessage}}}}function Vh(t){let e=[],n=0,r=0,s="",i=!1,o;for(let a of t){e.push(a.result||"");let l=a.duration_ms;typeof l=="number"&&Number.isFinite(l)&&(n+=l);let c=a.num_turns;typeof c=="number"&&Number.isFinite(c)&&(r=c);let u=a.session_id;if(typeof u=="string"&&u&&(s=u),a.is_error===!0){i=!0;let d=a.errors,f=Array.isArray(d)?d.filter(p=>typeof p=="string").join("; "):void 0,m=typeof a.subtype=="string"?a.subtype:"unknown";o=f&&f.length>0?f:`result subtype=${m} (no error detail provided)`}}return{resultTexts:e,durationMs:n,numTurns:r,sessionId:s,isError:i,errorMessage:o}}var Xc=E(()=>{"use strict"});import{spawn as wL}from"node:child_process";import{existsSync as EL}from"node:fs";function vL(t){let e=t.stderr.trim().slice(0,500),n=`lmctl: ${t.tool} exited with code ${t.exitCode} before returning a final result event.
|
|
1516
1516
|
One possible cause: the provider stream ended before a complete response was delivered; for Claude Code this can appear as "API Error: Stream idle timeout - partial response received".`;return e?`Original provider error:
|
|
1517
1517
|
${e}
|
|
1518
1518
|
|
|
1519
1519
|
${n}`:n}function Yh(t,e){return new Promise((n,r)=>{let s=e.tool||"claude",i=e.binaryPath||TL[s]||"claude",o=["-p","","--output-format","stream-json","--input-format","stream-json"];s==="claude"&&o.push("--verbose"),e.sessionId&&o.push("--resume",e.sessionId),e.model&&o.push("--model",e.model);let a=e.permissionMode??"yolo",l=kn(s,a)??SL[s]??["--dangerously-skip-permissions"];o.push(...l);try{tt(s,o,a)}catch(b){return r(b)}if(e.cwd&&!EL(e.cwd))return C({event:"transport_error",provider:s,error_class:"TransportConnectionError",error_message:`sessiondir missing: ${e.cwd}`,elapsed_ms:0}),r(new we(`sessiondir missing: ${e.cwd}`,{cause:Object.assign(new Error("cwd missing"),{code:"ENOENT_CWD"})}));let c=Ve(e.env,e.cwd,e.sessionId),u=wL(i,o,{cwd:e.cwd,stdio:["pipe","pipe","pipe"],env:s==="claude"?Bh(c):c});u.stdin?.on("error",b=>{Pe(`stream-json: stdin pipe error, ignored (exit handler reports): ${b.message}`)});let d=!1;if(e.signal){if(e.signal.aborted)return d=!0,C({event:"transport_abort",provider:s,phase:"pre_spawn"}),et(u).catch(()=>{}),r(new Error("Aborted"));e.signal.addEventListener("abort",()=>{d=!0,C({event:"transport_abort",provider:s}),et(u).catch(()=>{}),r(new Error("Aborted"))},{once:!0})}let f="",m=!1,p=!1,h=0,_=!1,y=Bc({onEvent:b=>{h=Date.now(),_=b.type!=="result",e.onEvent?.(b)},onText:e.onText});function g(){p||(p=!0,ho(e.holdOpen,{isAborted:()=>d,hasChildExited:()=>m,isTurnInFlight:()=>_,lastEventAtMs:()=>h,closeStdin:()=>{u.stdin?.end()},signal:e.signal,label:e.tool||"claude"}))}function w(b){let R=y.sawResult();y.processLine(b),!R&&y.sawResult()&&g()}u.stdout?.on("data",b=>{f+=b.toString();let R=f.split(`
|
|
1520
|
-
`);f=R.pop()||"";for(let K of R)w(K)});let T="";u.stderr?.on("data",b=>{T+=b.toString()}),u.on("error",b=>{C({event:"transport_error",provider:s,error_class:"TransportConnectionError",error_message:b.message}),r(new we(`Failed to spawn ${i}: ${b.message}`,{cause:b}))}),u.on("exit",b=>{if(m=!0,d)return;f.trim()&&w(f);let R=y.finalize();R?(Pe(`stream-json: result ${R.result.slice(0,80)}${R.result.length>80?"...":""} (${R.durationMs}ms)`),n({
|
|
1520
|
+
`);f=R.pop()||"";for(let K of R)w(K)});let T="";u.stderr?.on("data",b=>{T+=b.toString()}),u.on("error",b=>{C({event:"transport_error",provider:s,error_class:"TransportConnectionError",error_message:b.message}),r(new we(`Failed to spawn ${i}: ${b.message}`,{cause:b}))}),u.on("exit",b=>{if(m=!0,d)return;f.trim()&&w(f);let R=y.finalize();R?.isError?(C({event:"transport_error",provider:s,error_class:"Error",reason:"provider_result_error",error_message:R.errorMessage}),r(new Error(`${s} reported an error for this turn (no assistant output)`+(e.sessionId?` \u2014 session=${e.sessionId}`:"")+`: ${R.errorMessage??"unknown error"}`))):R?(Pe(`stream-json: result ${R.result.slice(0,80)}${R.result.length>80?"...":""} (${R.durationMs}ms)`),n({result:R.result,sessionId:R.sessionId,durationMs:R.durationMs,numTurns:R.numTurns,exitCode:b})):(C({event:"transport_error",provider:s,error_class:"Error",reason:"provider_no_result",exit_code:b,stderr_tail:T.slice(0,500)}),r(new Error(vL({tool:s,exitCode:b,stderr:T}))))});let N=JSON.stringify({type:"user",message:{role:"user",content:t}});u.stdin?.write(N+`
|
|
1521
1521
|
`),Pe(`stream-json: prompt sent (${t.length} chars)`)})}var TL,SL,zh=E(()=>{"use strict";xr();Ms();Zn();ae();Hc();Nt();Xc();Xc();TL={claude:"claude",qwen:"qwen"};SL={claude:["--dangerously-skip-permissions"],qwen:["--approval-mode","yolo"]}});function go(t={}){return[]}var Jc=E(()=>{"use strict"});function Gc(t){return t==="plan"?"read-only":"danger-full-access"}function Zh(t="0.0.0"){return{clientInfo:{name:"lmctl",title:"lmctl",version:t},capabilities:{experimentalApi:!1}}}function Kc(){return{agentItems:new Map,resultText:""}}function yo(t,e,n,r){let s=t.method;if(!s)return!1;let i=t.params;if(s==="turn/started")return e.agentItems.clear(),e.resultText="",!1;if(s==="item/started"){let o=i?.item;if(o?.type==="agentMessage"&&typeof o.id=="string"){let a=typeof o.phase=="string"?o.phase:void 0,l=a==="commentary"||a==="final_answer"?a:void 0;return e.agentItems.set(o.id,{phase:l,buffer:""}),!0}return!1}if(s==="item/agentMessage/delta"){let o=i?.delta||"",a=typeof i?.itemId=="string"?i.itemId:void 0;if(!o)return!0;let l=a?e.agentItems.get(a):void 0;return l?(l.phase==="commentary"||(l.buffer+=o),n?.(o),l.phase&&i&&(i._lmctlItemPhase=l.phase)):(e.resultText+=o,n?.(o)),!0}if(s==="item/completed"){let o=i?.item;if(o?.type==="agentMessage"&&typeof o.id=="string"){let a=e.agentItems.get(o.id);if(a){if(a.phase!=="commentary"){let l=typeof o.text=="string"?o.text:a.buffer;if(r&&typeof o.text=="string"&&o.text!==a.buffer){let c=typeof i?.threadId=="string"?i.threadId:void 0,u=typeof i?.turnId=="string"?i.turnId:void 0;r({itemId:o.id,threadId:c,turnId:u,expectedFromItemText:o.text,gotFromBuffer:a.buffer})}e.resultText+=l}e.agentItems.delete(o.id)}return!0}return!1}return!1}function Vc(t){for(let[,e]of t.agentItems.entries())e.phase!=="commentary"&&e.buffer&&(t.resultText+=e.buffer);t.agentItems.clear()}function Qh(t){let e=t.params,n=e?.error,r=typeof n?.message=="string"?n.message:void 0,s=r&&r.length>0?r:"(no message)";return e?.willRetry===!0?{willRetry:!0}:{willRetry:!1,turnError:new Error(`Turn errored: ${s}`)}}function Yc(){return{pendingCodexError:null}}function zc(t,e){let n=Qh(t);return n.willRetry||(e.pendingCodexError=n.turnError),n}function Zc(t,e){if(e.pendingCodexError){let i=e.pendingCodexError;return e.pendingCodexError=null,{shouldReject:!0,turnError:i}}let r=t.params?.turn;if((typeof r?.status=="string"?r.status:void 0)==="failed"){let i=r?.error,o=typeof i?.message=="string"?i.message:void 0,a=o&&o.length>0?o:"(no message)";return{shouldReject:!0,turnError:new Error(`Turn errored: ${a}`)}}return{shouldReject:!1}}var Qc=E(()=>{"use strict"});import{spawn as bL}from"node:child_process";import{createInterface as kL}from"node:readline";import{existsSync as IL,readFileSync as NL}from"node:fs";import{fileURLToPath as AL}from"node:url";function RL(){return Zh(xL)}function In(t,e){Pe(`[codex:${t}] ${JSON.stringify(e)}`)}function OL(t){let e=t.stderr.trim().slice(0,500),n=`lmctl: codex app-server exited with code ${t.exitCode} before completing the turn.
|
|
1522
1522
|
One possible cause: Codex stopped before delivering a terminal turn/completed event.`;return e?`Original provider error:
|
|
1523
1523
|
${e}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmctl-ai/lmctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.330",
|
|
4
4
|
"description": "A provider-agnostic control plane for teams of AI coding agents — across providers, with independent review and durable memory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://lmctl.com",
|