@lensmcp/protocol-types 1.26.23 → 1.26.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/lib/canvas.js CHANGED
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var i=(a,n)=>l(a,"name",{value:n,configurable:!0});var d=Object.defineProperty,r=i((a,n)=>d(a,"name",{value:n,configurable:!0}),"i");import{z as e}from"zod";export const CANVAS_FORMAT=1,CANVAS_FRAME_PROTOCOL=1,CANVAS_FRAME_RUNTIME="frame-v1",CANVAS_FRAME_PATH="/v1",CANVAS_FRAME_HOST="lensmcp.canvas.localhost",CANVAS_ID_PATTERN=/^cv-[0-9a-f]{16}$/,CANVAS_PROJECT_ID_PATTERN=/^pr-[0-9a-f]{16}$/,CANVAS_QID_PATTERN=/^[a-z][a-z0-9_-]{0,63}$/i,isCanvasId=r(a=>typeof a=="string"&&CANVAS_ID_PATTERN.test(a),"isCanvasId"),CANVAS_LIMITS={mdxBytes:256*1024,mdxWholeBytes:64*1024,dataBytes:2*1024*1024,answerBytes:16*1024,questions:500,assets:50,assetBytes:100*1024*1024,assetFileBytes:10*1024*1024,canvasBytes:256*1024*1024,projectBytes:2*1024*1024*1024,titleChars:200,noteChars:2e3,commentChars:8e3,frameMessageBytes:256*1024,depth:64,ops:1e3,checkpointEvery:50,checkpointsKept:20,waitDefaultMs:45e3,waitMaxMs:9e5},CANVAS_KINDS=["doc","decision","plan","review","report","dashboard","qa","template"],CANVAS_TEMPLATE_NAMES=["decision-record","plan-review","weekly-report","goal-dashboard","qa-report"],CANVAS_QUESTION_KINDS=["choice","multi","text","number","confirm","approve"],CANVAS_FIELD_KINDS=["text","number","date","file","image"],CANVAS_INTERACTIVE=["Question","Checklist","Field","Options"];export function canvasAnswerKeys(a){return a.kind==="checklist"?(a.items??[]).map(n=>`${a.qid}/${n.id}`):a.kind==="multi"?(a.options??[]).map(n=>`${a.qid}/${n.id}`):[a.qid]}i(canvasAnswerKeys,"canvasAnswerKeys"),r(canvasAnswerKeys,"canvasAnswerKeys");export const canvasQidOf=r(a=>a.split("/")[0]??a,"canvasQidOf"),CANVAS_SHAPE_KEYS=["type","properties","required","items","enum","minimum","maximum","minItems","maxItems","format","additionalProperties","description","derived","$schema","title"],CANVAS_DATA_OPS=["set","remove","move","copy","append"],CANVAS_HEALTH_STATES=["checked","good","broken","unverified"],CANVAS_ANSWER_VIAS=["document","rail","inbox","cli","api","host"],CANVAS_LEDGER_PARTS=["version","data","answer","got","grant","share","archive","delete","comment","health","meta"],CANVAS_BROKER_METHODS=["ui/initialize","ui/notifications/size-changed","ui/open-link","canvas/heartbeat","canvas/slots","canvas/focus","canvas/get","canvas/rendered","canvas/problem","canvas/health","canvas/data-changed","canvas/answers-changed","canvas/selection","canvas/copy","canvas/download","canvas/open-ref","canvas/slot-sizes","canvas/theme"];export function canvasConfirmedAnswers(a){const n=new Map;for(const o of a){if(!o.confirmed)continue;const c=n.get(o.key);(!c||o.seq>c.seq)&&n.set(o.key,o)}const t={};for(const[o,c]of n)c.state==="current"&&(t[o]=c.value);return t}i(canvasConfirmedAnswers,"canvasConfirmedAnswers"),r(canvasConfirmedAnswers,"canvasConfirmedAnswers");export function canvasFrameInit(a){const n=a.detail;return{protocol:CANVAS_FRAME_PROTOCOL,theme:a.theme,tokens:a.tokens,canvas:n.canvas.id,version:n.shown,code:a.code,compiler:a.compiler,contract:n.version.contract,bindings:n.version.bindings,data:n.data,marks:n.marks,answers:canvasConfirmedAnswers(n.answers),got:{},...a.anchor?{anchor:a.anchor}:{},fallback:a.fallback,dir:"auto"}}i(canvasFrameInit,"canvasFrameInit"),r(canvasFrameInit,"canvasFrameInit");const s=e.number(),p=e.object({qid:e.string().max(64),x:s,y:s,width:s.min(0).max(1e4),height:s.min(0).max(1e4),visible:e.boolean()}),m=e.object({message:e.string().max(4e3),block:e.string().max(200).optional(),line:e.number().int().min(0).max(1e6).optional(),column:e.number().int().min(0).max(1e5).optional(),component:e.string().max(100).optional()});export const CANVAS_FRAME_PARAMS={"ui/initialize":e.looseObject({protocol:e.number().int()}),"ui/notifications/size-changed":e.object({height:s.min(0).max(1e6),width:s.min(0).max(1e5).optional()}),"ui/open-link":e.object({url:e.string().max(4e3)}),"canvas/heartbeat":e.object({t:s}),"canvas/slots":e.object({slots:e.array(p).max(CANVAS_LIMITS.questions)}),"canvas/focus":e.object({qid:e.string().max(64)}),"canvas/get":e.object({uri:e.string().max(2e3)}),"canvas/rendered":e.object({ms:s.min(0),blocks:e.number().int().min(0),errors:e.number().int().min(0)}),"canvas/problem":e.object({errors:e.array(m).max(200)}),"canvas/health":e.object({ok:e.boolean(),errors:e.array(m).max(200)}),"canvas/selection":e.object({text:e.string().max(8e3),block:e.string().max(200).optional(),lines:e.tuple([e.number().int(),e.number().int()]).optional()}),"canvas/copy":e.object({text:e.string().max(1024*1024)}),"canvas/download":e.object({name:e.string().max(200),type:e.enum(["csv","json","png","txt","md"]),text:e.string().max(4*1024*1024)}),"canvas/open-ref":e.object({kind:e.enum(["task","goal","file","canvas"]),id:e.string().max(2e3),line:e.number().int().optional()})};export function canvasSlotHeight(a){const n=40+(a.detail?20:0),t=44;switch(a.kind){case"choice":case"multi":return n+36*Math.max(1,a.options?.length??0)+t;case"checklist":return n+32*Math.max(1,a.items?.length??0);case"confirm":return n+t;case"approve":return n+72+t;case"text":return n+84+t;default:return n+40+t}}i(canvasSlotHeight,"canvasSlotHeight"),r(canvasSlotHeight,"canvasSlotHeight");
1
+ "use strict";var A=Object.defineProperty;var o=(a,n)=>A(a,"name",{value:n,configurable:!0});var l=Object.defineProperty,t=o((a,n)=>l(a,"name",{value:n,configurable:!0}),"a");import{z as e}from"zod";import{TASK_ARTIFACT_MAX_BYTES as d,TASK_ARTIFACTS_MAX as p,TASK_ARTIFACTS_MAX_BYTES as v}from"./canvas-attachments.js";export const CANVAS_FORMAT=1,CANVAS_FRAME_PROTOCOL=1,CANVAS_FRAME_RUNTIME="frame-v1",CANVAS_FRAME_PATH="/v1",CANVAS_FRAME_HOST="lensmcp.canvas.localhost",CANVAS_ID_PATTERN=/^cv-[0-9a-f]{16}$/,CANVAS_PROJECT_ID_PATTERN=/^pr-[0-9a-f]{16}$/,CANVAS_QID_PATTERN=/^[a-z][a-z0-9_-]{0,63}$/i,isCanvasId=t(a=>typeof a=="string"&&CANVAS_ID_PATTERN.test(a),"isCanvasId"),CANVAS_LIMITS={mdxBytes:256*1024,mdxWholeBytes:64*1024,dataBytes:2*1024*1024,answerBytes:16*1024,questions:500,assets:p,assetBytes:v,assetFileBytes:d,canvasBytes:256*1024*1024,projectBytes:2*1024*1024*1024,titleChars:200,noteChars:2e3,commentChars:8e3,frameMessageBytes:256*1024,depth:64,ops:1e3,checkpointEvery:50,checkpointsKept:20,waitDefaultMs:45e3,waitMaxMs:9e5},CANVAS_KINDS=["doc","decision","plan","review","report","dashboard","qa","template"],CANVAS_TEMPLATE_NAMES=["decision-record","plan-review","weekly-report","goal-dashboard","qa-report"],CANVAS_QUESTION_KINDS=["choice","multi","text","number","confirm","approve"],CANVAS_FIELD_KINDS=["text","number","date","file","image"],CANVAS_INTERACTIVE=["Question","Checklist","Field","Options"];export function canvasAnswerKeys(a){return a.kind==="checklist"?(a.items??[]).map(n=>`${a.qid}/${n.id}`):a.kind==="multi"?(a.options??[]).map(n=>`${a.qid}/${n.id}`):[a.qid]}o(canvasAnswerKeys,"canvasAnswerKeys"),t(canvasAnswerKeys,"canvasAnswerKeys");export const canvasQidOf=t(a=>a.split("/")[0]??a,"canvasQidOf"),CANVAS_SHAPE_KEYS=["type","properties","required","items","enum","minimum","maximum","minItems","maxItems","format","additionalProperties","description","derived","$schema","title"],CANVAS_DATA_OPS=["set","remove","move","copy","append"],CANVAS_HEALTH_STATES=["checked","good","broken","unverified"],CANVAS_ANSWER_VIAS=["document","rail","inbox","cli","api","host"],CANVAS_LEDGER_PARTS=["version","data","answer","got","grant","share","archive","delete","comment","health","meta","asset"],CANVAS_OUTSIDE={timeoutMs:1e4,maxBytes:2*1024*1024,redirects:5,perCanvasPerMinute:30,perOriginPerMinute:60,keptPerCanvas:20,keptBytesPerCanvas:8*1024*1024};export function canvasGrantWords(a){return`This canvas could send what it reads to ${a}, or anywhere.`}o(canvasGrantWords,"canvasGrantWords"),t(canvasGrantWords,"canvasGrantWords");export function canvasGrantPrompt(a){return{title:`Let this canvas read ${a}?`,lines:[canvasGrantWords(a),"A site a canvas may read is also a way out: the addresses its versions ask for can carry what its author knows, each read tells the site you opened the canvas, and the site can pass any of it on.","The dashboard fetches it, never the canvas: only the exact URLs a version declares, public addresses only, GET, no cookies, 10 s and 2 MB at most. Revoke it here at any time; the ledger records both."],act:`Approve ${a}`}}o(canvasGrantPrompt,"canvasGrantPrompt"),t(canvasGrantPrompt,"canvasGrantPrompt");export const CANVAS_BROKER_METHODS=["ui/initialize","ui/notifications/size-changed","ui/open-link","canvas/heartbeat","canvas/slots","canvas/focus","canvas/get","canvas/rendered","canvas/problem","canvas/health","canvas/data-changed","canvas/answers-changed","canvas/selection","canvas/copy","canvas/download","canvas/open-ref","canvas/slot-sizes","canvas/theme","canvas/escape"],CANVAS_APP_MIME="text/html;profile=mcp-app",CANVAS_APP_URI_TEMPLATE="ui://canvas/{id}",canvasAppUri=t(a=>`ui://canvas/${a}`,"canvasAppUri"),CANVAS_APP_VIEW_URI="ui://canvas/view",CANVAS_ANSWER_TOOL="canvas_answer",CANVAS_APP_PROTOCOL=1;export function canvasConfirmedAnswers(a){const n=new Map;for(const r of a){if(!r.confirmed)continue;const c=n.get(r.key);(!c||r.seq>c.seq)&&n.set(r.key,r)}const s={};for(const[r,c]of n)c.state==="current"&&(s[r]=c.value);return s}o(canvasConfirmedAnswers,"canvasConfirmedAnswers"),t(canvasConfirmedAnswers,"canvasConfirmedAnswers");export function canvasFrameInit(a){const n=a.detail;return{protocol:CANVAS_FRAME_PROTOCOL,theme:a.theme,tokens:a.tokens,canvas:n.canvas.id,version:n.shown,code:a.code,compiler:a.compiler,contract:n.version.contract,bindings:n.version.bindings,data:n.data,marks:n.marks,answers:canvasConfirmedAnswers(n.answers),got:{},...a.anchor?{anchor:a.anchor}:{},fallback:a.fallback,dir:"auto"}}o(canvasFrameInit,"canvasFrameInit"),t(canvasFrameInit,"canvasFrameInit");const i=e.number(),u=e.object({qid:e.string().max(64),x:i,y:i,width:i.min(0).max(1e4),height:i.min(0).max(1e4),visible:e.boolean()}),m=e.object({message:e.string().max(4e3),block:e.string().max(200).optional(),line:e.number().int().min(0).max(1e6).optional(),column:e.number().int().min(0).max(1e5).optional(),component:e.string().max(100).optional()});export const CANVAS_FRAME_PARAMS={"ui/initialize":e.looseObject({protocol:e.number().int()}),"ui/notifications/size-changed":e.object({height:i.min(0).max(1e6),width:i.min(0).max(1e5).optional()}),"ui/open-link":e.object({url:e.string().max(4e3)}),"canvas/heartbeat":e.object({t:i}),"canvas/slots":e.object({slots:e.array(u).max(CANVAS_LIMITS.questions)}),"canvas/focus":e.object({qid:e.string().max(64)}),"canvas/get":e.object({uri:e.string().max(2e3)}),"canvas/rendered":e.object({ms:i.min(0),blocks:e.number().int().min(0),errors:e.number().int().min(0)}),"canvas/problem":e.object({errors:e.array(m).max(200)}),"canvas/health":e.object({ok:e.boolean(),errors:e.array(m).max(200)}),"canvas/selection":e.object({text:e.string().max(8e3),block:e.string().max(200).optional(),lines:e.tuple([e.number().int(),e.number().int()]).optional()}),"canvas/copy":e.object({text:e.string().max(1024*1024)}),"canvas/download":e.object({name:e.string().max(200),type:e.enum(["csv","json","png","txt","md"]),text:e.string().max(4*1024*1024)}),"canvas/open-ref":e.object({kind:e.enum(["task","goal","file","canvas"]),id:e.string().max(2e3),line:e.number().int().optional()}),"canvas/escape":e.object({})};export function canvasSlotHeight(a){const n=40+(a.detail?20:0),s=44;switch(a.kind){case"choice":case"multi":return n+36*Math.max(1,a.options?.length??0)+s;case"checklist":return n+32*Math.max(1,a.items?.length??0);case"confirm":return n+s;case"approve":return n+72+s;case"text":return n+84+s;default:return n+40+s}}o(canvasSlotHeight,"canvasSlotHeight"),t(canvasSlotHeight,"canvasSlotHeight");
@@ -406,7 +406,7 @@ export declare const MAX_RUN_STRANGERS = 20;
406
406
  *
