Files
rune/scripts/admit_wave_d45_live_use_batch.py

145 lines
6.0 KiB
Python

"""Admission dispatch for wave d45-live-use-batch (D45 all five + D44
the doctrine).
classify + activate + admit (the headless scaffolding entry law,
scripts/admit_wave_scaffold_status_line.py pattern): the five defects
from the owner's live-use critique — (1) the toolset gap, the TUI chat
path must expose the mode-gated tool suite to the model; (2) the
context bar wiring, /v1/status context{used,limit} must reach the info
bar on BOTH the serve and library seams; (3) model name compaction in
the info bar (base name + param size + ablation marker); (4) the
v-version token hyperlinks to the Gitea release via OSC 8
detect-then-render; (5) timestamps re-landed far-left per message row
— approval_ref 'user:D45 directive 2026-10-20'.
"""
import json
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from rune import construction_activation as cact # noqa: E402
from rune import construction_admission as cadm # noqa: E402
from rune import construction_mode as cmode # noqa: E402
from rune import scaffold as sc # noqa: E402
ROOT = os.path.join(os.path.dirname(__file__), "..")
OBJECTIVE = (
"Land the D45 live-use critique batch: (1) fix the toolset gap — "
"the TUI chat path (core_server send_task → rune_operator → "
"local_tool_runtime) must surface the mode-allowed tool suite to "
"the model, CHAT mode read tools visible and callable live, TASK "
"mode writes exposed; (2) wire /v1/status context{used,limit} "
"through the TUI bridge to the info bar on the serve AND library "
"seams; (3) compact model display names (base name + param size + "
"ablation marker, no hf.co/ or GGUF/quant noise; cloud: vendor + "
"model + size); (4) hyperlink the v-version token to the Gitea "
"release via OSC 8 detect-then-render; (5) re-land timestamps "
"far-left in a consistent gutter per message row"
)
AFFECTED = [
"src/rune/local_tool_runtime.py",
"src/rune/core_server.py",
"src/rune/rune_operator.py",
"tui/bridge/bridge.go",
"tui/bridge/status.go",
"tui/face/infobar.go",
"tui/face/render.go",
"tui/face/timestamps.go",
"tui/face/versionlink.go",
"scripts/admit_wave_d45_live_use_batch.py",
]
def main() -> int:
store = os.path.join(ROOT, "store", "scaffold")
scaffold = sc.Scaffold(store, "rune")
md = cmode.classify_mode(
OBJECTIVE,
target_project="rune",
project_exists=True,
affected_surface=AFFECTED,
)
print("classified mode:", md.mode)
need = {
"need_id": "need-wave-d45-live-use-batch",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-d45-live-use-batch",
"affected_surface": AFFECTED,
"evidence_refs": [
"docs/architecture/boundary-law.md (D45 all five + D44 the "
"doctrine)",
"src/rune/local_tool_runtime.py (T2 capability-selection "
"slice, _capability_selection)",
"src/rune/tool_executor.py (the 19-tool suite)",
"src/rune/core_server.py (send_task, /v1/status "
"context{used,limit})",
"tui/bridge/ (b.serve.Status → body.Context.Used/Limit → "
"setCtx → m.rt.Ctx() → ctxToken)",
"docs/architecture/boundary-law.md (D43 addendum 6, "
"timestamps far-left + version hyperlink)",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-d45-live-use-batch")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-d45-live-use-batch",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-d45-live-use-batch",
expected_new_entities=[
"src/rune/local_tool_runtime.py (the chat-path capability "
"selection fix: the mode-allowed toolset is exposed in the "
"prompt/capability blocks for local models and native "
"tool-calls for cloud; red-first live proof a CHAT-mode "
"turn sees and calls list_directory)",
"tui/bridge + tui/face (the context{used,limit} wiring on "
"the library seam: the face fetches /v1/status or its own "
"Ctx source, the info bar renders the numbers)",
"tui/face (model name compaction: base name + param size "
"+ ablation marker, path/quant noise dropped; cloud: "
"vendor + model + size)",
"tui/face (OSC 8 version hyperlink detect-then-render to "
"http://127.0.0.1:3000/conductor/rune/releases/tag/tui-v"
"<version>)",
"tui/face (timestamps far-left gutter per message row)",
"tests: red-first suites per item, -race green",
],
expected_runtime_effects=[
"a CHAT-mode chat turn exposes the read tools to the model "
"and a live list_directory call succeeds through the full "
"path",
"the info bar shows context used/limit after a turn",
"the info bar shows the compacted model name",
"the version token hyperlinks when the terminal answers "
"the OSC 8 query, plain text otherwise",
"timestamps sit in a far-left gutter per message row",
],
verification_obligations=[
"python -m pytest tests/ -count green for the touched "
"python suites; cd tui && go test ./... -race green, go "
"build + vet + gofmt clean",
"tmux PTY proofs at 110 cols with the REAL home and REAL "
"core: a real chat turn with tool visibility proof",
"deploy the binary",
],
approval_ref="user:D45 directive 2026-10-20",
contract_id="ADMIT-wave-d45-live-use-batch",
project_store=store,
project_id="rune",
)
print(json.dumps(env, indent=2, default=str)[:2400])
return 0 if env.get("success") else 1
if __name__ == "__main__":
sys.exit(main())