@lensmcp/protocol-types 1.26.2 → 1.26.3

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.
Files changed (63) hide show
  1. package/index.d.ts +13 -1
  2. package/index.js +1 -1
  3. package/lib/ai-call-groups.js +2 -2
  4. package/lib/ai-call-row.js +3 -3
  5. package/lib/ai-call.js +9 -9
  6. package/lib/ai-context.js +6 -6
  7. package/lib/ai-origins.js +9 -9
  8. package/lib/bounded-clone.js +1 -1
  9. package/lib/bounded-map.js +1 -1
  10. package/lib/bounded-writer.js +1 -1
  11. package/lib/capture-demand.js +1 -1
  12. package/lib/changes.d.ts +15 -3
  13. package/lib/cluster-hosts.d.ts +272 -0
  14. package/lib/cluster-hosts.js +1 -0
  15. package/lib/dashboard-lint.d.ts +22 -0
  16. package/lib/dashboard-path.js +1 -1
  17. package/lib/dashboard-updates.d.ts +80 -0
  18. package/lib/dashboard-updates.js +1 -0
  19. package/lib/dashboard.d.ts +8 -1
  20. package/lib/docker-errors.d.ts +123 -0
  21. package/lib/docker-errors.js +1 -0
  22. package/lib/docker-jobs.d.ts +673 -0
  23. package/lib/docker-jobs.js +1 -0
  24. package/lib/docker-report.d.ts +99 -0
  25. package/lib/docker-report.js +2 -0
  26. package/lib/docker-runs.d.ts +300 -0
  27. package/lib/docker-runs.js +3 -0
  28. package/lib/error-cause.js +5 -5
  29. package/lib/error-dismissal.js +1 -1
  30. package/lib/event-loop.js +1 -1
  31. package/lib/expected-failure.js +2 -2
  32. package/lib/flood-guard.js +1 -1
  33. package/lib/goal-design.js +1 -1
  34. package/lib/host-agents.d.ts +139 -0
  35. package/lib/host-agents.js +1 -0
  36. package/lib/hosts.d.ts +206 -0
  37. package/lib/hosts.js +1 -0
  38. package/lib/lint-coverage.js +1 -1
  39. package/lib/log-query.js +1 -1
  40. package/lib/main-mirror.d.ts +117 -0
  41. package/lib/main-mirror.js +1 -0
  42. package/lib/metrics-reset.js +1 -1
  43. package/lib/overseer-findings.js +1 -1
  44. package/lib/peers.d.ts +1881 -0
  45. package/lib/peers.js +1 -0
  46. package/lib/perf-rules.js +1 -1
  47. package/lib/pod-memory.js +1 -1
  48. package/lib/producer-health.js +1 -1
  49. package/lib/proof.d.ts +32 -0
  50. package/lib/remote-instances.d.ts +129 -0
  51. package/lib/remote-instances.js +1 -0
  52. package/lib/resources.d.ts +2 -0
  53. package/lib/resources.js +1 -1
  54. package/lib/sources.js +1 -1
  55. package/lib/static-checks.d.ts +290 -0
  56. package/lib/static-checks.js +1 -0
  57. package/lib/system-report.js +1 -1
  58. package/lib/team-delivery.d.ts +13 -0
  59. package/lib/team.d.ts +60 -2
  60. package/lib/team.js +1 -1
  61. package/lib/workspace-actions.d.ts +104 -1
  62. package/lib/workspace-actions.js +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";var O=Object.defineProperty;var m=(e,o)=>O(e,"name",{value:o,configurable:!0});var B=Object.defineProperty,b=m((e,o)=>B(e,"name",{value:o,configurable:!0}),"m"),I=Object.defineProperty,c=b((e,o)=>I(e,"name",{value:o,configurable:!0}),"c");import{CONTAINER_OOM as k,DOCKER_ENGINE_LOST as g,DOCKER_RUN_FIELD as N}from"./docker-jobs.js";import{joinId as E}from"./error-cause.js";const _=200,f=50,$=c(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),h=c(e=>{if(typeof e!="string")return;const o=e.trim();return o?o.slice(0,_):void 0},"name"),p=c(e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,"someMb"),C=c(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,"anyMb"),w=c(e=>Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0)),"defined"),D=c(e=>{if(!$(e))return;const o=h(e.peer);if(!o)return;const n=h(e.name);return n?{peer:o,name:n}:{peer:o}},"hostOf"),M=c(e=>e.name??e.peer,"hostWord");export function readDockerError(e){if($(e)){if(e.kind===k)return w({kind:k,run:h(e.run),job:h(e.job),service:h(e.service),container:h(e.container),seen:e.seen==="event"||e.seen==="inspect"?e.seen:void 0,limitMb:p(e.limitMb),peakMb:p(e.peakMb),budgetMb:p(e.budgetMb),context:h(e.context),host:D(e.host)});if(e.kind===g){const o=new Map;for(const r of Array.isArray(e.runs)?e.runs:[]){const i=$(r)?h(r.run):h(r),t=$(r)?h(r.job):void 0;i&&!o.has(i)&&o.size<f&&o.set(i,{run:i,...t?{job:t}:{}})}const n=Array.isArray(e.killed)?[...new Set(e.killed.map(h).filter(r=>!!r))].slice(0,f):[];return w({kind:g,context:h(e.context),runs:[...o.values()],why:h(e.why),vmTotalMb:p(e.vmTotalMb),vmAvailableMb:C(e.vmAvailableMb),killed:n.length?n:void 0,host:D(e.host)})}}}m(readDockerError,"readDockerError"),b(readDockerError,"readDockerError"),c(readDockerError,"readDockerError");export function dockerErrorRuns(e){return e.kind===k?e.run?[e.run]:[]:e.runs.map(o=>o.run)}m(dockerErrorRuns,"dockerErrorRuns"),b(dockerErrorRuns,"dockerErrorRuns"),c(dockerErrorRuns,"dockerErrorRuns");export function dockerRunOfEvent(e){return $(e)?h(e[N]):void 0}m(dockerRunOfEvent,"dockerRunOfEvent"),b(dockerRunOfEvent,"dockerRunOfEvent"),c(dockerRunOfEvent,"dockerRunOfEvent");export const CONTAINER_OOM_ERROR="ContainerOOMKilled",DOCKER_ENGINE_LOST_ERROR="DockerEngineLost";const L=256,a=c(e=>`${Math.round(e)} MiB`,"mib");function x(e){const o=`${e.service??"a container"} ran out of memory in ${e.job??"a Docker job"}`,n=`${e.service?`\xAB${e.service}\xBB`:"A container"} ran out of memory and was killed, in ${e.job?`the Docker job \xAB${e.job}\xBB`:"a Docker job"}${e.host?` on the worker \xAB${M(e.host)}\xBB`:""}`,r=e.job?`\`${e.budgetMb!==void 0&&e.service?`jobs.${e.job}.budget.services.${e.service}`:`jobs.${e.job}.budget`}\` in lensmcp.json`:"its job's budget in lensmcp.json \u2192 jobs",{limitMb:i,peakMb:t,budgetMb:s}=e;let l;if(i!==void 0&&s!==void 0){const d=Math.round(i)-Math.round(s);l=d>0?`It was killed at its ${a(i)} limit \u2014 ${a(d)} over the ${a(s)} it declares. Raise ${r} to what it takes (more than ${a(i)}), and the container's memory limit with it.`:d===0?`It was killed at its ${a(i)} limit, which is all it declares. Raise ${r} to what it takes, and the container's memory limit with it.`:`It was killed at its ${a(i)} limit, ${a(-d)} under the ${a(s)} it declares. Raise the container's memory limit to its budget (${r}) \u2014 and both, if it takes more.`}else if(i!==void 0)l=`It was killed at its ${a(i)} limit. Raise the limit, and ${r}, to what it takes.`;else if(t!==void 0&&s!==void 0){const d=Math.round(t)-Math.round(s);l=d>0?`It held ${a(t)} at its peak \u2014 ${a(d)} over the ${a(s)} it declares. Raise ${r} to what it takes, so the queue lets the job in only when Docker's VM has that much.`:`It held ${a(t)} at its peak, within the ${a(s)} it declares (${r}): it was killed at a lower limit of its own, or when Docker's VM ran out. Check its memory limit in the compose file, and what else the VM held.`}else t!==void 0?l=`It held ${a(t)} at its peak. Check ${r} against that, and the container's memory limit.`:s!==void 0?l=`Its peak was not sampled. It declares ${a(s)}: raise ${r} to what it takes, and the container's memory limit with it.`:l=`Raise ${r} to what the service takes, and the container's memory limit with it.`;const u=[i!==void 0?`killed at its ${a(i)} limit`:"killed for memory",t!==void 0?`peak ${a(t)}`:void 0,s!==void 0?`budget ${a(s)}`:void 0,e.run?`run ${e.run}`:void 0,e.seen==="inspect"?"found by the inspect at the run's end":void 0,e.host?`on the worker ${M(e.host)}`:void 0,e.context?`Docker context ${e.context}`:void 0];return{cause:{id:E("cause",[CONTAINER_OOM_ERROR,e.job,e.service]),errorName:CONTAINER_OOM_ERROR,message:o},title:`${CONTAINER_OOM_ERROR}: ${o}`,headline:n,hint:l,facts:u.filter(Boolean).join(" \xB7 "),where:e.job?`Docker job ${e.job}`:"Docker"}}m(x,"y"),b(x,"A"),c(x,"oomWords");function y(e){const o=e.host?` on the worker ${M(e.host)}`:"",n=`Docker stopped answering${e.context?` (context ${e.context})`:""}${o}`,r=[...new Set(e.runs.map(v=>v.job).filter(v=>!!v))],i=e.runs.length,t=e.host?`Docker on the worker \xAB${M(e.host)}\xBB`:"Docker",s=i===0?`${t} stopped answering while LensMCP ran work in it`:i===1?`${t} stopped answering while ${r[0]?`the job \xAB${r[0]}\xBB`:"a job"} ran: its containers went with it`:`${t} stopped answering while ${i} runs were in it${r.length?` (${r.map(v=>`\xAB${v}\xBB`).join(", ")})`:""}: their containers went with it`,{vmTotalMb:l,vmAvailableMb:u}=e,d=u===void 0?void 0:`${a(u)} free${l!==void 0?` of ${a(l)}`:""}`,j=u===void 0?"If nobody stopped it, its VM most likely ran out of memory: compare the jobs' budgets in lensmcp.json with what Docker's VM has.":u<=L?`Its VM had ${d} when it was last read: it most likely ran out of memory. Let less in at once (the jobs' budgets in lensmcp.json decide), or give Docker's VM more.`:`Its VM had ${d} when it was last read, so memory is not the likely reason: was Docker stopped or restarted?`,A=[i?`${i} run${i===1?"":"s"} lost: ${e.runs.map(v=>`${v.job??"a job"} (run ${v.run})`).join(", ")}`:void 0,e.why,d?`VM ${d}`:void 0,e.killed?.length?`killed for memory before it went: ${e.killed.join(", ")}`:void 0];return{cause:{id:E("cause",e.host?[DOCKER_ENGINE_LOST_ERROR,e.context,e.host.peer]:[DOCKER_ENGINE_LOST_ERROR,e.context]),errorName:DOCKER_ENGINE_LOST_ERROR,message:n},title:`${DOCKER_ENGINE_LOST_ERROR}: ${n}`,headline:s,hint:`Start Docker again${o} and run ${i>1?"the jobs":"the job"} again: a run lost with the engine has no result. ${j}`,facts:A.filter(Boolean).join(" \xB7 "),where:`${e.context?`Docker context ${e.context}`:"Docker"}${o}`}}m(y,"E"),b(y,"I"),c(y,"engineWords");export function dockerErrorWords(e){return e.kind===k?x(e):y(e)}m(dockerErrorWords,"dockerErrorWords"),b(dockerErrorWords,"dockerErrorWords"),c(dockerErrorWords,"dockerErrorWords");export function mergeDockerError(e,o){if(e.kind===k){if(o.kind!==k)return e;const t=Math.max(e.peakMb??0,o.peakMb??0);return w({...o,...e,seen:e.seen==="event"||o.seen==="event"?"event":e.seen??o.seen,peakMb:t>0?t:void 0})}const n=e;if(o.kind===k)return o.service&&!n.killed?.includes(o.service)?{...n,killed:[...n.killed??[],o.service].slice(0,f)}:e;const r=new Map(n.runs.map(t=>[t.run,t]));for(const t of o.runs)(!r.has(t.run)||!r.get(t.run).job&&t.job)&&r.set(t.run,t);const i=[...new Set([...n.killed??[],...o.killed??[]])];return w({...o,...n,runs:[...r.values()].slice(0,f),vmAvailableMb:n.vmAvailableMb!==void 0&&o.vmAvailableMb!==void 0?Math.min(n.vmAvailableMb,o.vmAvailableMb):n.vmAvailableMb??o.vmAvailableMb,killed:i.length?i:void 0})}m(mergeDockerError,"mergeDockerError"),b(mergeDockerError,"mergeDockerError"),c(mergeDockerError,"mergeDockerError");export const DOCKER_ENGINE_LOSS_SAME_MS=6e4;const R=2e3,S=200;export class DockerErrorLedger{static{m(this,"DockerErrorLedger")}static{b(this,"DockerErrorLedger")}static{c(this,"DockerErrorLedger")}constructor(){this.kills=new Map,this.losses=new Map,this.lostRuns=new Map}account(o,n,r){if(o.kind===g){const l=o.host?`${o.host.peer}\0${o.context??""}`:o.context??"",u=this.losses.get(l),d=u&&Math.abs(r-u.at)<=DOCKER_ENGINE_LOSS_SAME_MS?u.told:void 0;d||this.remember(this.losses,l,{told:n,at:r},S);for(const j of o.runs)this.remember(this.lostRuns,j.run,d??n,R);return d}const i=o.seen!=="inspect",t=o.run&&o.container?`${o.run}\0${o.container}`:o.run&&o.service?`${o.run}\0\0${o.service}`:void 0,s=t?this.kills.get(t):void 0;if(!s){const l=!i&&o.run?this.lostRuns.get(o.run):void 0;if(l)return l;t&&this.remember(this.kills,t,{told:n,live:i?1:0},R);return}if(!i)return s.told;if(s.live===0)return s.live=1,s.told;s.live+=1,s.told=n}remember(o,n,r,i){o.delete(n),o.set(n,r),o.size>i&&o.delete(o.keys().next().value)}}