@lmctl-ai/lmctl 0.2.225 → 0.2.227

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.
@@ -0,0 +1 @@
1
+ "use strict";var{readFileSync:S,writeFileSync:N,renameSync:x,rmSync:I}=require("node:fs"),{execve:h}=process,{DatabaseSync:_}=require("node:sqlite");function g(e){try{let t=S("/proc/".concat(e,"/stat"),"utf8");return t.slice(t.lastIndexOf(")")+2).trim().split(/\s+/)[19]||null}catch{return null}}function w(e,t,r,n,i){let o=g(process.pid);if(o===null)return!1;let d=e.prepare("UPDATE on_demand_launches\n SET phase = 'worker_adopted', state = 'adopted', worker_pid = ?, worker_start = ?, updated_at = ?\n WHERE conversation_id = ? AND generation = ? AND job_id = ? AND run_id = ? AND phase = 'dispatching'").run(process.pid,o,new Date().toISOString(),t,r,n,i);return Number(d.changes)===1}function f(e,t){let r="".concat(e,".tmp-").concat(process.pid);try{N(r,JSON.stringify(t),{mode:384,flag:"wx"}),x(r,e)}catch(n){try{I(r,{force:!0})}catch{}throw n}}function m(e,t,r,n,i,o){return{adopted:e,conversationId:t,generation:r,jobId:n,runId:i,...o===void 0?{}:{error:o}}}function b(e){let[t,r,n,i,o,d,p]=e,s=Number(n),c=Number(i),a=Number(o);if(!t||!r||!Number.isSafeInteger(s)||s<1||!Number.isSafeInteger(c)||c<1||!Number.isSafeInteger(a)||a<1||typeof d!="string"||!p)throw new Error("invalid on-demand worker arguments");let u=new _(t,{timeout:0});u.exec("PRAGMA busy_timeout = 0");let y=!1;try{y=w(u,r,s,c,a)}catch(l){try{f(p,m(!1,r,s,c,a,String(l&&l.message||l)))}catch{}return u.close(),!1}if(!y){try{f(p,m(!1,r,s,c,a))}catch{}return u.close(),!1}try{f(p,m(!0,r,s,c,a))}catch{}if(u.close(),typeof h!="function")throw new Error("process.execve is unavailable");return h("/bin/sh",["sh","-c",d],process.env),!0}module.exports={adoptOnDemandWorker:w,ownerStartIdentity:g,writeReceipt:f,main:b};if(require.main===module)try{let e=b(process.argv.slice(2));process.exitCode=e?0:1}catch(e){process.stderr.write("on-demand worker: ".concat(e instanceof Error?e.message:String(e),"\n")),process.exitCode=1}
package/dist/schema.sql CHANGED
@@ -349,6 +349,23 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_cron_runs_active_job ON cron_runs(job_id)
349
349
  CREATE INDEX IF NOT EXISTS idx_cron_runs_job ON cron_runs(job_id);
350
350
  CREATE INDEX IF NOT EXISTS idx_cron_runs_status ON cron_runs(status);
351
351
 
352
+ CREATE TABLE IF NOT EXISTS on_demand_launches(
353
+ conversation_id TEXT PRIMARY KEY CHECK(length(trim(conversation_id)) > 0),
354
+ request_hash TEXT NOT NULL,
355
+ generation INTEGER NOT NULL CHECK(generation > 0),
356
+ job_id INTEGER NOT NULL,
357
+ run_id INTEGER,
358
+ state TEXT NOT NULL CHECK(state IN ('claimed', 'retryable', 'adopted')),
359
+ phase TEXT NOT NULL DEFAULT 'reserved' CHECK(phase IN ('reserved', 'dispatching', 'worker_adopted', 'uncertain')),
360
+ worker_pid INTEGER,
361
+ worker_start TEXT,
362
+ receipt_path TEXT,
363
+ owner_pid INTEGER NOT NULL CHECK(owner_pid > 0),
364
+ owner_start TEXT NOT NULL,
365
+ created_at TEXT NOT NULL,
366
+ updated_at TEXT NOT NULL
367
+ );
368
+
352
369
  CREATE TABLE IF NOT EXISTS logical_names(
353
370
  name TEXT PRIMARY KEY CHECK(length(trim(name)) > 0 AND name != 'operator'),
354
371
  teamfile_path TEXT NOT NULL CHECK(length(trim(teamfile_path)) > 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmctl-ai/lmctl",
3
- "version": "0.2.225",
3
+ "version": "0.2.227",
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",
@@ -20,6 +20,7 @@
20
20
  "dist/schema.sql",
21
21
  "dist/cli/lmscript.js",
22
22
  "dist/cli/native-holder-worker.js",
23
+ "dist/on-demand-worker.cjs",
23
24
  "dist/lmbee.js",
24
25
  "dist/config/",
25
26
  "dist/public/",