@christang/keel 5.196.1 → 5.197.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/.claude-plugin/plugin.json +1 -1
- package/README.md +12 -0
- package/README.zh-CN.md +10 -0
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/registry.py +2 -0
- package/scripts/validation/shift.py +95 -0
- package/src/core/config.js +10 -1
- package/src/core/tick.js +56 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.197.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
package/README.md
CHANGED
|
@@ -963,6 +963,18 @@ minutes, which runs the patrol once its recommended next run has passed. Declare
|
|
|
963
963
|
`cadence: adaptive` to let the patrol choose that next run by what it saw; `keel tick task` prints the
|
|
964
964
|
launchd job. See [docs/cli-team.md](docs/cli-team.md).
|
|
965
965
|
|
|
966
|
+
The tick also passes the patrol what a host task used to (#456). It measures free disk on each patrol
|
|
967
|
+
worktree's filesystem, against `disk_min_gb:` (default 20). It reads the weekly quota percent from the
|
|
968
|
+
file `quota_file:` names, if that file was written in the last 6 hours. Keel runs no command to get
|
|
969
|
+
quota; a status line can write it, since only status lines receive `rate_limits`. When the file is
|
|
970
|
+
stale, or none is declared, the tick says so once. Declare both on any `patrol:` item; the coordinator
|
|
971
|
+
that owns repository-wide risks reports them.
|
|
972
|
+
|
|
973
|
+
```bash
|
|
974
|
+
# in ~/.claude/statusline-command.sh, after reading the JSON into $input
|
|
975
|
+
echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty' > ~/.claude/keel-quota.txt
|
|
976
|
+
```
|
|
977
|
+
|
|
966
978
|
## The owner's language
|
|
967
979
|
|
|
968
980
|
An agent reads mostly English — tool output, issues, specs, Keel's own output — and drifts into it when it answers you. Declare the language you want to be addressed in, and the rule is restated where replies are written: in `keel context`, the session-start note, and the chat hook on every prompt, in every worktree (#305) — and, on Claude, after every 15 tool calls or 10 minutes of them, since a status update written mid-turn follows no prompt (#311). The agent may still work in any language; identifiers, commands, paths, and quoted output stay as they are.
|
package/README.zh-CN.md
CHANGED
|
@@ -802,6 +802,16 @@ patrol:
|
|
|
802
802
|
下一次运行时间,就运行巡查。声明 `runner: tick`,再加上 `cadence: adaptive` 让巡查根据所见来选择下一次运行时间;
|
|
803
803
|
`keel tick task` 会打印 launchd 任务。见 [docs/cli-team.zh-CN.md](docs/cli-team.zh-CN.md)。
|
|
804
804
|
|
|
805
|
+
tick 还会把以前由宿主任务传的数字交给巡查(#456)。它测量每个巡查 worktree 所在文件系统的剩余磁盘空间,对照
|
|
806
|
+
`disk_min_gb:`(默认 20)。它从 `quota_file:` 指定的文件里读取周配额百分比,前提是这个文件在 6 小时内写过。Keel
|
|
807
|
+
不会为了配额去执行任何命令;可以由 status line 来写这个文件,因为只有 status line 能拿到 `rate_limits`。文件过期,
|
|
808
|
+
或者根本没有声明时,tick 只说一次。两项都可以声明在任意一个 `patrol:` 项上,由负责全仓库风险的协调者报告。
|
|
809
|
+
|
|
810
|
+
```bash
|
|
811
|
+
# 在 ~/.claude/statusline-command.sh 里,把 JSON 读进 $input 之后
|
|
812
|
+
echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty' > ~/.claude/keel-quota.txt
|
|
813
|
+
```
|
|
814
|
+
|
|
805
815
|
## 负责人的语言
|
|
806
816
|
|
|
807
817
|
agent 读到的大多是英文——工具输出、issue、spec、Keel 自己的输出——回答你时也会滑向英文。声明你希望被使用的语言,这条规则就会在写回复的地方被重申:在 `keel context`、会话启动提示,以及每个 worktree 里每次提示时的 chat hook 中(#305)——在 Claude 上,还会在每 15 次工具调用或连续 10 分钟的工具调用之后重申,因为回合中途写的状态更新并不跟在某次提示之后(#311)。agent 仍可以用任何语言工作;标识符、命令、路径和引用的输出保持原样。
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.197.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.197.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.197.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.197.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
|
|
|
35
35
|
os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
PACKAGE_VERSION = "5.
|
|
38
|
+
PACKAGE_VERSION = "5.197.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.197.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -459,6 +459,8 @@ SCENARIOS: tuple = (
|
|
|
459
459
|
("patrol-next", shift.validate_patrol_next_scenario),
|
|
460
460
|
("tick-runs-due-patrol", shift.validate_tick_runs_due_patrol_scenario),
|
|
461
461
|
("tick-runs-each-patrol", shift.validate_tick_runs_each_patrol_scenario),
|
|
462
|
+
("tick-passes-free-disk", shift.validate_tick_passes_free_disk_scenario),
|
|
463
|
+
("tick-reads-quota-file", shift.validate_tick_reads_quota_file_scenario),
|
|
462
464
|
("launchd-stable-node", shift.validate_launchd_stable_node_scenario),
|
|
463
465
|
("shift-slash-command", shift.validate_shift_slash_command_scenario),
|
|
464
466
|
("shift-check-skips-host-keep-awake", shift.validate_shift_check_skips_host_keep_awake_scenario),
|
|
@@ -974,6 +974,101 @@ def validate_tick_runs_each_patrol_scenario() -> int:
|
|
|
974
974
|
return 0
|
|
975
975
|
|
|
976
976
|
|
|
977
|
+
def tick_scopes_scratch(base: Path, extra_a: str = "", extra_b: str = "", tail: str = "") -> tuple[Path, dict, dict[str, Path], Path]:
|
|
978
|
+
"""Two scoped coordinators run by `keel tick` (#434), for what the tick passes them (#456)."""
|
|
979
|
+
config = ("patrol:\n"
|
|
980
|
+
f" - role: pm-a\n every: 30m\n runner: tick\n scope: group:team-a\n{extra_a}"
|
|
981
|
+
f" - role: pm-b\n every: 45m\n runner: tick\n scope: group:team-b\n{extra_b}" + tail)
|
|
982
|
+
repo, env, wt = patrol_scopes_scratch(base, config)
|
|
983
|
+
return repo, env, wt, mailbox_common_dir(repo) / "keel-chat" / "tick" / "state.json"
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
def due_tick(repo: Path, env: dict, wt: dict[str, Path], state: Path) -> subprocess.CompletedProcess[str]:
|
|
987
|
+
"""Run `keel tick` with every recorded patrol made due first."""
|
|
988
|
+
if state.exists():
|
|
989
|
+
saved = json.loads(state.read_text(encoding="utf-8"))
|
|
990
|
+
for entry in (saved.get("patrols") or {}).values():
|
|
991
|
+
entry["next_at"] = "2000-01-01T00:00:00+00:00"
|
|
992
|
+
state.write_text(json.dumps(saved), encoding="utf-8")
|
|
993
|
+
return run_keel(wt["dev-a"], "tick", "--repo", str(repo), env=env)
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
def patrol_told(repo: Path, role: str, needle: str) -> int:
|
|
997
|
+
return len(chat_records_with(repo, "dm-" + "--".join(sorted(("keel-patrol", role))), needle))
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
def validate_tick_passes_free_disk_scenario() -> int:
|
|
1001
|
+
"""Issue #456 D1, D2: `keel tick` measures free disk and passes it to the patrol.
|
|
1002
|
+
|
|
1003
|
+
Raising the floor far above the machine's free space turns the disk low
|
|
1004
|
+
without faking the measurement; the risk reaches the coordinator that owns
|
|
1005
|
+
repository-wide risks once, and nobody else.
|
|
1006
|
+
"""
|
|
1007
|
+
label = "tick-passes-free-disk:"
|
|
1008
|
+
with tempfile.TemporaryDirectory(prefix="keel-tick-disk-") as raw:
|
|
1009
|
+
# The patrol reports disk turning low, so the floor starts below the
|
|
1010
|
+
# machine's free space and is then raised far above it.
|
|
1011
|
+
repo, env, wt, state = tick_scopes_scratch(Path(raw), extra_a=" disk_min_gb: 1\n")
|
|
1012
|
+
config = repo / "keel" / "config.yaml"
|
|
1013
|
+
for floor in ("1", "1000000", "1000000"):
|
|
1014
|
+
config.write_text(config.read_text(encoding="utf-8").replace("disk_min_gb: 1\n", f"disk_min_gb: {floor}\n")
|
|
1015
|
+
.replace("disk_min_gb: 1000000\n", f"disk_min_gb: {floor}\n"), encoding="utf-8")
|
|
1016
|
+
ran = due_tick(repo, env, wt, state)
|
|
1017
|
+
if ran.returncode != 0:
|
|
1018
|
+
report(f"{label} keel tick exited {ran.returncode}: {ran.stdout!r} {ran.stderr!r}")
|
|
1019
|
+
return 1
|
|
1020
|
+
told = {role: patrol_told(repo, role, "free disk is") for role in ("pm-a", "pm-b")}
|
|
1021
|
+
if told != {"pm-a": 1, "pm-b": 0}:
|
|
1022
|
+
report(f"{label} the disk risk reached {told}, not pm-a once: {ran.stdout!r}")
|
|
1023
|
+
return 1
|
|
1024
|
+
if not patrol_told(repo, "pm-a", "below 1000000 GB"):
|
|
1025
|
+
report(f"{label} the disk risk does not name the declared floor of 1000000 GB.")
|
|
1026
|
+
return 1
|
|
1027
|
+
report("tick-passes-free-disk scenario passed.")
|
|
1028
|
+
return 0
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
def validate_tick_reads_quota_file_scenario() -> int:
|
|
1032
|
+
"""Issue #456 D2, D3: `keel tick` passes the quota a declared file holds.
|
|
1033
|
+
|
|
1034
|
+
A status line writes the weekly percent; the tick reads it while fresh,
|
|
1035
|
+
says once when it is stale, and says once when no file is declared. Keel
|
|
1036
|
+
runs no command for it.
|
|
1037
|
+
"""
|
|
1038
|
+
label = "tick-reads-quota-file:"
|
|
1039
|
+
with tempfile.TemporaryDirectory(prefix="keel-tick-quota-") as raw:
|
|
1040
|
+
base = Path(raw)
|
|
1041
|
+
quota = base / "quota.txt"
|
|
1042
|
+
quota.write_text("91\n", encoding="utf-8")
|
|
1043
|
+
repo, env, wt, state = tick_scopes_scratch(base / "declared", extra_a=f" quota_file: {quota}\n")
|
|
1044
|
+
due_tick(repo, env, wt, state)
|
|
1045
|
+
quota.write_text("96.4\n", encoding="utf-8")
|
|
1046
|
+
due_tick(repo, env, wt, state)
|
|
1047
|
+
for needle in ("past 90%", "past 95%"):
|
|
1048
|
+
told = {role: patrol_told(repo, role, needle) for role in ("pm-a", "pm-b")}
|
|
1049
|
+
if told != {"pm-a": 1, "pm-b": 0}:
|
|
1050
|
+
report(f"{label} the {needle!r} quota risk reached {told}, not pm-a once.")
|
|
1051
|
+
return 1
|
|
1052
|
+
old = time.time() - 7 * 3600
|
|
1053
|
+
os.utime(quota, (old, old))
|
|
1054
|
+
stale = due_tick(repo, env, wt, state)
|
|
1055
|
+
if not any("quota" in line and "stale" in line for line in stale.stdout.splitlines()):
|
|
1056
|
+
report(f"{label} a quota file 7 hours old is not reported stale: {stale.stdout!r}")
|
|
1057
|
+
return 1
|
|
1058
|
+
|
|
1059
|
+
repo, env, wt, state = tick_scopes_scratch(base / "undeclared")
|
|
1060
|
+
first = due_tick(repo, env, wt, state)
|
|
1061
|
+
if "quota is not checked" not in first.stdout:
|
|
1062
|
+
report(f"{label} with no quota_file the tick does not say quota is not checked: {first.stdout!r}")
|
|
1063
|
+
return 1
|
|
1064
|
+
second = due_tick(repo, env, wt, state)
|
|
1065
|
+
if any("quota" in line for line in second.stdout.splitlines()):
|
|
1066
|
+
report(f"{label} the tick repeats an unchanged quota state: {second.stdout!r}")
|
|
1067
|
+
return 1
|
|
1068
|
+
report("tick-reads-quota-file scenario passed.")
|
|
1069
|
+
return 0
|
|
1070
|
+
|
|
1071
|
+
|
|
977
1072
|
def validate_patrol_nudge_scenario() -> int:
|
|
978
1073
|
"""Issues #307 part 1 and #313: the patrol nudges idle roles directly.
|
|
979
1074
|
|
package/src/core/config.js
CHANGED
|
@@ -1000,13 +1000,22 @@ function patrolItem(block) {
|
|
|
1000
1000
|
if (window) cadence.quiet = { start: Number(window[1]) * 60 + Number(window[2]), end: Number(window[3]) * 60 + Number(window[4]) };
|
|
1001
1001
|
else ignored.push(`quiet \`${block.quiet}\` is not a window such as 23:00-08:30`);
|
|
1002
1002
|
}
|
|
1003
|
+
// What `keel tick` passes the patrol (#456 D2): the free-disk floor, and the
|
|
1004
|
+
// file a status line writes the weekly quota percent to. Keel runs nothing to
|
|
1005
|
+
// read quota.
|
|
1006
|
+
let diskMinGb = null;
|
|
1007
|
+
if (block.disk_min_gb !== undefined) {
|
|
1008
|
+
if (Number(block.disk_min_gb) > 0) diskMinGb = Number(block.disk_min_gb);
|
|
1009
|
+
else ignored.push(`disk_min_gb \`${block.disk_min_gb}\` is not a positive number of gigabytes`);
|
|
1010
|
+
}
|
|
1011
|
+
const quotaFile = block.quota_file !== undefined ? String(block.quota_file).replace(/^["']|["']$/g, "") : null;
|
|
1003
1012
|
// `runner: tick` says `keel tick` runs the patrol from the host scheduler.
|
|
1004
1013
|
let runner = null;
|
|
1005
1014
|
if (block.runner !== undefined) {
|
|
1006
1015
|
if (block.runner === "tick") runner = "tick";
|
|
1007
1016
|
else ignored.push(`runner \`${block.runner}\` is not tick`);
|
|
1008
1017
|
}
|
|
1009
|
-
return { declaration: { declared: true, role: block.role, every: block.every, hostTask, model, cadence, runner, scope }, ignored };
|
|
1018
|
+
return { declaration: { declared: true, role: block.role, every: block.every, hostTask, model, cadence, runner, scope, diskMinGb, quotaFile }, ignored };
|
|
1010
1019
|
}
|
|
1011
1020
|
|
|
1012
1021
|
function readPatrolDeclarations(repo) {
|
package/src/core/tick.js
CHANGED
|
@@ -45,6 +45,38 @@ function patrolWorktrees(where) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// Free space on a worktree's filesystem in GiB, as `df -g` reports it (#456 D1).
|
|
49
|
+
function freeDiskGb(dir) {
|
|
50
|
+
try {
|
|
51
|
+
const stats = fs.statfsSync(dir);
|
|
52
|
+
return { gb: Math.floor((Number(stats.bavail) * Number(stats.bsize)) / 2 ** 30), error: null };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return { gb: null, error: error.message };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const QUOTA_MAX_AGE_MS = 6 * 3600 * 1000;
|
|
59
|
+
|
|
60
|
+
function readQuota(where, declared, now) {
|
|
61
|
+
if (!declared) return { state: "unchecked", percent: null, text: "quota is not checked: no `patrol:` item declares quota_file" };
|
|
62
|
+
const file = path.resolve(where.worktree, declared.replace(/^~(?=\/|$)/, os.homedir()));
|
|
63
|
+
let stat;
|
|
64
|
+
let body;
|
|
65
|
+
try {
|
|
66
|
+
stat = fs.statSync(file);
|
|
67
|
+
body = fs.readFileSync(file, "utf8");
|
|
68
|
+
} catch (error) {
|
|
69
|
+
return { state: "unreadable", percent: null, text: `quota file ${file} cannot be read (${error.code || error.message}), so quota is not checked` };
|
|
70
|
+
}
|
|
71
|
+
if (now.getTime() - stat.mtimeMs > QUOTA_MAX_AGE_MS) {
|
|
72
|
+
return { state: "stale", percent: null, text: `quota file ${file} is stale, last written ${store.isoLocal(stat.mtime)}, so quota is not checked` };
|
|
73
|
+
}
|
|
74
|
+
const number = body.match(/\d+(?:\.\d+)?/);
|
|
75
|
+
if (!number) return { state: "unreadable", percent: null, text: `quota file ${file} holds no number, so quota is not checked` };
|
|
76
|
+
const percent = Math.round(Number(number[0]));
|
|
77
|
+
return { state: "read", percent, text: `quota is read from ${file} (${percent}%)` };
|
|
78
|
+
}
|
|
79
|
+
|
|
48
80
|
function patrolWorktree(where) {
|
|
49
81
|
const all = patrolWorktrees(where);
|
|
50
82
|
return all.find((found) => found.worktree) || all[0];
|
|
@@ -89,6 +121,20 @@ function tick(where, now = new Date()) {
|
|
|
89
121
|
const all = patrolWorktrees(where);
|
|
90
122
|
const listed = all.length > 1;
|
|
91
123
|
const state = readState(where);
|
|
124
|
+
// Repository-wide settings come from the first item declaring each (#456 D2);
|
|
125
|
+
// every run gets them, and the patrol decides who reports (#434 D4).
|
|
126
|
+
const declared = all.map((found) => found.declaration).filter(Boolean);
|
|
127
|
+
const diskMinGb = (declared.find((d) => d.diskMinGb) || {}).diskMinGb || null;
|
|
128
|
+
// Quota comes from a file the repository names, never from a command Keel
|
|
129
|
+
// runs (#456 D3, D4); its state is said when it changes, not every tick.
|
|
130
|
+
const quota = declared.length
|
|
131
|
+
? readQuota(where, (declared.find((d) => d.quotaFile) || {}).quotaFile || null, now)
|
|
132
|
+
: { state: null, percent: null };
|
|
133
|
+
if (quota.state && quota.state !== state.quota_state) {
|
|
134
|
+
result.quota = quota;
|
|
135
|
+
state.quota_state = quota.state;
|
|
136
|
+
store.writeJsonAtomic(where, stateFile(where), state);
|
|
137
|
+
}
|
|
92
138
|
result.patrols = all.map((found) => {
|
|
93
139
|
if (!found.worktree) return { role: found.declaration ? found.declaration.role : null, ran: false, why: found.why };
|
|
94
140
|
const role = found.declaration.role;
|
|
@@ -101,9 +147,12 @@ function tick(where, now = new Date()) {
|
|
|
101
147
|
// and the patrol still runs on the refs it has.
|
|
102
148
|
const fetched = spawnSync("git", ["-C", found.worktree, "fetch", "-q", "origin"], { encoding: "utf8" });
|
|
103
149
|
const fetchError = fetched.status === 0 ? null : String(fetched.stderr || fetched.error || "fetch failed").trim();
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
150
|
+
const args = [KEEL, "patrol", "--repo", found.worktree, "--since-last", "--notify", "--json"];
|
|
151
|
+
const disk = freeDiskGb(found.worktree);
|
|
152
|
+
if (disk.gb !== null) args.push("--disk-free-gb", String(disk.gb));
|
|
153
|
+
if (diskMinGb) args.push("--disk-min-gb", String(diskMinGb));
|
|
154
|
+
if (quota.percent !== null) args.push("--quota", String(quota.percent));
|
|
155
|
+
const ran = spawnSync(process.execPath, args, { cwd: found.worktree, encoding: "utf8" });
|
|
107
156
|
let payload = {};
|
|
108
157
|
try {
|
|
109
158
|
payload = JSON.parse(ran.stdout);
|
|
@@ -117,7 +166,7 @@ function tick(where, now = new Date()) {
|
|
|
117
166
|
store.writeJsonAtomic(where, stateFile(where), state);
|
|
118
167
|
return {
|
|
119
168
|
role, listed, ran: true, exit: ran.status, next_at: next, rule: payload.next_rule || null,
|
|
120
|
-
fetchError, error: ran.status === 1 ? String(ran.stderr || "").trim() : null,
|
|
169
|
+
fetchError, diskError: disk.error, error: ran.status === 1 ? String(ran.stderr || "").trim() : null,
|
|
121
170
|
};
|
|
122
171
|
});
|
|
123
172
|
result.patrol = result.patrols[0];
|
|
@@ -127,13 +176,15 @@ function tick(where, now = new Date()) {
|
|
|
127
176
|
function render(result) {
|
|
128
177
|
const woke = (result.woken || []).map((w) => `keel tick: ${w.ok ? "resumed" : "could not resume"} ${w.role}'s CLI session ${w.session} for ${w.record}`);
|
|
129
178
|
const handed = (result.handedOver || []).map((h) => `keel tick: ${h.role}'s hand-off ${h.state}${h.new_session ? ` as session ${h.new_session}` : ""}${h.error ? `: ${h.error}` : ""}`);
|
|
130
|
-
|
|
179
|
+
const quota = result.quota ? [`keel tick: ${result.quota.text}`] : [];
|
|
180
|
+
return [...handed, ...woke, ...quota, ...(result.patrols || [result.patrol]).map(renderPatrol)].join("\n");
|
|
131
181
|
}
|
|
132
182
|
|
|
133
183
|
function renderPatrol(p) {
|
|
134
184
|
if (!p.ran) return `keel tick: ${p.why}`;
|
|
135
185
|
const lines = [`keel tick: ran ${p.listed ? `${p.role}'s` : "the"} patrol (exit ${p.exit})${p.next_at ? `; next ${p.next_at} (${p.rule})` : ""}`];
|
|
136
186
|
if (p.fetchError) lines.push(`fetch failed: ${p.fetchError}`);
|
|
187
|
+
if (p.diskError) lines.push(`free disk not measured: ${p.diskError}`);
|
|
137
188
|
if (p.error) lines.push(`patrol failed: ${p.error}`);
|
|
138
189
|
return lines.join("\n");
|
|
139
190
|
}
|