407
407
  * Who writes what (every write is read → change → write, under the record's lock; `run-registry.ts`):
408
408
  * - the runner creates it and writes `state` up to its end, `child` (as each step starts and ends), `origin`, `url`,
409
- * `edgePort`, `startedAt`, `endedAt`, `exit`, `note`, `urlNote`;
409
+ * `edgePort`, `startedAt`, `endedAt`, `exit`, `note`, `urlNote` — and `strangersNote` when its first look got no answer;
410
410
  * - the guard writes `guard` — its own name, as it starts: the runner starts nothing of the job before it reads it;
411
411
  * - whoever cleans — the runner, the guard, the sweep — writes `cleaning` while it does and `cleanup` when it is
412
412
  * through, takes `url` and `edgePort` away with the route, and `child` once it has ended that process group; the
@@ -425,7 +425,8 @@ export declare const MAX_RUN_STRANGERS = 20;
425
425
  *
426
426
  * Every kind of job is one of these (slice D10): what differs is `scope` — and with it `project`, `files.override`
427
427
  * and what the watcher and the cleanup ask Docker. `warnings` is the runner's, written as the record is created;
428
- * `strangers` is written once, with the cleanup's verdict, by whoever cleans while the run's end is fresh.
428
+ * `strangers` (or why there are none to say, `strangersNote`) is written once, with the cleanup's verdict, by whoever
429
+ * cleans while the run's end is fresh.
429
430
  */
430
431
  export interface DockerRunRecord {
431
432
  /** The record's version. A reader that does not know it leaves the run alone. */
@@ -495,6 +496,12 @@ export interface DockerRunRecord {
495
496
  cleanup?: DockerRunCleanup;
496
497
  /** Containers without a LensMCP label that came up while it ran and were still there when it was cleaned ({@link DockerRunStrangers}) — none: there were none, or it was not looked for. */
497
498
  strangers?: DockerRunStrangers;
499
+ /**
500
+ * Why `strangers` could not be said: a look Docker did not answer — the one its runner takes before the first
501
+ * command, or the one at its cleanup (`docker ps did not answer in 10 s`). Without it a run whose look failed read as
502
+ * one beside which nothing came up (issues/closed/test-infra-20). None: both looks answered, or none was owed.
503
+ */
504
+ strangersNote?: string;
498
505
  /**
499
506
  * Its files: the run's folder, the override file (a run that has a stack), the artifacts folder, the command's
500
507
  * log, the guard's log — and the watcher's two (slice D6): every sample (`docker-samples.jsonl`) and every event of
@@ -84,7 +84,8 @@ export interface DockerRunReport {
84
84
  * As far as LensMCP can honestly tell, and no further. Two things it knows: that it SAW no container with the run's
85
85
  * labels — its command ran, and the look at its end answered — and which containers without a LensMCP label came up
86
86
  * meanwhile and were still there ({@link DockerRunRecord.strangers}). Who started those Docker does not say, so
87
- * neither does this — and no name is read for a hint. `queue run` says these where the run's end is read;
87
+ * neither does this — and no name is read for a hint. A look that got no answer is said as that
88
+ * ({@link DockerRunRecord.strangersNote}), never as none. `queue run` says these where the run's end is read;
88
89
  * `lensmcp docker report` prints them.
89
90
  */
90
91
  export declare function runUnlabeledWords(record: DockerRunRecord): string[];
@@ -1,2 +1,2 @@
1
- "use strict";var M=Object.defineProperty;var h=(e,t)=>M(e,"name",{value:t,configurable:!0});var w=Object.defineProperty,u=h((e,t)=>w(e,"name",{value:t,configurable:!0}),"u");import{DOCKER_RUN_ENV as b,dockerRunEnded as k,RYUK_DISABLED_ENV as x}from"./docker-jobs.js";export function runUnlabeledWords(e){if(e.scope!=="containers")return[];const t=[],o=`hand ${b.labels} to each container it starts \u2014 a JSON object of labels: .withLabels(JSON.parse(process.env.${b.labels} ?? '{}'))`,a=e.startedAt!==void 0&&e.watch?.inspected!==void 0&&!e.engineLost&&!(e.services??[]).length;a&&t.push(`LensMCP saw no container with the run's labels while it ran: it watched none and removed none. If the job starts containers, ${o}.`);const i=e.strangers;if(i?.containers.length){const n=i.containers.length+(i.more??0),c=(e.warnings??[]).some(l=>l.startsWith(x));t.push(`${n} container${n===1?"":"s"} without the run's labels came up while it ran and ${n===1?"is":"are"} still there: ${i.containers.join(", ")}${i.more?` and ${i.more} more`:""}. LensMCP cannot tell whether this run started ${n===1?"it":"them"} \u2014 Docker does not say who starts a container \u2014 and ${n===1?"does not remove it":"removes none of them"}: only what carries the run's labels is the run's. `+(c?"testcontainers' own reaper is off, so nothing else removes what a suite left either.":"Where testcontainers' own reaper is on, it removes what a suite left.")+(a?"":` If the job started ${n===1?"it":"them"}, ${o}.`))}return t}h(runUnlabeledWords,"runUnlabeledWords"),u(runUnlabeledWords,"runUnlabeledWords");export function dockerRunReport(e,t=Date.now()){const o=k(e.state),a=(e.services??[]).map(l=>{const s=l.budgetMb===void 0?0:l.peakMb-l.budgetMb;return{...l,...s>0?{overMb:s}:{},...l.peakMb>0?{}:{unsampled:!0}}}).sort((l,s)=>(s.overMb??0)-(l.overMb??0)||s.peakMb-l.peakMb||l.name.localeCompare(s.name)),i=a.filter(l=>l.budgetMb!==void 0),n=e.startedAt===void 0?void 0:Math.max(0,(e.endedAt??t)-e.startedAt),c=runUnlabeledWords(e);return{run:{id:e.id,job:e.job,kind:e.kind,state:e.state,ended:o,scope:e.scope??"stack",project:e.project,root:e.root,...e.context?{context:e.context}:{},...e.stage?{stage:e.stage}:{},...e.note?{note:e.note}:{},...e.url?{url:e.url}:{},...e.origin?{origin:e.origin}:{},...e.urlNote?{urlNote:e.urlNote}:{},createdAt:e.createdAt,...e.startedAt!==void 0?{startedAt:e.startedAt}:{},...e.endedAt!==void 0?{endedAt:e.endedAt}:{},...n!==void 0?{ranMs:n}:{},...e.exit?{exit:e.exit}:{}},services:a,totals:{lastMb:a.reduce((l,s)=>l+s.lastMb,0),...i.length?{budgetMb:i.reduce((l,s)=>l+(s.budgetMb??0),0)}:{}},kills:e.kills??[],...e.killsMore?{killsMore:e.killsMore}:{},...e.engineLost?{engineLost:e.engineLost}:{},...e.vm?{vm:e.vm}:{},...e.cleanup?{cleanup:e.cleanup}:{},...e.warnings?.length?{warnings:e.warnings}:{},...c.length?{unlabeled:c}:{},...e.watch?{watch:e.watch}:{},files:{...e.files.samples?{samples:e.files.samples}:{},...e.files.events?{events:e.files.events}:{},log:e.files.log,artifacts:e.files.artifacts}}}h(dockerRunReport,"dockerRunReport"),u(dockerRunReport,"dockerRunReport");const d=u(e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),"when"),g=u(e=>{const t=Math.round(e/1e3);if(t<60)return`${t} s`;const o=Math.floor(t/60);return o<60?`${o} min${t%60?` ${t%60} s`:""}`:`${Math.floor(o/60)} h${o%60?` ${o%60} min`:""}`},"lasted"),$=u((e,t,o)=>`${e} ${e===1?t:o}`,"plural");export{d as dockerTime,g as dockerLasted};function v(e){const t=e.exit?e.exit.signal?`its command was ended by ${e.exit.signal}`:`its command exited ${e.exit.code}`:void 0,o=[e.ranMs!==void 0?`${e.ended?"ran":"running for"} ${g(e.ranMs)}`:void 0,e.startedAt!==void 0?`started ${d(e.startedAt)}`:`created ${d(e.createdAt)}`,e.endedAt!==void 0?`ended ${d(e.endedAt)}`:void 0].filter(Boolean).join(", ");return`${{starting:"starting: nothing of the job has run yet",preparing:"preparing: its prepare steps run",running:"running",cleaning:`cleaning up${t?`: ${t}`:""}`,passed:`passed${t?`: ${t}`:""}`,failed:`failed${t?`: ${t}`:""}`,cancelled:"cancelled",timeout:"timed out",errored:"errored",lost:`lost: its runner died, so nobody knows how it would have ended${t?` (${t})`:""}`}[e.state]} \xB7 ${o}`}h(v,"w"),u(v,"stateText");function f(e){const t=e[0].map((o,a)=>Math.max(...e.map(i=>(i[a]??"").length)));return e.map(o=>o.map((a,i)=>i===0?a.padEnd(t[i]):i===o.length-1?a:a.padStart(t[i])).join(" ").trimEnd())}h(f,"k"),u(f,"table");export function dockerRunReportText(e){const{run:t,vm:o,watch:a,cleanup:i}=e,n=[`Docker run ${t.id} \u2014 job \xAB${t.job}\xBB (${t.kind}), ${t.project?`Compose project ${t.project}`:t.scope==="none"?"nothing in Docker":"no Compose project: its containers by the run's labels"}`,` ${v(t)}`,` in ${t.root}${t.context?` \xB7 Docker context ${t.context}`:""}`];t.stage&&n.push(` stage: ${t.stage}`),t.note&&n.push(` ${t.note}`);for(const s of e.warnings??[])n.push(` ! ${s}`);t.url?n.push(` URL: ${t.url}`):t.urlNote&&n.push(` no URL: ${t.urlNote}`),n.push("");const c=a?.samples?`${$(a.samples,"sample","samples")}${a.sampledAt!==void 0?`, the last at ${d(a.sampledAt)}`:""}`:"no sample was taken";if(n.push(t.scope==="none"?"Memory: the job declares nothing in Docker's VM \u2014 its commands were given no labels, and Docker was not asked about it.":`Memory by service, MiB \u2014 ${c}`),e.services.length){const s=u(r=>r===void 0?"\u2013":String(r),"figure"),m=u(r=>[r.overMb!==void 0?`OVER its budget by ${r.overMb}`:void 0,r.oomKilled?"killed for memory":void 0,r.exitCode!==void 0?`exit ${r.exitCode}`:void 0,r.unsampled?"never sampled":void 0].filter(Boolean).join(" \xB7 "),"remark");n.push(...f([["service","now","peak","budget","limit",""],...e.services.map(r=>[r.name,r.unsampled?"\u2013":String(r.lastMb),r.unsampled?"\u2013":String(r.peakMb),s(r.budgetMb),s(r.limitMb),m(r)]),["all",String(e.totals.lastMb),"",s(e.totals.budgetMb),"",""]]).map(r=>` ${r}`));const p=e.services.filter(r=>r.overMb!==void 0);p.length&&n.push(` ${$(p.length,"service","services")} over what ${p.length===1?"it declares":"they declare"}: raise \`jobs.${t.job}.budget.services\` in lensmcp.json to what ${p.length===1?"it takes":"they take"} \u2014 the queue lets the job in by these figures.`)}else t.scope!=="none"&&n.push(" No container of the run was seen.");n.push("");const l=e.kills.length+(e.killsMore??0);n.push(l?`Killed for memory: ${l}`:"Killed for memory: none");for(const s of e.kills){const m=[s.limitMb!==void 0?`at its ${s.limitMb} MiB limit`:"no limit of its own: the VM ran out, or it was not read",s.peakMb!==void 0?`peak ${s.peakMb} MiB`:"never sampled",s.budgetMb!==void 0?`budget ${s.budgetMb} MiB`:void 0,s.seen==="event"?"seen live":"found by the inspect: the live stream did not tell it"].filter(Boolean).join(" \xB7 ");n.push(` ${d(s.at)} ${s.service}${s.name?` (${s.name})`:""} ${m}`)}if(e.killsMore&&n.push(` \u2026 and ${e.killsMore} more, not listed`),e.engineLost){const s=e.engineLost;n.push(""),n.push(`Docker stopped answering at ${d(s.at)} \u2014 ${s.why}`),s.backAt!==void 0&&n.push(` it answered again at ${d(s.backAt)}`),s.killed?.length&&n.push(` found killed for memory once it was gone: ${s.killed.join(", ")} \u2014 they went with the engine`)}o&&(n.push(""),n.push(`Docker's VM: ${o.totalMb} MiB \xB7 ${o.read==="estimate"?"about ":""}${o.availableAtAdmissionMb} MiB free when the run was let in (${o.read==="estimate"?"an estimate: its own figure could not be read":"the VM's own figure"})`+(o.minAvailableMb!==void 0?` \xB7 lowest ${o.minAvailableMb} MiB while it ran`:" \xB7 not read while it ran")+(o.lastAvailableMb!==void 0?` \xB7 ${o.lastAvailableMb} MiB at the last read${o.sampledAt!==void 0?` (${d(o.sampledAt)})`:""}`:""))),n.push(""),i?i.done?n.push(`Cleanup: by ${i.by==="project"?"the project's own end (LensMCP looked, and found nothing)":i.by} at ${d(i.at)} \u2014 nothing of the run is left`):n.push(`Cleanup: OWED (${i.by}, ${d(i.at)}) \u2014 ${i.why??"something that carries the run's labels is left"}${i.left?.length?` \u2014 left: ${i.left.join(", ")}`:""}`):n.push(t.ended?"Cleanup: not recorded \u2014 its guard, or the sweep, has it":"Cleanup: not yet \u2014 the run has not ended"),i?.unlabeled?.length&&n.push(` in its Compose project without the run's labels, never removed: ${i.unlabeled.join(", ")}`);for(const s of e.unlabeled??[])n.push(` ${s}`);if(a?.notes?.length||a?.streamRestarts){n.push(""),n.push("What the watcher could not do:"),a.streamRestarts&&n.push(` the live stream ended ${$(a.streamRestarts,"time","times")} while Docker answered, and was started again`);for(const s of a.notes??[])n.push(` ${s}`)}return n.push(""),n.push(`Files: ${[e.files.samples?`samples ${e.files.samples}`:void 0,e.files.events?`events ${e.files.events}`:void 0,`log ${e.files.log}`].filter(Boolean).join(" \xB7 ")}`),n.join(`
1
+ "use strict";var M=Object.defineProperty;var h=(e,t)=>M(e,"name",{value:t,configurable:!0});var w=Object.defineProperty,u=h((e,t)=>w(e,"name",{value:t,configurable:!0}),"u");import{DOCKER_RUN_ENV as b,dockerRunEnded as k,RYUK_DISABLED_ENV as x}from"./docker-jobs.js";export function runUnlabeledWords(e){if(e.scope!=="containers")return[];const t=[],o=`hand ${b.labels} to each container it starts \u2014 a JSON object of labels: .withLabels(JSON.parse(process.env.${b.labels} ?? '{}'))`,i=e.startedAt!==void 0&&e.watch?.inspected!==void 0&&!e.engineLost&&!(e.services??[]).length;i&&t.push(`LensMCP saw no container with the run's labels while it ran: it watched none and removed none. If the job starts containers, ${o}.`);const a=e.strangers;if(a?.containers.length){const n=a.containers.length+(a.more??0),c=(e.warnings??[]).some(l=>l.startsWith(x));t.push(`${n} container${n===1?"":"s"} without the run's labels came up while it ran and ${n===1?"is":"are"} still there: ${a.containers.join(", ")}${a.more?` and ${a.more} more`:""}. LensMCP cannot tell whether this run started ${n===1?"it":"them"} \u2014 Docker does not say who starts a container \u2014 and ${n===1?"does not remove it":"removes none of them"}: only what carries the run's labels is the run's. `+(c?"testcontainers' own reaper is off, so nothing else removes what a suite left either.":"Where testcontainers' own reaper is on, it removes what a suite left.")+(i?"":` If the job started ${n===1?"it":"them"}, ${o}.`))}else e.strangersNote&&t.push(`LensMCP cannot say which containers without the run's labels came up while it ran: ${e.strangersNote}.`);return t}h(runUnlabeledWords,"runUnlabeledWords"),u(runUnlabeledWords,"runUnlabeledWords");export function dockerRunReport(e,t=Date.now()){const o=k(e.state),i=(e.services??[]).map(l=>{const s=l.budgetMb===void 0?0:l.peakMb-l.budgetMb;return{...l,...s>0?{overMb:s}:{},...l.peakMb>0?{}:{unsampled:!0}}}).sort((l,s)=>(s.overMb??0)-(l.overMb??0)||s.peakMb-l.peakMb||l.name.localeCompare(s.name)),a=i.filter(l=>l.budgetMb!==void 0),n=e.startedAt===void 0?void 0:Math.max(0,(e.endedAt??t)-e.startedAt),c=runUnlabeledWords(e);return{run:{id:e.id,job:e.job,kind:e.kind,state:e.state,ended:o,scope:e.scope??"stack",project:e.project,root:e.root,...e.context?{context:e.context}:{},...e.stage?{stage:e.stage}:{},...e.note?{note:e.note}:{},...e.url?{url:e.url}:{},...e.origin?{origin:e.origin}:{},...e.urlNote?{urlNote:e.urlNote}:{},createdAt:e.createdAt,...e.startedAt!==void 0?{startedAt:e.startedAt}:{},...e.endedAt!==void 0?{endedAt:e.endedAt}:{},...n!==void 0?{ranMs:n}:{},...e.exit?{exit:e.exit}:{}},services:i,totals:{lastMb:i.reduce((l,s)=>l+s.lastMb,0),...a.length?{budgetMb:a.reduce((l,s)=>l+(s.budgetMb??0),0)}:{}},kills:e.kills??[],...e.killsMore?{killsMore:e.killsMore}:{},...e.engineLost?{engineLost:e.engineLost}:{},...e.vm?{vm:e.vm}:{},...e.cleanup?{cleanup:e.cleanup}:{},...e.warnings?.length?{warnings:e.warnings}:{},...c.length?{unlabeled:c}:{},...e.watch?{watch:e.watch}:{},files:{...e.files.samples?{samples:e.files.samples}:{},...e.files.events?{events:e.files.events}:{},log:e.files.log,artifacts:e.files.artifacts}}}h(dockerRunReport,"dockerRunReport"),u(dockerRunReport,"dockerRunReport");const d=u(e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),"when"),g=u(e=>{const t=Math.round(e/1e3);if(t<60)return`${t} s`;const o=Math.floor(t/60);return o<60?`${o} min${t%60?` ${t%60} s`:""}`:`${Math.floor(o/60)} h${o%60?` ${o%60} min`:""}`},"lasted"),$=u((e,t,o)=>`${e} ${e===1?t:o}`,"plural");export{d as dockerTime,g as dockerLasted};function v(e){const t=e.exit?e.exit.signal?`its command was ended by ${e.exit.signal}`:`its command exited ${e.exit.code}`:void 0,o=[e.ranMs!==void 0?`${e.ended?"ran":"running for"} ${g(e.ranMs)}`:void 0,e.startedAt!==void 0?`started ${d(e.startedAt)}`:`created ${d(e.createdAt)}`,e.endedAt!==void 0?`ended ${d(e.endedAt)}`:void 0].filter(Boolean).join(", ");return`${{starting:"starting: nothing of the job has run yet",preparing:"preparing: its prepare steps run",running:"running",cleaning:`cleaning up${t?`: ${t}`:""}`,passed:`passed${t?`: ${t}`:""}`,failed:`failed${t?`: ${t}`:""}`,cancelled:"cancelled",timeout:"timed out",errored:"errored",lost:`lost: its runner died, so nobody knows how it would have ended${t?` (${t})`:""}`}[e.state]} \xB7 ${o}`}h(v,"w"),u(v,"stateText");function f(e){const t=e[0].map((o,i)=>Math.max(...e.map(a=>(a[i]??"").length)));return e.map(o=>o.map((i,a)=>a===0?i.padEnd(t[a]):a===o.length-1?i:i.padStart(t[a])).join(" ").trimEnd())}h(f,"k"),u(f,"table");export function dockerRunReportText(e){const{run:t,vm:o,watch:i,cleanup:a}=e,n=[`Docker run ${t.id} \u2014 job \xAB${t.job}\xBB (${t.kind}), ${t.project?`Compose project ${t.project}`:t.scope==="none"?"nothing in Docker":"no Compose project: its containers by the run's labels"}`,` ${v(t)}`,` in ${t.root}${t.context?` \xB7 Docker context ${t.context}`:""}`];t.stage&&n.push(` stage: ${t.stage}`),t.note&&n.push(` ${t.note}`);for(const s of e.warnings??[])n.push(` ! ${s}`);t.url?n.push(` URL: ${t.url}`):t.urlNote&&n.push(` no URL: ${t.urlNote}`),n.push("");const c=i?.samples?`${$(i.samples,"sample","samples")}${i.sampledAt!==void 0?`, the last at ${d(i.sampledAt)}`:""}`:"no sample was taken";if(n.push(t.scope==="none"?"Memory: the job declares nothing in Docker's VM \u2014 its commands were given no labels, and Docker was not asked about it.":`Memory by service, MiB \u2014 ${c}`),e.services.length){const s=u(r=>r===void 0?"\u2013":String(r),"figure"),m=u(r=>[r.overMb!==void 0?`OVER its budget by ${r.overMb}`:void 0,r.oomKilled?"killed for memory":void 0,r.exitCode!==void 0?`exit ${r.exitCode}`:void 0,r.unsampled?"never sampled":void 0].filter(Boolean).join(" \xB7 "),"remark");n.push(...f([["service","now","peak","budget","limit",""],...e.services.map(r=>[r.name,r.unsampled?"\u2013":String(r.lastMb),r.unsampled?"\u2013":String(r.peakMb),s(r.budgetMb),s(r.limitMb),m(r)]),["all",String(e.totals.lastMb),"",s(e.totals.budgetMb),"",""]]).map(r=>` ${r}`));const p=e.services.filter(r=>r.overMb!==void 0);p.length&&n.push(` ${$(p.length,"service","services")} over what ${p.length===1?"it declares":"they declare"}: raise \`jobs.${t.job}.budget.services\` in lensmcp.json to what ${p.length===1?"it takes":"they take"} \u2014 the queue lets the job in by these figures.`)}else t.scope!=="none"&&n.push(" No container of the run was seen.");n.push("");const l=e.kills.length+(e.killsMore??0);n.push(l?`Killed for memory: ${l}`:"Killed for memory: none");for(const s of e.kills){const m=[s.limitMb!==void 0?`at its ${s.limitMb} MiB limit`:"no limit of its own: the VM ran out, or it was not read",s.peakMb!==void 0?`peak ${s.peakMb} MiB`:"never sampled",s.budgetMb!==void 0?`budget ${s.budgetMb} MiB`:void 0,s.seen==="event"?"seen live":"found by the inspect: the live stream did not tell it"].filter(Boolean).join(" \xB7 ");n.push(` ${d(s.at)} ${s.service}${s.name?` (${s.name})`:""} ${m}`)}if(e.killsMore&&n.push(` \u2026 and ${e.killsMore} more, not listed`),e.engineLost){const s=e.engineLost;n.push(""),n.push(`Docker stopped answering at ${d(s.at)} \u2014 ${s.why}`),s.backAt!==void 0&&n.push(` it answered again at ${d(s.backAt)}`),s.killed?.length&&n.push(` found killed for memory once it was gone: ${s.killed.join(", ")} \u2014 they went with the engine`)}o&&(n.push(""),n.push(`Docker's VM: ${o.totalMb} MiB \xB7 ${o.read==="estimate"?"about ":""}${o.availableAtAdmissionMb} MiB free when the run was let in (${o.read==="estimate"?"an estimate: its own figure could not be read":"the VM's own figure"})`+(o.minAvailableMb!==void 0?` \xB7 lowest ${o.minAvailableMb} MiB while it ran`:" \xB7 not read while it ran")+(o.lastAvailableMb!==void 0?` \xB7 ${o.lastAvailableMb} MiB at the last read${o.sampledAt!==void 0?` (${d(o.sampledAt)})`:""}`:""))),n.push(""),a?a.done?n.push(`Cleanup: by ${a.by==="project"?"the project's own end (LensMCP looked, and found nothing)":a.by} at ${d(a.at)} \u2014 nothing of the run is left`):n.push(`Cleanup: OWED (${a.by}, ${d(a.at)}) \u2014 ${a.why??"something that carries the run's labels is left"}${a.left?.length?` \u2014 left: ${a.left.join(", ")}`:""}`):n.push(t.ended?"Cleanup: not recorded \u2014 its guard, or the sweep, has it":"Cleanup: not yet \u2014 the run has not ended"),a?.unlabeled?.length&&n.push(` in its Compose project without the run's labels, never removed: ${a.unlabeled.join(", ")}`);for(const s of e.unlabeled??[])n.push(` ${s}`);if(i?.notes?.length||i?.streamRestarts){n.push(""),n.push("What the watcher could not do:"),i.streamRestarts&&n.push(` the live stream ended ${$(i.streamRestarts,"time","times")} while Docker answered, and was started again`);for(const s of i.notes??[])n.push(` ${s}`)}return n.push(""),n.push(`Files: ${[e.files.samples?`samples ${e.files.samples}`:void 0,e.files.events?`events ${e.files.events}`:void 0,`log ${e.files.log}`].filter(Boolean).join(" \xB7 ")}`),n.join(`
2
2
  `)}h(dockerRunReportText,"dockerRunReportText"),u(dockerRunReportText,"dockerRunReportText");
@@ -23,7 +23,15 @@ export interface HttpExchangeBody {
23
23
  * compressed answer too big to unpack).
24
24
  */
25
25
  omitted?: 'binary' | 'form-data' | 'stream' | 'ai' | 'encoded';
26
+ /**
27
+ * The read stopped before the body ended — `size` is then only what arrived, and `truncated` is set: `time`, it ran
28
+ * past the read's bound (5 minutes from the answer's first byte, 30 for an AI call kept whole); `broken`, the caller
29
+ * or the network cut it. Absent from a capture before it said (foodguard-302).
30
+ */
31
+ cut?: HttpExchangeCut;
26
32
  }
33
+ /** Why a capture stopped reading an answer before its end. `size`: a bound of what is kept (a stream's events). */
34
+ export type HttpExchangeCut = 'time' | 'broken' | 'size';
27
35
  export interface HttpExchangeStreamEvent {
28
36
  /** Since the request started. */
29
37
  atMs: number;
@@ -72,6 +80,7 @@ export interface HttpExchange {
72
80
  decoded?: number;
73
81
  };
74
82
  body?: HttpExchangeBody;
83
+ /** `cut`: not every event was kept — `cutBy` says why, from a capture that says it. */
75
84
  stream?: {
76
85
  protocol: 'sse';
77
86
  firstEventMs?: number;
@@ -79,6 +88,7 @@ export interface HttpExchange {
79
88
  bytes: number;
80
89
  total: number;
81
90
  cut?: boolean;
91
+ cutBy?: HttpExchangeCut;
82
92
  };
83
93
  };
84
94
  /** What the lens removed before storing: header names, and body fields (paths). */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * LensMCP's own host names (planning/canvas D7, D9, phase H) and the links built on them.
3
+ *
4
+ * The dashboard lives at `https://lensmcp.localhost/<key>/`, a canvas's frame at `https://lensmcp.canvas.localhost`
5
+ * (`CANVAS_FRAME_HOST`, canvas.ts). `.localhost` is loopback by standard (RFC 6761): no `/etc/hosts` line, no mDNS miss
6
+ * (`.local` waited about 5 s per AAAA lookup for Bonjour).
7
+ *
8
+ * `lensmcp.local`, the name before the move, stays answered for two releases — through 1.27.x: it stays a name on the
9
+ * gateway's certificate; a browser's page load there is sent on with a 308 to the same path on the new host; anything
10
+ * else (a script, an open tab's API call, a worker Mac's tunnel) is served as the new host would be, an alias. A record
11
+ * written before the move is read as the new host ({@link currentLensHost}).
12
+ *
13
+ * Two copies, held equal by their specs, because neither package depends on this one at runtime: the gateway's
14
+ * (`@lensmcp/cluster` `runtime/lens-hosts.ts`) and the CLI's (`libs/cli` `dashboard-link.ts`).
15
+ */
16
+ /** The dashboard's host (D7). */
17
+ export declare const LENS_HOST = "lensmcp.localhost";
18
+ /** The dashboard's host before the move: an alias and a 308 through the compatibility window. */
19
+ export declare const LEGACY_LENS_HOST = "lensmcp.local";
20
+ /** The key-free path of a canvas, `https://lensmcp.localhost/canvas/<id>` (§8 Links): the workspace key `canvas` is reserved. */
21
+ export declare const CANVAS_LINK_PATH = "/canvas";
22
+ export interface LensLinkOptions {
23
+ /** The gateway's front door port. The scheme's own (443) is left out of the link. */
24
+ port?: number;
25
+ /** The dashboard host the running gateway serves (an operator's `lensHost`). Default {@link LENS_HOST}. */
26
+ host?: string;
27
+ }
28
+ /** `https://lensmcp.localhost`, with the front door's port when it is not 443. */
29
+ export declare function lensOrigin(opts?: LensLinkOptions): string;
30
+ /**
31
+ * A dashboard page through the gateway (§8 Links: what replaces every hard-coded dashboard link): `base` is the
32
+ * dashboard's mount (`/<key>`), `path` a page under it (`canvases/cv-…`), empty for its home.
33
+ */
34
+ export declare function dashboardLink(base: string, path?: string, opts?: LensLinkOptions): string;
35
+ /** The canonical, key-free link to a canvas: the gateway looks the id up and sends the browser to the dashboard that serves it. */
36
+ export declare function canvasKeyFreeLink(id: string, opts?: LensLinkOptions): string;
37
+ /** The front door's port as the gateway tells its children (`LENSMCP_GATEWAY_PORTS`, the first one) — none when not told. */
38
+ export declare function gatewayPortFromEnv(env: Readonly<Record<string, string | undefined>>): number | undefined;
39
+ /** A host as written before the move, as it is now: `lensmcp.local` is `lensmcp.localhost`; any other name is itself. */
40
+ export declare function currentLensHost(host: string): string;
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});var c=Object.defineProperty,n=t((r,e)=>c(r,"name",{value:e,configurable:!0}),"r");export const LENS_HOST="lensmcp.localhost",LEGACY_LENS_HOST="lensmcp.local",CANVAS_LINK_PATH="/canvas";export function lensOrigin(r={}){const e=r.port!==void 0&&r.port!==443?`:${r.port}`:"";return`https://${r.host||LENS_HOST}${e}`}t(lensOrigin,"lensOrigin"),n(lensOrigin,"lensOrigin");export function dashboardLink(r,e="",o={}){const s=r.replace(/\/+$/,"");return`${lensOrigin(o)}${s}/${e.replace(/^\/+/,"")}`}t(dashboardLink,"dashboardLink"),n(dashboardLink,"dashboardLink");export function canvasKeyFreeLink(r,e={}){return`${lensOrigin(e)}${CANVAS_LINK_PATH}/${r}`}t(canvasKeyFreeLink,"canvasKeyFreeLink"),n(canvasKeyFreeLink,"canvasKeyFreeLink");export function gatewayPortFromEnv(r){const e=Number((r.LENSMCP_GATEWAY_PORTS??"").split(",")[0]);return Number.isInteger(e)&&e>0&&e<65536?e:void 0}t(gatewayPortFromEnv,"gatewayPortFromEnv"),n(gatewayPortFromEnv,"gatewayPortFromEnv");export function currentLensHost(r){return r.trim().toLowerCase()===LEGACY_LENS_HOST?LENS_HOST:r}t(currentLensHost,"currentLensHost"),n(currentLensHost,"currentLensHost");
@@ -87,6 +87,14 @@ export interface LintBase {
87
87
  moreFiles?: number;
88
88
  errors: LintBaseError[];
89
89
  moreErrors?: number;
90
+ /**
91
+ * What of the above the person's ignores hold (`.lensmcp/lint/ignores.json`, lint-ignores.ts) — by file, each rule in
92
+ * the project that owns the file, with how many errors and warnings: `[file, rule, project, errors, warnings]`, up to a
93
+ * cap (`moreHidden` past it). The counts above are of everything held; a run built on this leaves these out of its
94
+ * verdict. Absent from a lens from before it said (foodguard-305), and when nothing is ignored.
95
+ */
96
+ hidden?: Array<[string, string, string, number, number]>;
97
+ moreHidden?: number;
90
98
  }
91
99
  export interface LintBaseAnswer {
92
100
  schemaVersion: 1;
@@ -126,6 +126,26 @@ export declare function lintIgnoredSummary(read: LintIgnoresRead, hid: ReadonlyM
126
126
  errors: number;
127
127
  warnings: number;
128
128
  }>): LintIgnoredSummary | undefined;
129
+ /**
130
+ * The split an answer makes, for a reader that counts findings one by one (`lensmcp lint`'s plain and cold runs): `hides`
131
+ * says whether an ignore holds a finding — and counts it under that ignore — and `summary` is the block the answer
132
+ * carries, as {@link lintIgnoredSummary} makes it. `n` counts a row of findings at once.
133
+ */
134
+ export interface LintIgnoreTally {
135
+ hides(finding: {
136
+ rule: string | null | undefined;
137
+ project: string | undefined;
138
+ scope?: string | undefined;
139
+ }, severity: 'error' | 'warning', n?: number): LintIgnore | undefined;
140
+ summary(): LintIgnoredSummary | undefined;
141
+ }
142
+ export declare function lintIgnoreTally(read: LintIgnoresRead): LintIgnoreTally;
143
+ /**
144
+ * What the person ignored, as a text answer prints it — the `lint` tool's text, `lensmcp lint` plain, by unit and cold
145
+ * alike: how many it left out, then each rule in its project that hides something now, with why; then what in the file
146
+ * does not hold. Indented under the answer's verdict line.
147
+ */
148
+ export declare function lintIgnoredLines(ignored: LintIgnoredSummary | undefined): string[];
129
149
  /** What became of a proposal: open for the person, accepted (the ignore is written), or declined. */
130
150
  export type LintIgnoreProposalState = 'open' | 'accepted' | 'declined';
131
151
  /** An agent's proposal to ignore a rule in a project — data for the person, who accepts or declines it on the Lint page. */
@@ -1,2 +1,2 @@
1
- "use strict";var y=Object.defineProperty;var p=(e,t)=>y(e,"name",{value:t,configurable:!0});var j=Object.defineProperty,l=p((e,t)=>j(e,"name",{value:t,configurable:!0}),"l");export const LINT_IGNORES_FILE=".lensmcp/lint/ignores.json",LINT_IGNORE_LIMITS={rule:200,project:200,reason:500,evidence:1e3,by:80,ignores:500},LINT_IGNORED_RULES_SAID=50,LINT_IGNORED_NOTE="The person ignored these lints in the repository (each a rule in a project, with why): they are left out of the counts, the verdict and the status \u2014 do not fix them, and do not edit the ESLint config or this file for them. ESLint itself (`nx lint`) still reports them. To ask for another, `lint_ignore_propose`; only the person accepts.";const I=l(e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,"obj"),u=l(e=>typeof e=="string"&&e.trim()?e.replace(/\s+/g," ").trim():void 0,"text");export function lintIgnoreKey(e,t){return`${t}\0${e}`}p(lintIgnoreKey,"lintIgnoreKey"),l(lintIgnoreKey,"lintIgnoreKey");export function checkLintIgnore(e){const t=u(e.rule),n=u(e.project),r=u(e.reason),o=LINT_IGNORE_LIMITS;return t?t==="fatal"?{problem:"a file ESLint could not parse is never ignored \u2014 fix it"}:t.length>o.rule?{problem:`the rule is at most ${o.rule} characters`}:n?n.length>o.project?{problem:`the project is at most ${o.project} characters`}:r?r.length>o.reason?{problem:`the reason is at most ${o.reason} characters`}:{rule:t,project:n,reason:r}:{problem:"say why it is not to be fixed \u2014 the reason is what a teammate and an agent read"}:{problem:"name the project that owns the files"}:{problem:"name the rule (ESLint\u2019s rule id, as the finding names it)"}}p(checkLintIgnore,"checkLintIgnore"),l(checkLintIgnore,"checkLintIgnore");export function parseLintIgnores(e){if(e===void 0||!e.trim())return{ignores:[],problems:[]};let t;try{t=JSON.parse(e)}catch(i){return{ignores:[],problems:[`${LINT_IGNORES_FILE} is not JSON (${i instanceof Error?i.message:String(i)}) \u2014 no lint is ignored until it is`]}}const n=I(t),r=n?n.ignores:void 0;if(!n||!Array.isArray(r))return{ignores:[],problems:[`${LINT_IGNORES_FILE} holds no "ignores" list \u2014 no lint is ignored until it does`]};const o=[],a=[],s=new Set;return r.forEach((i,h)=>{const g=I(i);if(!g){a.push(`ignores[${h}] is not an object`);return}const c=checkLintIgnore(g);if("problem"in c){a.push(`ignores[${h}]: ${c.problem}`);return}const f=lintIgnoreKey(c.rule,c.project);if(s.has(f)){a.push(`ignores[${h}]: ${c.rule} in ${c.project} is ignored above already \u2014 the first stands`);return}if(o.length>=LINT_IGNORE_LIMITS.ignores){a.push(`ignores[${h}]: past ${LINT_IGNORE_LIMITS.ignores} ignores \u2014 the rest are not read`);return}s.add(f);const b=u(g.by)?.slice(0,LINT_IGNORE_LIMITS.by),m=u(g.at),d=u(g.proposal);o.push({...c,...b?{by:b}:{},...m&&!Number.isNaN(Date.parse(m))?{at:m}:{},...d?{proposal:d.slice(0,40)}:{}})}),{ignores:o,problems:a}}p(parseLintIgnores,"parseLintIgnores"),l(parseLintIgnores,"parseLintIgnores");export function lintIgnoresText(e){const t=[...e].sort((r,o)=>r.project<o.project?-1:r.project>o.project?1:r.rule<o.rule?-1:r.rule>o.rule?1:0),n=l(r=>({rule:r.rule,project:r.project,reason:r.reason,...r.by?{by:r.by}:{},...r.at?{at:r.at}:{},...r.proposal?{proposal:r.proposal}:{}}),"entry");return`${JSON.stringify({version:1,ignores:t.map(n)},null,2)}
2
- `}p(lintIgnoresText,"lintIgnoresText"),l(lintIgnoresText,"lintIgnoresText");export function withLintIgnore(e,t){const n=lintIgnoreKey(t.rule,t.project);return[...e.filter(r=>lintIgnoreKey(r.rule,r.project)!==n),t]}p(withLintIgnore,"withLintIgnore"),l(withLintIgnore,"withLintIgnore");export function withoutLintIgnore(e,t,n){const r=lintIgnoreKey(t,n);return e.filter(o=>lintIgnoreKey(o.rule,o.project)!==r)}p(withoutLintIgnore,"withoutLintIgnore"),l(withoutLintIgnore,"withoutLintIgnore");export function lintIgnoreMatcher(e){if(!e.length)return()=>{};const t=new Map(e.map(n=>[lintIgnoreKey(n.rule,n.project),n]));return({rule:n,project:r,scope:o})=>{if(!n||n==="fatal")return;const a=r??o;return a===void 0?void 0:t.get(lintIgnoreKey(n,a))}}p(lintIgnoreMatcher,"lintIgnoreMatcher"),l(lintIgnoreMatcher,"lintIgnoreMatcher");export function lintIgnoredSummary(e,t){if(!e.ignores.length&&!e.problems.length)return;let n=0,r=0;const o=e.ignores.map(s=>{const i=t.get(lintIgnoreKey(s.rule,s.project))??{errors:0,warnings:0};return n+=i.errors,r+=i.warnings,{rule:s.rule,project:s.project,reason:s.reason,...s.by?{by:s.by}:{},...s.at?{at:s.at}:{},errors:i.errors,warnings:i.warnings}}).map((s,i)=>({r:s,i})).sort((s,i)=>i.r.errors-s.r.errors||i.r.warnings-s.r.warnings||s.i-i.i).map(({r:s})=>s),a=o.length-LINT_IGNORED_RULES_SAID;return{file:LINT_IGNORES_FILE,errors:n,warnings:r,rules:o.slice(0,LINT_IGNORED_RULES_SAID),...a>0?{moreRules:a}:{},...e.problems.length?{problems:e.problems.slice(0,10)}:{},note:LINT_IGNORED_NOTE}}p(lintIgnoredSummary,"lintIgnoredSummary"),l(lintIgnoredSummary,"lintIgnoredSummary");export const LINT_IGNORE_PROPOSAL_LIMITS={open:30,kept:200,requestId:200};
1
+ "use strict";var $=Object.defineProperty;var u=(r,t)=>$(r,"name",{value:t,configurable:!0});var w=Object.defineProperty,a=u((r,t)=>w(r,"name",{value:t,configurable:!0}),"l");export const LINT_IGNORES_FILE=".lensmcp/lint/ignores.json",LINT_IGNORE_LIMITS={rule:200,project:200,reason:500,evidence:1e3,by:80,ignores:500},LINT_IGNORED_RULES_SAID=50,LINT_IGNORED_NOTE="The person ignored these lints in the repository (each a rule in a project, with why): they are left out of the counts, the verdict and the status \u2014 do not fix them, and do not edit the ESLint config or this file for them. ESLint itself (`nx lint`) still reports them. To ask for another, `lint_ignore_propose`; only the person accepts.";const y=a(r=>r&&typeof r=="object"&&!Array.isArray(r)?r:void 0,"obj"),g=a(r=>typeof r=="string"&&r.trim()?r.replace(/\s+/g," ").trim():void 0,"text");export function lintIgnoreKey(r,t){return`${t}\0${r}`}u(lintIgnoreKey,"lintIgnoreKey"),a(lintIgnoreKey,"lintIgnoreKey");export function checkLintIgnore(r){const t=g(r.rule),o=g(r.project),e=g(r.reason),n=LINT_IGNORE_LIMITS;return t?t==="fatal"?{problem:"a file ESLint could not parse is never ignored \u2014 fix it"}:t.length>n.rule?{problem:`the rule is at most ${n.rule} characters`}:o?o.length>n.project?{problem:`the project is at most ${n.project} characters`}:e?e.length>n.reason?{problem:`the reason is at most ${n.reason} characters`}:{rule:t,project:o,reason:e}:{problem:"say why it is not to be fixed \u2014 the reason is what a teammate and an agent read"}:{problem:"name the project that owns the files"}:{problem:"name the rule (ESLint\u2019s rule id, as the finding names it)"}}u(checkLintIgnore,"checkLintIgnore"),a(checkLintIgnore,"checkLintIgnore");export function parseLintIgnores(r){if(r===void 0||!r.trim())return{ignores:[],problems:[]};let t;try{t=JSON.parse(r)}catch(i){return{ignores:[],problems:[`${LINT_IGNORES_FILE} is not JSON (${i instanceof Error?i.message:String(i)}) \u2014 no lint is ignored until it is`]}}const o=y(t),e=o?o.ignores:void 0;if(!o||!Array.isArray(e))return{ignores:[],problems:[`${LINT_IGNORES_FILE} holds no "ignores" list \u2014 no lint is ignored until it does`]};const n=[],l=[],s=new Set;return e.forEach((i,p)=>{const h=y(i);if(!h){l.push(`ignores[${p}] is not an object`);return}const c=checkLintIgnore(h);if("problem"in c){l.push(`ignores[${p}]: ${c.problem}`);return}const d=lintIgnoreKey(c.rule,c.project);if(s.has(d)){l.push(`ignores[${p}]: ${c.rule} in ${c.project} is ignored above already \u2014 the first stands`);return}if(n.length>=LINT_IGNORE_LIMITS.ignores){l.push(`ignores[${p}]: past ${LINT_IGNORE_LIMITS.ignores} ignores \u2014 the rest are not read`);return}s.add(d);const b=g(h.by)?.slice(0,LINT_IGNORE_LIMITS.by),f=g(h.at),I=g(h.proposal);n.push({...c,...b?{by:b}:{},...f&&!Number.isNaN(Date.parse(f))?{at:f}:{},...I?{proposal:I.slice(0,40)}:{}})}),{ignores:n,problems:l}}u(parseLintIgnores,"parseLintIgnores"),a(parseLintIgnores,"parseLintIgnores");export function lintIgnoresText(r){const t=[...r].sort((e,n)=>e.project<n.project?-1:e.project>n.project?1:e.rule<n.rule?-1:e.rule>n.rule?1:0),o=a(e=>({rule:e.rule,project:e.project,reason:e.reason,...e.by?{by:e.by}:{},...e.at?{at:e.at}:{},...e.proposal?{proposal:e.proposal}:{}}),"entry");return`${JSON.stringify({version:1,ignores:t.map(o)},null,2)}
2
+ `}u(lintIgnoresText,"lintIgnoresText"),a(lintIgnoresText,"lintIgnoresText");export function withLintIgnore(r,t){const o=lintIgnoreKey(t.rule,t.project);return[...r.filter(e=>lintIgnoreKey(e.rule,e.project)!==o),t]}u(withLintIgnore,"withLintIgnore"),a(withLintIgnore,"withLintIgnore");export function withoutLintIgnore(r,t,o){const e=lintIgnoreKey(t,o);return r.filter(n=>lintIgnoreKey(n.rule,n.project)!==e)}u(withoutLintIgnore,"withoutLintIgnore"),a(withoutLintIgnore,"withoutLintIgnore");export function lintIgnoreMatcher(r){if(!r.length)return()=>{};const t=new Map(r.map(o=>[lintIgnoreKey(o.rule,o.project),o]));return({rule:o,project:e,scope:n})=>{if(!o||o==="fatal")return;const l=e??n;return l===void 0?void 0:t.get(lintIgnoreKey(o,l))}}u(lintIgnoreMatcher,"lintIgnoreMatcher"),a(lintIgnoreMatcher,"lintIgnoreMatcher");export function lintIgnoredSummary(r,t){if(!r.ignores.length&&!r.problems.length)return;let o=0,e=0;const n=r.ignores.map(s=>{const i=t.get(lintIgnoreKey(s.rule,s.project))??{errors:0,warnings:0};return o+=i.errors,e+=i.warnings,{rule:s.rule,project:s.project,reason:s.reason,...s.by?{by:s.by}:{},...s.at?{at:s.at}:{},errors:i.errors,warnings:i.warnings}}).map((s,i)=>({r:s,i})).sort((s,i)=>i.r.errors-s.r.errors||i.r.warnings-s.r.warnings||s.i-i.i).map(({r:s})=>s),l=n.length-LINT_IGNORED_RULES_SAID;return{file:LINT_IGNORES_FILE,errors:o,warnings:e,rules:n.slice(0,LINT_IGNORED_RULES_SAID),...l>0?{moreRules:l}:{},...r.problems.length?{problems:r.problems.slice(0,10)}:{},note:LINT_IGNORED_NOTE}}u(lintIgnoredSummary,"lintIgnoredSummary"),a(lintIgnoredSummary,"lintIgnoredSummary");export function lintIgnoreTally(r){const t=lintIgnoreMatcher(r.ignores),o=new Map;return{hides(e,n,l=1){const s=t(e);if(!s)return;const i=lintIgnoreKey(s.rule,s.project),p=o.get(i)??{errors:0,warnings:0};return n==="error"?p.errors+=l:p.warnings+=l,o.set(i,p),s},summary:a(()=>lintIgnoredSummary(r,o),"summary")}}u(lintIgnoreTally,"lintIgnoreTally"),a(lintIgnoreTally,"lintIgnoreTally");const m=10,j=a((r,t)=>`${r} ${t}${r===1?"":"s"}`,"counted");export function lintIgnoredLines(r){if(!r)return[];const t=[],o=r.rules.filter(n=>n.errors||n.warnings),e=[r.errors?j(r.errors,"error"):"",r.warnings?j(r.warnings,"warning"):""].filter(Boolean).join(", ");e&&t.push(` ignored (${r.file}): ${e} left out \u2014 not counted, not to be fixed`);for(const n of o.slice(0,m))t.push(` ${n.rule} in ${n.project} \u2014 ${n.reason}`);o.length>m&&t.push(` and ${o.length-m} more (--json lists them)`);for(const n of r.problems??[])t.push(` ${r.file}: ${n}`);return t}u(lintIgnoredLines,"lintIgnoredLines"),a(lintIgnoredLines,"lintIgnoredLines");export const LINT_IGNORE_PROPOSAL_LIMITS={open:30,kept:200,requestId:200};
@@ -1,4 +1,4 @@
1
- import type { DashSystemScope, DashSystemUnit } from './system-report.js';
1
+ import { type DashSystemScope, type DashSystemUnit } from './system-report.js';
2
2
  import type { DashTeamHealthStatus } from './team.js';
3
3
  /**
4
4
  * The overseer's findings (planning/team/15-the-overseer.md S3): one problem each, kept until it is fixed or dismissed —
@@ -17,11 +17,19 @@ export type DashFindingState = 'open' | 'proposed' | 'applied' | 'fixed' | 'dism
17
17
  export type DashFindingVerdict = 'true' | 'false-alarm';
18
18
  /** Whose the problem is: the project's (its team, its code), LensMCP's, the host's, or the person's to decide. */
19
19
  export type DashFindingCause = 'project' | 'lensmcp' | 'host' | 'person';
20
- /** One reading of a finding's checks that was not ok — written when the status or the value moved. */
20
+ /** One reading of a finding's checks that was not ok — written when the status, the value or the check moved. */
21
21
  export interface DashFindingSighting {
22
22
  at: number;
23
23
  status: DashTeamHealthStatus;
24
24
  value: number;
25
+ /**
26
+ * The check it is the reading of — the worst of the finding's checks then (`machine/machine.memory`). A finding over
27
+ * several checks reads each in its own unit (issues/closed/overseer-113: machine-09 printed memory % free as «load
28
+ * 46.0»). Absent: a record from before, a retrospective's goal count, a grade's value — the finding's `unit` then.
29
+ */
30
+ check?: string;
31
+ /** That check's unit; absent with a check: a count. */
32
+ unit?: DashSystemUnit;
25
33
  }
26
34
  /** A change to one task, as `POST /api/team/task/operate` makes it (store.operate). */
27
35
  export interface DashFindingOperate {
@@ -274,8 +282,11 @@ export interface DashFinding {
274
282
  /** How its applied proposal is judged on the goals after it, and the newest grade (planning/team/18 RT-D16). */
275
283
  acceptance?: DashFindingAcceptance;
276
284
  grade?: DashFindingGrade;
277
- /** A retrospective wrote it (planning/team/18 RT-D1) — the overseer's otherwise. */
278
- source?: 'retrospective';
285
+ /**
286
+ * A retrospective wrote it (planning/team/18 RT-D1), or the repository census raised it when its thresholds passed
287
+ * (`repo.hygiene`, issues/closed/foodguard-307) — the overseer's otherwise.
288
+ */
289
+ source?: 'retrospective' | 'census';
279
290
  /** `<repo>:<target>:<signal>` (RT-D8): a new sighting of the same cause merges into it as another goal (RT-D9). */
280
291
  causeKey?: string;
281
292
  /** The independent goals that showed its cause, oldest first. */
@@ -324,6 +335,12 @@ export interface DashFindingApplied {
324
335
  finding: DashFinding;
325
336
  results: DashFindingActionResult[];
326
337
  }
338
+ /**
339
+ * A sighting's value as the terminal and the Inbox print it: in its own check's unit, and named by that check's id when
340
+ * the finding holds more than one («machine.memory 37 %»). A sighting from before it kept its check reads in the
341
+ * finding's unit, as it always did (issues/closed/overseer-113).
342
+ */
343
+ export declare function findingSightingValue(s: DashFindingSighting, f: Pick<DashFinding, 'unit' | 'checks'>): string;
327
344
  /** Still the overseer's or the person's to settle: open, proposed or applied (not yet fixed). */
328
345
  export declare function findingLive(f: Pick<DashFinding, 'state'>): boolean;
329
346
  /**
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var i=(e,n)=>c(e,"name",{value:n,configurable:!0});var u=Object.defineProperty,o=i((e,n)=>u(e,"name",{value:n,configurable:!0}),"s");export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingLive(e){return e.state==="open"||e.state==="proposed"||e.state==="applied"}i(findingLive,"findingLive"),o(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(s=>FINDING_RUN_KINDS.includes(s.kind)||s.kind==="issue"&&n.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),o(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,s){const r=`repo:${n}/team.${s}`;return e.filter(t=>findingLive(t)&&t.checks.includes(r))}i(findingsForCheck,"findingsForCheck"),o(findingsForCheck,"findingsForCheck");
1
+ "use strict";var r=Object.defineProperty;var s=(e,n)=>r(e,"name",{value:n,configurable:!0});var u=Object.defineProperty,o=s((e,n)=>u(e,"name",{value:n,configurable:!0}),"s");import{systemValue as l}from"./system-report.js";export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingSightingValue(e,n){const i=l(e.value,e.check?e.unit:n.unit);if(!e.check||n.checks.length<=1)return i;const t=e.check.slice(e.check.lastIndexOf("/")+1),c=t.slice(t.lastIndexOf(".")+1);return i.startsWith(`${c} `)?`${t}${i.slice(c.length)}`:`${t} ${i}`}s(findingSightingValue,"findingSightingValue"),o(findingSightingValue,"findingSightingValue");export function findingLive(e){return e.state==="open"||e.state==="proposed"||e.state==="applied"}s(findingLive,"findingLive"),o(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(i=>FINDING_RUN_KINDS.includes(i.kind)||i.kind==="issue"&&n.issuesFolder===!0)}s(findingRunsActions,"findingRunsActions"),o(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,i){const t=`repo:${n}/team.${i}`;return e.filter(c=>findingLive(c)&&c.checks.includes(t))}s(findingsForCheck,"findingsForCheck"),o(findingsForCheck,"findingsForCheck");
package/lib/peers.d.ts CHANGED
@@ -648,6 +648,63 @@ export interface StoreReply {
648
648
  result?: unknown;
649
649
  error?: StoreCallError;
650
650
  }
651
+ /**
652
+ * The canvas tools a launch on a worker runs at the organizer (planning/canvas/00-plan.md § 6 «Worker Macs», phase 14;
653
+ * issues canvas-03) — all of them: a canvas's home is the organizer's store, so its writes, reads, waits and renders go
654
+ * there. `canvas_resource` is `canvas://{id}`.
655
+ */
656
+ export declare const CANVAS_CALL_TOOLS: readonly ["canvas_write", "canvas_data", "canvas_get", "canvas_render", "canvas_list", "canvas_wait", "canvas_comment", "canvas_resource"];
657
+ export type CanvasCallTool = (typeof CANVAS_CALL_TOOLS)[number];
658
+ /**
659
+ * `canvas.call` (worker → organizer) — canvas phase 14: one canvas tool, run at the organizer as one launch, over the
660
+ * channel the team's store calls take (the worker daemon's `store.sock`, then its link). The organizer's hub resolves
661
+ * the key as it does for a `store.call`: the launch's placement decides the project (its repository's, at the
662
+ * organizer) and its goal the links a write may carry. Its answer is a {@link CanvasReply}, carried back as the
663
+ * `result` of the envelope's `ack`. Schema: {@link CanvasCallSchema}.
664
+ */
665
+ export interface CanvasCall {
666
+ v: 1;
667
+ kind: 'canvas.call';
668
+ /** The reply carries it back. */
669
+ id: string;
670
+ tool: CanvasCallTool;
671
+ /** The tool's input, as the worker's server took it — checked again against the tool's schema at the organizer. */
672
+ input: Record<string, unknown>;
673
+ /** The worker's MCP session and client, as its server knows them: the provenance of what the call writes. */
674
+ caller?: {
675
+ session?: string;
676
+ client?: string;
677
+ };
678
+ /** `LENSMCP_PEER_LAUNCH_KEY`. Never logged, listed or answered. */
679
+ launchKey: string;
680
+ }
681
+ /** A file an answer hands back to the worker, which saves it under its own workspace's `.lensmcp/`. */
682
+ export interface CanvasCallFile {
683
+ /**
684
+ * `render`: a picture or a page of a render (`.lensmcp/renders/`); `mirror`: a part too big to answer inline
685
+ * (`.lensmcp/canvases/`); `asset`: a file the person attached to an answer (`.lensmcp/canvases/assets/`, canvas-11).
686
+ */
687
+ kind: 'render' | 'mirror' | 'asset';
688
+ /** Its file name, {@link CANVAS_CALL_FILE_NAME}: never a folder. */
689
+ name: string;
690
+ base64: string;
691
+ }
692
+ /** `canvas.reply` — the answer to one {@link CanvasCall}, as the `result` of its `ack`. */
693
+ export interface CanvasReply {
694
+ v: 1;
695
+ kind: 'canvas.reply';
696
+ id: string;
697
+ /** The tool's structured answer. A file it names is `lensmcp-worker:<kind>/<name>` ({@link CANVAS_WORKER_FILE}), the worker's copy once saved. */
698
+ result?: Record<string, unknown>;
699
+ /** The picture the answer shows inline (a render): one of `files`, by its `lensmcp-worker:` name. */
700
+ image?: string;
701
+ files?: CanvasCallFile[];
702
+ /** The tool did not answer: what an agent reads, as the tool's own refusal. */
703
+ error?: {
704
+ code: 'NOT_FOUND' | 'REFUSED' | 'UNAVAILABLE' | 'ERROR';
705
+ message: string;
706
+ };
707
+ }
651
708
  /**
652
709
  * `store.read` (worker → organizer) — slice D32 (planning/docker/00-plan.md § 13, DW-Q2: read-only): the WORKER's own
653
710
  * read of the organizer's board, for the worker's dashboard. It carries no launch key — it acts as no launch: the hub
@@ -762,6 +819,7 @@ export interface PeerBodies {
762
819
  'launch.tail': LaunchTail;
763
820
  'store.call': StoreCall;
764
821
  'store.reply': StoreReply;
822
+ 'canvas.call': CanvasCall;
765
823
  'store.read': StoreRead;
766
824
  'version.install': VersionInstall;
767
825
  'version.state': VersionState;
@@ -784,7 +842,7 @@ export type PeerMessage = {
784
842
  /** What the organizer sends (§ 8, left column). */
785
843
  export declare const TO_WORKER: readonly ["job.offer", "job.cancel", "bundle.ready", "tunnel.open", "tunnel.close", "launch.start", "launch.stop", "store.reply", "version.install", "main.moved", "instance.tunnel.open", "goal.place", "goal.changes", "goal.update"];
786
844
  /** What the worker sends (§ 8, right column), and `forget`. */
787
- export declare const TO_ORGANIZER: readonly ["hello", "capacity", "job.state", "job.stage", "job.done", "bundle.sent", "launch.state", "launch.tail", "store.call", "version.state", "forget", "main.state", "instance.state", "store.read", "goal.sent", "conversation.sync", "conversation.read"];
845
+ export declare const TO_ORGANIZER: readonly ["hello", "capacity", "job.state", "job.stage", "job.done", "bundle.sent", "launch.state", "launch.tail", "store.call", "version.state", "forget", "main.state", "instance.state", "store.read", "goal.sent", "conversation.sync", "conversation.read", "canvas.call"];
788
846
  /** Either side sends a ping. */
789
847
  export declare const EITHER_WAY: readonly ["ping"];
790
848
  /** The replies: each names the message it answers, and is answered by nothing. */
@@ -1516,6 +1574,70 @@ export declare const StoreReplySchema: z.ZodObject<{
1516
1574
  wal: z.ZodOptional<z.ZodBoolean>;
1517
1575
  }, z.core.$strict>>;
1518
1576
  }, z.core.$strict>;
1577
+ /**
1578
+ * What one canvas call carries (canvas phase 14), inside one line of the control stream (512 KiB with its envelope):
1579
+ * its input, encoded; its answer, encoded — the tool's structured output and the files it hands back, base64; the
1580
+ * files' bytes before their encoding (a render's first screen first, the rest while they fit). A wait runs at most
1581
+ * `waitSliceMs` at the organizer per call: the worker's tool asks again until its own time is up.
1582
+ */
1583
+ export declare const CANVAS_CALL_LIMITS: {
1584
+ readonly inputBytes: number;
1585
+ readonly answerBytes: number;
1586
+ readonly fileBytes: number;
1587
+ readonly waitSliceMs: 20000;
1588
+ };
1589
+ /** A file a canvas answer hands back is named so — a canvas's id, then letters, digits, `.`, `_`, `-` — never a folder. */
1590
+ export declare const CANVAS_CALL_FILE_NAME: RegExp;
1591
+ /** How an answer names a file it hands back: `lensmcp-worker:render/<name>`, `lensmcp-worker:mirror/<name>`, `lensmcp-worker:asset/<name>`. */
1592
+ export declare const CANVAS_WORKER_FILE = "lensmcp-worker:";
1593
+ /** A {@link CanvasCall}, as the forwarder checks it before it goes and the organizer's hub before it runs. */
1594
+ export declare const CanvasCallSchema: z.ZodObject<{
1595
+ v: z.ZodLiteral<1>;
1596
+ kind: z.ZodLiteral<"canvas.call">;
1597
+ id: z.ZodString;
1598
+ tool: z.ZodEnum<{
1599
+ canvas_write: "canvas_write";
1600
+ canvas_data: "canvas_data";
1601
+ canvas_get: "canvas_get";
1602
+ canvas_render: "canvas_render";
1603
+ canvas_list: "canvas_list";
1604
+ canvas_wait: "canvas_wait";
1605
+ canvas_comment: "canvas_comment";
1606
+ canvas_resource: "canvas_resource";
1607
+ }>;
1608
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1609
+ caller: z.ZodOptional<z.ZodObject<{
1610
+ session: z.ZodOptional<z.ZodString>;
1611
+ client: z.ZodOptional<z.ZodString>;
1612
+ }, z.core.$strict>>;
1613
+ launchKey: z.ZodString;
1614
+ }, z.core.$strict>;
1615
+ /** A {@link CanvasReply}, as the worker reads the `ack`'s result. */
1616
+ export declare const CanvasReplySchema: z.ZodObject<{
1617
+ v: z.ZodLiteral<1>;
1618
+ kind: z.ZodLiteral<"canvas.reply">;
1619
+ id: z.ZodString;
1620
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1621
+ image: z.ZodOptional<z.ZodString>;
1622
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
1623
+ kind: z.ZodEnum<{
1624
+ render: "render";
1625
+ mirror: "mirror";
1626
+ asset: "asset";
1627
+ }>;
1628
+ name: z.ZodString;
1629
+ base64: z.ZodString;
1630
+ }, z.core.$strict>>>;
1631
+ error: z.ZodOptional<z.ZodObject<{
1632
+ code: z.ZodEnum<{
1633
+ NOT_FOUND: "NOT_FOUND";
1634
+ REFUSED: "REFUSED";
1635
+ UNAVAILABLE: "UNAVAILABLE";
1636
+ ERROR: "ERROR";
1637
+ }>;
1638
+ message: z.ZodString;
1639
+ }, z.core.$strict>>;
1640
+ }, z.core.$strict>;
1519
1641
  /**
1520
1642
  * The remote instances' messages (slice D35), strict — what the hub's `handle('instance.state', …)` and the worker
1521
1643
  * daemon's `handle('instance.tunnel.open', …)` are registered with. A tunnel's id follows the hub's rule for the bulk