@lensmcp/protocol-types 1.26.2 → 1.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +13 -1
- package/index.js +1 -1
- package/lib/changes.d.ts +15 -3
- package/lib/cluster-hosts.d.ts +272 -0
- package/lib/cluster-hosts.js +1 -0
- package/lib/dashboard-lint.d.ts +22 -0
- package/lib/dashboard-updates.d.ts +80 -0
- package/lib/dashboard-updates.js +1 -0
- package/lib/dashboard.d.ts +8 -1
- package/lib/docker-errors.d.ts +123 -0
- package/lib/docker-errors.js +1 -0
- package/lib/docker-jobs.d.ts +673 -0
- package/lib/docker-jobs.js +1 -0
- package/lib/docker-report.d.ts +99 -0
- package/lib/docker-report.js +2 -0
- package/lib/docker-runs.d.ts +300 -0
- package/lib/docker-runs.js +3 -0
- package/lib/host-agents.d.ts +139 -0
- package/lib/host-agents.js +1 -0
- package/lib/hosts.d.ts +206 -0
- package/lib/hosts.js +1 -0
- package/lib/main-mirror.d.ts +117 -0
- package/lib/main-mirror.js +1 -0
- package/lib/peers.d.ts +1881 -0
- package/lib/peers.js +1 -0
- package/lib/proof.d.ts +32 -0
- package/lib/remote-instances.d.ts +129 -0
- package/lib/remote-instances.js +1 -0
- package/lib/resources.d.ts +2 -0
- package/lib/resources.js +1 -1
- package/lib/static-checks.d.ts +290 -0
- package/lib/static-checks.js +1 -0
- package/lib/team-delivery.d.ts +13 -0
- package/lib/team.d.ts +60 -2
- package/lib/workspace-actions.d.ts +104 -1
- package/lib/workspace-actions.js +1 -1
- package/package.json +1 -1
package/lib/peers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var W=Object.defineProperty;var w=(t,a)=>W(t,"name",{value:a,configurable:!0});var G=Object.defineProperty,s=w((t,a)=>G(t,"name",{value:a,configurable:!0}),"r");import{z as e}from"zod";import{RUN_ID_PATTERN as I}from"./docker-jobs.js";import{REMOTE_DASHBOARD_BASE_PATTERN as K,REMOTE_INSTANCE_ID_PATTERN as S,REMOTE_INSTANCE_NAME_PREFIX as U}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"],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"],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"};const h=s((t,a)=>t.includes(a),"has");export const isPeerMessageType=s(t=>Object.prototype.hasOwnProperty.call(PEER_MESSAGE_SLICE,t),"isPeerMessageType");export function peerMaySend(t,a){return h(EITHER_WAY,a)||h(PEER_REPLIES,a)?!0:h(t==="organizer"?TO_WORKER:TO_ORGANIZER,a)}w(peerMaySend,"peerMaySend"),s(peerMaySend,"peerMaySend");export const isPeerReply=s(t=>h(PEER_REPLIES,t),"isPeerReply");const l=/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]*$/u,m=s(t=>e.string().min(1).max(t).regex(l),"shownText"),z=e.string().regex(/^[A-Za-z0-9_-]{43}$/),D=e.string().regex(/^[0-9a-f]{64}$/),r=e.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),F=e.tuple([e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/)]),n=e.number().int().nonnegative();export const PeerEnvelopeSchema=e.strictObject({v:e.literal(1),id:e.string().regex(PEER_MESSAGE_ID),replyTo:e.string().regex(PEER_MESSAGE_ID).optional(),type:e.string().min(1).max(40),body:e.record(e.string(),e.unknown())});const Y=["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=e.strictObject({code:e.enum(Y),message:e.string().max(500),triesLeft:e.number().int().min(0).max(PAIRING_CODE.tries).optional(),retryAfterMs:e.number().int().min(0).max(36e5).optional()});const c=e.string().regex(I);export const WorkerAdvertSchema=e.record(e.string(),e.unknown()).superRefine((t,a)=>{const x=t.runs;x!==void 0&&(!Array.isArray(x)||x.length>256||!x.every(v=>typeof v=="string"&&I.test(v)))&&a.addIssue({code:"custom",message:"runs: at most 256 run ids"})}),PEER_BODY_SCHEMAS={hello:e.strictObject({protocol:e.literal(PEER_PROTOCOL),lensmcp:r,follow:e.boolean().optional(),store:e.array(r).max(64).optional(),capacity:WorkerAdvertSchema.optional()}),ping:e.strictObject({at:n}),pong:e.strictObject({at:n}),ack:e.strictObject({result:e.unknown().optional()}),error:PeerErrorBodySchema,forget:e.strictObject({why:e.string().max(200).regex(l).optional()})},PeerWelcomeSchema=e.strictObject({protocol:e.literal(PEER_PROTOCOL),lensmcp:r,name:m(64),inStep:e.boolean().optional(),why:e.string().max(500).optional()}),PAIR_BODY_SCHEMAS={"pair.hello":e.strictObject({protocol:e.literal(PEER_PROTOCOL),nonce:z,name:m(64),model:m(40),lensmcp:r}),"pair.resume":e.strictObject({protocol:e.literal(PEER_PROTOCOL)}),"pair.challenge":e.strictObject({nonce:z}),"pair.proof":e.strictObject({proof:D}),"pair.accepted":e.strictObject({proof:D,name:m(64),model:m(40),words:F,approveBy:n}),"pair.approved":e.strictObject({at:n}),"pair.declined":e.strictObject({why:e.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 o=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),f=e.string().regex(/^[0-9a-f]{16,64}$/),$=e.string().regex(/^[0-9a-f]{64}$/),M=e.string().regex(/^[0-9a-f]{16}$/),d=e.number().int().min(0).max(1e7),O=e.string().min(1).max(250).regex(/^[A-Za-z0-9._/-]+$/),y=e.string().max(1e3),k=e.strictObject({state:e.enum(["in-main","brought-in","waiting","not-ff","refused"]),count:d,sha:o.optional(),main:o.optional(),why:y,at:n}),q=e.strictObject({outcome:e.enum(["merged","fast-forward","current","conflicts","waiting","refused"]),at:n,why:y,sha:o.optional(),conflicts:e.array(e.string().min(1).max(4096)).max(200).optional(),asked:e.array(e.strictObject({who:e.enum(["person","manager"]),goal:e.string().max(64).optional(),to:e.string().max(200).optional()})).max(20).optional()}),P=e.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":e.strictObject({bundleId:M,repository:f,refs:e.array(O).length(1),size:e.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:$}),"main.moved":e.strictObject({repository:f,branch:O,sha:o,bundle:e.strictObject({id:M,size:e.number().int().positive(),sha256:$}),verdict:k.optional(),at:n}),"main.state":e.strictObject({repository:f,branch:O,head:o.optional(),organizerHead:o.optional(),haves:e.array(o).max(MAIN_MIRROR.maxHaves),notSent:d,toPull:d,uncommitted:e.strictObject({files:d,changedAt:n.optional()}),snapshot:e.strictObject({sha:o,at:n,files:d,sent:e.boolean()}).optional(),follow:P,update:q.optional(),at:n})},MAIN_MIRROR_ANSWER_SCHEMAS={"bundle.sent":e.strictObject({took:e.boolean(),ref:O,sha:o.optional(),code:e.string().max(40).optional(),why:y.optional(),verdict:k.optional()}),"main.moved":e.strictObject({took:e.boolean(),needWhole:e.boolean().optional(),why:y.optional(),follow:P.optional(),head:o.optional()})};const X=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),_=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),T=e.string().regex(/^[0-9a-f]{16,64}$/),u=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),C=s(t=>e.string().min(1).max(t).regex(l),"sentence"),p=e.record(e.string(),e.unknown()),J=e.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,99}$/),i=e.strictObject({lensmcp:r,protocol:e.string().regex(/^peer\/v[1-9]\d{0,3}$/)});export const PEER_WORK_SCHEMAS={capacity:WorkerAdvertSchema,"job.offer":e.strictObject({runId:c,job:X,candidate:_,repository:T,lane:e.enum(["light","heavy"]).optional(),kind:e.enum(["compose","testcontainers","playwright"]).optional(),hostMb:e.number().int().min(0).max(1024*1024).optional(),vmMb:e.number().int().min(0).max(1024*1024).optional(),proof:e.boolean().optional(),timeoutMinutes:e.number().positive().max(360).optional(),secrets:e.record(J,e.string().min(1).max(8192)).refine(t=>Object.keys(t).length<=16,"at most 16 secrets").optional(),origin:e.string().max(300).regex(/^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$/).optional()}),"job.cancel":e.strictObject({runId:c,why:C(300)}),"job.state":e.strictObject({runId:c,at:n,started:e.literal(!0).optional(),state:e.enum(["queued","running"]).optional(),note:e.string().max(1e3).optional(),queue:p.optional(),docker:p.optional(),edgePort:e.number().int().min(1024).max(65535).optional()}),"job.stage":e.strictObject({runId:c,stage:C(120),at:n}),"job.done":e.strictObject({runId:c,at:n,state:e.enum(["passed","failed","errored","cancelled","timeout"]),note:e.string().max(1e3).optional(),step:p.optional(),docker:p.optional(),givenBack:e.strictObject({why:e.string().min(1).max(1e3)}).optional(),refused:e.strictObject({why:e.string().min(1).max(1e3)}).optional(),proof:p.optional()}),"bundle.ready":e.strictObject({runId:c.optional(),bundleId:u,repository:T,heads:e.array(_).min(1).max(16),basis:e.array(_).max(256).optional(),size:e.number().int().positive().max(64*1024*1024*1024),sha256:e.string().regex(/^[0-9a-f]{64}$/),shipment:p.optional(),blobs:e.record(e.string().regex(/^[0-9a-f]{64}$/),u).refine(t=>Object.keys(t).length<=101,"at most 101 blobs").optional()}),"tunnel.open":e.strictObject({tunnelId:u,runId:c,port:e.number().int().min(1).max(65535).optional()}),"tunnel.close":e.strictObject({tunnelId:u,why:e.string().max(300).optional()}),"version.install":e.strictObject({version:r,from:e.enum(["registry","organizer"]),tarball:e.strictObject({bundleId:u,sha256:e.string().regex(/^[0-9a-f]{64}$/),size:e.number().int().positive().max(8*1024*1024*1024)}).optional()}),"version.state":e.discriminatedUnion("state",[e.strictObject({state:e.literal("in-step"),worker:i,organizer:i}),e.strictObject({state:e.literal("installing"),worker:i,organizer:i,from:e.enum(["registry","organizer"]),since:n}),e.strictObject({state:e.literal("waiting-for-person"),worker:i,organizer:i,stored:e.boolean()}),e.strictObject({state:e.literal("out-of-step"),worker:i,organizer:i,why:e.object({kind:e.enum(["protocol","version","installed","restarting","install-failed","restart-failed","no-store"])}).catchall(e.union([e.string().max(600),e.number(),e.boolean()]))})])},STORE_CALL_LIMITS={args:16,argsBytes:256*1024,answerBytes:480*1024},PEER_LAUNCH_KEY_PATTERN=/^[A-Za-z0-9_-]{43}$/;const N=e.strictObject({added:e.number().int().nonnegative().nullable(),removed:e.number().int().nonnegative().nullable()});export const StoreCallSchema=e.strictObject({v:e.literal(1),kind:e.literal("store.call"),id:e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),method:e.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:e.array(e.unknown()).max(STORE_CALL_LIMITS.args),launchKey:e.string().min(16).max(512),observe:e.strictObject({intervalMs:e.number().int().min(0).max(864e5).optional(),snapshot:e.strictObject({branch:e.string().max(300).nullable(),head:e.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).nullable(),files:e.array(e.strictObject({path:e.string().min(1).max(4096),from:e.string().max(4096).optional(),status:e.string().max(2),staged:N.optional(),unstaged:N.optional()})).max(1e3),truncated:e.boolean()}).optional(),failed:e.literal(!0).optional()}).optional()}),StoreReplySchema=e.strictObject({v:e.literal(1),kind:e.literal("store.reply"),id:e.string().max(100),wrote:e.boolean(),result:e.unknown().optional(),error:e.strictObject({name:e.enum(["CoordinationError","CapacityRefusal","CoordinationBusyError","StoreCallRefused","Error"]),message:e.string().max(4e3),room:e.record(e.string(),e.unknown()).optional(),step:e.enum(["open","write","commit","read"]).optional(),waitedMs:e.number().nonnegative().optional(),tries:e.number().int().nonnegative().optional(),wrote:e.boolean().optional(),where:e.string().max(300).optional(),wal:e.boolean().optional()}).optional()}),REMOTE_INSTANCE_BODY_SCHEMAS={"instance.tunnel.open":e.strictObject({tunnelId:e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),instanceId:e.string().regex(S)}),"instance.state":e.strictObject({instanceId:e.string().regex(S),state:e.enum(["up","gone"]),apex:e.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(U).optional(),dashboardBase:e.string().regex(K).optional(),at:n,why:e.string().max(500).regex(l).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 b=e.string().regex(PEER_LAUNCH_ID),Q=e.string().regex(PEER_LAUNCH_KEY_PATTERN),L=e.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),V=e.string().regex(/^[a-z][a-z0-9-]{0,39}$/),Z=s(t=>e.string().min(1).max(t).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/),"clientWord"),A=e.string().min(2).max(1024).regex(/^\/[^\0\r\n]*$/).refine(t=>!t.split("/").includes(".."),"no .. part"),R=e.string().min(1).max(100).regex(/^[A-Za-z0-9._:-]+$/);export const PEER_LAUNCH_SCHEMAS={"launch.start":e.strictObject({launchId:b,repository:f,goal:R,task:L.optional(),role:V,by:R,client:e.enum(["claude","codex"]),model:Z(80).optional(),effort:Z(40).optional(),worktree:A.optional(),placedGoal:e.literal(!0).optional(),prompt:e.string().min(1).max(PEER_LAUNCH_LIMITS.promptChars),roleText:e.string().max(PEER_LAUNCH_LIMITS.roleTextChars).optional(),name:e.string().min(1).max(80).regex(l).optional(),maxMinutes:e.number().int().min(1).max(PEER_LAUNCH_LIMITS.maxMinutes),account:e.string().regex(/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/).optional(),launchKey:Q,lensmcp:r,resume:e.strictObject({launchId:b,threadId:L,from:A.optional()}).optional(),capKind:e.enum(["writers","checkers"]).optional()}).refine(t=>t.worktree===void 0!=(t.placedGoal===void 0),"a launch names its worktree, or that its goal is placed there \u2014 exactly one"),"launch.stop":e.strictObject({launchId:b,why:e.string().max(300).regex(l).optional()}),"launch.state":e.strictObject({launchId:b,state:e.enum(["running","exited","stopped","failed"]),at:n,pid:e.number().int().min(0).max(99999999).optional(),exitCode:e.number().int().min(-1).max(1024).optional(),endedAt:n.optional(),threadId:R.optional(),ended:e.strictObject({quota:e.strictObject({client:e.enum(["claude","codex"]),why:e.string().min(1).max(300),until:n,firstTurn:e.boolean(),account:e.string().max(40).optional()}).optional(),context:e.string().min(1).max(600).optional()}).optional()}),"launch.tail":e.strictObject({launchId:b,lines:e.array(e.string().max(PEER_LAUNCH_LIMITS.tailLineChars+8)).max(PEER_LAUNCH_LIMITS.tailLines),at:n})},LaunchStartedSchema=e.strictObject({started:e.literal(!0),pid:e.number().int().min(2).max(99999999),worktree:A,branch:e.string().max(250).optional(),startedAt:n,deadline:n,threadId:e.string().max(200).optional(),lensmcp:r}),STORE_READ_LIMITS={calls:24,argsBytes:64*1024,answerBytes:STORE_CALL_LIMITS.answerBytes},StoreReadSchema=e.strictObject({v:e.literal(1),kind:e.literal("store.read"),id:e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),repoId:e.string().regex(/^[0-9a-f]{16,64}$/),calls:e.array(e.strictObject({method:e.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:e.array(e.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 j=e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),B=e.strictObject({id:e.string().regex(/^[0-9a-f]{16}$/),size:e.number().int().positive().max(64*1024*1024*1024),sha256:e.string().regex(/^[0-9a-f]{64}$/)}),ee=e.string().min(1).max(200).regex(/^lensmcp\/g-[a-z0-9-]{1,30}$/),g=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),H=e.string().regex(/^[0-9a-f]{16,64}$/),E=e.string().max(1e3);export const GOAL_PEER_SCHEMAS={"goal.place":e.strictObject({goal:j,title:e.string().min(1).max(300).regex(l),repository:H,worktreeId:e.string().regex(/^[0-9a-f]{24}$/),name:e.string().regex(/^g-[a-z0-9](?:[a-z0-9-]{0,17}[a-z0-9])?$/),branch:ee,base:g,bundle:B,services:e.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":e.strictObject({bundleId:e.string().regex(/^[0-9a-f]{16}$/),repository:H,goal:j,ref:e.string().min(1).max(250).regex(/^heads\/lensmcp\/g-[a-z0-9-]{1,30}$/),size:e.number().int().positive().max(GOAL_ON_WORKER.maxSendBytes),sha256:e.string().regex(/^[0-9a-f]{64}$/)}),"goal.changes":e.strictObject({goal:j,what:e.enum(["row","files","diff","commits","commit","against"]),path:e.string().min(1).max(4096).optional(),sha:g.optional(),full:e.boolean().optional(),againstMain:e.boolean().optional()}),"goal.update":e.strictObject({goal:j,main:e.strictObject({branch:e.string().min(1).max(200).regex(/^[A-Za-z0-9._/-]+$/),sha:g,bundle:B}),at:n})},GOAL_PEER_ANSWER_SCHEMAS={"goal.place":e.strictObject({state:e.enum(["ready","creating","failed"]),head:g.optional(),onDemand:e.boolean().optional(),needWhole:e.boolean().optional(),why:E.optional()}),"goal.sent":e.strictObject({took:e.boolean(),ref:e.string().max(250),sha:g.optional(),mirror:e.enum(["created","fast-forward","current","not-ff","checked-out"]).optional(),told:e.string().max(200).optional(),code:e.string().max(40).optional(),why:E.optional()}),"goal.changes":e.strictObject({ok:e.boolean(),value:e.unknown().optional(),status:e.number().int().min(100).max(599).optional(),why:E.optional(),shortened:e.boolean().optional()}),"goal.update":e.strictObject({outcome:e.enum(["current","merged","asked","conflicts","refused"]),why:E,sha:g.optional(),behind:e.number().int().min(0).max(1e7).optional(),dirty:e.number().int().min(0).max(1e7).optional(),conflicts:e.array(e.string().min(1).max(4096)).max(200).optional(),needWhole:e.boolean().optional()})};
|
package/lib/proof.d.ts
CHANGED
|
@@ -19,6 +19,25 @@ export interface RuntimeProofIdentity {
|
|
|
19
19
|
ran: string;
|
|
20
20
|
}>;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Where a proof ran (planning/docker/00-plan.md § 12, slice D25): evidence, as `runtime` and `runnerHash` are — never a
|
|
24
|
+
* candidate input. A job run on a worker Mac and the same run on the organizer stand for the same candidate; this says
|
|
25
|
+
* which Mac it was. (`peers.ts` may name the same shape for the channel: this is the proof's own.)
|
|
26
|
+
*/
|
|
27
|
+
export interface ProofHost {
|
|
28
|
+
/** The peer that ran it, as the organizer knows it: `local` for the organizer's own Mac, else the worker's peer id. */
|
|
29
|
+
peer: string;
|
|
30
|
+
/** The Mac's name, as it calls itself (its host name). */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Its processor, as Node names it: `arm64`, `x64`. */
|
|
33
|
+
arch: string;
|
|
34
|
+
/** Its system and release: `darwin 25.5.0`. */
|
|
35
|
+
os: string;
|
|
36
|
+
/** The Docker engine's version where the host said it (a worker's capacity) — absent where nothing asked Docker. */
|
|
37
|
+
docker?: string;
|
|
38
|
+
/** The LensMCP version that ran it. */
|
|
39
|
+
lensmcp: string;
|
|
40
|
+
}
|
|
22
41
|
/** Identity of a proof's source and declared execution inputs. Secret values are never retained. */
|
|
23
42
|
export interface ProofFingerprint {
|
|
24
43
|
version: 1;
|
|
@@ -42,10 +61,23 @@ export interface ProofFingerprint {
|
|
|
42
61
|
committed: string;
|
|
43
62
|
ran: string;
|
|
44
63
|
}>;
|
|
64
|
+
/**
|
|
65
|
+
* The Mac the proof ran on (slice D25). In the key, as `runtime` is — taken once per run, so before and after agree —
|
|
66
|
+
* and not a candidate input: a worker's proof and the organizer's of the same job, candidate and inputs differ here
|
|
67
|
+
* and nowhere else. Absent on proofs that do not say (every proof but a job's, for now).
|
|
68
|
+
*/
|
|
69
|
+
host?: ProofHost;
|
|
45
70
|
}
|
|
46
71
|
export interface ProofEvidence {
|
|
47
72
|
fingerprint?: ProofFingerprint;
|
|
48
73
|
eligible: boolean;
|
|
49
74
|
reason?: string;
|
|
50
75
|
verifiedAt?: number;
|
|
76
|
+
/**
|
|
77
|
+
* What a `lensmcp queue run` proof of a static check stands on (planning/checks § 8; CK-Q3): `exit-code` — the
|
|
78
|
+
* command's exit code alone, which cannot say what was checked (a `--work typecheck | lint | build | verify` run with
|
|
79
|
+
* no report); `coverage` — a `--report static-check` report that binds the result to the candidate and says what it
|
|
80
|
+
* covered. Absent on every other proof: a test run stands on its test report.
|
|
81
|
+
*/
|
|
82
|
+
basis?: 'exit-code' | 'coverage';
|
|
51
83
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REMOTE INSTANCES — a goal's runtime on a worker Mac, opened from the organizer's URLs (planning/docker/00-plan.md § 13
|
|
3
|
+
* «The lens for a remote goal's runtime», slice D35; issues/open/overseer-74). What the peer hub (`apps/agent`
|
|
4
|
+
* `peers/remote-instance.ts`) and the dev gateway (`@lensmcp/cluster` `runtime/remote-instances.ts`) share:
|
|
5
|
+
*
|
|
6
|
+
* - the route the hub asks of the organizer's gateway on its control socket (`POST/GET/DELETE /remote-instance`) — the
|
|
7
|
+
* request, the answer, the refusals. The gateway's copy is written beside its code (cluster does not depend on this
|
|
8
|
+
* package); `remote-instances.contract.spec.ts` (cluster) fails when the two differ;
|
|
9
|
+
* - the worker's record of the instances it runs for its organizer (`~/.lensmcp/peer/instances.json`) — what its side of
|
|
10
|
+
* the tunnel reads before it lets a request through: the instance's apex, and its lens dashboard's host and base;
|
|
11
|
+
* - the lens's own host, `lensmcp.<apex>`, which both sides derive the same way.
|
|
12
|
+
*
|
|
13
|
+
* The channel's messages for it (`instance.tunnel.open`, `instance.state`) are in `peers.ts`, with the rest of the union.
|
|
14
|
+
* Pure, as the rest of this package.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A remote instance's id: letters, digits, `_` and `-`, 8 to 40 characters — safe in a log line and a path, and short
|
|
18
|
+
* enough that `<home>/.lensmcp/peers/instances/<id>.sock` fits a unix socket's 103 bytes under a usual home.
|
|
19
|
+
*/
|
|
20
|
+
export declare const REMOTE_INSTANCE_ID_PATTERN: RegExp;
|
|
21
|
+
/**
|
|
22
|
+
* What a remote instance's name — its apex's first label — begins with: it is a goal's worktree on a worker, named as
|
|
23
|
+
* LensMCP names one (`g-<slug>-<id6>`). The organizer's gateway refuses any other name (a tenant's under the main
|
|
24
|
+
* checkout's wildcard would be taken from it), and the worker records no other.
|
|
25
|
+
*/
|
|
26
|
+
export declare const REMOTE_INSTANCE_NAME_PREFIX = "g-";
|
|
27
|
+
/** The longest lease of a remote instance's route (s): a hub that died leaves no route for longer. */
|
|
28
|
+
export declare const MAX_REMOTE_INSTANCE_SEC: number;
|
|
29
|
+
/**
|
|
30
|
+
* The label of a remote instance's lens host: `lensmcp.<apex>`. The worker's lens dashboard is served there, on an
|
|
31
|
+
* origin of its own — never under the organizer's dashboard host, whose session cookie and same-origin writes it would
|
|
32
|
+
* otherwise share.
|
|
33
|
+
*/
|
|
34
|
+
export declare const REMOTE_LENS_LABEL = "lensmcp";
|
|
35
|
+
/** The lens dashboard's base path as the worker's gateway serves it: ONE path segment (`/<instance key>`). */
|
|
36
|
+
export declare const REMOTE_DASHBOARD_BASE_PATTERN: RegExp;
|
|
37
|
+
/** `lensmcp.<apex>`: the remote instance's lens, on an origin of its own. */
|
|
38
|
+
export declare function remoteLensHost(apex: string): string;
|
|
39
|
+
/** `POST /remote-instance`. */
|
|
40
|
+
export interface RemoteInstanceRouteRequest {
|
|
41
|
+
/** The instance, as the hub names it ({@link REMOTE_INSTANCE_ID_PATTERN}): its socket is named for it. */
|
|
42
|
+
instanceId: string;
|
|
43
|
+
/** A workspace registered with this gateway — the main checkout of the instance's project: its apex is under that one's. */
|
|
44
|
+
wsKey: string;
|
|
45
|
+
/** The instance's apex as the worker's gateway serves it: `g-<goal>.<the workspace's apex>`. */
|
|
46
|
+
apex: string;
|
|
47
|
+
/** Its tunnel's socket: `<home>/.lensmcp/peers/instances/<instanceId>.sock`, and nothing else. */
|
|
48
|
+
socket: string;
|
|
49
|
+
/** How long the route lives unless asked again (s): more than 0, at most {@link MAX_REMOTE_INSTANCE_SEC}. */
|
|
50
|
+
forSec: number;
|
|
51
|
+
/** The instance's lens dashboard base path on the worker (`/<instance key>`): asked, its lens host is routed too. */
|
|
52
|
+
dashboardBase?: string;
|
|
53
|
+
}
|
|
54
|
+
/** A remote instance's routes as `/remote-instance` answers them. */
|
|
55
|
+
export interface RemoteInstanceRouteView {
|
|
56
|
+
instanceId: string;
|
|
57
|
+
wsKey: string;
|
|
58
|
+
apex: string;
|
|
59
|
+
/** Every host routed to its tunnel: the apex, `*.<apex>`, the workspace's hosts named under it, its lens host. */
|
|
60
|
+
hosts: string[];
|
|
61
|
+
/** Where a browser opens its app: `https://<apex>`, with the front door's port when it is not the scheme's own. */
|
|
62
|
+
origin: string;
|
|
63
|
+
socket: string;
|
|
64
|
+
/** Its lens: `lensmcp.<apex>` and the dashboard's base on the worker — `url` is what a browser opens. */
|
|
65
|
+
lens?: {
|
|
66
|
+
host: string;
|
|
67
|
+
base: string;
|
|
68
|
+
url: string;
|
|
69
|
+
};
|
|
70
|
+
registeredAt: number;
|
|
71
|
+
/** When it goes unless renewed (ms). */
|
|
72
|
+
expiresAt: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Why the gateway refused. `not-its-apex`: the apex is not one name in front of the workspace's. `instance-in-use`: the
|
|
76
|
+
* id is routed with another apex, workspace or lens — removed first. `no-socket`: nothing of this user's serves the
|
|
77
|
+
* socket (none there, not a socket, a link, another user's, open to others). `no-instance-route`: a GET of an id that
|
|
78
|
+
* is not routed.
|
|
79
|
+
*/
|
|
80
|
+
export type RemoteInstanceRouteRefusalCode = 'bad-request' | 'no-workspace' | 'no-apex' | 'apex-not-loopback' | 'not-its-apex' | 'instance-in-use' | 'host-conflict' | 'no-socket' | 'too-many-instances' | 'no-instance-route';
|
|
81
|
+
/** Why a request was refused: a code, and one sentence a person or the hub's log can act on. */
|
|
82
|
+
export interface RemoteInstanceRouteRefusal {
|
|
83
|
+
error: RemoteInstanceRouteRefusalCode;
|
|
84
|
+
message: string;
|
|
85
|
+
/** `bad-request`: the field that is wrong. */
|
|
86
|
+
field?: string;
|
|
87
|
+
/** The host that is held. */
|
|
88
|
+
host?: string;
|
|
89
|
+
/** Who holds it: `workspace '<key>' (<project>)`, `run '<id>'`, `remote instance '<id>'`, the dashboard, a parked worktree. */
|
|
90
|
+
heldBy?: string;
|
|
91
|
+
/** `no-workspace`: the keys that are registered. */
|
|
92
|
+
workspaces?: string[];
|
|
93
|
+
/** `too-many-instances`: the cap. */
|
|
94
|
+
max?: number;
|
|
95
|
+
}
|
|
96
|
+
/** `~/.lensmcp/peer/instances.json`, under `LENSMCP_HOME` when it is set: the worker's record (0600, in its 0700 folder). */
|
|
97
|
+
export declare const REMOTE_INSTANCES_FILE = "instances.json";
|
|
98
|
+
/**
|
|
99
|
+
* An instance a worker runs for its organizer, as the worker recorded it when the instance came up (slice D30 writes
|
|
100
|
+
* it; D35's tunnel reads it). Nothing here comes from a message at the time of a request: what a tunnel stream may reach
|
|
101
|
+
* is decided by this record and the worker's own gateway alone.
|
|
102
|
+
*/
|
|
103
|
+
export interface RemoteInstanceRecord {
|
|
104
|
+
/** {@link REMOTE_INSTANCE_ID_PATTERN}. */
|
|
105
|
+
instanceId: string;
|
|
106
|
+
/** The organizer it runs for: its pinned certificate's fingerprint. An instance recorded for another organizer is never reached. */
|
|
107
|
+
organizer: string;
|
|
108
|
+
/** Its apex as the worker's gateway serves it: a `.localhost` name. A request reaches the instance only on it or a host beneath it. */
|
|
109
|
+
apex: string;
|
|
110
|
+
/**
|
|
111
|
+
* Its lens dashboard as the worker's gateway serves it: the dashboard host (`lensmcp.local`) and the instance's base
|
|
112
|
+
* path (`/<instance key>`). A request on `lensmcp.<apex>` reaches it under that base only — never the dashboard host's
|
|
113
|
+
* chooser, never another workspace's dashboard.
|
|
114
|
+
*/
|
|
115
|
+
dashboard?: {
|
|
116
|
+
host: string;
|
|
117
|
+
base: string;
|
|
118
|
+
};
|
|
119
|
+
/** The instance's checkout on the worker: evidence, never routed on. */
|
|
120
|
+
root?: string;
|
|
121
|
+
/** When it was recorded (ms). */
|
|
122
|
+
recordedAt: number;
|
|
123
|
+
}
|
|
124
|
+
/** Where the worker's own gateway serves browsers, as it says on its control socket (`GET /status` → `daemon.frontDoor`). */
|
|
125
|
+
export interface GatewayFrontDoor {
|
|
126
|
+
port: number;
|
|
127
|
+
/** It speaks TLS: dialled over TLS, as a browser does. */
|
|
128
|
+
tls: boolean;
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var _=(E,e)=>t(E,"name",{value:e,configurable:!0});var o=Object.defineProperty,A=_((E,e)=>o(E,"name",{value:e,configurable:!0}),"o");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}$/;export function remoteLensHost(E){return`${REMOTE_LENS_LABEL}.${E.toLowerCase()}`}_(remoteLensHost,"remoteLensHost"),A(remoteLensHost,"remoteLensHost");export const REMOTE_INSTANCES_FILE="instances.json";
|
package/lib/resources.d.ts
CHANGED
|
@@ -337,6 +337,7 @@ declare const CheckEntrySchema: z.ZodObject<{
|
|
|
337
337
|
line: z.ZodOptional<z.ZodNumber>;
|
|
338
338
|
column: z.ZodOptional<z.ZodNumber>;
|
|
339
339
|
project: z.ZodOptional<z.ZodString>;
|
|
340
|
+
programs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
340
341
|
}, z.core.$strip>;
|
|
341
342
|
export type CheckEntry = z.infer<typeof CheckEntrySchema>;
|
|
342
343
|
export declare const TypecheckCurrentSchema: z.ZodObject<{
|
|
@@ -426,6 +427,7 @@ export declare const TypecheckErrorsSchema: z.ZodObject<{
|
|
|
426
427
|
line: z.ZodOptional<z.ZodNumber>;
|
|
427
428
|
column: z.ZodOptional<z.ZodNumber>;
|
|
428
429
|
project: z.ZodOptional<z.ZodString>;
|
|
430
|
+
programs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
429
431
|
}, z.core.$strip>>;
|
|
430
432
|
}, z.core.$strip>;
|
|
431
433
|
export type TypecheckErrors = z.infer<typeof TypecheckErrorsSchema>;
|
package/lib/resources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{z as n}from"zod";import{SCHEMA_VERSION as i}from"./schema-version.js";import{SourceLocationSchema as
|
|
1
|
+
"use strict";import{z as n}from"zod";import{SCHEMA_VERSION as i}from"./schema-version.js";import{SourceLocationSchema as r}from"./source-location.js";import{SeveritySchema as t}from"./event.js";import{ProducerHealthSchema as e}from"./producer-health.js";export const URI_SCHEMES=["agent","events","build","lint","typecheck","test","runtime","render","visual","flow","story","trace","graph","bundle","security","perf","deps","memory","browser","react","valtio","nest","next","process"],ResourceEnvelopeSchema=n.object({$schema:n.string().optional(),schemaVersion:n.literal(i),revision:n.number().int().nonnegative(),updatedAt:n.string().datetime().optional()}),AgentStatusKindSchema=n.enum(["starting","clean","warning","failing"]),AgentBlockingItemSchema=n.object({source:n.string(),severity:t,title:n.string(),fingerprint:n.string(),resource:n.string(),pageId:n.string().optional(),flowId:n.string().optional(),location:r.optional(),rule:n.string().optional(),fix:n.string().optional(),verify:n.string().optional(),docs:n.string().optional()}),AgentChecksSchema=n.object({typecheck:n.enum(["passed","failed","unknown"]).optional(),lint:n.enum(["passed","failed","unknown"]).optional(),build:n.enum(["passed","failed","unknown"]).optional(),runtime:n.enum(["passed","failed","warning","unknown"]).optional(),visual:n.enum(["passed","failed","warning","unknown"]).optional(),memory:n.enum(["passed","failed","warning","unknown"]).optional()}),AgentServerModeSchema=n.enum(["embedded","shared"]),AgentServerInfoSchema=n.object({mode:AgentServerModeSchema,pid:n.number(),startedAt:n.string(),url:n.string().optional()}),AgentCurrentStatusSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),status:AgentStatusKindSchema,activeTab:n.string().optional(),tabsWithIssues:n.array(n.string()).optional(),blocking:n.array(AgentBlockingItemSchema),warnings:n.array(AgentBlockingItemSchema).default([]),suggestedReads:n.array(n.string()),checks:AgentChecksSchema.optional(),server:AgentServerInfoSchema.optional()}),AgentStorageStatsSchema=n.object({eventsResident:n.number().int().nonnegative(),eventsResidentBytes:n.number().int().nonnegative(),eventsIngested:n.number().int().nonnegative(),eventsDropped:n.number().int().nonnegative(),eventsDroppedForBytes:n.number().int().nonnegative().optional(),eventCap:n.number().int().nonnegative().optional(),eventByteCap:n.number().int().nonnegative().optional(),artifactsResident:n.number().int().nonnegative().optional(),artifactsResidentBytes:n.number().int().nonnegative().optional(),artifactsDropped:n.number().int().nonnegative().optional(),artifactByteCap:n.number().int().nonnegative().optional(),truncatedEvents:n.number().int().nonnegative().optional(),truncatedBytesReclaimed:n.number().int().nonnegative().optional(),rawByteLimit:n.number().int().nonnegative().optional(),reducers:n.record(n.string(),n.object({residentEvents:n.number().int().nonnegative(),residentBytes:n.number().int().nonnegative(),evictedEvents:n.number().int().nonnegative(),evictedForBytes:n.number().int().nonnegative(),eventCap:n.number().int().nonnegative(),byteCap:n.number().int().nonnegative()})).optional()}),AgentSessionSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),supportedResources:n.array(n.string()),supportedTools:n.array(n.string()),supportedJobs:n.array(n.string()),supportedChannels:n.array(n.string()),subscribedByDefault:n.array(n.string()),transports:n.array(n.enum(["stdio","http","socket"])),host:n.object({platform:n.string(),node:n.string()}),project:n.object({name:n.string(),nxVersion:n.string().optional()}),storage:AgentStorageStatsSchema.optional()});const o=n.object({id:n.string(),timestamp:n.number().int().nonnegative(),message:n.string(),fingerprint:n.string(),code:n.string().optional(),rule:n.string().optional(),severity:t.optional(),file:n.string().optional(),line:n.number().int().nonnegative().optional(),column:n.number().int().nonnegative().optional(),project:n.string().optional(),programs:n.array(n.string()).optional()});export const TypecheckCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","failing"]),errorCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),TypecheckErrorsSchema=ResourceEnvelopeSchema.merge(e).extend({errors:n.array(o)}),LintCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),errorCount:n.number().int().nonnegative(),warningCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),BuildCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),hmrUpdates:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()});
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static checks — the one answer `lensmcp typecheck` and `lensmcp lint` give, the same in the CLI's `--json`, the MCP
|
|
3
|
+
* tools and the record store (planning/checks/00-plan.md § 1–2; issues: overseer-75).
|
|
4
|
+
*
|
|
5
|
+
* FoodGuard's first Main QA spent 34.4 minutes type checking to find 2 errors from one missing field, and nothing it
|
|
6
|
+
* printed said what had been checked. So an answer here is only the errors — each once, under the project that owns
|
|
7
|
+
* its file — and a coverage block that says what the answer is worth: what was checked, what is stale, what has no
|
|
8
|
+
* producer, and which checkers gave no verdict. A checker that failed is never counted as clean.
|
|
9
|
+
*/
|
|
10
|
+
export type StaticCheckKind = 'typecheck' | 'lint';
|
|
11
|
+
/** `warm`: from the checkout's current state. `cold`: at an exact SHA, in a clean checkout. */
|
|
12
|
+
export type StaticCheckMode = 'warm' | 'cold';
|
|
13
|
+
export type StaticCheckVerdict = 'clean' | 'errors' | 'partial' | 'no-verdict';
|
|
14
|
+
/** 0 clean and fully covered · 1 errors · 2 no verdict or incomplete coverage. */
|
|
15
|
+
export type StaticCheckExitCode = 0 | 1 | 2;
|
|
16
|
+
/** How the programs in scope were chosen. `adhoc`: paths handed to `lensmcp lint` as before — never «all». */
|
|
17
|
+
export type ScopeKind = 'changed' | 'all' | 'services' | 'projects' | 'affected' | 'files' | 'diff' | 'adhoc';
|
|
18
|
+
/** How a program is checked: tsgo on the tsconfig as it is, tsgo through the shim, or the workspace's ESLint. */
|
|
19
|
+
export type StaticCheckRoute = 'tsgo-shim' | 'tsgo' | 'eslint';
|
|
20
|
+
export type StaticFindingSeverity = 'error' | 'warning';
|
|
21
|
+
/** The owner of a workspace file no project's root holds. */
|
|
22
|
+
export declare const OWNER_WORKSPACE = "(workspace)";
|
|
23
|
+
/** The owner of a file under `node_modules`, or outside the checkout. */
|
|
24
|
+
export declare const OWNER_EXTERNAL = "(external)";
|
|
25
|
+
/** One type error, once, wherever it was found. Key: (file, line, col, code) — never the message. */
|
|
26
|
+
export interface TypecheckFinding {
|
|
27
|
+
/** Workspace-relative, POSIX. */
|
|
28
|
+
file: string;
|
|
29
|
+
/** 1-based. */
|
|
30
|
+
line: number;
|
|
31
|
+
/** 1-based. */
|
|
32
|
+
col: number;
|
|
33
|
+
/** `TS2322`. */
|
|
34
|
+
code: string;
|
|
35
|
+
severity: StaticFindingSeverity;
|
|
36
|
+
/** The first reporting program's text: tsgo and tsc truncate printed types differently. */
|
|
37
|
+
message: string;
|
|
38
|
+
/** The Nx project that OWNS `file` (longest root prefix), or {@link OWNER_WORKSPACE} / {@link OWNER_EXTERNAL}. */
|
|
39
|
+
project: string;
|
|
40
|
+
/** Every program that reported it, by tsconfig path (sorted). */
|
|
41
|
+
programs: string[];
|
|
42
|
+
}
|
|
43
|
+
/** One lint finding, once. Key: (file, line, col, ruleId). */
|
|
44
|
+
export interface LintFinding {
|
|
45
|
+
file: string;
|
|
46
|
+
line: number;
|
|
47
|
+
col: number;
|
|
48
|
+
/** null: a fatal parse error. */
|
|
49
|
+
ruleId: string | null;
|
|
50
|
+
severity: StaticFindingSeverity;
|
|
51
|
+
message: string;
|
|
52
|
+
/** The owner of `file`. */
|
|
53
|
+
project: string;
|
|
54
|
+
/** The lint units that reported it (sorted). */
|
|
55
|
+
units: string[];
|
|
56
|
+
fixable?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface ProjectGroup<F> {
|
|
59
|
+
project: string;
|
|
60
|
+
errorCount: number;
|
|
61
|
+
warningCount: number;
|
|
62
|
+
findings: F[];
|
|
63
|
+
}
|
|
64
|
+
export interface CheckAnswer<F> {
|
|
65
|
+
check: StaticCheckKind;
|
|
66
|
+
mode: StaticCheckMode;
|
|
67
|
+
verdict: StaticCheckVerdict;
|
|
68
|
+
exitCode: StaticCheckExitCode;
|
|
69
|
+
scope: {
|
|
70
|
+
kind: ScopeKind;
|
|
71
|
+
asked: string[];
|
|
72
|
+
inScope: number;
|
|
73
|
+
empty?: true;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Exact, whatever the page holds. `notKept`: findings counted in `errors` / `warnings` that no page lists — a
|
|
77
|
+
* program's record keeps its first 50,000 diagnostics, and counts the rest.
|
|
78
|
+
*/
|
|
79
|
+
totals: {
|
|
80
|
+
errors: number;
|
|
81
|
+
warnings: number;
|
|
82
|
+
projects: number;
|
|
83
|
+
notKept?: number;
|
|
84
|
+
};
|
|
85
|
+
/** One page, by project. */
|
|
86
|
+
groups: ProjectGroup<F>[];
|
|
87
|
+
/**
|
|
88
|
+
* `listed`: the listing left out what the caller already shows (lint: the dashboard's Lint page, beside the lens
|
|
89
|
+
* bus's findings), and its pages hold this many in all. `totals`, the verdict and the coverage stay the scope's.
|
|
90
|
+
*/
|
|
91
|
+
page: {
|
|
92
|
+
offset: number;
|
|
93
|
+
limit: number;
|
|
94
|
+
nextOffset?: number;
|
|
95
|
+
listed?: number;
|
|
96
|
+
};
|
|
97
|
+
coverage: Coverage;
|
|
98
|
+
/** The checkout the answer reflects. */
|
|
99
|
+
head: {
|
|
100
|
+
sha: string;
|
|
101
|
+
dirty: boolean;
|
|
102
|
+
};
|
|
103
|
+
/** Cold: the exact SHA. */
|
|
104
|
+
sha?: string;
|
|
105
|
+
/** Cold: how many programs started from the last green run's build info, and how many from zero. */
|
|
106
|
+
seeded?: {
|
|
107
|
+
seeded: number;
|
|
108
|
+
fromZero: number;
|
|
109
|
+
};
|
|
110
|
+
/** The caller waited: for how long, how many programs were checked again meanwhile, and how many had their files listed first. */
|
|
111
|
+
waited?: {
|
|
112
|
+
ms: number;
|
|
113
|
+
rechecked: number;
|
|
114
|
+
listed?: number;
|
|
115
|
+
};
|
|
116
|
+
/** A cold run the tool submitted instead of blocking on it. */
|
|
117
|
+
queued?: {
|
|
118
|
+
id: string;
|
|
119
|
+
place: number;
|
|
120
|
+
};
|
|
121
|
+
at: number;
|
|
122
|
+
}
|
|
123
|
+
export interface Coverage {
|
|
124
|
+
inScope: number;
|
|
125
|
+
checked: {
|
|
126
|
+
count: number;
|
|
127
|
+
byRoute: Record<StaticCheckRoute, number>;
|
|
128
|
+
/**
|
|
129
|
+
* Typecheck only: how many of the checked programs were shown to answer as the workspace's own `tsc` does
|
|
130
|
+
* (`lensmcp typecheck --parity`). `programs`: the ones a proof has something to say about and that are not proven —
|
|
131
|
+
* it found a difference, or it no longer stands; a program never proven is counted, not listed. `programsMore`:
|
|
132
|
+
* how many the list leaves out.
|
|
133
|
+
*/
|
|
134
|
+
parity: {
|
|
135
|
+
proven: number;
|
|
136
|
+
unproven: number;
|
|
137
|
+
differs: number;
|
|
138
|
+
programs?: ParityNote[];
|
|
139
|
+
programsMore?: number;
|
|
140
|
+
};
|
|
141
|
+
/** Lint only: how many of the checked units started from ESLint's per-file cache — a change in another file is not seen by a cached result. */
|
|
142
|
+
cached?: number;
|
|
143
|
+
oldestVerdictAt?: number;
|
|
144
|
+
/** Only when asked for in detail: 290 items would not fit an agent's answer. */
|
|
145
|
+
items?: CheckedProgram[];
|
|
146
|
+
};
|
|
147
|
+
/** Inputs changed after the last verdict, or never checked. */
|
|
148
|
+
stale: StaleProgram[];
|
|
149
|
+
notCovered: UncoveredProgram[];
|
|
150
|
+
/** Never counted as clean. */
|
|
151
|
+
toolErrors: ToolErrorProgram[];
|
|
152
|
+
}
|
|
153
|
+
/** A checked program whose parity proof says something other than «proven», and what. */
|
|
154
|
+
export interface ParityNote {
|
|
155
|
+
/** The tsconfig path. */
|
|
156
|
+
program: string;
|
|
157
|
+
/** `differs`: tsc and LensMCP's check were compared and do not report the same. `unproven`: its proof no longer stands, or compared nothing. */
|
|
158
|
+
parity: 'unproven' | 'differs';
|
|
159
|
+
why: string;
|
|
160
|
+
}
|
|
161
|
+
export interface CheckedProgram {
|
|
162
|
+
/** The tsconfig path (typecheck) or the unit's name (lint). */
|
|
163
|
+
program: string;
|
|
164
|
+
project: string;
|
|
165
|
+
compiler: {
|
|
166
|
+
name: 'tsgo' | 'eslint';
|
|
167
|
+
version: string;
|
|
168
|
+
};
|
|
169
|
+
route: StaticCheckRoute;
|
|
170
|
+
reflects: {
|
|
171
|
+
sha: string;
|
|
172
|
+
dirty: boolean;
|
|
173
|
+
inputsHash: string;
|
|
174
|
+
};
|
|
175
|
+
at: number;
|
|
176
|
+
durationMs: number;
|
|
177
|
+
peakMb?: number;
|
|
178
|
+
/** `sampled` is a lower bound. */
|
|
179
|
+
peakHow?: 'footprint' | 'maxrss' | 'sampled';
|
|
180
|
+
parity?: 'proven' | 'unproven' | 'differs';
|
|
181
|
+
/** Cold: started from a seed whose inputs matched exactly. */
|
|
182
|
+
seeded?: true;
|
|
183
|
+
/** Lint: ESLint's per-file cache answered — a change in another file is not seen. */
|
|
184
|
+
cached?: true;
|
|
185
|
+
errorCount: number;
|
|
186
|
+
}
|
|
187
|
+
export interface StaleProgram {
|
|
188
|
+
program: string;
|
|
189
|
+
project: string;
|
|
190
|
+
lastVerdictAt?: number;
|
|
191
|
+
lastErrorCount?: number;
|
|
192
|
+
/** The first changed inputs; `changedCount` counts them all. */
|
|
193
|
+
changed: string[];
|
|
194
|
+
changedCount: number;
|
|
195
|
+
}
|
|
196
|
+
export declare const UNCOVERED_REASONS: readonly ["no-route", "needs-build", "tsgo-refused", "parity-unproven", "parity-differs", "held-for-memory", "not-in-census"];
|
|
197
|
+
export type UncoveredReason = (typeof UNCOVERED_REASONS)[number];
|
|
198
|
+
export interface UncoveredProgram {
|
|
199
|
+
program?: string;
|
|
200
|
+
project?: string;
|
|
201
|
+
reason: UncoveredReason;
|
|
202
|
+
detail: string;
|
|
203
|
+
}
|
|
204
|
+
export declare const TOOL_ERROR_KINDS: readonly ["config-refused", "program-error", "timeout", "signal", "exit-without-diagnostics", "spawn-failed", "unparseable-output"];
|
|
205
|
+
export type ToolErrorKind = (typeof TOOL_ERROR_KINDS)[number];
|
|
206
|
+
export interface ToolErrorProgram {
|
|
207
|
+
program: string;
|
|
208
|
+
project: string;
|
|
209
|
+
kind: ToolErrorKind;
|
|
210
|
+
/** The first compiler code, when the tool error has one (`TS18003`). */
|
|
211
|
+
code?: string;
|
|
212
|
+
detail: string;
|
|
213
|
+
at: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A type error's identity: where it is and which one — never the message, which tsgo and tsc print differently (a
|
|
217
|
+
* long type is cut at different lengths), and never the program, so one error in a shared file is one finding however
|
|
218
|
+
* many programs reach it.
|
|
219
|
+
*/
|
|
220
|
+
export declare function typecheckFindingKey(f: Pick<TypecheckFinding, 'file' | 'line' | 'col' | 'code'>): string;
|
|
221
|
+
/** A lint finding's identity. A fatal parse error has no rule: it is keyed on its position alone. */
|
|
222
|
+
export declare function lintFindingKey(f: Pick<LintFinding, 'file' | 'line' | 'col' | 'ruleId'>): string;
|
|
223
|
+
/** One diagnostic as a program's verdict holds it: `file` workspace-relative POSIX, positions 1-based. */
|
|
224
|
+
export interface ReportedDiagnostic {
|
|
225
|
+
file: string;
|
|
226
|
+
line: number;
|
|
227
|
+
col: number;
|
|
228
|
+
code: string;
|
|
229
|
+
severity: StaticFindingSeverity;
|
|
230
|
+
message: string;
|
|
231
|
+
}
|
|
232
|
+
/** One lint message as a unit's record holds it. */
|
|
233
|
+
export interface ReportedLintMessage {
|
|
234
|
+
file: string;
|
|
235
|
+
line: number;
|
|
236
|
+
col: number;
|
|
237
|
+
ruleId: string | null;
|
|
238
|
+
severity: StaticFindingSeverity;
|
|
239
|
+
message: string;
|
|
240
|
+
fixable?: boolean;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Every program's diagnostics as findings, each once: the message of the first program that reported it (programs are
|
|
244
|
+
* read in the order given), every reporting program listed, and the owner of its file. An error from any program makes
|
|
245
|
+
* the finding an error. Sorted by file, line, col, code.
|
|
246
|
+
*/
|
|
247
|
+
export declare function dedupeTypecheckFindings(reports: ReadonlyArray<{
|
|
248
|
+
program: string;
|
|
249
|
+
diagnostics: readonly ReportedDiagnostic[];
|
|
250
|
+
}>, ownerOf: (file: string) => string): TypecheckFinding[];
|
|
251
|
+
/** Every unit's messages as findings, each once — as {@link dedupeTypecheckFindings}, keyed by rule. */
|
|
252
|
+
export declare function dedupeLintFindings(reports: ReadonlyArray<{
|
|
253
|
+
unit: string;
|
|
254
|
+
messages: readonly ReportedLintMessage[];
|
|
255
|
+
}>, ownerOf: (file: string) => string): LintFinding[];
|
|
256
|
+
/** What a verdict is read from: the error findings (lint warnings never count) and what the answer covered. */
|
|
257
|
+
export interface VerdictInput {
|
|
258
|
+
/** `totals.errors`. */
|
|
259
|
+
errors: number;
|
|
260
|
+
coverage: {
|
|
261
|
+
inScope: number;
|
|
262
|
+
checked: {
|
|
263
|
+
count: number;
|
|
264
|
+
};
|
|
265
|
+
stale: readonly unknown[];
|
|
266
|
+
notCovered: readonly unknown[];
|
|
267
|
+
toolErrors: readonly unknown[];
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The verdict of an answer.
|
|
272
|
+
*
|
|
273
|
+
* | Case | Verdict |
|
|
274
|
+
* |---|---|
|
|
275
|
+
* | Any error finding | `errors`, whatever the coverage |
|
|
276
|
+
* | A tool error and no error findings | `no-verdict`: a checker that failed needs a look |
|
|
277
|
+
* | Nothing in scope, or nothing checked | `no-verdict`: nothing was verified |
|
|
278
|
+
* | No errors; some stale or not covered | `partial` |
|
|
279
|
+
* | No errors; every program in scope checked and fresh | `clean` |
|
|
280
|
+
*
|
|
281
|
+
* A program in scope that is in none of the lists counts as not covered: `clean` needs every one of them checked.
|
|
282
|
+
*/
|
|
283
|
+
export declare function verdictOf(input: VerdictInput): StaticCheckVerdict;
|
|
284
|
+
/**
|
|
285
|
+
* The exit code of a verdict: 0 clean · 1 errors · 2 no verdict or incomplete coverage. `allowPartial` accepts a clean
|
|
286
|
+
* answer that is partly stale or uncovered (0); it never accepts `no-verdict`. A usage error is 2 as well.
|
|
287
|
+
*/
|
|
288
|
+
export declare function exitCodeOf(verdict: StaticCheckVerdict, opts?: {
|
|
289
|
+
allowPartial?: boolean;
|
|
290
|
+
}): StaticCheckExitCode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=(e,o)=>p(e,"name",{value:o,configurable:!0});var g=Object.defineProperty,l=c((e,o)=>g(e,"name",{value:o,configurable:!0}),"c");export const OWNER_WORKSPACE="(workspace)",OWNER_EXTERNAL="(external)",UNCOVERED_REASONS=["no-route","needs-build","tsgo-refused","parity-unproven","parity-differs","held-for-memory","not-in-census"],TOOL_ERROR_KINDS=["config-refused","program-error","timeout","signal","exit-without-diagnostics","spawn-failed","unparseable-output"];export function typecheckFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.code}`}c(typecheckFindingKey,"typecheckFindingKey"),l(typecheckFindingKey,"typecheckFindingKey");export function lintFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.ruleId??""}`}c(lintFindingKey,"lintFindingKey"),l(lintFindingKey,"lintFindingKey");const a=l((e,o)=>e.file<o.file?-1:e.file>o.file?1:e.line-o.line||e.col-o.col,"byPosition");export function dedupeTypecheckFindings(e,o){const n=new Map;for(const{program:i,diagnostics:r}of e)for(const t of r){const s=typecheckFindingKey(t),u=n.get(s);if(!u){n.set(s,{file:t.file,line:t.line,col:t.col,code:t.code,severity:t.severity,message:t.message,project:o(t.file),programs:[i]});continue}u.programs.includes(i)||u.programs.push(i),t.severity==="error"&&(u.severity="error")}const d=[...n.values()];for(const i of d)i.programs.sort();return d.sort((i,r)=>a(i,r)||(i.code<r.code?-1:i.code>r.code?1:0))}c(dedupeTypecheckFindings,"dedupeTypecheckFindings"),l(dedupeTypecheckFindings,"dedupeTypecheckFindings");export function dedupeLintFindings(e,o){const n=new Map;for(const{unit:r,messages:t}of e)for(const s of t){const u=lintFindingKey(s),f=n.get(u);if(!f){n.set(u,{file:s.file,line:s.line,col:s.col,ruleId:s.ruleId,severity:s.severity,message:s.message,project:o(s.file),units:[r],...s.fixable?{fixable:!0}:{}});continue}f.units.includes(r)||f.units.push(r),s.severity==="error"&&(f.severity="error")}const d=[...n.values()];for(const r of d)r.units.sort();const i=l(r=>r.ruleId??"","rule");return d.sort((r,t)=>a(r,t)||(i(r)<i(t)?-1:i(r)>i(t)?1:0))}c(dedupeLintFindings,"dedupeLintFindings"),l(dedupeLintFindings,"dedupeLintFindings");export function verdictOf(e){const{errors:o,coverage:n}=e;return o>0?"errors":n.toolErrors.length>0||n.inScope<=0||n.checked.count<=0?"no-verdict":n.stale.length>0||n.notCovered.length>0||n.checked.count<n.inScope?"partial":"clean"}c(verdictOf,"verdictOf"),l(verdictOf,"verdictOf");export function exitCodeOf(e,o={}){return e==="errors"?1:e==="clean"||e==="partial"&&o.allowPartial?0:2}c(exitCodeOf,"exitCodeOf"),l(exitCodeOf,"exitCodeOf");
|
package/lib/team-delivery.d.ts
CHANGED
|
@@ -45,6 +45,19 @@ export interface DeliveryProofRequirement {
|
|
|
45
45
|
related?: string[];
|
|
46
46
|
proofFiles?: string[];
|
|
47
47
|
candidateRuntime?: CandidateRuntimeRequirement;
|
|
48
|
+
/**
|
|
49
|
+
* A job the candidate's `lensmcp.json` declares (`jobs.<name>`; planning/docker § 12, slice D26): the proof is that
|
|
50
|
+
* job's run — action `e2e`, under a Compose project of its own — and its fingerprint is the job's (its name and
|
|
51
|
+
* declaration, its declared `inputs.files`), not a command line's. It needs no `candidateRuntime` (the job brings its
|
|
52
|
+
* own stack) and takes no target, files, related sources or proof files: its manifest says what it runs and reads.
|
|
53
|
+
*/
|
|
54
|
+
job?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Where a {@link job}'s proof runs (slice D26): `local` — this Mac —, `auto` — placement chooses once a worker Mac is
|
|
57
|
+
* paired, and this Mac when none is —, or a paired worker Mac's name. Left out: this Mac, as before. A proof made on a
|
|
58
|
+
* worker counts exactly when the same proof made here would: its `host` is evidence, never what it proves.
|
|
59
|
+
*/
|
|
60
|
+
host?: string;
|
|
48
61
|
}
|
|
49
62
|
/** Scope, ownership and proof declared together before independent writers start. */
|
|
50
63
|
export interface PackageContract {
|