lensmcp 1.26.6 → 1.26.7
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/bundled/coordination.js +369 -367
- package/bundled/dashboard.js +734 -732
- package/bundled/goal-archive.js +47 -45
- package/bundled/main.js +403 -401
- package/bundled/migrations.js +3 -1
- package/bundled/project.js +2 -0
- package/bundled/shim.js +2 -0
- package/bundled/workspace-action-runner.js +233 -231
- package/lib/agent-plugins.js +2 -2
- package/lib/cli.js +18 -18
- package/package.json +4 -4
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/lensmcp/.codex-plugin/plugin.json +1 -1
package/bundled/migrations.js
CHANGED
|
@@ -4478,6 +4478,8 @@ CREATE INDEX IF NOT EXISTS tasks_main_qa ON tasks(json_extract(data,'$.createdAt
|
|
|
4478
4478
|
CREATE INDEX IF NOT EXISTS tasks_qa_causes ON tasks(json_extract(data,'$.createdAt')) WHERE json_extract(data,'$.kind')='qa' AND json_extract(data,'$.causes') IS NOT NULL;
|
|
4479
4479
|
-- The goals filed from suggestions (suggestionGoals: the Suggestions page's poll, the dashboard's sweep each minute).
|
|
4480
4480
|
CREATE INDEX IF NOT EXISTS tasks_suggestion_goals ON tasks(json_extract(data,'$.updatedAt')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.suggestions') IS NOT NULL;
|
|
4481
|
+
-- The goals with a design, by its stage (designs, nextDesign): the overseer's due read walked every goal for none due (overseer-101).
|
|
4482
|
+
CREATE INDEX IF NOT EXISTS tasks_design_stage ON tasks(json_extract(data,'$.design.stage')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.design') IS NOT NULL;
|
|
4481
4483
|
-- Team health's window (health): the tasks made or changed since, and the direct messages written since. Without them
|
|
4482
4484
|
-- every report read every task's JSON and every message, whatever its window \u2014 29 MB of tasks on FoodGuard (2026-11-05).
|
|
4483
4485
|
CREATE INDEX IF NOT EXISTS tasks_created ON tasks(json_extract(data,'$.createdAt'));
|
|
@@ -4525,7 +4527,7 @@ ${i.commitNote}`),p.state==="claimed"&&(p.leaseUntil=c.expiresAt),p.updatedAt=th
|
|
|
4525
4527
|
json_extract(data,'$.design.stage') AS stage, json_extract(data,'$.followUpReviewed') AS reviewed FROM tasks WHERE id IN (${i.map(()=>"?").join(",")})`).all(...i))n.set(String(r.id),{title:String(r.title??""),...r.kind?{kind:String(r.kind)}:{},state:String(r.state),...r.outcome?{outcome:String(r.outcome)}:{},...r.stage?{stage:String(r.stage)}:{},...r.reviewed?(()=>{try{return{followUpReviewed:JSON.parse(String(r.reviewed))}}catch{return{}}})():{}})}return n})}suggestionGoals(){return this.reading(()=>this.readSuggestionGoals())}readSuggestionGoals(){return this.db.prepare(`SELECT id, json_extract(data,'$.title') AS title, json_extract(data,'$.state') AS state, json_extract(data,'$.outcome') AS outcome,
|
|
4526
4528
|
json_extract(data,'$.personDone') IS NOT NULL AS personDone, json_extract(data,'$.design.stage') AS stage, json_extract(data,'$.suggestions') AS suggestions,
|
|
4527
4529
|
json_extract(data,'$.updatedAt') AS updatedAt FROM tasks WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.suggestions') IS NOT NULL
|
|
4528
|
-
ORDER BY json_extract(data,'$.updatedAt') DESC LIMIT 2000`).all().map(e=>({id:String(e.id),title:String(e.title??""),state:String(e.state),...e.outcome?{outcome:String(e.outcome)}:{},...Number(e.personDone)?{personDone:!0}:{},...e.stage?{stage:String(e.stage)}:{},suggestions:(()=>{try{return JSON.parse(String(e.suggestions))}catch{return[]}})(),updatedAt:Number(e.updatedAt??0)}))}settleGoalSuggestions(e){return this.transaction(()=>{let n=this.task(e);if(n.kind!=="goal"||n.state!=="completed"||n.outcome!=="done"||!n.suggestions?.length)return[];let s=this.clock(),t=n.suggestions.filter(i=>!i.settledAt);if(!t.length)return[];for(let i of t)i.settledAt=s;return n.updatedAt=s,this.logTo(n,"lensmcp","note",`its suggestion${t.length===1?"":"s"} ${t.slice(0,4).map(i=>`\xAB${T(i.title,80)}\xBB`).join(", ")}${t.length>4?", \u2026":""} move${t.length===1?"s":""} to applied, and LensMCP's check of ${t.length===1?"it":"each"} is scheduled`),this.saveTask(n),this.event("task.log",n.id,n),t.map(i=>({...i}))})}designGoal(e){let n=this.task(e);return k(n.kind==="goal"&&n.design,"This is not a goal with a design"),n}designMarkdown(e,n){let s=this.task(e).design,t=n??s?.versions.at(-1)?.n;return s&&t?zl(this.designsRoot,e,t):void 0}designFigure(e,n,s){let t=this.task(e).design?.versions.find(r=>r.n===n)?.figures.find(r=>r.name===s),i=t?N3(this.designsRoot,e,n,s):void 0;return t&&i?{bytes:i,mediaType:t.mediaType}:void 0}designs(e={}){let n=this.readTasks(
|
|
4530
|
+
ORDER BY json_extract(data,'$.updatedAt') DESC LIMIT 2000`).all().map(e=>({id:String(e.id),title:String(e.title??""),state:String(e.state),...e.outcome?{outcome:String(e.outcome)}:{},...Number(e.personDone)?{personDone:!0}:{},...e.stage?{stage:String(e.stage)}:{},suggestions:(()=>{try{return JSON.parse(String(e.suggestions))}catch{return[]}})(),updatedAt:Number(e.updatedAt??0)}))}settleGoalSuggestions(e){return this.transaction(()=>{let n=this.task(e);if(n.kind!=="goal"||n.state!=="completed"||n.outcome!=="done"||!n.suggestions?.length)return[];let s=this.clock(),t=n.suggestions.filter(i=>!i.settledAt);if(!t.length)return[];for(let i of t)i.settledAt=s;return n.updatedAt=s,this.logTo(n,"lensmcp","note",`its suggestion${t.length===1?"":"s"} ${t.slice(0,4).map(i=>`\xAB${T(i.title,80)}\xBB`).join(", ")}${t.length>4?", \u2026":""} move${t.length===1?"s":""} to applied, and LensMCP's check of ${t.length===1?"it":"each"} is scheduled`),this.saveTask(n),this.event("task.log",n.id,n),t.map(i=>({...i}))})}designGoal(e){let n=this.task(e);return k(n.kind==="goal"&&n.design,"This is not a goal with a design"),n}designMarkdown(e,n){let s=this.task(e).design,t=n??s?.versions.at(-1)?.n;return s&&t?zl(this.designsRoot,e,t):void 0}designFigure(e,n,s){let t=this.task(e).design?.versions.find(r=>r.n===n)?.figures.find(r=>r.name===s),i=t?N3(this.designsRoot,e,n,s):void 0;return t&&i?{bytes:i,mediaType:t.mediaType}:void 0}designs(e={}){let n=e.stages??[],s=e.stages?`AND json_extract(data,'$.design.stage') IN (${n.map(()=>"?").join(",")})`:"";return this.readTasks(`WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.design') IS NOT NULL ${s} ORDER BY +json_extract(data,'$.updatedAt') DESC LIMIT ?`,...n,Math.min(e.limit??200,500))}checkoutTasks(e,n=[]){return this.reading(()=>{let s=new Map,t="SELECT id, json_extract(data,'$.title') AS title, json_extract(data,'$.state') AS state, json_extract(data,'$.kind') AS kind, json_extract(data,'$.parentId') AS parent FROM tasks",i=h(o=>{let l=String(o.id);s.set(l,{id:l,title:String(o.title??""),state:String(o.state??""),kind:String(o.kind??""),...o.parent?{parentId:String(o.parent)}:{}})},"add"),r=[...new Set(e.filter(o=>/^[A-Za-z0-9-]{1,80}$/.test(o)))].slice(0,200);for(let o=0;o<r.length;o+=50){let l=r.slice(o,o+50);for(let c of this.db.prepare(`${t} WHERE id IN (${l.map(()=>"?").join(",")})`).all(...l))i(c)}for(let o of[...new Set(n.filter(l=>/^[a-f0-9]{4,32}$/.test(l)))].slice(0,100))for(let l of this.db.prepare(`${t} WHERE id >= ? AND id < ? AND json_extract(data,'$.kind')='goal' LIMIT 3`).all(o,`${o}~`))i(l);return[...s.values()]})}search(e,n={}){let s=o2(e);if(!s.length)return{goals:[],questions:[]};let t=Math.max(1,Math.min(n.limit??CO,IO)),i=s.map(m=>`%${m.replace(/[\\%_]/g,g=>`\\${g}`)}%`),r=h(m=>i.map(()=>`${m} LIKE ? ESCAPE '\\'`).join(" AND "),"all"),o=h(m=>`COALESCE(json_extract(data,'${m}'),'')`,"field"),l=`(id || ' ' || ${["$.title","$.description","$.design.request.text","$.design.versions[#-1].summary"].map(o).join(" || ' ' || ")})`,c=this.readTasks(`WHERE json_extract(data,'$.kind')='goal' AND ${r(l)}
|
|
4529
4531
|
ORDER BY CASE WHEN json_extract(data,'$.state') IN ('design','open','claimed','recovery') THEN 0 ELSE 1 END, json_extract(data,'$.updatedAt') DESC LIMIT ?`,...i,t),d=`(id || ' ' || ${["$.question","$.context","$.taskTitle","$.askerName","$.askerRole"].map(o).join(" || ' ' || ")})`,p=this.db.prepare(`SELECT data FROM questions WHERE ${r(d)}
|
|
4530
4532
|
${n.worktreeId?"AND json_extract(data,'$.worktreeId')=?":""}
|
|
4531
4533
|
ORDER BY CASE WHEN state IN ('person','manager') THEN 0 ELSE 1 END, json_extract(data,'$.updatedAt') DESC LIMIT ?`).all(...i,...n.worktreeId?[n.worktreeId]:[],t).map(m=>JSON.parse(String(m.data)));return{goals:c,questions:p}}nextDesign(){let e=this.clock(),n=this.designs({stages:["requested","changes","drafting"],limit:500}).filter(t=>(t.state==="design"||!!t.design.amendment&&this.liveGoal(t))&&(t.design.stage!=="drafting"||!t.design.drafting||t.design.drafting.until<=e)),s=h(t=>t.design.stage==="changes"||t.design.stage==="drafting"&&t.design.replies.length?0:1,"rank");return n.sort((t,i)=>s(t)-s(i)||t.priority-i.priority||t.createdAt-i.createdAt)[0]}liveGoal(e){return e.state==="open"||e.state==="claimed"||e.state==="recovery"}designActor(e){if(e==="user")return{id:"user",origin:"lensmcp",worktreeId:this.identity.worktreeId};if(e==="lensmcp")return{id:"lensmcp",origin:"lensmcp",worktreeId:this.identity.worktreeId};let n=this.actor(e),s=this.session(n.id);return k(s.role===Mt,"Only the overseer proposes a design \u2014 agents put discovered work on their goal's next list"),{...n,...s.name?{name:s.name}:{}}}designWrite(e,n,s,t,i){return this.transaction(()=>{let r=e==="user"||e==="lensmcp"?this.designActor(e):this.actor(e);return typeof e!="string"&&this.heard(this.authenticate(e)),this.once(`${r.id}:${r.generation??0}`,n,["design",s,...t],()=>{let o=this.task(s);k(o.kind==="goal"&&o.design,"This is not a goal with a design");let l=i(o,o.design,r);return o.updatedAt=this.clock(),this.logTo(o,r.id,o.state==="open"&&l.includes("is open")?"state":"decision",l),this.saveTask(o),this.event(o.state==="open"&&l.includes("is open")?"task.opened":"task.design",o.id,o),o})})}underDesign(e){if(e.parentId)return this.chain(e).slice(1).find(n=>n.kind==="goal"&&n.state==="design")}rootGoalOf(e){let n;for(let s=e,t=0;s&&t<64;t++)s.kind==="goal"&&(n=s),s=s.parentId?G(this.row("SELECT data FROM tasks WHERE id=?",s.parentId)):void 0;return n}onWorker(e){let n=this.rootGoalOf(e)?.host?.host;return!!n&&n!=="local"}runningGoals(){let e=new Map;for(let n of this.readTasks("WHERE json_extract(data,'$.state') IN ('claimed','recovery') AND json_extract(data,'$.kind')='goal' ORDER BY json_extract(data,'$.createdAt')")){let s=this.rootGoalOf(n);s&&s.admission?.mode!=="paused"&&!e.has(s.id)&&e.set(s.id,s)}return[...e.values()]}machineRunning(e){try{if(this.presence.machineLaunches)return this.presence.machineLaunches(e);let n=Yg(this.path);return Jg(n)==="coordination"?ZE({home:Yg(n)},e):0}catch{return 0}}machineHolds(e){if(!this.anyWaits())return[];let n=this.clock();return this.runningGoals().filter(s=>s.id!==e).flatMap(s=>(s.waits??[]).filter(t=>t.machine&&t.offered&&t.offered.until>n).map(t=>({goal:{id:s.id,title:s.title},role:t.role,pool:t.machine.pool,at:t.offered.at,until:t.offered.until})))}anyWaits(){return!!this.row(`SELECT id FROM tasks WHERE json_extract(data,'$.state') IN ('open','claimed','recovery') AND json_extract(data,'$.kind')='goal'
|
package/bundled/project.js
CHANGED
|
@@ -3123,6 +3123,8 @@ CREATE INDEX IF NOT EXISTS tasks_main_qa ON tasks(json_extract(data,'$.createdAt
|
|
|
3123
3123
|
CREATE INDEX IF NOT EXISTS tasks_qa_causes ON tasks(json_extract(data,'$.createdAt')) WHERE json_extract(data,'$.kind')='qa' AND json_extract(data,'$.causes') IS NOT NULL;
|
|
3124
3124
|
-- The goals filed from suggestions (suggestionGoals: the Suggestions page's poll, the dashboard's sweep each minute).
|
|
3125
3125
|
CREATE INDEX IF NOT EXISTS tasks_suggestion_goals ON tasks(json_extract(data,'$.updatedAt')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.suggestions') IS NOT NULL;
|
|
3126
|
+
-- The goals with a design, by its stage (designs, nextDesign): the overseer's due read walked every goal for none due (overseer-101).
|
|
3127
|
+
CREATE INDEX IF NOT EXISTS tasks_design_stage ON tasks(json_extract(data,'$.design.stage')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.design') IS NOT NULL;
|
|
3126
3128
|
-- Team health's window (health): the tasks made or changed since, and the direct messages written since. Without them
|
|
3127
3129
|
-- every report read every task's JSON and every message, whatever its window \u2014 29 MB of tasks on FoodGuard (2026-11-05).
|
|
3128
3130
|
CREATE INDEX IF NOT EXISTS tasks_created ON tasks(json_extract(data,'$.createdAt'));
|
package/bundled/shim.js
CHANGED
|
@@ -3138,6 +3138,8 @@ CREATE INDEX IF NOT EXISTS tasks_main_qa ON tasks(json_extract(data,'$.createdAt
|
|
|
3138
3138
|
CREATE INDEX IF NOT EXISTS tasks_qa_causes ON tasks(json_extract(data,'$.createdAt')) WHERE json_extract(data,'$.kind')='qa' AND json_extract(data,'$.causes') IS NOT NULL;
|
|
3139
3139
|
-- The goals filed from suggestions (suggestionGoals: the Suggestions page's poll, the dashboard's sweep each minute).
|
|
3140
3140
|
CREATE INDEX IF NOT EXISTS tasks_suggestion_goals ON tasks(json_extract(data,'$.updatedAt')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.suggestions') IS NOT NULL;
|
|
3141
|
+
-- The goals with a design, by its stage (designs, nextDesign): the overseer's due read walked every goal for none due (overseer-101).
|
|
3142
|
+
CREATE INDEX IF NOT EXISTS tasks_design_stage ON tasks(json_extract(data,'$.design.stage')) WHERE json_extract(data,'$.kind')='goal' AND json_extract(data,'$.design') IS NOT NULL;
|
|
3141
3143
|
-- Team health's window (health): the tasks made or changed since, and the direct messages written since. Without them
|
|
3142
3144
|
-- every report read every task's JSON and every message, whatever its window \u2014 29 MB of tasks on FoodGuard (2026-11-05).
|
|
3143
3145
|
CREATE INDEX IF NOT EXISTS tasks_created ON tasks(json_extract(data,'$.createdAt'));
|