@lensmcp/protocol-types 1.26.36 → 1.26.38

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 (79) hide show
  1. package/index.d.ts +7 -0
  2. package/index.js +1 -1
  3. package/lib/account-drain.js +1 -1
  4. package/lib/ai-cache-facts.js +1 -1
  5. package/lib/ai-cache-verdict.js +1 -1
  6. package/lib/ai-cache.js +3 -3
  7. package/lib/ai-call-groups.js +2 -2
  8. package/lib/ai-call-row.js +3 -3
  9. package/lib/ai-call.js +9 -9
  10. package/lib/ai-compare.js +3 -3
  11. package/lib/ai-context.js +6 -6
  12. package/lib/ai-origins.js +9 -9
  13. package/lib/ai-together.js +5 -5
  14. package/lib/bounded-clone.js +1 -1
  15. package/lib/bounded-map.js +1 -1
  16. package/lib/bounded-writer.js +1 -1
  17. package/lib/canvas-attachments.js +1 -1
  18. package/lib/canvas-catalog.d.ts +10 -5
  19. package/lib/canvas-catalog.js +1 -1
  20. package/lib/canvas-chat.js +2 -2
  21. package/lib/canvas-diagram.d.ts +130 -0
  22. package/lib/canvas-diagram.js +8 -0
  23. package/lib/canvas-editing.js +4 -4
  24. package/lib/canvas-frame-policy.js +1 -1
  25. package/lib/canvas-hub.js +1 -1
  26. package/lib/canvas.d.ts +9 -5
  27. package/lib/capture-demand.js +1 -1
  28. package/lib/dashboard-path.js +1 -1
  29. package/lib/dashboard.d.ts +2 -0
  30. package/lib/delivery-actions.d.ts +257 -0
  31. package/lib/delivery-actions.js +1 -0
  32. package/lib/delivery-status.d.ts +201 -4
  33. package/lib/docker-errors.js +1 -1
  34. package/lib/docker-jobs.js +1 -1
  35. package/lib/docker-report.js +2 -2
  36. package/lib/docker-runs.js +3 -3
  37. package/lib/error-cause.js +6 -6
  38. package/lib/error-dismissal.js +1 -1
  39. package/lib/error-verdict.js +3 -3
  40. package/lib/event-loop.js +1 -1
  41. package/lib/expected-failure.js +2 -2
  42. package/lib/finding-proof.js +1 -1
  43. package/lib/flood-guard.js +1 -1
  44. package/lib/goal-design.js +1 -1
  45. package/lib/goal-main-follow.d.ts +103 -0
  46. package/lib/goal-main-follow.js +1 -0
  47. package/lib/goal-number.js +1 -1
  48. package/lib/goal-process.d.ts +449 -0
  49. package/lib/goal-process.js +1 -0
  50. package/lib/goal-review.d.ts +126 -0
  51. package/lib/goal-review.js +6 -0
  52. package/lib/host-agents.js +1 -1
  53. package/lib/lens-hosts.js +1 -1
  54. package/lib/lint-coverage.js +1 -1
  55. package/lib/lint-ignores.js +2 -2
  56. package/lib/log-query.js +1 -1
  57. package/lib/metrics-reset.js +1 -1
  58. package/lib/overseer-findings.js +1 -1
  59. package/lib/peers.d.ts +31 -31
  60. package/lib/peers.js +1 -1
  61. package/lib/perf-rules.js +1 -1
  62. package/lib/pod-memory.js +1 -1
  63. package/lib/producer-health.js +1 -1
  64. package/lib/pull-requests.d.ts +33 -2
  65. package/lib/remote-instances.js +1 -1
  66. package/lib/source.d.ts +414 -0
  67. package/lib/source.js +1 -0
  68. package/lib/sources.js +1 -1
  69. package/lib/static-checks.js +1 -1
  70. package/lib/system-report.js +1 -1
  71. package/lib/team-decide.d.ts +191 -0
  72. package/lib/team-decide.js +1 -0
  73. package/lib/team-design.d.ts +43 -7
  74. package/lib/team-design.js +1 -1
  75. package/lib/team-library.d.ts +2 -0
  76. package/lib/team-roadmap.d.ts +44 -2
  77. package/lib/team.d.ts +63 -3
  78. package/lib/team.js +1 -1
  79. package/package.json +1 -1
