@lensmcp/protocol-types 1.25.50 → 1.25.52
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 +2 -0
- package/index.js +1 -1
- 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 +9 -9
- 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/error-dismissal.js +1 -1
- package/lib/event-loop.js +1 -1
- package/lib/flood-guard.js +1 -1
- package/lib/goal-design.d.ts +200 -0
- package/lib/goal-design.js +1 -0
- package/lib/log-query.js +1 -1
- package/lib/overseer-findings.js +1 -1
- package/lib/overseer-messages.d.ts +28 -0
- package/lib/overseer-messages.js +1 -0
- package/lib/overseer-rounds.d.ts +78 -0
- package/lib/overseer-rounds.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/sources.js +1 -1
- package/lib/system-report.js +1 -1
- package/lib/team.d.ts +5 -1
- package/lib/team.js +1 -1
- package/package.json +1 -1
package/lib/capture-demand.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var a=(r,e)=>s(r,"name",{value:e,configurable:!0});var p=Object.defineProperty,c=a((r,e)=>p(r,"name",{value:e,configurable:!0}),"o"),u=Object.defineProperty,E=c((r,e)=>u(r,"name",{value:e,configurable:!0}),"s");export const CAPTURE_REQUEST_FILENAME="capture-request.json",CAPTURE_PRESENCE_FILENAME="capture-runner.json";export function appMatchesPage(r,e){const t=r.trim().toLowerCase();if(!t)return!1;if(e.project&&e.project.toLowerCase()===t)return!0;const o=e.url.toLowerCase();if(o===t||o.replace(/\/+$/,"")===t.replace(/\/+$/,""))return!0;try{const n=new URL(e.url);return/^\d+$/.test(t)?n.port===t:n.origin.toLowerCase()===t.replace(/\/+$/,"")}catch{return!1}}a(appMatchesPage,"appMatchesPage"),c(appMatchesPage,"appMatchesPage"),E(appMatchesPage,"appMatchesPage");export const CAPTURE_RULES_FILENAME="capture-rules.json";
|
package/lib/error-dismissal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.defineProperty;var s=(e,r)=>E(e,"name",{value:r,configurable:!0});var m=Object.defineProperty,c=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"s"),p=Object.defineProperty,l=c((e,r)=>p(e,"name",{value:r,configurable:!0}),"s");export const ERROR_DISMISSED="error-dismissed",ERROR_RESTORED="error-restored",LENS_EVENT_SOURCE="lens",MAX_DISMISSAL_EVENT_IDS=200;const y=2048;export const MAX_DISMISSAL_REASON_CHARS=500;const b=300,I=new Set(["dashboard","cli","agent"]);export function readErrorDismissal(e){if(e.source!==LENS_EVENT_SOURCE||!e.raw||typeof e.raw!="object")return;const r=e.raw,i=r.groupId;if(typeof i!="string"||i.length===0||i.length>2048)return;if(r.kind===ERROR_RESTORED)return{kind:ERROR_RESTORED,groupId:i};if(r.kind!==ERROR_DISMISSED)return;const n=r.until;if(typeof n!="number"||!Number.isFinite(n))return;const f=Array.isArray(r.eventIds)?r.eventIds.filter(t=>typeof t=="string"&&t.length>0).slice(0,200):[],o=I.has(r.by)?r.by:void 0,a=l((t,S)=>typeof t=="string"&&t.trim()?t.trim().slice(0,S):void 0,"text"),d=a(r.reason,500),u=a(r.title,300);return{kind:ERROR_DISMISSED,groupId:i,until:Math.min(n,e.timestamp),eventIds:f,...o?{by:o}:{},...d?{reason:d}:{},...u?{title:u}:{}}}s(readErrorDismissal,"readErrorDismissal"),c(readErrorDismissal,"readErrorDismissal"),l(readErrorDismissal,"readErrorDismissal");
|
package/lib/event-loop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var r=(e,t)=>s(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,o=r((e,t)=>u(e,"name",{value:t,configurable:!0}),"r"),c=Object.defineProperty,i=o((e,t)=>c(e,"name",{value:t,configurable:!0}),"e");export const LOOP_STARTUP_MS=6e4;export function loopStartedAt(e){if(!e.startsWith("node:"))return;const t=Number(e.slice(e.lastIndexOf(":")+1));return Number.isFinite(t)&&t>0?t:void 0}r(loopStartedAt,"loopStartedAt"),o(loopStartedAt,"loopStartedAt"),i(loopStartedAt,"loopStartedAt");export function loopPhaseAt(e,t){const n=loopStartedAt(e);if(n===void 0)return;const a=Math.max(0,Math.round(t-n));return{phase:a<6e4?"startup":"running",sinceStartMs:a}}r(loopPhaseAt,"loopPhaseAt"),o(loopPhaseAt,"loopPhaseAt"),i(loopPhaseAt,"loopPhaseAt");
|
package/lib/flood-guard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var i=(t,
|
|
1
|
+
"use strict";var S=Object.defineProperty;var i=(t,s)=>S(t,"name",{value:s,configurable:!0});var A=Object.defineProperty,f=i((t,s)=>A(t,"name",{value:s,configurable:!0}),"i"),k=Object.defineProperty,u=f((t,s)=>k(t,"name",{value:s,configurable:!0}),"o");function l(){const t=typeof process<"u"?process.env?.LENSMCP_EVENT_MAX_EPS:void 0;if(t===void 0||t==="")return;if(t==="off")return"off";const s=Number(t);if(Number.isFinite(s))return s<=0?"off":s}i(l,"d"),f(l,"S"),u(l,"envPerSec");export function createEventFloodGuard(t){const s=t?.envOverride===!1?void 0:l();if(s==="off")return{admit:u(()=>({ok:!0,suppressed:0}),"admit")};const c=s??t?.perSec??5,d=Math.max(1,t?.burst??Math.max(30,c*4)),p=t?.maxKeys??2048,n=new Map,v=u(o=>{for(const[r,e]of n)o-e.lastSeenAt>6e4&&n.delete(r);if(n.size>p){const r=[...n.entries()].sort((e,a)=>e[1].lastSeenAt-a[1].lastSeenAt);for(let e=0;e<r.length>>1;e++)n.delete(r[e][0])}},"evictStale");return{admit(o){const r=Date.now();let e=n.get(o);e||(n.size>=p&&v(r),e={tokens:d,lastRefillAt:r,suppressed:0,lastSeenAt:r},n.set(o,e)),e.lastSeenAt=r;const a=r-e.lastRefillAt;if(a>0&&(e.tokens=Math.min(d,e.tokens+a/1e3*c),e.lastRefillAt=r),e.tokens>=1){e.tokens-=1;const m=e.suppressed;return e.suppressed=0,{ok:!0,suppressed:m}}return e.suppressed+=1,{ok:!1,suppressed:0}}}}i(createEventFloodGuard,"createEventFloodGuard"),f(createEventFloodGuard,"createEventFloodGuard"),u(createEventFloodGuard,"createEventFloodGuard");
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design first (planning/team/20): no top-level goal starts without a design the person approved. The goal itself waits in
|
|
3
|
+
* the task state `design` (DF-D1) while the overseer writes its design — Markdown from a template per type (DF-D2,
|
|
4
|
+
* DF-D3) — and the person answers its questions and approves it (DF-D5, DF-D6). Approving opens the goal from the
|
|
5
|
+
* design's brief; managers claim it as any goal.
|
|
6
|
+
*
|
|
7
|
+
* A design has one **type** — what the change is for — and any number of **concerns**: the parts of the system it touches
|
|
8
|
+
* that need their own say (the owner's DF-D3 note: «maybe more types, or recategorize them»). The type sets the sections
|
|
9
|
+
* that argue the change; each concern adds the sections a reviewer of that part asks for.
|
|
10
|
+
*/
|
|
11
|
+
/** What the change is for — one per design. */
|
|
12
|
+
export declare const DESIGN_TYPES: readonly ["bug", "investigation", "performance", "reliability", "feature", "architecture", "maintenance"];
|
|
13
|
+
export type DesignType = (typeof DESIGN_TYPES)[number];
|
|
14
|
+
/** What the change touches that needs its own sections — any number per design. */
|
|
15
|
+
export declare const DESIGN_CONCERNS: readonly ["security", "data", "api", "ui", "integration", "operations"];
|
|
16
|
+
export type DesignConcern = (typeof DESIGN_CONCERNS)[number];
|
|
17
|
+
/** Words for a type: its name on a page, and the one line that says when to pick it. */
|
|
18
|
+
export declare const DESIGN_TYPE_INFO: Readonly<Record<DesignType, {
|
|
19
|
+
label: string;
|
|
20
|
+
when: string;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const DESIGN_CONCERN_INFO: Readonly<Record<DesignConcern, {
|
|
23
|
+
label: string;
|
|
24
|
+
when: string;
|
|
25
|
+
}>>;
|
|
26
|
+
/**
|
|
27
|
+
* Where a design is:
|
|
28
|
+
* proposed the overseer or LensMCP suggests it; the person starts it (DF-D9)
|
|
29
|
+
* requested started — waiting for the overseer to draft it
|
|
30
|
+
* drafting the overseer writes it
|
|
31
|
+
* waiting a version waits for the person: answers, then Approve / Ask for changes / Decline
|
|
32
|
+
* changes the person answered otherwise or asked for changes — the overseer writes the next version
|
|
33
|
+
* approved the goal is open (or the amendment holds)
|
|
34
|
+
* declined the person declined it — the goal is cancelled
|
|
35
|
+
*/
|
|
36
|
+
export declare const DESIGN_STAGES: readonly ["proposed", "requested", "drafting", "waiting", "changes", "approved", "declined"];
|
|
37
|
+
export type DesignStage = (typeof DESIGN_STAGES)[number];
|
|
38
|
+
/** A design's question for the person, read from its `## Questions` section: 2–4 options, exactly one recommended. */
|
|
39
|
+
export interface DashDesignQuestion {
|
|
40
|
+
/** `q1`, `q2` … in the order the version asks them. */
|
|
41
|
+
id: string;
|
|
42
|
+
question: string;
|
|
43
|
+
/** What the overseer found that the answer turns on. */
|
|
44
|
+
context?: string;
|
|
45
|
+
options: Array<{
|
|
46
|
+
label: string;
|
|
47
|
+
detail?: string;
|
|
48
|
+
}>;
|
|
49
|
+
/** The number (1…) of the recommended option. */
|
|
50
|
+
recommended: number;
|
|
51
|
+
}
|
|
52
|
+
export interface DashDesignFigure {
|
|
53
|
+
name: string;
|
|
54
|
+
mediaType: string;
|
|
55
|
+
bytes: number;
|
|
56
|
+
sha256: string;
|
|
57
|
+
}
|
|
58
|
+
/** One version of a design: what it was, who wrote it, its questions, and what LensMCP's check warned about. */
|
|
59
|
+
export interface DashDesignVersion {
|
|
60
|
+
n: number;
|
|
61
|
+
at: number;
|
|
62
|
+
/** A session id (the overseer's), or `user`. */
|
|
63
|
+
by: string;
|
|
64
|
+
byName?: string;
|
|
65
|
+
title: string;
|
|
66
|
+
summary: string;
|
|
67
|
+
bytes: number;
|
|
68
|
+
sha256: string;
|
|
69
|
+
questions: DashDesignQuestion[];
|
|
70
|
+
figures: DashDesignFigure[];
|
|
71
|
+
/** What the check let through but said (an inferred concern, an unreferenced figure). */
|
|
72
|
+
warnings?: string[];
|
|
73
|
+
/** A change to a goal already open (DF-D12): approving it changes the goal's brief and plan. */
|
|
74
|
+
amendment?: boolean;
|
|
75
|
+
/** What changed since the previous version, in the author's words. */
|
|
76
|
+
changes?: string;
|
|
77
|
+
}
|
|
78
|
+
/** The person's answer to one question: an option, words, or both. Unanswered questions take the recommended option. */
|
|
79
|
+
export interface DashDesignAnswer {
|
|
80
|
+
id: string;
|
|
81
|
+
option?: number;
|
|
82
|
+
text?: string;
|
|
83
|
+
}
|
|
84
|
+
/** The person's word on one version. */
|
|
85
|
+
export interface DashDesignReply {
|
|
86
|
+
version: number;
|
|
87
|
+
at: number;
|
|
88
|
+
verdict: 'approve' | 'changes' | 'decline';
|
|
89
|
+
answers: DashDesignAnswer[];
|
|
90
|
+
note?: string;
|
|
91
|
+
/** An approve that answered otherwise than recommended, or left a note: it sent the design back for a revision (DF-D5). */
|
|
92
|
+
revise?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface DashDesignRequest {
|
|
95
|
+
text: string;
|
|
96
|
+
/** `user`, the overseer's session id, or `lensmcp` (a main QA run's follow-up). */
|
|
97
|
+
by: string;
|
|
98
|
+
byName?: string;
|
|
99
|
+
from: 'person' | 'overseer' | 'lensmcp';
|
|
100
|
+
at: number;
|
|
101
|
+
}
|
|
102
|
+
export interface DashGoalDesign {
|
|
103
|
+
type: DesignType;
|
|
104
|
+
concerns: DesignConcern[];
|
|
105
|
+
stage: DesignStage;
|
|
106
|
+
request: DashDesignRequest;
|
|
107
|
+
/** Who writes it: the overseer, or the person (who then approves it with no second round — DF-D4). */
|
|
108
|
+
author: 'overseer' | 'person';
|
|
109
|
+
drafting?: {
|
|
110
|
+
by: string;
|
|
111
|
+
byName?: string;
|
|
112
|
+
at: number;
|
|
113
|
+
until: number;
|
|
114
|
+
};
|
|
115
|
+
versions: DashDesignVersion[];
|
|
116
|
+
replies: DashDesignReply[];
|
|
117
|
+
approved?: {
|
|
118
|
+
at: number;
|
|
119
|
+
version: number;
|
|
120
|
+
};
|
|
121
|
+
declined?: {
|
|
122
|
+
at: number;
|
|
123
|
+
why: string;
|
|
124
|
+
};
|
|
125
|
+
/** An amendment's version waiting for the person, on a goal that is open or claimed. */
|
|
126
|
+
amendment?: {
|
|
127
|
+
version: number;
|
|
128
|
+
at: number;
|
|
129
|
+
};
|
|
130
|
+
/** Where the approved design is committed by the goal's branch (DF-D13), repository-relative. */
|
|
131
|
+
file?: string;
|
|
132
|
+
}
|
|
133
|
+
/** A design on the Inbox › Designs list. */
|
|
134
|
+
export interface DashDesignBrief {
|
|
135
|
+
goalId: string;
|
|
136
|
+
title: string;
|
|
137
|
+
state: string;
|
|
138
|
+
stage: DesignStage;
|
|
139
|
+
type: DesignType;
|
|
140
|
+
concerns: DesignConcern[];
|
|
141
|
+
author: 'overseer' | 'person';
|
|
142
|
+
priority: number;
|
|
143
|
+
/** The newest version's number, summary and open question count. */
|
|
144
|
+
version?: number;
|
|
145
|
+
summary?: string;
|
|
146
|
+
questions?: number;
|
|
147
|
+
amendment?: boolean;
|
|
148
|
+
request: DashDesignRequest;
|
|
149
|
+
updatedAt: number;
|
|
150
|
+
}
|
|
151
|
+
export interface DashDesignsAnswer {
|
|
152
|
+
designs: DashDesignBrief[];
|
|
153
|
+
/** Designs waiting on the person (stage `waiting`, an amendment too) and proposed ones. */
|
|
154
|
+
counts: {
|
|
155
|
+
waiting: number;
|
|
156
|
+
proposed: number;
|
|
157
|
+
drafting: number;
|
|
158
|
+
requested: number;
|
|
159
|
+
};
|
|
160
|
+
/** Whether this repository requires a design for every goal (`.lensmcp/team/design.json`, on by default — DF-D8). */
|
|
161
|
+
required: boolean;
|
|
162
|
+
observedAt: number;
|
|
163
|
+
}
|
|
164
|
+
/** One design whole: the goal's design record and the newest (or asked) version's Markdown. */
|
|
165
|
+
export interface DashDesignAnswerOne {
|
|
166
|
+
goalId: string;
|
|
167
|
+
title: string;
|
|
168
|
+
state: string;
|
|
169
|
+
priority: number;
|
|
170
|
+
design: DashGoalDesign;
|
|
171
|
+
version?: number;
|
|
172
|
+
markdown?: string;
|
|
173
|
+
/** The previous version's Markdown, for the page's diff. */
|
|
174
|
+
previous?: string;
|
|
175
|
+
}
|
|
176
|
+
/** The template a person (or the overseer) fills in, for a type and its concerns. */
|
|
177
|
+
export interface DashDesignTemplate {
|
|
178
|
+
type: DesignType;
|
|
179
|
+
concerns: DesignConcern[];
|
|
180
|
+
markdown: string;
|
|
181
|
+
}
|
|
182
|
+
/** What LensMCP's check says of a draft: refused for any problem; warnings let it through. */
|
|
183
|
+
export interface DashDesignCheck {
|
|
184
|
+
ok: boolean;
|
|
185
|
+
problems: string[];
|
|
186
|
+
warnings: string[];
|
|
187
|
+
questions: DashDesignQuestion[];
|
|
188
|
+
title?: string;
|
|
189
|
+
summary?: string;
|
|
190
|
+
}
|
|
191
|
+
/** A goal's design as the board shows it (DashTeamTask.design): where it is, its type, its newest version. */
|
|
192
|
+
export interface DashTeamTaskDesign {
|
|
193
|
+
stage: DesignStage;
|
|
194
|
+
type: DesignType;
|
|
195
|
+
author: 'overseer' | 'person';
|
|
196
|
+
version?: number;
|
|
197
|
+
/** The newest version's questions for the person. */
|
|
198
|
+
questions?: number;
|
|
199
|
+
amendment?: boolean;
|
|
200
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const DESIGN_TYPES=["bug","investigation","performance","reliability","feature","architecture","maintenance"],DESIGN_CONCERNS=["security","data","api","ui","integration","operations"],DESIGN_TYPE_INFO={bug:{label:"Bug",when:"Something works wrong, and the cause is known or can be found by reading the code."},investigation:{label:"Investigation",when:"Symptoms without a known cause: research first, and the goal ends in a decision or a fix."},performance:{label:"Performance",when:"Something is measurably slow, heavy or costly: a baseline the lens measured and a target."},reliability:{label:"Reliability",when:"Crashes, stalls, flaky tests, lost work, CI or the machine: how it fails and how often."},feature:{label:"Feature",when:"Someone can do something they cannot do now."},architecture:{label:"Architecture",when:"Boundaries, contracts or structure change, in steps that each ship."},maintenance:{label:"Maintenance",when:"Upgrades, moves, tooling and cleanup: no new behaviour, and nothing breaks."}},DESIGN_CONCERN_INFO={security:{label:"Security",when:"Auth, permissions, secrets, input from outside, or anything an attacker would read."},data:{label:"Data",when:"Schema, migrations, backfills, or data already stored."},api:{label:"API",when:"A request or response other code or other people depend on."},ui:{label:"UI",when:"Screens, flows or what a person sees."},integration:{label:"Integration",when:"A service outside the repository: its API, keys, limits and failures."},operations:{label:"Operations",when:"How it deploys, runs, is watched and is rolled back."}},DESIGN_STAGES=["proposed","requested","drafting","waiting","changes","approved","declined"];
|
package/lib/log-query.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var L=Object.defineProperty;var a=(e,t)=>L(e,"name",{value:t,configurable:!0});var d=Object.defineProperty,c=a((e,t)=>d(e,"name",{value:t,configurable:!0}),"a"),h=Object.defineProperty,u=c((e,t)=>h(e,"name",{value:t,configurable:!0}),"c");const p={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},C={warn:"warning",err:"error"},k=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const t=[],r=[];for(const s of e.matchAll(k)){const[o,n,g,y,w]=s,i=(y??w??"").trim(),l=g?p[g.toLowerCase()]:void 0;if(l&&i){const m=l==="level"?C[i.toLowerCase()]??i.toLowerCase():i;t.push({key:l,value:m,negate:n==="-"})}else o.trim()&&r.push(o.trim())}return{tokens:t,text:r.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery"),u(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const t=u(r=>/\s/.test(r)?`"${r}"`:r,"quote");return[...e.tokens.map(r=>`${r.negate?"-":""}${r.key}:${t(r.value)}`),e.text].filter(Boolean).join(" ")}a(formatLogQuery,"formatLogQuery"),c(formatLogQuery,"formatLogQuery"),u(formatLogQuery,"formatLogQuery");function v(e,t){if(e===void 0)return!1;const r=/^(>=|<=|>|<|=)?\s*(\d+(?:\.\d+)?)$/.exec(t);if(!r)return!1;const s=Number(r[2]);switch(r[1]){case">":return e>s;case"<":return e<s;case"<=":return e<=s;case"=":return e===s;default:return e>=s}}a(v,"v"),c(v,"h"),u(v,"msMatches");function f(e,t){const r=t.value.toLowerCase();switch(t.key){case"level":return e.severity.toLowerCase()===r;case"service":return e.source.toLowerCase()===r;case"flow":return!!e.flowId&&e.flowId.toLowerCase().startsWith(r);case"trace":return!!e.requestId&&e.requestId.toLowerCase().startsWith(r);case"category":return e.category.toLowerCase()===r;case"ms":return v(e.durationMs,t.value)}}a(f,"l"),c(f,"i"),u(f,"tokenMatches");export function matchesLogQuery(e,t,r){const s=new Map;for(const o of t.tokens){if(o.negate){if(f(e,o))return!1;continue}const n=s.get(o.key);n?n.push(o):s.set(o.key,[o])}for(const o of s.values())if(!o.some(n=>f(e,n)))return!1;if(t.text){const o=`${e.title} ${e.message??""} ${e.source} ${e.flowId??""}`;return r?r(o):o.toLowerCase().includes(t.text.toLowerCase())}return!0}a(matchesLogQuery,"matchesLogQuery"),c(matchesLogQuery,"matchesLogQuery"),u(matchesLogQuery,"matchesLogQuery");
|
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 f=Object.defineProperty,s=i((e,n)=>f(e,"name",{value:n,configurable:!0}),"i"),d=Object.defineProperty,r=s((e,n)=>d(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"),s(findingLive,"findingLive"),r(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"),s(findingRunsActions,"findingRunsActions"),r(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,o){const c=`repo:${n}/team.${o}`;return e.filter(t=>findingLive(t)&&t.checks.includes(c))}i(findingsForCheck,"findingsForCheck"),s(findingsForCheck,"findingsForCheck"),r(findingsForCheck,"findingsForCheck");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The person writes to the overseer (planning/team/20 DF-D10): one contact for questions, designs and the board. A
|
|
3
|
+
* message wakes the overseer's inbox launch; its reply comes back to the Inbox beside it. Kept machine-wide in
|
|
4
|
+
* `~/.lensmcp/overseer/messages.json` (the newest 100).
|
|
5
|
+
*/
|
|
6
|
+
export interface DashOverseerMessage {
|
|
7
|
+
/** `om-` and 10 hex digits. */
|
|
8
|
+
id: string;
|
|
9
|
+
at: number;
|
|
10
|
+
text: string;
|
|
11
|
+
/** A repository it is about, by name — none: the whole machine. */
|
|
12
|
+
repository?: string;
|
|
13
|
+
/** A goal it is about. */
|
|
14
|
+
goalId?: string;
|
|
15
|
+
reply?: {
|
|
16
|
+
at: number;
|
|
17
|
+
text: string;
|
|
18
|
+
};
|
|
19
|
+
/** The overseer read it (an inbox launch picked it up) and has not replied yet. */
|
|
20
|
+
seenAt?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DashOverseerMessagesAnswer {
|
|
23
|
+
messages: DashOverseerMessage[];
|
|
24
|
+
unanswered: number;
|
|
25
|
+
observedAt: number;
|
|
26
|
+
}
|
|
27
|
+
/** The most a message or a reply holds. */
|
|
28
|
+
export declare const MAX_OVERSEER_MESSAGE = 4000;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const MAX_OVERSEER_MESSAGE=4e3;
|
package/lib/overseer-rounds.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ import type { DashTeamLaunch, DashTeamLaunchClient } from './team.js';
|
|
|
9
9
|
* POST /api/overseer/rounds { requestId } → DashOverseerStatus — a round now, as the person asks
|
|
10
10
|
* POST /api/overseer/rounds/<id>/stop → DashOverseerStatus
|
|
11
11
|
* GET /api/overseer/digests[/<id>] DashOverseerDigests / { digest }
|
|
12
|
+
* GET /api/overseer/messages DashOverseerMessagesAnswer (overseer-messages.ts)
|
|
13
|
+
* POST /api/overseer/messages { text, repository?, goalId?, requestId? } → { message } — the person's
|
|
14
|
+
*
|
|
15
|
+
* One identity and one folder, three kinds of launch (planning/team/20 DF-D11), each single-flight on the machine:
|
|
16
|
+
* a **round** (plan 15), a **design** (the machine's next design to draft, at most `designsPerDay`), and the **inbox**
|
|
17
|
+
* (a question waiting on the person, or a message from them) — so a long design never delays an answer.
|
|
12
18
|
*/
|
|
13
19
|
export interface DashOverseerSettings {
|
|
14
20
|
/** Off until the person turns it on: no tick, no round. */
|
|
@@ -34,7 +40,27 @@ export interface DashOverseerSettings {
|
|
|
34
40
|
* LensMCP. None: findings stay in `~/.lensmcp/overseer/findings/` alone.
|
|
35
41
|
*/
|
|
36
42
|
issuesDir?: string;
|
|
43
|
+
/** The most design launches a day (local) — 0–48, 12 by default (DF-D11, the owner's choice); 0: none. */
|
|
44
|
+
designsPerDay: number;
|
|
45
|
+
/** A design launch is stopped past this many minutes — 10–120, 45 by default. */
|
|
46
|
+
designMinutes: number;
|
|
47
|
+
/** A design launch is stopped past this many million tokens — 1–60, 15 by default. */
|
|
48
|
+
designTokensM: number;
|
|
49
|
+
/** An inbox launch starts at most this often, in minutes — 2–120, 10 by default. */
|
|
50
|
+
inboxEveryMinutes: number;
|
|
51
|
+
/** An inbox launch is stopped past this many minutes — 2–60, 10 by default. */
|
|
52
|
+
inboxMinutes: number;
|
|
53
|
+
/** An inbox launch is stopped past this many million tokens — 1–20, 3 by default. */
|
|
54
|
+
inboxTokensM: number;
|
|
55
|
+
/**
|
|
56
|
+
* A design launch's model and effort, in the client's own words. None: {@link DESIGN_MODEL_DEFAULT} on Claude Code
|
|
57
|
+
* (Opus — design is where model strength matters), the round's model on Codex; {@link DESIGN_EFFORT_DEFAULT}.
|
|
58
|
+
*/
|
|
59
|
+
designModel?: string;
|
|
60
|
+
designEffort?: string;
|
|
37
61
|
}
|
|
62
|
+
/** What a launch of the overseer is for (planning/team/20 DF-D11). */
|
|
63
|
+
export type DashOverseerPurpose = 'round' | 'design' | 'inbox';
|
|
38
64
|
/** Why a round ran: a new bad item, a warning held a day, the day's digest, or the person asked. */
|
|
39
65
|
export type DashOverseerRoundReason = 'bad' | 'held' | 'digest' | 'asked';
|
|
40
66
|
export interface DashOverseerRound {
|
|
@@ -62,6 +88,26 @@ export interface DashOverseerNext {
|
|
|
62
88
|
/** The next digest round, when it is on. */
|
|
63
89
|
digestAt?: number;
|
|
64
90
|
}
|
|
91
|
+
/** A design or an inbox launch (planning/team/20 DF-D11) — a round is a {@link DashOverseerRound}. */
|
|
92
|
+
export interface DashOverseerLaunch {
|
|
93
|
+
/** Its launch's id. */
|
|
94
|
+
id: string;
|
|
95
|
+
purpose: 'design' | 'inbox';
|
|
96
|
+
startedAt: number;
|
|
97
|
+
/** A design launch's design: the goal it drafts, where. */
|
|
98
|
+
design?: {
|
|
99
|
+
repoId: string;
|
|
100
|
+
repository: string;
|
|
101
|
+
goalId: string;
|
|
102
|
+
title: string;
|
|
103
|
+
};
|
|
104
|
+
/** An inbox launch's reasons: the questions waiting on the person and the person's messages that woke it, by id. */
|
|
105
|
+
questions?: string[];
|
|
106
|
+
messages?: string[];
|
|
107
|
+
launch?: DashTeamLaunch;
|
|
108
|
+
tokensM?: number;
|
|
109
|
+
stoppedFor?: 'deadline' | 'tokens';
|
|
110
|
+
}
|
|
65
111
|
/** `GET /api/overseer`. */
|
|
66
112
|
export interface DashOverseerStatus {
|
|
67
113
|
settings: DashOverseerSettings;
|
|
@@ -76,6 +122,10 @@ export interface DashOverseerStatus {
|
|
|
76
122
|
/** Rounds started today (local), of `roundsPerDay`. */
|
|
77
123
|
today: number;
|
|
78
124
|
next: DashOverseerNext;
|
|
125
|
+
/** Design and inbox launches, newest first, at most 20 (planning/team/20). */
|
|
126
|
+
launches?: DashOverseerLaunch[];
|
|
127
|
+
/** Design launches started today (local), of `designsPerDay`. */
|
|
128
|
+
designsToday?: number;
|
|
79
129
|
}
|
|
80
130
|
export interface DashOverseerDigest {
|
|
81
131
|
id: string;
|
|
@@ -108,4 +158,32 @@ export declare const OVERSEER_BOUNDS: {
|
|
|
108
158
|
readonly min: 1;
|
|
109
159
|
readonly max: 200;
|
|
110
160
|
};
|
|
161
|
+
readonly designsPerDay: {
|
|
162
|
+
readonly min: 0;
|
|
163
|
+
readonly max: 48;
|
|
164
|
+
};
|
|
165
|
+
readonly designMinutes: {
|
|
166
|
+
readonly min: 10;
|
|
167
|
+
readonly max: 120;
|
|
168
|
+
};
|
|
169
|
+
readonly designTokensM: {
|
|
170
|
+
readonly min: 1;
|
|
171
|
+
readonly max: 60;
|
|
172
|
+
};
|
|
173
|
+
readonly inboxEveryMinutes: {
|
|
174
|
+
readonly min: 2;
|
|
175
|
+
readonly max: 120;
|
|
176
|
+
};
|
|
177
|
+
readonly inboxMinutes: {
|
|
178
|
+
readonly min: 2;
|
|
179
|
+
readonly max: 60;
|
|
180
|
+
};
|
|
181
|
+
readonly inboxTokensM: {
|
|
182
|
+
readonly min: 1;
|
|
183
|
+
readonly max: 20;
|
|
184
|
+
};
|
|
111
185
|
};
|
|
186
|
+
/** A design launch's model on Claude Code when the settings name none: Opus (DF-D11). */
|
|
187
|
+
export declare const DESIGN_MODEL_DEFAULT = "opus";
|
|
188
|
+
/** A design launch's effort when the settings name none. */
|
|
189
|
+
export declare const DESIGN_EFFORT_DEFAULT = "high";
|
package/lib/overseer-rounds.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const OVERSEER_SETTINGS_DEFAULTS={on:!1,client:"claude",roundsPerDay:4,digestHour:8,roundMinutes:30,roundTokensM:20},OVERSEER_BOUNDS={roundsPerDay:{min:1,max:12},digestHour:{min:0,max:23},roundMinutes:{min:5,max:120},roundTokensM:{min:1,max:200}};
|
|
1
|
+
"use strict";export const OVERSEER_SETTINGS_DEFAULTS={on:!1,client:"claude",roundsPerDay:4,digestHour:8,roundMinutes:30,roundTokensM:20,designsPerDay:12,designMinutes:45,designTokensM:15,inboxEveryMinutes:10,inboxMinutes:10,inboxTokensM:3},OVERSEER_BOUNDS={roundsPerDay:{min:1,max:12},digestHour:{min:0,max:23},roundMinutes:{min:5,max:120},roundTokensM:{min:1,max:200},designsPerDay:{min:0,max:48},designMinutes:{min:10,max:120},designTokensM:{min:1,max:60},inboxEveryMinutes:{min:2,max:120},inboxMinutes:{min:2,max:60},inboxTokensM:{min:1,max:20}},DESIGN_MODEL_DEFAULT="opus",DESIGN_EFFORT_DEFAULT="high";
|
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 l=Object.defineProperty,o=a((r,e)=>l(r,"name",{value:e,configurable:!0}),"o"),f=Object.defineProperty,p=o((r,e)=>f(r,"name",{value:e,configurable:!0}),"o");export const PERF_RULE_IDS=["bundle/heavy-barrel-import","pod/heap-budget","pod/retained-generation"],PERF_RULE_EVENT_KINDS=["perf-rule-finding","perf-rule-retracted","perf-rule-scan"],PERF_RULES_DOC="https://github.com/kiwiapps-ltd/lensmcp/blob/main/docs/lensmcp/concepts/memory-and-build-cost.mdx",PERF_RULE_DOCS={"bundle/heavy-barrel-import":`${PERF_RULES_DOC}#bundleheavy-barrel-import`,"pod/heap-budget":`${PERF_RULES_DOC}#podheap-budget`,"pod/retained-generation":`${PERF_RULES_DOC}#podretained-generation`};export function perfRuleFingerprint(r,e,n){return`perf-rule:${r}:${e}:${n}`}a(perfRuleFingerprint,"perfRuleFingerprint"),o(perfRuleFingerprint,"perfRuleFingerprint"),p(perfRuleFingerprint,"perfRuleFingerprint");export function perfRuleScanFingerprint(r,e){return`perf-rule-scan:${r}:${e}`}a(perfRuleScanFingerprint,"perfRuleScanFingerprint"),o(perfRuleScanFingerprint,"perfRuleScanFingerprint"),p(perfRuleScanFingerprint,"perfRuleScanFingerprint");const s=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,d=12,y=4e3,t=p((r,e=y)=>typeof r=="string"&&r.length>0&&r.length<=e,"isText");export function asPerfRuleRaw(r){if(!r||typeof r!="object")return;const e=r;if(!PERF_RULE_EVENT_KINDS.includes(e.kind)||typeof e.rule!="string"||!s.test(e.rule)||!t(e.project,512))return;if(e.kind==="perf-rule-scan"){const i=e.open;return!Array.isArray(i)||i.length>256||!i.every(u=>t(u,512))?void 0:r}if(!t(e.subject,512))return;if(e.kind==="perf-rule-retracted")return r;if(e.severity!=="warning"&&e.severity!=="error"||!t(e.title)||!t(e.summary)||!t(e.verify)||!t(e.docs,1024))return;const n=e.fix;if(!(!Array.isArray(n)||n.length===0||n.length>d||!n.every(i=>t(i)))&&!(!e.evidence||typeof e.evidence!="object"||Array.isArray(e.evidence))&&!(!e.cost||typeof e.cost!="object"||Array.isArray(e.cost)))return r}a(asPerfRuleRaw,"asPerfRuleRaw"),o(asPerfRuleRaw,"asPerfRuleRaw"),p(asPerfRuleRaw,"asPerfRuleRaw");
|
package/lib/pod-memory.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var o=(r,e)=>n(r,"name",{value:e,configurable:!0});var d=Object.defineProperty,t=o((r,e)=>d(r,"name",{value:e,configurable:!0}),"r"),m=Object.defineProperty,i=t((r,e)=>m(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"),t(asPodMemoryRaw,"asPodMemoryRaw"),i(asPodMemoryRaw,"asPodMemoryRaw");
|
package/lib/producer-health.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var R=Object.defineProperty;var i=(e,o)=>R(e,"name",{value:o,configurable:!0});var $=Object.defineProperty,d=i((e,o)=>$(e,"name",{value:o,configurable:!0}),"i"),b=Object.defineProperty,m=d((e,o)=>b(e,"name",{value:o,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 o=e.now??Date.now(),t=[...e.producers].sort((n,h)=>h.lastReportedAt-n.lastReportedAt);if(t.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 l=t[0].lastReportedAt,u=Math.max(0,o-l),p=u>PRODUCER_STALE_AFTER_MS,g=t.filter(n=>n.lastRunStatus==="failing"),s=t.filter(n=>n.lastRunStatus==="error"),a=[`${t.length} ${e.domain} producer${t.length===1?"":"s"} reporting (${t.map(n=>n.id).join(", ")}); newest report ${c(u)}.`];return s.length>0&&a.push(`${s.length} produced NO verdict (the tool itself failed): ${s.map(n=>`${n.id} \u2014 ${n.error??"unknown error"}`).join("; ")}.`),g.length>0&&a.push(`${g.length} reporting errors.`),p&&a.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:t,lastReportedAt:l,ageMs:u,stale:p,detail:a.join(" ")}}i(summariseProducers,"summariseProducers"),d(summariseProducers,"summariseProducers"),m(summariseProducers,"summariseProducers");function c(e){return e<1e3?"just now":e<6e4?`${Math.round(e/1e3)}s ago`:e<36e5?`${Math.round(e/6e4)}m ago`:`${Math.round(e/36e5)}h ago`}i(c,"g"),d(c,"g"),m(c,"describeAge");
|
package/lib/sources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var U=Object.defineProperty;var u=(e,r)=>U(e,"name",{value:r,configurable:!0});var v=Object.defineProperty,c=u((e,r)=>v(e,"name",{value:r,configurable:!0}),"a"),I=Object.defineProperty,n=c((e,r)=>I(e,"name",{value:r,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"),n(sourceStaleAfterMs,"sourceStaleAfterMs");const i=n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),t=n(e=>typeof e=="number"&&Number.isInteger(e)&&e>=0,"isCount"),E=n(e=>typeof e=="number"&&Number.isFinite(e)&&e>0,"isTime"),a=n((e,r)=>typeof e=="string"&&e.length>0&&e.length<=r,"isStr"),L=n(e=>e===void 0||typeof e=="number"&&e>0,"isMin");function _(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 r=e.thresholds;if(!i(r))return!1;for(const o of["stalledMin","idleMin","oldestWaitMin","quotaPct","errorRatePct","orphanMin","failurePct","p95Ms","rateLimited"])if(!L(r[o]))return!1;return e.sourceKind!=="queue"||typeof r.oldestWaitMin=="number"}u(_,"_"),c(_,"l"),n(_,"asDecl");const d=n(e=>e===null||typeof e=="string","isIsoOrNull"),l=n(e=>e===void 0||t(e),"isOptCount");function f(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!E(e.intervalSec)||!d(e.lastRunAt)||e.nextRunAt!==void 0&&!d(e.nextRunAt))return!1;for(const r of["lastDurationMs","lastItems","runsInWindow","itemsInWindow","failuresInWindow","windowSec"])if(!l(e[r]))return!1;return e.lastOutcome!==void 0&&!LOOP_OUTCOMES.includes(e.lastOutcome)?!1:e.lastError===void 0||typeof e.lastError=="string"}u(f,"d"),c(f,"_"),n(f,"asLoopSnapshot");const T=n(e=>e===void 0||i(e)&&Object.values(e).every(r=>typeof r=="string"),"isLabels");function S(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!t(e.objects)||!t(e.bytes)||e.quotaBytes!==void 0&&e.quotaBytes!==null&&!t(e.quotaBytes))return!1;for(const s of["opsInWindow","writesInWindow","deletesInWindow","errorsInWindow","windowSec"])if(!l(e[s]))return!1;if(e.lastWriteAt!==void 0&&!d(e.lastWriteAt)||e.lastError!==void 0&&typeof e.lastError!="string")return!1;const r=e.truncated;if(r!==void 0&&!(i(r)&&t(r.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)&&t(s.objects)&&t(s.bytes)&&T(s.labels))}u(S,"S"),c(S,"S"),n(S,"asStoreSnapshot");function R(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!Array.isArray(e.channels)||!l(e.windowSec))return!1;const r=e.truncated;return r!==void 0&&!(i(r)&&t(r.channels))?!1:e.channels.length<=SOURCE_MAX_GROUPS&&e.channels.every(o=>{if(!i(o)||!a(o.channel,1e3)||!T(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(!l(o[s]))return!1;return o.p95Ms!==void 0&&!(typeof o.p95Ms=="number"&&Number.isFinite(o.p95Ms)&&o.p95Ms>=0)||o.lastAt!==void 0&&!d(o.lastAt)?!1:o.lastError===void 0||typeof o.lastError=="string"})}u(R,"p"),c(R,"R"),n(R,"asTrafficSnapshot");function p(e){return i(e)&&a(e.digest,100)&&typeof e.at=="string"&&E(e.receivedAt)}u(p,"R"),c(p,"A"),n(p,"asSame");function A(e){if(!i(e)||!a(e.group,1e3)||!t(e.pending))return!1;for(const s of["inFlight","failed","completedInWindow"])if(e[s]!==void 0&&!t(e[s]))return!1;const r=e.oldestPendingAt;if(r!=null&&typeof r!="string")return!1;const o=e.labels;return o===void 0||i(o)&&Object.values(o).every(s=>typeof s=="string")}u(A,"A"),c(A,"O"),n(A,"asGroup");function O(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!Array.isArray(e.groups))return!1;const r=e.totals;if(!i(r)||!t(r.groups)||!t(r.pending)||!t(r.inFlight)||!t(r.failed))return!1;const o=e.truncated;return o!==void 0&&!(i(o)&&t(o.groups))?!1:e.groups.length<=SOURCE_MAX_GROUPS&&e.groups.every(A)}u(O,"O"),c(O,"T"),n(O,"asSnapshot");export function asSourcePollRaw(e){if(!i(e)||e.kind!=="source-poll"||!a(e.project,200)||!_(e)||!SOURCE_POLL_STATES.includes(e.state)||!E(e.polledAt)||!E(e.reportEveryMs)||e.path===void 0)return;const r=SOURCE_SNAPSHOT_FIELD[e.sourceKind];for(const s of Object.values(SOURCE_SNAPSHOT_FIELD))if(s!==r&&e[s]!==void 0)return;const o={snapshot:O,loop:f,store:S,traffic:R}[r];if(!(e[r]!==void 0&&!o(e[r]))&&!(e.same!==void 0&&(!p(e.same)||e[r]!==void 0))&&!(e.state==="current"&&e[r]===void 0&&e.same===void 0))return e}u(asSourcePollRaw,"asSourcePollRaw"),c(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 r=e.sourceKind;if(SOURCE_KINDS_READ.includes(r)&&SOURCE_PUSH_EVENTS[r].includes(e.event)&&!(e.item!==void 0&&!a(e.item,200)||e.group!==void 0&&!a(e.group,200))&&!(!l(e.items)||!l(e.durationMs)||!l(e.bytes))&&!(e.outcome!==void 0&&!SOURCE_PUSH_OUTCOMES[r].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"),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(r=>i(r)&&_(r)))&&!(!Array.isArray(e.problems)||!e.problems.every(r=>typeof r=="string")))return e}u(asSourceDeclarationRaw,"asSourceDeclarationRaw"),c(asSourceDeclarationRaw,"asSourceDeclarationRaw"),n(asSourceDeclarationRaw,"asSourceDeclarationRaw");
|
package/lib/system-report.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var s=(e,t)=>o(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,n=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"r"),c=Object.defineProperty,r=n((e,t)=>c(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"),r(systemScopeId,"systemScopeId");export function systemItemKey(e,t){return`${systemScopeId(e)}/${t}`}s(systemItemKey,"systemItemKey"),n(systemItemKey,"systemItemKey"),r(systemItemKey,"systemItemKey");export function systemValue(e,t){switch(t){case"bytes":{const a=e/1073741824;return a>=1?`${a.toFixed(a>=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"),r(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"),r(systemScopeLabel,"systemScopeLabel");const m={"n/a":0,ok:1,warn:2,bad:3};export function systemStatusRank(e){return m[e]}s(systemStatusRank,"systemStatusRank"),n(systemStatusRank,"systemStatusRank"),r(systemStatusRank,"systemStatusRank");
|
package/lib/team.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DashTeamTaskDesign } from './goal-design.js';
|
|
1
2
|
/**
|
|
2
3
|
* The Team page (servers/lensmcp-mcp/src/dashboard/team.ts): the repository's agent team as its coordination store
|
|
3
4
|
* holds it — the agents in their roles, the tasks they take and hand on, each task's work log — and what the person at
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
*/
|
|
11
12
|
export declare const DASH_TEAM_KINDS: readonly ["goal", "build", "bug", "review", "test", "qa", "docs", "marketing", "research", "chore"];
|
|
12
13
|
export type DashTeamKind = (typeof DASH_TEAM_KINDS)[number];
|
|
13
|
-
|
|
14
|
+
/** `design`: a goal waiting for its design to be approved (planning/team/20 DF-D1) — no one claims it, or anything under it. */
|
|
15
|
+
export type DashTeamTaskState = 'design' | 'open' | 'claimed' | 'recovery' | 'completed' | 'cancelled';
|
|
14
16
|
export type DashTeamOutcome = 'done' | 'approved' | 'changes-requested' | 'passed' | 'failed' | 'wontfix';
|
|
15
17
|
/** What a task points at in the lens or the repository. */
|
|
16
18
|
export declare const DASH_TEAM_LINK_KINDS: readonly ["task", "flow", "error", "suggestion", "ai-call", "review", "page", "route", "commit", "branch", "worktree", "file", "finding", "test"];
|
|
@@ -51,6 +53,8 @@ export interface DashTeamTask {
|
|
|
51
53
|
/** Every line it ever had, those no longer kept counted. */
|
|
52
54
|
logCount: number;
|
|
53
55
|
state: DashTeamTaskState;
|
|
56
|
+
/** A goal's design, briefly (planning/team/20): where it is, its type, its newest version — none on a goal made before designs. */
|
|
57
|
+
design?: DashTeamTaskDesign;
|
|
54
58
|
outcome?: DashTeamOutcome;
|
|
55
59
|
/** The session holding it. */
|
|
56
60
|
owner?: string;
|
package/lib/team.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});var a=Object.defineProperty,o=r((t,e)=>a(t,"name",{value:e,configurable:!0}),"r"),n=Object.defineProperty,l=o((t,e)=>n(t,"name",{value:e,configurable:!0}),"r");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"),l(modelClient,"modelClient");
|