@lensmcp/protocol-types 1.25.79 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/index.d.ts +9 -1
  2. package/index.js +1 -1
  3. package/lib/ai-call-groups.js +2 -2
  4. package/lib/ai-call-row.js +3 -3
  5. package/lib/ai-call.js +9 -9
  6. package/lib/ai-context.js +6 -6
  7. package/lib/ai-origins.js +9 -9
  8. package/lib/attributes.d.ts +19 -4
  9. package/lib/attributes.js +1 -1
  10. package/lib/bounded-clone.js +1 -1
  11. package/lib/bounded-map.js +1 -1
  12. package/lib/bounded-writer.js +1 -1
  13. package/lib/capture-demand.js +1 -1
  14. package/lib/changes.d.ts +48 -0
  15. package/lib/context.d.ts +2 -2
  16. package/lib/dashboard-lint.d.ts +207 -0
  17. package/lib/dashboard-lint.js +1 -0
  18. package/lib/dashboard-path.d.ts +15 -0
  19. package/lib/dashboard-path.js +1 -0
  20. package/lib/dashboard.d.ts +198 -3
  21. package/lib/edge.d.ts +8 -8
  22. package/lib/error-cause.d.ts +69 -0
  23. package/lib/error-cause.js +5 -0
  24. package/lib/error-dismissal.js +1 -1
  25. package/lib/event-loop.d.ts +57 -1
  26. package/lib/event-loop.js +1 -1
  27. package/lib/event.d.ts +45 -45
  28. package/lib/flood-guard.js +1 -1
  29. package/lib/follow-ups.d.ts +238 -0
  30. package/lib/follow-ups.js +1 -0
  31. package/lib/goal-design.d.ts +51 -0
  32. package/lib/goal-design.js +1 -1
  33. package/lib/goal-outcome.d.ts +12 -1
  34. package/lib/goal-retro.d.ts +21 -0
  35. package/lib/lint-coverage.d.ts +113 -0
  36. package/lib/lint-coverage.js +1 -0
  37. package/lib/log-query.js +1 -1
  38. package/lib/metrics-reset.js +1 -1
  39. package/lib/node.d.ts +11 -11
  40. package/lib/overseer-findings.js +1 -1
  41. package/lib/perf-rules.js +1 -1
  42. package/lib/pod-memory.d.ts +2 -0
  43. package/lib/pod-memory.js +1 -1
  44. package/lib/producer-health.js +1 -1
  45. package/lib/resources.d.ts +28 -28
  46. package/lib/role-fidelity.d.ts +210 -0
  47. package/lib/role-fidelity.js +1 -0
  48. package/lib/sources.js +1 -1
  49. package/lib/system-report.js +1 -1
  50. package/lib/team-delivery.d.ts +38 -4
  51. package/lib/team-delivery.js +1 -1
  52. package/lib/team-design.d.ts +224 -0
  53. package/lib/team-design.js +1 -1
  54. package/lib/team-prompts.d.ts +16 -7
  55. package/lib/team-prompts.js +4 -47
  56. package/lib/team-skills.d.ts +355 -0
  57. package/lib/team-skills.js +1 -0
  58. package/lib/team.d.ts +95 -1
  59. package/lib/team.js +1 -1
  60. package/package.json +1 -1