@@ -0,0 +1,257 @@
1
+ import type { DashPrMerger } from './goal-main-follow.js';
2
+ import type { DashDeliveryCommit } from './delivery-status.js';
3
+ /**
4
+ * Delivery ships work from the page (issues/closed/foodguard-334). The owner, 2026-11-25: «… to have options to merge and
5
+ * land and doing the correct things», then «it may be a specific agent that know what to do next that will use the
6
+ * claude api to do things and display status».
7
+ *
8
+ * Two halves, both the person's:
9
+ *
10
+ * actions a button on the row it belongs to — Land on main, Open / update its pull request, Merge the pull request,
11
+ * Push main, Pull main, Clean up, Park its app. Each is looked at first (`GET …/action/plan`: its
12
+ * preconditions, met or not, and exactly what it runs), confirmed in one dialog, and run on the server
13
+ * through the dashboard's mutation guard (`POST …/action`), one at a time per goal and per repository
14
+ * steward the Delivery steward: code lists the steps that may run now (the menu), Claude orders them and says why,
15
+ * and the steward runs what it may — a fetch, a park, a pull request kept in step, a cleanup — while what
16
+ * changes main or origin waits for the person's «Do it» (unless they let it), and what needs code goes to
17
+ * the goal's manager as a message
18
+ */
19
+ /** What an action does. `fetch` only moves origin's main; the others are below. */
20
+ export type DashDeliveryActionKind = 'land' | 'pr' | 'merge-pr' | 'push' | 'pull' | 'cleanup' | 'park' | 'fetch';
21
+ export declare const DELIVERY_ACTION_KINDS: readonly DashDeliveryActionKind[];
22
+ /** What an action is about: a goal (land, pr, cleanup, park), a pull request (merge-pr) or the repository (push, pull, fetch). */
23
+ export interface DashDeliveryActionTarget {
24
+ goalId?: string;
25
+ /** A pull request's number. */
26
+ number?: number;
27
+ }
28
+ /** One precondition, as the dialog lists it: met or not, and why not. */
29
+ export interface DashDeliveryActionCheck {
30
+ text: string;
31
+ ok: boolean;
32
+ /** Why it is not met, whole. */
33
+ why?: string;
34
+ }
35
+ /** A ref the action moves: from one commit to another (a new one: no `from`). */
36
+ export interface DashDeliveryActionRef {
37
+ ref: string;
38
+ from?: string;
39
+ to?: string;
40
+ /** In words: «local main moves to the squash commit». */
41
+ text: string;
42
+ }
43
+ /** The goal's last QA run and its other checks — what «Land on main» shows before it runs (it never runs them). */
44
+ export interface DashDeliveryVerdict {
45
+ qa: {
46
+ state: 'passed' | 'failed' | 'cancelled' | 'running' | 'none';
47
+ text: string;
48
+ at?: number;
49
+ };
50
+ /** Its packages integrated and nothing under it open — the rest of what the manager's own merge asks. */
51
+ checks: {
52
+ ok: boolean;
53
+ text: string;
54
+ };
55
+ /** QA did not pass: the person may land it anyway, ticking it — recorded on the goal and in its commit. */
56
+ anyway: boolean;
57
+ }
58
+ /** `GET /api/team/delivery/action/plan?kind=&goal=&number=`: what the action would do, and whether it may now. */
59
+ export interface DashDeliveryActionPlan {
60
+ kind: DashDeliveryActionKind;
61
+ target: DashDeliveryActionTarget;
62
+ /** «Land G-181 on main», «Push main», «Merge #140». */
63
+ title: string;
64
+ /** Every precondition met (with `anyway` ticked, for a land whose QA did not pass). */
65
+ ok: boolean;
66
+ checks: DashDeliveryActionCheck[];
67
+ /** The first precondition not met, whole — why the action is refused. */
68
+ refused?: string;
69
+ /** What runs, in order: each command exactly. */
70
+ commands: string[];
71
+ refs: DashDeliveryActionRef[];
72
+ /** The files it changes (a land's, a pull's), capped — `count` all of them. */
73
+ files: {
74
+ count: number;
75
+ paths: string[];
76
+ };
77
+ /** The commits it sends or brings (a push's, a pull's, a land's), newest first, capped. */
78
+ commits?: DashDeliveryCommit[];
79
+ verdict?: DashDeliveryVerdict;
80
+ /** The commit message a land writes — the manager's merge's own (`Goal:` and `Branch:` lines, the commits, the notes). */
81
+ message?: string;
82
+ /** What it never does, in one line: «never forced; nothing pushed». */
83
+ never: string;
84
+ /** What the run must be given back: the facts it was planned on, which it checks again before anything runs. */
85
+ token?: string;
86
+ /** What it is single-flight on: `repo` (main and origin), `goal:<id>`, `pr:<n>`. */
87
+ locks: string[];
88
+ /** An action of the same lock runs now. */
89
+ busy?: {
90
+ id: string;
91
+ title: string;
92
+ };
93
+ }
94
+ /** `POST /api/team/delivery/action`: the person's confirmation. */
95
+ export interface DashDeliveryActionRequest {
96
+ kind: DashDeliveryActionKind;
97
+ goalId?: string;
98
+ number?: number;
99
+ /** The plan's token: refused when the facts moved since. */
100
+ token: string;
101
+ /** A land whose QA did not pass, landed past it — and why (recorded on the goal and in its commit). */
102
+ anyway?: {
103
+ why: string;
104
+ };
105
+ /** A step of the steward's plan this act carries out. */
106
+ stepId?: string;
107
+ }
108
+ /** One action run: its progress while it runs, then what it did. `GET /api/team/delivery/action?id=`. */
109
+ export interface DashDeliveryActionRun {
110
+ id: string;
111
+ kind: DashDeliveryActionKind;
112
+ target: DashDeliveryActionTarget;
113
+ title: string;
114
+ state: 'running' | 'done' | 'failed';
115
+ /** Where it is now: «Squashing lensmcp/g-… onto main», «Pushing main to origin». */
116
+ stage: string;
117
+ startedAt: number;
118
+ endedAt?: number;
119
+ /**
120
+ * The person's click, the steward's own act (with the person's standing permission), or LensMCP's auto-merge of a
121
+ * goal's pull request that is ready, green and holds origin's main (issues/closed/hub-19).
122
+ */
123
+ by: 'person' | 'steward' | 'lensmcp';
124
+ /** What happened, line by line. */
125
+ did: string[];
126
+ error?: string;
127
+ /** What it made: a commit, a pull request, a worktree action's run. */
128
+ result?: {
129
+ sha?: string;
130
+ number?: number;
131
+ url?: string;
132
+ worktreeRun?: string;
133
+ };
134
+ }
135
+ /** `off`; `idle` (nothing to do, or a plan with nothing left); `planning` (Claude reads the menu); `waiting` (a step waits for you); `working`; `failed` (its last plan or step failed). */
136
+ export type DashStewardState = 'off' | 'idle' | 'planning' | 'waiting' | 'working' | 'failed';
137
+ /** A step of the steward's menu: an action, or a message to a goal's manager about work that needs code. */
138
+ export type DashStewardStepKind = DashDeliveryActionKind | 'tell-manager';
139
+ /**
140
+ * Who carries a step out: `auto` — the steward, by itself, when the person lets it tidy (a fetch, a park, a pull request
141
+ * kept in step, a cleanup of work on origin); `click` — the person's «Do it» (land, push, pull, merge — or the steward
142
+ * itself when they let it land, push and merge); `team` — the goal's manager, told by a message.
143
+ */
144
+ export type DashStewardHands = 'auto' | 'click' | 'team';
145
+ export interface DashStewardStep {
146
+ /** Stable while its facts hold: `land:<goal>`, `push`, `merge-pr:140`, `tell:<goal>:conflict`. */
147
+ id: string;
148
+ kind: DashStewardStepKind;
149
+ /** «Land G-181 on main», «Push main (2 commits)», «Tell G-182's manager: main moved past its branch». */
150
+ label: string;
151
+ target: DashDeliveryActionTarget;
152
+ /** The facts behind it, as code read them. */
153
+ facts: string[];
154
+ hands: DashStewardHands;
155
+ /** Why now, in one line — Claude's, or the code's own. */
156
+ why?: string;
157
+ state: 'proposed' | 'running' | 'done' | 'failed' | 'skipped';
158
+ /** Its run, once started (an action's), or what was sent (a message). */
159
+ run?: {
160
+ id?: string;
161
+ at: number;
162
+ text: string;
163
+ ok: boolean;
164
+ };
165
+ }
166
+ export interface DashStewardPlan {
167
+ at: number;
168
+ /** `model`: Claude ordered the menu; `code`: the code's own order (no key, the allowance spent, or an answer it could not use — `fallback` says which). */
169
+ by: 'model' | 'code';
170
+ trigger: 'click' | 'auto';
171
+ steps: DashStewardStep[];
172
+ fallback?: string;
173
+ model?: string;
174
+ costUsd?: number;
175
+ /** The AI call's ledger id (AI calls page). */
176
+ ledgerId?: string;
177
+ /** The menu it was planned from, one line: «4 steps: land, push, cleanup, tell-manager». */
178
+ menu: string;
179
+ }
180
+ /** The steward's switches — the person's alone, kept in the team's store (never a file an agent could edit). */
181
+ export interface DashStewardSettings {
182
+ /** The background look in the dashboard's minute: plans when the delivery facts change. Off by default. */
183
+ look: 'on' | 'off';
184
+ /** Steps that only read or tidy run by themselves: a fetch, a park, a pull request kept in step, a cleanup of work on origin. Off by default. */
185
+ tidy: 'on' | 'off';
186
+ /** «The steward may land, push and merge»: steps that change main or origin run without a click. Off by default. */
187
+ landPushMerge: 'on' | 'off';
188
+ /**
189
+ * «Label linked pull requests by itself» (issues/closed/hub-13): an open pull request proven to carry a goal (its
190
+ * branch, or the goal's verified commit) that lacks the goal's label is labelled as «Tag» does. On by default.
191
+ */
192
+ autoLabel: 'on' | 'off';
193
+ /**
194
+ * «Auto-merge» (issues/closed/hub-19): LensMCP merges a goal's pull request by itself once it is ready, green
195
+ * and holds origin's main. Unset: flow.json `delivery.autoMerge`, on by default while pull requests are.
196
+ */
197
+ autoMerge?: 'on' | 'off';
198
+ /** «PR merger»: after a goal completes, its open pull request is a merge task of the repository's one PR merger. Unset: on. */
199
+ prMerger?: 'on' | 'off';
200
+ updatedAt?: number;
201
+ }
202
+ export declare const STEWARD_DEFAULTS: DashStewardSettings;
203
+ export interface DashStewardLogEntry {
204
+ at: number;
205
+ kind: 'plan' | 'act' | 'tell' | 'fail' | 'settings';
206
+ text: string;
207
+ by: 'person' | 'steward';
208
+ goalId?: string;
209
+ costUsd?: number;
210
+ }
211
+ /** `GET /api/team/delivery/steward`: the panel at the top of Delivery › Status. */
212
+ export interface DashStewardView {
213
+ at: number;
214
+ state: DashStewardState;
215
+ /** One line: «Off — Plan next steps asks Claude once», «2 steps wait for you», «Planning…». */
216
+ stateText: string;
217
+ settings: DashStewardSettings;
218
+ plan?: DashStewardPlan;
219
+ /** What it did last. */
220
+ last?: DashStewardLogEntry;
221
+ /** Its newest log lines, newest first. */
222
+ log: DashStewardLogEntry[];
223
+ /** What its plans cost today (UTC), and each trigger's allowance as spent today by everything on it. */
224
+ cost: {
225
+ day: string;
226
+ usd: number;
227
+ plans: number;
228
+ click: {
229
+ spentUsd: number;
230
+ capUsd: number;
231
+ };
232
+ auto: {
233
+ spentUsd: number;
234
+ capUsd: number;
235
+ };
236
+ };
237
+ /** A working Anthropic key: without one, a plan is the code's order. */
238
+ hasKey: boolean;
239
+ /** «Plan next steps» may run now — and why not. */
240
+ canPlan: boolean;
241
+ whyNot?: string;
242
+ /** This dashboard runs the background look (the main checkout's). */
243
+ looks: boolean;
244
+ nextLookAt?: number;
245
+ /** «Auto-merge» as it stands now (issues/closed/hub-19): on or off, and why — the switch, flow.json, or pull requests off. */
246
+ autoMerge?: {
247
+ on: boolean;
248
+ why: string;
249
+ };
250
+ /** The repository's PR merger: its switch, the agent running, its queue (hub-19). */
251
+ merger?: DashPrMerger;
252
+ }
253
+ /** `POST /api/team/delivery/steward/settings`: one switch, the person's. */
254
+ export interface DashStewardSettingRequest {
255
+ key: keyof Omit<DashStewardSettings, 'updatedAt'>;
256
+ value: 'on' | 'off';
257
+ }
@@ -0,0 +1 @@
1
+ "use strict";export const DELIVERY_ACTION_KINDS=["land","pr","merge-pr","push","pull","cleanup","park","fetch"],STEWARD_DEFAULTS={look:"off",tidy:"off",landPushMerge:"off",autoLabel:"on"};
@@ -1,4 +1,6 @@
1
+ import type { DashDeliveryActionKind } from './delivery-actions.js';
1
2
  import type { DashPrProblemKind } from './pull-requests.js';
3
+ import type { DashGoalReviewBrief } from './goal-review.js';
2
4
  /**
3
5
  * Delivery › Status (issues/closed/foodguard-312): the repository's whole delivery at a glance. The owner, 2026-11-25:
4
6
  * «along with prs page we need understand how we can display the full status of the system, how much prs, what is need
@@ -9,18 +11,22 @@ import type { DashPrProblemKind } from './pull-requests.js';
9
11
  */
10
12
  /** One line of «What needs you»: how many, what, and what to do. */
11
13
  export interface DashDeliveryNeed {
12
- key: 'main-behind' | 'main-diverged' | 'main-ahead' | 'main-ci' | 'prs-blocked' | 'prs-ready' | 'retarget' | 'goals-asking' | 'goals-ready' | 'goals-landed' | 'uncommitted' | 'goals-working' | 'goal-prs-closed' | 'goal-prs-failed';
14
+ key: 'main-behind' | 'main-diverged' | 'main-ahead' | 'main-ci' | 'prs-blocked' | 'prs-ready' | 'retarget' | 'goals-asking' | 'goals-ready' | 'goals-landed' | 'uncommitted' | 'goals-working' | 'goal-prs-closed' | 'goal-prs-failed' | 'goals-left' | 'goal-prs-parked';
13
15
  tone: 'bad' | 'warn' | 'info';
14
16
  count: number;
15
17
  text: string;
16
18
  /** A few names behind the count: the pull requests, the goals. */
17
19
  detail?: string;
18
- /** What to do: a command to run in the main checkout, or a page to open. */
20
+ /**
21
+ * What to do: a command to run in the main checkout, or a page to open — and `act`, the page's own action that does it
22
+ * (issues/closed/foodguard-334: «Push main», «Pull main»), looked at and confirmed in its dialog.
23
+ */
19
24
  action: {
20
25
  label: string;
21
26
  command?: string;
22
- page?: 'prs' | 'main' | 'changes' | 'inbox' | 'team' | 'pipeline';
27
+ page?: 'prs' | 'main' | 'changes' | 'inbox' | 'team' | 'pipeline' | 'finished';
23
28
  goalId?: string;
29
+ act?: DashDeliveryActionKind;
24
30
  };
25
31
  }
26
32
  export type DashDeliveryLaneId = 'progress' | 'ready' | 'local' | 'pr' | 'merged';
