feat: hub and skills requirements 032 to 063
Hub: send in the field (032), coherent speak box (033), stream head band (034), Match at full width with its pile (035, 036), Home without the outer box (037), badge to Match (038), rejects that survive a changed or withdrawn card (039), the release card (040), code marks in the review diff (041), why Deny is off (042), the undo window clock (043), widgets without inner boxes (044), the Artifacts head on one line (045), accepting a red gate's risk (046), one code box (047), done rows greyed and folded (048), one control height (049), menus that stay open (050), radio settings in the Device card (051), bubbles beside the modes (052), agent settings on every face and name (053), pin only by menu (054), WASD in Match (055), the flowing card edge (056), Schedules in Controls (057) and the hub poll cost (059). Skills: the coach leaves for its own repository kevinveenbirkenbach/coach (058; test_install pins its four skills in skills-lock.json and stays red until that repository is published and pinned), hooks and timers start fewer processes (060), council files on hot paths stay bounded and mirror by marker instead of mtime (061), scripts and hooks hand agents less output (062), and block.py builds the commit table and message block in one run (063). Requirement documents 032 to 063 with their implementation amendments. MEDUSA false positives accepted after kvb-think-criticize (36 lines): MM-SCAN-058 (pla inside replace or plan), JB-SCAN-616/641 (the local clip helper), CODEGEN-SCAN-001 (drop-in paths), CGS-SCAN-029 (systemctl argv from constants), CGS-SCAN-040 (runner poll loop), FLA-SCAN-055 (feedback), WM-SCAN-354, AI-BACKDOOR-006, GENAI-SCAN-1270, B604 (runner shell path for passkey-verified commands), TC004, EXA002, EXA006, EXA010 and WEB-SSRF. 🎯 Fix: 92 % 💥 Break: 8 % 💸 Tokens: 89 % ⏱️ Velocity: – 🛡️ Security: ~100 % 🏆 Score: 95 🚦 Gate: ⛔ break 8 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5fd70e183
commit
0fad1bfae3
265 files changed
+10434
-2242
No files matched your search
@@ -45,12 +45,14 @@
|
||||
~/.local/state/agents-council/resources.
|
||||
--council: the council directory with queue.json and the claims.
|
||||
--queue (sample): the installed kvb-org-queue queue.py, run with
|
||||
AGENTS_COUNCIL_ROOT set to --council.
|
||||
AGENTS_COUNCIL_ROOT set to --council while an entry waits or runs.
|
||||
--transcripts (tokens): Claude Code's projects directory.
|
||||
--proc, --sys (sample): where /proc and /sys are mounted.
|
||||
|
||||
Returns:
|
||||
Runs on the host every minute through kvb-orchestrator-resources.timer,
|
||||
Runs on the host, sample every minute through
|
||||
kvb-orchestrator-resources.timer and tokens every 10 minutes through
|
||||
kvb-orchestrator-tokens.timer,
|
||||
because the hub's container sees neither the host's disks, memory and
|
||||
GPUs nor its transcripts' offsets; nothing here calls a language model.
|
||||
The exit code is 0.
|
||||
@@ -331,7 +333,12 @@ def queue_view(council: Path, script: Path, run: Callable[[list[str]], str | Non
|
||||
|
||||
|
||||
def queue_state(council: Path, script: Path, run: Callable[[list[str]], str | None]) -> dict:
|
||||
return {**queue(council), **queue_view(council, script, run)}
|
||||
"""Returns:
|
||||
queue() with queue_view() added, which starts queue.py only while
|
||||
an entry waits or runs.
|
||||
"""
|
||||
counts = queue(council)
|
||||
return {**counts, **(queue_view(council, script, run) if counts["waiting"] or counts["active"] else {})}
|
||||
|
||||
|
||||
def integers(value: object, size: int) -> bool:
|
||||
|
||||
@@ -40,8 +40,8 @@ Returns:
|
||||
changes without --rasci and --council or into a council that is a
|
||||
symlink or another uid's, gate changes without --gates, and every other
|
||||
job. Posts the last 200 output lines
|
||||
back while it runs and the exit code at its end. Before every poll it
|
||||
posts, for each open operator row that is a git merge of a full commit
|
||||
back while it runs and the exit code at its end. Before a poll, at most
|
||||
every PREVIEW_SECONDS, it posts, for each open operator row that is a git merge of a full commit
|
||||
id (staged_diff.merge_of) whose HEAD differs from the preview the hub
|
||||
holds, staged_diff.merge_preview, which its Match card shows; such a
|
||||
merge whose job names the previewed HEAD is refused once HEAD moved. The
|
||||
@@ -80,6 +80,7 @@ PREVIEWS = "/api/runner/previews"
|
||||
ERROR_LIMIT = 500
|
||||
PREVIEW_FAILURES = (OSError, ValueError, staged_diff.DiffError)
|
||||
BEAT = 2.0
|
||||
PREVIEW_SECONDS = 10.0
|
||||
SAFE_PATH = "/usr/bin:/bin"
|
||||
TASK_JOB = "task"
|
||||
TASK_LIMIT = 30.0
|
||||
@@ -461,15 +462,17 @@ def main() -> int:
|
||||
trust = verifier.Trust(approvers=args.approvers, replay=args.replay, origin=signing.origin_of(args.port))
|
||||
register = Register(rasci=args.rasci, council=args.council) if args.rasci and args.council else None
|
||||
host = Host(shell=os.environ.get("SHELL") or pwd.getpwuid(os.geteuid()).pw_shell, operator=args.operator, council=args.council)
|
||||
rules, told = staged_diff.rules_root(), ""
|
||||
rules, told, previewed = staged_diff.rules_root(), "", None
|
||||
while True:
|
||||
try:
|
||||
previews(base, rules)
|
||||
told = ""
|
||||
except (OSError, ValueError, KeyError, TypeError) as error:
|
||||
if str(error) != told:
|
||||
print(f"runner: no merge previews: {error}", file=sys.stderr)
|
||||
told = str(error)
|
||||
if previewed is None or time.monotonic() - previewed >= PREVIEW_SECONDS:
|
||||
previewed = time.monotonic()
|
||||
try:
|
||||
previews(base, rules)
|
||||
told = ""
|
||||
except (OSError, ValueError, KeyError, TypeError) as error:
|
||||
if str(error) != told:
|
||||
print(f"runner: no merge previews: {error}", file=sys.stderr)
|
||||
told = str(error)
|
||||
try:
|
||||
cycle(base, trust, register, args.gates, host)
|
||||
except (OSError, ValueError, KeyError, TypeError):
|
||||
|
||||
@@ -10,7 +10,8 @@ Returns:
|
||||
nor the host's processes: replaces --output with {"written": <epoch>,
|
||||
"sessions": {<session id>: {"name", "status", "statusUpdatedAt",
|
||||
"running"}}}, running being whether the record's pid still runs the
|
||||
process it started. The exit code is 0.
|
||||
process it started, unless it holds the same sessions written less than
|
||||
REFRESH seconds ago. The exit code is 0.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -27,6 +28,7 @@ PROC = Path("/proc")
|
||||
KEPT = ("name", "status", "statusUpdatedAt")
|
||||
RECORD_BYTES = 65536
|
||||
VALUE_CHARS = 200
|
||||
REFRESH = 120
|
||||
|
||||
|
||||
def read_record(path: Path) -> object:
|
||||
@@ -96,7 +98,24 @@ def snapshot(folder: Path, proc: Path, now: float) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def unchanged(output: Path, data: dict) -> bool:
|
||||
"""Returns:
|
||||
Whether output already holds data's sessions, written less than
|
||||
REFRESH seconds before it; the hub counts a snapshot older than five
|
||||
minutes as gone.
|
||||
"""
|
||||
try:
|
||||
stored = json.loads(output.read_bytes())
|
||||
except (OSError, ValueError, RecursionError):
|
||||
return False
|
||||
written = stored.get("written") if isinstance(stored, dict) else None
|
||||
fresh = isinstance(written, int | float) and not isinstance(written, bool) and 0 <= data["written"] - written < REFRESH
|
||||
return fresh and stored.get("sessions") == data["sessions"]
|
||||
|
||||
|
||||
def write(output: Path, data: dict) -> None:
|
||||
if unchanged(output, data):
|
||||
return
|
||||
with tempfile.NamedTemporaryFile("w", encoding="utf-8", dir=output.parent, prefix=f".{output.name}.", delete=False) as handle:
|
||||
try:
|
||||
json.dump(data, handle)
|
||||
|
||||
@@ -408,14 +408,24 @@ def write_view(path: Path, view: dict) -> None:
|
||||
verifier.private_dir(); a linked or foreign spool, or a write
|
||||
that fails, prints one line and raises nothing, so an error of
|
||||
the cycle before it still surfaces.
|
||||
view: Writer.view().
|
||||
view: Writer.view(); a stored view that differs only in "written"
|
||||
stays.
|
||||
"""
|
||||
try:
|
||||
with verifier.private_dir(path.parent, True) as folder:
|
||||
verifier.write_at(folder, path.name, view)
|
||||
if not same_view(folder, path.name, view):
|
||||
verifier.write_at(folder, path.name, view)
|
||||
except (signing.Refused, OSError) as error:
|
||||
print(f"view not written: {error}", file=sys.stderr)
|
||||
|
||||
|
||||
def same_view(folder: int, name: str, view: dict) -> bool:
|
||||
try:
|
||||
stored = json.loads(verifier.read_regular(name, folder))
|
||||
except (OSError, ValueError, RecursionError):
|
||||
return False
|
||||
return isinstance(stored, dict) and {**stored, "written": None} == {**view, "written": None}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -230,6 +230,10 @@ def threshold_item(threshold: int) -> dict:
|
||||
return {"kind": "speech-threshold", "threshold": threshold}
|
||||
|
||||
|
||||
def popups_item(popups: dict) -> dict:
|
||||
return {"kind": "popups", "popups": popups}
|
||||
|
||||
|
||||
def task_item(task: str, argv: list[str]) -> dict:
|
||||
return {"kind": "task", "id": task, "argv": argv}
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ SAFE = (GIT, "--no-pager", "--no-lazy-fetch", "-c", "core.fsmonitor=false", "-c"
|
||||
PASSED_ENV = ("HOME", "LANG", "LC_ALL", "LC_CTYPE")
|
||||
FIXED_ENV = {"GIT_OPTIONAL_LOCKS": "0", "GIT_NO_LAZY_FETCH": "1", "GIT_CONFIG_NOSYSTEM": "1", "GIT_CONFIG_GLOBAL": os.devnull, "PATH": TRUSTED_PATH}
|
||||
INTENT_TO_ADD = 0x20000000
|
||||
TOPLEVELS: dict[str, tuple[Path, tuple]] = {}
|
||||
TOPLEVELS_KEPT = 64
|
||||
DEBUG_LINES = 5
|
||||
NAMES_COMMIT = re.compile(r"(?<![\w.-])git(?![\w.-]).*(?<![\w-])commit(?![\w-])", re.DOTALL)
|
||||
VERBS = ("commit", "commit-tree", "merge")
|
||||
@@ -188,8 +190,44 @@ def blobs(cwd: Path, oids: set[str]) -> dict[str, bytes]:
|
||||
return found
|
||||
|
||||
|
||||
def stat_mark(path: Path) -> tuple[int, int] | None:
|
||||
try:
|
||||
found = os.stat(path)
|
||||
except OSError:
|
||||
return None
|
||||
return found.st_ino, found.st_mtime_ns
|
||||
|
||||
|
||||
def git_marks(top: Path) -> tuple:
|
||||
"""Returns:
|
||||
The (inode, mtime) of top's .git, its HEAD, packed-refs and
|
||||
refs/heads, which change when the worktree, HEAD, a branch or
|
||||
packed-refs moves; () when the .git file cannot be read.
|
||||
"""
|
||||
marker, gitdir = top / ".git", top / ".git"
|
||||
try:
|
||||
if marker.is_file():
|
||||
gitdir = Path(os.path.realpath(top / marker.read_text(encoding="utf-8").strip().removeprefix("gitdir:").strip()))
|
||||
common = Path(os.path.realpath(gitdir / (gitdir / "commondir").read_text(encoding="utf-8").strip())) if (gitdir / "commondir").is_file() else gitdir
|
||||
except OSError:
|
||||
return ()
|
||||
return tuple(stat_mark(path) for path in (marker, gitdir / "HEAD", common / "packed-refs", common / "refs" / "heads"))
|
||||
|
||||
|
||||
def toplevel(cwd: Path) -> Path:
|
||||
return Path(os.path.realpath(git(cwd, ["rev-parse", "--show-toplevel"], None).decode("utf-8", "surrogateescape").strip()))
|
||||
"""Returns:
|
||||
The real path of cwd's worktree root, from git once per directory
|
||||
until git_marks() of that root changes.
|
||||
"""
|
||||
key = os.path.realpath(cwd)
|
||||
held = TOPLEVELS.get(key)
|
||||
if held is not None and held[1] and held[1] == git_marks(held[0]):
|
||||
return held[0]
|
||||
top = Path(os.path.realpath(git(cwd, ["rev-parse", "--show-toplevel"], None).decode("utf-8", "surrogateescape").strip()))
|
||||
if len(TOPLEVELS) >= TOPLEVELS_KEPT:
|
||||
TOPLEVELS.clear()
|
||||
TOPLEVELS[key] = (top, git_marks(top))
|
||||
return top
|
||||
|
||||
|
||||
def flagged(raw: bytes) -> list[tuple[bytes, int]]:
|
||||
|
||||
Reference in new issue
Block a user