@lensmcp/protocol-types 1.26.2 → 1.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +13 -1
- package/index.js +1 -1
- package/lib/ai-call-groups.js +2 -2
- package/lib/ai-call-row.js +3 -3
- package/lib/ai-call.js +9 -9
- package/lib/ai-context.js +6 -6
- package/lib/ai-origins.js +9 -9
- package/lib/bounded-clone.js +1 -1
- package/lib/bounded-map.js +1 -1
- package/lib/bounded-writer.js +1 -1
- package/lib/capture-demand.js +1 -1
- package/lib/changes.d.ts +15 -3
- package/lib/cluster-hosts.d.ts +272 -0
- package/lib/cluster-hosts.js +1 -0
- package/lib/dashboard-lint.d.ts +22 -0
- package/lib/dashboard-path.js +1 -1
- package/lib/dashboard-updates.d.ts +80 -0
- package/lib/dashboard-updates.js +1 -0
- package/lib/dashboard.d.ts +8 -1
- package/lib/docker-errors.d.ts +123 -0
- package/lib/docker-errors.js +1 -0
- package/lib/docker-jobs.d.ts +673 -0
- package/lib/docker-jobs.js +1 -0
- package/lib/docker-report.d.ts +99 -0
- package/lib/docker-report.js +2 -0
- package/lib/docker-runs.d.ts +300 -0
- package/lib/docker-runs.js +3 -0
- package/lib/error-cause.js +5 -5
- package/lib/error-dismissal.js +1 -1
- package/lib/event-loop.js +1 -1
- package/lib/expected-failure.js +2 -2
- package/lib/flood-guard.js +1 -1
- package/lib/goal-design.js +1 -1
- package/lib/host-agents.d.ts +139 -0
- package/lib/host-agents.js +1 -0
- package/lib/hosts.d.ts +206 -0
- package/lib/hosts.js +1 -0
- package/lib/lint-coverage.js +1 -1
- package/lib/log-query.js +1 -1
- package/lib/main-mirror.d.ts +117 -0
- package/lib/main-mirror.js +1 -0
- package/lib/metrics-reset.js +1 -1
- package/lib/overseer-findings.js +1 -1
- package/lib/peers.d.ts +1881 -0
- package/lib/peers.js +1 -0
- package/lib/perf-rules.js +1 -1
- package/lib/pod-memory.js +1 -1
- package/lib/producer-health.js +1 -1
- package/lib/proof.d.ts +32 -0
- package/lib/remote-instances.d.ts +129 -0
- package/lib/remote-instances.js +1 -0
- package/lib/resources.d.ts +2 -0
- package/lib/resources.js +1 -1
- package/lib/sources.js +1 -1
- package/lib/static-checks.d.ts +290 -0
- package/lib/static-checks.js +1 -0
- package/lib/system-report.js +1 -1
- package/lib/team-delivery.d.ts +13 -0
- package/lib/team.d.ts +60 -2
- package/lib/team.js +1 -1
- package/lib/workspace-actions.d.ts +104 -1
- package/lib/workspace-actions.js +1 -1
- package/package.json +1 -1
package/lib/bounded-clone.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var
|
|
1
|
+
"use strict";var T=Object.defineProperty;var c=(t,e)=>T(t,"name",{value:e,configurable:!0});var h=Object.defineProperty,l=c((t,e)=>h(t,"name",{value:e,configurable:!0}),"i"),_=Object.defineProperty,y=l((t,e)=>_(t,"name",{value:e,configurable:!0}),"_");export const DEFAULT_RAW_BYTE_LIMIT=32768,DEFAULT_MAX_STRING_BYTES=4096,DEFAULT_MAX_ARRAY_ITEMS=64,DEFAULT_MAX_DEPTH=12,CHEAP_ENTRY_BYTES=512,NOMINAL_DEEP_BYTES=32,DEEP_REPORT_DEPTH=64,SKELETON_STRING_BYTES=256,MAX_RECORDED_PATHS=20,TRUNCATION_MARKER_KEY="__lensmcpTruncation",TRUNCATED_VALUE_KEY="__lensmcpTruncated";export function estimateJsonBytes(t,e=Number.POSITIVE_INFINITY,n=12){return g(t,e,n,32)}c(estimateJsonBytes,"estimateJsonBytes"),l(estimateJsonBytes,"estimateJsonBytes"),y(estimateJsonBytes,"estimateJsonBytes");export function exceedsJsonByteBudget(t,e,n=12){return g(t,e,n,Number.POSITIVE_INFINITY)>e}c(exceedsJsonByteBudget,"exceedsJsonByteBudget"),l(exceedsJsonByteBudget,"exceedsJsonByteBudget"),y(exceedsJsonByteBudget,"exceedsJsonByteBudget");function g(t,e,n,a){switch(typeof t){case"undefined":case"function":case"symbol":return 0;case"boolean":return 5;case"number":return Number.isFinite(t)?8:4;case"bigint":return 20;case"string":return t.length+2;default:break}if(t===null)return 4;if(n<=0)return a;if(t instanceof Date)return 26;if(Array.isArray(t)){let r=2;for(let u=0;u<t.length;u++)if(r+=g(t[u],e-r,n-1,a)+1,r>e)return r;return r}let s=2;const o=t;for(const r in o){if(!Object.prototype.hasOwnProperty.call(o,r))continue;const u=g(o[r],e-s,n-1,a);if(u!==0&&(s+=r.length+4+u,s>e))return s}return s}c(g,"y"),l(g,"T"),y(g,"walk");function f(t,e){t.truncatedAnything=!0,t.paths.length<20&&t.paths.push(e||"<root>")}c(f,"g"),l(f,"A"),y(f,"record");function p(t,e,n){return f(t,n),{[TRUNCATED_VALUE_KEY]:!0,originalBytes:estimateJsonBytes(e,Number.POSITIVE_INFINITY,64)}}c(p,"f"),l(p,"I"),y(p,"stub");function m(t){if(t===null)return!0;const e=typeof t;return e==="number"||e==="boolean"||e==="string"||e==="bigint"}c(m,"p"),l(m,"y"),y(m,"isScalar");export function clampValue(t,e,n,a){if(typeof t=="string"){const s=e.budget<=0?256:e.maxStringBytes;if(t.length+2<=s)return e.budget-=t.length+2,t;const o=Math.max(0,s-64);return f(e,a),e.budget-=o,`${t.slice(0,o)}\u2026[lensmcp truncated: ${t.length-o} more chars]`}return t===null||typeof t!="object"?(e.budget-=g(t,Number.POSITIVE_INFINITY,1,32),t):n<=0?p(e,t,a):t instanceof Date?(e.budget-=26,t):Array.isArray(t)?b(t,e,n,a):d(t,e,n,a)}c(clampValue,"clampValue"),l(clampValue,"clampValue"),y(clampValue,"clampValue");function b(t,e,n,a){const s=[],o=Math.min(t.length,e.maxArrayItems);for(let r=0;r<o&&!(e.budget<=0);r++)s.push(clampValue(t[r],e,n-1,`${a}[${r}]`));return s.length<t.length&&f(e,`${a}[] (+${t.length-s.length} items dropped)`),s}c(b,"m"),l(b,"f"),y(b,"clampArray");function d(t,e,n,a){const s={};let o;const r=e.budget<=0;for(const u in t){if(!Object.prototype.hasOwnProperty.call(t,u))continue;const i=t[u],I=g(i,512,n-1,Number.POSITIVE_INFINITY);if(I<=512&&(!r||m(i))){s[u]=i,e.budget-=u.length+4+I;continue}(o??=[]).push({key:u,bytes:I})}if(!o)return s;o.sort((u,i)=>u.bytes===i.bytes?0:u.bytes<i.bytes?-1:1);for(const{key:u}of o){const i=a?`${a}.${u}`:u;s[u]=clampValue(t[u],e,n-1,i)}return s}c(d,"b"),l(d,"m"),y(d,"clampObject");export function boundedClone(t,e={}){const n=e.rawByteLimit??32768,a=e.maxDepth??12;if(n<=0)return{value:void 0,truncated:!1,originalBytes:0,keptBytes:0,paths:[]};if(t==null)return{value:t,truncated:!1,originalBytes:0,keptBytes:0,paths:[]};if(!exceedsJsonByteBudget(t,n,a)){const i=estimateJsonBytes(t,n,a),I={budget:n,maxStringBytes:e.maxStringBytes??4096,maxArrayItems:e.maxArrayItems??64,paths:[],truncatedAnything:!1};return{value:clampValue(t,I,a,""),truncated:!1,originalBytes:i,keptBytes:i,paths:[]}}const s=estimateJsonBytes(t,Number.POSITIVE_INFINITY,64),o={budget:n,maxStringBytes:e.maxStringBytes??4096,maxArrayItems:e.maxArrayItems??64,paths:[],truncatedAnything:!1},r=clampValue(t,o,a,""),u=estimateJsonBytes(r,Number.POSITIVE_INFINITY,a);if(o.truncatedAnything&&r!==null&&typeof r=="object"&&!Array.isArray(r)){const i={truncated:!0,originalBytes:s,keptBytes:u,paths:o.paths};r[TRUNCATION_MARKER_KEY]=i}return{value:r,truncated:o.truncatedAnything,originalBytes:s,keptBytes:u,paths:o.paths}}c(boundedClone,"boundedClone"),l(boundedClone,"boundedClone"),y(boundedClone,"boundedClone");
|
package/lib/bounded-map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var t=(e,a)=>i(e,"name",{value:a,configurable:!0});var p=Object.defineProperty,o=t((e,a)=>p(e,"name",{value:a,configurable:!0}),"t"),s=Object.defineProperty,u=o((e,a)=>s(e,"name",{value:a,configurable:!0}),"o");export function capMap(e,a){if(e.size<=a)return 0;let r=0;const c=e.keys();for(;e.size>a;){const n=c.next();if(n.done)break;e.delete(n.value)&&(r+=1)}return r}t(capMap,"capMap"),o(capMap,"capMap"),u(capMap,"capMap");export const MAX_PRODUCER_KEYS=256;
|
package/lib/bounded-writer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var r=(t,e)=>m(t,"name",{value:e,configurable:!0});var f=Object.defineProperty,o=r((t,e)=>f(t,"name",{value:e,configurable:!0}),"r"),x=Object.defineProperty,s=o((t,e)=>x(t,"name",{value:e,configurable:!0}),"c");import{renameSync as v,statSync as M,unlinkSync as E}from"node:fs";export function eventMaxBytes(t=process.env){const e=Number(t.LENSMCP_EVENT_MAX_BYTES);return Number.isFinite(e)&&e>0?e:50*1024*1024}r(eventMaxBytes,"eventMaxBytes"),o(eventMaxBytes,"eventMaxBytes"),s(eventMaxBytes,"eventMaxBytes");export function eventMaxFiles(t=process.env){const e=Number(t.LENSMCP_EVENT_MAX_FILES);return Number.isFinite(e)&&e>=1&&e<=20?Math.floor(e):5}r(eventMaxFiles,"eventMaxFiles"),o(eventMaxFiles,"eventMaxFiles"),s(eventMaxFiles,"eventMaxFiles");const b=1024*1024,a=new Map;export function maybeRotateEventFile(t,e,c){const i=(a.get(t)??0)+e,l=c?.maxBytes??eventMaxBytes(),u=c?.maxFiles??eventMaxFiles(),y=Math.min(b,l);if(i<y){a.set(t,i);return}try{const n=M(t).size;if(a.set(t,0),n<=l)return}catch{a.set(t,i);return}try{E(`${t}.${u}`)}catch{}for(let n=u-1;n>=1;n--)try{v(`${t}.${n}`,`${t}.${n+1}`)}catch{}try{v(t,`${t}.1`)}catch{}}r(maybeRotateEventFile,"maybeRotateEventFile"),o(maybeRotateEventFile,"maybeRotateEventFile"),s(maybeRotateEventFile,"maybeRotateEventFile");export function resetRotationThrottle(t){t===void 0?a.clear():a.delete(t)}r(resetRotationThrottle,"resetRotationThrottle"),o(resetRotationThrottle,"resetRotationThrottle"),s(resetRotationThrottle,"resetRotationThrottle");
|
package/lib/capture-demand.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var a=(r,e)=>s(r,"name",{value:e,configurable:!0});var p=Object.defineProperty,c=a((r,e)=>p(r,"name",{value:e,configurable:!0}),"o"),u=Object.defineProperty,E=c((r,e)=>u(r,"name",{value:e,configurable:!0}),"s");export const CAPTURE_REQUEST_FILENAME="capture-request.json",CAPTURE_PRESENCE_FILENAME="capture-runner.json";export function appMatchesPage(r,e){const t=r.trim().toLowerCase();if(!t)return!1;if(e.project&&e.project.toLowerCase()===t)return!0;const o=e.url.toLowerCase();if(o===t||o.replace(/\/+$/,"")===t.replace(/\/+$/,""))return!0;try{const n=new URL(e.url);return/^\d+$/.test(t)?n.port===t:n.origin.toLowerCase()===t.replace(/\/+$/,"")}catch{return!1}}a(appMatchesPage,"appMatchesPage"),c(appMatchesPage,"appMatchesPage"),E(appMatchesPage,"appMatchesPage");export const CAPTURE_RULES_FILENAME="capture-rules.json";
|
package/lib/changes.d.ts
CHANGED
|
@@ -62,6 +62,14 @@ export interface DashChangesCheckout {
|
|
|
62
62
|
missing?: true;
|
|
63
63
|
/** Git could not read it; what it said. */
|
|
64
64
|
error?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The Mac it is on, when not this one (overseer-74 D30): a goal placed on a worker — its checkout read there, through
|
|
67
|
+
* the channel. Its folder is the worker's and is never named here.
|
|
68
|
+
*/
|
|
69
|
+
host?: {
|
|
70
|
+
peer: string;
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
65
73
|
}
|
|
66
74
|
export interface DashChanges {
|
|
67
75
|
at: number;
|
|
@@ -168,11 +176,15 @@ export type DashChangesCommitRequest = {
|
|
|
168
176
|
message: string;
|
|
169
177
|
paths: string[];
|
|
170
178
|
};
|
|
171
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* What a write on the Changes page did. Main on a worker (planning/docker § 14, slice D34) adds `bring-in` (the
|
|
181
|
+
* organizer brings a worker's sent commits into main), `update-main` («Update from main» on a worker's main) and
|
|
182
|
+
* `send-main` (a worker sends its main's commits), and the outcomes they end with.
|
|
183
|
+
*/
|
|
172
184
|
export interface DashChangesActed {
|
|
173
185
|
key: string;
|
|
174
|
-
action: 'commit' | 'push' | 'update';
|
|
175
|
-
outcome: 'committed' | 'pushed' | 'merged' | 'current' | 'conflicts' | 'asked';
|
|
186
|
+
action: 'commit' | 'push' | 'update' | 'bring-in' | 'update-main' | 'send-main';
|
|
187
|
+
outcome: 'committed' | 'pushed' | 'merged' | 'current' | 'conflicts' | 'asked' | 'brought-in' | 'waiting' | 'not-ff' | 'fast-forward' | 'queued' | 'refused';
|
|
176
188
|
/** One sentence for the person. */
|
|
177
189
|
said: string;
|
|
178
190
|
/** The commit a commit or a merge made. */
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import type { DockerVmRead } from './docker-jobs.js';
|
|
2
|
+
import type { HostAgentsView } from './host-agents.js';
|
|
3
|
+
import type { HostLinkView, HostVersionView } from './hosts.js';
|
|
4
|
+
/**
|
|
5
|
+
* CLUSTER › HOSTS — what the dashboard's `GET /api/cluster/hosts` answers (planning/docker/00-plan.md § 11 «The
|
|
6
|
+
* dashboard», slice D23; issues/open/overseer-74): every host placement places on — this Mac first, then each paired
|
|
7
|
+
* worker — with its memory and Docker's VM as it last said them, what its machine queue runs and holds waiting, and the
|
|
8
|
+
* runs this Mac placed there; the jobs waiting at the organizer for a host, with each host's reason; and the
|
|
9
|
+
* placement's decisions, the newest first. Settings › Hosts (slice D19) pairs and revokes; this page only reads.
|
|
10
|
+
*
|
|
11
|
+
* READ ONLY, AND CHEAP: one request reads the files once — `workers.json`, `links.json`, `hub.json`, `placement.db`,
|
|
12
|
+
* `placements.jsonl`, the machine queue's `admission.db`, D16's index of the runs on workers — and writes none. Docker
|
|
13
|
+
* is asked nothing: a worker's VM is its last capacity advert's; this Mac's is the last reading the dashboard holds
|
|
14
|
+
* (Cluster › Docker's) or the last placement decision's, whichever is newer — each said with when it was taken.
|
|
15
|
+
*
|
|
16
|
+
* Every time here is THIS Mac's clock. A worker's queue times, which its advert gives by its own clock, are moved by
|
|
17
|
+
* that clock's offset as it was last heard (placement does the same).
|
|
18
|
+
*/
|
|
19
|
+
export type ClusterLane = 'heavy' | 'light';
|
|
20
|
+
/** One entry of a host's machine queue: a run, or a job waiting there. */
|
|
21
|
+
export interface ClusterQueueEntry {
|
|
22
|
+
state: 'running' | 'waiting';
|
|
23
|
+
lane: ClusterLane;
|
|
24
|
+
label: string;
|
|
25
|
+
/** Its run (`q_…`, `wa_…`) — on a worker, a job this Mac placed there is named by its run's id on the channel. */
|
|
26
|
+
ref: string;
|
|
27
|
+
/** 0 first, 2 last — before ageing. */
|
|
28
|
+
priority: number;
|
|
29
|
+
enqueuedAt: number;
|
|
30
|
+
startedAt?: number;
|
|
31
|
+
/** The host memory it waits for, or was let in by, MiB. */
|
|
32
|
+
needMb: number;
|
|
33
|
+
/** A Docker job's: its budget in the VM, and what its containers hold of it now (none: not sampled). */
|
|
34
|
+
vmMb?: number;
|
|
35
|
+
usedMb?: number;
|
|
36
|
+
/** It runs, or waits to run, alone on its machine. */
|
|
37
|
+
exclusive?: true;
|
|
38
|
+
/** A waiter's own reason, as it last judged it — this Mac's queue alone: a worker's advert carries none. */
|
|
39
|
+
why?: string;
|
|
40
|
+
/** The waiter waits on Docker: memory in its VM, or an engine that does not answer. */
|
|
41
|
+
waitsOnDocker?: true;
|
|
42
|
+
}
|
|
43
|
+
/** A host's machine queue — its own: placement proposes, this queue admits. */
|
|
44
|
+
export interface ClusterQueue {
|
|
45
|
+
running: ClusterQueueEntry[];
|
|
46
|
+
waiting: ClusterQueueEntry[];
|
|
47
|
+
/** An older LensMCP's runner holds the heavy lane. */
|
|
48
|
+
legacy?: true;
|
|
49
|
+
/** What the queue keeps free and runs at once (its `queue-config.json`). */
|
|
50
|
+
limits: {
|
|
51
|
+
reserveMb: number;
|
|
52
|
+
dockerReserveMb: number;
|
|
53
|
+
heavyMax: number;
|
|
54
|
+
lightMax: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** The containers LensMCP did not start in a host's VM. */
|
|
58
|
+
export interface ClusterVmOthers {
|
|
59
|
+
/** What they hold together, MiB — none: not read. */
|
|
60
|
+
mb?: number;
|
|
61
|
+
count: number;
|
|
62
|
+
/** The largest first. */
|
|
63
|
+
containers: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
mb?: number;
|
|
66
|
+
}>;
|
|
67
|
+
/** Past the ones listed. */
|
|
68
|
+
more?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Docker's VM on a host, as it was last read there — or why it gave no figure. `from`: `advert` — the worker's last
|
|
72
|
+
* capacity advert (its own probe); `docker-page` — the reading Cluster › Docker last had taken on this Mac (an
|
|
73
|
+
* estimate by design: the page starts no container); `placement` — this Mac's VM as the last placement decision read
|
|
74
|
+
* it (admission's own reading). `at`: when it was taken, by this Mac's clock.
|
|
75
|
+
*/
|
|
76
|
+
export type ClusterVm = {
|
|
77
|
+
ok: true;
|
|
78
|
+
from: 'advert' | 'docker-page' | 'placement';
|
|
79
|
+
at: number;
|
|
80
|
+
context?: string;
|
|
81
|
+
version?: string;
|
|
82
|
+
totalMb: number;
|
|
83
|
+
availableMb: number;
|
|
84
|
+
read: DockerVmRead;
|
|
85
|
+
/** With `estimate`: why the VM's own figure was not read. */
|
|
86
|
+
why?: string;
|
|
87
|
+
others?: ClusterVmOthers;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
from: 'advert' | 'docker-page';
|
|
91
|
+
at: number;
|
|
92
|
+
why: string;
|
|
93
|
+
};
|
|
94
|
+
/** A host's machine as it last said it: its memory and what it is. */
|
|
95
|
+
export interface ClusterMachine {
|
|
96
|
+
/** When the figures were taken — a worker's: its advert's moment, moved to this Mac's clock. */
|
|
97
|
+
at: number;
|
|
98
|
+
/** Its free memory (`vm_stat`'s free, inactive, speculative and purgeable pages) and its whole memory, MiB. */
|
|
99
|
+
freeMb: number;
|
|
100
|
+
totalMb: number;
|
|
101
|
+
cpus?: number;
|
|
102
|
+
arch?: string;
|
|
103
|
+
os?: string;
|
|
104
|
+
/** A worker's LensMCP, as its advert said it. */
|
|
105
|
+
lensmcp?: string;
|
|
106
|
+
/** How many images it holds — a worker's. */
|
|
107
|
+
images?: number;
|
|
108
|
+
}
|
|
109
|
+
/** A run this Mac placed on a worker, as this Mac knows it now. */
|
|
110
|
+
export interface ClusterPlacedRun {
|
|
111
|
+
/** Its id on the channel (`q_…`): Cluster › Docker's card for it carries it. */
|
|
112
|
+
run: string;
|
|
113
|
+
job: string;
|
|
114
|
+
label: string;
|
|
115
|
+
lane?: ClusterLane;
|
|
116
|
+
/**
|
|
117
|
+
* `offered` — the worker has not answered yet (it starts it within 30 s or gives it back); `queued` — in the worker's
|
|
118
|
+
* own queue; `running` — let in there.
|
|
119
|
+
*/
|
|
120
|
+
state: 'offered' | 'queued' | 'running';
|
|
121
|
+
/** Offered at, queued at, or running since. */
|
|
122
|
+
since: number;
|
|
123
|
+
attempt?: number;
|
|
124
|
+
/** Its placement (`pl_…`), while the placement queue has it. */
|
|
125
|
+
placement?: string;
|
|
126
|
+
/** The action here that keeps its evidence (`wa_…`, slice D16) — none: no record of it yet. */
|
|
127
|
+
action?: string;
|
|
128
|
+
stage?: string;
|
|
129
|
+
/** Where it waits in the worker's queue, and why. */
|
|
130
|
+
queue?: {
|
|
131
|
+
place?: number;
|
|
132
|
+
of?: number;
|
|
133
|
+
why?: string;
|
|
134
|
+
};
|
|
135
|
+
/** The last word of it from the worker. */
|
|
136
|
+
heardAt?: number;
|
|
137
|
+
}
|
|
138
|
+
/** A host as Cluster › Hosts shows it. */
|
|
139
|
+
export interface ClusterHost {
|
|
140
|
+
/** `local` — this Mac — or the worker's id on the channel. */
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
local: boolean;
|
|
144
|
+
/** Its model identifier («Mac14,13»). */
|
|
145
|
+
model?: string;
|
|
146
|
+
/** A worker's whole certificate fingerprint and its short form, from its pin. */
|
|
147
|
+
fingerprint?: string;
|
|
148
|
+
short?: string;
|
|
149
|
+
/** A worker's link and version, as Settings › Hosts reads them. */
|
|
150
|
+
link?: HostLinkView;
|
|
151
|
+
version?: HostVersionView;
|
|
152
|
+
/** Whether placement gives it work now, by placement's own rules — and why not. `stale`: its channel went quiet. */
|
|
153
|
+
work: {
|
|
154
|
+
takes: true;
|
|
155
|
+
} | {
|
|
156
|
+
takes: false;
|
|
157
|
+
why: string;
|
|
158
|
+
stale?: true;
|
|
159
|
+
};
|
|
160
|
+
/** Placement still keeps a record of it, and this Mac has no pin of it: revoked, or forgotten on the other side. */
|
|
161
|
+
unpaired?: true;
|
|
162
|
+
/** When this Mac last heard from the worker — any word: hello, advert, ping. */
|
|
163
|
+
heardAt?: number;
|
|
164
|
+
machine?: ClusterMachine;
|
|
165
|
+
vm?: ClusterVm;
|
|
166
|
+
queue?: ClusterQueue;
|
|
167
|
+
/** What this Mac placed there that is offered, queued or running — the newest first. */
|
|
168
|
+
placed: ClusterPlacedRun[];
|
|
169
|
+
/** Runs this Mac placed there that were lost in the last day: Cluster › Docker lists them. */
|
|
170
|
+
lostToday: number;
|
|
171
|
+
/** Its accounts (never a token) and its agent ceiling — slice D31 (host-agents.ts); none: not read. */
|
|
172
|
+
agents?: HostAgentsView;
|
|
173
|
+
}
|
|
174
|
+
/** A host's numbers as placement weighed them for one job (placement.ts `HostNumbers`). */
|
|
175
|
+
export interface ClusterHostNumbers {
|
|
176
|
+
freeMb: number;
|
|
177
|
+
totalMb: number;
|
|
178
|
+
reserveMb: number;
|
|
179
|
+
/** What the job would wait for there: its need and the reserve, MiB. */
|
|
180
|
+
needMb: number;
|
|
181
|
+
vm?: {
|
|
182
|
+
totalMb: number;
|
|
183
|
+
availableMb: number;
|
|
184
|
+
promisedMb: number;
|
|
185
|
+
needMb: number;
|
|
186
|
+
read: DockerVmRead;
|
|
187
|
+
} | {
|
|
188
|
+
unread: string;
|
|
189
|
+
};
|
|
190
|
+
running: {
|
|
191
|
+
heavy: number;
|
|
192
|
+
light: number;
|
|
193
|
+
};
|
|
194
|
+
waiting: number;
|
|
195
|
+
images?: {
|
|
196
|
+
have: number;
|
|
197
|
+
of: number;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** What one host said to one job (placement.ts `HostLook`). */
|
|
201
|
+
export interface ClusterHostLook {
|
|
202
|
+
host: string;
|
|
203
|
+
name: string;
|
|
204
|
+
state: 'fits' | 'full' | 'never' | 'no-work' | 'avoided' | 'taken';
|
|
205
|
+
why?: string;
|
|
206
|
+
numbers?: ClusterHostNumbers;
|
|
207
|
+
}
|
|
208
|
+
/** A job waiting at the organizer for a host — on no host's card. */
|
|
209
|
+
export interface ClusterWaitingJob {
|
|
210
|
+
placement: string;
|
|
211
|
+
job: string;
|
|
212
|
+
label: string;
|
|
213
|
+
ref: string;
|
|
214
|
+
lane: ClusterLane;
|
|
215
|
+
priority: number;
|
|
216
|
+
attempt: number;
|
|
217
|
+
enqueuedAt: number;
|
|
218
|
+
/** Since when it waits for these reasons, and the reasons in a line (`waiting for a host — this Mac: …; mac-mini: …`). */
|
|
219
|
+
since?: number;
|
|
220
|
+
why?: string;
|
|
221
|
+
/** Each host's reason, as `lensmcp queue status` says it. */
|
|
222
|
+
looks: ClusterHostLook[];
|
|
223
|
+
/** The workers it was lost on before. */
|
|
224
|
+
lostOn: string[];
|
|
225
|
+
}
|
|
226
|
+
export type ClusterDecisionKind = 'place' | 'wait' | 'refuse' | 'started' | 'take-back' | 'retry' | 'no-retry';
|
|
227
|
+
/** One line of `placements.jsonl`: one decision. */
|
|
228
|
+
export interface ClusterDecision {
|
|
229
|
+
at: number;
|
|
230
|
+
placement: string;
|
|
231
|
+
job: string;
|
|
232
|
+
label: string;
|
|
233
|
+
ref: string;
|
|
234
|
+
lane: ClusterLane;
|
|
235
|
+
attempt: number;
|
|
236
|
+
decision: ClusterDecisionKind;
|
|
237
|
+
/** The host chosen, or the one the line is about. */
|
|
238
|
+
host?: string;
|
|
239
|
+
hostName?: string;
|
|
240
|
+
/** Placed on this Mac while it was full: the only host it may go to — it waits in this Mac's queue. */
|
|
241
|
+
waitsThere?: true;
|
|
242
|
+
why: string;
|
|
243
|
+
/** Each host considered, with its reason and its numbers at that moment. */
|
|
244
|
+
hosts: ClusterHostLook[];
|
|
245
|
+
}
|
|
246
|
+
export interface ClusterDecisions {
|
|
247
|
+
/** The newest first — at most `limit`. */
|
|
248
|
+
lines: ClusterDecision[];
|
|
249
|
+
/** The decisions the log keeps (a day's); with `partial`, those of the end of it that was read. */
|
|
250
|
+
total: number;
|
|
251
|
+
partial?: true;
|
|
252
|
+
limit: number;
|
|
253
|
+
}
|
|
254
|
+
/** `GET /api/cluster/hosts`: Cluster › Hosts. */
|
|
255
|
+
export interface ClusterHostsView {
|
|
256
|
+
at: number;
|
|
257
|
+
/** This Mac first, then the paired workers by name. */
|
|
258
|
+
hosts: ClusterHost[];
|
|
259
|
+
/** The jobs waiting at the organizer for a host, in their order. */
|
|
260
|
+
waiting: ClusterWaitingJob[];
|
|
261
|
+
decisions: ClusterDecisions;
|
|
262
|
+
/** This Mac is a worker of another Mac: placement is that Mac's; this one shows its own queue. */
|
|
263
|
+
servesOrganizer?: {
|
|
264
|
+
name: string;
|
|
265
|
+
state: 'pending' | 'paired';
|
|
266
|
+
};
|
|
267
|
+
/** A part that could not be read, and why: the rest of the page stands. */
|
|
268
|
+
unread?: string[];
|
|
269
|
+
}
|
|
270
|
+
/** How many decisions an answer carries unless the page asks for more (`?decisions=`), and the most it may ask for. */
|
|
271
|
+
export declare const CLUSTER_DECISIONS_SHOWN = 25;
|
|
272
|
+
export declare const CLUSTER_DECISIONS_MAX = 500;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const CLUSTER_DECISIONS_SHOWN=25,CLUSTER_DECISIONS_MAX=500;
|
package/lib/dashboard-lint.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LintCoverageKind } from './lint-coverage.js';
|
|
2
|
+
import type { CheckAnswer, LintFinding } from './static-checks.js';
|
|
2
3
|
/**
|
|
3
4
|
* The dashboard's Lint page (Investigate › Lint, `GET /api/lint`): the ESLint findings `lint://errors` and
|
|
4
5
|
* `lint://warnings` hold, grouped and filtered on the server so the answer stays bounded, beside each lint run (when,
|
|
@@ -205,3 +206,24 @@ export interface DashLint {
|
|
|
205
206
|
/** The saved lint of the whole checkout — absent before a full lint. */
|
|
206
207
|
whole?: DashLintWhole;
|
|
207
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* `GET /api/lint/findings?offset=&limit=&detail=1` — the page's full list and its coverage strip, read from the RECORD
|
|
211
|
+
* STORE and not from the bus (planning/checks/00-plan.md § 9): every finding the lint units' kept verdicts hold, a
|
|
212
|
+
* page at a time and each once under the project that owns its file, with the `Coverage` block that says which units
|
|
213
|
+
* those verdicts are of — linted and still fresh, stale, not runnable as ESLint, or failed. It is the answer
|
|
214
|
+
* `lensmcp lint --all --wait 0 --json` prints: nothing is linted to give it. `available: false` — and why — when the
|
|
215
|
+
* workspace has no ESLint or no lint target, or `projects` names one it does not have.
|
|
216
|
+
*
|
|
217
|
+
* `&projects=a,b`: the units those projects own (`lensmcp lint --projects a,b`). `&rest=1`: without the findings the
|
|
218
|
+
* bus holds — the rest of what a run found, which the page lists beside the bus's, each once; `answer.page.listed`
|
|
219
|
+
* counts it, and the totals and the coverage stay the scope's.
|
|
220
|
+
*/
|
|
221
|
+
export type DashLintFindings = {
|
|
222
|
+
at: number;
|
|
223
|
+
available: true;
|
|
224
|
+
answer: CheckAnswer<LintFinding>;
|
|
225
|
+
} | {
|
|
226
|
+
at: number;
|
|
227
|
+
available: false;
|
|
228
|
+
why: string;
|
|
229
|
+
};
|
package/lib/dashboard-path.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var t=(e,n)=>d(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,c=t((e,n)=>a(e,"name",{value:n,configurable:!0}),"c"),g=Object.defineProperty,o=c((e,n)=>g(e,"name",{value:n,configurable:!0}),"t");const p={"~":"~~","/":"~s","\\":"~b","\0":"~0"},l={"~":"~",s:"/",b:"\\",0:"\0",d:"."},m=/%2f|%5c|%2e|%00/i;export function encodeSegment(e){return e==="."||e===".."?e.replace(/\./g,"~d"):encodeURIComponent(e.replace(/[~/\\\0]/g,n=>p[n])).replace(/%3A/g,":").replace(/%40/g,"@")}t(encodeSegment,"encodeSegment"),c(encodeSegment,"encodeSegment"),o(encodeSegment,"encodeSegment");export function decodeSegment(e){let n;try{n=decodeURIComponent(e)}catch{n=e}return m.test(e)?n:n.replace(/~([~sb0d])/g,(u,r)=>l[r])}t(decodeSegment,"decodeSegment"),c(decodeSegment,"decodeSegment"),o(decodeSegment,"decodeSegment");
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLUSTER › UPDATE MODES — what the dashboard's `/api/updates` answers (planning/updates/00-plan.md, slice U5): whether
|
|
3
|
+
* each service and frontend of THIS dashboard's checkout takes every save live (`hmr`), waits for an update (`manual`)
|
|
4
|
+
* or does not run (`off`: parked); the agents' holds on it; what is collected while held; the last update's outcome.
|
|
5
|
+
*
|
|
6
|
+
* The dashboard only passes the gateway's control-socket answer through (`GET /updates`, `POST /updates/{mode,apply}`),
|
|
7
|
+
* so these are a lock-step copy of the gateway's `libs/cluster/src/executors/gateway/runtime/updates.ts`
|
|
8
|
+
* (`WorkspaceUpdates`, `PieceStatus`, `UpdateOutcome`) — protocol-types imports no gateway code.
|
|
9
|
+
*
|
|
10
|
+
* Only the person changes a mode (UM-D6): the dashboard is a person's surface, as the CLI is; agents read, hold, release
|
|
11
|
+
* and update through their tools.
|
|
12
|
+
*/
|
|
13
|
+
export type DashUpdateMode = 'hmr' | 'manual' | 'off';
|
|
14
|
+
export type DashUpdateState = 'live' | 'held' | 'manual' | 'parked';
|
|
15
|
+
export type DashUpdateOutcomeKind = 'swapped' | 'unchanged' | 'failed' | 'skipped' | 'pending';
|
|
16
|
+
/** One holder of a piece: an agent (its name, else its client), the CLI's person, a script. */
|
|
17
|
+
export interface DashUpdateHolder {
|
|
18
|
+
/** `claude`, `codex`, `cli`, `dashboard`, … */
|
|
19
|
+
client: string;
|
|
20
|
+
session: string;
|
|
21
|
+
/** A name a person reads: the agent's, the goal's. */
|
|
22
|
+
name?: string;
|
|
23
|
+
since: number;
|
|
24
|
+
/** When the hold lapses unless its holder renews it (its session lease, UM-D4). */
|
|
25
|
+
until: number;
|
|
26
|
+
why?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DashUpdateOutcome {
|
|
29
|
+
piece: string;
|
|
30
|
+
outcome: DashUpdateOutcomeKind;
|
|
31
|
+
ms: number;
|
|
32
|
+
errors?: string[];
|
|
33
|
+
/** Why `skipped` or `pending`. */
|
|
34
|
+
why?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DashUpdatePiece {
|
|
37
|
+
/** The project — a service's or a frontend's, as Cluster › Services names it. */
|
|
38
|
+
piece: string;
|
|
39
|
+
kind: 'service' | 'frontend';
|
|
40
|
+
mode: DashUpdateMode;
|
|
41
|
+
/** Where the mode came from: the checkout's `.lensmcp/updates.json`, the declaration's, or the default (`hmr`). */
|
|
42
|
+
modeFrom: 'checkout' | 'declaration' | 'default';
|
|
43
|
+
state: DashUpdateState;
|
|
44
|
+
holders: DashUpdateHolder[];
|
|
45
|
+
/** While held or manual: the files saved since (the last 50), how many (unknown for a build host's live group), the builds or reloads spared. */
|
|
46
|
+
collected?: {
|
|
47
|
+
files: string[];
|
|
48
|
+
count?: number;
|
|
49
|
+
skipped: number;
|
|
50
|
+
since: number;
|
|
51
|
+
};
|
|
52
|
+
lastUpdate?: DashUpdateOutcome & {
|
|
53
|
+
at: number;
|
|
54
|
+
by?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** `GET /api/updates`, and the answer of `POST /api/updates/mode`. */
|
|
58
|
+
export interface DashUpdates {
|
|
59
|
+
workspace: string;
|
|
60
|
+
/** The main checkout (its modes the person's) or a worktree (agents set them too, `service_mode`). Absent from an older gateway. */
|
|
61
|
+
checkout?: 'main' | 'worktree';
|
|
62
|
+
/** A worktree's instance name. */
|
|
63
|
+
instance?: string;
|
|
64
|
+
pieces: DashUpdatePiece[];
|
|
65
|
+
holds: Array<{
|
|
66
|
+
holder: {
|
|
67
|
+
client: string;
|
|
68
|
+
session: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
};
|
|
71
|
+
pieces: '*' | string[];
|
|
72
|
+
since: number;
|
|
73
|
+
until: number;
|
|
74
|
+
why?: string;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/** `POST /api/updates/apply`: each piece's outcome — `pending` when its build outlived the wait. */
|
|
78
|
+
export interface DashUpdatesApplied {
|
|
79
|
+
outcomes: DashUpdateOutcome[];
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{};
|
package/lib/dashboard.d.ts
CHANGED
|
@@ -861,8 +861,10 @@ export interface DashWarning {
|
|
|
861
861
|
* log — an error-level log line no request explains
|
|
862
862
|
* build / typecheck / service — the code or a service is broken right now (standing, not events)
|
|
863
863
|
* lint — ESLint errors as of its last run (nothing re-lints on save, so dated, not "now")
|
|
864
|
+
* container — a container of a Docker job LensMCP ran was killed for running out of memory (docker-errors.ts)
|
|
865
|
+
* docker — Docker stopped answering while LensMCP ran jobs in it: one error, whatever it held
|
|
864
866
|
*/
|
|
865
|
-
export type DashErrorKind = 'server' | 'exception' | 'request' | 'browser' | 'external' | 'queue' | 'log' | 'build' | 'typecheck' | 'lint' | 'service';
|
|
867
|
+
export type DashErrorKind = 'server' | 'exception' | 'request' | 'browser' | 'external' | 'queue' | 'log' | 'build' | 'typecheck' | 'lint' | 'service' | 'container' | 'docker';
|
|
866
868
|
export interface DashErrorOccurrence {
|
|
867
869
|
/** The primary event's id. */
|
|
868
870
|
id: string;
|
|
@@ -884,6 +886,11 @@ export interface DashErrorGroup {
|
|
|
884
886
|
/** Where: the service, host or page. */
|
|
885
887
|
where?: string;
|
|
886
888
|
project?: string;
|
|
889
|
+
/**
|
|
890
|
+
* The services whose calls to this one failed with it. A failed call between the cluster's own services is told
|
|
891
|
+
* once, where it was answered — not a second time as the caller's «external» error.
|
|
892
|
+
*/
|
|
893
|
+
callers?: string[];
|
|
887
894
|
message?: string;
|
|
888
895
|
/** App frames first; framework frames trimmed. */
|
|
889
896
|
stack?: string;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { CONTAINER_OOM, DOCKER_ENGINE_LOST, type DockerKillSeen } from './docker-jobs.js';
|
|
2
|
+
import { type ErrorCause } from './error-cause.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reading the two Docker failures off the bus (docker-jobs.ts: `ContainerOomEvent`, `DockerEngineLostEvent`;
|
|
5
|
+
* planning/docker/00-plan.md § 4 «Errors», slice D7): what each IS, in the words every list uses, and which accounts
|
|
6
|
+
* are one failure.
|
|
7
|
+
*
|
|
8
|
+
* Two lists show them — the dashboard's Errors page (`servers/lensmcp-mcp/src/dashboard/errors.ts`) and the agents'
|
|
9
|
+
* `observe_errors` (`apps/agent/src/lib/docker-errors.ts`) — in two processes that fold the same bus file. Both read
|
|
10
|
+
* here, so a row and an entry carry one cause id, one title, one headline and one next step, and count the same
|
|
11
|
+
* occurrences: an agent and the person talk about one thing.
|
|
12
|
+
*
|
|
13
|
+
* Pure and total. The bus is a file any local process appends to and its producer may be another version, so every
|
|
14
|
+
* field is checked, and a failure that lacks one is still told — with what it does say.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The worker Mac a failure happened on, as read (slice D16): its id, and the name to say it by when it has one — none:
|
|
18
|
+
* this Mac. A host that names no id is no host: the failure is read as this Mac's.
|
|
19
|
+
*/
|
|
20
|
+
export interface DockerErrorHost {
|
|
21
|
+
peer: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
}
|
|
24
|
+
/** A container killed for memory, as read: everything but the kind may be missing. */
|
|
25
|
+
export interface ContainerOom {
|
|
26
|
+
kind: typeof CONTAINER_OOM;
|
|
27
|
+
run?: string;
|
|
28
|
+
job?: string;
|
|
29
|
+
service?: string;
|
|
30
|
+
container?: string;
|
|
31
|
+
seen?: DockerKillSeen;
|
|
32
|
+
limitMb?: number;
|
|
33
|
+
peakMb?: number;
|
|
34
|
+
budgetMb?: number;
|
|
35
|
+
context?: string;
|
|
36
|
+
host?: DockerErrorHost;
|
|
37
|
+
}
|
|
38
|
+
/** An engine that stopped answering, as read. */
|
|
39
|
+
export interface DockerEngineLost {
|
|
40
|
+
kind: typeof DOCKER_ENGINE_LOST;
|
|
41
|
+
context?: string;
|
|
42
|
+
runs: Array<{
|
|
43
|
+
run: string;
|
|
44
|
+
job?: string;
|
|
45
|
+
}>;
|
|
46
|
+
why?: string;
|
|
47
|
+
vmTotalMb?: number;
|
|
48
|
+
vmAvailableMb?: number;
|
|
49
|
+
/** Services of its runs found killed for memory once it was gone — part of this loss, not errors of their own. */
|
|
50
|
+
killed?: string[];
|
|
51
|
+
host?: DockerErrorHost;
|
|
52
|
+
}
|
|
53
|
+
export type DockerError = ContainerOom | DockerEngineLost;
|
|
54
|
+
/**
|
|
55
|
+
* One of the two failures out of an event's `raw` — or out of an entry that keeps `raw`'s fields flat, as
|
|
56
|
+
* `observe_errors` lists them — or nothing when it is neither. Never throws: a field of the wrong type is a field
|
|
57
|
+
* that is missing.
|
|
58
|
+
*/
|
|
59
|
+
export declare function readDockerError(raw: unknown): DockerError | undefined;
|
|
60
|
+
/** The runs a failure explains: whatever else failed in one of them failed of it. */
|
|
61
|
+
export declare function dockerErrorRuns(error: DockerError): string[];
|
|
62
|
+
/** The run an error event of another kind says it happened because of (`raw.dockerRun`), if it names one. */
|
|
63
|
+
export declare function dockerRunOfEvent(raw: unknown): string | undefined;
|
|
64
|
+
/** A Docker failure as every list says it. */
|
|
65
|
+
export interface DockerErrorWords {
|
|
66
|
+
/**
|
|
67
|
+
* The cause, built from the job and the service (or the Docker context) as written — not from a folded message,
|
|
68
|
+
* as `errorCause` builds one: folding digits would make `redis6` and `redis7` one service, and a limit that is
|
|
69
|
+
* known on one account and not on the other would make one kill two causes.
|
|
70
|
+
*/
|
|
71
|
+
cause: ErrorCause;
|
|
72
|
+
/** The cause in a line, as both lists title it: `ContainerOOMKilled: api ran out of memory in system-e2e`. */
|
|
73
|
+
title: string;
|
|
74
|
+
/** What happened, in plain words. */
|
|
75
|
+
headline: string;
|
|
76
|
+
/** What to do next — for a kill: which budget, and by how much it was over. */
|
|
77
|
+
hint: string;
|
|
78
|
+
/** This occurrence's own numbers, in a line. */
|
|
79
|
+
facts: string;
|
|
80
|
+
/** Where it was: the job, or the Docker context. */
|
|
81
|
+
where: string;
|
|
82
|
+
}
|
|
83
|
+
/** The class each failure is told under: the pill on its row, and the first part of its cause's id. */
|
|
84
|
+
export declare const CONTAINER_OOM_ERROR = "ContainerOOMKilled";
|
|
85
|
+
export declare const DOCKER_ENGINE_LOST_ERROR = "DockerEngineLost";
|
|
86
|
+
/** How a Docker failure is said — its cause, its title, what it means and what to do next. */
|
|
87
|
+
export declare function dockerErrorWords(error: DockerError): DockerErrorWords;
|
|
88
|
+
/**
|
|
89
|
+
* What is known of one failure once a second account of it arrived: `told` with what `later` adds.
|
|
90
|
+
* - a kill and its other account: the numbers the first lacked, and the higher peak;
|
|
91
|
+
* - a loss and another watcher's account of it: the runs both name;
|
|
92
|
+
* - a loss and a container of one of its runs found killed afterwards: that service, on the loss.
|
|
93
|
+
*/
|
|
94
|
+
export declare function mergeDockerError<T extends DockerError>(told: T, later: DockerError): T;
|
|
95
|
+
/**
|
|
96
|
+
* How far apart two accounts of an engine that stopped answering are still one loss. Each run's watcher notices on its
|
|
97
|
+
* own — its stream ends, its next sample fails — so they tell it seconds apart, never together.
|
|
98
|
+
*/
|
|
99
|
+
export declare const DOCKER_ENGINE_LOSS_SAME_MS = 60000;
|
|
100
|
+
/**
|
|
101
|
+
* Which accounts are one failure — the one rule both lists count by.
|
|
102
|
+
*
|
|
103
|
+
* A KILL has two witnesses: the live events stream, and the inspect at the run's end. The first account of a container
|
|
104
|
+
* is the kill; the other witness's account of the same container completes it. A container killed AGAIN (a restart
|
|
105
|
+
* policy brings it back under the same id) is seen live each time, and each is a kill; the end inspect, which sees
|
|
106
|
+
* only that it was killed, adds none. An account that names no container is matched by its run and service; one that
|
|
107
|
+
* names neither is a kill of its own.
|
|
108
|
+
*
|
|
109
|
+
* A LOST ENGINE is told by every watcher that was on it: accounts for one context within
|
|
110
|
+
* {@link DOCKER_ENGINE_LOSS_SAME_MS} are one loss. A container of a run that was lost, found killed afterwards, went
|
|
111
|
+
* with the engine — part of that loss, never a row per container.
|
|
112
|
+
*/
|
|
113
|
+
export declare class DockerErrorLedger {
|
|
114
|
+
private readonly kills;
|
|
115
|
+
private readonly losses;
|
|
116
|
+
private readonly lostRuns;
|
|
117
|
+
/**
|
|
118
|
+
* Take one account, told by the event `eventId` at `at`. Returns the id of the event that already told this failure
|
|
119
|
+
* — this account only completes it — or undefined: it is a failure of its own, told by this event.
|
|
120
|
+
*/
|
|
121
|
+
account(error: DockerError, eventId: string, at: number): string | undefined;
|
|
122
|
+
private remember;
|
|
123
|
+
}
|