lab-kit-cli 1.7.0__tar.gz → 1.9.0__tar.gz
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.
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/CHANGELOG.md +20 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/PKG-INFO +1 -1
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/docs/model.md +24 -7
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/pyproject.toml +1 -1
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/skills/lab-work/SKILL.md +1 -1
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/__init__.py +1 -1
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/record.py +35 -3
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/site.py +69 -26
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_parked.py +1 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_site.py +32 -6
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_states.py +24 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/.github/workflows/ci.yml +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/.github/workflows/policy.yml +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/.github/workflows/release.yml +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/.gitignore +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/AGENTS.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/CLAUDE.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/CONTRIBUTING.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/LICENSE +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/README.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/agents/reviewer.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/method/METHOD.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/skills/lab-mission/SKILL.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/skills/lab-review/SKILL.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/skills/lab-set-up/SKILL.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/skills/lab-talk/SKILL.md +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/checks.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/cli.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/history.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/runs.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/supervise.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/views.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/src/lab_kit/write.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_flow.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_held.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_integrity.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_mission.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_needs.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_order.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_refusals.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_vocabulary.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tests/test_wording.py +0 -0
- {lab_kit_cli-1.7.0 → lab_kit_cli-1.9.0}/tools/import_run.py +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
- **A Missions page** on the site, compact like Decisions: the current first, then the next, then the closed.
|
|
6
|
+
Each mission shows its status mark, the decision it carries, what it is for, its steps as marks with how many
|
|
7
|
+
are closed, its last log line, and its rules and log folded. The rail lists the page with how many are current,
|
|
8
|
+
and Now's mission line links to it.
|
|
9
|
+
|
|
10
|
+
## 1.8.0
|
|
11
|
+
|
|
12
|
+
- **A question with nothing left under it is the agent's next step.** `lab now` ("Yours next") and Now's "Next for
|
|
13
|
+
the agent" list every open question that no open decision holds and that has no step open, waiting or running
|
|
14
|
+
under it: answer it, add the next experiment, or bring parking it to the operator. An open goal whose questions are
|
|
15
|
+
all answered, parked or dropped is listed too, to be closed in a decision, and so is an open goal with no question yet. Before, such a question was listed
|
|
16
|
+
nowhere, and stayed open in silence once its last experiment finished or a decision dropped its last step. The
|
|
17
|
+
skill `lab-work` changed: run `lab init` in a lab after upgrading.
|
|
18
|
+
- **An answer is written as itself, in a box:** yes, no, mixed or found, in the ink's colour, on Now and in the lists
|
|
19
|
+
of a lab's pages; the page header says "answered no" in the same box. Where only a sign fits, as in the rail and the
|
|
20
|
+
rows of marks, it is the word's first letter in a small box. It was a bare letter followed by "answered yes".
|
|
21
|
+
- **No key** on Now or in the rail: every mark names its state on hover.
|
|
22
|
+
|
|
3
23
|
## 1.7.0
|
|
4
24
|
|
|
5
25
|
Two kinds of question, and the site draws every state with one mark, the same on every page.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lab-kit-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: A research lab's record, its method, and the command that keeps both.
|
|
5
5
|
Project-URL: Homepage, https://github.com/pierg/lab-kit
|
|
6
6
|
Project-URL: Issues, https://github.com/pierg/lab-kit/issues
|
|
@@ -289,6 +289,16 @@ never come back, with `dropped: <why>` on its card; park one that may.
|
|
|
289
289
|
its reason, whether or not its card says so: the card needs no edit, and none can be forgotten. A goal is closed by `reached: true` or
|
|
290
290
|
`dropped: <why>`, and a dropped goal drops every question under it.
|
|
291
291
|
|
|
292
|
+
**Nothing is left in silence.** An answer is never worked out from the experiments: everything under a
|
|
293
|
+
question being done can mean that it is answered or that the next experiment is due, and only someone reading
|
|
294
|
+
the question can tell. So `lab now` ("Yours next") and Now's "Next for the agent" list, after the steps the
|
|
295
|
+
agent can move, every open question that no open decision holds and that has no step open, waiting or running
|
|
296
|
+
under it, with what is next on it: to answer it, add the next experiment or bring parking it to you when an
|
|
297
|
+
experiment under it finished and is not void; to add an experiment, or bring parking or dropping it to you,
|
|
298
|
+
when none did; to plan its first experiment when nothing is under it yet. An open goal whose every question is
|
|
299
|
+
answered, parked or dropped is listed too: closing it is brought to you in a decision; and so is an open goal
|
|
300
|
+
with no question yet, whose first question is brought to you in a decision.
|
|
301
|
+
|
|
292
302
|
**The order of the work.** What the agent takes up first is agreed with you, and a settled decision records
|
|
293
303
|
it: `order:` lists goals, questions and steps, first to last. `lab now` ("Yours next", "Not yours to move yet")
|
|
294
304
|
and the site's Now page list steps in that order. A step takes the place of its own id where the order names it,
|
|
@@ -471,7 +481,13 @@ A folder is named after its card's title, so a short title gives a short path.
|
|
|
471
481
|
## 7. The site
|
|
472
482
|
|
|
473
483
|
Now (the dashboard), a page per goal, question, experiment, build, reading and decision, Decisions,
|
|
474
|
-
Log, Resources, Glossary. Every page has the copy-path control.
|
|
484
|
+
Missions (when the lab has any), Log, Resources, Glossary. Every page has the copy-path control.
|
|
485
|
+
|
|
486
|
+
**Missions** lists every mission compactly, as Decisions lists decisions: the current first, then the next,
|
|
487
|
+
then the closed, the latest first. Each shows its status as a mark, the decision it carries, what it is for,
|
|
488
|
+
the steps its decision orders as one mark each with how many are closed, its last log line, and its rules
|
|
489
|
+
and whole log folded. The rail names the page, with how many missions are current; Now's mission line
|
|
490
|
+
links to it.
|
|
475
491
|
|
|
476
492
|
**The rail** on the left of every page is the lab as a tree: each goal, its questions under it, and
|
|
477
493
|
each question's steps under that. A row shows a mark for its type (G, Q, E, B, R), its short id, its
|
|
@@ -485,14 +501,16 @@ its end.
|
|
|
485
501
|
**One mark for each state, everywhere.** Every word a page uses for where something stands has one
|
|
486
502
|
mark, a shape in a colour, and it is the same on Now, in the rail, in the page header, in a list of
|
|
487
503
|
steps and in a list of runs: open ○, waiting ‖, running ● (it pulses), parked ◇, done ✓, replaced and
|
|
488
|
-
dropped –; a question answered yes, no, mixed or found
|
|
489
|
-
|
|
504
|
+
dropped –; a question answered yes, no, mixed or found shows its answer as the word itself in a box (where only a
|
|
505
|
+
sign fits, as in the rail, the word's first letter, Y, N, M or F), in the ink's colour, since an answer is a finding
|
|
506
|
+
and never good or bad; an experiment confirmed ✓, refuted ✗, unclear ?, void !; a decision to
|
|
490
507
|
discuss ◆ or decided ✓; a run running, finished ✓ or failed ✗, and a review passed ✓ or failed ✗. The
|
|
491
508
|
shape carries the meaning, so colour is never the only signal. Where a page writes a state out, it
|
|
492
|
-
writes the mark and the word, in the mark's colour
|
|
509
|
+
writes the mark and the word, in the mark's colour; an answer is written as its boxed word alone, except in the
|
|
510
|
+
page header, which says "answered no" in a box. A goal or a question that is open or waiting with a
|
|
493
511
|
step running under it shows as running, its mark pulsing, with the running steps named on hover; its
|
|
494
512
|
state in the record does not change. A log line's kind (found, stuck, decided) is a kind of event, not
|
|
495
|
-
a state, and is drawn without colour.
|
|
513
|
+
a state, and is drawn without colour. There is no key: every mark names its state on hover.
|
|
496
514
|
|
|
497
515
|
**How a page of a card reads.** Every page of a goal, a question or a step reads in the same order:
|
|
498
516
|
|
|
@@ -531,8 +549,7 @@ what is live at this moment (each run going, the current mission with the last l
|
|
|
531
549
|
the agent says it is on), each with a pulsing mark, and when the record last moved; what needs you (the
|
|
532
550
|
open decisions) and what is next for the agent, in the agreed order of the work; the map, one row per
|
|
533
551
|
goal with its mark and how many of its questions are answered, and one tile per live question with its
|
|
534
|
-
mark and its state written out (its answer once answered) and one mark per step in tree order,
|
|
535
|
-
them the key; what each resource has used of its grant, as a bar; the
|
|
552
|
+
mark and its state written out (its answer once answered) and one mark per step in tree order; what each resource has used of its grant, as a bar; the
|
|
536
553
|
latest events. There is no graph page: the rail is the tree and Now is the map.
|
|
537
554
|
|
|
538
555
|
**An example on every question.** A question's page carries one case, step by step, as a numbered
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
dynamic = ["readme"]
|
|
7
7
|
name = "lab-kit-cli"
|
|
8
|
-
version = "1.
|
|
8
|
+
version = "1.9.0"
|
|
9
9
|
description = "A research lab's record, its method, and the command that keeps both."
|
|
10
10
|
license = "MIT"
|
|
11
11
|
authors = [{ name = "Piergiuseppe Mallozzi" }]
|
|
@@ -239,7 +239,7 @@ repository, tests first. When it works, put `commits:` and `tests:` on the card
|
|
|
239
239
|
|
|
240
240
|
## When all experiments of a question are done
|
|
241
241
|
|
|
242
|
-
Decide whether they answer it. For a test, `lab answer <question> yes|no|mixed "<what the answer rests
|
|
242
|
+
`lab now` lists such a question under **Yours next**, and a goal whose questions are all settled. Decide whether they answer it. For a test, `lab answer <question> yes|no|mixed "<what the answer rests
|
|
243
243
|
on>"`: yes and no say whether what the question expected held; mixed says part held and part did not,
|
|
244
244
|
and the sentence says which. For an estimate, `lab answer <question> found "<the finding, with its range
|
|
245
245
|
or its shape, and what it rests on>"`. Then bring **So far** up to date. An answer rests on a done experiment that is not
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""lab-kit: a research lab's record, its method, and the command that keeps both."""
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.9.0"
|
|
@@ -779,7 +779,7 @@ class Lab:
|
|
|
779
779
|
place = {}
|
|
780
780
|
for i, ident in enumerate(d["order"]):
|
|
781
781
|
place.setdefault(ident, i)
|
|
782
|
-
rank = lambda x: next((place[i] for i in (x["id"], x
|
|
782
|
+
rank = lambda x: next((place[i] for i in (x["id"], x.get("question"), x.get("goal")) if i in place), len(d["order"]))
|
|
783
783
|
return sorted(steps, key=rank) # a stable sort: what shares a place keeps the order of the tree
|
|
784
784
|
|
|
785
785
|
def set_aside(self):
|
|
@@ -1155,8 +1155,40 @@ class Lab:
|
|
|
1155
1155
|
return sum(v for v in ((r.get("used") or {}).get(name, 0) for r in x["runs"] + x["trials"]) if amount(v))
|
|
1156
1156
|
|
|
1157
1157
|
def yours(self):
|
|
1158
|
-
"""
|
|
1159
|
-
|
|
1158
|
+
"""Everything the agent can move now, with what is next on each: the steps, then the questions and goals that
|
|
1159
|
+
have nothing left under them to move."""
|
|
1160
|
+
return self.in_order([x for x in self.items if x["mine"]] + self.to_settle())
|
|
1161
|
+
|
|
1162
|
+
def to_settle(self):
|
|
1163
|
+
"""The open questions with no step open, waiting or running under them, and the open goals whose every question
|
|
1164
|
+
is settled or that have none yet, each with what is next on it. Only someone reading the question can tell whether what finished
|
|
1165
|
+
answers it, so nothing here is worked out into an answer: it is listed so that it is never left in silence.
|
|
1166
|
+
What an open decision holds waits on the decision and is not listed. The text goes on the node as its `next`,
|
|
1167
|
+
as a step's does; a Lab is read afresh for every command."""
|
|
1168
|
+
out = []
|
|
1169
|
+
for g in self.goals:
|
|
1170
|
+
if g["state"] != "open" or self.holding(g["id"]):
|
|
1171
|
+
continue
|
|
1172
|
+
for q in g["questions"]:
|
|
1173
|
+
if q["state"] != "open" or self.holding(q["id"]) or any(x["state"] not in CLOSED for x in q["items"]):
|
|
1174
|
+
continue
|
|
1175
|
+
usable = [x["id"] for x in q["items"] if x["type"] == "experiment" and x["state"] == "done" and x.get("outcome") != "void"]
|
|
1176
|
+
if usable:
|
|
1177
|
+
q["next"] = (f"every step under it is closed and {', '.join(usable)} finished: answer it (lab answer {q['id']} ...), "
|
|
1178
|
+
"add the next experiment, or bring parking it to the operator in a decision")
|
|
1179
|
+
elif q["items"]:
|
|
1180
|
+
q["next"] = ("no step is left under it and no experiment finished that is not void: add an experiment, "
|
|
1181
|
+
"or bring parking or dropping it to the operator in a decision")
|
|
1182
|
+
else:
|
|
1183
|
+
q["next"] = f"nothing under it yet: plan its first experiment (lab new experiment {q['id']} \"<title>\")"
|
|
1184
|
+
out.append(q)
|
|
1185
|
+
if not g["questions"]:
|
|
1186
|
+
g["next"] = "no question under it yet: bring its first question to the operator in a decision"
|
|
1187
|
+
out.append(g)
|
|
1188
|
+
elif all(q["state"] in ("done", "parked", "dropped") for q in g["questions"]):
|
|
1189
|
+
g["next"] = "every question under it is answered, parked or dropped: bring closing it (reached or dropped) to the operator in a decision"
|
|
1190
|
+
out.append(g)
|
|
1191
|
+
return out
|
|
1160
1192
|
|
|
1161
1193
|
def since(self, day=None):
|
|
1162
1194
|
"""What happened since the last decision was recorded, or since a day."""
|
|
@@ -25,12 +25,6 @@ MEANS = {"running": "running", "waiting": "waiting", "open": "open", "done": "do
|
|
|
25
25
|
"mixed": "answered mixed", "found": "found", "unclear": "unclear", "refuted": "refuted", "void": "void", "parked": "parked",
|
|
26
26
|
"replaced": "replaced", "dropped": "dropped", "to discuss": "to discuss", "decided": "decided",
|
|
27
27
|
"finished": "finished", "failed": "failed", "pass": "passed", "fail": "failed"}
|
|
28
|
-
# The key, on Now and in the rail: one group per kind of card, each word with the mark it has everywhere.
|
|
29
|
-
LEGEND = (("Any card", ("open", "waiting", "running", "parked", "done", "replaced", "dropped")),
|
|
30
|
-
("A question, answered", ("yes", "no", "mixed", "found")),
|
|
31
|
-
("An experiment, done", ("confirmed", "refuted", "unclear", "void")),
|
|
32
|
-
("A decision", ("to discuss", "decided")),
|
|
33
|
-
("A run, a review", ("running", "finished", "pass", "failed")))
|
|
34
28
|
HINT = {"running": "work under way; on a goal or a question, a step under it is running", "waiting": "held by a step it needs, a decision or something outside the lab",
|
|
35
29
|
"parked": "set aside by a decision", "void": "its results review failed: its numbers are never used", "replaced": "redone by a newer experiment",
|
|
36
30
|
"dropped": "will not be done", "to discuss": "open: waits for you", "found": "an estimate, answered with what was found", "failed": "a run that stopped with an error, or a review that did not pass"}
|
|
@@ -99,7 +93,7 @@ def key(n):
|
|
|
99
93
|
|
|
100
94
|
|
|
101
95
|
def label(n):
|
|
102
|
-
"""A node's state as the operator reads it, in the words
|
|
96
|
+
"""A node's state as the operator reads it, in the words every page uses: on done, a question shows its answer and an
|
|
103
97
|
experiment its outcome."""
|
|
104
98
|
return MEANS.get(key(n), key(n))
|
|
105
99
|
|
|
@@ -128,7 +122,7 @@ def pill(text, t="plain"):
|
|
|
128
122
|
|
|
129
123
|
|
|
130
124
|
def mark(k, title=""):
|
|
131
|
-
"""The mark of a
|
|
125
|
+
"""The mark of a state or a label: its sign in its tone, the same shape and colour on every page and in the rail.
|
|
132
126
|
Running pulses."""
|
|
133
127
|
t, g = LOOK.get(k, ("plain", "\u25cb"))
|
|
134
128
|
return f'<span class="sg t-{t}{" live" if k == "running" else ""}" title="{e(title or MEANS.get(k, k))}">{g}</span>'
|
|
@@ -146,24 +140,25 @@ def status(n):
|
|
|
146
140
|
|
|
147
141
|
|
|
148
142
|
def word(k, title=""):
|
|
149
|
-
"""A
|
|
143
|
+
"""A state or a label written out: its mark and the word, in its tone. An answer is written as itself, in a box
|
|
144
|
+
(yes, no, mixed, found): the box is its mark, and the word is the finding."""
|
|
150
145
|
t = LOOK.get(k, ("plain", ""))[0]
|
|
146
|
+
if t == "ink":
|
|
147
|
+
return f'<span class="ans" title="{e(title or HINT.get(k, MEANS.get(k, k)))}">{e(k)}</span>'
|
|
151
148
|
return f'<span class="stw t-{t}" title="{e(title or HINT.get(k, MEANS.get(k, k)))}">{mark(k, title)}{e(MEANS.get(k, k))}</span>'
|
|
152
149
|
|
|
153
150
|
|
|
154
|
-
def legend_html():
|
|
155
|
-
"""The key on Now: every mark the site draws, by the kind of card it is on."""
|
|
156
|
-
rows = "".join(f'<div><b>{e(group)}</b>' + "".join(word(k) for k in keys) + "</div>" for group, keys in LEGEND)
|
|
157
|
-
return f'<div class="legend">{rows}</div>'
|
|
158
|
-
|
|
159
|
-
|
|
160
151
|
def header_css():
|
|
161
152
|
"""folio's page header shows the view's status as a pill: draw it with the same mark and tone as everywhere else."""
|
|
162
153
|
soft = {"ok": "ok-soft", "warn": "warn-soft", "bad": "bad-soft", "info": "info-soft"}
|
|
163
|
-
|
|
154
|
+
# The rail's answers: the letter boxed, as in a row of marks on a lab page.
|
|
155
|
+
out = ['.f-vsign[data-t="ink"]{border:1px solid var(--ink-3);border-radius:3px;padding:0 .2em;min-width:0;font-size:.62rem;line-height:1.2}']
|
|
164
156
|
for k, (t, g) in LOOK.items():
|
|
165
157
|
fg = {"plain": "ink-3", "gone": "ink-3", "ink": "ink"}.get(t, t)
|
|
166
158
|
sel = f'.f-status[data-s="{MEANS.get(k, k)}"]'
|
|
159
|
+
if t == "ink": # an answer: the words alone, boxed, as on every lab page
|
|
160
|
+
out.append(f'{sel}{{background:none;color:var(--ink);border:1px solid var(--ink-3)}}{sel}::before{{display:none}}')
|
|
161
|
+
continue
|
|
167
162
|
out.append(f'{sel}{{background:var(--{soft.get(t, "sunk")});color:var(--{fg})}}'
|
|
168
163
|
f'{sel}::before{{content:"{g}";width:auto;height:auto;border-radius:0;background:none;opacity:1;font-weight:700}}')
|
|
169
164
|
if k == "running":
|
|
@@ -171,6 +166,54 @@ def header_css():
|
|
|
171
166
|
return "".join(out)
|
|
172
167
|
|
|
173
168
|
|
|
169
|
+
# A mission's status reads as a card's state: next as open, current as running, done as done, stopped as dropped.
|
|
170
|
+
MISSION_KEY = {"next": "open", "current": "running", "done": "done", "stopped": "dropped"}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def mission_mark(m):
|
|
174
|
+
return mark(MISSION_KEY.get(m["state"], "open"), m["state"])
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def mission_box(lab, T, m):
|
|
178
|
+
"""One mission, compact: what it carries and where it stands, its steps as marks, its last line, and its log folded."""
|
|
179
|
+
d = lab.nodes.get(m["carries"])
|
|
180
|
+
carries = named(lab, d["id"]) if d and d["type"] == "decision" else '<span class="muted">no decision: lab check says why</span>'
|
|
181
|
+
started = next((l for l in m["log"] if l.get("what") == "launched"), None)
|
|
182
|
+
head = (f'{e(m["id"])} · {mission_mark(m)} {e(m["state"])} · carries {carries}'
|
|
183
|
+
+ (f' · launched {nice(started["day"])}' if started else ""))
|
|
184
|
+
rows = []
|
|
185
|
+
if L.flat(m["description"]):
|
|
186
|
+
rows.append(("For", T(L.flat(m["description"]))))
|
|
187
|
+
steps = lab.mission_steps(m)
|
|
188
|
+
if steps:
|
|
189
|
+
done = sum(x["state"] in L.CLOSED for x in steps)
|
|
190
|
+
rows.append(("Steps", f'{done} of {len(steps)} closed <span class="marks">' + "".join(dot(x, f'{x["id"]} {x["title"]}: {label(x)}') for x in steps) + "</span>"))
|
|
191
|
+
lines = [l for l in m["log"] if l.get("what")]
|
|
192
|
+
if lines:
|
|
193
|
+
last = lines[-1]
|
|
194
|
+
rows.append(("Last", f'<span class="muted">{nice(last["day"])} {e(last["time"])}</span> {T(last["what"])}'))
|
|
195
|
+
if L.flat(m["slots"].get("Rules", "")):
|
|
196
|
+
rows.append(("Rules", f'<details><summary>the rules of this mission</summary>{block(T, m["slots"]["Rules"])}</details>'))
|
|
197
|
+
if len(lines) > 1:
|
|
198
|
+
rows.append(("Log", f'<details><summary>{len(lines)} lines</summary><ul class="mlog">'
|
|
199
|
+
+ "".join(f'<li><span class="muted">{nice(l["day"])} {e(l["time"])}</span> {T(l["what"])}</li>' for l in lines) + "</ul></details>"))
|
|
200
|
+
return (f'<div class="box mission m-{e(m["state"])}" id="{e(m["id"])}"><div class="decisionhead">{head}</div>'
|
|
201
|
+
f'<p class="decisionq">{e(m["title"] or m["path"])}</p>'
|
|
202
|
+
'<dl class="decisionrows">' + "".join(f"<dt>{k}</dt><dd>{v}</dd>" for k, v in rows) + "</dl></div>")
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def missions_page(lab, T):
|
|
206
|
+
"""Every mission: the current first, then the next, then the closed, the latest first."""
|
|
207
|
+
body = ["<h1>Missions</h1>", '<p class="lead">A mission carries out a settled decision across sessions: its rules, and a log a later session resumes from.</p>']
|
|
208
|
+
closed = sorted([m for m in lab.missions if m["state"] in ("done", "stopped")], key=lambda m: m["n"], reverse=True)
|
|
209
|
+
for title, group in (("Current", [m for m in lab.missions if m["state"] == "current"]), ("Next", [m for m in lab.missions if m["state"] == "next"]), ("Closed", closed)):
|
|
210
|
+
if group:
|
|
211
|
+
body.append(f"<h2>{title}</h2>" + "".join(mission_box(lab, T, m) for m in group))
|
|
212
|
+
if not lab.missions:
|
|
213
|
+
body.append('<p class="muted">None yet.</p>')
|
|
214
|
+
return frame(lab, "Missions", "".join(body))
|
|
215
|
+
|
|
216
|
+
|
|
174
217
|
def libraries(lab):
|
|
175
218
|
"""The other libraries this lab's charter names, each with where it is on disk and where it is served."""
|
|
176
219
|
if not hasattr(lab, "_libraries"):
|
|
@@ -330,6 +373,8 @@ CSS = """
|
|
|
330
373
|
.lv .slot p+p{margin-top:.5rem}
|
|
331
374
|
.lv .box{background:var(--surface);border:1px solid var(--rule);border-radius:8px;padding:.9rem 1.1rem;margin:0 0 1rem}
|
|
332
375
|
.lv .box.decision{border-left:3px solid var(--warn);background:var(--warn-soft);margin:0 0 .8rem}
|
|
376
|
+
.lv .box.mission{border-left:3px solid var(--rule-strong);margin:0 0 .8rem}.lv .box.mission.m-current{border-left-color:var(--info);background:var(--info-soft)}
|
|
377
|
+
.lv .box.mission .marks{margin-left:.4rem}.lv .mlog{margin:.3rem 0 0;padding-left:1.1rem;font-size:.86rem}.lv .box.mission summary{cursor:pointer;color:var(--ink-3);font-size:.86rem}
|
|
333
378
|
.lv .box.decision.closed{border-left-color:var(--ok);background:var(--ok-soft)}
|
|
334
379
|
.lv .decisionhead{font:500 .78rem var(--sans);color:var(--muted);margin:0 0 .3rem}
|
|
335
380
|
.lv .decisionq{font-size:1.08rem;line-height:1.45;margin:0 0 .6rem;font-weight:600}
|
|
@@ -390,12 +435,11 @@ CSS = """
|
|
|
390
435
|
.lv .sg.t-ok{color:var(--ok)}.lv .sg.t-warn{color:var(--warn)}.lv .sg.t-bad{color:var(--bad)}.lv .sg.t-info{color:var(--info)}.lv .sg.t-ink{color:var(--ink)}.lv .sg.t-gone{color:var(--ink-3)}
|
|
391
436
|
.lv .t-ink{background:var(--sunk);color:var(--ink)}
|
|
392
437
|
.lv .t-gone{background:none;color:var(--ink-3);text-decoration:line-through}
|
|
438
|
+
.lv .sg.t-ink{min-width:0;padding:.1em .28em;border:1px solid var(--ink-3);border-radius:3px;font-size:.62em;line-height:1.1;vertical-align:.12em}
|
|
439
|
+
.lv .ans{display:inline-block;padding:0 .45rem;border:1px solid var(--ink-3);border-radius:4px;font:650 .74rem/1.45 var(--sans);color:var(--ink);background:var(--surface);white-space:nowrap}
|
|
393
440
|
.lv .live{animation:lv-pulse 1.6s ease-in-out infinite}
|
|
394
441
|
.lv .stw{display:inline-flex;gap:.25rem;align-items:baseline;background:none;font:600 .78rem/1.4 var(--sans);white-space:nowrap}
|
|
395
442
|
.lv .stw.t-plain,.lv .stw.t-gone{color:var(--ink-3);text-decoration:none}.lv .stw.t-ink{color:var(--ink)}
|
|
396
|
-
.lv .legend{display:flex;flex-wrap:wrap;gap:.35rem 1.4rem;margin:.2rem 0 .8rem;padding:.5rem .8rem;border:1px solid var(--rule);border-radius:8px;background:var(--surface);font:400 .78rem var(--sans)}
|
|
397
|
-
.lv .legend>div{display:flex;flex-wrap:wrap;gap:.2rem .7rem;align-items:baseline}
|
|
398
|
-
.lv .legend b{font:650 .66rem var(--sans);text-transform:uppercase;letter-spacing:.08em;color:var(--ink-3);margin-right:.1rem}
|
|
399
443
|
@keyframes lv-pulse{0%,100%{opacity:1}50%{opacity:.3}}
|
|
400
444
|
@media (prefers-reduced-motion:reduce){.lv .live{animation:none}}
|
|
401
445
|
.lv .dash-live{background:var(--surface);border:1px solid var(--rule);border-left:3px solid var(--info);border-radius:8px;padding:.7rem 1rem;margin:.2rem 0 1rem;font:400 .95rem/1.5 var(--sans)}
|
|
@@ -896,7 +940,7 @@ def live_box(lab, T):
|
|
|
896
940
|
+ (f' on {e(", ".join(x["uses"]))}' if x["uses"] else "") + ".</p>")
|
|
897
941
|
for m in [m for m in lab.missions if m["state"] == "current"]:
|
|
898
942
|
last = next((l for l in reversed(m["log"]) if l.get("what")), None)
|
|
899
|
-
rows.append(f'<p><span class="who">mission</span>{mark("running")} {e(m["id"])} {e(m["title"])}'
|
|
943
|
+
rows.append(f'<p><span class="who">mission</span>{mark("running")} <a href="/missions#{e(m["id"])}">{e(m["id"])} {e(m["title"])}</a>'
|
|
900
944
|
+ (f' <span class="muted">last, {nice(last["day"])} {e(last["time"])}: {T(last["what"])}</span>' if last else "") + "</p>")
|
|
901
945
|
d = lab.doing()
|
|
902
946
|
if d:
|
|
@@ -1000,7 +1044,7 @@ def home(lab, T):
|
|
|
1000
1044
|
talk = [decision_box(lab, T, d) for d in lab.open_decisions()]
|
|
1001
1045
|
if talk:
|
|
1002
1046
|
out.append("<h2>To discuss with you</h2>" + "".join(talk))
|
|
1003
|
-
out.append("<h2>The lab</h2>" +
|
|
1047
|
+
out.append("<h2>The lab</h2>" + lab_map(lab, T))
|
|
1004
1048
|
if lab.resources:
|
|
1005
1049
|
out.append('<h2>Resources</h2>' + resources_table(lab))
|
|
1006
1050
|
latest = happened(lab.lines)[-5:]
|
|
@@ -1449,6 +1493,8 @@ class Provider:
|
|
|
1449
1493
|
page, path = log_page(lab, T, parts[1] if len(parts) == 2 else ""), "log.md"
|
|
1450
1494
|
elif inner == "decisions":
|
|
1451
1495
|
page = decisions_page(lab, T)
|
|
1496
|
+
elif inner == "missions":
|
|
1497
|
+
page = missions_page(lab, T)
|
|
1452
1498
|
elif inner == "resources":
|
|
1453
1499
|
page, path = resources_page(lab, T), "resources.toml"
|
|
1454
1500
|
elif inner == "glossary":
|
|
@@ -1485,6 +1531,8 @@ class Provider:
|
|
|
1485
1531
|
|
|
1486
1532
|
talk = len(lab.open_decisions())
|
|
1487
1533
|
out = [{"title": "Now", "url": "/lab/"}, {"title": "Decisions", "url": "/lab/decisions/", **({"status": f"{talk} to discuss", "tone": "warn"} if talk else {})}]
|
|
1534
|
+
current = sum(m["state"] == "current" for m in lab.missions)
|
|
1535
|
+
out += [{"title": "Missions", "url": "/lab/missions/", **({"status": f"{current} current", "tone": "info"} if current else {})}] if lab.missions else []
|
|
1488
1536
|
out += [{"title": t, "url": f"/lab/{p}"} for t, p in (("Log", "log/"), ("Resources", "resources/"), ("Glossary", "glossary/"))]
|
|
1489
1537
|
for g in lab.live(lab.goals):
|
|
1490
1538
|
questions, under = [], []
|
|
@@ -1500,11 +1548,6 @@ class Provider:
|
|
|
1500
1548
|
if aside:
|
|
1501
1549
|
questions.append({"title": f"set aside ({len(aside)})", "key": f"{g['id']}:aside", "fold": True, "items": [row(q, q["id"].split(".")[-1]) for q in aside]})
|
|
1502
1550
|
out.append({**row(g, g["id"]), "items": questions, "summary": summary(under)})
|
|
1503
|
-
legend = [{"mark": MARK[k], "text": k} for k in L.STEPS]
|
|
1504
|
-
seen = set()
|
|
1505
|
-
for _, keys in LEGEND:
|
|
1506
|
-
legend += [{"sign": LOOK[k][1], "tone": LOOK[k][0], "status": MEANS[k], "text": MEANS[k] + (f": {HINT[k]}" if k in HINT else "")} for k in keys if not (k in seen or seen.add(k))]
|
|
1507
|
-
out.append({"title": "Key", "legend": legend})
|
|
1508
1551
|
return out
|
|
1509
1552
|
|
|
1510
1553
|
def search(self):
|
|
@@ -33,6 +33,7 @@ def test_a_parked_question_leaves_the_work_and_comes_back_only_by_a_decision(tmp
|
|
|
33
33
|
lab(root, "decide", d2, "--with", "Ada", "The biased coin is parked: the fair coin answers what the lab needs first. It comes back if the law holds.")
|
|
34
34
|
now = lab(root, "now")
|
|
35
35
|
assert "Set aside" in now and f"G1.Q2 (parked by {d2})" in now and "A biased sampler" not in now.split("Set aside")[0]
|
|
36
|
+
assert "G1.Q2" not in now.split("Yours next")[1].split("Not yours")[0] # parked: never listed as one to settle
|
|
36
37
|
assert f"Parked by {d2}" in lab(root, "show", "G1.Q2")
|
|
37
38
|
refused = lab(root, "new", "reading", "G1.Q2", "What the biased runs said", ok=False)
|
|
38
39
|
assert f"parked by {d2}" in refused and "unparks" in refused and not glob.glob(f"{root}/goals/G1-*/Q2-*/2-*")
|
|
@@ -124,7 +124,6 @@ def test_the_rail_the_search_and_the_stamp_follow_the_record(tmp_path):
|
|
|
124
124
|
goal = next(r for r in rail if r.get("kind") == "goal")
|
|
125
125
|
question = goal["items"][0]
|
|
126
126
|
assert question["kind"] == "question" and question["items"][0]["url"] == "/lab/G1.Q1.1/" and question["items"][0]["status"] == "open" and question["tone"] == "plain"
|
|
127
|
-
assert rail[-1]["title"] == "Key" and any(k.get("status") == "running" for k in rail[-1]["legend"])
|
|
128
127
|
assert any(s["url"] == "/lab/G1.Q1.1/" and "factor of four" in s["description"] for s in site.search()) and any(s["url"] == "/lab/D1/" for s in site.search())
|
|
129
128
|
before = site.stamp()
|
|
130
129
|
lab(root, "log", "G1.Q1.1", "stuck", "The machine is down.")
|
|
@@ -337,7 +336,8 @@ def test_a_step_that_needs_a_later_one_reads_on_every_page_as_it_does_in_the_com
|
|
|
337
336
|
ident, d, later_card = across(root) # a reading, a build and an experiment under Q1, each needing a done reading under Q2
|
|
338
337
|
site = Provider(root)
|
|
339
338
|
front_page = site.get("").main
|
|
340
|
-
assert agents_next(front_page) ==
|
|
339
|
+
assert agents_next(front_page) == 4 and "wait:" not in front_page # the three steps, and Q2, whose only step is done
|
|
340
|
+
assert "no step is left under it and no experiment finished" in front_page
|
|
341
341
|
for step in ("G1.Q1.1", "G1.Q1.2", ident):
|
|
342
342
|
assert "Next, for the agent:" in site.get(step).main and "Waiting on" not in site.get(step).main, step
|
|
343
343
|
assert "Waiting on" not in site.get("G1.Q1").main and site.get("G1.Q1").main.count("Next: ") == 3
|
|
@@ -438,7 +438,7 @@ def test_a_table_with_no_rows_and_a_title_that_ends_in_a_mark_are_drawn(tmp_path
|
|
|
438
438
|
assert '<a class="page" href="/lab/G1.Q1/"' in other and ">Does the error halve when the sample quadruples?</a>" in other
|
|
439
439
|
|
|
440
440
|
|
|
441
|
-
def
|
|
441
|
+
def test_every_state_has_one_mark_on_every_page_and_an_answer_is_a_boxed_word(tmp_path):
|
|
442
442
|
from lab_kit import site as S
|
|
443
443
|
root, ident, d, command = locked(tmp_path)
|
|
444
444
|
lab(root, "run", ident, "--wait", "--", *command)
|
|
@@ -451,12 +451,38 @@ def test_every_state_has_one_mark_on_every_page_and_now_carries_the_key(tmp_path
|
|
|
451
451
|
assert (question["status"], question["tone"], question["sign"]) == ("answered no", no[0], no[1]) # the rail
|
|
452
452
|
now = site.get("").main
|
|
453
453
|
tile = now[now.index('class="tile'):]
|
|
454
|
-
assert
|
|
454
|
+
assert '<span class="ans" title="answered no">no</span>' in tile and "answered no</span>" not in tile # the tile on Now: the answer, boxed
|
|
455
455
|
assert site.get("G1.Q1").status == "answered no" and 'data-s="answered no"' in S.header_css() # the page header draws the same mark
|
|
456
|
-
assert '
|
|
457
|
-
assert
|
|
456
|
+
assert 'class="legend"' not in now and site.rail()[-1]["title"] != "Key" # no key: every mark names itself on hover
|
|
457
|
+
assert S.mark("no") == '<span class="sg t-ink" title="answered no">N</span>' and "::before{display:none}" in S.header_css() and '.f-vsign[data-t="ink"]{border' in S.header_css()
|
|
458
458
|
assert len({S.LOOK[k] for k in ("open", "waiting", "running", "parked", "done", "dropped", "to discuss")}) == 7 # no two states share a mark
|
|
459
459
|
busy = {"type": "question", "state": "open", "items": [{"id": "G1.Q1.2", "state": "running"}]}
|
|
460
460
|
assert S.key(busy) == "running" and "G1.Q1.2 running" in S.dot(busy) and " live" in S.dot(busy) # a question with a running step pulses
|
|
461
461
|
assert S.key({"type": "goal", "state": "open", "questions": [busy]}) == "running"
|
|
462
462
|
assert S.key({**busy, "state": "parked"}) == "parked"
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def test_missions_have_a_compact_page_like_decisions_and_a_line_in_the_rail(tmp_path):
|
|
466
|
+
from test_flow import open_question
|
|
467
|
+
from test_order import order, three_steps
|
|
468
|
+
from test_mission import saved
|
|
469
|
+
root = str(tmp_path)
|
|
470
|
+
open_question(root)
|
|
471
|
+
three_steps(root)
|
|
472
|
+
card, d2 = order(root, ["G1.Q2.2", "G1.Q1", "G1.Q2"])
|
|
473
|
+
site = Provider(root)
|
|
474
|
+
assert all(r["title"] != "Missions" for r in site.rail()) # no mission yet: no page in the rail
|
|
475
|
+
saved(root, "The weight first", d2)
|
|
476
|
+
lab(root, "decide", d2, "--with", "Ada", "The weight on heads first.")
|
|
477
|
+
lab(root, "mission", "launch")
|
|
478
|
+
lab(root, "mission", "log", "started G1.Q2.2 in its own session")
|
|
479
|
+
site = Provider(root)
|
|
480
|
+
entry = next(r for r in site.rail() if r["title"] == "Missions")
|
|
481
|
+
assert entry["url"] == "/lab/missions/" and entry["status"] == "1 current"
|
|
482
|
+
page = site.get("missions").main
|
|
483
|
+
assert 'id="M1"' in page and "The weight first" in page and "Current" in page and f'href="/lab/{d2}/"' in page
|
|
484
|
+
assert re.search(r"\d of \d closed", page) and "in its own session</li>" in page and "<details>" in page
|
|
485
|
+
assert 'href="/lab/missions/#M1"' in site.get("").main # Now's mission line links to it
|
|
486
|
+
lab(root, "mission", "close", "M1", "Done for now.")
|
|
487
|
+
page = Provider(root).get("missions").main
|
|
488
|
+
assert "Closed" in page and "Current" not in page and "1 current" not in str(Provider(root).rail())
|
|
@@ -136,3 +136,27 @@ def test_a_test_is_answered_yes_no_or_mixed_and_an_estimate_with_what_was_found(
|
|
|
136
136
|
assert "`kind:` is test or estimate" in lab(root, "check", "--no-rederive", ok=False)
|
|
137
137
|
front(f"{qdir}/question.md", kind="[estimate]")
|
|
138
138
|
assert "`kind:` holds one value, not a list" in lab(root, "check", "--no-rederive", ok=False) # reported, not a crash
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def test_a_question_with_nothing_left_under_it_is_the_agents_next_step(tmp_path):
|
|
142
|
+
root = str(tmp_path)
|
|
143
|
+
open_question(root)
|
|
144
|
+
yours = lambda: lab(root, "now").split("Yours next")[1].split("Not yours")[0]
|
|
145
|
+
assert "G1.Q1" in yours() and "nothing under it yet: plan its first experiment" in yours()
|
|
146
|
+
ident, d, command = experiment(root, command=WRITES % "0.5")
|
|
147
|
+
assert "G1.Q1 " not in yours().replace(ident, "") # a step under it can move: the step is listed, not the question
|
|
148
|
+
lab(root, "lock", ident)
|
|
149
|
+
lab(root, "run", ident, "--wait", "--", *command)
|
|
150
|
+
results(d)
|
|
151
|
+
lab(root, "review", ident, "results", "fail", "The seed was fixed after a first look.")
|
|
152
|
+
assert "no experiment finished that is not void" in yours() # a void experiment answers nothing
|
|
153
|
+
again, d2, command2 = experiment(root, title="The same, with the seed fixed first", command=WRITES % "0.5")
|
|
154
|
+
lab(root, "lock", again)
|
|
155
|
+
lab(root, "run", again, "--wait", "--", *command2)
|
|
156
|
+
done(root, again, d2)
|
|
157
|
+
assert f"{again} finished: answer it (lab answer G1.Q1 ...)" in yours()
|
|
158
|
+
card, dn = park(root, "G1.Q1", "Whether to go on", "", key="holds")
|
|
159
|
+
assert "G1.Q1" not in yours() and "G1 " not in yours() # what an open decision holds waits on it, and its goal is not settled either
|
|
160
|
+
lab(root, "decide", dn, "--with", "Ada", "Go on.")
|
|
161
|
+
lab(root, "answer", "G1.Q1", "yes", "It halves at 400 flips.")
|
|
162
|
+
assert "G1 " in yours() and "bring closing it (reached or dropped) to the operator" in yours()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|