@lensmcp/protocol-types 1.26.20 → 1.26.21

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 (44) hide show
  1. package/lib/ai-cache-facts.js +1 -1
  2. package/lib/ai-cache-verdict.js +1 -1
  3. package/lib/ai-cache.js +3 -3
  4. package/lib/ai-call-groups.js +2 -2
  5. package/lib/ai-call-row.js +3 -3
  6. package/lib/ai-call.js +11 -11
  7. package/lib/ai-compare.js +3 -3
  8. package/lib/ai-context.js +6 -6
  9. package/lib/ai-origins.js +8 -8
  10. package/lib/ai-together.js +5 -5
  11. package/lib/bounded-clone.js +1 -1
  12. package/lib/bounded-map.js +1 -1
  13. package/lib/bounded-writer.js +1 -1
  14. package/lib/capture-demand.js +1 -1
  15. package/lib/dashboard-path.js +1 -1
  16. package/lib/docker-errors.js +1 -1
  17. package/lib/docker-jobs.js +1 -1
  18. package/lib/docker-report.js +2 -2
  19. package/lib/docker-runs.js +3 -3
  20. package/lib/error-cause.js +6 -6
  21. package/lib/error-dismissal.js +1 -1
  22. package/lib/error-verdict.js +3 -3
  23. package/lib/event-loop.js +1 -1
  24. package/lib/expected-failure.js +2 -2
  25. package/lib/finding-proof.js +1 -1
  26. package/lib/flood-guard.js +1 -1
  27. package/lib/goal-design.js +1 -1
  28. package/lib/host-agents.js +1 -1
  29. package/lib/lint-coverage.js +1 -1
  30. package/lib/lint-ignores.js +2 -2
  31. package/lib/log-query.js +1 -1
  32. package/lib/metrics-reset.js +1 -1
  33. package/lib/overseer-findings.js +1 -1
  34. package/lib/peers.d.ts +33 -33
  35. package/lib/peers.js +1 -1
  36. package/lib/perf-rules.js +1 -1
  37. package/lib/pod-memory.js +1 -1
  38. package/lib/producer-health.js +1 -1
  39. package/lib/remote-instances.js +1 -1
  40. package/lib/sources.js +1 -1
  41. package/lib/static-checks.js +1 -1
  42. package/lib/system-report.js +1 -1
  43. package/lib/team.js +1 -1
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var A=Object.defineProperty;var s=(t,e)=>A(t,"name",{value:e,configurable:!0});var c=Object.defineProperty,o=s((t,e)=>c(t,"name",{value:e,configurable:!0}),"o");export const HOST_AGENT_CLIENTS=["claude","codex"],HOST_AGENTS_FILES={agents:"host-agents.json",ceilings:"host-ceilings.json"},HOST_AGENTS_LIMITS={accounts:32,windows:6,label:60,why:300,plan:40,name:40,agents:64},HOST_ACCOUNT_ID=/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const n=[/\bsk-[A-Za-z0-9_-]{16,}/,/\b[rs]k_(?:live|test)_[A-Za-z0-9]{12,}/,/\bgh[pousr]_[A-Za-z0-9]{20,}|\bgithub_pat_[A-Za-z0-9_]{20,}/,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/,/\bxox[abposr]-[A-Za-z0-9-]{10,}/,/\bAIza[0-9A-Za-z_-]{30,}/,/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{4,}/,/-----BEGIN [A-Z ]*(?:PRIVATE KEY|CERTIFICATE)-----/,/\bbearer\s+[A-Za-z0-9._~+/=-]{12,}/i],r=/[A-Za-z0-9+/_=-]{32,}/g;export function tokenShaped(t){if(n.some(e=>e.test(t)))return!0;for(const e of t.match(r)??[])if(/\d/.test(e)&&/[A-Za-z]/.test(e))return!0;return!1}s(tokenShaped,"tokenShaped"),o(tokenShaped,"tokenShaped");export function withoutTokens(t){let e=t;for(const a of n)e=e.replace(new RegExp(a.source,a.flags.includes("g")?a.flags:`${a.flags}g`),"\u2026");return e.replace(r,a=>/\d/.test(a)&&/[A-Za-z]/.test(a)?"\u2026":a)}s(withoutTokens,"withoutTokens"),o(withoutTokens,"withoutTokens");
1
+ "use strict";var A=Object.defineProperty;var o=(t,e)=>A(t,"name",{value:e,configurable:!0});var i=Object.defineProperty,n=o((t,e)=>i(t,"name",{value:e,configurable:!0}),"o"),b=Object.defineProperty,s=n((t,e)=>b(t,"name",{value:e,configurable:!0}),"s"),l=Object.defineProperty,r=s((t,e)=>l(t,"name",{value:e,configurable:!0}),"o");export const HOST_AGENT_CLIENTS=["claude","codex"],HOST_AGENTS_FILES={agents:"host-agents.json",ceilings:"host-ceilings.json"},HOST_AGENTS_LIMITS={accounts:32,windows:6,label:60,why:300,plan:40,name:40,agents:64},HOST_ACCOUNT_ID=/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const c=[/\bsk-[A-Za-z0-9_-]{16,}/,/\b[rs]k_(?:live|test)_[A-Za-z0-9]{12,}/,/\bgh[pousr]_[A-Za-z0-9]{20,}|\bgithub_pat_[A-Za-z0-9_]{20,}/,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/,/\bxox[abposr]-[A-Za-z0-9-]{10,}/,/\bAIza[0-9A-Za-z_-]{30,}/,/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{4,}/,/-----BEGIN [A-Z ]*(?:PRIVATE KEY|CERTIFICATE)-----/,/\bbearer\s+[A-Za-z0-9._~+/=-]{12,}/i],u=/[A-Za-z0-9+/_=-]{32,}/g;export function tokenShaped(t){if(c.some(e=>e.test(t)))return!0;for(const e of t.match(u)??[])if(/\d/.test(e)&&/[A-Za-z]/.test(e))return!0;return!1}o(tokenShaped,"tokenShaped"),n(tokenShaped,"tokenShaped"),s(tokenShaped,"tokenShaped"),r(tokenShaped,"tokenShaped");export function withoutTokens(t){let e=t;for(const a of c)e=e.replace(new RegExp(a.source,a.flags.includes("g")?a.flags:`${a.flags}g`),"\u2026");return e.replace(u,a=>/\d/.test(a)&&/[A-Za-z]/.test(a)?"\u2026":a)}o(withoutTokens,"withoutTokens"),n(withoutTokens,"withoutTokens"),s(withoutTokens,"withoutTokens"),r(withoutTokens,"withoutTokens");
@@ -1 +1 @@
1
- "use strict";var k=Object.defineProperty;var g=(e,n)=>k(e,"name",{value:n,configurable:!0});var v=Object.defineProperty,d=g((e,n)=>v(e,"name",{value:n,configurable:!0}),"i");import{TRUNCATION_MARKER_KEY as C}from"./bounded-clone.js";export const LINT_COVER_KIND="lint-cover",MAX_LINT_UNCOMMITTED=500;const A=["tree","paths","changed","incremental"],h=d(e=>Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.length>0):[],"strings"),i=d(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,"count"),l=d(e=>typeof e=="string"&&e?e:void 0,"text");export function readLintCoverage(e){if(!e||typeof e!="object"||e[C])return;const n=e.coverage;if(!n||typeof n!="object")return;const t=n,r=t.kind,s=t.root;if(!A.includes(r)||typeof s!="string"||!s)return;const f=h(t.dirs),o=h(t.files),p=h(t.gone),m=i(t.notLinted),$=i(t.untracked),a=t.base&&typeof t.base=="object"?t.base:void 0,y=a&&l(a.sha)&&l(a.run)?{from:a.from==="main"?"main":"own",sha:a.sha,run:a.run}:void 0,b=Array.isArray(t.inputs)?t.inputs.flatMap(u=>Array.isArray(u)&&typeof u[0]=="string"&&typeof u[1]=="string"?[[u[0],u[1]]]:[]):void 0;return{kind:r,root:s,dirs:f,files:o,gone:p,fileCount:i(t.fileCount)??o.length,goneCount:i(t.goneCount)??p.length,linted:i(t.linted)??0,...i(t.dirCount)!==void 0?{dirCount:i(t.dirCount)}:{},...m?{notLinted:m}:{},...$?{untracked:$}:{},...l(t.since)?{since:t.since}:{},...l(t.head)?{head:t.head}:{},...typeof t.dirty=="boolean"?{dirty:t.dirty}:{},...Array.isArray(t.uncommitted)?{uncommitted:h(t.uncommitted)}:{},...t.uncommittedMore===!0?{uncommittedMore:!0}:{},...b?{inputs:b}:{},...l(t.folder)?{folder:t.folder}:{},...t.projects===!0?{projects:!0}:{},...y?{base:y}:{},...t.fromZero===!0?{fromZero:!0}:{},...t.narrowed===!0?{narrowed:!0}:{}}}g(readLintCoverage,"readLintCoverage"),d(readLintCoverage,"readLintCoverage");const c=d((e,n)=>`${e} ${n}${e===1?"":"s"}`,"some");export function lintCoverageLabel(e,n={}){const t=e.files??0,r=e.gone??0;if(e.kind==="changed"){const o=`since ${e.since??"HEAD"}`;if(!t)return`${c(r,"deleted file")} ${o}`;const p=n.untracked&&e.untracked?` (${e.untracked} untracked)`:"";return`${c(t,"changed file")} ${o}${p}${r?`, ${r} deleted`:""}`}if(e.kind==="incremental"){const o=e.since?` since ${e.since.slice(0,7)}`:"";return!t&&!r?`nothing changed${o}`:t?`${c(t,"file")} changed${o}${r?`, ${r} deleted`:""}`:`${c(r,"file")} deleted${o}`}if(e.kind==="tree"&&e.projects)return`the workspace\u2019s ${c(e.projects,"project")}`;if(e.kind==="tree"&&e.paths[0]===".")return"whole checkout";if(e.narrowed)return`${c(t,"file")} ESLint linted with the caller\u2019s arguments`;const s=e.paths.slice(0,3).join(", "),f=(e.more??0)+Math.max(0,e.paths.length-3);return f?`${s} +${f} more`:s}g(lintCoverageLabel,"lintCoverageLabel"),d(lintCoverageLabel,"lintCoverageLabel");
1
+ "use strict";var k=Object.defineProperty;var p=(e,n)=>k(e,"name",{value:n,configurable:!0});var L=Object.defineProperty,h=p((e,n)=>L(e,"name",{value:n,configurable:!0}),"p"),j=Object.defineProperty,y=h((e,n)=>j(e,"name",{value:n,configurable:!0}),"g"),A=Object.defineProperty,s=y((e,n)=>A(e,"name",{value:n,configurable:!0}),"i");import{TRUNCATION_MARKER_KEY as M}from"./bounded-clone.js";export const LINT_COVER_KIND="lint-cover",MAX_LINT_UNCOMMITTED=500;const w=["tree","paths","changed","incremental"],m=s(e=>Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.length>0):[],"strings"),i=s(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,"count"),l=s(e=>typeof e=="string"&&e?e:void 0,"text");export function readLintCoverage(e){if(!e||typeof e!="object"||e[M])return;const n=e.coverage;if(!n||typeof n!="object")return;const t=n,r=t.kind,a=t.root;if(!w.includes(r)||typeof a!="string"||!a)return;const f=m(t.dirs),o=m(t.files),g=m(t.gone),$=i(t.notLinted),v=i(t.untracked),d=t.base&&typeof t.base=="object"?t.base:void 0,b=d&&l(d.sha)&&l(d.run)?{from:d.from==="main"?"main":"own",sha:d.sha,run:d.run}:void 0,C=Array.isArray(t.inputs)?t.inputs.flatMap(u=>Array.isArray(u)&&typeof u[0]=="string"&&typeof u[1]=="string"?[[u[0],u[1]]]:[]):void 0;return{kind:r,root:a,dirs:f,files:o,gone:g,fileCount:i(t.fileCount)??o.length,goneCount:i(t.goneCount)??g.length,linted:i(t.linted)??0,...i(t.dirCount)!==void 0?{dirCount:i(t.dirCount)}:{},...$?{notLinted:$}:{},...v?{untracked:v}:{},...l(t.since)?{since:t.since}:{},...l(t.head)?{head:t.head}:{},...typeof t.dirty=="boolean"?{dirty:t.dirty}:{},...Array.isArray(t.uncommitted)?{uncommitted:m(t.uncommitted)}:{},...t.uncommittedMore===!0?{uncommittedMore:!0}:{},...C?{inputs:C}:{},...l(t.folder)?{folder:t.folder}:{},...t.projects===!0?{projects:!0}:{},...b?{base:b}:{},...t.fromZero===!0?{fromZero:!0}:{},...t.narrowed===!0?{narrowed:!0}:{}}}p(readLintCoverage,"readLintCoverage"),h(readLintCoverage,"readLintCoverage"),y(readLintCoverage,"readLintCoverage"),s(readLintCoverage,"readLintCoverage");const c=s((e,n)=>`${e} ${n}${e===1?"":"s"}`,"some");export function lintCoverageLabel(e,n={}){const t=e.files??0,r=e.gone??0;if(e.kind==="changed"){const o=`since ${e.since??"HEAD"}`;if(!t)return`${c(r,"deleted file")} ${o}`;const g=n.untracked&&e.untracked?` (${e.untracked} untracked)`:"";return`${c(t,"changed file")} ${o}${g}${r?`, ${r} deleted`:""}`}if(e.kind==="incremental"){const o=e.since?` since ${e.since.slice(0,7)}`:"";return!t&&!r?`nothing changed${o}`:t?`${c(t,"file")} changed${o}${r?`, ${r} deleted`:""}`:`${c(r,"file")} deleted${o}`}if(e.kind==="tree"&&e.projects)return`the workspace\u2019s ${c(e.projects,"project")}`;if(e.kind==="tree"&&e.paths[0]===".")return"whole checkout";if(e.narrowed)return`${c(t,"file")} ESLint linted with the caller\u2019s arguments`;const a=e.paths.slice(0,3).join(", "),f=(e.more??0)+Math.max(0,e.paths.length-3);return f?`${a} +${f} more`:a}p(lintCoverageLabel,"lintCoverageLabel"),h(lintCoverageLabel,"lintCoverageLabel"),y(lintCoverageLabel,"lintCoverageLabel"),s(lintCoverageLabel,"lintCoverageLabel");
@@ -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 L=Object.defineProperty;var p=(e,t)=>L(e,"name",{value:t,configurable:!0});var w=Object.defineProperty,c=p((e,t)=>w(e,"name",{value:t,configurable:!0}),"p"),x=Object.defineProperty,u=c((e,t)=>x(e,"name",{value:t,configurable:!0}),"p"),S=Object.defineProperty,l=u((e,t)=>S(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 j=l(e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,"obj"),h=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"),c(lintIgnoreKey,"lintIgnoreKey"),u(lintIgnoreKey,"lintIgnoreKey"),l(lintIgnoreKey,"lintIgnoreKey");export function checkLintIgnore(e){const t=h(e.rule),n=h(e.project),r=h(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"),c(checkLintIgnore,"checkLintIgnore"),u(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(s){return{ignores:[],problems:[`${LINT_IGNORES_FILE} is not JSON (${s instanceof Error?s.message:String(s)}) \u2014 no lint is ignored until it is`]}}const n=j(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=[],i=new Set;return r.forEach((s,f)=>{const I=j(s);if(!I){a.push(`ignores[${f}] is not an object`);return}const g=checkLintIgnore(I);if("problem"in g){a.push(`ignores[${f}]: ${g.problem}`);return}const b=lintIgnoreKey(g.rule,g.project);if(i.has(b)){a.push(`ignores[${f}]: ${g.rule} in ${g.project} is ignored above already \u2014 the first stands`);return}if(o.length>=LINT_IGNORE_LIMITS.ignores){a.push(`ignores[${f}]: past ${LINT_IGNORE_LIMITS.ignores} ignores \u2014 the rest are not read`);return}i.add(b);const d=h(I.by)?.slice(0,LINT_IGNORE_LIMITS.by),m=h(I.at),y=h(I.proposal);o.push({...g,...d?{by:d}:{},...m&&!Number.isNaN(Date.parse(m))?{at:m}:{},...y?{proposal:y.slice(0,40)}:{}})}),{ignores:o,problems:a}}p(parseLintIgnores,"parseLintIgnores"),c(parseLintIgnores,"parseLintIgnores"),u(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"),c(lintIgnoresText,"lintIgnoresText"),u(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"),c(withLintIgnore,"withLintIgnore"),u(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"),c(withoutLintIgnore,"withoutLintIgnore"),u(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"),c(lintIgnoreMatcher,"lintIgnoreMatcher"),u(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(i=>{const s=t.get(lintIgnoreKey(i.rule,i.project))??{errors:0,warnings:0};return n+=s.errors,r+=s.warnings,{rule:i.rule,project:i.project,reason:i.reason,...i.by?{by:i.by}:{},...i.at?{at:i.at}:{},errors:s.errors,warnings:s.warnings}}).map((i,s)=>({r:i,i:s})).sort((i,s)=>s.r.errors-i.r.errors||s.r.warnings-i.r.warnings||i.i-s.i).map(({r:i})=>i),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"),c(lintIgnoredSummary,"lintIgnoredSummary"),u(lintIgnoredSummary,"lintIgnoredSummary"),l(lintIgnoredSummary,"lintIgnoredSummary");export const LINT_IGNORE_PROPOSAL_LIMITS={open:30,kept:200,requestId:200};
package/lib/log-query.js CHANGED
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var a=(e,r)=>m(e,"name",{value:r,configurable:!0});var L=Object.defineProperty,c=a((e,r)=>L(e,"name",{value:r,configurable:!0}),"c");const d={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},h={warn:"warning",err:"error"},p=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const r=[],t=[];for(const s of e.matchAll(p)){const[o,n,f,w,g]=s,u=(w??g??"").trim(),i=f?d[f.toLowerCase()]:void 0;if(i&&u){const y=i==="level"?h[u.toLowerCase()]??u.toLowerCase():u;r.push({key:i,value:y,negate:n==="-"})}else o.trim()&&t.push(o.trim())}return{tokens:r,text:t.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const r=c(t=>/\s/.test(t)?`"${t}"`:t,"quote");return[...e.tokens.map(t=>`${t.negate?"-":""}${t.key}:${r(t.value)}`),e.text].filter(Boolean).join(" ")}a(formatLogQuery,"formatLogQuery"),c(formatLogQuery,"formatLogQuery");function v(e,r){if(e===void 0)return!1;const t=/^(>=|<=|>|<|=)?\s*(\d+(?:\.\d+)?)$/.exec(r);if(!t)return!1;const s=Number(t[2]);switch(t[1]){case">":return e>s;case"<":return e<s;case"<=":return e<=s;case"=":return e===s;default:return e>=s}}a(v,"h"),c(v,"msMatches");function l(e,r){const t=r.value.toLowerCase();switch(r.key){case"level":return e.severity.toLowerCase()===t;case"service":return e.source.toLowerCase()===t;case"flow":return!!e.flowId&&e.flowId.toLowerCase().startsWith(t);case"trace":return!!e.requestId&&e.requestId.toLowerCase().startsWith(t);case"category":return e.category.toLowerCase()===t;case"ms":return v(e.durationMs,r.value)}}a(l,"i"),c(l,"tokenMatches");export function matchesLogQuery(e,r,t){const s=new Map;for(const o of r.tokens){if(o.negate){if(l(e,o))return!1;continue}const n=s.get(o.key);n?n.push(o):s.set(o.key,[o])}for(const o of s.values())if(!o.some(n=>l(e,n)))return!1;if(r.text){const o=`${e.title} ${e.message??""} ${e.source} ${e.flowId??""}`;return t?t(o):o.toLowerCase().includes(r.text.toLowerCase())}return!0}a(matchesLogQuery,"matchesLogQuery"),c(matchesLogQuery,"matchesLogQuery");
1
+ "use strict";var d=Object.defineProperty;var a=(e,t)=>d(e,"name",{value:t,configurable:!0});var h=Object.defineProperty,c=a((e,t)=>h(e,"name",{value:t,configurable:!0}),"a"),p=Object.defineProperty,u=c((e,t)=>p(e,"name",{value:t,configurable:!0}),"a"),C=Object.defineProperty,i=u((e,t)=>C(e,"name",{value:t,configurable:!0}),"c");const Q={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},k={warn:"warning",err:"error"},$=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const t=[],r=[];for(const s of e.matchAll($)){const[o,n,y,m,L]=s,l=(m??L??"").trim(),g=y?Q[y.toLowerCase()]:void 0;if(g&&l){const w=g==="level"?k[l.toLowerCase()]??l.toLowerCase():l;t.push({key:g,value:w,negate:n==="-"})}else o.trim()&&r.push(o.trim())}return{tokens:t,text:r.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery"),u(parseLogQuery,"parseLogQuery"),i(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const t=i(r=>/\s/.test(r)?`"${r}"`:r,"quote");return[...e.tokens.map(r=>`${r.negate?"-":""}${r.key}:${t(r.value)}`),e.text].filter(Boolean).join(" ")}a(formatLogQuery,"formatLogQuery"),c(formatLogQuery,"formatLogQuery"),u(formatLogQuery,"formatLogQuery"),i(formatLogQuery,"formatLogQuery");function v(e,t){if(e===void 0)return!1;const r=/^(>=|<=|>|<|=)?\s*(\d+(?:\.\d+)?)$/.exec(t);if(!r)return!1;const s=Number(r[2]);switch(r[1]){case">":return e>s;case"<":return e<s;case"<=":return e<=s;case"=":return e===s;default:return e>=s}}a(v,"v"),c(v,"v"),u(v,"h"),i(v,"msMatches");function f(e,t){const r=t.value.toLowerCase();switch(t.key){case"level":return e.severity.toLowerCase()===r;case"service":return e.source.toLowerCase()===r;case"flow":return!!e.flowId&&e.flowId.toLowerCase().startsWith(r);case"trace":return!!e.requestId&&e.requestId.toLowerCase().startsWith(r);case"category":return e.category.toLowerCase()===r;case"ms":return v(e.durationMs,t.value)}}a(f,"f"),c(f,"l"),u(f,"i"),i(f,"tokenMatches");export function matchesLogQuery(e,t,r){const s=new Map;for(const o of t.tokens){if(o.negate){if(f(e,o))return!1;continue}const n=s.get(o.key);n?n.push(o):s.set(o.key,[o])}for(const o of s.values())if(!o.some(n=>f(e,n)))return!1;if(t.text){const o=`${e.title} ${e.message??""} ${e.source} ${e.flowId??""}`;return r?r(o):o.toLowerCase().includes(t.text.toLowerCase())}return!0}a(matchesLogQuery,"matchesLogQuery"),c(matchesLogQuery,"matchesLogQuery"),u(matchesLogQuery,"matchesLogQuery"),i(matchesLogQuery,"matchesLogQuery");
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var i=(t,e)=>a(t,"name",{value:e,configurable:!0});var S=Object.defineProperty,o=i((t,e)=>S(t,"name",{value:e,configurable:!0}),"s");import{LENS_EVENT_SOURCE as f}from"./error-dismissal.js";export const METRICS_RESET="metrics-reset",METRICS_RESTORED="metrics-restored",METRICS_SCOPES=["sql","external"],MAX_METRICS_RESET_IDS=500,MAX_METRICS_RESET_ID_LENGTH=512,METRICS_RESET_IDS_PER_EVENT=64;const l=16*1024,u=o(t=>t==="sql"||t==="external","isScope"),E=o(t=>typeof t=="string"&&t.length>0&&t.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(t){if(t.source!==f||!t.raw||typeof t.raw!="object")return;const e=t.raw,r=e.kind;if(r!==METRICS_RESET&&r!==METRICS_RESTORED)return;const n=e.scope;if(!u(n))return;let s;if(e.ids!==void 0&&(!Array.isArray(e.ids)||(s=[...new Set(e.ids.filter(E))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:n,...s?{ids:s}:{}};const c=e.at;if(!(typeof c!="number"||!Number.isFinite(c)))return{kind:r,scope:n,at:Math.min(c,t.timestamp),...s?{ids:s}:{}}}i(readMetricsReset,"readMetricsReset"),o(readMetricsReset,"readMetricsReset");export function metricsIdBatches(t){const e=[];let r=[],n=0;for(const s of new Set(t.filter(E)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||n+s.length+3>l)&&(e.push(r),r=[],n=0),r.push(s),n+=s.length+3;return r.length&&e.push(r),e}i(metricsIdBatches,"metricsIdBatches"),o(metricsIdBatches,"metricsIdBatches");
1
+ "use strict";var d=Object.defineProperty;var n=(e,t)=>d(e,"name",{value:t,configurable:!0});var f=Object.defineProperty,a=n((e,t)=>f(e,"name",{value:t,configurable:!0}),"i"),u=Object.defineProperty,E=a((e,t)=>u(e,"name",{value:t,configurable:!0}),"i"),S=Object.defineProperty,c=E((e,t)=>S(e,"name",{value:t,configurable:!0}),"s");import{LENS_EVENT_SOURCE as p}from"./error-dismissal.js";export const METRICS_RESET="metrics-reset",METRICS_RESTORED="metrics-restored",METRICS_SCOPES=["sql","external"],MAX_METRICS_RESET_IDS=500,MAX_METRICS_RESET_ID_LENGTH=512,METRICS_RESET_IDS_PER_EVENT=64;const R=16*1024,h=c(e=>e==="sql"||e==="external","isScope"),l=c(e=>typeof e=="string"&&e.length>0&&e.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(e){if(e.source!==p||!e.raw||typeof e.raw!="object")return;const t=e.raw,r=t.kind;if(r!==METRICS_RESET&&r!==METRICS_RESTORED)return;const i=t.scope;if(!h(i))return;let s;if(t.ids!==void 0&&(!Array.isArray(t.ids)||(s=[...new Set(t.ids.filter(l))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:i,...s?{ids:s}:{}};const o=t.at;if(!(typeof o!="number"||!Number.isFinite(o)))return{kind:r,scope:i,at:Math.min(o,e.timestamp),...s?{ids:s}:{}}}n(readMetricsReset,"readMetricsReset"),a(readMetricsReset,"readMetricsReset"),E(readMetricsReset,"readMetricsReset"),c(readMetricsReset,"readMetricsReset");export function metricsIdBatches(e){const t=[];let r=[],i=0;for(const s of new Set(e.filter(l)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||i+s.length+3>R)&&(t.push(r),r=[],i=0),r.push(s),i+=s.length+3;return r.length&&t.push(r),t}n(metricsIdBatches,"metricsIdBatches"),a(metricsIdBatches,"metricsIdBatches"),E(metricsIdBatches,"metricsIdBatches"),c(metricsIdBatches,"metricsIdBatches");
@@ -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 u=Object.defineProperty;var i=(n,e)=>u(n,"name",{value:e,configurable:!0});var d=Object.defineProperty,o=i((n,e)=>d(n,"name",{value:e,configurable:!0}),"i"),a=Object.defineProperty,r=o((n,e)=>a(n,"name",{value:e,configurable:!0}),"i"),l=Object.defineProperty,t=r((n,e)=>l(n,"name",{value:e,configurable:!0}),"s");export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingLive(n){return n.state==="open"||n.state==="proposed"||n.state==="applied"}i(findingLive,"findingLive"),o(findingLive,"findingLive"),r(findingLive,"findingLive"),t(findingLive,"findingLive");export function findingRunsActions(n,e={}){return n.actions.some(s=>FINDING_RUN_KINDS.includes(s.kind)||s.kind==="issue"&&e.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),o(findingRunsActions,"findingRunsActions"),r(findingRunsActions,"findingRunsActions"),t(findingRunsActions,"findingRunsActions");export function findingsForCheck(n,e,s){const f=`repo:${e}/team.${s}`;return n.filter(c=>findingLive(c)&&c.checks.includes(f))}i(findingsForCheck,"findingsForCheck"),o(findingsForCheck,"findingsForCheck"),r(findingsForCheck,"findingsForCheck"),t(findingsForCheck,"findingsForCheck");
package/lib/peers.d.ts CHANGED
@@ -863,8 +863,9 @@ export declare const PeerEnvelopeSchema: z.ZodObject<{
863
863
  }, z.core.$strict>;
864
864
  export declare const PeerErrorBodySchema: z.ZodObject<{
865
865
  code: z.ZodEnum<{
866
- lost: "lost";
867
866
  timeout: "timeout";
867
+ lost: "lost";
868
+ refused: "refused";
868
869
  "unknown-type": "unknown-type";
869
870
  "wrong-direction": "wrong-direction";
870
871
  "bad-message": "bad-message";
@@ -872,7 +873,6 @@ export declare const PeerErrorBodySchema: z.ZodObject<{
872
873
  "not-handled": "not-handled";
873
874
  "too-large": "too-large";
874
875
  busy: "busy";
875
- refused: "refused";
876
876
  internal: "internal";
877
877
  "no-window": "no-window";
878
878
  "window-used": "window-used";
@@ -912,8 +912,9 @@ export declare const PEER_BODY_SCHEMAS: {
912
912
  }, z.core.$strict>;
913
913
  readonly error: z.ZodObject<{
914
914
  code: z.ZodEnum<{
915
- lost: "lost";
916
915
  timeout: "timeout";
916
+ lost: "lost";
917
+ refused: "refused";
917
918
  "unknown-type": "unknown-type";
918
919
  "wrong-direction": "wrong-direction";
919
920
  "bad-message": "bad-message";
@@ -921,7 +922,6 @@ export declare const PEER_BODY_SCHEMAS: {
921
922
  "not-handled": "not-handled";
922
923
  "too-large": "too-large";
923
924
  busy: "busy";
924
- refused: "refused";
925
925
  internal: "internal";
926
926
  "no-window": "no-window";
927
927
  "window-used": "window-used";
@@ -978,8 +978,9 @@ export declare const PAIR_BODY_SCHEMAS: {
978
978
  }, z.core.$strict>;
979
979
  readonly error: z.ZodObject<{
980
980
  code: z.ZodEnum<{
981
- lost: "lost";
982
981
  timeout: "timeout";
982
+ lost: "lost";
983
+ refused: "refused";
983
984
  "unknown-type": "unknown-type";
984
985
  "wrong-direction": "wrong-direction";
985
986
  "bad-message": "bad-message";
@@ -987,7 +988,6 @@ export declare const PAIR_BODY_SCHEMAS: {
987
988
  "not-handled": "not-handled";
988
989
  "too-large": "too-large";
989
990
  busy: "busy";
990
- refused: "refused";
991
991
  internal: "internal";
992
992
  "no-window": "no-window";
993
993
  "window-used": "window-used";
@@ -1171,10 +1171,10 @@ export declare const MAIN_MIRROR_SCHEMAS: {
1171
1171
  }, z.core.$strict>;
1172
1172
  verdict: z.ZodOptional<z.ZodObject<{
1173
1173
  state: z.ZodEnum<{
1174
+ waiting: "waiting";
1174
1175
  refused: "refused";
1175
1176
  "in-main": "in-main";
1176
1177
  "brought-in": "brought-in";
1177
- waiting: "waiting";
1178
1178
  "not-ff": "not-ff";
1179
1179
  }>;
1180
1180
  count: z.ZodNumber;
@@ -1204,8 +1204,8 @@ export declare const MAIN_MIRROR_SCHEMAS: {
1204
1204
  sent: z.ZodBoolean;
1205
1205
  }, z.core.$strict>>;
1206
1206
  follow: z.ZodEnum<{
1207
- "in-step": "in-step";
1208
1207
  waiting: "waiting";
1208
+ "in-step": "in-step";
1209
1209
  "fast-forward": "fast-forward";
1210
1210
  ahead: "ahead";
1211
1211
  "to-update": "to-update";
@@ -1214,11 +1214,11 @@ export declare const MAIN_MIRROR_SCHEMAS: {
1214
1214
  }>;
1215
1215
  update: z.ZodOptional<z.ZodObject<{
1216
1216
  outcome: z.ZodEnum<{
1217
- refused: "refused";
1218
1217
  waiting: "waiting";
1218
+ refused: "refused";
1219
+ current: "current";
1219
1220
  "fast-forward": "fast-forward";
1220
1221
  merged: "merged";
1221
- current: "current";
1222
1222
  conflicts: "conflicts";
1223
1223
  }>;
1224
1224
  at: z.ZodNumber;
@@ -1247,10 +1247,10 @@ export declare const MAIN_MIRROR_ANSWER_SCHEMAS: {
1247
1247
  why: z.ZodOptional<z.ZodString>;
1248
1248
  verdict: z.ZodOptional<z.ZodObject<{
1249
1249
  state: z.ZodEnum<{
1250
+ waiting: "waiting";
1250
1251
  refused: "refused";
1251
1252
  "in-main": "in-main";
1252
1253
  "brought-in": "brought-in";
1253
- waiting: "waiting";
1254
1254
  "not-ff": "not-ff";
1255
1255
  }>;
1256
1256
  count: z.ZodNumber;
@@ -1265,8 +1265,8 @@ export declare const MAIN_MIRROR_ANSWER_SCHEMAS: {
1265
1265
  needWhole: z.ZodOptional<z.ZodBoolean>;
1266
1266
  why: z.ZodOptional<z.ZodString>;
1267
1267
  follow: z.ZodOptional<z.ZodEnum<{
1268
- "in-step": "in-step";
1269
1268
  waiting: "waiting";
1269
+ "in-step": "in-step";
1270
1270
  "fast-forward": "fast-forward";
1271
1271
  ahead: "ahead";
1272
1272
  "to-update": "to-update";
@@ -1333,9 +1333,9 @@ export declare const PEER_WORK_SCHEMAS: {
1333
1333
  runId: z.ZodString;
1334
1334
  at: z.ZodNumber;
1335
1335
  state: z.ZodEnum<{
1336
- failed: "failed";
1337
- passed: "passed";
1338
1336
  errored: "errored";
1337
+ passed: "passed";
1338
+ failed: "failed";
1339
1339
  cancelled: "cancelled";
1340
1340
  timeout: "timeout";
1341
1341
  }>;
@@ -1430,10 +1430,10 @@ export declare const PEER_WORK_SCHEMAS: {
1430
1430
  }, z.core.$strict>;
1431
1431
  why: z.ZodObject<{
1432
1432
  kind: z.ZodEnum<{
1433
+ restarting: "restarting";
1433
1434
  protocol: "protocol";
1434
1435
  version: "version";
1435
1436
  installed: "installed";
1436
- restarting: "restarting";
1437
1437
  "install-failed": "install-failed";
1438
1438
  "restart-failed": "restart-failed";
1439
1439
  "no-store": "no-store";
@@ -1495,18 +1495,18 @@ export declare const StoreReplySchema: z.ZodObject<{
1495
1495
  result: z.ZodOptional<z.ZodUnknown>;
1496
1496
  error: z.ZodOptional<z.ZodObject<{
1497
1497
  name: z.ZodEnum<{
1498
+ Error: "Error";
1498
1499
  CoordinationError: "CoordinationError";
1499
1500
  CapacityRefusal: "CapacityRefusal";
1500
1501
  CoordinationBusyError: "CoordinationBusyError";
1501
1502
  StoreCallRefused: "StoreCallRefused";
1502
- Error: "Error";
1503
1503
  }>;
1504
1504
  message: z.ZodString;
1505
1505
  room: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1506
1506
  step: z.ZodOptional<z.ZodEnum<{
1507
1507
  open: "open";
1508
- write: "write";
1509
1508
  commit: "commit";
1509
+ write: "write";
1510
1510
  read: "read";
1511
1511
  }>>;
1512
1512
  waitedMs: z.ZodOptional<z.ZodNumber>;
@@ -1594,10 +1594,10 @@ export declare const PEER_LAUNCH_SCHEMAS: {
1594
1594
  readonly 'launch.state': z.ZodObject<{
1595
1595
  launchId: z.ZodString;
1596
1596
  state: z.ZodEnum<{
1597
- stopped: "stopped";
1598
- exited: "exited";
1599
1597
  running: "running";
1600
1598
  failed: "failed";
1599
+ stopped: "stopped";
1600
+ exited: "exited";
1601
1601
  }>;
1602
1602
  at: z.ZodNumber;
1603
1603
  pid: z.ZodOptional<z.ZodNumber>;
@@ -1802,9 +1802,9 @@ export declare const GOAL_PEER_SCHEMAS: {
1802
1802
  sha256: z.ZodString;
1803
1803
  }, z.core.$strict>;
1804
1804
  services: z.ZodOptional<z.ZodEnum<{
1805
- "on-demand": "on-demand";
1806
- none: "none";
1807
1805
  always: "always";
1806
+ none: "none";
1807
+ "on-demand": "on-demand";
1808
1808
  }>>;
1809
1809
  at: z.ZodNumber;
1810
1810
  }, z.core.$strict>;
@@ -1819,12 +1819,12 @@ export declare const GOAL_PEER_SCHEMAS: {
1819
1819
  readonly 'goal.changes': z.ZodObject<{
1820
1820
  goal: z.ZodString;
1821
1821
  what: z.ZodEnum<{
1822
- commit: "commit";
1823
1822
  files: "files";
1824
- row: "row";
1823
+ commit: "commit";
1825
1824
  diff: "diff";
1826
- commits: "commits";
1827
1825
  against: "against";
1826
+ row: "row";
1827
+ commits: "commits";
1828
1828
  }>;
1829
1829
  path: z.ZodOptional<z.ZodString>;
1830
1830
  sha: z.ZodOptional<z.ZodString>;
@@ -1863,10 +1863,10 @@ export declare const GOAL_PEER_ANSWER_SCHEMAS: {
1863
1863
  ref: z.ZodString;
1864
1864
  sha: z.ZodOptional<z.ZodString>;
1865
1865
  mirror: z.ZodOptional<z.ZodEnum<{
1866
+ created: "created";
1867
+ current: "current";
1866
1868
  "not-ff": "not-ff";
1867
1869
  "fast-forward": "fast-forward";
1868
- current: "current";
1869
- created: "created";
1870
1870
  "checked-out": "checked-out";
1871
1871
  }>>;
1872
1872
  told: z.ZodOptional<z.ZodString>;
@@ -1883,10 +1883,10 @@ export declare const GOAL_PEER_ANSWER_SCHEMAS: {
1883
1883
  readonly 'goal.update': z.ZodObject<{
1884
1884
  outcome: z.ZodEnum<{
1885
1885
  refused: "refused";
1886
- merged: "merged";
1887
1886
  current: "current";
1888
- conflicts: "conflicts";
1889
1887
  asked: "asked";
1888
+ merged: "merged";
1889
+ conflicts: "conflicts";
1890
1890
  }>;
1891
1891
  why: z.ZodString;
1892
1892
  sha: z.ZodOptional<z.ZodString>;
@@ -2051,8 +2051,8 @@ export declare const CONVERSATION_PEER_SCHEMAS: {
2051
2051
  startedAt: z.ZodNumber;
2052
2052
  lastAt: z.ZodNumber;
2053
2053
  state: z.ZodEnum<{
2054
- ended: "ended";
2055
2054
  running: "running";
2055
+ ended: "ended";
2056
2056
  kept: "kept";
2057
2057
  }>;
2058
2058
  kind: z.ZodOptional<z.ZodEnum<{
@@ -2072,10 +2072,10 @@ export declare const CONVERSATION_PEER_SCHEMAS: {
2072
2072
  seq: z.ZodNumber;
2073
2073
  at: z.ZodOptional<z.ZodNumber>;
2074
2074
  kind: z.ZodEnum<{
2075
- reply: "reply";
2076
2075
  tool: "tool";
2077
- compaction: "compaction";
2078
2076
  prompt: "prompt";
2077
+ reply: "reply";
2078
+ compaction: "compaction";
2079
2079
  subagent: "subagent";
2080
2080
  }>;
2081
2081
  text: z.ZodString;
@@ -2084,8 +2084,8 @@ export declare const CONVERSATION_PEER_SCHEMAS: {
2084
2084
  name: z.ZodString;
2085
2085
  target: z.ZodOptional<z.ZodString>;
2086
2086
  outcome: z.ZodOptional<z.ZodEnum<{
2087
- ok: "ok";
2088
2087
  error: "error";
2088
+ ok: "ok";
2089
2089
  }>>;
2090
2090
  output: z.ZodOptional<z.ZodString>;
2091
2091
  }, z.core.$strict>>;
@@ -2094,8 +2094,8 @@ export declare const CONVERSATION_PEER_SCHEMAS: {
2094
2094
  settles: z.ZodOptional<z.ZodArray<z.ZodObject<{
2095
2095
  seq: z.ZodNumber;
2096
2096
  outcome: z.ZodEnum<{
2097
- ok: "ok";
2098
2097
  error: "error";
2098
+ ok: "ok";
2099
2099
  }>;
2100
2100
  output: z.ZodOptional<z.ZodString>;
2101
2101
  }, z.core.$strict>>>;
package/lib/peers.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Y=Object.defineProperty;var w=(e,o)=>Y(e,"name",{value:o,configurable:!0});var X=Object.defineProperty,i=w((e,o)=>X(e,"name",{value:o,configurable:!0}),"i");import{z as t}from"zod";import{RUN_ID_PATTERN as T}from"./docker-jobs.js";import{CONVERSATION_ID as J,CONVERSATION_LIST_MAX as D,CONVERSATION_TOOL_OUTPUT_CHARS as M,CONVERSATION_TURN_CHARS as Q}from"./conversations.js";import{REMOTE_DASHBOARD_BASE_PATTERN as tt,REMOTE_INSTANCE_ID_PATTERN as N,REMOTE_INSTANCE_NAME_PREFIX as et}from"./remote-instances.js";export const PEER_PROTOCOL="peer/v1",PEER_PORT=7466,PEER_TIMING={pingMs:5e3,lostMs:45e3,windowMs:10*6e4,approveMs:10*6e4,capacityMs:3e4},PAIRING_CODE={length:10,tries:5},CROCKFORD_ALPHABET="0123456789ABCDEFGHJKMNPQRSTVWXYZ",PEER_PATHS={pair:"/peer/v1/pair",control:"/peer/v1/control",runs:"/peer/v1/runs/",bundles:"/peer/v1/bundles/",sent:"/peer/v1/sent/",tunnel:"/peer/v1/tunnel/"},RUN_UPLOAD_KINDS=["log","samples","events","artifacts"],RUN_UPLOAD_RANGE={from:"x-lensmcp-from",to:"x-lensmcp-to"},PEER_FILES={dir:"peers",key:"identity.key",cert:"identity.crt",window:"window.json",workers:"workers.json",organizer:"organizer.json",hub:"hub.json",hubLock:"hub.lock",hubLog:"hub.log",runs:"runs",instances:"instances"},FINGERPRINT_PATTERN=/^[0-9a-f]{64}$/,REMOTE_RUN_LOST="lost",PEER_MESSAGE_ID=/^[A-Za-z0-9_-]{1,64}$/,TO_WORKER=["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"],TO_ORGANIZER=["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"],EITHER_WAY=["ping"],PEER_REPLIES=["ack","error","pong"],PEER_MESSAGE_SLICE={hello:"D12 (versions: D13, capacity: D14)",ping:"D12",pong:"D12",ack:"D12",error:"D12",forget:"D11",capacity:"D14","job.offer":"D14","job.cancel":"D14/D18","job.state":"D14/D16","job.stage":"D16","job.done":"D16","bundle.ready":"D15","bundle.sent":"D34 (goal branches: D30)","tunnel.open":"D17","tunnel.close":"D17","launch.start":"D29","launch.stop":"D29","launch.state":"D29","launch.tail":"D29","store.call":"D27/D28","store.reply":"D27/D28","version.install":"D13","version.state":"D13","main.moved":"D34","main.state":"D34","instance.tunnel.open":"D35","instance.state":"D35 (sent by D30)","store.read":"D32","goal.place":"D30","goal.sent":"D30","goal.changes":"D30","goal.update":"D30","conversation.sync":"CV5","conversation.read":"CV5"};const f=i((e,o)=>e.includes(o),"has");export const isPeerMessageType=i(e=>Object.prototype.hasOwnProperty.call(PEER_MESSAGE_SLICE,e),"isPeerMessageType");export function peerMaySend(e,o){return f(EITHER_WAY,o)||f(PEER_REPLIES,o)?!0:f(e==="organizer"?TO_WORKER:TO_ORGANIZER,o)}w(peerMaySend,"peerMaySend"),i(peerMaySend,"peerMaySend");export const isPeerReply=i(e=>f(PEER_REPLIES,e),"isPeerReply");const s=/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]*$/u,d=i(e=>t.string().min(1).max(e).regex(s),"shownText"),$=t.string().regex(/^[A-Za-z0-9_-]{43}$/),C=t.string().regex(/^[0-9a-f]{64}$/),l=t.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),nt=t.tuple([t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/)]),n=t.number().int().nonnegative();export const PeerEnvelopeSchema=t.strictObject({v:t.literal(1),id:t.string().regex(PEER_MESSAGE_ID),replyTo:t.string().regex(PEER_MESSAGE_ID).optional(),type:t.string().min(1).max(40),body:t.record(t.string(),t.unknown())});const at=["unknown-type","wrong-direction","bad-message","hello-first","not-handled","too-large","busy","refused","timeout","lost","internal","no-window","window-used","window-closed","wrong-code","protocol"];export const PeerErrorBodySchema=t.strictObject({code:t.enum(at),message:t.string().max(500),triesLeft:t.number().int().min(0).max(PAIRING_CODE.tries).optional(),retryAfterMs:t.number().int().min(0).max(36e5).optional()});const p=t.string().regex(T);export const WorkerAdvertSchema=t.record(t.string(),t.unknown()).superRefine((e,o)=>{const O=e.runs;O!==void 0&&(!Array.isArray(O)||O.length>256||!O.every(z=>typeof z=="string"&&T.test(z)))&&o.addIssue({code:"custom",message:"runs: at most 256 run ids"})}),PEER_BODY_SCHEMAS={hello:t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,follow:t.boolean().optional(),store:t.array(l).max(64).optional(),capacity:WorkerAdvertSchema.optional()}),ping:t.strictObject({at:n}),pong:t.strictObject({at:n}),ack:t.strictObject({result:t.unknown().optional()}),error:PeerErrorBodySchema,forget:t.strictObject({why:t.string().max(200).regex(s).optional()})},PeerWelcomeSchema=t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,name:d(64),inStep:t.boolean().optional(),why:t.string().max(500).optional()}),PAIR_BODY_SCHEMAS={"pair.hello":t.strictObject({protocol:t.literal(PEER_PROTOCOL),nonce:$,name:d(64),model:d(40),lensmcp:l}),"pair.resume":t.strictObject({protocol:t.literal(PEER_PROTOCOL)}),"pair.challenge":t.strictObject({nonce:$}),"pair.proof":t.strictObject({proof:C}),"pair.accepted":t.strictObject({proof:C,name:d(64),model:d(40),words:nt,approveBy:n}),"pair.approved":t.strictObject({at:n}),"pair.declined":t.strictObject({why:t.string().max(500)}),error:PeerErrorBodySchema},MAIN_MIRROR={branch:"main",quietMs:10*6e4,snapshotEveryMs:60*6e4,maxSendBytes:512*1024*1024,maxWipBytes:256*1024*1024,maxHaves:16},MAIN_BRING_IN=["in-main","brought-in","waiting","not-ff","refused"],MAIN_FOLLOW_STATES=["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"];const r=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),y=t.string().regex(/^[0-9a-f]{16,64}$/),P=t.string().regex(/^[0-9a-f]{64}$/),L=t.string().regex(/^[0-9a-f]{16}$/),u=t.number().int().min(0).max(1e7),j=t.string().min(1).max(250).regex(/^[A-Za-z0-9._/-]+$/),E=t.string().max(1e3),Z=t.strictObject({state:t.enum(["in-main","brought-in","waiting","not-ff","refused"]),count:u,sha:r.optional(),main:r.optional(),why:E,at:n}),ot=t.strictObject({outcome:t.enum(["merged","fast-forward","current","conflicts","waiting","refused"]),at:n,why:E,sha:r.optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),asked:t.array(t.strictObject({who:t.enum(["person","manager"]),goal:t.string().max(64).optional(),to:t.string().max(200).optional()})).max(20).optional()}),B=t.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":t.strictObject({bundleId:L,repository:y,refs:t.array(j).length(1),size:t.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:P}),"main.moved":t.strictObject({repository:y,branch:j,sha:r,bundle:t.strictObject({id:L,size:t.number().int().positive(),sha256:P}),verdict:Z.optional(),at:n}),"main.state":t.strictObject({repository:y,branch:j,head:r.optional(),organizerHead:r.optional(),haves:t.array(r).max(MAIN_MIRROR.maxHaves),notSent:u,toPull:u,uncommitted:t.strictObject({files:u,changedAt:n.optional()}),snapshot:t.strictObject({sha:r,at:n,files:u,sent:t.boolean()}).optional(),follow:B,update:ot.optional(),at:n})},MAIN_MIRROR_ANSWER_SCHEMAS={"bundle.sent":t.strictObject({took:t.boolean(),ref:j,sha:r.optional(),code:t.string().max(40).optional(),why:E.optional(),verdict:Z.optional()}),"main.moved":t.strictObject({took:t.boolean(),needWhole:t.boolean().optional(),why:E.optional(),follow:B.optional(),head:r.optional()})};const rt=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),v=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),H=t.string().regex(/^[0-9a-f]{16,64}$/),b=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),W=i(e=>t.string().min(1).max(e).regex(s),"sentence"),m=t.record(t.string(),t.unknown()),it=t.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,99}$/),c=t.strictObject({lensmcp:l,protocol:t.string().regex(/^peer\/v[1-9]\d{0,3}$/)});export const PEER_WORK_SCHEMAS={capacity:WorkerAdvertSchema,"job.offer":t.strictObject({runId:p,job:rt,candidate:v,repository:H,lane:t.enum(["light","heavy"]).optional(),kind:t.enum(["compose","testcontainers","playwright"]).optional(),hostMb:t.number().int().min(0).max(1024*1024).optional(),vmMb:t.number().int().min(0).max(1024*1024).optional(),proof:t.boolean().optional(),timeoutMinutes:t.number().positive().max(360).optional(),onLinkLoss:t.union([t.literal("cancel"),t.strictObject({continueMinutes:t.number().int().min(1).max(360)})]).optional(),secrets:t.record(it,t.string().min(1).max(8192)).refine(e=>Object.keys(e).length<=16,"at most 16 secrets").optional(),origin:t.string().max(300).regex(/^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$/).optional()}),"job.cancel":t.strictObject({runId:p,why:W(300)}),"job.state":t.strictObject({runId:p,at:n,started:t.literal(!0).optional(),state:t.enum(["queued","running"]).optional(),note:t.string().max(1e3).optional(),queue:m.optional(),docker:m.optional(),edgePort:t.number().int().min(1024).max(65535).optional()}),"job.stage":t.strictObject({runId:p,stage:W(120),at:n}),"job.done":t.strictObject({runId:p,at:n,state:t.enum(["passed","failed","errored","cancelled","timeout"]),note:t.string().max(1e3).optional(),step:m.optional(),docker:m.optional(),givenBack:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),refused:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),proof:m.optional()}),"bundle.ready":t.strictObject({runId:p.optional(),bundleId:b,repository:H,heads:t.array(v).min(1).max(16),basis:t.array(v).max(256).optional(),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/),shipment:m.optional(),blobs:t.record(t.string().regex(/^[0-9a-f]{64}$/),b).refine(e=>Object.keys(e).length<=101,"at most 101 blobs").optional()}),"tunnel.open":t.strictObject({tunnelId:b,runId:p,port:t.number().int().min(1).max(65535).optional()}),"tunnel.close":t.strictObject({tunnelId:b,why:t.string().max(300).optional()}),"version.install":t.strictObject({version:l,from:t.enum(["registry","organizer"]),tarball:t.strictObject({bundleId:b,sha256:t.string().regex(/^[0-9a-f]{64}$/),size:t.number().int().positive().max(8*1024*1024*1024)}).optional()}),"version.state":t.discriminatedUnion("state",[t.strictObject({state:t.literal("in-step"),worker:c,organizer:c}),t.strictObject({state:t.literal("installing"),worker:c,organizer:c,from:t.enum(["registry","organizer"]),since:n}),t.strictObject({state:t.literal("waiting-for-person"),worker:c,organizer:c,stored:t.boolean()}),t.strictObject({state:t.literal("out-of-step"),worker:c,organizer:c,why:t.object({kind:t.enum(["protocol","version","installed","restarting","install-failed","restart-failed","no-store"])}).catchall(t.union([t.string().max(600),t.number(),t.boolean()]))})])},STORE_CALL_LIMITS={args:16,argsBytes:256*1024,answerBytes:480*1024},PEER_LAUNCH_KEY_PATTERN=/^[A-Za-z0-9_-]{43}$/;const G=t.strictObject({added:t.number().int().nonnegative().nullable(),removed:t.number().int().nonnegative().nullable()});export const StoreCallSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.call"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args),launchKey:t.string().min(16).max(512),observe:t.strictObject({intervalMs:t.number().int().min(0).max(864e5).optional(),snapshot:t.strictObject({branch:t.string().max(300).nullable(),head:t.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).nullable(),files:t.array(t.strictObject({path:t.string().min(1).max(4096),from:t.string().max(4096).optional(),status:t.string().max(2),staged:G.optional(),unstaged:G.optional()})).max(1e3),truncated:t.boolean()}).optional(),failed:t.literal(!0).optional()}).optional()}),StoreReplySchema=t.strictObject({v:t.literal(1),kind:t.literal("store.reply"),id:t.string().max(100),wrote:t.boolean(),result:t.unknown().optional(),error:t.strictObject({name:t.enum(["CoordinationError","CapacityRefusal","CoordinationBusyError","StoreCallRefused","Error"]),message:t.string().max(4e3),room:t.record(t.string(),t.unknown()).optional(),step:t.enum(["open","write","commit","read"]).optional(),waitedMs:t.number().nonnegative().optional(),tries:t.number().int().nonnegative().optional(),wrote:t.boolean().optional(),where:t.string().max(300).optional(),wal:t.boolean().optional()}).optional()}),REMOTE_INSTANCE_BODY_SCHEMAS={"instance.tunnel.open":t.strictObject({tunnelId:t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),instanceId:t.string().regex(N)}),"instance.state":t.strictObject({instanceId:t.string().regex(N),state:t.enum(["up","gone"]),apex:t.string().max(253).regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.localhost$/).startsWith(et).optional(),dashboardBase:t.string().regex(tt).optional(),at:n,why:t.string().max(500).regex(s).optional()})},PEER_LAUNCH_LIMITS={promptChars:64*1024,roleTextChars:64*1024,maxMinutes:720,tailLines:40,tailLineChars:400},PEER_LAUNCH_ID=/^ln-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const x=t.string().regex(PEER_LAUNCH_ID),st=t.string().regex(PEER_LAUNCH_KEY_PATTERN),U=t.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),lt=t.string().regex(/^[a-z][a-z0-9-]{0,39}$/),K=i(e=>t.string().min(1).max(e).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/),"clientWord"),R=t.string().min(2).max(1024).regex(/^\/[^\0\r\n]*$/).refine(e=>!e.split("/").includes(".."),"no .. part"),I=t.string().min(1).max(100).regex(/^[A-Za-z0-9._:-]+$/);export const PEER_LAUNCH_SCHEMAS={"launch.start":t.strictObject({launchId:x,repository:y,goal:I,task:U.optional(),role:lt,by:I,client:t.enum(["claude","codex"]),model:K(80).optional(),effort:K(40).optional(),worktree:R.optional(),placedGoal:t.literal(!0).optional(),prompt:t.string().min(1).max(PEER_LAUNCH_LIMITS.promptChars),roleText:t.string().max(PEER_LAUNCH_LIMITS.roleTextChars).optional(),name:t.string().min(1).max(80).regex(s).optional(),maxMinutes:t.number().int().min(1).max(PEER_LAUNCH_LIMITS.maxMinutes),account:t.string().regex(/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/).optional(),launchKey:st,lensmcp:l,resume:t.strictObject({launchId:x,threadId:U,from:R.optional()}).optional(),capKind:t.enum(["writers","checkers"]).optional()}).refine(e=>e.worktree===void 0!=(e.placedGoal===void 0),"a launch names its worktree, or that its goal is placed there \u2014 exactly one"),"launch.stop":t.strictObject({launchId:x,why:t.string().max(300).regex(s).optional()}),"launch.state":t.strictObject({launchId:x,state:t.enum(["running","exited","stopped","failed"]),at:n,pid:t.number().int().min(0).max(99999999).optional(),exitCode:t.number().int().min(-1).max(1024).optional(),endedAt:n.optional(),threadId:I.optional(),ended:t.strictObject({quota:t.strictObject({client:t.enum(["claude","codex"]),why:t.string().min(1).max(300),until:n,firstTurn:t.boolean(),account:t.string().max(40).optional()}).optional(),context:t.string().min(1).max(600).optional()}).optional()}),"launch.tail":t.strictObject({launchId:x,lines:t.array(t.string().max(PEER_LAUNCH_LIMITS.tailLineChars+8)).max(PEER_LAUNCH_LIMITS.tailLines),at:n})},LaunchStartedSchema=t.strictObject({started:t.literal(!0),pid:t.number().int().min(2).max(99999999),worktree:R,branch:t.string().max(250).optional(),startedAt:n,deadline:n,threadId:t.string().max(200).optional(),lensmcp:l}),STORE_READ_LIMITS={calls:24,argsBytes:64*1024,answerBytes:STORE_CALL_LIMITS.answerBytes},StoreReadSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.read"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),repoId:t.string().regex(/^[0-9a-f]{16,64}$/),calls:t.array(t.strictObject({method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args)})).min(1).max(STORE_READ_LIMITS.calls)}),GOAL_ON_WORKER={maxSendBytes:512*1024*1024,maxChangesBytes:400*1024,branchPrefix:"lensmcp/g-"};const _=t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),V=t.strictObject({id:t.string().regex(/^[0-9a-f]{16}$/),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),ct=t.string().min(1).max(200).regex(/^lensmcp\/g-[a-z0-9-]{1,30}$/),g=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),q=t.string().regex(/^[0-9a-f]{16,64}$/),A=t.string().max(1e3);export const GOAL_PEER_SCHEMAS={"goal.place":t.strictObject({goal:_,title:t.string().min(1).max(300).regex(s),repository:q,worktreeId:t.string().regex(/^[0-9a-f]{24}$/),name:t.string().regex(/^g-[a-z0-9](?:[a-z0-9-]{0,17}[a-z0-9])?$/),branch:ct,base:g,bundle:V,services:t.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":t.strictObject({bundleId:t.string().regex(/^[0-9a-f]{16}$/),repository:q,goal:_,ref:t.string().min(1).max(250).regex(/^heads\/lensmcp\/g-[a-z0-9-]{1,30}$/),size:t.number().int().positive().max(GOAL_ON_WORKER.maxSendBytes),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),"goal.changes":t.strictObject({goal:_,what:t.enum(["row","files","diff","commits","commit","against"]),path:t.string().min(1).max(4096).optional(),sha:g.optional(),full:t.boolean().optional(),againstMain:t.boolean().optional()}),"goal.update":t.strictObject({goal:_,main:t.strictObject({branch:t.string().min(1).max(200).regex(/^[A-Za-z0-9._/-]+$/),sha:g,bundle:V}),at:n})},GOAL_PEER_ANSWER_SCHEMAS={"goal.place":t.strictObject({state:t.enum(["ready","creating","failed"]),head:g.optional(),onDemand:t.boolean().optional(),needWhole:t.boolean().optional(),why:A.optional()}),"goal.sent":t.strictObject({took:t.boolean(),ref:t.string().max(250),sha:g.optional(),mirror:t.enum(["created","fast-forward","current","not-ff","checked-out"]).optional(),told:t.string().max(200).optional(),code:t.string().max(40).optional(),why:A.optional()}),"goal.changes":t.strictObject({ok:t.boolean(),value:t.unknown().optional(),status:t.number().int().min(100).max(599).optional(),why:A.optional(),shortened:t.boolean().optional()}),"goal.update":t.strictObject({outcome:t.enum(["current","merged","asked","conflicts","refused"]),why:A,sha:g.optional(),behind:t.number().int().min(0).max(1e7).optional(),dirty:t.number().int().min(0).max(1e7).optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),needWhole:t.boolean().optional()})},CONVERSATION_PEER_LIMITS={messageBytes:384*1024,conversations:32,turns:500,settles:64,turnBytes:64*1024,targetChars:4096,beatBytes:1024*1024,beatConversations:64,readTokens:6e4};const S=t.string().regex(J),F=t.string().regex(/^[0-9a-f]{16,64}$/),a=i(e=>t.string().max(e),"cvWords"),k=t.number().int().min(1).max(Number.MAX_SAFE_INTEGER),pt=t.strictObject({id:S,client:t.enum(["claude","codex"]),nativeId:t.string().regex(/^[\w.-]{8,128}$/),account:t.string().min(1).max(4200),accountNick:a(200).optional(),checkout:t.strictObject({root:t.string().min(1).max(4096),branch:a(300).optional(),key:a(300).optional()}),cwd:a(4096).optional(),model:a(200).optional(),startedAt:n,lastAt:n,state:t.enum(["running","ended","kept"]),kind:t.enum(["person","team","outside"]).optional(),sessionId:a(200).optional(),launchId:a(200).optional(),role:a(80).optional(),goalId:a(120).optional(),goalTitle:a(300).optional(),taskId:a(120).optional(),continues:S.optional()}),mt=t.strictObject({seq:k,at:n.optional(),kind:t.enum(["prompt","reply","tool","compaction","subagent"]),text:a(Q),cut:t.literal(!0).optional(),tool:t.strictObject({name:t.string().min(1).max(200),target:a(CONVERSATION_PEER_LIMITS.targetChars).optional(),outcome:t.enum(["ok","error"]).optional(),output:a(M).optional()}).optional(),files:t.array(t.string().min(1).max(4096)).max(50).optional()}),gt=t.strictObject({checkout:a(400).min(1).optional(),goalId:a(120).min(1).optional(),taskId:a(120).min(1).optional(),role:a(80).min(1).optional(),client:t.enum(["claude","codex"]).optional(),account:a(4200).min(1).optional(),mac:a(128).min(1).optional(),state:t.enum(["running","ended","kept"]).optional(),since:n.optional(),text:a(400).min(1).optional(),limit:t.number().int().min(1).max(D).optional()}),h=t.record(t.string(),t.unknown()),dt=t.discriminatedUnion("what",[t.strictObject({what:t.literal("list"),query:gt}),t.strictObject({what:t.literal("get"),id:t.string().min(1).max(200),part:t.enum(["handoff","turns"]),maxTokens:t.number().int().min(500).max(1e5).optional(),before:k.optional()})]);export const CONVERSATION_PEER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),kind:t.literal("conversation.sync"),repository:F,macBasis:t.string().regex(/^[\w-]{8,128}$/),conversations:t.array(t.strictObject({row:pt,turns:t.array(mt).max(CONVERSATION_PEER_LIMITS.turns),settles:t.array(t.strictObject({seq:k,outcome:t.enum(["ok","error"]),output:a(M).optional()})).max(CONVERSATION_PEER_LIMITS.settles).optional(),rewound:t.literal(!0).optional()})).min(1).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),kind:t.literal("conversation.read"),repository:F,ask:dt})},CONVERSATION_PEER_ANSWER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),held:t.array(t.strictObject({id:S,seq:t.number().int().min(0),refused:a(500).optional()})).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),from:t.strictObject({name:t.string().min(1).max(64).regex(s),fingerprint:t.string().regex(FINGERPRINT_PATTERN).optional()}),found:t.boolean(),why:a(1e3).optional(),list:t.object({conversations:t.array(h).max(D),more:t.boolean()}).passthrough().optional(),handoff:t.object({conversation:h,turns:t.array(h),more:t.boolean(),next:t.string()}).passthrough().optional(),page:t.object({conversation:h,turns:t.array(h),more:t.boolean()}).passthrough().optional()})};
1
+ "use strict";var J=Object.defineProperty;var w=(e,o)=>J(e,"name",{value:o,configurable:!0});var Q=Object.defineProperty,D=w((e,o)=>Q(e,"name",{value:o,configurable:!0}),"w"),tt=Object.defineProperty,M=D((e,o)=>tt(e,"name",{value:o,configurable:!0}),"w"),et=Object.defineProperty,i=M((e,o)=>et(e,"name",{value:o,configurable:!0}),"i");import{z as t}from"zod";import{RUN_ID_PATTERN as T}from"./docker-jobs.js";import{CONVERSATION_ID as nt,CONVERSATION_LIST_MAX as N,CONVERSATION_TOOL_OUTPUT_CHARS as $,CONVERSATION_TURN_CHARS as at}from"./conversations.js";import{REMOTE_DASHBOARD_BASE_PATTERN as ot,REMOTE_INSTANCE_ID_PATTERN as C,REMOTE_INSTANCE_NAME_PREFIX as rt}from"./remote-instances.js";export const PEER_PROTOCOL="peer/v1",PEER_PORT=7466,PEER_TIMING={pingMs:5e3,lostMs:45e3,windowMs:10*6e4,approveMs:10*6e4,capacityMs:3e4},PAIRING_CODE={length:10,tries:5},CROCKFORD_ALPHABET="0123456789ABCDEFGHJKMNPQRSTVWXYZ",PEER_PATHS={pair:"/peer/v1/pair",control:"/peer/v1/control",runs:"/peer/v1/runs/",bundles:"/peer/v1/bundles/",sent:"/peer/v1/sent/",tunnel:"/peer/v1/tunnel/"},RUN_UPLOAD_KINDS=["log","samples","events","artifacts"],RUN_UPLOAD_RANGE={from:"x-lensmcp-from",to:"x-lensmcp-to"},PEER_FILES={dir:"peers",key:"identity.key",cert:"identity.crt",window:"window.json",workers:"workers.json",organizer:"organizer.json",hub:"hub.json",hubLock:"hub.lock",hubLog:"hub.log",runs:"runs",instances:"instances"},FINGERPRINT_PATTERN=/^[0-9a-f]{64}$/,REMOTE_RUN_LOST="lost",PEER_MESSAGE_ID=/^[A-Za-z0-9_-]{1,64}$/,TO_WORKER=["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"],TO_ORGANIZER=["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"],EITHER_WAY=["ping"],PEER_REPLIES=["ack","error","pong"],PEER_MESSAGE_SLICE={hello:"D12 (versions: D13, capacity: D14)",ping:"D12",pong:"D12",ack:"D12",error:"D12",forget:"D11",capacity:"D14","job.offer":"D14","job.cancel":"D14/D18","job.state":"D14/D16","job.stage":"D16","job.done":"D16","bundle.ready":"D15","bundle.sent":"D34 (goal branches: D30)","tunnel.open":"D17","tunnel.close":"D17","launch.start":"D29","launch.stop":"D29","launch.state":"D29","launch.tail":"D29","store.call":"D27/D28","store.reply":"D27/D28","version.install":"D13","version.state":"D13","main.moved":"D34","main.state":"D34","instance.tunnel.open":"D35","instance.state":"D35 (sent by D30)","store.read":"D32","goal.place":"D30","goal.sent":"D30","goal.changes":"D30","goal.update":"D30","conversation.sync":"CV5","conversation.read":"CV5"};const f=i((e,o)=>e.includes(o),"has");export const isPeerMessageType=i(e=>Object.prototype.hasOwnProperty.call(PEER_MESSAGE_SLICE,e),"isPeerMessageType");export function peerMaySend(e,o){return f(EITHER_WAY,o)||f(PEER_REPLIES,o)?!0:f(e==="organizer"?TO_WORKER:TO_ORGANIZER,o)}w(peerMaySend,"peerMaySend"),D(peerMaySend,"peerMaySend"),M(peerMaySend,"peerMaySend"),i(peerMaySend,"peerMaySend");export const isPeerReply=i(e=>f(PEER_REPLIES,e),"isPeerReply");const s=/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]*$/u,d=i(e=>t.string().min(1).max(e).regex(s),"shownText"),P=t.string().regex(/^[A-Za-z0-9_-]{43}$/),L=t.string().regex(/^[0-9a-f]{64}$/),l=t.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),it=t.tuple([t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/)]),n=t.number().int().nonnegative();export const PeerEnvelopeSchema=t.strictObject({v:t.literal(1),id:t.string().regex(PEER_MESSAGE_ID),replyTo:t.string().regex(PEER_MESSAGE_ID).optional(),type:t.string().min(1).max(40),body:t.record(t.string(),t.unknown())});const st=["unknown-type","wrong-direction","bad-message","hello-first","not-handled","too-large","busy","refused","timeout","lost","internal","no-window","window-used","window-closed","wrong-code","protocol"];export const PeerErrorBodySchema=t.strictObject({code:t.enum(st),message:t.string().max(500),triesLeft:t.number().int().min(0).max(PAIRING_CODE.tries).optional(),retryAfterMs:t.number().int().min(0).max(36e5).optional()});const p=t.string().regex(T);export const WorkerAdvertSchema=t.record(t.string(),t.unknown()).superRefine((e,o)=>{const O=e.runs;O!==void 0&&(!Array.isArray(O)||O.length>256||!O.every(z=>typeof z=="string"&&T.test(z)))&&o.addIssue({code:"custom",message:"runs: at most 256 run ids"})}),PEER_BODY_SCHEMAS={hello:t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,follow:t.boolean().optional(),store:t.array(l).max(64).optional(),capacity:WorkerAdvertSchema.optional()}),ping:t.strictObject({at:n}),pong:t.strictObject({at:n}),ack:t.strictObject({result:t.unknown().optional()}),error:PeerErrorBodySchema,forget:t.strictObject({why:t.string().max(200).regex(s).optional()})},PeerWelcomeSchema=t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,name:d(64),inStep:t.boolean().optional(),why:t.string().max(500).optional()}),PAIR_BODY_SCHEMAS={"pair.hello":t.strictObject({protocol:t.literal(PEER_PROTOCOL),nonce:P,name:d(64),model:d(40),lensmcp:l}),"pair.resume":t.strictObject({protocol:t.literal(PEER_PROTOCOL)}),"pair.challenge":t.strictObject({nonce:P}),"pair.proof":t.strictObject({proof:L}),"pair.accepted":t.strictObject({proof:L,name:d(64),model:d(40),words:it,approveBy:n}),"pair.approved":t.strictObject({at:n}),"pair.declined":t.strictObject({why:t.string().max(500)}),error:PeerErrorBodySchema},MAIN_MIRROR={branch:"main",quietMs:10*6e4,snapshotEveryMs:60*6e4,maxSendBytes:512*1024*1024,maxWipBytes:256*1024*1024,maxHaves:16},MAIN_BRING_IN=["in-main","brought-in","waiting","not-ff","refused"],MAIN_FOLLOW_STATES=["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"];const r=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),y=t.string().regex(/^[0-9a-f]{16,64}$/),Z=t.string().regex(/^[0-9a-f]{64}$/),B=t.string().regex(/^[0-9a-f]{16}$/),u=t.number().int().min(0).max(1e7),j=t.string().min(1).max(250).regex(/^[A-Za-z0-9._/-]+$/),E=t.string().max(1e3),H=t.strictObject({state:t.enum(["in-main","brought-in","waiting","not-ff","refused"]),count:u,sha:r.optional(),main:r.optional(),why:E,at:n}),lt=t.strictObject({outcome:t.enum(["merged","fast-forward","current","conflicts","waiting","refused"]),at:n,why:E,sha:r.optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),asked:t.array(t.strictObject({who:t.enum(["person","manager"]),goal:t.string().max(64).optional(),to:t.string().max(200).optional()})).max(20).optional()}),W=t.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":t.strictObject({bundleId:B,repository:y,refs:t.array(j).length(1),size:t.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:Z}),"main.moved":t.strictObject({repository:y,branch:j,sha:r,bundle:t.strictObject({id:B,size:t.number().int().positive(),sha256:Z}),verdict:H.optional(),at:n}),"main.state":t.strictObject({repository:y,branch:j,head:r.optional(),organizerHead:r.optional(),haves:t.array(r).max(MAIN_MIRROR.maxHaves),notSent:u,toPull:u,uncommitted:t.strictObject({files:u,changedAt:n.optional()}),snapshot:t.strictObject({sha:r,at:n,files:u,sent:t.boolean()}).optional(),follow:W,update:lt.optional(),at:n})},MAIN_MIRROR_ANSWER_SCHEMAS={"bundle.sent":t.strictObject({took:t.boolean(),ref:j,sha:r.optional(),code:t.string().max(40).optional(),why:E.optional(),verdict:H.optional()}),"main.moved":t.strictObject({took:t.boolean(),needWhole:t.boolean().optional(),why:E.optional(),follow:W.optional(),head:r.optional()})};const ct=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),v=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),G=t.string().regex(/^[0-9a-f]{16,64}$/),b=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),U=i(e=>t.string().min(1).max(e).regex(s),"sentence"),m=t.record(t.string(),t.unknown()),pt=t.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,99}$/),c=t.strictObject({lensmcp:l,protocol:t.string().regex(/^peer\/v[1-9]\d{0,3}$/)});export const PEER_WORK_SCHEMAS={capacity:WorkerAdvertSchema,"job.offer":t.strictObject({runId:p,job:ct,candidate:v,repository:G,lane:t.enum(["light","heavy"]).optional(),kind:t.enum(["compose","testcontainers","playwright"]).optional(),hostMb:t.number().int().min(0).max(1024*1024).optional(),vmMb:t.number().int().min(0).max(1024*1024).optional(),proof:t.boolean().optional(),timeoutMinutes:t.number().positive().max(360).optional(),onLinkLoss:t.union([t.literal("cancel"),t.strictObject({continueMinutes:t.number().int().min(1).max(360)})]).optional(),secrets:t.record(pt,t.string().min(1).max(8192)).refine(e=>Object.keys(e).length<=16,"at most 16 secrets").optional(),origin:t.string().max(300).regex(/^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$/).optional()}),"job.cancel":t.strictObject({runId:p,why:U(300)}),"job.state":t.strictObject({runId:p,at:n,started:t.literal(!0).optional(),state:t.enum(["queued","running"]).optional(),note:t.string().max(1e3).optional(),queue:m.optional(),docker:m.optional(),edgePort:t.number().int().min(1024).max(65535).optional()}),"job.stage":t.strictObject({runId:p,stage:U(120),at:n}),"job.done":t.strictObject({runId:p,at:n,state:t.enum(["passed","failed","errored","cancelled","timeout"]),note:t.string().max(1e3).optional(),step:m.optional(),docker:m.optional(),givenBack:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),refused:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),proof:m.optional()}),"bundle.ready":t.strictObject({runId:p.optional(),bundleId:b,repository:G,heads:t.array(v).min(1).max(16),basis:t.array(v).max(256).optional(),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/),shipment:m.optional(),blobs:t.record(t.string().regex(/^[0-9a-f]{64}$/),b).refine(e=>Object.keys(e).length<=101,"at most 101 blobs").optional()}),"tunnel.open":t.strictObject({tunnelId:b,runId:p,port:t.number().int().min(1).max(65535).optional()}),"tunnel.close":t.strictObject({tunnelId:b,why:t.string().max(300).optional()}),"version.install":t.strictObject({version:l,from:t.enum(["registry","organizer"]),tarball:t.strictObject({bundleId:b,sha256:t.string().regex(/^[0-9a-f]{64}$/),size:t.number().int().positive().max(8*1024*1024*1024)}).optional()}),"version.state":t.discriminatedUnion("state",[t.strictObject({state:t.literal("in-step"),worker:c,organizer:c}),t.strictObject({state:t.literal("installing"),worker:c,organizer:c,from:t.enum(["registry","organizer"]),since:n}),t.strictObject({state:t.literal("waiting-for-person"),worker:c,organizer:c,stored:t.boolean()}),t.strictObject({state:t.literal("out-of-step"),worker:c,organizer:c,why:t.object({kind:t.enum(["protocol","version","installed","restarting","install-failed","restart-failed","no-store"])}).catchall(t.union([t.string().max(600),t.number(),t.boolean()]))})])},STORE_CALL_LIMITS={args:16,argsBytes:256*1024,answerBytes:480*1024},PEER_LAUNCH_KEY_PATTERN=/^[A-Za-z0-9_-]{43}$/;const K=t.strictObject({added:t.number().int().nonnegative().nullable(),removed:t.number().int().nonnegative().nullable()});export const StoreCallSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.call"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args),launchKey:t.string().min(16).max(512),observe:t.strictObject({intervalMs:t.number().int().min(0).max(864e5).optional(),snapshot:t.strictObject({branch:t.string().max(300).nullable(),head:t.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).nullable(),files:t.array(t.strictObject({path:t.string().min(1).max(4096),from:t.string().max(4096).optional(),status:t.string().max(2),staged:K.optional(),unstaged:K.optional()})).max(1e3),truncated:t.boolean()}).optional(),failed:t.literal(!0).optional()}).optional()}),StoreReplySchema=t.strictObject({v:t.literal(1),kind:t.literal("store.reply"),id:t.string().max(100),wrote:t.boolean(),result:t.unknown().optional(),error:t.strictObject({name:t.enum(["CoordinationError","CapacityRefusal","CoordinationBusyError","StoreCallRefused","Error"]),message:t.string().max(4e3),room:t.record(t.string(),t.unknown()).optional(),step:t.enum(["open","write","commit","read"]).optional(),waitedMs:t.number().nonnegative().optional(),tries:t.number().int().nonnegative().optional(),wrote:t.boolean().optional(),where:t.string().max(300).optional(),wal:t.boolean().optional()}).optional()}),REMOTE_INSTANCE_BODY_SCHEMAS={"instance.tunnel.open":t.strictObject({tunnelId:t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),instanceId:t.string().regex(C)}),"instance.state":t.strictObject({instanceId:t.string().regex(C),state:t.enum(["up","gone"]),apex:t.string().max(253).regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.localhost$/).startsWith(rt).optional(),dashboardBase:t.string().regex(ot).optional(),at:n,why:t.string().max(500).regex(s).optional()})},PEER_LAUNCH_LIMITS={promptChars:64*1024,roleTextChars:64*1024,maxMinutes:720,tailLines:40,tailLineChars:400},PEER_LAUNCH_ID=/^ln-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const x=t.string().regex(PEER_LAUNCH_ID),mt=t.string().regex(PEER_LAUNCH_KEY_PATTERN),V=t.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),gt=t.string().regex(/^[a-z][a-z0-9-]{0,39}$/),q=i(e=>t.string().min(1).max(e).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/),"clientWord"),R=t.string().min(2).max(1024).regex(/^\/[^\0\r\n]*$/).refine(e=>!e.split("/").includes(".."),"no .. part"),I=t.string().min(1).max(100).regex(/^[A-Za-z0-9._:-]+$/);export const PEER_LAUNCH_SCHEMAS={"launch.start":t.strictObject({launchId:x,repository:y,goal:I,task:V.optional(),role:gt,by:I,client:t.enum(["claude","codex"]),model:q(80).optional(),effort:q(40).optional(),worktree:R.optional(),placedGoal:t.literal(!0).optional(),prompt:t.string().min(1).max(PEER_LAUNCH_LIMITS.promptChars),roleText:t.string().max(PEER_LAUNCH_LIMITS.roleTextChars).optional(),name:t.string().min(1).max(80).regex(s).optional(),maxMinutes:t.number().int().min(1).max(PEER_LAUNCH_LIMITS.maxMinutes),account:t.string().regex(/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/).optional(),launchKey:mt,lensmcp:l,resume:t.strictObject({launchId:x,threadId:V,from:R.optional()}).optional(),capKind:t.enum(["writers","checkers"]).optional()}).refine(e=>e.worktree===void 0!=(e.placedGoal===void 0),"a launch names its worktree, or that its goal is placed there \u2014 exactly one"),"launch.stop":t.strictObject({launchId:x,why:t.string().max(300).regex(s).optional()}),"launch.state":t.strictObject({launchId:x,state:t.enum(["running","exited","stopped","failed"]),at:n,pid:t.number().int().min(0).max(99999999).optional(),exitCode:t.number().int().min(-1).max(1024).optional(),endedAt:n.optional(),threadId:I.optional(),ended:t.strictObject({quota:t.strictObject({client:t.enum(["claude","codex"]),why:t.string().min(1).max(300),until:n,firstTurn:t.boolean(),account:t.string().max(40).optional()}).optional(),context:t.string().min(1).max(600).optional()}).optional()}),"launch.tail":t.strictObject({launchId:x,lines:t.array(t.string().max(PEER_LAUNCH_LIMITS.tailLineChars+8)).max(PEER_LAUNCH_LIMITS.tailLines),at:n})},LaunchStartedSchema=t.strictObject({started:t.literal(!0),pid:t.number().int().min(2).max(99999999),worktree:R,branch:t.string().max(250).optional(),startedAt:n,deadline:n,threadId:t.string().max(200).optional(),lensmcp:l}),STORE_READ_LIMITS={calls:24,argsBytes:64*1024,answerBytes:STORE_CALL_LIMITS.answerBytes},StoreReadSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.read"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),repoId:t.string().regex(/^[0-9a-f]{16,64}$/),calls:t.array(t.strictObject({method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args)})).min(1).max(STORE_READ_LIMITS.calls)}),GOAL_ON_WORKER={maxSendBytes:512*1024*1024,maxChangesBytes:400*1024,branchPrefix:"lensmcp/g-"};const _=t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),F=t.strictObject({id:t.string().regex(/^[0-9a-f]{16}$/),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),dt=t.string().min(1).max(200).regex(/^lensmcp\/g-[a-z0-9-]{1,30}$/),g=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Y=t.string().regex(/^[0-9a-f]{16,64}$/),A=t.string().max(1e3);export const GOAL_PEER_SCHEMAS={"goal.place":t.strictObject({goal:_,title:t.string().min(1).max(300).regex(s),repository:Y,worktreeId:t.string().regex(/^[0-9a-f]{24}$/),name:t.string().regex(/^g-[a-z0-9](?:[a-z0-9-]{0,17}[a-z0-9])?$/),branch:dt,base:g,bundle:F,services:t.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":t.strictObject({bundleId:t.string().regex(/^[0-9a-f]{16}$/),repository:Y,goal:_,ref:t.string().min(1).max(250).regex(/^heads\/lensmcp\/g-[a-z0-9-]{1,30}$/),size:t.number().int().positive().max(GOAL_ON_WORKER.maxSendBytes),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),"goal.changes":t.strictObject({goal:_,what:t.enum(["row","files","diff","commits","commit","against"]),path:t.string().min(1).max(4096).optional(),sha:g.optional(),full:t.boolean().optional(),againstMain:t.boolean().optional()}),"goal.update":t.strictObject({goal:_,main:t.strictObject({branch:t.string().min(1).max(200).regex(/^[A-Za-z0-9._/-]+$/),sha:g,bundle:F}),at:n})},GOAL_PEER_ANSWER_SCHEMAS={"goal.place":t.strictObject({state:t.enum(["ready","creating","failed"]),head:g.optional(),onDemand:t.boolean().optional(),needWhole:t.boolean().optional(),why:A.optional()}),"goal.sent":t.strictObject({took:t.boolean(),ref:t.string().max(250),sha:g.optional(),mirror:t.enum(["created","fast-forward","current","not-ff","checked-out"]).optional(),told:t.string().max(200).optional(),code:t.string().max(40).optional(),why:A.optional()}),"goal.changes":t.strictObject({ok:t.boolean(),value:t.unknown().optional(),status:t.number().int().min(100).max(599).optional(),why:A.optional(),shortened:t.boolean().optional()}),"goal.update":t.strictObject({outcome:t.enum(["current","merged","asked","conflicts","refused"]),why:A,sha:g.optional(),behind:t.number().int().min(0).max(1e7).optional(),dirty:t.number().int().min(0).max(1e7).optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),needWhole:t.boolean().optional()})},CONVERSATION_PEER_LIMITS={messageBytes:384*1024,conversations:32,turns:500,settles:64,turnBytes:64*1024,targetChars:4096,beatBytes:1024*1024,beatConversations:64,readTokens:6e4};const S=t.string().regex(nt),X=t.string().regex(/^[0-9a-f]{16,64}$/),a=i(e=>t.string().max(e),"cvWords"),k=t.number().int().min(1).max(Number.MAX_SAFE_INTEGER),ut=t.strictObject({id:S,client:t.enum(["claude","codex"]),nativeId:t.string().regex(/^[\w.-]{8,128}$/),account:t.string().min(1).max(4200),accountNick:a(200).optional(),checkout:t.strictObject({root:t.string().min(1).max(4096),branch:a(300).optional(),key:a(300).optional()}),cwd:a(4096).optional(),model:a(200).optional(),startedAt:n,lastAt:n,state:t.enum(["running","ended","kept"]),kind:t.enum(["person","team","outside"]).optional(),sessionId:a(200).optional(),launchId:a(200).optional(),role:a(80).optional(),goalId:a(120).optional(),goalTitle:a(300).optional(),taskId:a(120).optional(),continues:S.optional()}),bt=t.strictObject({seq:k,at:n.optional(),kind:t.enum(["prompt","reply","tool","compaction","subagent"]),text:a(at),cut:t.literal(!0).optional(),tool:t.strictObject({name:t.string().min(1).max(200),target:a(CONVERSATION_PEER_LIMITS.targetChars).optional(),outcome:t.enum(["ok","error"]).optional(),output:a($).optional()}).optional(),files:t.array(t.string().min(1).max(4096)).max(50).optional()}),xt=t.strictObject({checkout:a(400).min(1).optional(),goalId:a(120).min(1).optional(),taskId:a(120).min(1).optional(),role:a(80).min(1).optional(),client:t.enum(["claude","codex"]).optional(),account:a(4200).min(1).optional(),mac:a(128).min(1).optional(),state:t.enum(["running","ended","kept"]).optional(),since:n.optional(),text:a(400).min(1).optional(),limit:t.number().int().min(1).max(N).optional()}),h=t.record(t.string(),t.unknown()),ht=t.discriminatedUnion("what",[t.strictObject({what:t.literal("list"),query:xt}),t.strictObject({what:t.literal("get"),id:t.string().min(1).max(200),part:t.enum(["handoff","turns"]),maxTokens:t.number().int().min(500).max(1e5).optional(),before:k.optional()})]);export const CONVERSATION_PEER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),kind:t.literal("conversation.sync"),repository:X,macBasis:t.string().regex(/^[\w-]{8,128}$/),conversations:t.array(t.strictObject({row:ut,turns:t.array(bt).max(CONVERSATION_PEER_LIMITS.turns),settles:t.array(t.strictObject({seq:k,outcome:t.enum(["ok","error"]),output:a($).optional()})).max(CONVERSATION_PEER_LIMITS.settles).optional(),rewound:t.literal(!0).optional()})).min(1).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),kind:t.literal("conversation.read"),repository:X,ask:ht})},CONVERSATION_PEER_ANSWER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),held:t.array(t.strictObject({id:S,seq:t.number().int().min(0),refused:a(500).optional()})).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),from:t.strictObject({name:t.string().min(1).max(64).regex(s),fingerprint:t.string().regex(FINGERPRINT_PATTERN).optional()}),found:t.boolean(),why:a(1e3).optional(),list:t.object({conversations:t.array(h).max(N),more:t.boolean()}).passthrough().optional(),handoff:t.object({conversation:h,turns:t.array(h),more:t.boolean(),next:t.string()}).passthrough().optional(),page:t.object({conversation:h,turns:t.array(h),more:t.boolean()}).passthrough().optional()})};
package/lib/perf-rules.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var o=(r,e)=>u(r,"name",{value:e,configurable:!0});var c=Object.defineProperty,a=o((r,e)=>c(r,"name",{value:e,configurable:!0}),"o");export const PERF_RULE_IDS=["bundle/heavy-barrel-import","pod/heap-budget","pod/retained-generation"],PERF_RULE_EVENT_KINDS=["perf-rule-finding","perf-rule-retracted","perf-rule-scan"],PERF_RULES_DOC="https://github.com/kiwiapps-ltd/lensmcp/blob/main/docs/lensmcp/concepts/memory-and-build-cost.mdx",PERF_RULE_DOCS={"bundle/heavy-barrel-import":`${PERF_RULES_DOC}#bundleheavy-barrel-import`,"pod/heap-budget":`${PERF_RULES_DOC}#podheap-budget`,"pod/retained-generation":`${PERF_RULES_DOC}#podretained-generation`};export function perfRuleFingerprint(r,e,n){return`perf-rule:${r}:${e}:${n}`}o(perfRuleFingerprint,"perfRuleFingerprint"),a(perfRuleFingerprint,"perfRuleFingerprint");export function perfRuleScanFingerprint(r,e){return`perf-rule-scan:${r}:${e}`}o(perfRuleScanFingerprint,"perfRuleScanFingerprint"),a(perfRuleScanFingerprint,"perfRuleScanFingerprint");const s=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,l=12,f=4e3,t=a((r,e=f)=>typeof r=="string"&&r.length>0&&r.length<=e,"isText");export function asPerfRuleRaw(r){if(!r||typeof r!="object")return;const e=r;if(!PERF_RULE_EVENT_KINDS.includes(e.kind)||typeof e.rule!="string"||!s.test(e.rule)||!t(e.project,512))return;if(e.kind==="perf-rule-scan"){const i=e.open;return!Array.isArray(i)||i.length>256||!i.every(p=>t(p,512))?void 0:r}if(!t(e.subject,512))return;if(e.kind==="perf-rule-retracted")return r;if(e.severity!=="warning"&&e.severity!=="error"||!t(e.title)||!t(e.summary)||!t(e.verify)||!t(e.docs,1024))return;const n=e.fix;if(!(!Array.isArray(n)||n.length===0||n.length>l||!n.every(i=>t(i)))&&!(!e.evidence||typeof e.evidence!="object"||Array.isArray(e.evidence))&&!(!e.cost||typeof e.cost!="object"||Array.isArray(e.cost)))return r}o(asPerfRuleRaw,"asPerfRuleRaw"),a(asPerfRuleRaw,"asPerfRuleRaw");
1
+ "use strict";var c=Object.defineProperty;var a=(r,e)=>c(r,"name",{value:e,configurable:!0});var f=Object.defineProperty,p=a((r,e)=>f(r,"name",{value:e,configurable:!0}),"a"),s=Object.defineProperty,o=p((r,e)=>s(r,"name",{value:e,configurable:!0}),"o"),d=Object.defineProperty,u=o((r,e)=>d(r,"name",{value:e,configurable:!0}),"o");export const PERF_RULE_IDS=["bundle/heavy-barrel-import","pod/heap-budget","pod/retained-generation"],PERF_RULE_EVENT_KINDS=["perf-rule-finding","perf-rule-retracted","perf-rule-scan"],PERF_RULES_DOC="https://github.com/kiwiapps-ltd/lensmcp/blob/main/docs/lensmcp/concepts/memory-and-build-cost.mdx",PERF_RULE_DOCS={"bundle/heavy-barrel-import":`${PERF_RULES_DOC}#bundleheavy-barrel-import`,"pod/heap-budget":`${PERF_RULES_DOC}#podheap-budget`,"pod/retained-generation":`${PERF_RULES_DOC}#podretained-generation`};export function perfRuleFingerprint(r,e,t){return`perf-rule:${r}:${e}:${t}`}a(perfRuleFingerprint,"perfRuleFingerprint"),p(perfRuleFingerprint,"perfRuleFingerprint"),o(perfRuleFingerprint,"perfRuleFingerprint"),u(perfRuleFingerprint,"perfRuleFingerprint");export function perfRuleScanFingerprint(r,e){return`perf-rule-scan:${r}:${e}`}a(perfRuleScanFingerprint,"perfRuleScanFingerprint"),p(perfRuleScanFingerprint,"perfRuleScanFingerprint"),o(perfRuleScanFingerprint,"perfRuleScanFingerprint"),u(perfRuleScanFingerprint,"perfRuleScanFingerprint");const g=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,y=12,R=4e3,n=u((r,e=R)=>typeof r=="string"&&r.length>0&&r.length<=e,"isText");export function asPerfRuleRaw(r){if(!r||typeof r!="object")return;const e=r;if(!PERF_RULE_EVENT_KINDS.includes(e.kind)||typeof e.rule!="string"||!g.test(e.rule)||!n(e.project,512))return;if(e.kind==="perf-rule-scan"){const i=e.open;return!Array.isArray(i)||i.length>256||!i.every(l=>n(l,512))?void 0:r}if(!n(e.subject,512))return;if(e.kind==="perf-rule-retracted")return r;if(e.severity!=="warning"&&e.severity!=="error"||!n(e.title)||!n(e.summary)||!n(e.verify)||!n(e.docs,1024))return;const t=e.fix;if(!(!Array.isArray(t)||t.length===0||t.length>y||!t.every(i=>n(i)))&&!(!e.evidence||typeof e.evidence!="object"||Array.isArray(e.evidence))&&!(!e.cost||typeof e.cost!="object"||Array.isArray(e.cost)))return r}a(asPerfRuleRaw,"asPerfRuleRaw"),p(asPerfRuleRaw,"asPerfRuleRaw"),o(asPerfRuleRaw,"asPerfRuleRaw"),u(asPerfRuleRaw,"asPerfRuleRaw");
package/lib/pod-memory.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty;var r=(o,e)=>t(o,"name",{value:e,configurable:!0});var d=Object.defineProperty,m=r((o,e)=>d(o,"name",{value:e,configurable:!0}),"r");export const POD_MEMORY_KINDS=["pod-memory","pod-memory-retained","pod-memory-released","pod-memory-exited"];export function asPodMemoryRaw(o){if(!o||typeof o!="object")return;const e=o;if(POD_MEMORY_KINDS.includes(e.kind)&&!(typeof e.project!="string"||!e.project)&&!(typeof e.pod!="number"||typeof e.pid!="number")&&!(e.kind==="pod-memory"&&(typeof e.live!="number"||!Number.isFinite(e.live)))&&!((e.kind==="pod-memory-retained"||e.kind==="pod-memory-released")&&typeof e.gen!="number"))return o}r(asPodMemoryRaw,"asPodMemoryRaw"),m(asPodMemoryRaw,"asPodMemoryRaw");
1
+ "use strict";var d=Object.defineProperty;var r=(o,e)=>d(o,"name",{value:e,configurable:!0});var m=Object.defineProperty,n=r((o,e)=>m(o,"name",{value:e,configurable:!0}),"o"),i=Object.defineProperty,t=n((o,e)=>i(o,"name",{value:e,configurable:!0}),"r"),a=Object.defineProperty,p=t((o,e)=>a(o,"name",{value:e,configurable:!0}),"r");export const POD_MEMORY_KINDS=["pod-memory","pod-memory-retained","pod-memory-released","pod-memory-exited"];export function asPodMemoryRaw(o){if(!o||typeof o!="object")return;const e=o;if(POD_MEMORY_KINDS.includes(e.kind)&&!(typeof e.project!="string"||!e.project)&&!(typeof e.pod!="number"||typeof e.pid!="number")&&!(e.kind==="pod-memory"&&(typeof e.live!="number"||!Number.isFinite(e.live)))&&!((e.kind==="pod-memory-retained"||e.kind==="pod-memory-released")&&typeof e.gen!="number"))return o}r(asPodMemoryRaw,"asPodMemoryRaw"),n(asPodMemoryRaw,"asPodMemoryRaw"),t(asPodMemoryRaw,"asPodMemoryRaw"),p(asPodMemoryRaw,"asPodMemoryRaw");
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var i=(t,o)=>m(t,"name",{value:o,configurable:!0});var R=Object.defineProperty,p=i((t,o)=>R(t,"name",{value:o,configurable:!0}),"u");import{z as e}from"zod";export const ProducerStateSchema=e.enum(["none","connected"]),ProducerRunStatusSchema=e.enum(["running","clean","failing","error"]),ProducerReportSchema=e.object({id:e.string(),tool:e.string(),project:e.string().optional(),firstReportedAt:e.number().int().nonnegative(),lastReportedAt:e.number().int().nonnegative(),lastRunStatus:ProducerRunStatusSchema,lastRunDurationMs:e.number().int().nonnegative().optional(),errorCount:e.number().int().nonnegative(),warningCount:e.number().int().nonnegative().optional(),error:e.string().optional()}),ProducerHealthSchema=e.object({producer:ProducerStateSchema,producers:e.array(ProducerReportSchema),lastReportedAt:e.number().int().nonnegative().optional(),ageMs:e.number().int().nonnegative().optional(),stale:e.boolean(),detail:e.string()}),PRODUCER_STALE_AFTER_MS=10*6e4;export function summariseProducers(t){const o=t.now??Date.now(),n=[...t.producers].sort((r,h)=>h.lastReportedAt-r.lastReportedAt);if(n.length===0)return{producer:"none",producers:[],stale:!1,detail:`No ${t.domain} producer has ever reported into this session \u2014 this is NOT a clean result, nothing is watching. ${t.noProducerHint}`};const d=n[0].lastReportedAt,u=Math.max(0,o-d),l=u>PRODUCER_STALE_AFTER_MS,c=n.filter(r=>r.lastRunStatus==="failing"),s=n.filter(r=>r.lastRunStatus==="error"),a=[`${n.length} ${t.domain} producer${n.length===1?"":"s"} reporting (${n.map(r=>r.id).join(", ")}); newest report ${g(u)}.`];return s.length>0&&a.push(`${s.length} produced NO verdict (the tool itself failed): ${s.map(r=>`${r.id} \u2014 ${r.error??"unknown error"}`).join("; ")}.`),c.length>0&&a.push(`${c.length} reporting errors.`),l&&a.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:n,lastReportedAt:d,ageMs:u,stale:l,detail:a.join(" ")}}i(summariseProducers,"summariseProducers"),p(summariseProducers,"summariseProducers");function g(t){return t<1e3?"just now":t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}i(g,"g"),p(g,"describeAge");
1
+ "use strict";var f=Object.defineProperty;var i=(e,n)=>f(e,"name",{value:n,configurable:!0});var R=Object.defineProperty,c=i((e,n)=>R(e,"name",{value:n,configurable:!0}),"i"),$=Object.defineProperty,l=c((e,n)=>$(e,"name",{value:n,configurable:!0}),"i"),v=Object.defineProperty,h=l((e,n)=>v(e,"name",{value:n,configurable:!0}),"u");import{z as r}from"zod";export const ProducerStateSchema=r.enum(["none","connected"]),ProducerRunStatusSchema=r.enum(["running","clean","failing","error"]),ProducerReportSchema=r.object({id:r.string(),tool:r.string(),project:r.string().optional(),firstReportedAt:r.number().int().nonnegative(),lastReportedAt:r.number().int().nonnegative(),lastRunStatus:ProducerRunStatusSchema,lastRunDurationMs:r.number().int().nonnegative().optional(),errorCount:r.number().int().nonnegative(),warningCount:r.number().int().nonnegative().optional(),error:r.string().optional()}),ProducerHealthSchema=r.object({producer:ProducerStateSchema,producers:r.array(ProducerReportSchema),lastReportedAt:r.number().int().nonnegative().optional(),ageMs:r.number().int().nonnegative().optional(),stale:r.boolean(),detail:r.string()}),PRODUCER_STALE_AFTER_MS=10*6e4;export function summariseProducers(e){const n=e.now??Date.now(),o=[...e.producers].sort((t,b)=>b.lastReportedAt-t.lastReportedAt);if(o.length===0)return{producer:"none",producers:[],stale:!1,detail:`No ${e.domain} producer has ever reported into this session \u2014 this is NOT a clean result, nothing is watching. ${e.noProducerHint}`};const p=o[0].lastReportedAt,s=Math.max(0,n-p),g=s>PRODUCER_STALE_AFTER_MS,m=o.filter(t=>t.lastRunStatus==="failing"),d=o.filter(t=>t.lastRunStatus==="error"),a=[`${o.length} ${e.domain} producer${o.length===1?"":"s"} reporting (${o.map(t=>t.id).join(", ")}); newest report ${u(s)}.`];return d.length>0&&a.push(`${d.length} produced NO verdict (the tool itself failed): ${d.map(t=>`${t.id} \u2014 ${t.error??"unknown error"}`).join("; ")}.`),m.length>0&&a.push(`${m.length} reporting errors.`),g&&a.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:o,lastReportedAt:p,ageMs:s,stale:g,detail:a.join(" ")}}i(summariseProducers,"summariseProducers"),c(summariseProducers,"summariseProducers"),l(summariseProducers,"summariseProducers"),h(summariseProducers,"summariseProducers");function u(e){return e<1e3?"just now":e<6e4?`${Math.round(e/1e3)}s ago`:e<36e5?`${Math.round(e/6e4)}m ago`:`${Math.round(e/36e5)}h ago`}i(u,"c"),c(u,"g"),l(u,"g"),h(u,"describeAge");
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty;var _=(E,e)=>t(E,"name",{value:e,configurable:!0});var n=Object.defineProperty,A=_((E,e)=>n(E,"name",{value:e,configurable:!0}),"t");export const REMOTE_INSTANCE_ID_PATTERN=/^[A-Za-z0-9][A-Za-z0-9_-]{7,39}$/,REMOTE_INSTANCE_NAME_PREFIX="g-",MAX_REMOTE_INSTANCE_SEC=14400,REMOTE_LENS_LABEL="lensmcp",REMOTE_DASHBOARD_BASE_PATTERN=/^\/[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/,PEER_TUNNEL_HEADER="x-lensmcp-peer-tunnel";export function remoteLensHost(E){return`${REMOTE_LENS_LABEL}.${E.toLowerCase()}`}_(remoteLensHost,"remoteLensHost"),A(remoteLensHost,"remoteLensHost");export const REMOTE_INSTANCES_FILE="instances.json";
1
+ "use strict";var o=Object.defineProperty;var t=(e,E)=>o(e,"name",{value:E,configurable:!0});var _=Object.defineProperty,n=t((e,E)=>_(e,"name",{value:E,configurable:!0}),"t"),a=Object.defineProperty,r=n((e,E)=>a(e,"name",{value:E,configurable:!0}),"_"),s=Object.defineProperty,A=r((e,E)=>s(e,"name",{value:E,configurable:!0}),"t");export const REMOTE_INSTANCE_ID_PATTERN=/^[A-Za-z0-9][A-Za-z0-9_-]{7,39}$/,REMOTE_INSTANCE_NAME_PREFIX="g-",MAX_REMOTE_INSTANCE_SEC=14400,REMOTE_LENS_LABEL="lensmcp",REMOTE_DASHBOARD_BASE_PATTERN=/^\/[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/,PEER_TUNNEL_HEADER="x-lensmcp-peer-tunnel";export function remoteLensHost(e){return`${REMOTE_LENS_LABEL}.${e.toLowerCase()}`}t(remoteLensHost,"remoteLensHost"),n(remoteLensHost,"remoteLensHost"),r(remoteLensHost,"remoteLensHost"),A(remoteLensHost,"remoteLensHost");export const REMOTE_INSTANCES_FILE="instances.json";