@stigmer/ink-ui 0.1.3 → 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/components/FileReviewAtoms.d.ts +1 -2
- package/components/FileReviewAtoms.d.ts.map +1 -1
- package/components/FileReviewAtoms.js +1 -2
- package/components/FileReviewAtoms.js.map +1 -1
- package/components/FileReviewPrompt.d.ts +2 -2
- package/components/FileReviewPrompt.js +2 -2
- package/components/WorkingLine.d.ts.map +1 -1
- package/components/WorkingLine.js +16 -1
- package/components/WorkingLine.js.map +1 -1
- package/package.json +4 -4
- package/src/components/FileReviewAtoms.tsx +1 -2
- package/src/components/FileReviewPrompt.tsx +2 -2
- package/src/components/WorkingLine.tsx +8 -3
- package/src/working.ts +14 -3
- package/working.d.ts +2 -0
- package/working.d.ts.map +1 -1
- package/working.js +12 -3
- package/working.js.map +1 -1
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* The change-kind marker is deliberately NOT here: the terminal renders kind via
|
|
8
8
|
* the pure `kindLetter` helper (in `file-review.ts`), already shared across every
|
|
9
|
-
* surface. The web
|
|
10
|
-
* per-kind color tokens and a11y labels; a plain letter needs neither.
|
|
9
|
+
* surface. (The web kit says a file's kind in words, "New" or "Deleted".)
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
13
12
|
* The `+N −M` stat for one file (or a whole set), in the diff colour vocabulary.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileReviewAtoms.d.ts","sourceRoot":"","sources":["../src/components/FileReviewAtoms.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"FileReviewAtoms.d.ts","sourceRoot":"","sources":["../src/components/FileReviewAtoms.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,YAAY,GACb,EAAE;IACD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,kDASA"}
|
|
@@ -9,8 +9,7 @@ import { useRoles } from "../theme.js";
|
|
|
9
9
|
*
|
|
10
10
|
* The change-kind marker is deliberately NOT here: the terminal renders kind via
|
|
11
11
|
* the pure `kindLetter` helper (in `file-review.ts`), already shared across every
|
|
12
|
-
* surface. The web
|
|
13
|
-
* per-kind color tokens and a11y labels; a plain letter needs neither.
|
|
12
|
+
* surface. (The web kit says a file's kind in words, "New" or "Deleted".)
|
|
14
13
|
*/
|
|
15
14
|
/**
|
|
16
15
|
* The `+N −M` stat for one file (or a whole set), in the diff colour vocabulary.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileReviewAtoms.js","sourceRoot":"","sources":["../src/components/FileReviewAtoms.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"FileReviewAtoms.js","sourceRoot":"","sources":["../src/components/FileReviewAtoms.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,UAAU,EACV,YAAY,GAIb;IACC,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,IAAI,UAAU,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,OAAO,CACL,MAAC,IAAI,eACH,MAAC,IAAI,OAAK,IAAI,CAAC,OAAO,kBAAI,UAAU,IAAQ,EAC5C,MAAC,IAAI,OAAK,IAAI,CAAC,MAAM,mBAAK,YAAY,IAAQ,IACzC,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -28,8 +28,8 @@ export interface FileReviewPromptProps {
|
|
|
28
28
|
readonly isActive?: boolean;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The terminal file-review decision surface
|
|
32
|
-
*
|
|
31
|
+
* The terminal file-review decision surface, in the linear log. (The web
|
|
32
|
+
* kit lists a finished turn's files once, with Undo, under its answer.)
|
|
33
33
|
*
|
|
34
34
|
* Renders `N files awaiting review` and, gated by `changeSetReviewability`:
|
|
35
35
|
* bulk Approve/Keep all + Reject all (a complete set is keepable as-is; a
|
|
@@ -27,8 +27,8 @@ function bulkLabels(total, decided, binaryOnly) {
|
|
|
27
27
|
return { approve: `${verb} all`, reject: "Reject all" };
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* The terminal file-review decision surface
|
|
31
|
-
*
|
|
30
|
+
* The terminal file-review decision surface, in the linear log. (The web
|
|
31
|
+
* kit lists a finished turn's files once, with Undo, under its answer.)
|
|
32
32
|
*
|
|
33
33
|
* Renders `N files awaiting review` and, gated by `changeSetReviewability`:
|
|
34
34
|
* bulk Approve/Keep all + Reject all (a complete set is keepable as-is; a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkingLine.d.ts","sourceRoot":"","sources":["../src/components/WorkingLine.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WorkingLine.d.ts","sourceRoot":"","sources":["../src/components/WorkingLine.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGhE,qCAAqC;AACrC,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,gBAAgB,2CAkB/E"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The working turn's one line, drawn just above the composer: a spinner, what
|
|
3
|
+
// the turn is doing now and for how long, "⠋ Running a command · 1m 12s".
|
|
4
|
+
// The words come from working.ts, the derivation the browser reads too. While
|
|
5
|
+
// the turn waits on the person the spinner stops: nothing is working.
|
|
6
|
+
//
|
|
7
|
+
// The clock ticks on Ink's shared animation timer, with the spinner. A wait
|
|
8
|
+
// the server measured (a turn waiting for a sandbox) counts on from when the
|
|
9
|
+
// turn's liveness arrived, which this line remembers per liveness.
|
|
10
|
+
//
|
|
11
|
+
// Proven by __tests__/working-line.test.tsx.
|
|
12
|
+
import { useRef } from "react";
|
|
2
13
|
import { Box, Text, useAnimation } from "ink";
|
|
3
14
|
import { useRoles } from "../theme.js";
|
|
4
15
|
import { workingWords } from "../working.js";
|
|
@@ -8,7 +19,11 @@ export function WorkingLine({ turn, isSlow, isStopping, hint }) {
|
|
|
8
19
|
const role = useRoles();
|
|
9
20
|
// Re-renders each second so the time moves while nothing else does.
|
|
10
21
|
useAnimation({ interval: 1000 });
|
|
11
|
-
const
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
const arrival = useRef({ liveness: turn?.liveness, at: now });
|
|
24
|
+
if (arrival.current.liveness !== turn?.liveness)
|
|
25
|
+
arrival.current = { liveness: turn?.liveness, at: now };
|
|
26
|
+
const words = workingWords(turn, now, { isSlow, isStopping, livenessAgeMs: now - arrival.current.at });
|
|
12
27
|
const parts = [words.elapsed, hint].filter((part) => part !== undefined && part !== "");
|
|
13
28
|
return (_jsxs(Box, { gap: 1, paddingLeft: 1, children: [words.waiting ? _jsx(Text, { ...role.accent, children: "\u25CB" }) : _jsx(Spinner, { style: role.accent }), _jsxs(Text, { wrap: "truncate-end", children: [words.phrase, parts.length > 0 && _jsx(Text, { ...role.muted, children: ` · ${parts.join(" · ")}` })] })] }));
|
|
14
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkingLine.js","sourceRoot":"","sources":["../src/components/WorkingLine.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"WorkingLine.js","sourceRoot":"","sources":["../src/components/WorkingLine.tsx"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,sEAAsE;AACtE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,6CAA6C;AAE7C,OAAc,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAqB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvC,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAoB;IAC9E,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,oEAAoE;IACpE,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,CAA+D,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5H,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,QAAQ;QAAE,OAAO,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;IACzG,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACvG,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;IACxF,OAAO,CACL,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,aACxB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,IAAI,OAAK,IAAI,CAAC,MAAM,uBAAU,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,KAAK,EAAE,IAAI,CAAC,MAAM,GAAI,EAClF,MAAC,IAAI,IAAC,IAAI,EAAC,cAAc,aACtB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,IAAI,OAAK,IAAI,CAAC,KAAK,YAAG,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAQ,IACxE,IACH,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/ink-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Terminal components for Stigmer, the open-source backend for the agents in your product",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@bufbuild/protobuf": "^2.0.0",
|
|
42
|
-
"@stigmer/apis": "0.
|
|
43
|
-
"@stigmer/client": "0.
|
|
44
|
-
"@stigmer/react-core": "0.
|
|
42
|
+
"@stigmer/apis": "0.2.0",
|
|
43
|
+
"@stigmer/client": "0.2.0",
|
|
44
|
+
"@stigmer/react-core": "0.2.0",
|
|
45
45
|
"ink": "^7.0.0",
|
|
46
46
|
"react": ">=19.0.0"
|
|
47
47
|
}
|
|
@@ -10,8 +10,7 @@ import { useRoles } from "../theme.js";
|
|
|
10
10
|
*
|
|
11
11
|
* The change-kind marker is deliberately NOT here: the terminal renders kind via
|
|
12
12
|
* the pure `kindLetter` helper (in `file-review.ts`), already shared across every
|
|
13
|
-
* surface. The web
|
|
14
|
-
* per-kind color tokens and a11y labels; a plain letter needs neither.
|
|
13
|
+
* surface. (The web kit says a file's kind in words, "New" or "Deleted".)
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -82,8 +82,8 @@ interface BulkOption {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* The terminal file-review decision surface
|
|
86
|
-
*
|
|
85
|
+
* The terminal file-review decision surface, in the linear log. (The web
|
|
86
|
+
* kit lists a finished turn's files once, with Undo, under its answer.)
|
|
87
87
|
*
|
|
88
88
|
* Renders `N files awaiting review` and, gated by `changeSetReviewability`:
|
|
89
89
|
* bulk Approve/Keep all + Reject all (a complete set is keepable as-is; a
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
// The words come from working.ts, the derivation the browser reads too. While
|
|
4
4
|
// the turn waits on the person the spinner stops: nothing is working.
|
|
5
5
|
//
|
|
6
|
-
// The clock ticks on Ink's shared animation timer, with the spinner.
|
|
6
|
+
// The clock ticks on Ink's shared animation timer, with the spinner. A wait
|
|
7
|
+
// the server measured (a turn waiting for a sandbox) counts on from when the
|
|
8
|
+
// turn's liveness arrived, which this line remembers per liveness.
|
|
7
9
|
//
|
|
8
10
|
// Proven by __tests__/working-line.test.tsx.
|
|
9
11
|
|
|
10
|
-
import React from "react";
|
|
12
|
+
import React, { useRef } from "react";
|
|
11
13
|
import { Box, Text, useAnimation } from "ink";
|
|
12
14
|
import type { Turn } from "@stigmer/client";
|
|
13
15
|
import { useRoles } from "../theme.js";
|
|
@@ -27,7 +29,10 @@ export function WorkingLine({ turn, isSlow, isStopping, hint }: WorkingLineProps
|
|
|
27
29
|
const role = useRoles();
|
|
28
30
|
// Re-renders each second so the time moves while nothing else does.
|
|
29
31
|
useAnimation({ interval: 1000 });
|
|
30
|
-
const
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
const arrival = useRef<{ readonly liveness: Turn["liveness"]; readonly at: number }>({ liveness: turn?.liveness, at: now });
|
|
34
|
+
if (arrival.current.liveness !== turn?.liveness) arrival.current = { liveness: turn?.liveness, at: now };
|
|
35
|
+
const words = workingWords(turn, now, { isSlow, isStopping, livenessAgeMs: now - arrival.current.at });
|
|
31
36
|
const parts = [words.elapsed, hint].filter((part) => part !== undefined && part !== "");
|
|
32
37
|
return (
|
|
33
38
|
<Box gap={1} paddingLeft={1}>
|
package/src/working.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// The words of the terminal's working line and of the line a turn leaves
|
|
2
|
-
// when it ends, from the derivation the browser
|
|
3
|
-
// (`describeTurnActivity`
|
|
4
|
-
//
|
|
2
|
+
// when it ends, from the derivation the browser reads too
|
|
3
|
+
// (`describeTurnActivity` in @stigmer/client, and the one word table its
|
|
4
|
+
// `activityPhrase` and the browser's step lines share), so both surfaces say
|
|
5
|
+
// the same thing about the same turn.
|
|
5
6
|
//
|
|
6
7
|
// - While a turn works: what it is doing now and for how long, "Running a
|
|
7
8
|
// command · 1m 12s". Stopping, waiting on the person, and slowness take the
|
|
8
9
|
// phrase over, in that order.
|
|
10
|
+
// - While a turn waits for a sandbox with room, before it starts: how long it
|
|
11
|
+
// has waited, "Waiting for a sandbox · 1m 20s", the server's measure
|
|
12
|
+
// counted on from when its liveness arrived (`livenessAgeMs`), never the
|
|
13
|
+
// turn's own time since the message.
|
|
9
14
|
// - When a turn completes: "Worked for 1m 12s", one quiet line left in the
|
|
10
15
|
// history. A failed or stopped turn keeps its badge instead.
|
|
11
16
|
//
|
|
@@ -32,6 +37,8 @@ export interface WorkingState {
|
|
|
32
37
|
readonly isStopping?: boolean;
|
|
33
38
|
/** The turn has gone quiet for longer than usual. */
|
|
34
39
|
readonly isSlow?: boolean;
|
|
40
|
+
/** How long ago the turn's newest liveness arrived; a wait it carries counts on by this much. 0 by default. */
|
|
41
|
+
readonly livenessAgeMs?: number;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
/** The phrase a slow turn reads. */
|
|
@@ -44,6 +51,10 @@ export function workingWords(turn: Turn | null, nowMs: number, state: WorkingSta
|
|
|
44
51
|
if (turn === null) return { phrase: state.isStopping === true ? STOPPING_PHRASE : "Starting", elapsed: "", waiting: false };
|
|
45
52
|
const progress = describeTurnActivity(turn, nowMs);
|
|
46
53
|
const waiting = progress.activity.kind === "waiting_for_you";
|
|
54
|
+
if (progress.activity.kind === "waiting_for_sandbox" && state.isStopping !== true) {
|
|
55
|
+
const waitedMs = progress.activity.waitedMs + Math.max(0, state.livenessAgeMs ?? 0);
|
|
56
|
+
return { phrase: activityPhrase(progress.activity), elapsed: formatElapsed(waitedMs), waiting: false };
|
|
57
|
+
}
|
|
47
58
|
const elapsed = progress.startedAt === "" ? "" : formatElapsed(progress.elapsedMs);
|
|
48
59
|
if (state.isStopping === true) return { phrase: STOPPING_PHRASE, elapsed, waiting: false };
|
|
49
60
|
if (waiting) return { phrase: activityPhrase(progress.activity), elapsed, waiting };
|
package/working.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface WorkingState {
|
|
|
14
14
|
readonly isStopping?: boolean;
|
|
15
15
|
/** The turn has gone quiet for longer than usual. */
|
|
16
16
|
readonly isSlow?: boolean;
|
|
17
|
+
/** How long ago the turn's newest liveness arrived; a wait it carries counts on by this much. 0 by default. */
|
|
18
|
+
readonly livenessAgeMs?: number;
|
|
17
19
|
}
|
|
18
20
|
/** The phrase a slow turn reads. */
|
|
19
21
|
export declare const SLOW_PHRASE = "Still working, taking longer than usual";
|
package/working.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"working.d.ts","sourceRoot":"","sources":["src/working.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"working.d.ts","sourceRoot":"","sources":["src/working.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAuD,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEjG,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,+GAA+G;IAC/G,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,oCAAoC;AACpC,eAAO,MAAM,WAAW,4CAA4C,CAAC;AACrE,qDAAqD;AACrD,eAAO,MAAM,eAAe,mBAAc,CAAC;AAE3C,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,YAAiB,GAAG,YAAY,CAarG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAI9C"}
|
package/working.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// The words of the terminal's working line and of the line a turn leaves
|
|
2
|
-
// when it ends, from the derivation the browser
|
|
3
|
-
// (`describeTurnActivity`
|
|
4
|
-
//
|
|
2
|
+
// when it ends, from the derivation the browser reads too
|
|
3
|
+
// (`describeTurnActivity` in @stigmer/client, and the one word table its
|
|
4
|
+
// `activityPhrase` and the browser's step lines share), so both surfaces say
|
|
5
|
+
// the same thing about the same turn.
|
|
5
6
|
//
|
|
6
7
|
// - While a turn works: what it is doing now and for how long, "Running a
|
|
7
8
|
// command · 1m 12s". Stopping, waiting on the person, and slowness take the
|
|
8
9
|
// phrase over, in that order.
|
|
10
|
+
// - While a turn waits for a sandbox with room, before it starts: how long it
|
|
11
|
+
// has waited, "Waiting for a sandbox · 1m 20s", the server's measure
|
|
12
|
+
// counted on from when its liveness arrived (`livenessAgeMs`), never the
|
|
13
|
+
// turn's own time since the message.
|
|
9
14
|
// - When a turn completes: "Worked for 1m 12s", one quiet line left in the
|
|
10
15
|
// history. A failed or stopped turn keeps its badge instead.
|
|
11
16
|
//
|
|
@@ -24,6 +29,10 @@ export function workingWords(turn, nowMs, state = {}) {
|
|
|
24
29
|
return { phrase: state.isStopping === true ? STOPPING_PHRASE : "Starting", elapsed: "", waiting: false };
|
|
25
30
|
const progress = describeTurnActivity(turn, nowMs);
|
|
26
31
|
const waiting = progress.activity.kind === "waiting_for_you";
|
|
32
|
+
if (progress.activity.kind === "waiting_for_sandbox" && state.isStopping !== true) {
|
|
33
|
+
const waitedMs = progress.activity.waitedMs + Math.max(0, state.livenessAgeMs ?? 0);
|
|
34
|
+
return { phrase: activityPhrase(progress.activity), elapsed: formatElapsed(waitedMs), waiting: false };
|
|
35
|
+
}
|
|
27
36
|
const elapsed = progress.startedAt === "" ? "" : formatElapsed(progress.elapsedMs);
|
|
28
37
|
if (state.isStopping === true)
|
|
29
38
|
return { phrase: STOPPING_PHRASE, elapsed, waiting: false };
|
package/working.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"working.js","sourceRoot":"","sources":["src/working.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,
|
|
1
|
+
{"version":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