GET /v1/integrations (per-connection capability listing + exact approved set + pending_consent); POST discover (MCP descriptor decode: capability fields ONLY — a foreign package mechanically cannot express authority); POST approve (exact-scope consent, sole mutator, scopes must be advertised); POST check (typed refusals: not_connected, not_advertised, pending_consent — expansion blocked until fresh exact-scope consent). Library seam: Repo.Integrations read. Frozen round-trip + enforcement + foreign-alter tests red-first green. Main-session verify: entry + lib suites green own runs.
110 lines
4.2 KiB
Python
110 lines
4.2 KiB
Python
"""Admission dispatch for the K23 inspect-before-connect settings wave
|
|
(task 5.2, runtime side).
|
|
|
|
classify + activate + admit (the headless scaffolding entry law,
|
|
scripts/admit_wave_settings_surfaces.py pattern): the integration
|
|
settings layer on the runtime side — the rune-entry serve surface
|
|
(/v1/integrations: capability listing, exact-scope approval, MCP
|
|
descriptor ingest feeding inspection only) plus the tui/runtime/lib
|
|
library seam that reads it — 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 = (
|
|
"build the task-5.2 inspect-before-connect integration settings on "
|
|
"the runtime side: a native /v1/integrations serve surface in "
|
|
"rune-entry (capability listing of what each external connection can "
|
|
"read/change BEFORE connecting, exact-scope approval, ingest of the "
|
|
"common MCP descriptor shape feeding inspection only — discovery is "
|
|
"never consent, advertised scope expansion after approval stays "
|
|
"blocked pending fresh exact-scope consent) plus the tui/runtime/lib "
|
|
"library seam that reads the same listing; foreign package content "
|
|
"cannot alter authority — approval mutates only through the owner "
|
|
"approve path, proven by a frozen foreign-alter refusal conformance "
|
|
"test; frozen tests: capability listing round-trip, exact-scope "
|
|
"approval enforcement, foreign-alter refusal; red-first"
|
|
)
|
|
AFFECTED = [
|
|
"src/go/rune-entry/internal/entry/integrations.go",
|
|
"src/go/rune-entry/internal/entry/integrations_test.go",
|
|
"src/go/rune-entry/internal/entry/serve.go",
|
|
"src/go/rune-entry/internal/entry/surface.go",
|
|
"tui/runtime/lib/integrations.go",
|
|
"tui/runtime/lib/integrations_test.go",
|
|
]
|
|
|
|
|
|
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-k23-mcp-settings",
|
|
"objective": OBJECTIVE,
|
|
"origin": "worker",
|
|
"project": "rune",
|
|
"task_ref": "wave-K23-mcp-settings",
|
|
"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",
|
|
"src/go/rune-entry/internal/entry/surface.go",
|
|
"tui/runtime/lib/lib.go",
|
|
],
|
|
}
|
|
act = cact.activate(md, need=need, scaffold=scaffold,
|
|
builder="wave-K23-mcp-settings")
|
|
print("activated:", act.get("activated"), act.get("mode"))
|
|
|
|
env = cadm.admit(
|
|
act,
|
|
objective=OBJECTIVE,
|
|
builder="wave-K23-mcp-settings",
|
|
affected_surface=AFFECTED,
|
|
evidence_refs=need["evidence_refs"],
|
|
origin="worker",
|
|
task_ref="wave-K23-mcp-settings",
|
|
expected_new_entities=[
|
|
"src/go/rune-entry /v1/integrations surface (package internal/entry)",
|
|
"tui/runtime/lib integration settings seam",
|
|
],
|
|
expected_runtime_effects=[
|
|
"serve surface gains GET/POST /v1/integrations* routes over an "
|
|
"on-disk hot state file; no existing route shapes change",
|
|
],
|
|
verification_obligations=[
|
|
"go test ./... green in src/go/rune-entry",
|
|
"go test ./runtime/lib/ green in tui/ (fixture tests)",
|
|
"gofmt + go vet clean on both touched packages",
|
|
],
|
|
approval_ref="user:wave-K23-mcp-settings dispatch",
|
|
contract_id="ADMIT-wave-K23-mcp-settings",
|
|
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())
|