@biolibs/bionet-panels 0.3.4 → 0.3.5
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/adviser.d.ts +27 -1
- package/dist/adviser.d.ts.map +1 -1
- package/dist/adviser.js +26 -2
- package/dist/adviser.js.map +1 -1
- package/package.json +1 -1
- package/src/adviser.tsx +49 -2
package/dist/adviser.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface AdviserSeen {
|
|
|
14
14
|
ok: boolean;
|
|
15
15
|
/** When, as an ISO date. */
|
|
16
16
|
at: string;
|
|
17
|
+
/** Where in the lab it would be seen, if it has a place there, as the adviser's tools report it. */
|
|
18
|
+
shows?: unknown;
|
|
17
19
|
}
|
|
18
20
|
/** The way an agent reaches the adviser's tools on this device, as a host offers it. */
|
|
19
21
|
export interface AdviserDoor {
|
|
@@ -30,13 +32,37 @@ export interface AdviserDoor {
|
|
|
30
32
|
/** Make the token anew, shutting out whatever had the old one. */
|
|
31
33
|
renew?: () => Promise<unknown>;
|
|
32
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* What the adviser did, in a few words.
|
|
37
|
+
*
|
|
38
|
+
* @param tool - Which of its tools it used.
|
|
39
|
+
* @returns Something like `worked out a digest`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const adviserDid: (tool: string) => string;
|
|
33
42
|
/**
|
|
34
43
|
* The adviser this device hosts, and the door to it.
|
|
35
44
|
*
|
|
36
45
|
* @param props - `door` is the way an agent reaches it, for a host that has one to offer. Without
|
|
37
46
|
* it the adviser can still be hosted and let in, and something else has to carry what it says.
|
|
47
|
+
* `onWatch`, if given, adds a way to go and watch the adviser at work in the lab.
|
|
38
48
|
*/
|
|
39
|
-
export declare function Adviser({ door }: {
|
|
49
|
+
export declare function Adviser({ door, onWatch }: {
|
|
40
50
|
door?: AdviserDoor;
|
|
51
|
+
onWatch?: () => void;
|
|
52
|
+
}): ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* What the adviser is doing, said over the lab while it is being watched.
|
|
55
|
+
*
|
|
56
|
+
* Watching is following: the view goes where the adviser last looked. A person can stop following
|
|
57
|
+
* and take the controls, since what is drawn under this is the lab and its tools and not a film of them.
|
|
58
|
+
*
|
|
59
|
+
* @param props - `last` is the latest thing it did, if it has done anything; `following` is whether
|
|
60
|
+
* the view is going where it looks, and `onFollow` changes that; `onBack` leaves.
|
|
61
|
+
*/
|
|
62
|
+
export declare function AdviserStrip({ last, following, onFollow, onBack }: {
|
|
63
|
+
last: AdviserSeen | null;
|
|
64
|
+
following: boolean;
|
|
65
|
+
onFollow: (following: boolean) => void;
|
|
66
|
+
onBack: () => void;
|
|
41
67
|
}): ReactNode;
|
|
42
68
|
//# sourceMappingURL=adviser.d.ts.map
|
package/dist/adviser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adviser.d.ts","sourceRoot":"","sources":["../src/adviser.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,wCAAwC;AACxC,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"adviser.d.ts","sourceRoot":"","sources":["../src/adviser.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,wCAAwC;AACxC,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,oGAAoG;IACpG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wFAAwF;AACxF,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,uBAAuB;IACvB,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,oGAAoG;IACpG,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAChC;AASD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MAA4C,CAAC;AAEvF;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAqGlG;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;IAClE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAC;CAC1G,GAAG,SAAS,CAiBZ"}
|
package/dist/adviser.js
CHANGED
|
@@ -16,13 +16,21 @@ const TOOL_WORDS = {
|
|
|
16
16
|
design_primers: "designed a pair of primers", work_out_pcr: "worked out a PCR", work_out_digest: "worked out a digest", work_out_ligation: "worked out a ligation",
|
|
17
17
|
add_part: "added a part", propose_pcr: "proposed a PCR", propose_digest: "proposed a digest", propose_ligation: "proposed a ligation", withdraw_proposal: "took a proposal back",
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* What the adviser did, in a few words.
|
|
21
|
+
*
|
|
22
|
+
* @param tool - Which of its tools it used.
|
|
23
|
+
* @returns Something like `worked out a digest`.
|
|
24
|
+
*/
|
|
25
|
+
export const adviserDid = (tool) => TOOL_WORDS[tool] ?? `used ${tool}`;
|
|
19
26
|
/**
|
|
20
27
|
* The adviser this device hosts, and the door to it.
|
|
21
28
|
*
|
|
22
29
|
* @param props - `door` is the way an agent reaches it, for a host that has one to offer. Without
|
|
23
30
|
* it the adviser can still be hosted and let in, and something else has to carry what it says.
|
|
31
|
+
* `onWatch`, if given, adds a way to go and watch the adviser at work in the lab.
|
|
24
32
|
*/
|
|
25
|
-
export function Adviser({ door }) {
|
|
33
|
+
export function Adviser({ door, onWatch }) {
|
|
26
34
|
const state = useLab();
|
|
27
35
|
const act = useAct();
|
|
28
36
|
const [person, setPerson] = useState("Claude");
|
|
@@ -39,6 +47,22 @@ export function Adviser({ door }) {
|
|
|
39
47
|
setBusy(false);
|
|
40
48
|
} };
|
|
41
49
|
const theirs = hosting === null ? [] : lab.plans.filter((one) => one.by === hosting.key);
|
|
42
|
-
return (_jsxs(_Fragment, { children: [_jsxs("section", { className: "card", children: [_jsx("h2", { children: "An adviser on this device" }), _jsx("p", { className: "small", children: "An adviser is a member with no hands: an agent that can read what the lab holds, work things out with the lab's own tools, add a part by its sequence, and propose a run for a person to carry out." }), _jsx("p", { className: "dim small", children: "It cannot say that anything was done, used or moved. That is not a setting here: its key has the role of adviser, and every device in the lab refuses anything else it writes. What it proposes is shown at the tool that would carry it out, with its reasons, and nothing happens until a person does it." }), hosting === null ? (_jsx("button", { type: "button", disabled: busy, onClick: () => void ask(() => act("hostAdviser")), children: "Host an adviser on this device" })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "keybox", children: [_jsxs("div", { children: [_jsx("span", { className: "label", children: "The adviser's key" }), _jsx(Copy, { words: hosting.key, label: "Copy key" })] }), _jsx("code", { className: "wrap", children: hosting.key }), _jsxs("p", { className: "dim small", children: ["Fingerprint ", _jsx("code", { children: hosting.fingerprint }), ". It is a key of its own, kept on this device and apart from yours: what the adviser writes is signed with it and never with your key."] })] }), hosting.standing === "adviser" && _jsx("p", { className: "small good", role: "status", children: "It is in the lab as an adviser." }), hosting.standing === "removed" && _jsx("p", { className: "small trouble", role: "status", children: "It was removed from the lab. What it wrote until then is kept." }), (hosting.standing === "member" || hosting.standing === "keeper") && (_jsxs("p", { className: "small trouble", role: "status", children: ["This key is in the lab as a ", hosting.standing, ", which can do more than advise. Nothing is written with it from here until a keeper makes it an adviser."] })), hosting.standing === null && (lab.keeper ? (_jsxs("fieldset", { disabled: busy, className: "stack", children: [_jsx("p", { className: "small", children: "It is not in the lab yet. Until it is, it can read and work things out, and propose nothing." }), _jsxs("label", { children: ["Call it", _jsx("input", { value: person, onChange: (event) => setPerson(event.target.value), maxLength: 200, "aria-label": "What to call the adviser" })] }), _jsx("button", { type: "button", disabled: person.trim() === "", onClick: () => void ask(() => act("addMember", { key: hosting.key, person: person.trim(), role: "adviser" })), children: "Let it into the lab as an adviser" })] })) : _jsx("p", { className: "small", children: "It is not in the lab yet. Only a keeper can let it in: send them the key above, to add as an adviser." }))] }))] }), hosting !== null && door !== undefined && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "The way in" }), _jsx("p", { className: "small", children: "An agent reaches the adviser's tools through a door on this computer. It is shut until you open it, it cannot be reached from the network, and whoever comes through it needs a token that is kept sealed on this device." }), _jsxs("div", { className: "row", children: [_jsx("button", { type: "button", disabled: busy, onClick: () => void ask(() => door.turn(!door.on)), children: door.on ? "Shut the door" : "Open the door" }), _jsx("span", { className: door.on ? "small good" : "dim small", role: "status", children: door.on ? "Open, on this computer only." : "Shut. Nothing can reach the adviser." })] }), door.on && door.url !== null && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "keybox", children: [_jsx("div", { children: _jsx("span", { className: "label", children: "Where it is" }) }), _jsx("code", { className: "wrap", children: door.url })] }), _jsxs("div", { className: "row", children: [_jsx("button", { type: "button", className: "quiet", disabled: busy, onClick: () => void ask(async () => { await door.copy(); setCopied(true); setTimeout(() => setCopied(false), 2500); }), children: copied ? "Copied" : "Copy the command that connects Claude Code" }), door.renew !== undefined && _jsx("button", { type: "button", className: "quiet", disabled: busy, onClick: () => void ask(() => door.renew()), children: "Make a new token" })] }), _jsx("p", { className: "dim small", children: "The command carries the token, so it goes to the clipboard and is not shown here. Paste it into a terminal once. A new token shuts the door and shuts out whatever had the old one." })] }))] })), hosting !== null && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "What it has done" }), theirs.length === 0 ? _jsx("p", { className: "dim small", children: "It has proposed nothing." }) : (_jsxs("p", { className: "small", children: ["It has proposed ", theirs.length, " ", theirs.length === 1 ? "run" : "runs", ": ", theirs.filter((one) => one.settled === null).length, " open,", " ", theirs.filter((one) => one.settled !== null && one.settled.run !== null).length, " carried out, ", theirs.filter((one) => one.settled !== null && one.settled.run === null).length, " set aside. Each is at its tool, under Proposed."] })), door?.seen !== undefined && door.seen.length > 0 && (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "When" }), _jsx("th", { children: "It" }), _jsx("th", {})] }) }), _jsx("tbody", { children: [...door.seen].reverse().slice(0, 12).map((one, at) => (_jsxs("tr", { children: [_jsx("td", { className: "dim", children: new Date(one.at).toLocaleTimeString() }), _jsx("td", { children:
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsxs("section", { className: "card", children: [_jsx("h2", { children: "An adviser on this device" }), _jsx("p", { className: "small", children: "An adviser is a member with no hands: an agent that can read what the lab holds, work things out with the lab's own tools, add a part by its sequence, and propose a run for a person to carry out." }), _jsx("p", { className: "dim small", children: "It cannot say that anything was done, used or moved. That is not a setting here: its key has the role of adviser, and every device in the lab refuses anything else it writes. What it proposes is shown at the tool that would carry it out, with its reasons, and nothing happens until a person does it." }), hosting === null ? (_jsx("button", { type: "button", disabled: busy, onClick: () => void ask(() => act("hostAdviser")), children: "Host an adviser on this device" })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "keybox", children: [_jsxs("div", { children: [_jsx("span", { className: "label", children: "The adviser's key" }), _jsx(Copy, { words: hosting.key, label: "Copy key" })] }), _jsx("code", { className: "wrap", children: hosting.key }), _jsxs("p", { className: "dim small", children: ["Fingerprint ", _jsx("code", { children: hosting.fingerprint }), ". It is a key of its own, kept on this device and apart from yours: what the adviser writes is signed with it and never with your key."] })] }), hosting.standing === "adviser" && _jsx("p", { className: "small good", role: "status", children: "It is in the lab as an adviser." }), hosting.standing === "removed" && _jsx("p", { className: "small trouble", role: "status", children: "It was removed from the lab. What it wrote until then is kept." }), (hosting.standing === "member" || hosting.standing === "keeper") && (_jsxs("p", { className: "small trouble", role: "status", children: ["This key is in the lab as a ", hosting.standing, ", which can do more than advise. Nothing is written with it from here until a keeper makes it an adviser."] })), hosting.standing === null && (lab.keeper ? (_jsxs("fieldset", { disabled: busy, className: "stack", children: [_jsx("p", { className: "small", children: "It is not in the lab yet. Until it is, it can read and work things out, and propose nothing." }), _jsxs("label", { children: ["Call it", _jsx("input", { value: person, onChange: (event) => setPerson(event.target.value), maxLength: 200, "aria-label": "What to call the adviser" })] }), _jsx("button", { type: "button", disabled: person.trim() === "", onClick: () => void ask(() => act("addMember", { key: hosting.key, person: person.trim(), role: "adviser" })), children: "Let it into the lab as an adviser" })] })) : _jsx("p", { className: "small", children: "It is not in the lab yet. Only a keeper can let it in: send them the key above, to add as an adviser." }))] }))] }), hosting !== null && door !== undefined && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "The way in" }), _jsx("p", { className: "small", children: "An agent reaches the adviser's tools through a door on this computer. It is shut until you open it, it cannot be reached from the network, and whoever comes through it needs a token that is kept sealed on this device." }), _jsxs("div", { className: "row", children: [_jsx("button", { type: "button", disabled: busy, onClick: () => void ask(() => door.turn(!door.on)), children: door.on ? "Shut the door" : "Open the door" }), _jsx("span", { className: door.on ? "small good" : "dim small", role: "status", children: door.on ? "Open, on this computer only." : "Shut. Nothing can reach the adviser." })] }), door.on && door.url !== null && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "keybox", children: [_jsx("div", { children: _jsx("span", { className: "label", children: "Where it is" }) }), _jsx("code", { className: "wrap", children: door.url })] }), _jsxs("div", { className: "row", children: [_jsx("button", { type: "button", className: "quiet", disabled: busy, onClick: () => void ask(async () => { await door.copy(); setCopied(true); setTimeout(() => setCopied(false), 2500); }), children: copied ? "Copied" : "Copy the command that connects Claude Code" }), door.renew !== undefined && _jsx("button", { type: "button", className: "quiet", disabled: busy, onClick: () => void ask(() => door.renew()), children: "Make a new token" })] }), _jsx("p", { className: "dim small", children: "The command carries the token, so it goes to the clipboard and is not shown here. Paste it into a terminal once. A new token shuts the door and shuts out whatever had the old one." })] }))] })), hosting !== null && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "What it has done" }), theirs.length === 0 ? _jsx("p", { className: "dim small", children: "It has proposed nothing." }) : (_jsxs("p", { className: "small", children: ["It has proposed ", theirs.length, " ", theirs.length === 1 ? "run" : "runs", ": ", theirs.filter((one) => one.settled === null).length, " open,", " ", theirs.filter((one) => one.settled !== null && one.settled.run !== null).length, " carried out, ", theirs.filter((one) => one.settled !== null && one.settled.run === null).length, " set aside. Each is at its tool, under Proposed."] })), door?.seen !== undefined && door.seen.length > 0 && (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "When" }), _jsx("th", { children: "It" }), _jsx("th", {})] }) }), _jsx("tbody", { children: [...door.seen].reverse().slice(0, 12).map((one, at) => (_jsxs("tr", { children: [_jsx("td", { className: "dim", children: new Date(one.at).toLocaleTimeString() }), _jsx("td", { children: adviserDid(one.tool) }), _jsx("td", { children: one.ok ? "" : _jsx("span", { className: "badge", children: "could not" }) })] }, `${one.at} ${at}`))) })] })), onWatch !== undefined && (_jsxs("div", { className: "row", children: [_jsx("button", { type: "button", onClick: onWatch, children: "Watch it work" }), _jsx("span", { className: "dim small", children: "The lab, with the view going wherever the adviser is looking." })] })), _jsx("p", { className: "dim small", children: "Everything it writes is in History under its own name, like anybody's." })] }))] }));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* What the adviser is doing, said over the lab while it is being watched.
|
|
54
|
+
*
|
|
55
|
+
* Watching is following: the view goes where the adviser last looked. A person can stop following
|
|
56
|
+
* and take the controls, since what is drawn under this is the lab and its tools and not a film of them.
|
|
57
|
+
*
|
|
58
|
+
* @param props - `last` is the latest thing it did, if it has done anything; `following` is whether
|
|
59
|
+
* the view is going where it looks, and `onFollow` changes that; `onBack` leaves.
|
|
60
|
+
*/
|
|
61
|
+
export function AdviserStrip({ last, following, onFollow, onBack }) {
|
|
62
|
+
const state = useLab();
|
|
63
|
+
const hosting = state?.hosting ?? null;
|
|
64
|
+
const name = state?.lab?.roster.find((one) => one.key === hosting?.key)?.person ?? "The adviser";
|
|
65
|
+
return (_jsxs("section", { className: "card adviserstrip", "aria-live": "polite", children: [_jsxs("div", { className: "row", children: [_jsx("p", { children: last === null ? _jsxs("span", { className: "dim", children: [name, " has not done anything yet. What it does will be shown here, where it does it."] })
|
|
66
|
+
: _jsxs(_Fragment, { children: [_jsx("strong", { children: name }), " ", adviserDid(last.tool), last.ok ? "" : ", and could not", " ", _jsxs("span", { className: "dim small", children: ["at ", new Date(last.at).toLocaleTimeString()] })] }) }), _jsxs("label", { className: "check small", children: [_jsx("input", { type: "checkbox", checked: following, onChange: (event) => onFollow(event.target.checked) }), " Follow it"] }), _jsx("button", { type: "button", className: "quiet", onClick: onBack, children: "Back" })] }), !following && _jsx("p", { className: "dim small", children: "You have the controls. What it does next is still listed, and the view stays where you put it." })] }));
|
|
43
67
|
}
|
|
44
68
|
//# sourceMappingURL=adviser.js.map
|
package/dist/adviser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adviser.js","sourceRoot":"","sources":["../src/adviser.t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Seen {
|
|
|
19
19
|
ok: boolean;
|
|
20
20
|
/** When, as an ISO date. */
|
|
21
21
|
at: string;
|
|
22
|
+
/** Where in the lab it would be seen, if it has a place there, as the adviser's tools report it. */
|
|
23
|
+
shows?: unknown;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
/** The way an agent reaches the adviser's tools on this device, as a host offers it. */
|
|
@@ -44,13 +46,22 @@ const TOOL_WORDS: Readonly<Record<string, string>> = {
|
|
|
44
46
|
add_part: "added a part", propose_pcr: "proposed a PCR", propose_digest: "proposed a digest", propose_ligation: "proposed a ligation", withdraw_proposal: "took a proposal back",
|
|
45
47
|
};
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* What the adviser did, in a few words.
|
|
51
|
+
*
|
|
52
|
+
* @param tool - Which of its tools it used.
|
|
53
|
+
* @returns Something like `worked out a digest`.
|
|
54
|
+
*/
|
|
55
|
+
export const adviserDid = (tool: string): string => TOOL_WORDS[tool] ?? `used ${tool}`;
|
|
56
|
+
|
|
47
57
|
/**
|
|
48
58
|
* The adviser this device hosts, and the door to it.
|
|
49
59
|
*
|
|
50
60
|
* @param props - `door` is the way an agent reaches it, for a host that has one to offer. Without
|
|
51
61
|
* it the adviser can still be hosted and let in, and something else has to carry what it says.
|
|
62
|
+
* `onWatch`, if given, adds a way to go and watch the adviser at work in the lab.
|
|
52
63
|
*/
|
|
53
|
-
export function Adviser({ door }: { door?: AdviserDoor }): ReactNode {
|
|
64
|
+
export function Adviser({ door, onWatch }: { door?: AdviserDoor; onWatch?: () => void }): ReactNode {
|
|
54
65
|
const state = useLab();
|
|
55
66
|
const act = useAct();
|
|
56
67
|
const [person, setPerson] = useState("Claude");
|
|
@@ -133,16 +144,52 @@ export function Adviser({ door }: { door?: AdviserDoor }): ReactNode {
|
|
|
133
144
|
{[...door.seen].reverse().slice(0, 12).map((one, at) => (
|
|
134
145
|
<tr key={`${one.at} ${at}`}>
|
|
135
146
|
<td className="dim">{new Date(one.at).toLocaleTimeString()}</td>
|
|
136
|
-
<td>{
|
|
147
|
+
<td>{adviserDid(one.tool)}</td>
|
|
137
148
|
<td>{one.ok ? "" : <span className="badge">could not</span>}</td>
|
|
138
149
|
</tr>
|
|
139
150
|
))}
|
|
140
151
|
</tbody>
|
|
141
152
|
</table>
|
|
142
153
|
)}
|
|
154
|
+
{onWatch !== undefined && (
|
|
155
|
+
<div className="row">
|
|
156
|
+
<button type="button" onClick={onWatch}>Watch it work</button>
|
|
157
|
+
<span className="dim small">The lab, with the view going wherever the adviser is looking.</span>
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
143
160
|
<p className="dim small">Everything it writes is in History under its own name, like anybody's.</p>
|
|
144
161
|
</section>
|
|
145
162
|
)}
|
|
146
163
|
</>
|
|
147
164
|
);
|
|
148
165
|
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* What the adviser is doing, said over the lab while it is being watched.
|
|
169
|
+
*
|
|
170
|
+
* Watching is following: the view goes where the adviser last looked. A person can stop following
|
|
171
|
+
* and take the controls, since what is drawn under this is the lab and its tools and not a film of them.
|
|
172
|
+
*
|
|
173
|
+
* @param props - `last` is the latest thing it did, if it has done anything; `following` is whether
|
|
174
|
+
* the view is going where it looks, and `onFollow` changes that; `onBack` leaves.
|
|
175
|
+
*/
|
|
176
|
+
export function AdviserStrip({ last, following, onFollow, onBack }: {
|
|
177
|
+
last: AdviserSeen | null; following: boolean; onFollow: (following: boolean) => void; onBack: () => void;
|
|
178
|
+
}): ReactNode {
|
|
179
|
+
const state = useLab();
|
|
180
|
+
const hosting = state?.hosting ?? null;
|
|
181
|
+
const name = state?.lab?.roster.find((one) => one.key === hosting?.key)?.person ?? "The adviser";
|
|
182
|
+
return (
|
|
183
|
+
<section className="card adviserstrip" aria-live="polite">
|
|
184
|
+
<div className="row">
|
|
185
|
+
<p>
|
|
186
|
+
{last === null ? <span className="dim">{name} has not done anything yet. What it does will be shown here, where it does it.</span>
|
|
187
|
+
: <><strong>{name}</strong> {adviserDid(last.tool)}{last.ok ? "" : ", and could not"} <span className="dim small">at {new Date(last.at).toLocaleTimeString()}</span></>}
|
|
188
|
+
</p>
|
|
189
|
+
<label className="check small"><input type="checkbox" checked={following} onChange={(event) => onFollow(event.target.checked)} /> Follow it</label>
|
|
190
|
+
<button type="button" className="quiet" onClick={onBack}>Back</button>
|
|
191
|
+
</div>
|
|
192
|
+
{!following && <p className="dim small">You have the controls. What it does next is still listed, and the view stays where you put it.</p>}
|
|
193
|
+
</section>
|
|
194
|
+
);
|
|
195
|
+
}
|