Files
rune/scripts/admit_wave_k27_composer_depth.py
T
Nick 834eece4d7 feat(runtime+facade): batch landing — receipt presentation, compaction, composer depth, themes, Sleight wiring, gitignore hygiene, taxonomy
- K27 receipt presentation: full decision+evidence+effect packages,
  expandable sections, UNKNOWN-never-success in every dimension state,
  spine verdicts via evidence.Evaluate (read-only import)
- 2.6-depth compaction: append-per-message (O(1) tail line, 198 bytes
  steady-state), compaction every 64 appends (512/channel hot), cool
  archives per memory-continuity contract, nothing deleted, exact-by-ID
  across compaction+restart+tamper, legacy checkpoints heal on load
- K27 composer depth: 3-line input per old TUI contracts (§2.3 history
  walk, placeholder, stash/restore), deterministic natural-language
  resolution (40+ pinned phrases), palette natural-tier + ctrl+p bind,
  Accessibility profile (keyboard-only/no-color/reduced-motion)
- K27 themes: 10 fixed Go theme tables (byte-exact from Textual 8.2.8,
  not guessed; nord/dracula-default/monokai/solarized/catppuccin/tokyo-
  night/flexoki/gruvbox), /theme command (mirrors _cmd_theme exactly),
  live-editor data shape (staged per-token preview overrides), base bg
  rgb(30,30,40), no-drift drift test anchoring Go to retiring Python
- Sleight live wiring: operator._context_broker registers seventh
  contributor 'continuity' (bucket 2, fail-closed); K16 allowlist
  amended (memory_continuity.working_set); matrices now run against
  the live road; 102 tests green
- .gitignore hygiene: directory-level traps fixed (internal/ re-includes
  .go/.json/.md only; root-anchored /index/ /journal/ /state/; fixtures
  + testdata re-included at any depth); 6-test frozen gate; unified_check
  member wired; real git add (no -f) proven on testmod/internal
- Receipts, compaction, composer, themes, sleight-wiring, hygiene all
  under ADMIT contracts (101+ contracts, 0 research-gate violations)
- main.go NOT landed (chat-live P1 wave owns it, still in flight)
2026-10-17 22:00:03 +01:00

213 lines
8.8 KiB
Python

