112 lines
4.3 KiB
Python
112 lines
4.3 KiB
Python
"""Admission dispatch for the wave-K18-universal-input build (openspec
|
|
task 5.1, rich analysis slice).
|
|
|
|
classify + activate + admit (the headless scaffolding entry law,
|
|
tests/test_construction_admission.py pattern): the drop floor's rich
|
|
analysis layer with honest fallback on the existing rune project,
|
|
user-dispatch approved.
|
|
"""
|
|
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 = (
|
|
"Implement the universal input rich analysis layer with fallback "
|
|
"for the Rune TUI (openspec add-native-rune-tui task 5.1, wave "
|
|
"K18): extend the landed drop path floor in tui/inputs with "
|
|
"file-type detection (Classify: image/pdf/office/audio/video/"
|
|
"folder/archive/code/file from path + metadata), capability-gated "
|
|
"routing to the best available analyzer (Route: vision model check "
|
|
"for images per spec, document analyzers for pdf/office, media "
|
|
"analyzers for audio/video, entry enumeration for folders and "
|
|
"archives), injectable analyzer seams, and honest degradation to "
|
|
"path + metadata when incapable (FallbackSummary names the missing "
|
|
"capability, never fabricates analysis); frozen red-first battery: "
|
|
"drop fixtures per type, incapable-terminal fallback proof (the "
|
|
"same image drop yields path + analysis result — no capability "
|
|
"gap, display mode only), and capability routing correctness matrix"
|
|
)
|
|
AFFECTED = [
|
|
"tui/inputs/analysis.go",
|
|
"tui/inputs/analysis_test.go",
|
|
"tui/inputs/inputs.go",
|
|
"tui/inputs/README.md",
|
|
]
|
|
|
|
|
|
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-K18-universal-input",
|
|
"objective": OBJECTIVE,
|
|
"origin": "worker",
|
|
"project": "rune",
|
|
"task_ref": "wave-K18-universal-input",
|
|
"affected_surface": AFFECTED,
|
|
"evidence_refs": [
|
|
"docs/openspec/changes/add-native-rune-tui/tasks.md",
|
|
"docs/openspec/changes/add-native-rune-tui/specs/inputs-and-integrations/spec.md",
|
|
"tui/inputs/README.md",
|
|
],
|
|
}
|
|
act = cact.activate(md, need=need, scaffold=scaffold,
|
|
builder="wave-K18-universal-input")
|
|
print("activated:", act.get("activated"), act.get("mode"))
|
|
|
|
env = cadm.admit(
|
|
act,
|
|
objective=OBJECTIVE,
|
|
builder="wave-K18-universal-input",
|
|
affected_surface=AFFECTED,
|
|
evidence_refs=need["evidence_refs"],
|
|
origin="worker",
|
|
task_ref="wave-K18-universal-input",
|
|
expected_new_entities=[
|
|
"tui/inputs/analysis.go (the analysis runtime: Classify + "
|
|
"Route + Analyzers seams + honest FallbackSummary)",
|
|
"tui/inputs/analysis_test.go (frozen battery: per-type drop "
|
|
"fixtures, incapable-terminal fallback, routing matrix)",
|
|
],
|
|
expected_runtime_effects=[
|
|
"Inputs.SetAnalyzers installs the analysis runtime; "
|
|
"Inputs.DropPath classifies a dropped path, routes to the "
|
|
"best analyzer the caps allow (vision model check per "
|
|
"spec), and degrades honestly to path + metadata when "
|
|
"incapable — the drop floor display itself is unchanged",
|
|
],
|
|
verification_obligations=[
|
|
"cd tui && go test ./inputs/ green (new TestAnalysis* "
|
|
"battery red-first, then green with the runtime)",
|
|
"cd tui && go vet ./inputs/ and go build ./... green",
|
|
],
|
|
approval_ref="user:wave-K18-universal-input dispatch",
|
|
contract_id="ADMIT-wave-K18-universal-input",
|
|
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())
|