@lmctl-ai/lmctl 0.1.312 → 0.1.314
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/cli/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var n0=Object.defineProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var oe=(t,e)=>{f
|
|
|
14
14
|
`)),note:null}}catch(r){return r.code==="ENOENT"?{source_path:e,tail_lines:0,tail:"",note:"no intent log present (status never run on this host)"}:{source_path:e,tail_lines:0,tail:"",note:`intent log unreadable: ${r instanceof Error?r.message:String(r)}`}}}var Wi,w0,sc,Es=E(()=>{"use strict";Ui();Wi=["serve","db","runs","jobs","attentions","env","intents"];w0=["LMCTL_DB","LMCTL_API_URL","LMCTL_API_TOKEN","LMCTL_PID_FILE","LMCTL_SERVE_LOG","LMCTL_SESSIONDIR","LMCTL_DAEMON_INTERVAL_MS","LMCTL_SESSION_SIZE_DISABLED","NODE_ENV","PATH"];sc=["id","job_id","workflow_id","team_id","current_state","terminal_state","started_at","ended_at","paused_at","parent_run_id","blocker"].join(", ")});import{readFileSync as l_,appendFileSync as A0,mkdirSync as x0,existsSync as I8,readdirSync as N8,unlinkSync as A8}from"node:fs";import{join as Bi,dirname as R0}from"node:path";import{homedir as O0}from"node:os";function oc(){return Bi(O0(),".lmctl")}function c_(){Er=!0,process.env.LMCTL_DEBUG="1"}function d_(){return{cliDebug:Er,lmctlDebugEnv:process.env.LMCTL_DEBUG}}function u_(t){Er=t.cliDebug,t.lmctlDebugEnv===void 0?delete process.env.LMCTL_DEBUG:process.env.LMCTL_DEBUG=t.lmctlDebugEnv}function ce(){if(Er||process.env.LMCTL_DEBUG==="1")return!0;let t=Date.now();return t-a_>=L0&&(o_=M0(),a_=t),o_}function f_(){return Er||process.env.LMCTL_DEBUG==="1"}function C0(){let t=new Date,e=t.getTimezoneOffset(),n=e<=0?"+":"-",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return new Date(t.getTime()-e*6e4).toISOString().replace("Z",`${n}${r}:${s}`)}function De(t,e){if(e?.verbose){if(!Er)return}else if(!e?.always&&!ce())return;try{$0();let n={ts:new Date().toISOString(),pid:process.pid,vti:process.env.LMCTL_VTI??null,autocode_run_id:process.env.LMCTL_AUTOCODE_RUN_ID??void 0,...t};A0(qi,JSON.stringify(n)+`
|
|
15
15
|
`)}catch{}}function $0(){if(!qi){let e=C0().slice(0,13).replace("T","-");qi=Bi(oc(),`debug-${e}.log`)}x0(R0(qi),{recursive:!0})}function $e(...t){De({event:"legacy",msg:t.join(" ")})}function Ge(...t){De({event:"legacy",msg:t.join(" ")},{verbose:!0})}function $(t){De(t,{always:!0})}function M0(){return D0()||j0()}function D0(){try{let t=l_(Bi(oc(),"config.toml"),"utf-8");for(let e of t.split(`
|
|
16
16
|
`)){let n=e.trim();if(!n||n.startsWith("#"))continue;if(n.startsWith("["))break;let r=/^debug\s*=\s*(.+)$/.exec(n);if(r){let s=r[1].trim().toLowerCase().replace(/^["']|["']$/g,"");return s==="true"||s==="1"}}}catch{}return!1}function j0(){try{let t=l_(Bi(oc(),"config.json"),"utf-8"),e=JSON.parse(t);return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.debug===!0}catch{}return!1}var Er,o_,a_,L0,qi,de=E(()=>{"use strict";Er=!1,o_=!1,a_=0,L0=5e3;qi=null});var y_={};oe(y_,{INFRA_CLI_CONTRACT_EXPECTED:()=>nR,INFRA_FLAT_COMMANDS:()=>g_,INFRA_NAMESPACE_COMMAND:()=>lc,infraCliEnabled:()=>Hi,isInfraCommand:()=>Xi,runInfraCommand:()=>sR});function Hi(t=process.env){return t.LMCTL_INFRA_CLI==="1"||t.LMCTL_INFRA_CLI==="true"}function Xi(t){return g_.includes(t)||t===lc}async function sR(t,e,n,r=iR){let s;try{s=await r()}catch{return n.stderr.write(rR),1}if(s.INFRA_CLI_CONTRACT!==1)return n.stderr.write(`lmctl: infra command library contract version ${s.INFRA_CLI_CONTRACT} does not match the version this lmctl build expects (1).
|
|
17
|
-
`),1;let i=t===lc?e:[t,...e],o=s.createRuntime();return s.dispatch(i,o)}async function iR(){
|
|
17
|
+
`),1;let i=t===lc?e:[t,...e],o=s.createRuntime();return s.dispatch(i,o)}async function iR(){throw new Error("infra CLI adapter target (lmt) is retired; no successor module currently implements this contract")}var nR,g_,lc,rR,cc=E(()=>{"use strict";nR=1,g_=["lmchat","lmmail","lmnote","lmsheet","lmtext","lmsound","login","whoami","exec","tell","peers","site"],lc="auto";rR=`lmctl: infra commands (site/auto/exec/tell/peers/login/whoami/lmchat/lmmail/lmnote/lmsheet/lmtext/lmsound) are not available in this build.
|
|
18
18
|
`});import{existsSync as oR}from"node:fs";import{createRequire as aR}from"node:module";function lR(){return dc===null&&(dc=aR(import.meta.url)("node:sqlite").DatabaseSync),dc}function uc(t){return t.length===1&&cR(t[0])?[t[0]]:t}function cR(t){if(!pc(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function pc(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}var dc,fc,Gn,mc,Ji=E(()=>{"use strict";dc=null;fc=class{name;handle;transactionDepth=0;savepointId=0;constructor(e,n={}){if(n.fileMustExist===!0&&e!==":memory:"&&!oR(e))throw new Error("unable to open database file");this.name=e,this.handle=new(lR())(e,{readOnly:n.readonly===!0}),this.exec("PRAGMA busy_timeout = 5000")}prepare(e){return new mc(this.handle.prepare(e))}exec(e){this.handle.exec(e),this.updateTransactionDepth(e)}pragma(e,n){let r=`PRAGMA ${e}`;if(e.includes("=")){this.exec(r);return}let s=this.prepare(r).get();return n?.simple===!0?s===void 0?void 0:Object.values(s)[0]:s}transaction(e){return(...n)=>{if(this.transactionDepth===0){this.exec("BEGIN");try{let s=e(...n);return this.exec("COMMIT"),s}catch(s){throw this.inTransaction&&this.exec("ROLLBACK"),s}}let r=`lmctl_sp_${this.savepointId+=1}`;this.exec(`SAVEPOINT ${r}`);try{let s=e(...n);return this.exec(`RELEASE ${r}`),s}catch(s){throw this.inTransaction&&(this.exec(`ROLLBACK TO ${r}`),this.exec(`RELEASE ${r}`)),s}}}get inTransaction(){return this.transactionDepth>0}close(){this.handle.close()}updateTransactionDepth(e){let n=e.trim().match(/^([A-Za-z]+)/)?.[1]?.toUpperCase();if(n!==void 0){if(n==="BEGIN"||n==="SAVEPOINT"){this.transactionDepth+=1;return}if(n==="COMMIT"){this.transactionDepth=Math.max(0,this.transactionDepth-1);return}if(n==="RELEASE"){this.transactionDepth=Math.max(0,this.transactionDepth-1);return}n==="ROLLBACK"&&!/^ROLLBACK\s+TO\b/i.test(e.trim())&&(this.transactionDepth=0)}}},Gn=fc,mc=class{handle;rawMode=!1;constructor(e){this.handle=e,this.handle.setAllowBareNamedParameters(!0)}get(...e){let n=this.handle.get(...uc(e));return this.normalizeRow(n)}all(...e){return this.handle.all(...uc(e)).map(n=>this.normalizeRow(n))}run(...e){let n=this.handle.run(...uc(e));return{changes:Number(n.changes),lastInsertRowid:Number(n.lastInsertRowid)}}raw(){return this.rawMode=!0,this}normalizeRow(e){return e==null?e:this.rawMode&&pc(e)?Object.values(e):pc(e)?{...e}:e}}});import{createHash as dR}from"node:crypto";function uR(t,e,n){return dR("sha256").update(`${t}\0${e}\0${n}`).digest("hex")}function qe(t,e,n){let r=uR(e.stream_id,e.intentKey??e.event_type,e.observedLastSeq),s=t.prepare(`INSERT INTO message_event (event_id, ts, stream_id, event_type, payload)
|
|
19
19
|
VALUES (?, ?, ?, ?, ?)
|
|
20
20
|
ON CONFLICT(event_id) DO NOTHING`),i=t.prepare("SELECT seq FROM message_event WHERE event_id = ?");return t.transaction(()=>{let a=s.run(r,e.ts??new Date().toISOString(),e.stream_id,e.event_type,JSON.stringify(e.payload));if(a.changes===0)return{appended:!1,seq:i.get(r).seq,event_id:r};let l=Number(a.lastInsertRowid);return n(l),{appended:!0,seq:l,event_id:r}})()}var Gi=E(()=>{"use strict"});var E_={};oe(E_,{backfillEventLog:()=>_c,rebuildProjections:()=>w_});import{createHash as fR}from"node:crypto";function Kn(t,e){return t==null?null:{teamfile:t,alias:e??""}}function mR(t,e,n){return`lease_${fR("sha256").update(`${t}\0${e}\0${n}`).digest("hex").slice(0,16)}`}function Ki(t,e,n,r){n.forEach((s,i)=>{qe(t,{stream_id:e,event_type:s.event_type,payload:s.payload,observedLastSeq:i,ts:s.ts},()=>{}).appended?r.appended+=1:r.skipped+=1})}function pR(t){let e=`msg_tcl_${t.id}`,n=Kn(t.sender_teamfile,t.sender_alias),r=Kn(t.receiver_teamfile,t.receiver_alias),s={table:"team_chat_log",id:t.id},i={message_id:e,sender:n,receiver:r,root_teamfile:t.root_teamfile,legacy:s},o=[{event_type:ae.CREATE,ts:t.created_at,payload:{...i,message_type:"request",content:t.message,origin:t.origin,correlation_status:"legacy-unavailable"}}];return t.status!=="running"&&o.push({event_type:ae.HANDLED,ts:t.created_at,payload:{...i,outcome:t.status,receipt:t.response,error:t.error_detail,truncated:t.truncated===1}}),{streamId:e,events:o}}function _R(t){let e=`msg_mbx_${t.id}`,n=Kn(t.sender_teamfile,t.sender_alias),r=Kn(t.receiver_teamfile,t.receiver_alias),s={table:"agent_mailbox",id:t.id},i={message_id:e,sender:n,receiver:r,root_teamfile:t.root_teamfile,legacy:s},o=[];if(t.message_type==="response"){let a=t.request_mailbox_id!==null?`msg_mbx_${t.request_mailbox_id}`:null;return o.push({event_type:ae.RESPONSE_CREATE,ts:t.created_at,payload:{...i,message_type:"response",content:t.payload,in_reply_to_message_id:a,correlation_status:"legacy-unavailable"}}),o.push({event_type:ae.RESPONSE_ENQUEUE,ts:t.created_at,payload:{...i,message_type:"response",in_reply_to_message_id:a}}),t.delivered_at!==null&&o.push({event_type:ae.RESPONSE_DELIVERED,ts:t.delivered_at,payload:{...i,message_type:"response",receipt:t.receipt}}),{streamId:e,events:o}}return o.push({event_type:ae.CREATE,ts:t.created_at,payload:{...i,message_type:"request",content:t.payload,correlation_status:"legacy-unavailable"}}),o.push({event_type:ae.ENQUEUE,ts:t.created_at,payload:{...i,message_type:"request"}}),t.waited_at!==null&&o.push({event_type:ae.WAIT_REGISTER,ts:t.waited_at,payload:{...i,waited_by:t.waited_by}}),(t.delivering_at!==null||t.delivery_holder_pid!==null)&&o.push({event_type:ae.DELIVER_CLAIM,ts:t.delivering_at??t.created_at,payload:{...i,pid:t.delivery_holder_pid,host:t.delivery_holder_host}}),t.delivered_at!==null&&o.push({event_type:ae.DELIVERED,ts:t.delivered_at,payload:{...i,receipt:t.receipt}}),{streamId:e,events:o}}function hR(t){let e=`inv_${t.id}`,n=Kn(t.target_teamfile,t.target_alias),r={table:"tracked_invocation",id:t.id},s=[{event_type:ae.INVOCATION_START,ts:t.started_at,payload:{invocation_id:e,kind:t.kind,origin:t.origin,launch_source:t.launch_source,from_identity:t.from_identity,target:n,root_teamfile:t.root_teamfile,scope_teamfile:t.scope_teamfile,cwd:t.cwd,command:t.command,request_payload:t.request_payload,started_at:t.started_at,request_message_id:t.team_chat_log_id!==null?`msg_tcl_${t.team_chat_log_id}`:null,holder_pid:t.holder_pid,holder_host:t.holder_host,legacy:r}}];return t.notified_by!==null&&s.push({event_type:ae.INVOCATION_NOTIFY_CLAIM,ts:t.notified_at??t.started_at,payload:{invocation_id:e,notified_by:t.notified_by,notified_at:t.notified_at,legacy:r}}),t.status!=="running"&&s.push({event_type:ae.INVOCATION_FINISH,ts:t.ended_at??t.started_at,payload:{invocation_id:e,status:t.status,ended_at:t.ended_at,exit_code:t.exit_code,signal:t.signal,result_summary:t.result_summary,error:t.error,legacy:r}}),{streamId:e,events:s}}function gR(t){let e=mR(t.receiver_teamfile,t.receiver_alias,t.started_at),n=Kn(t.receiver_teamfile,t.receiver_alias),r=Kn(t.sender_teamfile,t.sender_alias);return{streamId:e,events:[{event_type:ae.INFLIGHT_TAKE,ts:t.started_at,payload:{lease_id:e,receiver:n,sender:r,holder_pid:t.holder_pid,holder_host:null,started_at:t.started_at,legacy:{table:"agent_inflight",receiver_teamfile:t.receiver_teamfile,receiver_alias:t.receiver_alias}}}]}}function Vi(t,e){return t.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(e)!==void 0}function _c(t){let e={appended:0,skipped:0},n={team_chat_log:0,agent_mailbox:0,tracked_invocation:0,agent_inflight:0};t.transaction(()=>{if(Vi(t,"team_chat_log"))for(let i of t.prepare("SELECT * FROM team_chat_log ORDER BY id").all()){let o=e.appended+e.skipped,{streamId:a,events:l}=pR(i);Ki(t,a,l,e),n.team_chat_log+=e.appended+e.skipped-o}if(Vi(t,"agent_mailbox"))for(let i of t.prepare("SELECT * FROM agent_mailbox ORDER BY id").all()){let o=e.appended+e.skipped,{streamId:a,events:l}=_R(i);Ki(t,a,l,e),n.agent_mailbox+=e.appended+e.skipped-o}if(Vi(t,"tracked_invocation"))for(let i of t.prepare("SELECT * FROM tracked_invocation ORDER BY id").all()){let o=e.appended+e.skipped,{streamId:a,events:l}=hR(i);Ki(t,a,l,e),n.tracked_invocation+=e.appended+e.skipped-o}if(Vi(t,"agent_inflight"))for(let i of t.prepare("SELECT * FROM agent_inflight ORDER BY receiver_teamfile, receiver_alias").all()){let o=e.appended+e.skipped,{streamId:a,events:l}=gR(i);Ki(t,a,l,e),n.agent_inflight+=e.appended+e.skipped-o}w_(t)})();let s=i=>t.prepare(`SELECT count(*) AS n FROM ${i}`).get().n;return{appended:e.appended,skipped:e.skipped,bySource:n,projections:{agent_state:s("agent_state"),message_pending:s("message_pending"),invocation_state:s("invocation_state")}}}function w_(t){t.exec("DELETE FROM agent_state"),t.exec("DELETE FROM message_pending"),t.exec("DELETE FROM invocation_state");let e=t.prepare("SELECT seq, stream_id, event_type, payload FROM message_event ORDER BY seq").all();for(let n of e){let r=JSON.parse(n.payload);yR(t,n.seq,n.stream_id,n.event_type,r)}}function xe(t,e,n){let r=t[e];return r!=null?r[n]??null:null}function yR(t,e,n,r,s){switch(r){case ae.ENQUEUE:case ae.RESPONSE_ENQUEUE:{let i=r===ae.RESPONSE_ENQUEUE;t.prepare(`INSERT INTO message_pending
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmctl-ai/lmctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.314",
|
|
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",
|