oc-flight-deck 0.1.2 → 0.2.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/README.md +74 -10
- package/flight-deck.example.jsonc +173 -100
- package/flight-deck.schema.json +178 -0
- package/package.json +2 -1
- package/src/tui/caution.ts +411 -0
- package/src/tui/config.ts +284 -7
- package/src/tui/index.tsx +129 -4
- package/src/tui/presentation.ts +1 -1
- package/src/tui/stats.ts +110 -19
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
// The caution annunciator: the one failure nothing else on the rail can see.
|
|
2
|
+
//
|
|
3
|
+
// Everything else in Flight Deck is event-driven state. A hang emits no events
|
|
4
|
+
// at all — no completion, no error, no signal of any kind — so every observable
|
|
5
|
+
// thing about a hang is the *absence* of something. Catching it needs a clock
|
|
6
|
+
// and a baseline instead of a listener, which is why this module exists next to
|
|
7
|
+
// the ticker rather than next to the stats.
|
|
8
|
+
//
|
|
9
|
+
// Four rules, all pure functions of the session snapshot and the current time:
|
|
10
|
+
//
|
|
11
|
+
// 1. A tool that has not come back. The host records when execution started
|
|
12
|
+
// (`time.ran`, falling back to `time.created`) and when it settled
|
|
13
|
+
// (`time.completed`). A start with no completion is in flight.
|
|
14
|
+
// 2. A shell the host still reports as running. This is deliberately separate
|
|
15
|
+
// from rule 1: when a shell command is backgrounded its tool call returns
|
|
16
|
+
// immediately and settles, so the tool part looks finished while the
|
|
17
|
+
// process is still going. `ShellInfo` outlives that.
|
|
18
|
+
// 3. The same call, over and over. Three identical consecutive calls is a
|
|
19
|
+
// loop; two is a retry.
|
|
20
|
+
// 4. The same call, failing over and over. Distinct from rule 3 because the
|
|
21
|
+
// interesting death spiral is not a repeated success — it is an agent
|
|
22
|
+
// retrying the same broken action and being refused each time.
|
|
23
|
+
//
|
|
24
|
+
// Followed by one weak rule, kept last and given generous thresholds because it
|
|
25
|
+
// cannot distinguish thinking from wedging: a session that reports itself
|
|
26
|
+
// running while nothing has settled.
|
|
27
|
+
//
|
|
28
|
+
// Every rule reports an **observation**, never a verdict. "shell running 8m41s"
|
|
29
|
+
// is a fact. "stuck" is a guess, and a ten-minute MSVC build is not a hang. A
|
|
30
|
+
// caution light that cries wolf is worse than no caution light.
|
|
31
|
+
|
|
32
|
+
/** Flight Deck's rail has one line for this, so only the worst is ever drawn. */
|
|
33
|
+
export type CautionSeverity = "watch" | "caution";
|
|
34
|
+
|
|
35
|
+
export type CautionKind = "hung-tool" | "hung-shell" | "repeat-loop" | "failure-loop" | "silent-turn";
|
|
36
|
+
|
|
37
|
+
export interface CautionThresholds {
|
|
38
|
+
readonly toolWatchMs: number;
|
|
39
|
+
readonly toolCautionMs: number;
|
|
40
|
+
readonly turnWatchMs: number;
|
|
41
|
+
readonly turnCautionMs: number;
|
|
42
|
+
readonly repeatThreshold: number;
|
|
43
|
+
/** How slow a tool may legitimately be before it is worth mentioning. */
|
|
44
|
+
readonly exemptTools: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface Caution {
|
|
48
|
+
readonly kind: CautionKind;
|
|
49
|
+
readonly severity: CautionSeverity;
|
|
50
|
+
readonly tool?: string;
|
|
51
|
+
/** `running` (executing) or `streaming` (the model is still writing the call). */
|
|
52
|
+
readonly status?: string;
|
|
53
|
+
readonly elapsedMs?: number;
|
|
54
|
+
readonly repeats?: number;
|
|
55
|
+
/** Stable identity, so a toast fires once per distinct problem. */
|
|
56
|
+
readonly key: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CautionInput {
|
|
60
|
+
/** The snapshot's tool parts, oldest first. */
|
|
61
|
+
readonly parts: readonly unknown[];
|
|
62
|
+
/** Running shells from `context.data.shell`, when the host exposes them. */
|
|
63
|
+
readonly shells?: readonly unknown[];
|
|
64
|
+
readonly now: number;
|
|
65
|
+
readonly sessionRunning: boolean;
|
|
66
|
+
readonly lastMessageAt?: number;
|
|
67
|
+
readonly thresholds: CautionThresholds;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
// Reading the host's shapes
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
75
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
76
|
+
? (value as Record<string, unknown>)
|
|
77
|
+
: undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function asCount(value: unknown): number | undefined {
|
|
81
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function asText(value: unknown): string | undefined {
|
|
85
|
+
if (typeof value !== "string") return undefined;
|
|
86
|
+
const text = value.trim();
|
|
87
|
+
return text.length === 0 ? undefined : text;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Statuses that mean a tool has stopped. Anything else counts as live. */
|
|
91
|
+
const SETTLED_TOOL = new Set(["completed", "error", "aborted", "cancelled"]);
|
|
92
|
+
|
|
93
|
+
export interface ToolCall {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly status: string;
|
|
96
|
+
/** Canonical form of the input, for comparing one call with the next. */
|
|
97
|
+
readonly inputKey: string;
|
|
98
|
+
readonly startedAt?: number;
|
|
99
|
+
readonly settledAt?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** One message part, or `undefined` for anything that is not a tool call. */
|
|
103
|
+
export function readToolCall(value: unknown): ToolCall | undefined {
|
|
104
|
+
const part = asRecord(value);
|
|
105
|
+
if (part === undefined || part["type"] !== "tool") return undefined;
|
|
106
|
+
|
|
107
|
+
const name = asText(part["name"]);
|
|
108
|
+
if (name === undefined) return undefined;
|
|
109
|
+
|
|
110
|
+
const state = asRecord(part["state"]);
|
|
111
|
+
const time = asRecord(part["time"]);
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
name,
|
|
115
|
+
status: asText(state?.["status"]) ?? "unknown",
|
|
116
|
+
inputKey: stableKey(state?.["input"]),
|
|
117
|
+
startedAt: asCount(time?.["ran"]) ?? asCount(time?.["created"]),
|
|
118
|
+
settledAt: asCount(time?.["completed"]),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function toolCalls(parts: readonly unknown[]): ToolCall[] {
|
|
123
|
+
const calls: ToolCall[] = [];
|
|
124
|
+
for (const part of parts) {
|
|
125
|
+
const call = readToolCall(part);
|
|
126
|
+
if (call !== undefined) calls.push(call);
|
|
127
|
+
}
|
|
128
|
+
return calls;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Key order must not decide whether two identical inputs look identical. */
|
|
132
|
+
export function stableKey(value: unknown): string {
|
|
133
|
+
if (value === undefined) return "";
|
|
134
|
+
try {
|
|
135
|
+
return JSON.stringify(sortValue(value)).slice(0, 512);
|
|
136
|
+
} catch {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function sortValue(value: unknown): unknown {
|
|
142
|
+
if (Array.isArray(value)) return value.map(sortValue);
|
|
143
|
+
const record = asRecord(value);
|
|
144
|
+
if (record === undefined) return value;
|
|
145
|
+
const sorted: Record<string, unknown> = {};
|
|
146
|
+
for (const key of Object.keys(record).sort()) sorted[key] = sortValue(record[key]);
|
|
147
|
+
return sorted;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// The rules
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
|
|
154
|
+
const SEVERITY_ORDER: Record<CautionSeverity, number> = { caution: 0, watch: 1 };
|
|
155
|
+
|
|
156
|
+
function severityFor(elapsed: number, watchMs: number, cautionMs: number): CautionSeverity {
|
|
157
|
+
return elapsed >= cautionMs ? "caution" : "watch";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function newestActivity(calls: readonly ToolCall[]): number | undefined {
|
|
161
|
+
let newest: number | undefined;
|
|
162
|
+
for (const call of calls) {
|
|
163
|
+
const stamp = call.settledAt ?? call.startedAt;
|
|
164
|
+
if (stamp === undefined) continue;
|
|
165
|
+
if (newest === undefined || stamp > newest) newest = stamp;
|
|
166
|
+
}
|
|
167
|
+
return newest;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function detectCautions(input: CautionInput): Caution[] {
|
|
171
|
+
const { parts, now, sessionRunning, thresholds } = input;
|
|
172
|
+
const calls = toolCalls(parts);
|
|
173
|
+
const shells = input.shells ?? [];
|
|
174
|
+
const found: Caution[] = [];
|
|
175
|
+
const exempt = (name: string) => thresholds.exemptTools.includes(name);
|
|
176
|
+
|
|
177
|
+
// Rule 1 — a tool that has not come back.
|
|
178
|
+
for (let index = calls.length - 1; index >= 0; index -= 1) {
|
|
179
|
+
const call = calls[index];
|
|
180
|
+
if (call === undefined || SETTLED_TOOL.has(call.status) || exempt(call.name)) continue;
|
|
181
|
+
// No recorded start means no measurable duration; silence beats a guess.
|
|
182
|
+
if (call.startedAt === undefined) continue;
|
|
183
|
+
|
|
184
|
+
const elapsedMs = now - call.startedAt;
|
|
185
|
+
if (elapsedMs < thresholds.toolWatchMs) continue;
|
|
186
|
+
|
|
187
|
+
found.push({
|
|
188
|
+
kind: "hung-tool",
|
|
189
|
+
severity: severityFor(elapsedMs, thresholds.toolWatchMs, thresholds.toolCautionMs),
|
|
190
|
+
tool: call.name,
|
|
191
|
+
status: call.status,
|
|
192
|
+
elapsedMs,
|
|
193
|
+
// Deliberately excludes the status: streaming -> running is progress, and
|
|
194
|
+
// re-raising the alert for it would be noise.
|
|
195
|
+
key: `hung:${call.name}`,
|
|
196
|
+
});
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Rule 2 — a shell the host still reports as running.
|
|
201
|
+
//
|
|
202
|
+
// A backgrounded command returns its tool result immediately, so the tool part
|
|
203
|
+
// above settles while the process keeps going. This is the only signal that
|
|
204
|
+
// survives that, and it reads the host's own shell record rather than ours.
|
|
205
|
+
for (const raw of shells) {
|
|
206
|
+
const shell = asRecord(raw);
|
|
207
|
+
if (shell === undefined || shell["status"] !== "running") continue;
|
|
208
|
+
const time = asRecord(shell["time"]);
|
|
209
|
+
const startedAt = asCount(time?.["started"]);
|
|
210
|
+
if (startedAt === undefined) continue;
|
|
211
|
+
|
|
212
|
+
const elapsedMs = now - startedAt;
|
|
213
|
+
if (elapsedMs < thresholds.toolWatchMs) continue;
|
|
214
|
+
// Only the long pole matters: twenty backgrounded commands is one problem.
|
|
215
|
+
if (elapsedMs < (found.find((c) => c.kind === "hung-shell")?.elapsedMs ?? 0)) continue;
|
|
216
|
+
|
|
217
|
+
const command = asText(shell["command"]) ?? "shell";
|
|
218
|
+
const label = command.split(/\s+/)[0] ?? "shell";
|
|
219
|
+
const existing = found.findIndex((c) => c.kind === "hung-shell");
|
|
220
|
+
const caution: Caution = {
|
|
221
|
+
kind: "hung-shell",
|
|
222
|
+
severity: severityFor(elapsedMs, thresholds.toolWatchMs, thresholds.toolCautionMs),
|
|
223
|
+
tool: label,
|
|
224
|
+
status: "running",
|
|
225
|
+
elapsedMs,
|
|
226
|
+
key: `shell:${label}`,
|
|
227
|
+
};
|
|
228
|
+
if (existing >= 0) found[existing] = caution;
|
|
229
|
+
else found.push(caution);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Rule 3 — the same call, over and over.
|
|
233
|
+
//
|
|
234
|
+
// Deliberately excludes a run where every call errored: that is rule 4's
|
|
235
|
+
// business, and one problem should not be reported as two.
|
|
236
|
+
const threshold = Math.max(2, Math.floor(thresholds.repeatThreshold));
|
|
237
|
+
if (calls.length >= threshold) {
|
|
238
|
+
const tail = calls.slice(-threshold);
|
|
239
|
+
const first = tail[0];
|
|
240
|
+
if (
|
|
241
|
+
first !== undefined &&
|
|
242
|
+
!exempt(first.name) &&
|
|
243
|
+
first.inputKey.length > 0 &&
|
|
244
|
+
tail.some((call) => call.status !== "error") &&
|
|
245
|
+
tail.every((call) => call.name === first.name && call.inputKey === first.inputKey)
|
|
246
|
+
) {
|
|
247
|
+
found.push({
|
|
248
|
+
kind: "repeat-loop",
|
|
249
|
+
severity: "caution",
|
|
250
|
+
tool: first.name,
|
|
251
|
+
repeats: threshold,
|
|
252
|
+
key: `repeat:${first.name}:${first.inputKey.slice(0, 64)}`,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Rule 4 — the same call failing over and over.
|
|
258
|
+
//
|
|
259
|
+
// Measured on real history, the genuine death spiral was not a repeated
|
|
260
|
+
// success: it was an agent calling the same unavailable tool again and again
|
|
261
|
+
// and being refused each time. `invalid: unavailable tool 'bash'` repeated is
|
|
262
|
+
// the shape this catches.
|
|
263
|
+
//
|
|
264
|
+
// Identical input is required, the same as rule 3. Three *different* reads
|
|
265
|
+
// that each failed is a rough patch, not a loop — and a rule loose enough to
|
|
266
|
+
// fire on that is one that fires on ordinary work.
|
|
267
|
+
if (calls.length >= threshold) {
|
|
268
|
+
const tail = calls.slice(-threshold);
|
|
269
|
+
const first = tail[0];
|
|
270
|
+
if (
|
|
271
|
+
first !== undefined &&
|
|
272
|
+
!exempt(first.name) &&
|
|
273
|
+
first.inputKey.length > 0 &&
|
|
274
|
+
tail.every(
|
|
275
|
+
(call) =>
|
|
276
|
+
call.name === first.name && call.status === "error" && call.inputKey === first.inputKey,
|
|
277
|
+
)
|
|
278
|
+
) {
|
|
279
|
+
found.push({
|
|
280
|
+
kind: "failure-loop",
|
|
281
|
+
severity: "caution",
|
|
282
|
+
tool: first.name,
|
|
283
|
+
repeats: threshold,
|
|
284
|
+
key: `failing:${first.name}:${first.inputKey.slice(0, 64)}`,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Rule 5 — running, but nothing is moving.
|
|
290
|
+
//
|
|
291
|
+
// A live tool or shell is progress and rules 1 and 2 own it, so this stays out
|
|
292
|
+
// of the way whenever one exists — including an exempt one, because an exempt
|
|
293
|
+
// tool is usually waiting on a person.
|
|
294
|
+
const hasLiveWork =
|
|
295
|
+
calls.some((call) => !SETTLED_TOOL.has(call.status)) ||
|
|
296
|
+
shells.some((raw) => asRecord(raw)?.["status"] === "running");
|
|
297
|
+
if (sessionRunning && !hasLiveWork) {
|
|
298
|
+
const settledAt = newestActivity(calls) ?? input.lastMessageAt;
|
|
299
|
+
if (settledAt !== undefined) {
|
|
300
|
+
const elapsedMs = now - settledAt;
|
|
301
|
+
if (elapsedMs >= thresholds.turnWatchMs) {
|
|
302
|
+
found.push({
|
|
303
|
+
kind: "silent-turn",
|
|
304
|
+
severity: severityFor(elapsedMs, thresholds.turnWatchMs, thresholds.turnCautionMs),
|
|
305
|
+
elapsedMs,
|
|
306
|
+
key: "silent-turn",
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return found.sort(
|
|
313
|
+
(a, b) =>
|
|
314
|
+
SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity] ||
|
|
315
|
+
b.kind.length - a.kind.length ||
|
|
316
|
+
a.key.localeCompare(b.key),
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** True when anything in the set is worth interrupting for, not just noting. */
|
|
321
|
+
export function hasSevereCaution(cautions: readonly Caution[]): boolean {
|
|
322
|
+
return cautions.some((caution) => caution.severity === "caution");
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** The rail has one line, so it draws the worst of the set. */
|
|
326
|
+
export function worstCaution(cautions: readonly Caution[]): Caution | undefined {
|
|
327
|
+
return [...cautions].sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity])[0];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// ---------------------------------------------------------------------------
|
|
331
|
+
// Wording
|
|
332
|
+
// ---------------------------------------------------------------------------
|
|
333
|
+
|
|
334
|
+
export const WATCH_GLYPH = "▲";
|
|
335
|
+
export const CAUTION_GLYPH = "⚠";
|
|
336
|
+
export const CLEAR_GLYPH = "○";
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Glyph overrides, for terminals that render the defaults badly.
|
|
340
|
+
*
|
|
341
|
+
* Structural, like `LayoutHint`, so this module stays free of imports.
|
|
342
|
+
*/
|
|
343
|
+
export interface GlyphHint {
|
|
344
|
+
readonly watch?: string;
|
|
345
|
+
readonly caution?: string;
|
|
346
|
+
readonly clear?: string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export function glyphFor(caution: Caution | undefined, glyphs: GlyphHint = {}): string {
|
|
350
|
+
if (caution === undefined) return glyphs.clear ?? CLEAR_GLYPH;
|
|
351
|
+
return caution.severity === "caution" ? (glyphs.caution ?? CAUTION_GLYPH) : (glyphs.watch ?? WATCH_GLYPH);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** The short value beside the label. Says what was seen, not what it means. */
|
|
355
|
+
export function cautionText(caution: Caution, glyphs: GlyphHint = {}): string {
|
|
356
|
+
const glyph = glyphFor(caution, glyphs);
|
|
357
|
+
const elapsed = caution.elapsedMs === undefined ? "" : ` ${formatElapsed(caution.elapsedMs)}`;
|
|
358
|
+
switch (caution.kind) {
|
|
359
|
+
case "hung-tool": {
|
|
360
|
+
// `streaming` means the model is still writing the call's arguments, which
|
|
361
|
+
// is a different situation from a tool that is executing and has not
|
|
362
|
+
// returned. Calling both "running" would be a small lie.
|
|
363
|
+
const phase = caution.status === "streaming" ? "streaming" : "running";
|
|
364
|
+
return `${glyph} ${caution.tool ?? "tool"} ${phase}${elapsed}`;
|
|
365
|
+
}
|
|
366
|
+
case "hung-shell":
|
|
367
|
+
return `${glyph} ${caution.tool ?? "shell"} running${elapsed}`;
|
|
368
|
+
case "repeat-loop":
|
|
369
|
+
return `${glyph} ${caution.tool ?? "tool"} ×${caution.repeats ?? 0} identical`;
|
|
370
|
+
case "failure-loop":
|
|
371
|
+
return `${glyph} ${caution.tool ?? "tool"} failing ×${caution.repeats ?? 0}`;
|
|
372
|
+
case "silent-turn":
|
|
373
|
+
return `${glyph} no progress${elapsed}`;
|
|
374
|
+
default:
|
|
375
|
+
return `${glyph} unknown`;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** The longer sentence, used for the toast. States the observation, then the readings. */
|
|
380
|
+
export function cautionDetail(caution: Caution): string {
|
|
381
|
+
const elapsed = caution.elapsedMs === undefined ? "a while" : formatElapsed(caution.elapsedMs);
|
|
382
|
+
const tool = caution.tool ?? "a tool";
|
|
383
|
+
switch (caution.kind) {
|
|
384
|
+
case "hung-tool":
|
|
385
|
+
if (caution.status === "streaming") {
|
|
386
|
+
return `${tool} has been streaming its arguments for ${elapsed}. Either a very large call, or the model has lost the thread.`;
|
|
387
|
+
}
|
|
388
|
+
return `${tool} has been running for ${elapsed} without returning. Slow, or waiting on something that will never finish.`;
|
|
389
|
+
case "hung-shell":
|
|
390
|
+
return `A shell command has been running for ${elapsed}. A build, or a process that will never exit.`;
|
|
391
|
+
case "repeat-loop":
|
|
392
|
+
return `${tool} was called ${caution.repeats ?? 0} times with identical input. That is usually a loop rather than a retry.`;
|
|
393
|
+
case "failure-loop":
|
|
394
|
+
return `${tool} failed ${caution.repeats ?? 0} times in a row. The agent is retrying something that is not working.`;
|
|
395
|
+
case "silent-turn":
|
|
396
|
+
return `The session is running but nothing has settled for ${elapsed}. Either the model is still thinking, or the turn is wedged.`;
|
|
397
|
+
default:
|
|
398
|
+
return "Something looks wrong, but this build cannot say what.";
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** `45s`, `14m`, `2h 14m`. */
|
|
403
|
+
export function formatElapsed(ms: number): string {
|
|
404
|
+
const seconds = Math.max(0, Math.floor(ms / 1_000));
|
|
405
|
+
if (seconds < 60) return `${seconds}s`;
|
|
406
|
+
const minutes = Math.floor(seconds / 60);
|
|
407
|
+
if (minutes < 60) return `${minutes}m`;
|
|
408
|
+
const hours = Math.floor(minutes / 60);
|
|
409
|
+
const rest = minutes % 60;
|
|
410
|
+
return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;
|
|
411
|
+
}
|