@@ -108,10 +114,19 @@ export interface DashDeliveryMain {
108
114
  push?: string;
109
115
  /** The newest CI runs of origin's main (one per workflow). */
110
116
  ci: DashDeliveryCiRun[];
111
- /** Uncommitted files in the main checkout — absent: not read. */
117
+ /**
118
+ * Uncommitted files in the main checkout — absent: not read. `files`/`paths`: those that need the person;
119
+ * `ignorable`: scratch, caches and build output (`tmp/`, `__pycache__/`, `dist/` …) counted apart — they never make
120
+ * «Something needs you» — with the `.gitignore` lines that would hide them (issues/closed/foodguard-334).
121
+ */
112
122
  uncommitted?: {
113
123
  files: number;
114
124
  paths: string[];
125
+ ignorable?: {
126
+ files: number;
127
+ paths: string[];
128
+ gitignore: string[];
129
+ };
115
130
  };
116
131
  fetch: DashDeliveryFetch;
117
132
  }
@@ -121,6 +136,12 @@ export interface DashDeliveryBranch {
121
136
  /** The census's class: `unique` — its work is on no main yet — or not classified yet. */
122
137
  class?: string;
123
138
  why?: string;
139
+ /**
140
+ * Its goal landed on main, and this tip is not proven to be what landed — say how it landed instead of its commits
141
+ * «main lacks» (issues/closed/foodguard-315): `landed as squash 82bef45b07 (by hand)`. A goal branch whose landed tip
142
+ * IS proven (its integration's tip, its tree on main, main holding it) is not listed at all.
143
+ */
144
+ goalLanded?: string;
124
145
  /** Commits it has that main lacks, and main has that it lacks. */
125
146
  ahead?: number;
126
147
  behind?: number;
@@ -149,6 +170,10 @@ export interface DashDeliveryWorktree {
149
170
  };
150
171
  }
151
172
  export interface DashDeliveryStatus {
173
+ /**
174
+ * When git was read for it (main, origin's main, the goal refs) — at most every 20 s, and an answer never waits for
175
+ * the next read (issues/closed/hub-13): `prs.at` says when GitHub was.
176
+ */
152
177
  at: number;
153
178
  /** «What needs you», most urgent first — none: nothing does. */
154
179
  needs: DashDeliveryNeed[];
@@ -177,6 +202,11 @@ export interface DashDeliveryStatus {
177
202
  text: string;
178
203
  };
179
204
  };
205
+ /**
206
+ * The goals that finished (completed or cancelled) in the last `days` days, each with where its work went and what is
207
+ * left of it (issues/closed/foodguard-315) — the ones that need the person first, then the newest.
208
+ */
209
+ finished: DashDeliveryFinished;
180
210
  /** `flow.json` `delivery.pullRequests`: whether the team writes on GitHub (the person's `lensmcp agent pr` always may). */