@@ -0,0 +1,210 @@
1
+ import type { DashGoalTranscripts } from './goal-outcome.js';
2
+ /**
3
+ * Whether a goal's agents did what their roles say (planning/team/26 R7, «role fidelity»): per role, over the goal's
4
+ * sessions, counted from each agent's own transcript in the goal's window, the launch registry and the run review —
5
+ * by code, never a model, and never a transcript's text. It is in the goal's run review (`metrics.roles`), its outcome
6
+ * row (`roles`) and, pooled over the last goals, in Team › Health (`goals.roles`).
7
+ *
8
+ * Every count is of what was read: a transcript too long is read to a cap (`read.cut`), one that could not be read is
9
+ * counted in `read.notRead` — never guessed. A row or review without the block reads as «not measured».
10
+ */
11
+ export interface DashRoleFidelity {
12
+ schema: 1;
13
+ measuredAt: number;
14
+ read: DashRoleFidelityRead;
15
+ /** One row a role, the role with most sessions first. Agents that joined no role are under `none`. */
16
+ roles: DashRoleFidelityRole[];
17
+ /**
18
+ * The goal's launches, from the launch registry (a transcript keeps growing after its goal is archived, so launches
19
+ * are never counted from one). `changes`: the builds and bugs the team made. Absent: the registry holds none for it.
20
+ */
21
+ launches?: DashRoleFidelityLaunches & {
22
+ changes?: number;
23
+ };
24
+ /**
25
+ * The older transcript recipes' counts (planning/team/18 gate 7), from the same read: lines matched and the agents
26
+ * they came from; for repeated errors, groups and their keys.
27
+ */
28
+ recipes?: DashGoalTranscripts['recipes'];
29
+ }
30
+ export interface DashRoleFidelityRead {
31
+ /** Transcripts read (a conversation shared by two sessions is read once), and the bytes of their lines in the window. */
32
+ transcripts: number;
33
+ bytes: number;
34
+ /** Read to a cap: their counts are of the part read. */
35
+ cut?: number;
36
+ /** Agents whose conversation was not read, and why. */
37
+ notRead?: number;
38
+ why?: Partial<Record<DashRoleFidelityNotRead, number>>;
39
+ }
40
+ /** `unlinked`: no transcript was found for the session; `client`: a client this measure does not read yet (Codex: read for its kit alone); `failed`: the read failed; `capped`: left out past the goal's cap. */
41
+ export type DashRoleFidelityNotRead = 'unlinked' | 'client' | 'failed' | 'capped';
42
+ export interface DashRoleFidelityLaunches {
43
+ /** Launches, and the tasks they were launched for. */
44
+ total: number;
45
+ tasks: number;
46
+ /** Launches that ended, and the median time one ran — ms. */
47
+ ended: number;
48
+ medianMs?: number;
49
+ }
50
+ /** One role's sessions in a goal — or, pooled, in several goals: counts add up, medians are taken over their parts. */
51
+ export interface DashRoleFidelityRole {
52
+ role: string;
53
+ /** A managing role — the manager, or a role built on the tech lead: the targets set for managers apply. */
54
+ managing?: boolean;
55
+ /** Its agents in the run, and those whose transcript was read: every count below is over the read ones. */
56
+ sessions: number;
57
+ measured: number;
58
+ /** Model requests. */
59
+ requests: number;
60
+ /**
61
+ * Requests by whether the role's rules were in the agent's context. A session launched with its role file has them
62
+ * throughout (`launched`: such sessions); any other has them from a join answer that carried them until the next
63
+ * compaction, and again from the hook note that gives the role card back, or a later whole join. `unknown`: requests
64
+ * before the first of those was read (a session older than the window) — in neither count.
65
+ */
66
+ rules: {
67
+ with: number;
68
+ without: number;
69
+ unknown: number;
70
+ launched: number;
71
+ };
72
+ /** Compactions, and those after which the rules were in context again before the next one. */
73
+ compactions: number;
74
+ rulesBack: number;
75
+ /**
76
+ * Its skill kit: of the sessions read with a launch record — a Codex rollout's too — those whose transcript shows the
77
+ * kit the launch recorded (overseer-84: its skills in the listing the client sent, its core in the role's prompt);
78
+ * `why`: what the others showed instead. Absent: no launch of the goal recorded one — not measured.
79
+ */
80
+ kit?: {
81
+ launched: number;
82
+ delivered: number;
83
+ why?: string[];
84
+ };
85
+ /** Sessions that opened a skill (the client's Skill tool, a read of `team://skills/<name>` or of a SKILL.md), and the skills opened by how many sessions, most first. */
86
+ skills: {
87
+ opened: number;
88
+ names: Array<{
89
+ name: string;
90
+ sessions: number;
91
+ }>;
92
+ };
93
+ /**
94
+ * Proof calls, and the tasks the measured sessions finished: lens observation tools, browser tools, check runs
95
+ * (workspace_action_run, and shell commands that run tests, a type check or a linter) — calls, and sessions with one.
96
+ */
97
+ proof: {
98
+ finished: number;
99
+ lens: number;
100
+ lensSessions: number;
101
+ browser: number;
102
+ browserSessions: number;
103
+ checks: number;
104
+ checkSessions: number;
105
+ };
106
+ /** Refusals and tool errors: tool results the client marked as errors, or that open as one. */
107
+ errors: number;
108
+ /** Sessions that made one identical call (same tool, same input) 3 times or more; the worst count and its tool's name. */
109
+ repeats: {
110
+ sessions: number;
111
+ worst?: {
112
+ count: number;
113
+ tool: string;
114
+ };
115
+ };
116
+ /** A request's context is its input, cache writes and cache reads, in tokens: the median first request and largest request over the `n` sessions that made one. */
117
+ context: {
118
+ n: number;
119
+ first?: number;
120
+ largest?: number;
121
+ };
122
+ /** The role's launches for the goal, from the launch registry — absent: the registry holds none. */
123
+ launches?: DashRoleFidelityLaunches;
124
+ /**
125
+ * What hooks added to the sessions' context, in characters: LensMCP's own notes, everything else, and the other
126
+ * sources by the first marker of each block (a tag's name and its `source`) — names and sizes only, never text.
127
+ * `own` and `other` are sums over the measured sessions; the medians are one session's (a session with one very
128
+ * long recall moves a sum, not a median).
129
+ */
130
+ hook: {
131
+ own: number;
132
+ other: number;
133
+ ownMedian?: number;
134
+ otherMedian?: number;
135
+ sources: DashRoleFidelitySource[];
136
+ };
137
+ }
138
+ export interface DashRoleFidelitySource {
139
+ name: string;
140
+ chars: number;
141
+ /** Sessions it reached. */
142
+ sessions: number;
143
+ }
144
+ export type DashRoleMeasureId = 'rules' | 'kit' | 'skills' | 'proof' | 'errors' | 'repeats' | 'context' | 'launches';
145
+ /**
146
+ * One measure of a role, in words, against what the role is held to. `ok`: within its target; `off`: past it — worth
147
+ * a look, never a verdict; `none`: reported, with no target for this role; `unmeasured`: nothing to measure it from.
148
+ */
149
+ export interface DashRoleMeasure {
150
+ id: DashRoleMeasureId;
151
+ title: string;
152
+ status: 'ok' | 'off' | 'none' | 'unmeasured';
153
+ /** The headline number, when it is one share or rate. */
154
+ value?: number;
155
+ /** `18%`, `65 a session`, `not measured`. */
156
+ text: string;
157
+ /** What it is held to — absent with no target for this role. */
158
+ target?: string;
159
+ /** The numbers behind it, in a sentence. */
160
+ detail: string;
161
+ }
162
+ /** A role across the last goals: its sessions and each measure. */
163
+ export interface DashTeamHealthRoleFidelity {
164
+ role: string;
165
+ managing?: boolean;
166
+ /** Goals of those measured that had the role. */
167
+ goals: number;
168
+ sessions: number;
169
+ measured: number;
170
+ measures: DashRoleMeasure[];
171
+ }
172
+ /** What a session carries at rest, over every role: the first request's weight and what hooks add, by source. */
173
+ export interface DashTeamHealthSessionWeight {
174
+ /** Sessions measured. */
175
+ sessions: number;
176
+ /** The median first request, in tokens — absent when no session made one. */
177
+ firstContext?: number;
178
+ /** Characters a session, the median session's: LensMCP's own notes, and everything else hooks added — and each on average. */
179
+ own: number;
180
+ other: number;
181
+ ownMean: number;
182
+ otherMean: number;
183
+ /** The other sources, largest first: characters a session on average, and the sessions each reached. */
184
+ sources: Array<{
185
+ name: string;
186
+ chars: number;
187
+ sessions: number;
188
+ }>;
189
+ /** The line Team › Health shows. */
190
+ text: string;
191
+ }
192
+ /**
193
+ * Team › Health, by role (planning/team/26 R7): the role fidelity of the last goals finished, pooled — a row a role,
194
+ * each measure against its target — and what a session weighs.
195
+ */
196
+ export interface DashTeamHealthRoles {
197
+ /** Of the goals read, those whose row holds the block, and those without: not measured. */
198
+ goals: number;
199
+ unmeasured: number;
200
+ /** The goals without it, by id: the dashboard measures them from their transcripts, off the request, and they show at a later read. */
201
+ pending?: string[];
202
+ /** Transcripts read over those goals, those cut at a cap, and agents whose conversation was not read. */
203
+ read: {
204
+ transcripts: number;
205
+ cut: number;
206
+ notRead: number;
207
+ };
208
+ roles: DashTeamHealthRoleFidelity[];
209
+ weight?: DashTeamHealthSessionWeight;
210
+ }
@@ -0,0 +1 @@
1
+ "use strict";export{};
package/lib/sources.js CHANGED
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var a=(t,r)=>T(t,"name",{value:r,configurable:!0});var U=Object.defineProperty,e=a((t,r)=>U(t,"name",{value:r,configurable:!0}),"r");export const SOURCE_KINDS=["queue","loop","store","traffic"],SOURCE_KINDS_READ=["queue","loop","store","traffic"],sourceWireSchema=e(t=>`lensmcp.${t}/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(t){return Math.max(SOURCE_STALE_MIN_MS,SOURCE_STALE_PERIODS*Math.max(0,t))}a(sourceStaleAfterMs,"sourceStaleAfterMs"),e(sourceStaleAfterMs,"sourceStaleAfterMs");const n=e(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isObj"),s=e(t=>typeof t=="number"&&Number.isInteger(t)&&t>=0,"isCount"),E=e(t=>typeof t=="number"&&Number.isFinite(t)&&t>0,"isTime"),u=e((t,r)=>typeof t=="string"&&t.length>0&&t.length<=r,"isStr"),v=e(t=>t===void 0||typeof t=="number"&&t>0,"isMin");function _(t){if(!SOURCE_KINDS_READ.includes(t.sourceKind)||typeof t.path!="string"&&!(t.path===void 0&&(t.sourceKind==="traffic"||t.sourceKind==="loop"))||!u(t.name,200)||typeof t.intervalSec!="number"||t.feeds!==void 0&&!u(t.feeds,200))return!1;const r=t.thresholds;if(!n(r))return!1;for(const o of["stalledMin","idleMin","oldestWaitMin","quotaPct","errorRatePct","orphanMin","failurePct","p95Ms","rateLimited"])if(!v(r[o]))return!1;return t.sourceKind!=="queue"||typeof r.oldestWaitMin=="number"}a(_,"l"),e(_,"asDecl");const l=e(t=>t===null||typeof t=="string","isIsoOrNull"),c=e(t=>t===void 0||s(t),"isOptCount");function d(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!E(t.intervalSec)||!l(t.lastRunAt)||t.nextRunAt!==void 0&&!l(t.nextRunAt))return!1;for(const r of["lastDurationMs","lastItems","runsInWindow","itemsInWindow","failuresInWindow","windowSec"])if(!c(t[r]))return!1;return t.lastOutcome!==void 0&&!LOOP_OUTCOMES.includes(t.lastOutcome)?!1:t.lastError===void 0||typeof t.lastError=="string"}a(d,"_"),e(d,"asLoopSnapshot");const f=e(t=>t===void 0||n(t)&&Object.values(t).every(r=>typeof r=="string"),"isLabels");function S(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!s(t.objects)||!s(t.bytes)||t.quotaBytes!==void 0&&t.quotaBytes!==null&&!s(t.quotaBytes))return!1;for(const i of["opsInWindow","writesInWindow","deletesInWindow","errorsInWindow","windowSec"])if(!c(t[i]))return!1;if(t.lastWriteAt!==void 0&&!l(t.lastWriteAt)||t.lastError!==void 0&&typeof t.lastError!="string")return!1;const r=t.truncated;if(r!==void 0&&!(n(r)&&s(r.groups)))return!1;const o=t.groups;return o===void 0?!0:Array.isArray(o)&&o.length<=SOURCE_MAX_GROUPS&&o.every(i=>n(i)&&u(i.group,1e3)&&s(i.objects)&&s(i.bytes)&&f(i.labels))}a(S,"S"),e(S,"asStoreSnapshot");function p(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!Array.isArray(t.channels)||!c(t.windowSec))return!1;const r=t.truncated;return r!==void 0&&!(n(r)&&s(r.channels))?!1:t.channels.length<=SOURCE_MAX_GROUPS&&t.channels.every(o=>{if(!n(o)||!u(o.channel,1e3)||!f(o.labels)||o.direction!==void 0&&o.direction!=="inbound"&&o.direction!=="outbound"||o.counterpart!==void 0&&!u(o.counterpart,200))return!1;for(const i of["messagesInWindow","failuresInWindow","rateLimitedInWindow"])if(!c(o[i]))return!1;return o.p95Ms!==void 0&&!(typeof o.p95Ms=="number"&&Number.isFinite(o.p95Ms)&&o.p95Ms>=0)||o.lastAt!==void 0&&!l(o.lastAt)?!1:o.lastError===void 0||typeof o.lastError=="string"})}a(p,"R"),e(p,"asTrafficSnapshot");function R(t){return n(t)&&u(t.digest,100)&&typeof t.at=="string"&&E(t.receivedAt)}a(R,"A"),e(R,"asSame");function A(t){if(!n(t)||!u(t.group,1e3)||!s(t.pending))return!1;for(const i of["inFlight","failed","completedInWindow"])if(t[i]!==void 0&&!s(t[i]))return!1;const r=t.oldestPendingAt;if(r!=null&&typeof r!="string")return!1;const o=t.labels;return o===void 0||n(o)&&Object.values(o).every(i=>typeof i=="string")}a(A,"O"),e(A,"asGroup");function O(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!Array.isArray(t.groups))return!1;const r=t.totals;if(!n(r)||!s(r.groups)||!s(r.pending)||!s(r.inFlight)||!s(r.failed))return!1;const o=t.truncated;return o!==void 0&&!(n(o)&&s(o.groups))?!1:t.groups.length<=SOURCE_MAX_GROUPS&&t.groups.every(A)}a(O,"T"),e(O,"asSnapshot");export function asSourcePollRaw(t){if(!n(t)||t.kind!=="source-poll"||!u(t.project,200)||!_(t)||!SOURCE_POLL_STATES.includes(t.state)||!E(t.polledAt)||!E(t.reportEveryMs)||t.path===void 0)return;const r=SOURCE_SNAPSHOT_FIELD[t.sourceKind];for(const i of Object.values(SOURCE_SNAPSHOT_FIELD))if(i!==r&&t[i]!==void 0)return;const o={snapshot:O,loop:d,store:S,traffic:p}[r];if(!(t[r]!==void 0&&!o(t[r]))&&!(t.same!==void 0&&(!R(t.same)||t[r]!==void 0))&&!(t.state==="current"&&t[r]===void 0&&t.same===void 0))return t}a(asSourcePollRaw,"asSourcePollRaw"),e(asSourcePollRaw,"asSourcePollRaw");export function asSourceEventRaw(t){if(!n(t)||t.kind!=="source-event"||!u(t.project,200)||!u(t.name,200))return;const r=t.sourceKind;if(SOURCE_KINDS_READ.includes(r)&&SOURCE_PUSH_EVENTS[r].includes(t.event)&&!(t.item!==void 0&&!u(t.item,200)||t.group!==void 0&&!u(t.group,200))&&!(!c(t.items)||!c(t.durationMs)||!c(t.bytes))&&!(t.outcome!==void 0&&!SOURCE_PUSH_OUTCOMES[r].includes(t.outcome))){for(const o of["object","channel","counterpart","correlation"])if(t[o]!==void 0&&!u(t[o],200))return;if(!(t.error!==void 0&&typeof t.error!="string"))return t}}a(asSourceEventRaw,"asSourceEventRaw"),e(asSourceEventRaw,"asSourceEventRaw");export function asSourceDeclarationRaw(t){if(!(!n(t)||t.kind!=="source-declaration"||!u(t.project,200))&&!(!Array.isArray(t.sources)||!t.sources.every(r=>n(r)&&_(r)))&&!(!Array.isArray(t.problems)||!t.problems.every(r=>typeof r=="string")))return t}a(asSourceDeclarationRaw,"asSourceDeclarationRaw"),e(asSourceDeclarationRaw,"asSourceDeclarationRaw");
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");
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var r=(e,n)=>o(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,s=r((e,n)=>a(e,"name",{value:n,configurable:!0}),"n");export function systemScopeId(e){return e.kind==="machine"?"machine":e.kind==="repository"?`repo:${e.repoId}`:`ws:${e.key}`}r(systemScopeId,"systemScopeId"),s(systemScopeId,"systemScopeId");export function systemItemKey(e,n){return`${systemScopeId(e)}/${n}`}r(systemItemKey,"systemItemKey"),s(systemItemKey,"systemItemKey");export function systemValue(e,n){switch(n){case"bytes":{const t=e/1073741824;return t>=1?`${t.toFixed(t>=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)}}r(systemValue,"systemValue"),s(systemValue,"systemValue");export function systemScopeLabel(e){return e.kind==="machine"?"machine":e.kind==="repository"?e.name:`${e.name} lens`}r(systemScopeLabel,"systemScopeLabel"),s(systemScopeLabel,"systemScopeLabel");const u={"n/a":0,ok:1,warn:2,bad:3};export function systemStatusRank(e){return u[e]}r(systemStatusRank,"systemStatusRank"),s(systemStatusRank,"systemStatusRank");
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");
@@ -10,13 +10,18 @@ export interface GoalAdmission {
10
10
  }
