@adrrr/tarmac 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/map.js CHANGED
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // A view over the fleet `buildFleet` already produced. It opens no second source: every
4
4
  // field below is derived from a row that is already on the page as a table line.
5
- import { isWaiting } from './sessions.js';
5
+ import { anchoredOnKind, isBackgroundAgent, isWaiting } from './sessions.js';
6
6
  /**
7
7
  * What a berth is labelled when the source published no working directory for it. In the
8
8
  * vocabulary the dials already use for a reading they do not have (`not chained`, `no turn
@@ -35,13 +35,11 @@ export const PULSE_WITHIN_MS = 10_000;
35
35
  * grid's arrangement of it, never the data's.
36
36
  */
37
37
  export function buildMap({ rows }, { pulseWithinMs = PULSE_WITHIN_MS } = {}) {
38
- // Whether this fleet still speaks the kind we know. If NOTHING calls itself `interactive`,
39
- // the word moved rather than every terminal on the machine going background at once — and
40
- // the map says so by drawing them all as what they almost certainly still are. It is the
41
- // tolerance `buildFleet` already applies to telemetry: a signal true of every row is a
42
- // change in the source.
43
- const anchored = rows.some((r) => r.kind === INTERACTIVE);
44
- const roleOf = (r) => !anchored || r.kind === null || r.kind === INTERACTIVE ? 'session' : 'agent';
38
+ // Which entries are agents, by the rule `sessions.ts` states and `buildFleet` reads too: the
39
+ // map draws them differently, and the coverage line counts them out of a population no
40
+ // install can ever cover.
41
+ const anchored = anchoredOnKind(rows);
42
+ const roleOf = (r) => (isBackgroundAgent(r, anchored) ? 'agent' : 'session');
45
43
  const node = (row) => {
46
44
  const reading = readingOf(row);
47
45
  return {
@@ -86,20 +84,6 @@ export function buildMap({ rows }, { pulseWithinMs = PULSE_WITHIN_MS } = {}) {
86
84
  }
87
85
  return { berths };
88
86
  }
89
- /**
90
- * The kind a terminal calls itself, and the anchor this module reasons from. A background
91
- * entry has since been seen beside them — `kind: 'background'`, no `pid`, its word under
92
- * `state` rather than `status` — so the two are no longer a reading of that CLI's help. It is
93
- * still the anchor and never the list: one observed alternative is not the vocabulary, and the
94
- * heuristic above asks only whether anything on this machine still calls itself `interactive`.
95
- *
96
- * An ABSENT kind is not evidence of an agent either: the same rule the session status follows
97
- * one module down, where unrecognised means unknown, never "the quiet one". The two mistakes
98
- * are not the same size — an agent drawn as a session is a node in the wrong shape, while a
99
- * session drawn as an agent is a terminal someone is working in, reduced to a footnote of a
100
- * directory it merely shares.
101
- */
102
- export const INTERACTIVE = 'interactive';
103
87
  /**
104
88
  * `stale` is not recomputed here — it is the collector's verdict, reached against the
105
89
  * threshold this run resolved (`--stale-after`, the environment, the config file). A second