@lensmcp/protocol-types 1.26.5 → 1.26.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ai-call-groups.js +2 -2
- package/lib/ai-call-row.js +3 -3
- package/lib/ai-call.js +9 -9
- package/lib/ai-context.js +6 -6
- package/lib/ai-origins.js +6 -6
- package/lib/bounded-clone.js +1 -1
- package/lib/bounded-map.js +1 -1
- package/lib/bounded-writer.js +1 -1
- package/lib/capture-demand.js +1 -1
- package/lib/dashboard-path.js +1 -1
- package/lib/docker-errors.js +1 -1
- package/lib/docker-jobs.js +1 -1
- package/lib/docker-report.js +2 -2
- package/lib/docker-runs.js +3 -3
- package/lib/error-cause.js +6 -6
- package/lib/error-dismissal.js +1 -1
- package/lib/event-loop.js +1 -1
- package/lib/expected-failure.js +2 -2
- package/lib/flood-guard.js +1 -1
- package/lib/goal-design.js +1 -1
- package/lib/host-agents.js +1 -1
- package/lib/lint-coverage.js +1 -1
- package/lib/log-query.js +1 -1
- package/lib/metrics-reset.js +1 -1
- package/lib/overseer-findings.js +1 -1
- package/lib/peers.d.ts +24 -24
- package/lib/peers.js +1 -1
- package/lib/perf-rules.js +1 -1
- package/lib/pod-memory.js +1 -1
- package/lib/producer-health.js +1 -1
- package/lib/remote-instances.js +1 -1
- package/lib/sources.js +1 -1
- package/lib/static-checks.js +1 -1
- package/lib/system-report.js +1 -1
- package/lib/team.d.ts +2 -0
- package/lib/team.js +1 -1
- package/package.json +1 -1
package/lib/log-query.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var a=(e,r)=>d(e,"name",{value:r,configurable:!0});var h=Object.defineProperty,c=a((e,r)=>h(e,"name",{value:r,configurable:!0}),"a"),Q=Object.defineProperty,u=c((e,r)=>Q(e,"name",{value:r,configurable:!0}),"a"),C=Object.defineProperty,i=u((e,r)=>C(e,"name",{value:r,configurable:!0}),"a"),k=Object.defineProperty,f=i((e,r)=>k(e,"name",{value:r,configurable:!0}),"c");const $={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},b={warn:"warning",err:"error"},x=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const r=[],t=[];for(const s of e.matchAll(x)){const[o,n,m,L,w]=s,y=(L??w??"").trim(),v=m?$[m.toLowerCase()]:void 0;if(v&&y){const p=v==="level"?b[y.toLowerCase()]??y.toLowerCase():y;r.push({key:v,value:p,negate:n==="-"})}else o.trim()&&t.push(o.trim())}return{tokens:r,text:t.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery"),u(parseLogQuery,"parseLogQuery"),i(parseLogQuery,"parseLogQuery"),f(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const r=f(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"),u(formatLogQuery,"formatLogQuery"),i(formatLogQuery,"formatLogQuery"),f(formatLogQuery,"formatLogQuery");function g(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(g,"v"),c(g,"v"),u(g,"v"),i(g,"h"),f(g,"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 g(e.durationMs,r.value)}}a(l,"f"),c(l,"f"),u(l,"l"),i(l,"i"),f(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"),u(matchesLogQuery,"matchesLogQuery"),i(matchesLogQuery,"matchesLogQuery"),f(matchesLogQuery,"matchesLogQuery");
|
package/lib/metrics-reset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var n=(e,t)=>f(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,o=n((e,t)=>u(e,"name",{value:t,configurable:!0}),"n"),S=Object.defineProperty,d=o((e,t)=>S(e,"name",{value:t,configurable:!0}),"i"),p=Object.defineProperty,l=d((e,t)=>p(e,"name",{value:t,configurable:!0}),"i"),R=Object.defineProperty,c=l((e,t)=>R(e,"name",{value:t,configurable:!0}),"s");import{LENS_EVENT_SOURCE as h}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 m=16*1024,_=c(e=>e==="sql"||e==="external","isScope"),E=c(e=>typeof e=="string"&&e.length>0&&e.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(e){if(e.source!==h||!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(!_(i))return;let s;if(t.ids!==void 0&&(!Array.isArray(t.ids)||(s=[...new Set(t.ids.filter(E))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:i,...s?{ids:s}:{}};const a=t.at;if(!(typeof a!="number"||!Number.isFinite(a)))return{kind:r,scope:i,at:Math.min(a,e.timestamp),...s?{ids:s}:{}}}n(readMetricsReset,"readMetricsReset"),o(readMetricsReset,"readMetricsReset"),d(readMetricsReset,"readMetricsReset"),l(readMetricsReset,"readMetricsReset"),c(readMetricsReset,"readMetricsReset");export function metricsIdBatches(e){const t=[];let r=[],i=0;for(const s of new Set(e.filter(E)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||i+s.length+3>m)&&(t.push(r),r=[],i=0),r.push(s),i+=s.length+3;return r.length&&t.push(r),t}n(metricsIdBatches,"metricsIdBatches"),o(metricsIdBatches,"metricsIdBatches"),d(metricsIdBatches,"metricsIdBatches"),l(metricsIdBatches,"metricsIdBatches"),c(metricsIdBatches,"metricsIdBatches");
|
package/lib/overseer-findings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var i=(e,n)=>u(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,r=i((e,n)=>a(e,"name",{value:n,configurable:!0}),"i"),l=Object.defineProperty,s=r((e,n)=>l(e,"name",{value:n,configurable:!0}),"i"),g=Object.defineProperty,t=s((e,n)=>g(e,"name",{value:n,configurable:!0}),"i"),p=Object.defineProperty,c=t((e,n)=>p(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"),r(findingLive,"findingLive"),s(findingLive,"findingLive"),t(findingLive,"findingLive"),c(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(o=>FINDING_RUN_KINDS.includes(o.kind)||o.kind==="issue"&&n.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),r(findingRunsActions,"findingRunsActions"),s(findingRunsActions,"findingRunsActions"),t(findingRunsActions,"findingRunsActions"),c(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,o){const d=`repo:${n}/team.${o}`;return e.filter(f=>findingLive(f)&&f.checks.includes(d))}i(findingsForCheck,"findingsForCheck"),r(findingsForCheck,"findingsForCheck"),s(findingsForCheck,"findingsForCheck"),t(findingsForCheck,"findingsForCheck"),c(findingsForCheck,"findingsForCheck");
|
package/lib/peers.d.ts
CHANGED
|
@@ -851,6 +851,7 @@ export declare const PeerErrorBodySchema: z.ZodObject<{
|
|
|
851
851
|
code: z.ZodEnum<{
|
|
852
852
|
timeout: "timeout";
|
|
853
853
|
lost: "lost";
|
|
854
|
+
refused: "refused";
|
|
854
855
|
"unknown-type": "unknown-type";
|
|
855
856
|
"wrong-direction": "wrong-direction";
|
|
856
857
|
"bad-message": "bad-message";
|
|
@@ -858,7 +859,6 @@ export declare const PeerErrorBodySchema: z.ZodObject<{
|
|
|
858
859
|
"not-handled": "not-handled";
|
|
859
860
|
"too-large": "too-large";
|
|
860
861
|
busy: "busy";
|
|
861
|
-
refused: "refused";
|
|
862
862
|
internal: "internal";
|
|
863
863
|
"no-window": "no-window";
|
|
864
864
|
"window-used": "window-used";
|
|
@@ -900,6 +900,7 @@ export declare const PEER_BODY_SCHEMAS: {
|
|
|
900
900
|
code: z.ZodEnum<{
|
|
901
901
|
timeout: "timeout";
|
|
902
902
|
lost: "lost";
|
|
903
|
+
refused: "refused";
|
|
903
904
|
"unknown-type": "unknown-type";
|
|
904
905
|
"wrong-direction": "wrong-direction";
|
|
905
906
|
"bad-message": "bad-message";
|
|
@@ -907,7 +908,6 @@ export declare const PEER_BODY_SCHEMAS: {
|
|
|
907
908
|
"not-handled": "not-handled";
|
|
908
909
|
"too-large": "too-large";
|
|
909
910
|
busy: "busy";
|
|
910
|
-
refused: "refused";
|
|
911
911
|
internal: "internal";
|
|
912
912
|
"no-window": "no-window";
|
|
913
913
|
"window-used": "window-used";
|
|
@@ -966,6 +966,7 @@ export declare const PAIR_BODY_SCHEMAS: {
|
|
|
966
966
|
code: z.ZodEnum<{
|
|
967
967
|
timeout: "timeout";
|
|
968
968
|
lost: "lost";
|
|
969
|
+
refused: "refused";
|
|
969
970
|
"unknown-type": "unknown-type";
|
|
970
971
|
"wrong-direction": "wrong-direction";
|
|
971
972
|
"bad-message": "bad-message";
|
|
@@ -973,7 +974,6 @@ export declare const PAIR_BODY_SCHEMAS: {
|
|
|
973
974
|
"not-handled": "not-handled";
|
|
974
975
|
"too-large": "too-large";
|
|
975
976
|
busy: "busy";
|
|
976
|
-
refused: "refused";
|
|
977
977
|
internal: "internal";
|
|
978
978
|
"no-window": "no-window";
|
|
979
979
|
"window-used": "window-used";
|
|
@@ -1157,10 +1157,10 @@ export declare const MAIN_MIRROR_SCHEMAS: {
|
|
|
1157
1157
|
}, z.core.$strict>;
|
|
1158
1158
|
verdict: z.ZodOptional<z.ZodObject<{
|
|
1159
1159
|
state: z.ZodEnum<{
|
|
1160
|
+
waiting: "waiting";
|
|
1160
1161
|
refused: "refused";
|
|
1161
1162
|
"in-main": "in-main";
|
|
1162
1163
|
"brought-in": "brought-in";
|
|
1163
|
-
waiting: "waiting";
|
|
1164
1164
|
"not-ff": "not-ff";
|
|
1165
1165
|
}>;
|
|
1166
1166
|
count: z.ZodNumber;
|
|
@@ -1190,8 +1190,8 @@ export declare const MAIN_MIRROR_SCHEMAS: {
|
|
|
1190
1190
|
sent: z.ZodBoolean;
|
|
1191
1191
|
}, z.core.$strict>>;
|
|
1192
1192
|
follow: z.ZodEnum<{
|
|
1193
|
-
"in-step": "in-step";
|
|
1194
1193
|
waiting: "waiting";
|
|
1194
|
+
"in-step": "in-step";
|
|
1195
1195
|
"fast-forward": "fast-forward";
|
|
1196
1196
|
ahead: "ahead";
|
|
1197
1197
|
"to-update": "to-update";
|
|
@@ -1200,11 +1200,11 @@ export declare const MAIN_MIRROR_SCHEMAS: {
|
|
|
1200
1200
|
}>;
|
|
1201
1201
|
update: z.ZodOptional<z.ZodObject<{
|
|
1202
1202
|
outcome: z.ZodEnum<{
|
|
1203
|
-
refused: "refused";
|
|
1204
1203
|
waiting: "waiting";
|
|
1204
|
+
refused: "refused";
|
|
1205
|
+
current: "current";
|
|
1205
1206
|
"fast-forward": "fast-forward";
|
|
1206
1207
|
merged: "merged";
|
|
1207
|
-
current: "current";
|
|
1208
1208
|
conflicts: "conflicts";
|
|
1209
1209
|
}>;
|
|
1210
1210
|
at: z.ZodNumber;
|
|
@@ -1233,10 +1233,10 @@ export declare const MAIN_MIRROR_ANSWER_SCHEMAS: {
|
|
|
1233
1233
|
why: z.ZodOptional<z.ZodString>;
|
|
1234
1234
|
verdict: z.ZodOptional<z.ZodObject<{
|
|
1235
1235
|
state: z.ZodEnum<{
|
|
1236
|
+
waiting: "waiting";
|
|
1236
1237
|
refused: "refused";
|
|
1237
1238
|
"in-main": "in-main";
|
|
1238
1239
|
"brought-in": "brought-in";
|
|
1239
|
-
waiting: "waiting";
|
|
1240
1240
|
"not-ff": "not-ff";
|
|
1241
1241
|
}>;
|
|
1242
1242
|
count: z.ZodNumber;
|
|
@@ -1251,8 +1251,8 @@ export declare const MAIN_MIRROR_ANSWER_SCHEMAS: {
|
|
|
1251
1251
|
needWhole: z.ZodOptional<z.ZodBoolean>;
|
|
1252
1252
|
why: z.ZodOptional<z.ZodString>;
|
|
1253
1253
|
follow: z.ZodOptional<z.ZodEnum<{
|
|
1254
|
-
"in-step": "in-step";
|
|
1255
1254
|
waiting: "waiting";
|
|
1255
|
+
"in-step": "in-step";
|
|
1256
1256
|
"fast-forward": "fast-forward";
|
|
1257
1257
|
ahead: "ahead";
|
|
1258
1258
|
"to-update": "to-update";
|
|
@@ -1299,8 +1299,8 @@ export declare const PEER_WORK_SCHEMAS: {
|
|
|
1299
1299
|
at: z.ZodNumber;
|
|
1300
1300
|
started: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1301
1301
|
state: z.ZodOptional<z.ZodEnum<{
|
|
1302
|
-
queued: "queued";
|
|
1303
1302
|
running: "running";
|
|
1303
|
+
queued: "queued";
|
|
1304
1304
|
}>>;
|
|
1305
1305
|
note: z.ZodOptional<z.ZodString>;
|
|
1306
1306
|
queue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1316,11 +1316,11 @@ export declare const PEER_WORK_SCHEMAS: {
|
|
|
1316
1316
|
runId: z.ZodString;
|
|
1317
1317
|
at: z.ZodNumber;
|
|
1318
1318
|
state: z.ZodEnum<{
|
|
1319
|
-
|
|
1319
|
+
errored: "errored";
|
|
1320
1320
|
passed: "passed";
|
|
1321
1321
|
failed: "failed";
|
|
1322
|
-
errored: "errored";
|
|
1323
1322
|
cancelled: "cancelled";
|
|
1323
|
+
timeout: "timeout";
|
|
1324
1324
|
}>;
|
|
1325
1325
|
note: z.ZodOptional<z.ZodString>;
|
|
1326
1326
|
step: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1413,10 +1413,10 @@ export declare const PEER_WORK_SCHEMAS: {
|
|
|
1413
1413
|
}, z.core.$strict>;
|
|
1414
1414
|
why: z.ZodObject<{
|
|
1415
1415
|
kind: z.ZodEnum<{
|
|
1416
|
+
restarting: "restarting";
|
|
1416
1417
|
protocol: "protocol";
|
|
1417
1418
|
version: "version";
|
|
1418
1419
|
installed: "installed";
|
|
1419
|
-
restarting: "restarting";
|
|
1420
1420
|
"install-failed": "install-failed";
|
|
1421
1421
|
"restart-failed": "restart-failed";
|
|
1422
1422
|
"no-store": "no-store";
|
|
@@ -1478,18 +1478,18 @@ export declare const StoreReplySchema: z.ZodObject<{
|
|
|
1478
1478
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
1479
1479
|
error: z.ZodOptional<z.ZodObject<{
|
|
1480
1480
|
name: z.ZodEnum<{
|
|
1481
|
+
Error: "Error";
|
|
1481
1482
|
CoordinationError: "CoordinationError";
|
|
1482
1483
|
CapacityRefusal: "CapacityRefusal";
|
|
1483
1484
|
CoordinationBusyError: "CoordinationBusyError";
|
|
1484
1485
|
StoreCallRefused: "StoreCallRefused";
|
|
1485
|
-
Error: "Error";
|
|
1486
1486
|
}>;
|
|
1487
1487
|
message: z.ZodString;
|
|
1488
1488
|
room: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1489
1489
|
step: z.ZodOptional<z.ZodEnum<{
|
|
1490
1490
|
open: "open";
|
|
1491
|
-
write: "write";
|
|
1492
1491
|
commit: "commit";
|
|
1492
|
+
write: "write";
|
|
1493
1493
|
read: "read";
|
|
1494
1494
|
}>>;
|
|
1495
1495
|
waitedMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1579,8 +1579,8 @@ export declare const PEER_LAUNCH_SCHEMAS: {
|
|
|
1579
1579
|
state: z.ZodEnum<{
|
|
1580
1580
|
running: "running";
|
|
1581
1581
|
failed: "failed";
|
|
1582
|
-
exited: "exited";
|
|
1583
1582
|
stopped: "stopped";
|
|
1583
|
+
exited: "exited";
|
|
1584
1584
|
}>;
|
|
1585
1585
|
at: z.ZodNumber;
|
|
1586
1586
|
pid: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1785,9 +1785,9 @@ export declare const GOAL_PEER_SCHEMAS: {
|
|
|
1785
1785
|
sha256: z.ZodString;
|
|
1786
1786
|
}, z.core.$strict>;
|
|
1787
1787
|
services: z.ZodOptional<z.ZodEnum<{
|
|
1788
|
-
"on-demand": "on-demand";
|
|
1789
|
-
none: "none";
|
|
1790
1788
|
always: "always";
|
|
1789
|
+
none: "none";
|
|
1790
|
+
"on-demand": "on-demand";
|
|
1791
1791
|
}>>;
|
|
1792
1792
|
at: z.ZodNumber;
|
|
1793
1793
|
}, z.core.$strict>;
|
|
@@ -1802,10 +1802,10 @@ export declare const GOAL_PEER_SCHEMAS: {
|
|
|
1802
1802
|
readonly 'goal.changes': z.ZodObject<{
|
|
1803
1803
|
goal: z.ZodString;
|
|
1804
1804
|
what: z.ZodEnum<{
|
|
1805
|
-
commit: "commit";
|
|
1806
1805
|
files: "files";
|
|
1807
|
-
|
|
1806
|
+
commit: "commit";
|
|
1808
1807
|
diff: "diff";
|
|
1808
|
+
row: "row";
|
|
1809
1809
|
commits: "commits";
|
|
1810
1810
|
against: "against";
|
|
1811
1811
|
}>;
|
|
@@ -1846,10 +1846,10 @@ export declare const GOAL_PEER_ANSWER_SCHEMAS: {
|
|
|
1846
1846
|
ref: z.ZodString;
|
|
1847
1847
|
sha: z.ZodOptional<z.ZodString>;
|
|
1848
1848
|
mirror: z.ZodOptional<z.ZodEnum<{
|
|
1849
|
+
created: "created";
|
|
1850
|
+
current: "current";
|
|
1849
1851
|
"not-ff": "not-ff";
|
|
1850
1852
|
"fast-forward": "fast-forward";
|
|
1851
|
-
current: "current";
|
|
1852
|
-
created: "created";
|
|
1853
1853
|
"checked-out": "checked-out";
|
|
1854
1854
|
}>>;
|
|
1855
1855
|
told: z.ZodOptional<z.ZodString>;
|
|
@@ -1866,10 +1866,10 @@ export declare const GOAL_PEER_ANSWER_SCHEMAS: {
|
|
|
1866
1866
|
readonly 'goal.update': z.ZodObject<{
|
|
1867
1867
|
outcome: z.ZodEnum<{
|
|
1868
1868
|
refused: "refused";
|
|
1869
|
-
merged: "merged";
|
|
1870
1869
|
current: "current";
|
|
1871
|
-
conflicts: "conflicts";
|
|
1872
1870
|
asked: "asked";
|
|
1871
|
+
merged: "merged";
|
|
1872
|
+
conflicts: "conflicts";
|
|
1873
1873
|
}>;
|
|
1874
1874
|
why: z.ZodString;
|
|
1875
1875
|
sha: z.ZodOptional<z.ZodString>;
|
package/lib/peers.js
CHANGED
|
@@ -1 +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()})};
|
|
1
|
+
"use strict";var U=Object.defineProperty;var w=(t,a)=>U(t,"name",{value:a,configurable:!0});var F=Object.defineProperty,v=w((t,a)=>F(t,"name",{value:a,configurable:!0}),"w"),Y=Object.defineProperty,I=v((t,a)=>Y(t,"name",{value:a,configurable:!0}),"w"),q=Object.defineProperty,z=I((t,a)=>q(t,"name",{value:a,configurable:!0}),"w"),X=Object.defineProperty,s=z((t,a)=>X(t,"name",{value:a,configurable:!0}),"r");import{z as e}from"zod";import{RUN_ID_PATTERN as D}from"./docker-jobs.js";import{REMOTE_DASHBOARD_BASE_PATTERN as J,REMOTE_INSTANCE_ID_PATTERN as M,REMOTE_INSTANCE_NAME_PREFIX as Q}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"),v(peerMaySend,"peerMaySend"),I(peerMaySend,"peerMaySend"),z(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"),$=e.string().regex(/^[A-Za-z0-9_-]{43}$/),k=e.string().regex(/^[0-9a-f]{64}$/),r=e.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),V=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 ee=["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(ee),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(D);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(S=>typeof S=="string"&&D.test(S)))&&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:$,name:m(64),model:m(40),lensmcp:r}),"pair.resume":e.strictObject({protocol:e.literal(PEER_PROTOCOL)}),"pair.challenge":e.strictObject({nonce:$}),"pair.proof":e.strictObject({proof:k}),"pair.accepted":e.strictObject({proof:k,name:m(64),model:m(40),words:V,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}$/),P=e.string().regex(/^[0-9a-f]{64}$/),T=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),C=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}),te=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()}),N=e.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":e.strictObject({bundleId:T,repository:f,refs:e.array(O).length(1),size:e.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:P}),"main.moved":e.strictObject({repository:f,branch:O,sha:o,bundle:e.strictObject({id:T,size:e.number().int().positive(),sha256:P}),verdict:C.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:N,update:te.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:C.optional()}),"main.moved":e.strictObject({took:e.boolean(),needWhole:e.boolean().optional(),why:y.optional(),follow:N.optional(),head:o.optional()})};const ne=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),_=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),L=e.string().regex(/^[0-9a-f]{16,64}$/),u=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),Z=s(t=>e.string().min(1).max(t).regex(l),"sentence"),p=e.record(e.string(),e.unknown()),ae=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:ne,candidate:_,repository:L,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(ae,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:Z(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:Z(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:L,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 B=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:B.optional(),unstaged:B.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(M)}),"instance.state":e.strictObject({instanceId:e.string().regex(M),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(Q).optional(),dashboardBase:e.string().regex(J).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),oe=e.string().regex(PEER_LAUNCH_KEY_PATTERN),H=e.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),re=e.string().regex(/^[a-z][a-z0-9-]{0,39}$/),W=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:H.optional(),role:re,by:R,client:e.enum(["claude","codex"]),model:W(80).optional(),effort:W(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:oe,lensmcp:r,resume:e.strictObject({launchId:b,threadId:H,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}$/),G=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}$/)}),ie=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})$/),K=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:K,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:ie,base:g,bundle:G,services:e.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":e.strictObject({bundleId:e.string().regex(/^[0-9a-f]{16}$/),repository:K,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:G}),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/perf-rules.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var a=(r,e)=>c(r,"name",{value:e,configurable:!0});var s=Object.defineProperty,p=a((r,e)=>s(r,"name",{value:e,configurable:!0}),"a"),d=Object.defineProperty,o=p((r,e)=>d(r,"name",{value:e,configurable:!0}),"a"),g=Object.defineProperty,u=o((r,e)=>g(r,"name",{value:e,configurable:!0}),"o"),R=Object.defineProperty,l=u((r,e)=>R(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"),l(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"),l(perfRuleScanFingerprint,"perfRuleScanFingerprint");const y=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,b=12,v=4e3,n=l((r,e=v)=>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"||!y.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(f=>n(f,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>b||!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"),l(asPerfRuleRaw,"asPerfRuleRaw");
|
package/lib/pod-memory.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var o=(r,e)=>d(r,"name",{value:e,configurable:!0});var m=Object.defineProperty,n=o((r,e)=>m(r,"name",{value:e,configurable:!0}),"r"),i=Object.defineProperty,t=n((r,e)=>i(r,"name",{value:e,configurable:!0}),"o"),p=Object.defineProperty,a=t((r,e)=>p(r,"name",{value:e,configurable:!0}),"r"),y=Object.defineProperty,u=a((r,e)=>y(r,"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(r){if(!r||typeof r!="object")return;const e=r;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 r}o(asPodMemoryRaw,"asPodMemoryRaw"),n(asPodMemoryRaw,"asPodMemoryRaw"),t(asPodMemoryRaw,"asPodMemoryRaw"),a(asPodMemoryRaw,"asPodMemoryRaw"),u(asPodMemoryRaw,"asPodMemoryRaw");
|
package/lib/producer-health.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var u=(e,t)=>v(e,"name",{value:t,configurable:!0});var R=Object.defineProperty,d=u((e,t)=>R(e,"name",{value:t,configurable:!0}),"i"),$=Object.defineProperty,l=d((e,t)=>$(e,"name",{value:t,configurable:!0}),"i"),P=Object.defineProperty,p=l((e,t)=>P(e,"name",{value:t,configurable:!0}),"i"),j=Object.defineProperty,f=p((e,t)=>j(e,"name",{value:t,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 t=e.now??Date.now(),o=[...e.producers].sort((n,b)=>b.lastReportedAt-n.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 g=o[0].lastReportedAt,s=Math.max(0,t-g),m=s>PRODUCER_STALE_AFTER_MS,h=o.filter(n=>n.lastRunStatus==="failing"),c=o.filter(n=>n.lastRunStatus==="error"),i=[`${o.length} ${e.domain} producer${o.length===1?"":"s"} reporting (${o.map(n=>n.id).join(", ")}); newest report ${a(s)}.`];return c.length>0&&i.push(`${c.length} produced NO verdict (the tool itself failed): ${c.map(n=>`${n.id} \u2014 ${n.error??"unknown error"}`).join("; ")}.`),h.length>0&&i.push(`${h.length} reporting errors.`),m&&i.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:o,lastReportedAt:g,ageMs:s,stale:m,detail:i.join(" ")}}u(summariseProducers,"summariseProducers"),d(summariseProducers,"summariseProducers"),l(summariseProducers,"summariseProducers"),p(summariseProducers,"summariseProducers"),f(summariseProducers,"summariseProducers");function a(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`}u(a,"u"),d(a,"c"),l(a,"g"),p(a,"g"),f(a,"describeAge");
|
package/lib/remote-instances.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var o=(e,t)=>a(e,"name",{value:t,configurable:!0});var s=Object.defineProperty,r=o((e,t)=>s(e,"name",{value:t,configurable:!0}),"o"),_=Object.defineProperty,n=r((e,t)=>_(e,"name",{value:t,configurable:!0}),"t"),A=Object.defineProperty,E=n((e,t)=>A(e,"name",{value:t,configurable:!0}),"_"),c=Object.defineProperty,T=E((e,t)=>c(e,"name",{value:t,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()}`}o(remoteLensHost,"remoteLensHost"),r(remoteLensHost,"remoteLensHost"),n(remoteLensHost,"remoteLensHost"),E(remoteLensHost,"remoteLensHost"),T(remoteLensHost,"remoteLensHost");export const REMOTE_INSTANCES_FILE="instances.json";
|
package/lib/sources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=Object.defineProperty;var u=(e,t)=>I(e,"name",{value:t,configurable:!0});var L=Object.defineProperty,c=u((e,t)=>L(e,"name",{value:t,configurable:!0}),"u"),y=Object.defineProperty,l=c((e,t)=>y(e,"name",{value:t,configurable:!0}),"u"),C=Object.defineProperty,E=l((e,t)=>C(e,"name",{value:t,configurable:!0}),"a"),m=Object.defineProperty,n=E((e,t)=>m(e,"name",{value:t,configurable:!0}),"r");export const SOURCE_KINDS=["queue","loop","store","traffic"],SOURCE_KINDS_READ=["queue","loop","store","traffic"],sourceWireSchema=n(e=>`lensmcp.${e}/v1`,"sourceWireSchema"),QUEUE_WIRE_SCHEMA="lensmcp.queue/v1",LOOP_WIRE_SCHEMA="lensmcp.loop/v1",STORE_WIRE_SCHEMA="lensmcp.store/v1",TRAFFIC_WIRE_SCHEMA="lensmcp.traffic/v1",SOURCE_SNAPSHOT_FIELD={queue:"snapshot",loop:"loop",store:"store",traffic:"traffic"},URI_SOURCES="process://sources",SOURCE_PROVENANCE="reported",QUEUE_OLDEST_WAIT_RULE="queue/oldest-wait",QUEUE_STALLED_RULE="queue/stalled",LOOP_OVERDUE_RULE="loop/overdue",LOOP_FAILING_RULE="loop/failing",LOOP_IDLE_RULE="loop/idle-while-fed",STORE_QUOTA_RULE="store/near-quota",STORE_ERRORS_RULE="store/errors",STORE_ORPHANS_RULE="store/orphans",TRAFFIC_FAILURES_RULE="traffic/failures",TRAFFIC_LATENCY_RULE="traffic/latency",TRAFFIC_RATE_LIMITED_RULE="traffic/rate-limited",SOURCE_RULES=[QUEUE_OLDEST_WAIT_RULE,QUEUE_STALLED_RULE,LOOP_OVERDUE_RULE,LOOP_FAILING_RULE,LOOP_IDLE_RULE,STORE_QUOTA_RULE,STORE_ERRORS_RULE,STORE_ORPHANS_RULE,TRAFFIC_FAILURES_RULE,TRAFFIC_LATENCY_RULE,TRAFFIC_RATE_LIMITED_RULE],SOURCE_EVENT_KINDS=["source-poll","source-declaration","source-event"],CUSTOM_EVENT_SOURCE="custom",QUEUE_EVENTS=["enqueued","admitted","completed","failed","parked"],LOOP_EVENTS=["run-start","run-end"],LOOP_OUTCOMES=["ok","failed","skipped"],STORE_EVENTS=["write","delete","error"],TRAFFIC_EVENTS=["inbound","outbound"],TRAFFIC_OUTCOMES=["ok","failed","rate-limited"],SOURCE_PUSH_EVENTS={queue:QUEUE_EVENTS,loop:LOOP_EVENTS,store:STORE_EVENTS,traffic:TRAFFIC_EVENTS},SOURCE_PUSH_OUTCOMES={queue:[],loop:LOOP_OUTCOMES,store:[],traffic:TRAFFIC_OUTCOMES},SOURCE_POLL_STATES=["current","unreachable","refused","malformed","not-running"],SOURCE_STATES=[...SOURCE_POLL_STATES,"stale","never-polled"],SOURCE_DEFAULT_INTERVAL_SEC=10,SOURCE_MIN_INTERVAL_SEC=2,QUEUE_DEFAULT_OLDEST_WAIT_MIN=10,QUEUE_DEFAULT_STALLED_MIN=15,LOOP_DEFAULT_IDLE_MIN=10,LOOP_OVERDUE_INTERVALS=2,LOOP_FAILING_RUNS=3,SOURCE_FULL_REPORT_MS=6e4,SOURCE_HISTORY_POINTS=60,SOURCE_RUNS_KEPT=30,SOURCE_PUSHED_KEPT=20,STORE_DEFAULT_QUOTA_PCT=90,STORE_DEFAULT_ERROR_RATE_PCT=5,STORE_DEFAULT_ORPHAN_MIN=60,TRAFFIC_DEFAULT_FAILURE_PCT=5,TRAFFIC_DEFAULT_P95_MS=2e3,TRAFFIC_DEFAULT_RATE_LIMITED=1,TRAFFIC_MIN_MESSAGES=10,TRAFFIC_PUSH_WINDOW_MS=10*6e4,TRAFFIC_PUSH_CHANNELS=50,TRAFFIC_PUSH_EVENTS_PER_CHANNEL=1e3,SOURCE_MAX_GROUPS=500,SOURCE_MAX_BYTES=256*1024,SOURCE_STALE_PERIODS=3,SOURCE_STALE_MIN_MS=3e4;export function sourceStaleAfterMs(e){return Math.max(SOURCE_STALE_MIN_MS,SOURCE_STALE_PERIODS*Math.max(0,e))}u(sourceStaleAfterMs,"sourceStaleAfterMs"),c(sourceStaleAfterMs,"sourceStaleAfterMs"),l(sourceStaleAfterMs,"sourceStaleAfterMs"),E(sourceStaleAfterMs,"sourceStaleAfterMs"),n(sourceStaleAfterMs,"sourceStaleAfterMs");const i=n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),r=n(e=>typeof e=="number"&&Number.isInteger(e)&&e>=0,"isCount"),f=n(e=>typeof e=="number"&&Number.isFinite(e)&&e>0,"isTime"),a=n((e,t)=>typeof e=="string"&&e.length>0&&e.length<=t,"isStr"),g=n(e=>e===void 0||typeof e=="number"&&e>0,"isMin");function d(e){if(!SOURCE_KINDS_READ.includes(e.sourceKind)||typeof e.path!="string"&&!(e.path===void 0&&(e.sourceKind==="traffic"||e.sourceKind==="loop"))||!a(e.name,200)||typeof e.intervalSec!="number"||e.feeds!==void 0&&!a(e.feeds,200))return!1;const t=e.thresholds;if(!i(t))return!1;for(const o of["stalledMin","idleMin","oldestWaitMin","quotaPct","errorRatePct","orphanMin","failurePct","p95Ms","rateLimited"])if(!g(t[o]))return!1;return e.sourceKind!=="queue"||typeof t.oldestWaitMin=="number"}u(d,"d"),c(d,"_"),l(d,"_"),E(d,"l"),n(d,"asDecl");const U=n(e=>e===null||typeof e=="string","isIsoOrNull"),_=n(e=>e===void 0||r(e),"isOptCount");function S(e){if(!i(e)||typeof e.at!="string"||!f(e.receivedAt)||!f(e.intervalSec)||!U(e.lastRunAt)||e.nextRunAt!==void 0&&!U(e.nextRunAt))return!1;for(const t of["lastDurationMs","lastItems","runsInWindow","itemsInWindow","failuresInWindow","windowSec"])if(!_(e[t]))return!1;return e.lastOutcome!==void 0&&!LOOP_OUTCOMES.includes(e.lastOutcome)?!1:e.lastError===void 0||typeof e.lastError=="string"}u(S,"S"),c(S,"f"),l(S,"d"),E(S,"_"),n(S,"asLoopSnapshot");const v=n(e=>e===void 0||i(e)&&Object.values(e).every(t=>typeof t=="string"),"isLabels");function R(e){if(!i(e)||typeof e.at!="string"||!f(e.receivedAt)||!r(e.objects)||!r(e.bytes)||e.quotaBytes!==void 0&&e.quotaBytes!==null&&!r(e.quotaBytes))return!1;for(const s of["opsInWindow","writesInWindow","deletesInWindow","errorsInWindow","windowSec"])if(!_(e[s]))return!1;if(e.lastWriteAt!==void 0&&!U(e.lastWriteAt)||e.lastError!==void 0&&typeof e.lastError!="string")return!1;const t=e.truncated;if(t!==void 0&&!(i(t)&&r(t.groups)))return!1;const o=e.groups;return o===void 0?!0:Array.isArray(o)&&o.length<=SOURCE_MAX_GROUPS&&o.every(s=>i(s)&&a(s.group,1e3)&&r(s.objects)&&r(s.bytes)&&v(s.labels))}u(R,"R"),c(R,"S"),l(R,"S"),E(R,"S"),n(R,"asStoreSnapshot");function p(e){if(!i(e)||typeof e.at!="string"||!f(e.receivedAt)||!Array.isArray(e.channels)||!_(e.windowSec))return!1;const t=e.truncated;return t!==void 0&&!(i(t)&&r(t.channels))?!1:e.channels.length<=SOURCE_MAX_GROUPS&&e.channels.every(o=>{if(!i(o)||!a(o.channel,1e3)||!v(o.labels)||o.direction!==void 0&&o.direction!=="inbound"&&o.direction!=="outbound"||o.counterpart!==void 0&&!a(o.counterpart,200))return!1;for(const s of["messagesInWindow","failuresInWindow","rateLimitedInWindow"])if(!_(o[s]))return!1;return o.p95Ms!==void 0&&!(typeof o.p95Ms=="number"&&Number.isFinite(o.p95Ms)&&o.p95Ms>=0)||o.lastAt!==void 0&&!U(o.lastAt)?!1:o.lastError===void 0||typeof o.lastError=="string"})}u(p,"p"),c(p,"R"),l(p,"p"),E(p,"R"),n(p,"asTrafficSnapshot");function A(e){return i(e)&&a(e.digest,100)&&typeof e.at=="string"&&f(e.receivedAt)}u(A,"A"),c(A,"p"),l(A,"R"),E(A,"A"),n(A,"asSame");function O(e){if(!i(e)||!a(e.group,1e3)||!r(e.pending))return!1;for(const s of["inFlight","failed","completedInWindow"])if(e[s]!==void 0&&!r(e[s]))return!1;const t=e.oldestPendingAt;if(t!=null&&typeof t!="string")return!1;const o=e.labels;return o===void 0||i(o)&&Object.values(o).every(s=>typeof s=="string")}u(O,"O"),c(O,"A"),l(O,"A"),E(O,"O"),n(O,"asGroup");function T(e){if(!i(e)||typeof e.at!="string"||!f(e.receivedAt)||!Array.isArray(e.groups))return!1;const t=e.totals;if(!i(t)||!r(t.groups)||!r(t.pending)||!r(t.inFlight)||!r(t.failed))return!1;const o=e.truncated;return o!==void 0&&!(i(o)&&r(o.groups))?!1:e.groups.length<=SOURCE_MAX_GROUPS&&e.groups.every(O)}u(T,"T"),c(T,"O"),l(T,"O"),E(T,"T"),n(T,"asSnapshot");export function asSourcePollRaw(e){if(!i(e)||e.kind!=="source-poll"||!a(e.project,200)||!d(e)||!SOURCE_POLL_STATES.includes(e.state)||!f(e.polledAt)||!f(e.reportEveryMs)||e.path===void 0)return;const t=SOURCE_SNAPSHOT_FIELD[e.sourceKind];for(const s of Object.values(SOURCE_SNAPSHOT_FIELD))if(s!==t&&e[s]!==void 0)return;const o={snapshot:T,loop:S,store:R,traffic:p}[t];if(!(e[t]!==void 0&&!o(e[t]))&&!(e.same!==void 0&&(!A(e.same)||e[t]!==void 0))&&!(e.state==="current"&&e[t]===void 0&&e.same===void 0))return e}u(asSourcePollRaw,"asSourcePollRaw"),c(asSourcePollRaw,"asSourcePollRaw"),l(asSourcePollRaw,"asSourcePollRaw"),E(asSourcePollRaw,"asSourcePollRaw"),n(asSourcePollRaw,"asSourcePollRaw");export function asSourceEventRaw(e){if(!i(e)||e.kind!=="source-event"||!a(e.project,200)||!a(e.name,200))return;const t=e.sourceKind;if(SOURCE_KINDS_READ.includes(t)&&SOURCE_PUSH_EVENTS[t].includes(e.event)&&!(e.item!==void 0&&!a(e.item,200)||e.group!==void 0&&!a(e.group,200))&&!(!_(e.items)||!_(e.durationMs)||!_(e.bytes))&&!(e.outcome!==void 0&&!SOURCE_PUSH_OUTCOMES[t].includes(e.outcome))){for(const o of["object","channel","counterpart","correlation"])if(e[o]!==void 0&&!a(e[o],200))return;if(!(e.error!==void 0&&typeof e.error!="string"))return e}}u(asSourceEventRaw,"asSourceEventRaw"),c(asSourceEventRaw,"asSourceEventRaw"),l(asSourceEventRaw,"asSourceEventRaw"),E(asSourceEventRaw,"asSourceEventRaw"),n(asSourceEventRaw,"asSourceEventRaw");export function asSourceDeclarationRaw(e){if(!(!i(e)||e.kind!=="source-declaration"||!a(e.project,200))&&!(!Array.isArray(e.sources)||!e.sources.every(t=>i(t)&&d(t)))&&!(!Array.isArray(e.problems)||!e.problems.every(t=>typeof t=="string")))return e}u(asSourceDeclarationRaw,"asSourceDeclarationRaw"),c(asSourceDeclarationRaw,"asSourceDeclarationRaw"),l(asSourceDeclarationRaw,"asSourceDeclarationRaw"),E(asSourceDeclarationRaw,"asSourceDeclarationRaw"),n(asSourceDeclarationRaw,"asSourceDeclarationRaw");
|
package/lib/static-checks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var s=(e,n)=>v(e,"name",{value:n,configurable:!0});var O=Object.defineProperty,u=s((e,n)=>O(e,"name",{value:n,configurable:!0}),"s"),h=Object.defineProperty,f=u((e,n)=>h(e,"name",{value:n,configurable:!0}),"c"),F=Object.defineProperty,a=f((e,n)=>F(e,"name",{value:n,configurable:!0}),"c"),m=Object.defineProperty,d=a((e,n)=>m(e,"name",{value:n,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}`}s(typecheckFindingKey,"typecheckFindingKey"),u(typecheckFindingKey,"typecheckFindingKey"),f(typecheckFindingKey,"typecheckFindingKey"),a(typecheckFindingKey,"typecheckFindingKey"),d(typecheckFindingKey,"typecheckFindingKey");export function lintFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.ruleId??""}`}s(lintFindingKey,"lintFindingKey"),u(lintFindingKey,"lintFindingKey"),f(lintFindingKey,"lintFindingKey"),a(lintFindingKey,"lintFindingKey"),d(lintFindingKey,"lintFindingKey");const y=d((e,n)=>e.file<n.file?-1:e.file>n.file?1:e.line-n.line||e.col-n.col,"byPosition");export function dedupeTypecheckFindings(e,n){const r=new Map;for(const{program:o,diagnostics:i}of e)for(const t of i){const c=typecheckFindingKey(t),l=r.get(c);if(!l){r.set(c,{file:t.file,line:t.line,col:t.col,code:t.code,severity:t.severity,message:t.message,project:n(t.file),programs:[o]});continue}l.programs.includes(o)||l.programs.push(o),t.severity==="error"&&(l.severity="error")}const p=[...r.values()];for(const o of p)o.programs.sort();return p.sort((o,i)=>y(o,i)||(o.code<i.code?-1:o.code>i.code?1:0))}s(dedupeTypecheckFindings,"dedupeTypecheckFindings"),u(dedupeTypecheckFindings,"dedupeTypecheckFindings"),f(dedupeTypecheckFindings,"dedupeTypecheckFindings"),a(dedupeTypecheckFindings,"dedupeTypecheckFindings"),d(dedupeTypecheckFindings,"dedupeTypecheckFindings");export function dedupeLintFindings(e,n){const r=new Map;for(const{unit:i,messages:t}of e)for(const c of t){const l=lintFindingKey(c),g=r.get(l);if(!g){r.set(l,{file:c.file,line:c.line,col:c.col,ruleId:c.ruleId,severity:c.severity,message:c.message,project:n(c.file),units:[i],...c.fixable?{fixable:!0}:{}});continue}g.units.includes(i)||g.units.push(i),c.severity==="error"&&(g.severity="error")}const p=[...r.values()];for(const i of p)i.units.sort();const o=d(i=>i.ruleId??"","rule");return p.sort((i,t)=>y(i,t)||(o(i)<o(t)?-1:o(i)>o(t)?1:0))}s(dedupeLintFindings,"dedupeLintFindings"),u(dedupeLintFindings,"dedupeLintFindings"),f(dedupeLintFindings,"dedupeLintFindings"),a(dedupeLintFindings,"dedupeLintFindings"),d(dedupeLintFindings,"dedupeLintFindings");export function verdictOf(e){const{errors:n,coverage:r}=e;return n>0?"errors":r.toolErrors.length>0||r.inScope<=0||r.checked.count<=0?"no-verdict":r.stale.length>0||r.notCovered.length>0||r.checked.count<r.inScope?"partial":"clean"}s(verdictOf,"verdictOf"),u(verdictOf,"verdictOf"),f(verdictOf,"verdictOf"),a(verdictOf,"verdictOf"),d(verdictOf,"verdictOf");export function exitCodeOf(e,n={}){return e==="errors"?1:e==="clean"||e==="partial"&&n.allowPartial?0:2}s(exitCodeOf,"exitCodeOf"),u(exitCodeOf,"exitCodeOf"),f(exitCodeOf,"exitCodeOf"),a(exitCodeOf,"exitCodeOf"),d(exitCodeOf,"exitCodeOf");
|
package/lib/system-report.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var s=(e,t)=>u(e,"name",{value:t,configurable:!0});var c=Object.defineProperty,n=s((e,t)=>c(e,"name",{value:t,configurable:!0}),"s"),y=Object.defineProperty,a=n((e,t)=>y(e,"name",{value:t,configurable:!0}),"s"),i=Object.defineProperty,r=a((e,t)=>i(e,"name",{value:t,configurable:!0}),"r"),d=Object.defineProperty,o=r((e,t)=>d(e,"name",{value:t,configurable:!0}),"n");export function systemScopeId(e){return e.kind==="machine"?"machine":e.kind==="repository"?`repo:${e.repoId}`:`ws:${e.key}`}s(systemScopeId,"systemScopeId"),n(systemScopeId,"systemScopeId"),a(systemScopeId,"systemScopeId"),r(systemScopeId,"systemScopeId"),o(systemScopeId,"systemScopeId");export function systemItemKey(e,t){return`${systemScopeId(e)}/${t}`}s(systemItemKey,"systemItemKey"),n(systemItemKey,"systemItemKey"),a(systemItemKey,"systemItemKey"),r(systemItemKey,"systemItemKey"),o(systemItemKey,"systemItemKey");export function systemValue(e,t){switch(t){case"bytes":{const m=e/1073741824;return m>=1?`${m.toFixed(m>=100?0:1)} GB`:`${Math.round(e/1024**2)} MB`}case"ms":return e>=1e3?`${(e/1e3).toFixed(1)} s`:`${Math.round(e)} ms`;case"percent":return`${Math.round(e)} %`;case"usd":return`$${e.toFixed(2)}`;case"load":return`load ${e.toFixed(1)}`;case"minutes":return`${Math.round(e)} min`;default:return String(e)}}s(systemValue,"systemValue"),n(systemValue,"systemValue"),a(systemValue,"systemValue"),r(systemValue,"systemValue"),o(systemValue,"systemValue");export function systemScopeLabel(e){return e.kind==="machine"?"machine":e.kind==="repository"?e.name:`${e.name} lens`}s(systemScopeLabel,"systemScopeLabel"),n(systemScopeLabel,"systemScopeLabel"),a(systemScopeLabel,"systemScopeLabel"),r(systemScopeLabel,"systemScopeLabel"),o(systemScopeLabel,"systemScopeLabel");const p={"n/a":0,ok:1,warn:2,bad:3};export function systemStatusRank(e){return p[e]}s(systemStatusRank,"systemStatusRank"),n(systemStatusRank,"systemStatusRank"),a(systemStatusRank,"systemStatusRank"),r(systemStatusRank,"systemStatusRank"),o(systemStatusRank,"systemStatusRank");
|
package/lib/team.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export interface DashTeamPersonDone {
|
|
|
38
38
|
why: string;
|
|
39
39
|
proof: 'not-run';
|
|
40
40
|
wasCancelled?: string;
|
|
41
|
+
/** When the upgrade converted the cancel; `at` is the cancel's (overseer-99). */
|
|
42
|
+
convertedAt?: number;
|
|
41
43
|
}
|
|
42
44
|
/** A task closed «not run — the person's decision» (overseer-78): the goal's tests or QA run the person decided not to run. Never passed. */
|
|
43
45
|
export interface DashTeamPersonNotRun {
|
package/lib/team.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var r=(t,e)=>a(t,"name",{value:e,configurable:!0});var l=Object.defineProperty,o=r((t,e)=>l(t,"name",{value:e,configurable:!0}),"r"),c=Object.defineProperty,i=o((t,e)=>c(t,"name",{value:e,configurable:!0}),"r"),u=Object.defineProperty,n=i((t,e)=>u(t,"name",{value:e,configurable:!0}),"r"),d=Object.defineProperty,s=n((t,e)=>d(t,"name",{value:e,configurable:!0}),"o");export const DASH_TEAM_KINDS=["goal","build","bug","review","test","qa","docs","marketing","research","chore"],DASH_TEAM_LINK_KINDS=["task","flow","error","suggestion","ai-call","review","page","route","commit","branch","worktree","file","finding","test"];export function modelClient(t){const e=t?.trim()??"";if(/\b(claude|opus|sonnet|haiku|fable)\b/i.test(e))return"claude";if(/^(gpt|o\d+|codex)\b/i.test(e))return"codex"}r(modelClient,"modelClient"),o(modelClient,"modelClient"),i(modelClient,"modelClient"),n(modelClient,"modelClient"),s(modelClient,"modelClient");export const DASH_TEAM_SEARCH_QUESTION_MAX=300;
|