diff --git a/README.md b/README.md index ebc1e8f..d4cc2e2 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,8 @@ anything that sends data or reaches an unknown host waits for you.

- An agent (here Claude Code, in a lea container) fetches a page of pkg.go.dev, a trusted host: the lockhttp gate lets the GET through at once. It then POSTs a build report to hooks.example.net, an unknown host: the gate holds the request, and an approval screen shows it with the body preview masked (the email as j***(20), the token as <secret>). The human answers n token in body; the agent gets a 403 E_DENIED, and the gate's audit records both decisions. + An agent (here Claude Code, in a lea container) fetches a page of pkg.go.dev, a trusted host: the lockhttp gate lets the GET through at once. It then POSTs a build report to hooks.example.net, an unknown host: the gate holds the request, and a question shows in lox run, in your own terminal. You press d to read the whole masked screen (the author's email shows as j***(23)), then n to deny; the agent gets a 403 E_DENIED, denied on the hub, and the gate's audit records both decisions.

-

An agent (here Claude Code, left, in a lea container) and the approval screen (right). Drawn in the console's frame from before the hub: today you answer in lox run.

Quick start · diff --git a/docs/install.md b/docs/install.md index 9682467..dc7b263 100644 --- a/docs/install.md +++ b/docs/install.md @@ -54,7 +54,10 @@ no host install. Coming from v0.1.0's install](docker.md#migrating-from-a-host-install). The README's demo is generated by [`scripts/brand/demo.py`](../scripts/brand/demo.py): -`python3 scripts/brand/demo.py > site/assets/demo.svg`. +`python3 scripts/brand/demo.py > site/assets/demo.svg`. Its terminals show +the capture in `scripts/brand/demo-capture/`: output of the gate and of +`lox run`, taken in two separate test runs and joined by hand +([how](../scripts/brand/demo-capture/README.md)). Accounts, volumes, the exact `docker run` of each command, and what Docker does and does not separate: [docs/docker.md](docker.md). Every command diff --git a/internal/gate/democapture_test.go b/internal/gate/democapture_test.go new file mode 100644 index 0000000..42d4b9d --- /dev/null +++ b/internal/gate/democapture_test.go @@ -0,0 +1,119 @@ +package gate + +import ( + "crypto/tls" + "encoding/json" + "encoding/pem" + "fmt" + "net" + "net/http" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/DavidGodefroid/lockkit/hubclient" + "github.com/DavidGodefroid/lockkit/ticket" +) + +// containerConn is a connection that says it arrived on a container's +// network address, as one does in lea's proxy container: sources.json names +// the container by that address. +type containerConn struct { + net.Conn + local net.Addr +} + +func (c containerConn) LocalAddr() net.Addr { return c.local } + +type containerListener struct{ net.Listener } + +func (l containerListener) Accept() (net.Conn, error) { + c, err := l.Listener.Accept() + if err != nil { + return nil, err + } + return containerConn{c, &net.TCPAddr{IP: net.ParseIP("10.89.3.2"), Port: 3130}}, nil +} + +const demoCapturePolicy = ` +[profiles.default] +hold = "60s" +trusted = ["pkg.go.dev"] +` + +// TestDemoCapture is not a test: it writes the gate's half of the README +// demo's capture (scripts/brand/demo-capture/README.md). It is skipped +// unless LOCKHTTP_DEMO_OUT names a directory, and needs curl: +// +// LOCKHTTP_DEMO_OUT=/tmp/capture go test ./internal/gate -run TestDemoCapture -count=1 +// +// It runs the demo's two requests with curl through a gate that reads a +// sources.json as lea writes it, against the tests' fake hub and a stand-in +// upstream, and writes gate.txt (curl's output, then the gate's audit +// records) and ticket.json (the ticket the gate signed for the held POST). +// The fake hub denies the ticket as lox run's n does: no reason, facade tty. +func TestDemoCapture(t *testing.T) { + out := os.Getenv("LOCKHTTP_DEMO_OUT") + if out == "" { + t.Skip("LOCKHTTP_DEMO_OUT is not set") + } + write := func(path string, b []byte) { + t.Helper() + if err := os.WriteFile(path, b, 0o644); err != nil { + t.Fatal(err) + } + } + dir := t.TempDir() + sources := filepath.Join(dir, "sources.json") + b, _ := json.Marshal(map[string]any{"version": 1, + "networks": []map[string]string{{"local_ip": "10.89.3.2", "container": "lea-ab12cd34ef", "project": "shop"}}, + "agents": []map[string]string{{"token_sha256": sum([]byte("t3")), "container": "lea-ab12cd34ef", "agent": "dev-3", + "role": "dev", "parent": "lead-1", "task_id": "t-42", "branch": "feat/ci-report"}}}) + write(sources, b) + e := newEnvHub(t, demoCapturePolicy, true, func(c *hubclient.Config) { c.Instance = "web" }, nil, func(c *Config) { + c.Sources = NewSources(sources) + // The stand-in upstream's certificate is httptest's, not pkg.go.dev's. + c.UpstreamTLS = &tls.Config{InsecureSkipVerify: true} + }) + // The senders are confined (sources.json names them): the policy need + // not allow unconfined ones. Wait for the gate to read it again. + e.console.pol.Unconfined = false + time.Sleep(300 * time.Millisecond) + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { ln.Close() }) + go func() { _ = e.gate.Serve(t.Context(), containerListener{ln}) }() + e.backend("pkg.go.dev", true, http.HandlerFunc(ok)) + e.remap("pkg.go.dev", "443") + + caFile := filepath.Join(dir, "ca.pem") + write(caFile, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: e.gate.cfg.Certs.(localCerts).c.Cert.Raw})) + write(filepath.Join(dir, "report.json"), []byte(`{"build":"ok","author":"jean.dupont@example.org"}`)) + var sb strings.Builder + curl := func(args ...string) { + cmd := exec.Command("curl", args...) + cmd.Dir = dir + proxy := "http://dev-3:t3@" + ln.Addr().String() + cmd.Env = append(os.Environ(), "HTTPS_PROXY="+proxy, "HTTP_PROXY="+proxy, "CURL_CA_BUNDLE="+caFile, "NO_PROXY=", "no_proxy=") + o, err := cmd.CombinedOutput() + fmt.Fprintf(&sb, "$ curl %s\n%s[exit: %v]\n", strings.Join(args, " "), o, err) + } + curl("-sS", "-o", "/dev/null", "-w", "%{http_code}\n", "https://pkg.go.dev/net/http") + go func() { + tk := e.hub.waitTickets(1)[0] + j, _ := json.MarshalIndent(tk, "", " ") + write(filepath.Join(out, "ticket.json"), j) + time.Sleep(300 * time.Millisecond) + e.hub.decideWith(tk, ticket.Denied, "", nil, "", func(d *ticket.Decision) { + d.Approver = ticket.Approver{ID: "host:uid:1000", Display: "alice"} + }) + }() + curl("-sS", "-X", "POST", "https://hooks.example.net/build", "-H", "content-type: application/json", "-d", "@report.json") + fmt.Fprintf(&sb, "== AUDIT\n%s\n", e.auditText()) + write(filepath.Join(out, "gate.txt"), []byte(sb.String())) +} diff --git a/scripts/brand/demo-capture/README.md b/scripts/brand/demo-capture/README.md new file mode 100644 index 0000000..d162d44 --- /dev/null +++ b/scripts/brand/demo-capture/README.md @@ -0,0 +1,79 @@ +# The demo's capture + +`scripts/brand/demo.py` draws `site/assets/demo.svg` (the README's and the +site's demo) from the files here. They are output of the code, but **not of +one run of a lea + `lox run` stack**: two runs, in two repositories, joined +by hand. + +Sources: lockhttp `2f0d37f`, lockhub `4d94ef1`, both on lockkit `v0.20.0`. + +## The files + +| File | What it is | Produced by | +|---|---|---| +| `gate.txt` | The two `curl` commands, their output as curl printed it, then the gate's audit records. | Run 1 | +| `lox-run-idle.ans`, `lox-run-question.ans`, `lox-run-details.ans`, `lox-run-denied.ans` | The frames `lox run` drew, 80×26, with their colours (SGR): before the ticket, the question, the question after `d`, after `n`. | Run 2 | +| `loxrun_demo_test.go.txt` | The test of run 2. It belongs in lockhub, so it is kept here as text and is not built. | — | + +## Run 1: the gate (this repository) + +`internal/gate/democapture_test.go`, `TestDemoCapture`, skipped unless +`LOCKHTTP_DEMO_OUT` names a directory. Needs `curl`. + +```sh +LOCKHTTP_DEMO_OUT=/tmp/capture go test ./internal/gate -run TestDemoCapture -count=1 +``` + +It starts the gate of `internal/gate` as the package's tests do, with TLS +decryption, a `sources.json` as lea writes it (container `lea-ab12cd34ef`, +agent `dev-3`) and the policy `trusted = ["pkg.go.dev"]`, `hold = "60s"`. +Real `curl`, with `HTTPS_PROXY` set as lea sets it, sends the GET and the +POST. It writes `gate.txt` and `ticket.json`, the ticket the gate signed for +the held POST. + +What is not the real thing in this run: + +- **The hub is the test suite's fake hub.** It denies the ticket the way + `lox run`'s `n` does, as run 2 showed: no reason, facade `tty` (the gate + turns an empty reason into `denied on the hub`). +- **The upstream is a stand-in**, not pkg.go.dev: the `200` is the gate's + answer for it. +- The connections are given the container's network address by the test + (in lea, the proxy container has that address). + +## Run 2: `lox run` (lockhub) + +In a throwaway worktree of lockhub at `4d94ef1`: + +1. In `internal/loxrun/e2e_test.go`: `inst = "shop"` becomes `"web"`, the + size `100, 30` becomes `80, 26`, `Workspace: "~/e2e"` becomes + `"~/Documents/shop"`. +2. Copy `loxrun_demo_test.go.txt` to `internal/loxrun/zz_demo_test.go`. +3. `LOCKHTTP_DEMO_OUT=/tmp/capture go test ./internal/loxrun -run TestLockhttpDemo -count=1` + +It uses lockhub's e2e world: the real hub, a real lockkit hub client, and +`lox run` driven by key presses. It writes the four frames and +`decision.txt`, the hub's signed decision. + +## The join + +Run 2 does not receive run 1's ticket over the wire. It reads `ticket.json` +and **builds and signs a ticket again**, with the same risk, flags, +requester, header, body lines and warning, the way `internal/gate/hub.go` +does (`ticket.NewTicket`, `render.MaskScreen` with the same detectors), +under the lock key of lockhub's harness. So: + +- the request id is the same on both sides, the ticket id is not; +- the clocks are those of two runs, a few seconds apart; +- the denial in `gate.txt` was given by run 1's fake hub, not by the `n` + pressed in run 2. + +## Typed in `demo.py`, not captured + +The prompt, the two `curl` commands as shown, Claude Code's frame around a +command and its output (`● Bash(…)`, `└`, `Running…`), the pane titles, the +`FREE` / `ASK` / `403` badges, the two "you press…" hints (`lox run` does +not echo keys), the audit box's title and the three captions. The audit +lines are records of `gate.txt` with fields left out where they show `…`; +`gate.txt` holds a third record (`refused`, the answer sent to the agent) +that the demo does not show. diff --git a/scripts/brand/demo-capture/gate.txt b/scripts/brand/demo-capture/gate.txt new file mode 100644 index 0000000..0a3fad2 --- /dev/null +++ b/scripts/brand/demo-capture/gate.txt @@ -0,0 +1,14 @@ +$ curl -sS -o /dev/null -w %{http_code} + https://pkg.go.dev/net/http +200 +[exit: ] +$ curl -sS -X POST https://hooks.example.net/build -H content-type: application/json -d @report.json +LockHTTP refused this request (E_DENIED): denied on the hub +Do not retry the same request; ask the user. +request id: h-mwm16i9i-c991bc1966bb624f +[exit: ] +== AUDIT +{"ts":"2026-11-18T11:21:23.949Z","event":"free","profile":"default","decision":"free","request_id":"h-mwm16i95-8f20dc2b6683da80","container":"lea-ab12cd34ef","project":"shop","via":"direct","agent":"dev-3","attribution":"proxy-auth","role":"dev","parent":"lead-1","task_id":"t-42","branch":"feat/ci-report","phase":"http","tls":"mitm","method":"GET","host":"pkg.go.dev","port":443,"path":"/net/http","req_headers":["accept","user-agent"],"rule":"trusted","class":"read","status":200,"resp_bytes":184,"duration_ms":4,"policy_fp":"sha256:ffe9c710b3ecc681e9f1f83e4a6b2a5ded6b1c439326de2c7c038bbd8de8f52c"} +{"ts":"2026-11-18T11:21:24.339Z","event":"denied","profile":"default","decision":"denied","warnings":["unknown host hooks.example.net"],"reason":"denied on the hub","approval":"hub","ticket":"01M7Q67PRCDJT3ACXBTEMMVS5Z","approver":{"id":"host:uid:1000","display":"alice"},"facade":"tty","hub_sig":"mBpqSdMPx0OymG7pcZYs01YEun274zV3xSRnwTMi9xKbpOwLVezSpvmWJpVDtubxIcOLyS3UdSn-VvhZBu2qDQ","request_id":"h-mwm16i9i-c991bc1966bb624f","container":"lea-ab12cd34ef","project":"shop","via":"direct","agent":"dev-3","attribution":"proxy-auth","role":"dev","parent":"lead-1","task_id":"t-42","branch":"feat/ci-report","phase":"http","tls":"mitm","method":"POST","host":"hooks.example.net","port":443,"path":"/build","req_headers":["accept","content-length","content-type","user-agent"],"req_bytes":49,"body_fp":"json:a20a0c27eefde4875a3a193fa2802e3e8de1e09d24334ce7633b23fc8c09b2fd","rule":"default:write","class":"write","policy_fp":"sha256:ffe9c710b3ecc681e9f1f83e4a6b2a5ded6b1c439326de2c7c038bbd8de8f52c"} +{"ts":"2026-11-18T11:21:24.339Z","event":"refused","profile":"default","decision":"refused","code":"E_DENIED","warnings":["unknown host hooks.example.net"],"reason":"denied on the hub","request_id":"h-mwm16i9i-c991bc1966bb624f","container":"lea-ab12cd34ef","project":"shop","via":"direct","agent":"dev-3","attribution":"proxy-auth","role":"dev","parent":"lead-1","task_id":"t-42","branch":"feat/ci-report","phase":"http","tls":"mitm","method":"POST","host":"hooks.example.net","port":443,"path":"/build","req_headers":["accept","content-length","content-type","user-agent"],"req_bytes":49,"body_fp":"json:a20a0c27eefde4875a3a193fa2802e3e8de1e09d24334ce7633b23fc8c09b2fd","rule":"default:write","class":"write","policy_fp":"sha256:ffe9c710b3ecc681e9f1f83e4a6b2a5ded6b1c439326de2c7c038bbd8de8f52c"} + diff --git a/scripts/brand/demo-capture/lox-run-denied.ans b/scripts/brand/demo-capture/lox-run-denied.ans new file mode 100644 index 0000000..9eabe09 --- /dev/null +++ b/scripts/brand/demo-capture/lox-run-denied.ans @@ -0,0 +1,26 @@ + lox run  AUTO  ~/Documents/shop ● hub up · 1 lock + connected none yet: a lock connects on its agent's first request +──────────────────────────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + 12:21:49 dev-3 ⇄ web - write from container lea… ✘ denied +──────────────────────────────────────────────────────────────────────────────── + Shift+Tab mode a audit ? help q quit \ No newline at end of file diff --git a/scripts/brand/demo-capture/lox-run-details.ans b/scripts/brand/demo-capture/lox-run-details.ans new file mode 100644 index 0000000..0e8acee --- /dev/null +++ b/scripts/brand/demo-capture/lox-run-details.ans @@ -0,0 +1,26 @@ + lox run  AUTO  ~/Documents/shop ● hub up · 1 lock · 1 waiting + connected none yet: a lock connects on its agent's first request +──────────────────────────────────────────────────────────────────────────────── + ┌ ◆ QUESTION write on web ───────────────────────────────────────────────────┐ + │ dev-3 asks (unverified name) · ⇄ lockhttp · expires in 23h59m │ + │ POST hooks.example.net · lea-ab12cd34ef │ + │  from container lea-ab12cd34ef (project shop) · agent dev-3 (declared, pr…│ + │  POST mitm://hooks.example.net/build │ + │  body 49 bytes application/json json:a20a0c27eefde4… │ + │  headers: accept content-length content-type user-agent │ + │  task t-42 · role dev · parent lead-1 · branch feat/ci-report │ + │  decided by: default:write │ + │  │ + │  preview (masked): │ + │  {"build":"ok","author":"‹j***(23)›"} │ + │  │ + │  client gone: y lets the same request through once in the next 10 minutes │ + │  request h-mwm16i9i-c991bc1966bb624f │ + │ ! unknown host hooks.example.net │ + │ why asked: this lock's ticket does not name its kind (version 1): asked │ + │ y approve n deny d less x forget profile │ + └────────────────────────────────────────────────────────────────────────────┘ + + 12:21:49 dev-3 ⇄ web - write from container lea… ◆ ask:v1 +──────────────────────────────────────────────────────────────────────────────── + Shift+Tab mode y/n answer d details a audit ? help q quit \ No newline at end of file diff --git a/scripts/brand/demo-capture/lox-run-idle.ans b/scripts/brand/demo-capture/lox-run-idle.ans new file mode 100644 index 0000000..cfaf0cc --- /dev/null +++ b/scripts/brand/demo-capture/lox-run-idle.ans @@ -0,0 +1,26 @@ + lox run  AUTO  ~/Documents/shop ● hub up · 1 lock + connected none yet: a lock connects on its agent's first request +──────────────────────────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + no ticket yet: every ticket and decision of the hub shows here, masked by its… +──────────────────────────────────────────────────────────────────────────────── + Shift+Tab mode a audit ? help q quit \ No newline at end of file diff --git a/scripts/brand/demo-capture/lox-run-question.ans b/scripts/brand/demo-capture/lox-run-question.ans new file mode 100644 index 0000000..611c21e --- /dev/null +++ b/scripts/brand/demo-capture/lox-run-question.ans @@ -0,0 +1,26 @@ + lox run  AUTO  ~/Documents/shop ● hub up · 1 lock · 1 waiting + connected none yet: a lock connects on its agent's first request +──────────────────────────────────────────────────────────────────────────────── + ┌ ◆ QUESTION write on web ───────────────────────────────────────────────────┐ + │ dev-3 asks (unverified name) · ⇄ lockhttp · expires in 23h59m │ + │ POST hooks.example.net · lea-ab12cd34ef │ + │  from container lea-ab12cd34ef (project shop) · agent dev-3 (declared, pr…│ + │  POST mitm://hooks.example.net/build │ + │  body 49 bytes application/json json:a20a0c27eefde4… │ + │  headers: accept content-length content-type user-agent │ + │  … 8 more lines: d for details │ + │ ! unknown host hooks.example.net │ + │ why asked: this lock's ticket does not name its kind (version 1): asked │ + │ y approve n deny d details x forget profile │ + └────────────────────────────────────────────────────────────────────────────┘ + + + + + + + + + 12:21:49 dev-3 ⇄ web - write from container lea… ◆ ask:v1 +──────────────────────────────────────────────────────────────────────────────── + Shift+Tab mode y/n answer d details a audit ? help q quit \ No newline at end of file diff --git a/scripts/brand/demo-capture/loxrun_demo_test.go.txt b/scripts/brand/demo-capture/loxrun_demo_test.go.txt new file mode 100644 index 0000000..790c4b2 --- /dev/null +++ b/scripts/brand/demo-capture/loxrun_demo_test.go.txt @@ -0,0 +1,105 @@ +package loxrun_test + +// The lox run half of lockhttp's README demo capture (lockhttp +// scripts/brand/demo-capture/README.md). Not part of lockhttp's build: copy +// it to lockhub as internal/loxrun/zz_demo_test.go, in a throwaway worktree, +// after the three edits of e2e_test.go that README lists. +// +// It submits the ticket lockhttp's gate signed (ticket.json, written by +// lockhttp's TestDemoCapture) through lockhub's e2e world (the real hub, a +// real lockkit hub client, lox run driven by key presses), presses d then n, +// and writes the frames lox run drew, with their colours, and the hub's +// signed decision. + +import ( + "context" + "encoding/json" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/DavidGodefroid/lockkit/pii" + "github.com/DavidGodefroid/lockkit/plans" + "github.com/DavidGodefroid/lockkit/render" + "github.com/DavidGodefroid/lockkit/ticket" + + "github.com/DavidGodefroid/lockhub/internal/loxrun" +) + +func lastFrame(s string) string { + i := strings.LastIndex(s, "\x1b[H") + if i < 0 { + return s + } + f := s[i+3:] + f = strings.ReplaceAll(f, "\x1b[K", "") + f = strings.ReplaceAll(f, "\x1b[J", "") + f = strings.ReplaceAll(f, "\a", "") + return strings.ReplaceAll(f, "\r\n", "\n") +} + +func TestLockhttpDemo(t *testing.T) { + out := os.Getenv("LOCKHTTP_DEMO_OUT") + if out == "" { + t.Skip() + } + raw, err := os.ReadFile(filepath.Join(out, "ticket.json")) + if err != nil { + t.Fatal(err) + } + var src ticket.Ticket + if err := json.Unmarshal(raw, &src); err != nil { + t.Fatal(err) + } + w := newWorldArm(t, -1) + save := func(name string) { + time.Sleep(400 * time.Millisecond) + os.WriteFile(filepath.Join(out, name), []byte(lastFrame(w.out.String())), 0o644) + } + save("lox-run-idle.ans") + + // The ticket as lockhttp's gate builds it (internal/gate/hub.go hubSubmit). + in := map[string]string{"request": "sha256:" + strings.Repeat("a", 64), "policy": src.PolicyFP} + hash, _ := ticket.HashOf(in) + p, err := w.plans.Create(plans.Binding{UID: caller.UID, Agent: src.Requester.Agent, TokenHash: plans.HashToken(caller.Token), + PolicyFP: src.PolicyFP, PlanHash: hash, Inputs: in}, json.RawMessage(`{}`), ticket.ClampTTL(src.Risk, 0)) + if err != nil { + t.Fatal(err) + } + tk := ticket.NewTicket(ticket.Source{Lock: "lockhttp"}, src.Risk, hash, src.PolicyFP, time.Now(), ticket.ClampTTL(src.Risk, 0)) + tk.Requester = src.Requester + tk.Flags = src.Flags + lines := make([]render.Line, 0, len(src.Screen.Body)) + for _, l := range src.Screen.Body { + lines = append(lines, render.Structure(l)) + } + ds, err := pii.Detectors([]string{"email", "phone", "iban", "card"}) + if err != nil { + t.Fatal(err) + } + masked := render.MaskScreen(render.ScreenSource{Header: src.Screen.Header, Body: lines, Warnings: src.Screen.Warnings, Red: src.Screen.Red}, + render.Masking{Detectors: ds}) + id, err := w.lock.Submit(context.Background(), w.plans, p.ID, caller, tk, masked) + if err != nil { + t.Fatal(err) + } + q := w.wait(loxrun.EvQuestion, "") + if q.ID != id { + t.Fatalf("question %s, ticket %s", q.ID, id) + } + save("lox-run-question.ans") + w.press(loxrun.R('d')) + save("lox-run-details.ans") + w.press(loxrun.R('d')) + time.Sleep(200 * time.Millisecond) + w.press(loxrun.R('n')) + d := w.wait(loxrun.EvDecided, id) + save("lox-run-denied.ans") + dec := w.decision(id) + j, _ := json.MarshalIndent(dec, "", " ") + _, _, berr := w.lock.Begin(w.plans, id, caller, func(*plans.Plan) (string, string, error) { return src.PolicyFP, hash, nil }) + os.WriteFile(filepath.Join(out, "decision.txt"), []byte(fmt.Sprintf("event: %+v\n%s\nlock sees: %v\n", d, j, berr)), 0o644) +} diff --git a/scripts/brand/demo.py b/scripts/brand/demo.py index 95a248a..7b13c60 100644 --- a/scripts/brand/demo.py +++ b/scripts/brand/demo.py @@ -1,24 +1,39 @@ #!/usr/bin/env python3 """Generate site/assets/demo.svg: lockhttp's value in one looping image. -Claude Code (left, in a lea container) reads a page of a trusted docs host: the gate lets the GET -through at once. It then POSTs a build report to an unknown host: the gate holds the request and -the lockhttp console (right, its own account) shows the approval screen, with the body preview -masked. The human answers "n token in body"; the agent gets a 403 E_DENIED, and the gate's audit -keeps both decisions. Pure SVG + CSS keyframes, so it plays on GitHub, on the site and in any -browser. Every animation shares one clock of LOOP seconds. - -The console, refusal and audit lines follow the real output of lockhttp and lockkit (approval -frame, screen body from internal/httpconsole, Preview masking, writeRefusal, wire.Record); keep -them in step when those change. The audit lines are abridged where they show "…". +An agent (left, Claude Code in a lea container) reads a page of a trusted host: the gate lets the +GET through at once. It then POSTs a build report to an unknown host: the gate holds the request +and asks lockhub, and the question shows in `lox run` (right, the human's own terminal, outside +lea). The human presses d to read the whole masked screen, then n; the agent gets a 403 E_DENIED, +and the gate's audit keeps both decisions. Pure SVG + CSS keyframes, so it plays on GitHub, on +the site and in any browser. Every animation shares one clock of LOOP seconds. + +No output on screen is written here: it is read from scripts/brand/demo-capture/. That capture +is output of the code, but of two separate runs joined by hand, not of one lea + lox run stack +(demo-capture/README.md says how each file was made): + + gate.txt two curl commands through the gate (internal/gate), against the tests' fake + hub and a stand-in upstream: their output, then the gate's audit records + lox-run-*.ans the frames lockhub's `lox run` (internal/loxrun) drew, in lockhub's own test + harness, for a ticket built again from the one the gate signed + +What is typed here is the scenario's input (the prompt, the two commands), Claude Code's frame +around a command and its output, the pane titles, the badges, the key hints and the captions. +The audit lines are captured records with fields left out where they show "…". python3 scripts/brand/demo.py > site/assets/demo.svg """ -LOOP = 14.5 +import json +import pathlib +import re + +CAPTURE = pathlib.Path(__file__).parent / "demo-capture" + +LOOP = 16.0 C = dict(bg="#0b1120", pane="#020617", bar="#0f172a", border="#253047", text="#e2e8f0", dim="#64748b", sub="#94a3b8", green="#4ade80", teal="#5eead4", violet="#a78bfa", - red="#f87171", yellow="#facc15", accent="#22c55e") + red="#f87171", yellow="#facc15", cyan="#22d3ee", accent="#22c55e") FONT = "'JetBrains Mono','SF Mono',Menlo,Consolas,'DejaVu Sans Mono',monospace" SANS = "Inter,-apple-system,'Segoe UI',system-ui,Helvetica,Arial,'DejaVu Sans',sans-serif" @@ -95,95 +110,179 @@ def badge(xc, y, label, col, cls): family=FONT, anchor="middle") + "") -W, H = 1200, 600 +# --- The capture -------------------------------------------------------------------------- + +def read_gate(): + """gate.txt: the output of each curl, and the audit records.""" + raw = (CAPTURE / "gate.txt").read_text() + runs, audit = raw.split("== AUDIT\n") + outs = [] + for block in runs.split("$ curl ")[1:]: + out = block[:block.index("[exit: ")] + # The command's own echo ends at its URL or its last argument. + marker = "https://pkg.go.dev/net/http\n" if "pkg.go.dev" in out else "-d @report.json\n" + outs.append(out[out.index(marker) + len(marker):].rstrip("\n").split("\n")) + return outs, [json.loads(l) for l in audit.splitlines() if l.strip()] + + +SGR = re.compile(r"\x1b\[([0-9;]*)m") +FG = {"30": C["pane"], "31": C["red"], "32": C["green"], "33": C["yellow"], "36": C["cyan"]} +BG = {"42": C["green"]} + + +def read_frame(name): + """A frame of lox run as rows of runs (col, text, colour, bold, italic, background).""" + rows = [] + for raw in (CAPTURE / f"lox-run-{name}.ans").read_text().split("\n"): + runs, col, pos = [], 0, 0 + fg, bold, italic, bg, dim = C["text"], False, False, None, False + + def emit(s): + nonlocal col + if s: + colour = fg if not dim or fg != C["text"] else C["sub"] + runs.append((col, s, colour, bold, italic, bg)) + col += len(s) + + for m in SGR.finditer(raw): + emit(raw[pos:m.start()]) + pos = m.end() + for code in (m.group(1) or "0").split(";"): + if code in ("0", ""): + fg, bold, italic, bg, dim = C["text"], False, False, None, False + elif code == "1": + bold = True + elif code == "2": + dim = True + elif code == "3": + italic = True + elif code in FG: + fg = FG[code] + elif code in BG: + bg = BG[code] + else: + raise SystemExit(f"demo.py: SGR {code} of lox-run-{name}.ans has no colour here") + emit(raw[pos:]) + rows.append(runs) + return rows + + +def draw_frame(rows, x, y, lh, size, cls): + """Each run is placed at its own column and stretched to its width, so a glyph taken from + a fallback font never shifts what follows it.""" + chw = size * 0.602 + out = [f''] + for r, runs in enumerate(rows): + yy = y + r * lh + for col, s, colour, bold, italic, bg in runs: + if bg: + out.append(f'') + lead = len(s) - len(s.lstrip(" ")) + t = s.strip(" ") + if not t: + continue + attrs = f' font-weight="700"' if bold else "" + attrs += ' font-style="italic"' if italic else "" + out.append(f'{esc(t)}') + out.append("") + return "".join(out) + + +curl_out, audit = read_gate() +get_out, post_out = curl_out +free_rec = next(r for r in audit if r["event"] == "free") +denied_rec = next(r for r in audit if r["event"] == "denied") +container, agent_name = free_rec["container"], free_rec["agent"] + +W, H = 1200, 680 body.append(f'') LH = 18 D, S, T, G, R, Y, V = C["dim"], C["sub"], C["text"], C["green"], C["red"], C["yellow"], C["violet"] +# Timeline (seconds). +T_GET, T_GET_OUT = 1.0, 1.9 +T_POST, T_ASK = 3.2, 4.0 +T_DETAILS, T_DENY, T_REPLY = 6.0, 9.4, 10.2 + # --- Agent pane (left) -------------------------------------------------------------------- -AX, AY, AW, AH = 24, 24, 468, 388 -pane(AX, AY, AW, AH, "✻ Claude Code", "container lea-ab12cd34ef") +AX, AY, AW, AH = 24, 24, 476, 468 +pane(AX, AY, AW, AH, "✻ Claude Code", f"container {container}") ax, ay = AX + 16, AY + 54 agent = [ - (0.3, [("> ", D), ("read the net/http Client docs, then post the", T)]), + (0.3, [("> ", D), ("check that the net/http docs are up, then post the", T)]), (0.3, [(" ", D), ("build report to our webhook", T)]), - (1.0, [("● ", G), ("Fetch", T), ("(https://pkg.go.dev/net/http)", S)]), - (1.9, [(" └ ", D), ("Received 41.2KB (200 OK)", S)]), - (2.6, [("● ", T), ("Client.Timeout bounds the whole exchange.", T)]), - (2.6, [(" ", T), ("Posting the report now.", T)]), - (3.4, [("● ", G), ("Bash", T), ("(curl -sS -X POST https://hooks.example.net/build", S)]), - (3.4, [(" ", T), ("-H 'content-type: application/json' -d @report.json)", S)]), + (None, []), + (T_GET, [("● ", G), ("Bash", T), ("(curl -sS -o /dev/null -w '%{http_code}\\n'", S)]), + (T_GET, [(" ", T), ("https://pkg.go.dev/net/http)", S)]), ] +agent += [(T_GET_OUT, [(" └ " if i == 0 else " ", D), (l, T)]) for i, l in enumerate(get_out)] +agent += [ + (None, []), + (T_POST, [("● ", G), ("Bash", T), ("(curl -sS -X POST https://hooks.example.net/build", S)]), + (T_POST, [(" ", T), ("-H 'content-type: application/json' -d @report.json)", S)]), +] +get_row = 3 +post_row = len(agent) - 2 for i, (t, parts) in enumerate(agent): - body.append(spans(ax, ay + i * LH, parts, cls=show(t))) + if parts: + body.append(spans(ax, ay + i * LH, parts, cls=show(t))) row = len(agent) -body.append(spans(ax, ay + row * LH, [(" └ ", D), ("Running…", Y)], cls=show(3.7, 7.6))) -reply = [ - (7.8, [(" └ ", D), ("LockHTTP refused this request (E_DENIED): denied by", T)]), - (7.8, [(" ", D), ("the human: token in body; do not retry unless asked", T)]), - (7.8, [(" ", D), ("Do not retry the same request; ask the user.", T)]), - (7.8, [(" ", D), ("request id: h-mh9q2m7c-91fd04b2a8e6c357", D)]), - (8.8, [("● ", T), ("You refused the post: report.json carries a", T)]), - (8.8, [(" ", T), ("token. I won't retry. Send it without the token?", T)]), -] -for i, (t, parts) in enumerate(reply): - body.append(spans(ax, ay + (row + i) * LH, parts, cls=show(t))) - -# --- Console pane (right) ----------------------------------------------------------------- -CX, CY, CW, CH = 572, 24, 604, 388 -pane(CX, CY, CW, CH, "lockhttp console", "account lockhttp · its own session") -cx, cy = CX + 16, CY + 54 -CS = 11.5 # one character is 0.602 em wide +body.append(spans(ax, ay + row * LH, [(" └ ", D), ("Running…", Y)], cls=show(T_POST + 0.3, T_REPLY - 0.2))) + + +def wrap(s, width): + """Wrap on spaces, as the agent's terminal does.""" + out, cur = [], "" + for word in s.split(" "): + if cur and len(cur) + 1 + len(word) > width: + out.append(cur) + cur = word + else: + cur = f"{cur} {word}" if cur else word + return out + [cur] + + +reply = [] +for l in post_out: + reply += wrap(l, 60) +for i, l in enumerate(reply): + colour = D if l.startswith("request id:") else T + body.append(spans(ax, ay + (row + i) * LH, [(" └ " if i == 0 else " ", D), (l, colour)], + cls=show(T_REPLY))) + +# --- lox run pane (right) ----------------------------------------------------------------- +CX, CY, CW, CH = 580, 24, 596, 468 +pane(CX, CY, CW, CH, "lox run", "your terminal · outside lea") +CS, CLH = 11.5, 16 CHW = CS * 0.602 -con = [ - [("$ ", D), ("lockhttp console", T)], - [("✓ ", G), ("profile ", T), ("default", T), (" · lockhttp gate ", T), ("(approved policy)", D)], - [("› ", C["accent"]), ("Listening on /run/lockhttp/user-default.sock", T)], -] -for i, parts in enumerate(con): - body.append(spans(cx, cy + i * LH, parts, size=CS)) -screen = [ - [("╭─ ", V), ("DEFAULT", V), (" · POST hooks.example.net · lea-ab12cd34ef ", T), ("─────", V)], - [("│ ", V), ("requested by container lea-ab12cd34ef · agent dev-3 (declared, proxy-auth)", D)], - [("│", V)], - [("│ ", V), ("POST mitm://hooks.example.net/build", T)], - [("│ ", V), ("body 97 bytes application/json json:31578a783c831b…", T)], - [("│ ", V), ("task t-42 · role dev · parent lead-1 · branch feat/ci-report", T)], - [("│ ", V), ("decided by: default:write", T)], - [("│", V)], - [("│ ", V), ("preview (masked):", T)], - [("│ ", V), (' {"build":"ok","author":', T), ('"j***(20)"', C["teal"]), (',"token":', T), - ('""', C["teal"]), ("}", T)], - [("│ ", V), ("request h-mh9q2m7c-91fd04b2a8e6c357", T)], - [("│ ", V), ("▲ unknown host hooks.example.net", R)], -] -srow = len(con) + 1 -g = [f''] -for i, parts in enumerate(screen): - g.append(spans(cx, cy + (srow + i) * LH, parts, size=CS)) -g.append("") -body.append("".join(g)) -prow = srow + len(screen) -py = cy + prow * LH -body.append(spans(cx, py, [("╰─ ", V), ("Approve? [y/N] ", T)], cls=show(4.4), size=CS)) -# The human types "n token in body", one key at a time. -answer = "n token in body" -for i, ch in enumerate(answer): - if ch != " ": - body.append(text(cx + CHW * (18 + i), py, ch, cls=show(6.0 + i * 0.06, fade=0.03), size=CS, - col=R if i == 0 else T, weight=700 if i == 0 else 400)) -# Cursor, blinking before the answer, then following it. -blink = anim([(0, "opacity:0"), (4.5, "opacity:0"), (4.51, "opacity:1"), (5.0, "opacity:1"), - (5.01, "opacity:0"), (5.4, "opacity:0"), (5.41, "opacity:1"), (5.99, "opacity:1"), - (6.0, "opacity:0"), (LOOP, "opacity:0")]) -body.append(f'') -body.append(spans(cx, py + LH, [("✗ ", R), ("denied: token in body", T)], cls=show(7.0), size=CS)) -# Key hint, lit while the console waits. -body.append(f'' - + text(CX + CW - 106, py, "only you can answer", size=12, col=C["pane"], - weight=700, family=SANS, anchor="middle") + "") +cx, cy = CX + 20, CY + 52 +frames = [("idle", 0.0, T_ASK), ("question", T_ASK, T_DETAILS), ("details", T_DETAILS, T_DENY), + ("denied", T_DENY, END)] +for name, t0, t1 in frames: + rows = read_frame(name) + if name == "idle": + cls = anim([(0, "opacity:1"), (t1, "opacity:1"), (t1 + 0.1, "opacity:0"), (END + 0.5, "opacity:0"), + (LOOP, "opacity:1")]) + else: + cls = show(t0, END if name == "denied" else t1, fade=0.1) + body.append(draw_frame(rows, cx, cy, CLH, CS, cls)) + + +def key_hint(t0, t1, label): + """The key the human presses: lox run does not echo it.""" + w = 196 + xc = CX + CW / 2 - 10 + body.append(f'' + + text(xc, CY + 19.5, label, size=12, col=C["pane"], + weight=700, family=SANS, anchor="middle") + "") + + +key_hint(T_ASK + 0.9, T_DETAILS, "you press d: the whole screen") +key_hint(T_DETAILS + 2.2, T_DENY, "you press n: deny") # --- The gate, between the two ------------------------------------------------------------ GX, GW = AX + AW + 12, CX - AX - AW - 24 @@ -191,73 +290,75 @@ def badge(xc, y, label, col, cls): body.append(f'') body.append(text(GC, AY + 26, "gate", size=12, col=C["accent"], weight=700, family=SANS, anchor="middle")) -body.append(text(GC, AY + AH - 2, ":3130", size=11, col=S, family=FONT, anchor="middle")) -fy = ay + 2 * LH - 4 # the Fetch line -by = ay + 6 * LH - 4 # the curl line -sy = cy + (srow + 3) * LH - 4 # the screen's request line +fy = ay + get_row * LH - 4 # the GET's line +by = ay + post_row * LH - 4 # the POST's line +sy = cy + 4 * CLH - 4 # the question card's first row pkt = 'r="6" cx="0" cy="0"' -body.append(f'') -body.append(f'') -badge(GC, fy - 18, "FREE", G, show(1.35, 3.2, fade=0.1)) -body.append(f'') -body.append(f'') -badge(GC, by - 18, "ASK", Y, show(3.75, 7.2, fade=0.1)) -body.append(f'') -body.append(f'') -badge(GC, by + 22, "403", R, show(7.3, END, fade=0.1)) +body.append(f'') +body.append(f'') +badge(GC, fy - 18, "FREE", G, show(T_GET + 0.35, T_POST, fade=0.1)) +body.append(f'') +body.append(f'') +badge(GC, by - 18, "ASK", Y, show(T_POST + 0.55, T_DENY + 0.3, fade=0.1)) +body.append(f'') +body.append(f'') +badge(GC, by + 22, "403", R, show(T_DENY + 0.4, END, fade=0.1)) # --- The gate's audit (bottom) ------------------------------------------------------------ -BX, BY, BW, BH = 24, 426, W - 48, 84 +BX, BY, BW, BH = 24, 506, W - 48, 84 body.append(f'') body.append(text(BX + 16, BY + 24, "gate audit", size=12, col=C["accent"], weight=700, family=SANS)) -body.append(text(BX + 92, BY + 24, "gate-2026-10-28.jsonl · one line per decision, traced to container and agent", +body.append(text(BX + 92, BY + 24, f"gate-{free_rec['ts'][:10]}.jsonl · what the gate recorded, traced to container and agent", size=12, col=D, family=SANS)) -def jline(pairs): - """A JSONL record as coloured runs: pairs of (key, value) or "…" for an elided run.""" - out = [("{", D)] - for i, kv in enumerate(pairs): - if i: +def jline(rec, keys, colours): + """A captured record as coloured runs, with "…" wherever fields are left out.""" + out, prev = [("{", D)], -1 + order = list(rec) + for k in keys: + i = order.index(k) + if prev >= 0: out.append((",", D)) - if kv == "…": - out.append(("…", D)) - continue - k, v, col = kv - out += [(f'"{k}":', D), (v, col)] + if i != prev + 1: + out.append(("…,", D) if prev >= 0 else ("…", D)) + if prev < 0: + out.append((",", D)) + out += [(f'"{k}":', D), (json.dumps(rec[k], ensure_ascii=False, separators=(",", ":")), colours.get(k, T))] + prev = i + if prev != len(order) - 1: + out.append((",…", D)) out.append(("}", D)) return out -free = jline([("event", '"free"', G), ("decision", '"free"', G), "…", ("container", '"lea-ab12cd34ef"', T), - ("agent", '"dev-3"', T), "…", ("method", '"GET"', T), ("host", '"pkg.go.dev"', T), - ("path", '"/net/http"', T), ("rule", '"trusted"', S), "…", ("status", "200", T)]) -refused = jline([("event", '"refused"', R), "…", ("code", '"E_DENIED"', R), "…", - ("reason", '"denied by the human: token in body; …"', Y), "…", - ("container", '"lea-ab12cd34ef"', T), ("agent", '"dev-3"', T), "…", ("method", '"POST"', T), - ("host", '"hooks.example.net"', T), "…"]) -body.append(spans(BX + 16, BY + 48, free, cls=show(2.0), size=10)) -body.append(spans(BX + 16, BY + 68, refused, cls=show(7.8), size=10)) +free = jline(free_rec, ["event", "container", "agent", "method", "host", "path", "rule", "status"], + {"event": G, "rule": S}) +denied = jline(denied_rec, ["event", "reason", "approval", "facade", "container", "agent", "method", "host"], + {"event": R, "reason": Y}) +body.append(spans(BX + 16, BY + 48, free, cls=show(T_GET_OUT + 0.1), size=10)) +body.append(spans(BX + 16, BY + 68, denied, cls=show(T_DENY + 0.4), size=10)) # Captions. -caps = [(0.0, 3.3, "Reads of hosts you trust pass at once."), - (3.3, 7.4, "A write to an unknown host waits for you, in a console the agent can't reach."), - (7.4, END, "You say no: the agent gets a 403, and the audit keeps both.")] +caps = [(0.0, T_POST, "Reads of hosts you trust pass at once."), + (T_POST, T_DENY, "A write to an unknown host waits for you in lox run, which the agent can't reach."), + (T_DENY, END, "You say no: the agent gets a 403, and the audit keeps both.")] for t0, t1, s in caps: - body.append(text(W / 2, 562, s, cls=show(t0 + 0.05, t1 - 0.2), size=24, weight=650, + body.append(text(W / 2, 642, s, cls=show(t0 + 0.05, t1 - 0.2), size=24, weight=650, family=SANS, anchor="middle")) -label = ("lockhttp: Claude Code, in a lea container, reads a page of pkg.go.dev, a trusted host, and " - "the gate lets it through at once. It then POSTs a build report to hooks.example.net, an " - "unknown host: the gate holds it, and the lockhttp console, in its own account, shows the " - "approval screen with the body masked. The human answers n token in body; the agent gets a " - "403 E_DENIED, and the gate's audit records both decisions.") +label = ("lockhttp: an agent (Claude Code, in a lea container) fetches a page of pkg.go.dev, a trusted " + "host, and the gate lets the GET through at once. It then POSTs a build report to " + "hooks.example.net, an unknown host: the gate holds it, and a question shows in lox run, in " + "the human's own terminal. The human presses d to read the whole masked screen (the author's " + "email shows as j***(23)), then n; the agent gets a 403 E_DENIED, denied on the hub, and the " + "gate's audit records both decisions.") print(f'') -print("lockhttp: your AI browses, you hold the key") +print("lockhttp: your agent browses, you hold the key") print("") print("\n".join(body)) print("") diff --git a/site/assets/demo.svg b/site/assets/demo.svg index 5b82bf0..88374b4 100644 --- a/site/assets/demo.svg +++ b/site/assets/demo.svg @@ -1,166 +1,117 @@ - -lockhttp: your AI browses, you hold the key - - - - + +lockhttp: your agent browses, you hold the key + + + + ✻ Claude Code -container lea-ab12cd34ef -> read the net/http Client docs, then post the +container lea-ab12cd34ef +> check that the net/http docs are up, then post the build report to our webhook -● Fetch(https://pkg.go.dev/net/http) - └ Received 41.2KB (200 OK) -● Client.Timeout bounds the whole exchange. - Posting the report now. -● Bash(curl -sS -X POST https://hooks.example.net/build - -H 'content-type: application/json' -d @report.json) - └ Running… - └ LockHTTP refused this request (E_DENIED): denied by - the human: token in body; do not retry unless asked - Do not retry the same request; ask the user. - request id: h-mh9q2m7c-91fd04b2a8e6c357 -● You refused the post: report.json carries a - token. I won't retry. Send it without the token? - - - - - -lockhttp console -account lockhttp · its own session -$ lockhttp console -✓ profile default · lockhttp gate (approved policy) -› Listening on /run/lockhttp/user-default.sock -╭─ DEFAULT · POST hooks.example.net · lea-ab12cd34ef ─────│ requested by container lea-ab12cd34ef · agent dev-3 (declared, proxy-auth)││ POST mitm://hooks.example.net/build│ body 97 bytes application/json json:31578a783c831b…│ task t-42 · role dev · parent lead-1 · branch feat/ci-report│ decided by: default:write││ preview (masked):│ {"build":"ok","author":"j***(20)","token":"<secret>"}│ request h-mh9q2m7c-91fd04b2a8e6c357│ ▲ unknown host hooks.example.net -╰─ Approve? [y/N] -n -t -o -k -e -n -i -n -b -o -d -y - -✗ denied: token in body -only you can answer - -gate -:3130 - - -FREE - - -ASK - - -403 - -gate audit -gate-2026-10-28.jsonl · one line per decision, traced to container and agent -{"event":"free","decision":"free",…,"container":"lea-ab12cd34ef","agent":"dev-3",…,"method":"GET","host":"pkg.go.dev","path":"/net/http","rule":"trusted",…,"status":200} -{"event":"refused",…,"code":"E_DENIED",…,"reason":"denied by the human: token in body; …",…,"container":"lea-ab12cd34ef","agent":"dev-3",…,"method":"POST","host":"hooks.example.net",…} -Reads of hosts you trust pass at once. -A write to an unknown host waits for you, in a console the agent can't reach. -You say no: the agent gets a 403, and the audit keeps both. +● Bash(curl -sS -o /dev/null -w '%{http_code}\n' + https://pkg.go.dev/net/http) + └ 200 +● Bash(curl -sS -X POST https://hooks.example.net/build + -H 'content-type: application/json' -d @report.json) + └ Running… + └ LockHTTP refused this request (E_DENIED): denied on the hub + Do not retry the same request; ask the user. + request id: h-mwm16i9i-c991bc1966bb624f + + + + + +lox run +your terminal · outside lea +lox runAUTO~/Documents/shop● hub up· 1 lockconnectednone yet: a lock connects on its agent's first request────────────────────────────────────────────────────────────────────────────────no ticket yet: every ticket and decision of the hub shows here, masked by its…────────────────────────────────────────────────────────────────────────────────Shift+Tabmodeaaudit?helpqquit +lox runAUTO~/Documents/shop● hub up· 1 lock·1 waitingconnectednone yet: a lock connects on its agent's first request────────────────────────────────────────────────────────────────────────────────┌◆ QUESTIONwriteon web───────────────────────────────────────────────────┐│dev-3asks (unverified name)· ⇄ lockhttp· expires in 23h59m││POSThooks.example.net · lea-ab12cd34ef││fromcontainer lea-ab12cd34ef (project shop) · agent dev-3 (declared, pr…││POSTmitm://hooks.example.net/build││body 49 bytes application/json json:a20a0c27eefde4…││headers: accept content-length content-type user-agent││… 8 more lines: d for details││! unknown host hooks.example.net││why asked: this lock's ticket does not name its kind (version 1): asked││yapprovendenyddetailsxforget profile│└────────────────────────────────────────────────────────────────────────────┘12:21:49dev-3⇄web-writefromcontainer lea…◆ ask:v1────────────────────────────────────────────────────────────────────────────────Shift+Tabmodey/nanswerddetailsaaudit?helpqquit +lox runAUTO~/Documents/shop● hub up· 1 lock·1 waitingconnectednone yet: a lock connects on its agent's first request────────────────────────────────────────────────────────────────────────────────┌◆ QUESTIONwriteon web───────────────────────────────────────────────────┐│dev-3asks (unverified name)· ⇄ lockhttp· expires in 23h59m││POSThooks.example.net · lea-ab12cd34ef││fromcontainer lea-ab12cd34ef (project shop) · agent dev-3 (declared, pr…││POSTmitm://hooks.example.net/build││body 49 bytes application/json json:a20a0c27eefde4…││headers: accept content-length content-type user-agent││task t-42 · role dev · parent lead-1 · branch feat/ci-report││decided by: default:write││││preview (masked):││{"build":"ok","author":"‹j***(23)›"}││││client gone: y lets the same request through once in the next 10 minutes││request h-mwm16i9i-c991bc1966bb624f││! unknown host hooks.example.net││why asked: this lock's ticket does not name its kind (version 1): asked││yapprovendenydlessxforget profile│└────────────────────────────────────────────────────────────────────────────┘12:21:49dev-3⇄web-writefromcontainer lea…◆ ask:v1────────────────────────────────────────────────────────────────────────────────Shift+Tabmodey/nanswerddetailsaaudit?helpqquit +lox runAUTO~/Documents/shop● hub up· 1 lockconnectednone yet: a lock connects on its agent's first request────────────────────────────────────────────────────────────────────────────────12:21:49dev-3⇄web-writefromcontainer lea…✘ denied────────────────────────────────────────────────────────────────────────────────Shift+Tabmodeaaudit?helpqquit +you press d: the whole screen +you press n: deny + +gate + + +FREE + + +ASK + + +403 + +gate audit +gate-2026-11-18.jsonl · what the gate recorded, traced to container and agent +{…,"event":"free",…,"container":"lea-ab12cd34ef",…,"agent":"dev-3",…,"method":"GET","host":"pkg.go.dev",…,"path":"/net/http",…,"rule":"trusted",…,"status":200,…} +{…,"event":"denied",…,"reason":"denied on the hub","approval":"hub",…,"facade":"tty",…,"container":"lea-ab12cd34ef",…,"agent":"dev-3",…,"method":"POST","host":"hooks.example.net",…} +Reads of hosts you trust pass at once. +A write to an unknown host waits for you in lox run, which the agent can't reach. +You say no: the agent gets a 403, and the audit keeps both. diff --git a/site/index.html b/site/index.html index f1e343f..756a650 100644 --- a/site/index.html +++ b/site/index.html @@ -95,10 +95,10 @@

Your agent browses. You hold the key.See it run

- An agent (here Claude Code, in a lea container) fetches a page of pkg.go.dev, a trusted host: the lockhttp gate lets the GET through at once. It then POSTs a build report to hooks.example.net, an unknown host: the gate holds the request, and an approval screen shows it with the body preview masked (the email as j***(20), the token as <secret>). The human answers n token in body; the agent gets a 403 E_DENIED, and the gate's audit records both decisions. + An agent (here Claude Code, in a lea container) fetches a page of pkg.go.dev, a trusted host: the lockhttp gate lets the GET through at once. It then POSTs a build report to hooks.example.net, an unknown host: the gate holds the request, and a question shows in lox run, in your own terminal. You press d to read the whole masked screen (the author's email shows as j***(23)), then n to deny; the agent gets a 403 E_DENIED, denied on the hub, and the gate's audit records both decisions.

Swipe sideways to see both terminals.

-
An agent (here Claude Code, left, in a lea container) reads pkg.go.dev at once. Its POST to an unknown host waits until you deny it with a reason. The approval screen (right) is drawn in the console’s frame from before the hub: today you answer it in lox run.
+
An agent (here Claude Code, left, in a lea container) reads pkg.go.dev at once. Its POST to an unknown host waits until you answer it in lox run (right), where you read the masked request and deny it.