11
11
  /** Pinned by the approved design. Absence preserves the legacy hand-off engine. */
12
12
  export declare const PROOF_ACTIONS: readonly ["test", "typecheck", "lint", "build", "e2e", "verify"];
13
- /** The kinds of proof the person has a goal not run: unrun, never passed — a candidate still lands by their force. */
13
+ /** What the person may have a goal not run (issues/closed/overseer-78): a kind of proof, or `qa` — the goal's QA run. */
14
+ export declare const NOT_RUN_KINDS: readonly ["test", "typecheck", "lint", "build", "e2e", "verify", "qa"];
15
+ export type NotRunKind = (typeof NOT_RUN_KINDS)[number];
16
+ /** What the person has a goal not run (overseer-78): «not run — the person's decision», who and why — never passed, done for its step. */
14
17
  export interface ProofDeferral {
15
- actions: Array<(typeof PROOF_ACTIONS)[number]>;
18
+ actions: NotRunKind[];
16
19
  reason: string;
17
20
  by: 'user';
18
21
  delegate?: string;
19
22
  at: number;
23
+ /** Recorded as done for its step (overseer-78). A deferral recorded before still lands by the person's force until recorded again. */
24
+ done?: true;
20
25
  }
21
26
  export interface GoalDeliveryPolicy {
22
27
  version: 1;
@@ -87,12 +92,31 @@ export interface PackageCandidate {
87
92
  evidence?: ProofEvidence;
88
93
  reason?: string;
89
94
  }>;
95
+ /** `carried`: an approval of an earlier candidate with this one's own patch — its `taskId` and `by` — and no review task (issues/closed/overseer-79). */
90
96
  reviews: Array<{
91
97
  role: string;
92
98
  taskId: string;
93
99
  state: 'pending' | 'approved' | 'changes-requested';
94
100
  by?: string;
101
+ carried?: {
102
+ from: string;
103
+ at: number;
104
+ };
95
105
  }>;
106
+ /** Its own change, base to it, normalised (issues/closed/overseer-79); absent on one prepared before it. */
107
+ patch?: string;
108
+ /** Its final reviews, made once the required proofs in `waitsFor` are in (issues/closed/overseer-77); absent on one prepared before it. */
109
+ reviewPlan?: {
110
+ waitsFor: string[];
111
+ roles: Array<{
112
+ role: string;
113
+ since?: string;
114
+ checks: Array<{
115
+ id: string;
116
+ why: string;
117
+ }>;
118
+ }>;
119
+ };
96
120
  /**
97
121
  * How many of the contract's acceptance lines its final reviews were made with (planning/team/25 EF-D1). Lines are only
98
122
  * appended, so a role's delta re-review of a later candidate checks those added since as items of their own. Absent on
@@ -177,7 +201,7 @@ export interface ForcedItem {
177
201
  kind: 'proof' | 'review' | 'finding';
178
202
  /** The proof's requirement id, the review's role, or the finding's id. */
179
203
  id: string;
180
- /** `failed`, `queued`, `not run`, `changes-requested`, `pending`, `none`, or a finding's kind (`unclassified` without one). */
204
+ /** `failed`, `queued`, `not run`, `changes-requested`, `pending`, `none`, `waiting for proofs`, or a finding's kind (`unclassified` without one). */
181
205
  state: string;
182
206
  runId?: string;
183
207
  taskId?: string;
@@ -219,6 +243,8 @@ export interface PackageDelivery {
219
243
  tests?: PackagePublication;
220
244
  /** The person let it land without its tests publication (issues/closed/overseer-68): its candidate is the implementation alone. */
221
245
  testsWaived?: TestsWaiver;
246
+ /** Its goal's «not run — the person's decision» on it (overseer-78): set and lifted with the goal's, kept once it integrated. */
247
+ notRun?: ProofDeferral;
222
248
  candidates: PackageCandidate[];
223
249
  current?: string;
224
250
  findings: DeliveryFinding[];
@@ -266,11 +292,19 @@ export interface DeliveryAssignment {
266
292
  export interface PackageDeliverySummary {
267
293
  state: 'building' | 'authoring-tests' | 'preparing' | 'verifying' | 'needs-repair' | 'ready' | 'integrating' | 'integrated';
268
294
  candidate?: string;
269
- /** `waived`: required proofs the person waived on this candidate (issues/closed/overseer-34), not counted in `passed`. */
295
+ /** `waived` (overseer-34) and `notRun` (overseer-78): required proofs the person waived or decided not to run — never in `passed`. */
270
296
  proofs: {
271
297
  passed: number;
272
298
  required: number;
273
299
  waived?: number;
300
+ notRun?: number;
301
+ };
302
+ /** «Not run — the person's decision» on it (issues/closed/overseer-78): the kinds, who, why — never passed. */
303
+ notRun?: {
304
+ kinds: string[];
305
+ by: string;
306
+ reason: string;
307
+ tests?: true;
274
308
  };
275
309
  reviews: {
276
310
  approved: number;
@@ -1 +1 @@
1
- "use strict";export const PROOF_ACTIONS=["test","typecheck","lint","build","e2e","verify"];
1
+ "use strict";export const PROOF_ACTIONS=["test","typecheck","lint","build","e2e","verify"],NOT_RUN_KINDS=[...PROOF_ACTIONS,"qa"];
@@ -325,3 +325,227 @@ export interface DashTeamDesignState {
325
325
  runToolCalls?: number;
326
326
  };
327
327
  }
328
+ /**
329
+ * What a design says of a role beside its file's fields (planning/team/26): the project's skills its work needs, when
330
+ * it reaches for each tool it adds, and the commands it runs as proof before it says done.
331
+ */
332
+ export interface TeamDesignRole {
333
+ /** The project's skills (`.claude/skills`, `.agents/skills`) this role's work needs, by name — written to its file's `skills:`. */
334
+ skills?: string[];
335
+ /** For each tool in `uses`: when this role reaches for it, in a sentence — written as the tool's reason in the role file. */
336
+ toolReasons?: Record<string, string>;
337
+ /** The commands this role runs as proof before it says done, as the repository writes them. */
338
+ proof?: string[];
339
+ }
340
+ /**
341
+ * The free check-up of a repository's team files: no model, no network, no writes. It reads the role files, the project
342
+ * brief, `flow.json`, the library roles they build on, the project's skills and instruction files and the open
343
+ * proposals, and lists what is stale, filler, unassigned, heavy or waiting — each item with its evidence and its fix.
344
+ * How its items are grouped, in the order the page shows them.
345
+ */
346
+ export declare const TEAM_CHECKUP_GROUPS: readonly ["drift", "lint", "skills", "weight", "proposals"];
347
+ export type TeamCheckupGroup = (typeof TEAM_CHECKUP_GROUPS)[number];
348
+ /**
349
+ * What an item says, by group:
350
+ * - drift — `base-moved`: the library role a role file builds on changed since the file was written against it;
351
+ * `base-unrecorded`: the file does not say which version of its base it was written against;
352
+ * - lint — the team lint's kinds (libs/storage team-lint.ts): `dangling-role`, `dangling-tool`, `dangling-skill`,
353
+ * `old-flow`, `duplicate-of-base`, `filler-reason`, `cap-mismatch`, `copied`, `check-unread`, `failed-twice`,
354
+ * `lesson-stale`;
355
+ * - skills — `skills-unheld`: project skills no role holds; `role-without-skills`: a role whose kind of work has
356
+ * project skills and holds none, with a proposed assignment;
357
+ * - weight — `heavy-instructions`: an instruction file an agent's client loads, past 40,000 characters; `heavy-rules`:
358
+ * a role file's rules past the length a join carries well; `past-cut`, `long-craft`: text a join cuts or carries long;
359
+ * - proposals — `open-proposal`: a retrospective's or the overseer's open proposal about the team's files.
360
+ */
361
+ export declare const TEAM_CHECKUP_KINDS: readonly ["base-moved", "base-unrecorded", "dangling-role", "dangling-tool", "dangling-skill", "old-flow", "duplicate-of-base", "filler-reason", "cap-mismatch", "copied", "check-unread", "failed-twice", "lesson-stale", "skills-unheld", "role-without-skills", "heavy-instructions", "heavy-rules", "past-cut", "long-craft", "open-proposal"];
362
+ export type TeamCheckupKind = (typeof TEAM_CHECKUP_KINDS)[number];
363
+ /** One line of a team file changed: replaced, removed, or a new line put after it. `old` is the whole line as it is now. */
364
+ export interface TeamCheckupEdit {
365
+ /** 1-based, where the check-up saw the line. */
366
+ line: number;
367
+ old: string;
368
+ op: 'replace' | 'remove' | 'insert-after';
369
+ /** The new line (replace, insert-after). */
370
+ text?: string;
371
+ }
372
+ /**
373
+ * A ready patch to one team file. `safe`: mechanical — it changes no rule and takes no tool or skill a role uses (a
374
+ * filler reason replaced by the library's own, a name that resolves nowhere removed, the base's version recorded). A
375
+ * patch that is not safe is a proposal (a skills assignment): the person picks it by itself.
376
+ */
377
+ export interface TeamCheckupPatch {
378
+ file: string;
379
+ edits: TeamCheckupEdit[];
380
+ safe: boolean;
381
+ /** One line: what applying it does. */
382
+ what: string;
383
+ }
384
+ export interface TeamCheckupItem {
385
+ /** Stable across check-ups: its kind, its file and what it is about — never its line, which moves. A dismissal is kept by it. */
386
+ id: string;
387
+ kind: TeamCheckupKind;
388
+ group: TeamCheckupGroup;
389
+ /** Repository-relative (`.lensmcp/team/roles/manager.md`), `team://library/<id>` for LensMCP's craft, or a finding's id. */
390
+ file: string;
391
+ /** 1-based; 1 when the item is about the whole file. */
392
+ line: number;
393
+ /** One line: what is wrong, and where. */
394
+ text: string;
395
+ /** What shows it: the line as written, the numbers measured, the goals that reported it. */
396
+ evidence: string;
397
+ /** One line: what to do about it, and what that changes. */
398
+ fix: string;
399
+ patch?: TeamCheckupPatch;
400
+ refs?: Array<{
401
+ file: string;
402
+ line?: number;
403
+ }>;
404
+ /** An open proposal: how often it came back. */
405
+ seen?: number;
406
+ /** The person dismissed it: it stays out of the counts until what it is about changes. */
407
+ dismissed?: {
408
+ at: number;
409
+ why?: string;
410
+ };
411
+ }
412
+ /** A library role a role file builds on moved since the file was written: «tech-lead moved from 21 to 22: 3 changes; manager.md has 2 lines it makes stale». */
413
+ export interface TeamCheckupMoved {
414
+ role: string;
415
+ file: string;
416
+ base: string;
417
+ from: number;
418
+ to: number;
419
+ /** The base's own lines for the versions since, newest first — none when the library does not say. */
420
+ changes: string[];
421
+ /** The lines of the file the lint lists as stale against the base as it is now. */
422
+ stale: number;
423
+ text: string;
424
+ }
425
+ /** `GET /api/team/checkup`: the check-up as now read. */
426
+ export interface DashTeamCheckup {
427
+ at: number;
428
+ /** The repository has team files of its own: there is something to check. */
429
+ team: boolean;
430
+ /** Open items, by group (TEAM_CHECKUP_GROUPS), then kind, file and line. */
431
+ items: TeamCheckupItem[];
432
+ /** The items the person dismissed that would still be listed. */
433
+ dismissed: TeamCheckupItem[];
434
+ /** Open items by group and by kind, and how many carry a safe patch. */
435
+ counts: {
436
+ total: number;
437
+ safe: number;
438
+ groups: Record<TeamCheckupGroup, number>;
439
+ kinds: Partial<Record<TeamCheckupKind, number>>;
440
+ };
441
+ moved: TeamCheckupMoved[];
442
+ /** Items past the most a check-up lists. */
443
+ cut?: number;
444
+ /** What it could not check, and why — never silent. */
445
+ notes: string[];
446
+ }
447
+ /** `POST /api/team/checkup/preview` and `/apply`: the items whose patches to apply — every safe one when `safe` is set. */
448
+ export interface DashTeamCheckupPick {
449
+ ids?: string[];
450
+ safe?: boolean;
451
+ /** The page's, one per submit: an apply sent again tells the team once. */
452
+ requestId?: string;
453
+ }
454
+ /** What applying would change, file by file, as a unified diff — and what it would not, and why. Nothing is written. */
455
+ export interface DashTeamCheckupPreview {
456
+ files: Array<{
457
+ path: string;
458
+ diff: string;
459
+ edits: number;
460
+ items: string[];
461
+ }>;
462
+ problems: string[];
463
+ }
464
+ export interface DashTeamCheckupApplied {
465
+ written: string[];
466
+ /** The items whose patches were applied. */
467
+ applied: string[];
468
+ problems: string[];
469
+ notified?: boolean;
470
+ }
471
+ /** One change a tune proposes to one team file — accepted or rejected by itself. */
472
+ export interface TeamTuneChange {
473
+ /** Stable within its run: `c1`, `c2`… */
474
+ id: string;
475
+ /** `.lensmcp/team/roles/<id>.md` or `.lensmcp/team/project.md`. */
476
+ file: string;
477
+ /** One line: what it changes. */
478
+ title: string;
479
+ why: string;
480
+ /** Check-up item ids, and `file:line` citations of the team's files or the library. */
481
+ evidence: string[];
482
+ /** The measure it should move, and which way: «filler tool reasons in role files: 42 → 0». */
483
+ measure: string;
484
+ /** Exact text of the file as the tune read it, and what replaces it. */
485
+ edits: Array<{
486
+ old: string;
487
+ new: string;
488
+ }>;
489
+ /** The unified diff LensMCP made from the edits, against the file as it was when the tune ran. */
490
+ diff: string;
491
+ /** The check-up items it answers. */
492
+ items: string[];
493
+ /** The person's verdict, once given — `problem`: why an accepted change was not written. */
494
+ verdict?: {
495
+ is: 'accepted' | 'rejected';
496
+ at: number;
497
+ problem?: string;
498
+ };
499
+ }
500
+ /** A tune's answer, as LensMCP checked it: a change set, never whole roles. */
501
+ export interface TeamTune {
502
+ version: 1;
503
+ /** Two or three sentences: what the check-up showed and what the changes do about it. */
504
+ summary: string;
505
+ changes: TeamTuneChange[];
506
+ /** What LensMCP's checks dropped or changed of the answer, and why. */
507
+ checks: TeamDesignCheck[];
508
+ /** What it left alone, and why. */
509
+ limits: string[];
510
+ basis: {
511
+ at: number;
512
+ items: number;
513
+ files: string[];
514
+ };
515
+ }
516
+ /** A design run carries a design; a tune run carries a change set. Both are runs of the project's team. */
517
+ export interface DashTeamDesignRun {
518
+ kind?: 'design' | 'tune';
519
+ tune?: TeamTune;
520
+ }
521
+ /** `POST /api/team/tune/accept`: the changes of a tune the person accepts and rejects — each alone. */
522
+ export interface DashTeamTuneVerdicts {
523
+ runId: string;
524
+ accept: string[];
525
+ reject: string[];
526
+ requestId?: string;
527
+ }
528
+ export interface DashTeamTuneAccepted {
529
+ written: string[];
530
+ accepted: string[];
531
+ rejected: string[];
532
+ problems: string[];
533
+ notified?: boolean;
534
+ run?: DashTeamDesignRun;
535
+ }
536
+ /** What `GET /api/team/design` says of the tune: its newest run, and what one started now may spend. */
537
+ export interface DashTeamDesignState {
538
+ tune?: {
539
+ latest?: DashTeamDesignRun;
540
+ /** The newest finished tune, when the newest run is another. */
541
+ done?: DashTeamDesignRun;
542
+ /** Settings › Design «Team tune ceiling» ($10 unless set), held to what the day's design allowance has left. */
543
+ ceiling: {
544
+ usd: number;
545
+ toolCalls: number;
546
+ source: 'workspace' | 'default';
547
+ runUsd: number;
548
+ runToolCalls: number;
549
+ };
550
+ };
551
+ }
@@ -1 +1 @@
1
- "use strict";export const TEAM_DESIGN_VERSION=1;
1
+ "use strict";export const TEAM_DESIGN_VERSION=1,TEAM_CHECKUP_GROUPS=["drift","lint","skills","weight","proposals"],TEAM_CHECKUP_KINDS=["base-moved","base-unrecorded","dangling-role","dangling-tool","dangling-skill","old-flow","duplicate-of-base","filler-reason","cap-mismatch","copied","check-unread","failed-twice","lesson-stale","skills-unheld","role-without-skills","heavy-instructions","heavy-rules","past-cut","long-craft","open-proposal"];