181
211
  settings: {
182
212
  pullRequests: 'on' | 'off';
@@ -185,6 +215,173 @@ export interface DashDeliveryStatus {
185
215
  /** What could not be read, in words. */
186
216
  problems: string[];
187
217
  }
218
+ /** Delivery › Status «Finished goals». */
219
+ export interface DashDeliveryFinished {
220
+ /** The window: goals finished in the last this many days (`?days=`, 14 unless asked). */
221
+ days: number;
222
+ goals: DashGoalLanding[];
223
+ /** Finished in the window beyond those listed. */
224
+ more: number;
225
+ /** Of those listed: how many need the person (not landed, not pushed, not pulled), and how many left something behind. */
226
+ needs: number;
227
+ left: number;
228
+ }
229
+ /**
230
+ * Where a goal's work went — or goes — and what is left of it (issues/closed/foodguard-315). The owner, 2026-11-25: «i
231
+ * need to understand if goal finished, what is her worktree, pr, if it's merged or not, cleaned up or still, what is the
232
+ * status». Delivery › Status lists the finished ones; the goal's drawer shows its own, a running goal's too.
233
+ */
234
+ export interface DashGoalLanding {
235
+ goalId: string;
236
+ /** Its number, shown G-44 (issues/closed/foodguard-314). */
237
+ number?: number;
238
+ title: string;
239
+ /** `completed`, `cancelled` — or, in the drawer, a running goal's state. */
240
+ state: string;
241
+ finishedAt?: number;
242
+ /**
243
+ * The one phrase: «Done and cleaned up», «Done — left: app running, worktree kept», «Done — not pushed», «Not
244
+ * landed», «Cancelled — cleaned up», «Running — not landed yet». `rank`: 0 most urgent.
245
+ */
246
+ status: {
247
+ text: string;
248
+ tone: 'ok' | 'warn' | 'bad' | 'muted';
249
+ rank: number;
250
+ };
251
+ landed: DashLandingLanded;
252
+ pr: DashLandingPr;
253
+ branch: DashLandingBranch;
254
+ worktree: DashLandingWorktree;
255
+ app: DashLandingApp;
256
+ /** What is the person's to do, each with the exact command to copy — run in the main checkout. */
257
+ steps: DashLandingStep[];
258
+ /** What the goal-end sweep did with what it left behind (issues/closed/foodguard-321) — none: not swept here. */
259
+ cleanup?: DashGoalCleanup;
260
+ /** Its review canvas and the person's word on it (issues/closed/hub-18) — none: no review canvas yet. */
261
+ review?: DashGoalReviewBrief;
262
+ }
263
+ /**
264
+ * A finished goal's cleanup as the goal-end sweep recorded it (storage goal-cleanup.ts), for Delivery's rows and drawer
265
+ * (issues/closed/foodguard-334): `kept` says why, `pending` when it looks next, `done` what it removed and parked.
266
+ */
267
+ export interface DashGoalCleanup {
268
+ state: 'pending' | 'kept' | 'done';
269
+ at: number;
270
+ why: string;
271
+ next?: number;
272
+ removed?: {
273
+ name: string;
274
+ root: string;
275
+ branch?: string;
276
+ archive?: string;
277
+ salvage?: string;
278
+ at: number;
279
+ };
280
+ parked?: {
281
+ name: string;
282
+ at: number;
283
+ };
284
+ running?: {
285
+ runId: string;
286
+ action: 'remove' | 'park';
287
+ at: number;
288
+ };
289
+ error?: string;
290
+ }
291
+ export interface DashLandingLanded {
292
+ /**
293
+ * `lensmcp`: LensMCP's merge (agent_task_update merge); `by-hand`: someone else's commit on main; `pull-request`: its
294
+ * pull request merged on GitHub; `none`: nothing of it is on main; `pending`: it is still worked.
295
+ */
296
+ how: 'lensmcp' | 'by-hand' | 'pull-request' | 'none' | 'pending';
297
+ /** What main got: one squash commit, a merge commit, a fast-forward to the branch — undefined: not known. */
298
+ kind?: 'squash' | 'merge' | 'ff';
299
+ /** The commit main got (whole when known; a census reading gives its first nine). */
300
+ sha?: string;
301
+ pr?: number;
302
+ /** On local main, and on origin's (pushed) — undefined: not known, or main tracks no remote. */
303
+ onLocal?: boolean;
304
+ onOrigin?: boolean;
305
+ /**
306
+ * How LensMCP knows: its merge record (`integration`), a commit on main whose message names the goal (`goal-line`,
307
+ * `Goal: <id>`), main's commit with the branch tip's tree (`tree`), the overseer's census (`census`), main holding the
308
+ * tip (`ancestor`), the goal completed in the main checkout (`completed-on-main`), a merged pull request (`pr`).
309
+ */
310
+ by?: 'integration' | 'goal-line' | 'tree' | 'census' | 'ancestor' | 'completed-on-main' | 'pr';
311
+ /** «LensMCP squash 68fa5276ed», «by hand as squash 82bef45b07», «not landed». */
312
+ text: string;
313
+ /** «the branch's 21 commits are on main as that one commit», «its work is only on branch lensmcp/g-…». */
314
+ detail?: string;
315
+ }
316
+ export interface DashLandingPr {
317
+ number?: number;
318
+ state?: 'open' | 'draft' | 'merged' | 'closed';
319
+ url?: string;
320
+ /** «#140 merged», «no pull request (pull requests are off)». */
321
+ text: string;
322
+ }
323
+ export interface DashLandingBranch {
324
+ name?: string;
325
+ /** `local`: on this machine only; `pushed`: on origin too; `deleted`; `none`: the goal had no branch of its own. */
326
+ state: 'local' | 'pushed' | 'deleted' | 'none';
327
+ tip?: string;
328
+ /** Commits of it main lacks — for one that landed as a squash, the commits the squash rewrote, never «work main lacks». */
329
+ offMain?: number;
330
+ /** Made by the lens with its worktree (`instance rm --delete-branch` deletes only such a branch). */
331
+ lensMade?: boolean;
332
+ text: string;
333
+ }
334
+ export interface DashLandingWorktree {
335
+ name?: string;
336
+ path?: string;
337
+ /** `removed`; `kept` (its folder is there); `gone` (git lists it, its folder is gone); `none` (the goal had none). */
338
+ state: 'removed' | 'kept' | 'gone' | 'none';
339
+ /** Why LensMCP kept it when the goal completed — its log, in a few words. */
340
+ why?: string;
341
+ /** Its uncommitted files when the census last read it (`readAt`) — undefined: not read. */
342
+ changes?: number;
343
+ readAt?: number;
344
+ text: string;
345
+ }
346
+ export interface DashLandingApp {
347
+ /** The instance's name (`lensmcp instance …<name>`) and key. */
348
+ name?: string;
349
+ key?: string;
350
+ /**
351
+ * `running` (the gateway serves it), `starting` (its create or start is under way), `parked` (on demand, nothing
352
+ * runs), `stopped`, `failed` (its create or start failed), `checkout-only` (no app of its own), `none` (no instance).
353
+ */
354
+ state: 'running' | 'starting' | 'parked' | 'stopped' | 'failed' | 'checkout-only' | 'none';
355
+ services?: number;
356
+ /** The last `instance run` asked for it; its last use (a request to its hosts); when it parks unless used again. */
357
+ runAt?: number;
358
+ lastUseAt?: number;
359
+ parkAt?: number;
360
+ /** Why it failed, or how far its start got. */
361
+ detail?: string;
362
+ text: string;
363
+ }
364
+ export interface DashLandingStep {
365
+ /** «Park its app», «Remove its worktree and branch», «Push main». */
366
+ label: string;
367
+ /** The command to copy, run in the main checkout — empty when only the page's action does it (Land on main). */
368
+ command: string;
369
+ /** What the command does, for its tip. */
370
+ why?: string;
371
+ /** The page's own action that does it (issues/closed/foodguard-334) — a button beside the command, its dialog first. */
372
+ action?: {
373
+ kind: DashDeliveryActionKind;
374
+ goalId?: string;
375
+ number?: number;
376
+ };
377
+ }
378
+ /** `GET /api/team/delivery/landing?goal=<id>`: one goal's landing, for its drawer. */
379
+ export interface DashGoalLandingAnswer {
380
+ at: number;
381
+ landing?: DashGoalLanding;
382
+ /** Why there is none: the goal is not this repository's, or the store could not be read. */
383
+ problem?: string;
384
+ }
188
385
  /** `POST /api/team/delivery/fetch`: the person's «Fetch now», or `auto` — the page's own, every five minutes. */
189
386
  export interface DashDeliveryFetchRequest {
190
387
  auto?: boolean;
@@ -1 +1 @@
1
- "use strict";var R=Object.defineProperty;var m=(t,e)=>R(t,"name",{value:e,configurable:!0});var O=Object.defineProperty,c=m((t,e)=>O(t,"name",{value:e,configurable:!0}),"c");import{CONTAINER_OOM as v,DOCKER_ENGINE_LOST as j,DOCKER_RUN_FIELD as B}from"./docker-jobs.js";import{joinId as x}from"./error-cause.js";const I=200,$=50,k=c(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isObj"),h=c(t=>{if(typeof t!="string")return;const e=t.trim();return e?e.slice(0,I):void 0},"name"),p=c(t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0,"someMb"),N=c(t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0,"anyMb"),w=c(t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),"defined"),g=c(t=>{if(!k(t))return;const e=h(t.peer);if(!e)return;const s=h(t.name);return s?{peer:e,name:s}:{peer:e}},"hostOf"),f=c(t=>t.name??t.peer,"hostWord");export function readDockerError(t){if(k(t)){if(t.kind===v)return w({kind:v,run:h(t.run),job:h(t.job),service:h(t.service),container:h(t.container),seen:t.seen==="event"||t.seen==="inspect"?t.seen:void 0,limitMb:p(t.limitMb),peakMb:p(t.peakMb),budgetMb:p(t.budgetMb),context:h(t.context),host:g(t.host)});if(t.kind===j){const e=new Map;for(const o of Array.isArray(t.runs)?t.runs:[]){const i=k(o)?h(o.run):h(o),r=k(o)?h(o.job):void 0;i&&!e.has(i)&&e.size<$&&e.set(i,{run:i,...r?{job:r}:{}})}const s=Array.isArray(t.killed)?[...new Set(t.killed.map(h).filter(o=>!!o))].slice(0,$):[];return w({kind:j,context:h(t.context),runs:[...e.values()],why:h(t.why),vmTotalMb:p(t.vmTotalMb),vmAvailableMb:N(t.vmAvailableMb),killed:s.length?s:void 0,host:g(t.host)})}}}m(readDockerError,"readDockerError"),c(readDockerError,"readDockerError");export function dockerErrorRuns(t){return t.kind===v?t.run?[t.run]:[]:t.runs.map(e=>e.run)}m(dockerErrorRuns,"dockerErrorRuns"),c(dockerErrorRuns,"dockerErrorRuns");export function dockerRunOfEvent(t){return k(t)?h(t[B]):void 0}m(dockerRunOfEvent,"dockerRunOfEvent"),c(dockerRunOfEvent,"dockerRunOfEvent");export const CONTAINER_OOM_ERROR="ContainerOOMKilled",DOCKER_ENGINE_LOST_ERROR="DockerEngineLost";const _=256,a=c(t=>`${Math.round(t)} MiB`,"mib");function y(t){const e=`${t.service??"a container"} ran out of memory in ${t.job??"a Docker job"}`,s=`${t.service?`\xAB${t.service}\xBB`:"A container"} ran out of memory and was killed, in ${t.job?`the Docker job \xAB${t.job}\xBB`:"a Docker job"}${t.host?` on the worker \xAB${f(t.host)}\xBB`:""}`,o=t.job?`\`${t.budgetMb!==void 0&&t.service?`jobs.${t.job}.budget.services.${t.service}`:`jobs.${t.job}.budget`}\` in lensmcp.json`:"its job's budget in lensmcp.json \u2192 jobs",{limitMb:i,peakMb:r,budgetMb:n}=t;let l;if(i!==void 0&&n!==void 0){const d=Math.round(i)-Math.round(n);l=d>0?`It was killed at its ${a(i)} limit \u2014 ${a(d)} over the ${a(n)} it declares. Raise ${o} to what it takes (more than ${a(i)}), and the container's memory limit with it.`:d===0?`It was killed at its ${a(i)} limit, which is all it declares. Raise ${o} to what it takes, and the container's memory limit with it.`:`It was killed at its ${a(i)} limit, ${a(-d)} under the ${a(n)} it declares. Raise the container's memory limit to its budget (${o}) \u2014 and both, if it takes more.`}else if(i!==void 0)l=`It was killed at its ${a(i)} limit. Raise the limit, and ${o}, to what it takes.`;else if(r!==void 0&&n!==void 0){const d=Math.round(r)-Math.round(n);l=d>0?`It held ${a(r)} at its peak \u2014 ${a(d)} over the ${a(n)} it declares. Raise ${o} to what it takes, so the queue lets the job in only when Docker's VM has that much.`:`It held ${a(r)} at its peak, within the ${a(n)} it declares (${o}): it was killed at a lower limit of its own, or when Docker's VM ran out. Check its memory limit in the compose file, and what else the VM held.`}else r!==void 0?l=`It held ${a(r)} at its peak. Check ${o} against that, and the container's memory limit.`:n!==void 0?l=`Its peak was not sampled. It declares ${a(n)}: raise ${o} to what it takes, and the container's memory limit with it.`:l=`Raise ${o} to what the service takes, and the container's memory limit with it.`;const u=[i!==void 0?`killed at its ${a(i)} limit`:"killed for memory",r!==void 0?`peak ${a(r)}`:void 0,n!==void 0?`budget ${a(n)}`:void 0,t.run?`run ${t.run}`:void 0,t.seen==="inspect"?"found by the inspect at the run's end":void 0,t.host?`on the worker ${f(t.host)}`:void 0,t.context?`Docker context ${t.context}`:void 0];return{cause:{id:x("cause",[CONTAINER_OOM_ERROR,t.job,t.service]),errorName:CONTAINER_OOM_ERROR,message:e},title:`${CONTAINER_OOM_ERROR}: ${e}`,headline:s,hint:l,facts:u.filter(Boolean).join(" \xB7 "),where:t.job?`Docker job ${t.job}`:"Docker"}}m(y,"A"),c(y,"oomWords");function E(t){const e=t.host?` on the worker ${f(t.host)}`:"",s=`Docker stopped answering${t.context?` (context ${t.context})`:""}${e}`,o=[...new Set(t.runs.map(b=>b.job).filter(b=>!!b))],i=t.runs.length,r=t.host?`Docker on the worker \xAB${f(t.host)}\xBB`:"Docker",n=i===0?`${r} stopped answering while LensMCP ran work in it`:i===1?`${r} stopped answering while ${o[0]?`the job \xAB${o[0]}\xBB`:"a job"} ran: its containers went with it`:`${r} stopped answering while ${i} runs were in it${o.length?` (${o.map(b=>`\xAB${b}\xBB`).join(", ")})`:""}: their containers went with it`,{vmTotalMb:l,vmAvailableMb:u}=t,d=u===void 0?void 0:`${a(u)} free${l!==void 0?` of ${a(l)}`:""}`,M=u===void 0?"If nobody stopped it, its VM most likely ran out of memory: compare the jobs' budgets in lensmcp.json with what Docker's VM has.":u<=_?`Its VM had ${d} when it was last read: it most likely ran out of memory. Let less in at once (the jobs' budgets in lensmcp.json decide), or give Docker's VM more.`:`Its VM had ${d} when it was last read, so memory is not the likely reason: was Docker stopped or restarted?`,A=[i?`${i} run${i===1?"":"s"} lost: ${t.runs.map(b=>`${b.job??"a job"} (run ${b.run})`).join(", ")}`:void 0,t.why,d?`VM ${d}`:void 0,t.killed?.length?`killed for memory before it went: ${t.killed.join(", ")}`:void 0];return{cause:{id:x("cause",t.host?[DOCKER_ENGINE_LOST_ERROR,t.context,t.host.peer]:[DOCKER_ENGINE_LOST_ERROR,t.context]),errorName:DOCKER_ENGINE_LOST_ERROR,message:s},title:`${DOCKER_ENGINE_LOST_ERROR}: ${s}`,headline:n,hint:`Start Docker again${e} and run ${i>1?"the jobs":"the job"} again: a run lost with the engine has no result. ${M}`,facts:A.filter(Boolean).join(" \xB7 "),where:`${t.context?`Docker context ${t.context}`:"Docker"}${e}`}}m(E,"I"),c(E,"engineWords");export function dockerErrorWords(t){return t.kind===v?y(t):E(t)}m(dockerErrorWords,"dockerErrorWords"),c(dockerErrorWords,"dockerErrorWords");export function mergeDockerError(t,e){if(t.kind===v){if(e.kind!==v)return t;const r=Math.max(t.peakMb??0,e.peakMb??0);return w({...e,...t,seen:t.seen==="event"||e.seen==="event"?"event":t.seen??e.seen,peakMb:r>0?r:void 0})}const s=t;if(e.kind===v)return e.service&&!s.killed?.includes(e.service)?{...s,killed:[...s.killed??[],e.service].slice(0,$)}:t;const o=new Map(s.runs.map(r=>[r.run,r]));for(const r of e.runs)(!o.has(r.run)||!o.get(r.run).job&&r.job)&&o.set(r.run,r);const i=[...new Set([...s.killed??[],...e.killed??[]])];return w({...e,...s,runs:[...o.values()].slice(0,$),vmAvailableMb:s.vmAvailableMb!==void 0&&e.vmAvailableMb!==void 0?Math.min(s.vmAvailableMb,e.vmAvailableMb):s.vmAvailableMb??e.vmAvailableMb,killed:i.length?i:void 0})}m(mergeDockerError,"mergeDockerError"),c(mergeDockerError,"mergeDockerError");export const DOCKER_ENGINE_LOSS_SAME_MS=6e4;const D=2e3,C=200;export class DockerErrorLedger{static{m(this,"DockerErrorLedger")}static{c(this,"DockerErrorLedger")}constructor(){this.kills=new Map,this.losses=new Map,this.lostRuns=new Map}account(e,s,o){if(e.kind===j){const l=e.host?`${e.host.peer}\0${e.context??""}`:e.context??"",u=this.losses.get(l),d=u&&Math.abs(o-u.at)<=DOCKER_ENGINE_LOSS_SAME_MS?u.told:void 0;d||this.remember(this.losses,l,{told:s,at:o},C);for(const M of e.runs)this.remember(this.lostRuns,M.run,d??s,D);return d}const i=e.seen!=="inspect",r=e.run&&e.container?`${e.run}\0${e.container}`:e.run&&e.service?`${e.run}\0\0${e.service}`:void 0,n=r?this.kills.get(r):void 0;if(!n){const l=!i&&e.run?this.lostRuns.get(e.run):void 0;if(l)return l;r&&this.remember(this.kills,r,{told:s,live:i?1:0},D);return}if(!i)return n.told;if(n.live===0)return n.live=1,n.told;n.live+=1,n.told=s}remember(e,s,o,i){e.delete(s),e.set(s,o),e.size>i&&e.delete(e.keys().next().value)}}
1
+ "use strict";var O=Object.defineProperty;var m=(e,o)=>O(e,"name",{value:o,configurable:!0});var B=Object.defineProperty,b=m((e,o)=>B(e,"name",{value:o,configurable:!0}),"m"),I=Object.defineProperty,c=b((e,o)=>I(e,"name",{value:o,configurable:!0}),"c");import{CONTAINER_OOM as k,DOCKER_ENGINE_LOST as g,DOCKER_RUN_FIELD as N}from"./docker-jobs.js";import{joinId as E}from"./error-cause.js";const _=200,f=50,$=c(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),h=c(e=>{if(typeof e!="string")return;const o=e.trim();return o?o.slice(0,_):void 0},"name"),p=c(e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,"someMb"),C=c(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,"anyMb"),w=c(e=>Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0)),"defined"),D=c(e=>{if(!$(e))return;const o=h(e.peer);if(!o)return;const n=h(e.name);return n?{peer:o,name:n}:{peer:o}},"hostOf"),M=c(e=>e.name??e.peer,"hostWord");export function readDockerError(e){if($(e)){if(e.kind===k)return w({kind:k,run:h(e.run),job:h(e.job),service:h(e.service),container:h(e.container),seen:e.seen==="event"||e.seen==="inspect"?e.seen:void 0,limitMb:p(e.limitMb),peakMb:p(e.peakMb),budgetMb:p(e.budgetMb),context:h(e.context),host:D(e.host)});if(e.kind===g){const o=new Map;for(const r of Array.isArray(e.runs)?e.runs:[]){const i=$(r)?h(r.run):h(r),t=$(r)?h(r.job):void 0;i&&!o.has(i)&&o.size<f&&o.set(i,{run:i,...t?{job:t}:{}})}const n=Array.isArray(e.killed)?[...new Set(e.killed.map(h).filter(r=>!!r))].slice(0,f):[];return w({kind:g,context:h(e.context),runs:[...o.values()],why:h(e.why),vmTotalMb:p(e.vmTotalMb),vmAvailableMb:C(e.vmAvailableMb),killed:n.length?n:void 0,host:D(e.host)})}}}m(readDockerError,"readDockerError"),b(readDockerError,"readDockerError"),c(readDockerError,"readDockerError");export function dockerErrorRuns(e){return e.kind===k?e.run?[e.run]:[]:e.runs.map(o=>o.run)}m(dockerErrorRuns,"dockerErrorRuns"),b(dockerErrorRuns,"dockerErrorRuns"),c(dockerErrorRuns,"dockerErrorRuns");export function dockerRunOfEvent(e){return $(e)?h(e[N]):void 0}m(dockerRunOfEvent,"dockerRunOfEvent"),b(dockerRunOfEvent,"dockerRunOfEvent"),c(dockerRunOfEvent,"dockerRunOfEvent");export const CONTAINER_OOM_ERROR="ContainerOOMKilled",DOCKER_ENGINE_LOST_ERROR="DockerEngineLost";const L=256,a=c(e=>`${Math.round(e)} MiB`,"mib");function x(e){const o=`${e.service??"a container"} ran out of memory in ${e.job??"a Docker job"}`,n=`${e.service?`\xAB${e.service}\xBB`:"A container"} ran out of memory and was killed, in ${e.job?`the Docker job \xAB${e.job}\xBB`:"a Docker job"}${e.host?` on the worker \xAB${M(e.host)}\xBB`:""}`,r=e.job?`\`${e.budgetMb!==void 0&&e.service?`jobs.${e.job}.budget.services.${e.service}`:`jobs.${e.job}.budget`}\` in lensmcp.json`:"its job's budget in lensmcp.json \u2192 jobs",{limitMb:i,peakMb:t,budgetMb:s}=e;let l;if(i!==void 0&&s!==void 0){const d=Math.round(i)-Math.round(s);l=d>0?`It was killed at its ${a(i)} limit \u2014 ${a(d)} over the ${a(s)} it declares. Raise ${r} to what it takes (more than ${a(i)}), and the container's memory limit with it.`:d===0?`It was killed at its ${a(i)} limit, which is all it declares. Raise ${r} to what it takes, and the container's memory limit with it.`:`It was killed at its ${a(i)} limit, ${a(-d)} under the ${a(s)} it declares. Raise the container's memory limit to its budget (${r}) \u2014 and both, if it takes more.`}else if(i!==void 0)l=`It was killed at its ${a(i)} limit. Raise the limit, and ${r}, to what it takes.`;else if(t!==void 0&&s!==void 0){const d=Math.round(t)-Math.round(s);l=d>0?`It held ${a(t)} at its peak \u2014 ${a(d)} over the ${a(s)} it declares. Raise ${r} to what it takes, so the queue lets the job in only when Docker's VM has that much.`:`It held ${a(t)} at its peak, within the ${a(s)} it declares (${r}): it was killed at a lower limit of its own, or when Docker's VM ran out. Check its memory limit in the compose file, and what else the VM held.`}else t!==void 0?l=`It held ${a(t)} at its peak. Check ${r} against that, and the container's memory limit.`:s!==void 0?l=`Its peak was not sampled. It declares ${a(s)}: raise ${r} to what it takes, and the container's memory limit with it.`:l=`Raise ${r} to what the service takes, and the container's memory limit with it.`;const u=[i!==void 0?`killed at its ${a(i)} limit`:"killed for memory",t!==void 0?`peak ${a(t)}`:void 0,s!==void 0?`budget ${a(s)}`:void 0,e.run?`run ${e.run}`:void 0,e.seen==="inspect"?"found by the inspect at the run's end":void 0,e.host?`on the worker ${M(e.host)}`:void 0,e.context?`Docker context ${e.context}`:void 0];return{cause:{id:E("cause",[CONTAINER_OOM_ERROR,e.job,e.service]),errorName:CONTAINER_OOM_ERROR,message:o},title:`${CONTAINER_OOM_ERROR}: ${o}`,headline:n,hint:l,facts:u.filter(Boolean).join(" \xB7 "),where:e.job?`Docker job ${e.job}`:"Docker"}}m(x,"y"),b(x,"A"),c(x,"oomWords");function y(e){const o=e.host?` on the worker ${M(e.host)}`:"",n=`Docker stopped answering${e.context?` (context ${e.context})`:""}${o}`,r=[...new Set(e.runs.map(v=>v.job).filter(v=>!!v))],i=e.runs.length,t=e.host?`Docker on the worker \xAB${M(e.host)}\xBB`:"Docker",s=i===0?`${t} stopped answering while LensMCP ran work in it`:i===1?`${t} stopped answering while ${r[0]?`the job \xAB${r[0]}\xBB`:"a job"} ran: its containers went with it`:`${t} stopped answering while ${i} runs were in it${r.length?` (${r.map(v=>`\xAB${v}\xBB`).join(", ")})`:""}: their containers went with it`,{vmTotalMb:l,vmAvailableMb:u}=e,d=u===void 0?void 0:`${a(u)} free${l!==void 0?` of ${a(l)}`:""}`,j=u===void 0?"If nobody stopped it, its VM most likely ran out of memory: compare the jobs' budgets in lensmcp.json with what Docker's VM has.":u<=L?`Its VM had ${d} when it was last read: it most likely ran out of memory. Let less in at once (the jobs' budgets in lensmcp.json decide), or give Docker's VM more.`:`Its VM had ${d} when it was last read, so memory is not the likely reason: was Docker stopped or restarted?`,A=[i?`${i} run${i===1?"":"s"} lost: ${e.runs.map(v=>`${v.job??"a job"} (run ${v.run})`).join(", ")}`:void 0,e.why,d?`VM ${d}`:void 0,e.killed?.length?`killed for memory before it went: ${e.killed.join(", ")}`:void 0];return{cause:{id:E("cause",e.host?[DOCKER_ENGINE_LOST_ERROR,e.context,e.host.peer]:[DOCKER_ENGINE_LOST_ERROR,e.context]),errorName:DOCKER_ENGINE_LOST_ERROR,message:n},title:`${DOCKER_ENGINE_LOST_ERROR}: ${n}`,headline:s,hint:`Start Docker again${o} and run ${i>1?"the jobs":"the job"} again: a run lost with the engine has no result. ${j}`,facts:A.filter(Boolean).join(" \xB7 "),where:`${e.context?`Docker context ${e.context}`:"Docker"}${o}`}}m(y,"E"),b(y,"I"),c(y,"engineWords");export function dockerErrorWords(e){return e.kind===k?x(e):y(e)}m(dockerErrorWords,"dockerErrorWords"),b(dockerErrorWords,"dockerErrorWords"),c(dockerErrorWords,"dockerErrorWords");export function mergeDockerError(e,o){if(e.kind===k){if(o.kind!==k)return e;const t=Math.max(e.peakMb??0,o.peakMb??0);return w({...o,...e,seen:e.seen==="event"||o.seen==="event"?"event":e.seen??o.seen,peakMb:t>0?t:void 0})}const n=e;if(o.kind===k)return o.service&&!n.killed?.includes(o.service)?{...n,killed:[...n.killed??[],o.service].slice(0,f)}:e;const r=new Map(n.runs.map(t=>[t.run,t]));for(const t of o.runs)(!r.has(t.run)||!r.get(t.run).job&&t.job)&&r.set(t.run,t);const i=[...new Set([...n.killed??[],...o.killed??[]])];return w({...o,...n,runs:[...r.values()].slice(0,f),vmAvailableMb:n.vmAvailableMb!==void 0&&o.vmAvailableMb!==void 0?Math.min(n.vmAvailableMb,o.vmAvailableMb):n.vmAvailableMb??o.vmAvailableMb,killed:i.length?i:void 0})}m(mergeDockerError,"mergeDockerError"),b(mergeDockerError,"mergeDockerError"),c(mergeDockerError,"mergeDockerError");export const DOCKER_ENGINE_LOSS_SAME_MS=6e4;const R=2e3,S=200;export class DockerErrorLedger{static{m(this,"DockerErrorLedger")}static{b(this,"DockerErrorLedger")}static{c(this,"DockerErrorLedger")}constructor(){this.kills=new Map,this.losses=new Map,this.lostRuns=new Map}account(o,n,r){if(o.kind===g){const l=o.host?`${o.host.peer}\0${o.context??""}`:o.context??"",u=this.losses.get(l),d=u&&Math.abs(r-u.at)<=DOCKER_ENGINE_LOSS_SAME_MS?u.told:void 0;d||this.remember(this.losses,l,{told:n,at:r},S);for(const j of o.runs)this.remember(this.lostRuns,j.run,d??n,R);return d}const i=o.seen!=="inspect",t=o.run&&o.container?`${o.run}\0${o.container}`:o.run&&o.service?`${o.run}\0\0${o.service}`:void 0,s=t?this.kills.get(t):void 0;if(!s){const l=!i&&o.run?this.lostRuns.get(o.run):void 0;if(l)return l;t&&this.remember(this.kills,t,{told:n,live:i?1:0},R);return}if(!i)return s.told;if(s.live===0)return s.live=1,s.told;s.live+=1,s.told=n}remember(o,n,r,i){o.delete(n),o.set(n,r),o.size>i&&o.delete(o.keys().next().value)}}
@@ -1 +1 @@
1
- "use strict";var R=Object.defineProperty;var i=(e,s)=>R(e,"name",{value:s,configurable:!0});var w=Object.defineProperty,n=i((e,s)=>w(e,"name",{value:s,configurable:!0}),"s");export const DOCKER_LABELS={run:"com.lensmcp.run",home:"com.lensmcp.home",job:"com.lensmcp.job",probe:"com.lensmcp.probe"},LENS_JOB_KINDS=["compose","testcontainers","playwright"];export function neverShipped(e){const s=(e.split("/").at(-1)??"").toLowerCase();return s===".env"||s===".env.local"||/^\.env\..+\.local$/.test(s)}i(neverShipped,"neverShipped"),n(neverShipped,"neverShipped");export const jobInputFiles=n(e=>[...new Set(e.inputs?.files??[])].sort(),"jobInputFiles"),jobMintedFiles=n(e=>[...new Set(e.inputs?.minted??[])].sort(),"jobMintedFiles"),DEFAULT_LINK_LOSS_MINUTES=15,jobProblemText=n(e=>e.job===void 0?e.problem:`jobs.${e.job}: ${e.problem}`,"jobProblemText");const M=["kind","lane","prepare","command","cleanup","report","artifacts","inputs","timeoutMinutes","retryable","onLinkLoss","nx","budget"],$={compose:[...M,"compose"],testcontainers:M,playwright:[...M,"stack"]},L={compose:["services","buildMb","hostMb"],testcontainers:["vmMb","hostMb"],playwright:["hostMb","vmMb"]},_=/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/,N=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,k=1024*1024,f=360,b=100,x=4e3,l=n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),E=n(e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=k,"isMb"),I=n(e=>e.map(s=>`"${s}"`).join(", "),"quoted");export function linkLossProblem(e){if(e==="cancel")return;const s=l(e)&&Object.keys(e).length===1?e.continueMinutes:void 0;if(!(typeof s=="number"&&Number.isInteger(s)&&s>=1&&s<=f))return`onLinkLoss is "cancel" or { "continueMinutes": 1 to ${f} }`}i(linkLossProblem,"linkLossProblem"),n(linkLossProblem,"linkLossProblem");export function linkLossMinutes(e,s,t=e.timeoutMinutes){const o=s??e.onLinkLoss??{continueMinutes:DEFAULT_LINK_LOSS_MINUTES};return o==="cancel"?0:Math.min(o.continueMinutes,Math.ceil(t??f))}i(linkLossMinutes,"linkLossMinutes"),n(linkLossMinutes,"linkLossMinutes");function v(e){return typeof e!="string"||!e||e.length>500||/[\0\\]/.test(e)||e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:/.test(e)?!1:!e.split("/").includes("..")}i(v,"y"),n(v,"inTree");function y(e){return Array.isArray(e)&&e.length>=1&&e.length<=b&&e.every(s=>typeof s=="string"&&s.length<=x)&&e[0]!==""}i(y,"k"),n(y,"isArgv");function m(e,s,t,o){const c=Object.keys(e).filter(a=>!s.includes(a));c.length&&o.push(`${t?`${t} has`:"has"} ${c.length===1?"an unknown key":"unknown keys"} ${I(c)}`)}i(m,"m"),n(m,"unknownKeys");function S(e,s,t){e!==void 0&&(!Array.isArray(e)||e.length>b||!e.every(v))&&t.push(`${s} is a list of paths inside the checkout`)}i(S,"$"),n(S,"paths");function j(e,s,t){if(e===void 0)return[];if(!Array.isArray(e)||e.length>b||!e.every(v))return t.push(`${s} is a list of paths inside the checkout`),[];for(const o of e){const c=o.split("/");c.some(a=>a===""||a===".")?t.push(`${s} names ${JSON.stringify(o)}: a file is written as git names it \u2014 a/b.json, with no ./, no // and no trailing /`):c.some(a=>a.toLowerCase()===".git")&&t.push(`${s} names ${JSON.stringify(o)}, which is inside git's own folder`)}return e}i(j,"N"),n(j,"inputPaths");function A(e){if(!l(e))return["is not an object"];const s=e.kind;if(!LENS_JOB_KINDS.includes(s))return[`kind is ${LENS_JOB_KINDS.slice(0,-1).join(", ")} or ${LENS_JOB_KINDS.at(-1)}`];const t=[];m(e,$[s],"",t),e.lane!==void 0&&e.lane!=="light"&&e.lane!=="heavy"&&t.push("lane is light or heavy"),y(e.command)||t.push("command is a program and its arguments, as a list of strings \u2014 not a shell line"),e.cleanup!==void 0&&!y(e.cleanup)&&t.push("cleanup is a program and its arguments, as a list of strings"),e.prepare!==void 0&&!(Array.isArray(e.prepare)&&e.prepare.length<=b&&e.prepare.every(y))&&t.push("prepare is a list of steps, each a program and its arguments"),e.report!==void 0&&!["jest","vitest","playwright"].includes(e.report)&&t.push("report is jest, vitest or playwright"),S(e.artifacts,"artifacts",t),e.timeoutMinutes!==void 0&&!(typeof e.timeoutMinutes=="number"&&e.timeoutMinutes>0&&e.timeoutMinutes<=f)&&t.push(`timeoutMinutes is execution minutes, up to ${f}`),e.retryable!==void 0&&typeof e.retryable!="boolean"&&t.push("retryable is true or false");const o=e.onLinkLoss,c=o===void 0?void 0:linkLossProblem(o);c?t.push(c):l(o)&&typeof e.timeoutMinutes=="number"&&o.continueMinutes>e.timeoutMinutes&&t.push(`onLinkLoss.continueMinutes is past timeoutMinutes (${e.timeoutMinutes}): a run goes on through a dropped link no longer than it may run`),e.nx!==void 0&&!(typeof e.nx=="string"&&/^\S+:[^\s:]+$/.test(e.nx))&&t.push("nx is <project>:<target>");const a=e.inputs;if(a!==void 0)if(!l(a))t.push("inputs is an object of files, minted and secrets");else{m(a,["files","minted","secrets"],"inputs",t);const r=j(a.files,"inputs.files",t),d=j(a.minted,"inputs.minted",t);for(const h of r)neverShipped(h)&&t.push(`inputs.files names ${h}, which is never shipped to another Mac \u2014 declare it in inputs.minted, and make it in a prepare step`);const u=[...new Set(r.filter(h=>d.includes(h)))];u.length&&t.push(`inputs names ${u.join(", ")} in files and in minted: a file is shipped by hash, or made per run on the host that runs it \u2014 not both`);const g=a.secrets;g!==void 0&&!(Array.isArray(g)&&g.length<=b&&g.every(h=>typeof h=="string"&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(h)))&&t.push("inputs.secrets is a list of variable names, never values")}const p=e.budget;if(!l(p))t.push("has no budget: the memory it declares is what it is admitted by");else{m(p,L[s],"budget",t);for(const r of["buildMb","hostMb","vmMb"])L[s].includes(r)&&p[r]!==void 0&&!E(p[r])&&t.push(`budget.${r} is MiB, a whole number from 1 to ${k}`);if(s==="testcontainers"&&(p.vmMb===void 0||p.hostMb===void 0)&&t.push("budget needs vmMb (its containers, in Docker's VM) and hostMb (the test runner, on the host)"),s==="playwright"&&p.vmMb===void 0&&p.hostMb===void 0&&t.push("budget needs hostMb or vmMb: where its browsers run"),s==="compose"){const r=p.services;if(!l(r)||!Object.keys(r).length)t.push("budget.services is each service's expected peak, MiB, by its name in the compose files");else for(const[d,u]of Object.entries(r))N.test(d)?E(u)||t.push(`budget.services.${d} is MiB, a whole number from 1 to ${k}`):t.push(`budget.services has "${d}", which is no service name`)}}if(s==="compose"){const r=e.compose;if(!l(r))t.push("compose is an object of files and edge");else{m(r,["files","edge"],"compose",t);const d=r.files;(!Array.isArray(d)||!d.length||d.length>b||!d.every(v))&&t.push("compose.files is the compose files, as paths inside the checkout");const u=r.edge;u!==void 0&&(!l(u)||typeof u.service!="string"||!N.test(u.service)||!Number.isInteger(u.port)||u.port<1||u.port>65535?t.push('compose.edge is the service and the container port its URL reaches: { "service": "edge", "port": 8443 }'):(m(u,["service","port"],"compose.edge",t),l(p)&&l(p.services)&&!Object.hasOwn(p.services,u.service)&&t.push(`${u.service} has no budget`)))}}return s==="playwright"&&e.stack!==void 0&&!(typeof e.stack=="string"&&_.test(e.stack))&&t.push("stack is the name of a compose job of this file"),t}i(A,"j"),n(A,"jobProblems");export function readLensJobs(e){const s={jobs:{},problems:[]};if(e===void 0)return s;if(!l(e))return s.problems.push({problem:"jobs is an object of jobs by name"}),s;for(const[t,o]of Object.entries(e)){if(!_.test(t)){s.problems.push({job:t,problem:"a job's name is letters, digits, dots, dashes and underscores \u2014 63 at most, the first a letter or a digit"});continue}const c=A(o);c.length?s.problems.push(...c.map(a=>({job:t,problem:a}))):s.jobs[t]=o}for(const[t,o]of Object.entries(s.jobs))o.kind!=="playwright"||o.stack===void 0||s.jobs[o.stack]?.kind!=="compose"&&(s.problems.push({job:t,problem:`stack names "${o.stack}", which is no compose job of this file that may run`}),delete s.jobs[t]);return s}i(readLensJobs,"readLensJobs"),n(readLensJobs,"readLensJobs");const O=n(e=>Object.values(e).reduce((s,t)=>s+t,0),"sum");export function jobVmNeedMb(e,s={}){if(e.kind==="compose")return Math.max(e.budget.buildMb??0,O(e.budget.services));if(e.kind==="testcontainers")return e.budget.vmMb;const t=e.budget.vmMb??0,o=e.stack===void 0?void 0:s[e.stack];return o?.kind==="compose"?Math.max(o.budget.buildMb??0,O(o.budget.services)+t):t}i(jobVmNeedMb,"jobVmNeedMb"),n(jobVmNeedMb,"jobVmNeedMb");export function jobHostNeedMb(e,s={}){const t=e.budget.hostMb??0,o=e.kind==="playwright"&&e.stack!==void 0?s[e.stack]:void 0;return t+(o?.kind==="compose"?o.budget.hostMb??0:0)}i(jobHostNeedMb,"jobHostNeedMb"),n(jobHostNeedMb,"jobHostNeedMb");export function jobLane(e){return e.lane?e.lane:e.kind==="compose"||e.kind==="playwright"&&e.stack!==void 0?"heavy":"light"}i(jobLane,"jobLane"),n(jobLane,"jobLane");export function unbudgetedServices(e,s){return[...new Set(s)].filter(t=>!Object.hasOwn(e.budget.services,t)).sort()}i(unbudgetedServices,"unbudgetedServices"),n(unbudgetedServices,"unbudgetedServices");export const RUN_ID_PATTERN=/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/;export function runShortId(e){const s=e.toLowerCase().replace(/^[a-z]+_/,"").replace(/[^a-z0-9]/g,"").slice(0,8);return s.length===8?s:void 0}i(runShortId,"runShortId"),n(runShortId,"runShortId");export const composeProjectOf=n(e=>`lensmcp-${e}`,"composeProjectOf"),DOCKER_RUN_ENV={id:"LENSMCP_RUN_ID",origin:"LENSMCP_RUN_ORIGIN",artifacts:"LENSMCP_RUN_ARTIFACTS",labels:"LENSMCP_RUN_LABELS",override:"LENSMCP_COMPOSE_OVERRIDE",project:"COMPOSE_PROJECT_NAME"};export function dockerRunLabels(e){return{[DOCKER_LABELS.run]:e.id,[DOCKER_LABELS.home]:e.home,[DOCKER_LABELS.job]:e.job}}i(dockerRunLabels,"dockerRunLabels"),n(dockerRunLabels,"dockerRunLabels");export const runLabelsEnv=n(e=>JSON.stringify(e),"runLabelsEnv");export function jobRunScope(e){return e.kind==="compose"||e.kind==="playwright"&&e.stack!==void 0?"stack":jobVmNeedMb(e)>0?"containers":"none"}i(jobRunScope,"jobRunScope"),n(jobRunScope,"jobRunScope");export const RYUK_DISABLED_ENV="TESTCONTAINERS_RYUK_DISABLED",RYUK_LABEL="org.testcontainers.ryuk";export function ryukWarning(e,s){const t=s[RYUK_DISABLED_ENV];if(!(e.kind!=="testcontainers"||t===void 0||t.trim().toLowerCase()!=="true"))return`${RYUK_DISABLED_ENV}=${t.trim()} is set in the job's environment: testcontainers' own reaper (Ryuk) is off, so a container the suite leaves is removed only where it carries the run's labels \u2014 hand ${DOCKER_RUN_ENV.labels} to every container it starts. One that does not carry them stays in Docker's VM: LensMCP never removes it, and nothing else does.`}i(ryukWarning,"ryukWarning"),n(ryukWarning,"ryukWarning");export const MAX_RUN_ROUTE_SEC=14400,DOCKER_RUN_ENDS=["passed","failed","cancelled","timeout","errored","lost"],dockerRunEnded=n(e=>DOCKER_RUN_ENDS.includes(e),"dockerRunEnded"),MAX_RUN_STRANGERS=20,MAX_RUN_KILLS=100,CONTAINER_OOM="container-oom",DOCKER_ENGINE_LOST="docker-engine-lost",DOCKER_RUN_FIELD="dockerRun";
1
+ "use strict";var w=Object.defineProperty;var i=(e,s)=>w(e,"name",{value:s,configurable:!0});var $=Object.defineProperty,r=i((e,s)=>$(e,"name",{value:s,configurable:!0}),"i"),x=Object.defineProperty,n=r((e,s)=>x(e,"name",{value:s,configurable:!0}),"s");export const DOCKER_LABELS={run:"com.lensmcp.run",home:"com.lensmcp.home",job:"com.lensmcp.job",probe:"com.lensmcp.probe"},LENS_JOB_KINDS=["compose","testcontainers","playwright"];export function neverShipped(e){const s=(e.split("/").at(-1)??"").toLowerCase();return s===".env"||s===".env.local"||/^\.env\..+\.local$/.test(s)}i(neverShipped,"neverShipped"),r(neverShipped,"neverShipped"),n(neverShipped,"neverShipped");export const jobInputFiles=n(e=>[...new Set(e.inputs?.files??[])].sort(),"jobInputFiles"),jobMintedFiles=n(e=>[...new Set(e.inputs?.minted??[])].sort(),"jobMintedFiles"),DEFAULT_LINK_LOSS_MINUTES=15,jobProblemText=n(e=>e.job===void 0?e.problem:`jobs.${e.job}: ${e.problem}`,"jobProblemText");const j=["kind","lane","prepare","command","cleanup","report","artifacts","inputs","timeoutMinutes","retryable","onLinkLoss","nx","budget"],I={compose:[...j,"compose"],testcontainers:j,playwright:[...j,"stack"]},S={compose:["services","buildMb","hostMb"],testcontainers:["vmMb","hostMb"],playwright:["hostMb","vmMb"]},E=/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/,R=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,L=1024*1024,g=360,f=100,C=4e3,l=n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),A=n(e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=L,"isMb"),P=n(e=>e.map(s=>`"${s}"`).join(", "),"quoted");export function linkLossProblem(e){if(e==="cancel")return;const s=l(e)&&Object.keys(e).length===1?e.continueMinutes:void 0;if(!(typeof s=="number"&&Number.isInteger(s)&&s>=1&&s<=g))return`onLinkLoss is "cancel" or { "continueMinutes": 1 to ${g} }`}i(linkLossProblem,"linkLossProblem"),r(linkLossProblem,"linkLossProblem"),n(linkLossProblem,"linkLossProblem");export function linkLossMinutes(e,s,t=e.timeoutMinutes){const o=s??e.onLinkLoss??{continueMinutes:DEFAULT_LINK_LOSS_MINUTES};return o==="cancel"?0:Math.min(o.continueMinutes,Math.ceil(t??g))}i(linkLossMinutes,"linkLossMinutes"),r(linkLossMinutes,"linkLossMinutes"),n(linkLossMinutes,"linkLossMinutes");function v(e){return typeof e!="string"||!e||e.length>500||/[\0\\]/.test(e)||e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:/.test(e)?!1:!e.split("/").includes("..")}i(v,"v"),r(v,"y"),n(v,"inTree");function y(e){return Array.isArray(e)&&e.length>=1&&e.length<=f&&e.every(s=>typeof s=="string"&&s.length<=C)&&e[0]!==""}i(y,"y"),r(y,"k"),n(y,"isArgv");function m(e,s,t,o){const p=Object.keys(e).filter(u=>!s.includes(u));p.length&&o.push(`${t?`${t} has`:"has"} ${p.length===1?"an unknown key":"unknown keys"} ${P(p)}`)}i(m,"m"),r(m,"m"),n(m,"unknownKeys");function _(e,s,t){e!==void 0&&(!Array.isArray(e)||e.length>f||!e.every(v))&&t.push(`${s} is a list of paths inside the checkout`)}i(_,"S"),r(_,"$"),n(_,"paths");function k(e,s,t){if(e===void 0)return[];if(!Array.isArray(e)||e.length>f||!e.every(v))return t.push(`${s} is a list of paths inside the checkout`),[];for(const o of e){const p=o.split("/");p.some(u=>u===""||u===".")?t.push(`${s} names ${JSON.stringify(o)}: a file is written as git names it \u2014 a/b.json, with no ./, no // and no trailing /`):p.some(u=>u.toLowerCase()===".git")&&t.push(`${s} names ${JSON.stringify(o)}, which is inside git's own folder`)}return e}i(k,"j"),r(k,"N"),n(k,"inputPaths");function N(e){if(!l(e))return["is not an object"];const s=e.kind;if(!LENS_JOB_KINDS.includes(s))return[`kind is ${LENS_JOB_KINDS.slice(0,-1).join(", ")} or ${LENS_JOB_KINDS.at(-1)}`];const t=[];m(e,I[s],"",t),e.lane!==void 0&&e.lane!=="light"&&e.lane!=="heavy"&&t.push("lane is light or heavy"),y(e.command)||t.push("command is a program and its arguments, as a list of strings \u2014 not a shell line"),e.cleanup!==void 0&&!y(e.cleanup)&&t.push("cleanup is a program and its arguments, as a list of strings"),e.prepare!==void 0&&!(Array.isArray(e.prepare)&&e.prepare.length<=f&&e.prepare.every(y))&&t.push("prepare is a list of steps, each a program and its arguments"),e.report!==void 0&&!["jest","vitest","playwright"].includes(e.report)&&t.push("report is jest, vitest or playwright"),_(e.artifacts,"artifacts",t),e.timeoutMinutes!==void 0&&!(typeof e.timeoutMinutes=="number"&&e.timeoutMinutes>0&&e.timeoutMinutes<=g)&&t.push(`timeoutMinutes is execution minutes, up to ${g}`),e.retryable!==void 0&&typeof e.retryable!="boolean"&&t.push("retryable is true or false");const o=e.onLinkLoss,p=o===void 0?void 0:linkLossProblem(o);p?t.push(p):l(o)&&typeof e.timeoutMinutes=="number"&&o.continueMinutes>e.timeoutMinutes&&t.push(`onLinkLoss.continueMinutes is past timeoutMinutes (${e.timeoutMinutes}): a run goes on through a dropped link no longer than it may run`),e.nx!==void 0&&!(typeof e.nx=="string"&&/^\S+:[^\s:]+$/.test(e.nx))&&t.push("nx is <project>:<target>");const u=e.inputs;if(u!==void 0)if(!l(u))t.push("inputs is an object of files, minted and secrets");else{m(u,["files","minted","secrets"],"inputs",t);const a=k(u.files,"inputs.files",t),b=k(u.minted,"inputs.minted",t);for(const h of a)neverShipped(h)&&t.push(`inputs.files names ${h}, which is never shipped to another Mac \u2014 declare it in inputs.minted, and make it in a prepare step`);const c=[...new Set(a.filter(h=>b.includes(h)))];c.length&&t.push(`inputs names ${c.join(", ")} in files and in minted: a file is shipped by hash, or made per run on the host that runs it \u2014 not both`);const M=u.secrets;M!==void 0&&!(Array.isArray(M)&&M.length<=f&&M.every(h=>typeof h=="string"&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(h)))&&t.push("inputs.secrets is a list of variable names, never values")}const d=e.budget;if(!l(d))t.push("has no budget: the memory it declares is what it is admitted by");else{m(d,S[s],"budget",t);for(const a of["buildMb","hostMb","vmMb"])S[s].includes(a)&&d[a]!==void 0&&!A(d[a])&&t.push(`budget.${a} is MiB, a whole number from 1 to ${L}`);if(s==="testcontainers"&&(d.vmMb===void 0||d.hostMb===void 0)&&t.push("budget needs vmMb (its containers, in Docker's VM) and hostMb (the test runner, on the host)"),s==="playwright"&&d.vmMb===void 0&&d.hostMb===void 0&&t.push("budget needs hostMb or vmMb: where its browsers run"),s==="compose"){const a=d.services;if(!l(a)||!Object.keys(a).length)t.push("budget.services is each service's expected peak, MiB, by its name in the compose files");else for(const[b,c]of Object.entries(a))R.test(b)?A(c)||t.push(`budget.services.${b} is MiB, a whole number from 1 to ${L}`):t.push(`budget.services has "${b}", which is no service name`)}}if(s==="compose"){const a=e.compose;if(!l(a))t.push("compose is an object of files and edge");else{m(a,["files","edge"],"compose",t);const b=a.files;(!Array.isArray(b)||!b.length||b.length>f||!b.every(v))&&t.push("compose.files is the compose files, as paths inside the checkout");const c=a.edge;c!==void 0&&(!l(c)||typeof c.service!="string"||!R.test(c.service)||!Number.isInteger(c.port)||c.port<1||c.port>65535?t.push('compose.edge is the service and the container port its URL reaches: { "service": "edge", "port": 8443 }'):(m(c,["service","port"],"compose.edge",t),l(d)&&l(d.services)&&!Object.hasOwn(d.services,c.service)&&t.push(`${c.service} has no budget`)))}}return s==="playwright"&&e.stack!==void 0&&!(typeof e.stack=="string"&&E.test(e.stack))&&t.push("stack is the name of a compose job of this file"),t}i(N,"A"),r(N,"j"),n(N,"jobProblems");export function readLensJobs(e){const s={jobs:{},problems:[]};if(e===void 0)return s;if(!l(e))return s.problems.push({problem:"jobs is an object of jobs by name"}),s;for(const[t,o]of Object.entries(e)){if(!E.test(t)){s.problems.push({job:t,problem:"a job's name is letters, digits, dots, dashes and underscores \u2014 63 at most, the first a letter or a digit"});continue}const p=N(o);p.length?s.problems.push(...p.map(u=>({job:t,problem:u}))):s.jobs[t]=o}for(const[t,o]of Object.entries(s.jobs))o.kind!=="playwright"||o.stack===void 0||s.jobs[o.stack]?.kind!=="compose"&&(s.problems.push({job:t,problem:`stack names "${o.stack}", which is no compose job of this file that may run`}),delete s.jobs[t]);return s}i(readLensJobs,"readLensJobs"),r(readLensJobs,"readLensJobs"),n(readLensJobs,"readLensJobs");const O=n(e=>Object.values(e).reduce((s,t)=>s+t,0),"sum");export function jobVmNeedMb(e,s={}){if(e.kind==="compose")return Math.max(e.budget.buildMb??0,O(e.budget.services));if(e.kind==="testcontainers")return e.budget.vmMb;const t=e.budget.vmMb??0,o=e.stack===void 0?void 0:s[e.stack];return o?.kind==="compose"?Math.max(o.budget.buildMb??0,O(o.budget.services)+t):t}i(jobVmNeedMb,"jobVmNeedMb"),r(jobVmNeedMb,"jobVmNeedMb"),n(jobVmNeedMb,"jobVmNeedMb");export function jobHostNeedMb(e,s={}){const t=e.budget.hostMb??0,o=e.kind==="playwright"&&e.stack!==void 0?s[e.stack]:void 0;return t+(o?.kind==="compose"?o.budget.hostMb??0:0)}i(jobHostNeedMb,"jobHostNeedMb"),r(jobHostNeedMb,"jobHostNeedMb"),n(jobHostNeedMb,"jobHostNeedMb");export function jobLane(e){return e.lane?e.lane:e.kind==="compose"||e.kind==="playwright"&&e.stack!==void 0?"heavy":"light"}i(jobLane,"jobLane"),r(jobLane,"jobLane"),n(jobLane,"jobLane");export function unbudgetedServices(e,s){return[...new Set(s)].filter(t=>!Object.hasOwn(e.budget.services,t)).sort()}i(unbudgetedServices,"unbudgetedServices"),r(unbudgetedServices,"unbudgetedServices"),n(unbudgetedServices,"unbudgetedServices");export const RUN_ID_PATTERN=/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/;export function runShortId(e){const s=e.toLowerCase().replace(/^[a-z]+_/,"").replace(/[^a-z0-9]/g,"").slice(0,8);return s.length===8?s:void 0}i(runShortId,"runShortId"),r(runShortId,"runShortId"),n(runShortId,"runShortId");export const composeProjectOf=n(e=>`lensmcp-${e}`,"composeProjectOf"),DOCKER_RUN_ENV={id:"LENSMCP_RUN_ID",origin:"LENSMCP_RUN_ORIGIN",artifacts:"LENSMCP_RUN_ARTIFACTS",labels:"LENSMCP_RUN_LABELS",override:"LENSMCP_COMPOSE_OVERRIDE",project:"COMPOSE_PROJECT_NAME"};export function dockerRunLabels(e){return{[DOCKER_LABELS.run]:e.id,[DOCKER_LABELS.home]:e.home,[DOCKER_LABELS.job]:e.job}}i(dockerRunLabels,"dockerRunLabels"),r(dockerRunLabels,"dockerRunLabels"),n(dockerRunLabels,"dockerRunLabels");export const runLabelsEnv=n(e=>JSON.stringify(e),"runLabelsEnv");export function jobRunScope(e){return e.kind==="compose"||e.kind==="playwright"&&e.stack!==void 0?"stack":jobVmNeedMb(e)>0?"containers":"none"}i(jobRunScope,"jobRunScope"),r(jobRunScope,"jobRunScope"),n(jobRunScope,"jobRunScope");export const RYUK_DISABLED_ENV="TESTCONTAINERS_RYUK_DISABLED",RYUK_LABEL="org.testcontainers.ryuk";export function ryukWarning(e,s){const t=s[RYUK_DISABLED_ENV];if(!(e.kind!=="testcontainers"||t===void 0||t.trim().toLowerCase()!=="true"))return`${RYUK_DISABLED_ENV}=${t.trim()} is set in the job's environment: testcontainers' own reaper (Ryuk) is off, so a container the suite leaves is removed only where it carries the run's labels \u2014 hand ${DOCKER_RUN_ENV.labels} to every container it starts. One that does not carry them stays in Docker's VM: LensMCP never removes it, and nothing else does.`}i(ryukWarning,"ryukWarning"),r(ryukWarning,"ryukWarning"),n(ryukWarning,"ryukWarning");export const MAX_RUN_ROUTE_SEC=14400,DOCKER_RUN_ENDS=["passed","failed","cancelled","timeout","errored","lost"],dockerRunEnded=n(e=>DOCKER_RUN_ENDS.includes(e),"dockerRunEnded"),MAX_RUN_STRANGERS=20,MAX_RUN_KILLS=100,CONTAINER_OOM="container-oom",DOCKER_ENGINE_LOST="docker-engine-lost",DOCKER_RUN_FIELD="dockerRun";