25, "wing" => "Building", "title" => "Change an app by asking", "promise" => "A model changes your app and shows it running on a preview address, and nothing reaches staging or live until you tap ship.", "block" => "The builder app: say what should change; it edits a clone, pushes preview/run- (its key can push nothing else), and the creator reviews the diff and the preview, then ships through root's ship request.", "show" => function (?array $me): string { $p = stored(25)["data"] ?? null; $b = rc_app_url("builder"); if (!$p) return '

The builder has not been checked yet.

'; $line = fn($k, $label) => '
  • ' . $label . ': /ping answered ' . (int)($p[$k]["status"] ?? 0) . ' ' . h(mb_strimwidth((string)($p[$k]["body"] ?? ""), 0, 40, "…")) . '' . (!empty($p[$k]["has_word"]) ? " (has the word)" : " (without it)") . "
  • "; return '

    Last night the builder\'s robot asked, on the sample app zoo-scratch:

    ' . '
    ' . h($p["request"] ?? "") . '
    " . '

    ' . h((string)($p["turns"] ?? "?")) . " turns, " . h((string)round(($p["tokens"] ?? 0) / 1000)) . "k tokens from the builder's own budget, " . h($p["at"] ?? "") . ".

    "; }, "check" => function (): array { $b = rc_app_url("builder"); [$code, , $p] = (new Browser())->get("$b/proof.json"); if ($code !== 200 || !is_array($p)) return [false, "the builder's /proof.json did not load ($code)"]; if (($p["ok"] ?? null) === null) return [false, "the builder has not run its nightly exhibit yet", $p]; $age = time() - (strtotime((string)($p["at"] ?? "")) ?: 0); if ($age > 26 * 3600) return [false, "the builder's last nightly run is " . round($age / 3600) . " h old", $p]; if (!$p["ok"]) return [false, (string)($p["detail"] ?? "the nightly run failed"), $p]; // From outside, now: staging and live still do not answer last night's word. foreach (["staging", "live"] as $e) { [, , $body] = (new Browser())->get((string)($p[$e]["url"] ?? "")); if (str_contains(is_string($body) ? $body : json_encode($body), (string)$p["word"])) return [false, "$e answers the preview's word: a change reached $e without a ship", $p]; } return [true, (string)$p["detail"], $p]; }, ];