"""Admission dispatch for wave wave-K27-composer-depth: spec 2.2a depth
(openspec add-native-rune-tui task 2.2a — the composer groundwork gains
its FULL surface).
classify + activate + admit (the headless scaffolding entry law,
scripts/admit_wave_k27_receipt_presentation.py exemplar), admitted
through the research gate on the EXISTING round chain
research/tui-frontier-r2/qualify.json (registry entry tui-build-program,
verdict PROCEED — this wave is a K-series program wave).
Artifacts this wave admits: tui/nav/input3.go (the 3-line input state
machine per the old TUI design contracts, docs/tui-design-capture/
rune_tui.md §2.2/§2.3: fixed 3-line viewport, the pinned placeholder,
per-channel history walk with stash/restore semantics, dedup, blank
never recorded, Enter-send/Shift+Enter-newline through the live map),
tui/nav/natural.go (natural-language action resolution — deterministic
phrase/synonym table over the seed command vocabulary, never a guess),
tui/nav/access.go (the accessibility checks: keyboard-only traversal,
no-color textual-state, reduced-motion direct-key reachability), the
red-first frozen batteries input3_test.go / natural_test.go /
access_test.go, the palette.open seed command + ctrl+p default bind
(deliberate pin updates), and the README honest-scope update. Still
wiring (main session lands): cmd/rune-tui wiring, the palette executor
(StubExecution stays), transport into Chat/Task.
"""
import json
import os
import subprocess
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__), "..")
SLUG = "wave-K27-composer-depth"
RESEARCH_SLUG = "tui-build-program"
OBJECTIVE = (
"construct the spec-2.2a composer/navigation depth in tui/nav: the "
"groundwork gains its FULL surface as pure data + pure functions. "
"(1) Natural language plus searchable palette: deterministic "
"natural-language action resolution over the seed command vocabulary "
"(phrase/synonym table, verb composition, unresolvable phrases are "
"honest misses — never a guess), with the palette search round-trip "
"pinned phrase-to-action-to-command-to-pick. (2) Numbered direct "
"shortcuts: already pinned, stay frozen. (3) Fully rebindable keys "
"with conflict/reset/accessibility checks: conflict detection and "
"reset stay frozen; NEW accessibility checks — keyboard-only "
"traversal (palette opener bound, every focus/cycle/compose action "
"keyed), no-color textual state (unavailable-with-reason, hints and "
"key spellings carry text, never color alone), reduced-motion "
"direct-key reachability (no available command reachable only "
"through the moving palette). (4) The 3-line input per the old TUI "
"design contracts (docs/tui-design-capture/rune_tui.md §2.2/§2.3): "
"fixed 3-line viewport windowed on the cursor, the pinned "
"placeholder 'Type in <Label>... (/ for commands, ↑↓ history)', "
"per-channel history walk (up starts at most recent and stashes "
"current input, up at oldest is a no-op, down past newest restores "
"the stash and exits browsing, left/right/home/end/shift-arrows do "
"not disturb browsing, any other key exits browsing and discards "
"the stash, dedup on record, blank never recorded), "
"Enter-send/Shift+Enter-newline routed through the live key map. "
"The palette executor stays stubbed (StubExecution) and cmd/rune-tui "
"wiring stays with the main session. Frozen tests: palette search "
"round-trip, rebindable keymap conflict detection, 3-line input "
"state machine, numbered shortcuts. Red-first."
)
AFFECTED = [
"tui/nav/nav.go",
"tui/nav/input3.go",
"tui/nav/input3_test.go",
"tui/nav/natural.go",
"tui/nav/natural_test.go",
"tui/nav/access.go",
"tui/nav/access_test.go",
"tui/nav/palette.go",
"tui/nav/palette_test.go",
"tui/nav/keymap.go",
"tui/nav/keymap_test.go",
"tui/nav/README.md",
]
def record_research_gate(marker: str) -> int:
"""Post-mint: pin the gate evidence on the contract's ext.research_gate
record (the sweep's first resolution path) so the contract resolves
through the round chain, never through a registry glob. Idempotent."""
store_dir = os.path.join(ROOT, "store", "scaffold")
scaffold = sc.Scaffold(store_dir, "rune")
doc = scaffold.load()
c = scaffold.contract(doc, f"ADMIT-{SLUG}")
if c is None:
print("contract ADMIT-<slug> not found — nothing to record")
return 1
ext = c.setdefault("ext", {})
rg = ext.get("research_gate") or {}
rg.update({
"chain": "research/tui-frontier-r2/qualify.json",
"verdict": "PROCEED",
"marker": marker,
"note": "K-series program wave of add-native-rune-tui (registry "
"entry tui-build-program); spec 2.2a composer depth",
})
ext["research_gate"] = rg
scaffold.commit(doc, what=f"record research_gate evidence for {SLUG}")
print("research_gate record committed on ADMIT-" + SLUG)
return 0
def main() -> int:
# ── research gate (layer 1, pre-mint): the round chain carries this
# program wave; the ALLOW marker lands in the contract evidence.
gate = subprocess.run(
[sys.executable, os.path.join("scripts", "check_research_gate.py"),
"admit", "--slug", SLUG, "--objective", OBJECTIVE,
"--research-slug", RESEARCH_SLUG],
capture_output=True, text=True, cwd=ROOT,
)
print(gate.stdout.strip())
if gate.returncode != 0:
print("research gate REFUSED — the law holds")
return 1
marker = ""
for line in gate.stdout.splitlines():
if line.startswith("research-gate:ALLOW") or line.startswith("exempt:research-gate:"):
marker = line.strip()
break
if not marker:
print("no ALLOW marker in gate output — refusing to mint unrecorded")
return 1
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": f"need-{SLUG}",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": SLUG,
"affected_surface": AFFECTED,
"evidence_refs": [
marker,
"docs/openspec/changes/add-native-rune-tui/tasks.md#2.2a",
"docs/openspec/changes/add-native-rune-tui/specs/dual-lane-interface/spec.md",
"docs/tui-design-capture/rune_tui.md",
"research/harness-survey/open-question-register.md",
"tui/nav/nav.go",
"tui/nav/README.md",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder=SLUG)
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder=SLUG,
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref=SLUG,
expected_new_entities=[
"tui/nav Input3 3-line input state machine (viewport + "
"history + placeholder per the old TUI design contracts)",
"tui/nav natural-language action resolution (Interpret)",
"tui/nav accessibility checks (Accessibility profile + "
"CheckAccessibility)",
],
expected_runtime_effects=[
"pure data + pure functions only: no keys answered, no "
"pixels, no semantic State touched; the semantic-map "
"coherence pin and the StubExecution marker stay law; the "
"palette executor and cmd/rune-tui wiring stay with the "
"main session",
],
verification_obligations=[
"go test ./nav/ -count=1 green in tui/ (frozen groups: "
"palette search round-trip, keymap conflict detection, "
"3-line input state machine, numbered shortcuts)",
"gofmt -l and go vet clean on tui/nav",
"go build ./... green in tui/",
"python scripts/check_research_gate.py sweep GREEN",
],
approval_ref=f"user:{SLUG} dispatch",
contract_id=f"ADMIT-{SLUG}",
project_store=store,
project_id="rune",
)
print(json.dumps(env, indent=2, default=str)[:2400])
rc = 0 if env.get("success") else 1
if record_research_gate(marker) != 0:
return 1
return rc
if __name__ == "__main__":
sys.exit(main())