psiloceyeben's picture
Release 12.0.1 (slim): 12.0 with the repairs found on the clean slim install: accounts written from the Simple English Wikipedia the release ships, a short account offers to read and go reads, a go with nothing waiting is said so, diffs drawn as blocks. No language model. (part 4)
e47c5f5 verified
Raw History Blame Contribute Delete
26.2 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oracle7</title>
<style>
@font-face { font-family: "O7 Mono"; src: url(/static/fonts/JetBrainsMono.ttf) format("truetype"); font-weight: 100 800; font-display: swap; }
:root {
color-scheme: light;
/* every colour, radius, shadow, font and duration is a token; nothing below this block names a raw value */
--bg: 0 0% 100%;
--side: 40 14% 97%;
--fg: 30 8% 12%;
--fg-soft: 30 5% 38%;
--fg-dim: 30 4% 56%;
--line: 35 12% 89%;
--line-strong: 35 10% 80%;
--bubble: 40 14% 95%;
--block: 40 16% 97%;
--accent: 22 78% 46%;
--accent-fg: 0 0% 100%;
--ok: 150 48% 34%;
--offer: 36 80% 38%;
--gap: 0 0% 46%;
--focus: 22 78% 46%;
--r-s: 8px; --r-m: 14px; --r-l: 22px;
--shadow-tab: 0 1px 2px hsl(var(--fg) / .12);
--shadow-box: 0 1px 2px hsl(var(--fg) / .05), 0 8px 28px hsl(var(--fg) / .07);
--sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--mono: "O7 Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
--col: 46rem;
--dur: 160ms; --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: hsl(var(--bg)); color: hsl(var(--fg)); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid hsl(var(--focus)); outline-offset: 2px; border-radius: var(--r-s); }
.app { display: grid; grid-template-columns: 17rem minmax(0, 1fr); height: 100%; }
/* sidebar */
.side { background: hsl(var(--side)); border-right: 1px solid hsl(var(--line)); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .6rem; font-weight: 650; letter-spacing: -.01em; }
.mark { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid hsl(var(--fg)); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: hsl(var(--accent)); }
.new { margin: .4rem .75rem .6rem; padding: .55rem .8rem; text-align: left; background: hsl(var(--bg)); border: 1px solid hsl(var(--line-strong)); border-radius: var(--r-s); cursor: pointer; transition: background var(--dur) var(--ease); }
.new:hover { background: hsl(var(--bubble)); }
.side h2 { font-size: .72rem; font-weight: 600; color: hsl(var(--fg-dim)); margin: .8rem 1rem .3rem; }
.convs { list-style: none; margin: 0; padding: 0 .5rem; overflow-y: auto; flex: 1; min-height: 0; }
.convs button { width: 100%; text-align: left; background: none; border: 0; padding: .45rem .55rem; border-radius: var(--r-s); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: hsl(var(--fg-soft)); font-size: .92rem; }
.convs button:hover, .convs button[aria-current="true"] { background: hsl(var(--bubble)); color: hsl(var(--fg)); }
.foot { border-top: 1px solid hsl(var(--line)); padding: .7rem 1rem; font-size: .82rem; color: hsl(var(--fg-dim)); display: grid; gap: .25rem; }
.foot a { color: hsl(var(--fg-soft)); text-decoration: none; }
.foot a:hover { color: hsl(var(--fg)); text-decoration: underline; }
/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; color: hsl(var(--fg-dim)); font-size: .85rem; }
.tabs { display: flex; gap: .25rem; margin-left: auto; margin-right: auto; background: hsl(var(--side)); border: 1px solid hsl(var(--line)); border-radius: 999px; padding: .2rem; }
.tabs button { border: 0; background: none; padding: .3rem .95rem; border-radius: 999px; cursor: pointer; color: hsl(var(--fg-soft)); font-size: .88rem; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.tabs button[aria-selected="true"] { background: hsl(var(--bg)); color: hsl(var(--fg)); box-shadow: var(--shadow-tab); font-weight: 600; }
.view[hidden] { display: none; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sat-head { padding: 2.2rem 0 1.2rem; }
.sat-head h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .3rem; }
.sat-head p { color: hsl(var(--fg-soft)); margin: 0; }
.sats { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; padding-bottom: 2rem; }
.sat { border: 1px solid hsl(var(--line)); border-radius: var(--r-m); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; background: hsl(var(--bg)); }
.sat h2 { font-size: 1.02rem; font-weight: 650; margin: 0; text-transform: capitalize; display: flex; align-items: center; gap: .5rem; }
.sat p { margin: 0; color: hsl(var(--fg-soft)); font-size: .92rem; line-height: 1.5; flex: 1; }
.sat .row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .8rem; color: hsl(var(--fg-dim)); }
.sat button { border: 1px solid hsl(var(--line-strong)); background: hsl(var(--bg)); border-radius: var(--r-s); padding: .3rem .7rem; cursor: pointer; font-size: .84rem; transition: background var(--dur) var(--ease); }
.sat button:hover:not(:disabled) { background: hsl(var(--bubble)); }
.sat button:disabled { opacity: .5; cursor: default; }
.sat code { font: .78rem var(--mono); background: hsl(var(--block)); border: 1px solid hsl(var(--line)); border-radius: var(--r-s); padding: .1rem .4rem; color: hsl(var(--fg-soft)); }
.sat .res { font: .78rem/1.55 var(--mono); color: hsl(var(--fg-soft)); white-space: pre-wrap; overflow-wrap: anywhere; border-left: 2px solid hsl(var(--line-strong)); padding-left: .7rem; }
.menu { display: none; background: none; border: 1px solid hsl(var(--line-strong)); border-radius: var(--r-s); padding: .25rem .55rem; cursor: pointer; }
.scroll { flex: 1; overflow-y: auto; min-height: 0; }
.col { max-width: var(--col); margin: 0 auto; padding: 0 1.25rem; }
.hello { padding: 16vh 0 2rem; text-align: center; }
.hello h1 { font-size: 2rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .4rem; }
.hello p { color: hsl(var(--fg-soft)); margin: 0 auto 1.6rem; max-width: 34rem; }
.tries { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; text-align: left; }
.tries button { background: hsl(var(--bg)); border: 1px solid hsl(var(--line)); border-radius: var(--r-m); padding: .7rem .9rem; cursor: pointer; color: hsl(var(--fg-soft)); font-size: .93rem; line-height: 1.4; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.tries button:hover { border-color: hsl(var(--line-strong)); color: hsl(var(--fg)); }
.tries b { display: block; color: hsl(var(--fg)); font-weight: 600; font-size: .82rem; margin-bottom: .1rem; }
.turn { padding: .9rem 0; animation: rise var(--dur) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.me { display: flex; justify-content: flex-end; }
.me div { background: hsl(var(--bubble)); border-radius: var(--r-l); padding: .6rem 1rem; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.it { overflow-wrap: anywhere; }
.it p { margin: 0 0 .75rem; }
.it h3 { font-size: 1.12rem; font-weight: 650; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
.it h4 { font-size: .95rem; font-weight: 650; margin: 1rem 0 .4rem; color: hsl(var(--fg-soft)); }
.it pre { background: hsl(var(--block)); border: 1px solid hsl(var(--line)); border-radius: var(--r-m); padding: .8rem 1rem; margin: 0 0 .75rem; font: .84rem/1.55 var(--mono); white-space: pre-wrap; overflow-x: auto; }
.it ol { margin: 0 0 .75rem; padding-left: 1.3rem; color: hsl(var(--fg-soft)); font-size: .9rem; }
.it ul { margin: 0 0 .75rem; padding-left: 1.3rem; }
.it ul li { margin-bottom: .4rem; }
.cite { display: inline-block; font-size: .72rem; color: hsl(var(--fg-soft)); border: 1px solid hsl(var(--line-strong)); border-radius: 999px; padding: 0 .5rem; margin: 0 .15rem; vertical-align: 1px; white-space: nowrap; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; font-size: .8rem; color: hsl(var(--fg-dim)); margin-top: .1rem; }
.st { display: inline-flex; align-items: center; gap: .35rem; }
.st i { width: .5rem; height: .5rem; border-radius: 50%; background: hsl(var(--gap)); }
.st.answered i { background: hsl(var(--ok)); } .st.offered i { background: hsl(var(--offer)); }
details { font-size: .8rem; color: hsl(var(--fg-dim)); }
summary { cursor: pointer; list-style: none; } summary::-webkit-details-marker { display: none; }
summary:hover { color: hsl(var(--fg-soft)); }
.why { margin: .5rem 0 0; padding: .6rem .8rem; border-left: 2px solid hsl(var(--line-strong)); color: hsl(var(--fg-soft)); font: .78rem/1.6 var(--mono); white-space: pre-wrap; }
.build-details { margin: .6rem 0; }
.build-details > summary { color: hsl(var(--fg-soft)); }
.build-details > summary::before { content: "+ "; }
.build-details[open] > summary::before { content: "− "; }
.it .build-evidence { margin-top: .6rem; }
.wait { display: inline-flex; gap: .3rem; padding: .5rem 0; }
.wait i { width: .42rem; height: .42rem; border-radius: 50%; background: hsl(var(--fg-dim)); animation: pulse 1.1s infinite var(--ease); }
.wait i:nth-child(2) { animation-delay: .15s; } .wait i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
/* composer */
.dock { padding: .4rem 0 1rem; }
.box { display: flex; align-items: flex-end; gap: .5rem; background: hsl(var(--bg)); border: 1px solid hsl(var(--line-strong)); border-radius: var(--r-l); padding: .55rem .55rem .55rem 1rem; box-shadow: var(--shadow-box); transition: border-color var(--dur) var(--ease); }
.box:focus-within { border-color: hsl(var(--fg-dim)); }
.box textarea { flex: 1; border: 0; outline: 0; resize: none; background: none; max-height: 12rem; padding: .35rem 0; line-height: 1.5; }
.send { width: 2.25rem; height: 2.25rem; flex: none; border: 0; border-radius: 50%; background: hsl(var(--accent)); color: hsl(var(--accent-fg)); cursor: pointer; display: grid; place-items: center; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):active { transform: scale(.94); }
.note { text-align: center; font-size: .76rem; color: hsl(var(--fg-dim)); margin-top: .55rem; }
@media (max-width: 760px) {
.app { grid-template-columns: minmax(0, 1fr); }
.side { position: fixed; inset: 0 22% 0 0; z-index: 5; transform: translateX(-102%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-box); }
.side.open { transform: none; }
.menu { display: inline-block; }
.tries { grid-template-columns: 1fr; }
.sats { grid-template-columns: 1fr; }
.hello { padding-top: 9vh; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
</style>
</head>
<body>
<div class="app">
<aside class="side" id="side" aria-label="Conversations">
<div class="brand"><span class="mark" aria-hidden="true"></span>Oracle7</div>
<button class="new" id="new">New chat</button>
<h2>Conversations</h2>
<ul class="convs" id="convs"></ul>
<div class="foot">
<a href="/full">Full workbench</a>
<span id="ver">no language model</span>
</div>
</aside>
<main class="main">
<div class="top"><button class="menu" id="menu" aria-label="Show conversations">Chats</button><span id="head">Oracle7</span>
<div class="tabs" role="tablist"><button role="tab" id="tab-chat" aria-selected="true">Chat</button><button role="tab" id="tab-sat" aria-selected="false">Satellites</button><button role="tab" id="tab-mac" aria-selected="false">Machines</button></div></div>
<div class="view" id="view-chat">
<div class="scroll" id="scroll">
<div class="col" id="log">
<section class="hello" id="hello">
<h1>What do you want to know or build?</h1>
<p>Ask, talk, or say what you want made. Every reply shows whether it was checked and how it got there.</p>
<div class="tries" id="tries">
<button data-q="What is the capital of Australia?"><b>Ask</b>What is the capital of Australia?</button>
<button data-q="explain photosynthesis"><b>Explain</b>explain photosynthesis</button>
<button data-q="make t: split it into words, count them, print it. expect 4" data-fill="1"><b>Build</b>make a small program from the steps you describe</button>
<button data-q="want the total amount of the regions whose amount is above average" data-fill="1"><b>Plan</b>want a result from a table in your sandbox</button>
</div>
</section>
</div>
</div>
<div class="dock"><div class="col">
<form class="box" id="form">
<textarea id="q" rows="1" placeholder="Message Oracle7" aria-label="Message Oracle7" autofocus></textarea>
<button class="send" id="send" aria-label="Send" disabled>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 13V3M8 3 3.5 7.5M8 3l4.5 4.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
</form>
<div class="note">Runs on this computer. Tools: index, find, read, write, run, fetch, make, change, want.</div>
</div></div>
</div>
<div class="view" id="view-mac" hidden>
<iframe id="macframe" title="Machines" style="border:0;width:100%;height:100%;display:block"></iframe>
</div>
<div class="view" id="view-sat" hidden>
<div class="scroll"><div class="col">
<div class="sat-head"><h1>Satellites</h1><p>The six orbiters that ship in this release. Each runs on its own beside the core, and each has an exam you can run here from the pack.</p></div>
<div class="sats" id="sats"></div>
</div></div>
</div>
</main>
</div>
<script>
(function () {
"use strict";
var $ = function (id) { return document.getElementById(id); };
var log = $("log"), q = $("q"), send = $("send"), scroll = $("scroll"), hello = $("hello");
var sid = newId(), busy = false;
function newId() { var s = "c"; for (var i = 0; i < 13; i++) s += "abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(Math.random() * 36)]; return s; }
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[c]; }); }
function api(path, body) {
return fetch(path, body ? { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) } : {})
.then(function (r) { return r.json(); });
}
// citations and internal marks, shown as plain source names (the terminal chat does the same)
function tidy(t) {
return String(t)
.replace(/\s*\[(?:turn|form|scene|op|ledger):[^\]]*\]/g, "").replace(/\s*\[none\]/g, "")
.replace(/\[simplewiki_[0-9a-f]+\]/g, "\u0001Simple Wikipedia\u0002").replace(/\[enwiki_[0-9a-f]+\]/g, "\u0001Wikipedia\u0002")
.replace(/\[wd:(Q\d+)[^\]]*\]/g, "\u0001Wikidata $1\u0002").replace(/\[(wiktionary|wordnet|conceptnet|openstax)[^\]]*\]/gi, function (m, a) { return "\u0001" + a.charAt(0).toUpperCase() + a.slice(1) + "\u0002"; })
.replace(/\[(rel-[a-z0-9-]+)\]/g, "\u0001$1\u0002");
}
function inline(s) { return esc(s).replace(/\u0001([^\u0002]*)\u0002/g, '<span class="cite">$1</span>'); }
// the reply as blocks: headings, numbered sources, indented or step-like output as a monospace block, the rest as paragraphs
function render(text) {
var lines = tidy(text).split("\n"), out = [], para = [], pre = [], ol = [], ul = [];
function flush() {
if (para.length) { out.push("<p>" + inline(para.join(" ")) + "</p>"); para = []; }
if (pre.length) { out.push("<pre>" + inline(pre.join("\n")) + "</pre>"); pre = []; }
if (ol.length) { out.push("<ol>" + ol.map(function (x) { return "<li>" + inline(x) + "</li>"; }).join("") + "</ol>"); ol = []; }
if (ul.length) { out.push("<ul>" + ul.map(function (x) { return "<li>" + inline(x) + "</li>"; }).join("") + "</ul>"); ul = []; }
}
var listy = /^(Built |Ran: |Planned from |Changed |Indexed |I could not |check: )/;
var inBlock = false, fenced = false;
lines.forEach(function (ln) {
var m;
// 12.0.1: a fenced block (```diff ... ```) is drawn as one block, its - and + lines kept as written
if (/^\s*```/.test(ln)) { if (!fenced) { if (para.length || ol.length || ul.length) flush(); fenced = true; inBlock = true; } else { fenced = false; flush(); inBlock = false; } return; }
if (fenced) { pre.push(ln); return; }
if (!ln.trim()) { if (!inBlock) flush(); else pre.push(""); return; }
if ((m = ln.match(/^#{1,2}\s+(.*)$/))) { flush(); inBlock = false; out.push("<h3>" + inline(m[1]) + "</h3>"); return; }
if ((m = ln.match(/^#{3,}\s+(.*)$/))) { flush(); inBlock = false; out.push("<h4>" + inline(m[1]) + "</h4>"); return; }
// every list the reply writes is shown as a list: numbered lines (sources, steps) and "- " lines (a record's points)
if (!inBlock && (m = ln.match(/^\s{0,1}(\d+)\.\s+(\S.*)$/))) { if (para.length || pre.length || ul.length) flush(); ol.push(m[2]); return; }
if (!inBlock && (m = ln.match(/^\s{0,1}[-*•]\s+(\S.*)$/))) { if (para.length || pre.length || ol.length) flush(); ul.push(m[1]); return; }
if (listy.test(ln) || /^\s{2,}\S/.test(ln) || inBlock) { if (para.length || ol.length) flush(); inBlock = true; pre.push(ln); return; }
para.push(ln.trim());
});
flush();
return out.join("");
}
function statusLine(st) {
var label = { answered: "checked", offered: "offered, not checked as an answer", hole: "a gap it names", declined: "declined" }[st] || st || "";
return '<span class="st ' + esc(st || "") + '"><i></i>' + esc(label) + "</span>";
}
function add(html, cls) { var d = document.createElement("div"); d.className = "turn " + cls; d.innerHTML = html; log.appendChild(d); scroll.scrollTop = scroll.scrollHeight; return d; }
function addMe(t) { hello.hidden = true; add("<div>" + esc(t) + "</div>", "me"); }
function addIt(r) {
var steps = (r.trace || []).map(function (s) { return s[1]; }).filter(Boolean).join(" → ");
var why = [steps, r.why || "", r.path ? "path: " + r.path : "", r.ms ? r.ms + " ms" : ""].filter(Boolean).join("\n");
var response = r.response || "", details = typeof r.details === "string" ? r.details : "";
// The API keeps the complete response. Only move an exactly matching evidence suffix out of its visible summary.
if (details && response.slice(-details.length) === details) response = response.slice(0, -details.length);
var evidence = details ? '<details class="build-details"><summary>Build details</summary><pre class="build-evidence"></pre></details>' : "";
var turn = add(render(response) + evidence + '<div class="meta">' + statusLine(r.status) +
(why ? "<details><summary>How it got there</summary><div class=\"why\">" + esc(why) + "</div></details>" : "") + "</div>", "it");
if (details) turn.querySelector(".build-evidence").textContent = details;
return turn;
}
// a long turn goes on as a job on the box: its stage is shown while it runs, its result when it ends; status and stop
// can be said meanwhile (the link carries them beside it)
var following = {};
function follow(s, job) {
if (following[job]) return;
var line = add('<div class="meta"><span class="st offered"><i></i>job ' + esc(job) + ': running</span></div>', "it");
following[job] = setInterval(function () {
api("/api/turn?sid=" + encodeURIComponent(s)).then(function (t) {
var j = t.job;
if (!j || j.id !== job) return;
if (j.state === "running") { line.querySelector(".st").lastChild.textContent = "job " + job + ": " + (j.stage || "running"); return; }
clearInterval(following[job]);
line.remove();
if (s !== sid || j.shown) return;
api("/api/turn?take=1&sid=" + encodeURIComponent(s)).then(function () {
var r = j.result || { response: "(the job ended without a kept result)", status: "hole" };
addIt(Object.assign({}, r, { response: "Job " + job + " " + j.state + ":\n" + (r.response || "") }));
});
}).catch(function () {});
}, 3000);
}
api("/api/identity").then(function (i) {
if (!i || !i.build) return;
$("ver").textContent = "build " + i.build + (i.running_is_on_disk ? "" : " (restart to load changes)") + " · no language model";
$("ver").title = "tree " + i.tree + "\nstate " + i.state + "\npid " + i.pid + "\nworkbench " + i.workbench_at_start.sha256 +
(i.running_is_release ? "\n= the assembled release's workbench" : "\nnot the assembled release's workbench (" + (i.workbench_in_release.sha256 || "none") + ")");
}).catch(function () {});
function ask(text) {
if (busy || !text.trim()) return;
busy = true; send.disabled = true;
addMe(text); q.value = ""; grow();
var w = add('<span class="wait" aria-label="Working"><i></i><i></i><i></i></span>', "it");
api("/api/chat", { text: text, sid: sid, deadline: 40 }).then(function (r) {
w.remove();
addIt(r.error ? { response: r.error, status: "declined" } : r);
var ex = r.execution || {};
if (ex.state === "running" && ex.job) follow(sid, ex.job);
}).catch(function (e) {
w.remove(); addIt({ response: "The workbench did not answer: " + e.message, status: "declined" });
}).then(function () { busy = false; send.disabled = !q.value.trim(); q.focus(); convs(); });
}
function convs() {
api("/api/convs").then(function (r) {
var ul = $("convs"); ul.innerHTML = "";
(r.items || []).slice(0, 60).forEach(function (c) {
var li = document.createElement("li"), b = document.createElement("button");
b.textContent = c.title && c.title !== "(untitled)" ? c.title : "Conversation";
if (c.id === sid) b.setAttribute("aria-current", "true");
b.onclick = function () { open(c.id); };
li.appendChild(b); ul.appendChild(li);
});
}).catch(function () {});
}
function clear() { Array.prototype.slice.call(log.querySelectorAll(".turn")).forEach(function (n) { n.remove(); }); }
function open(id) {
api("/api/conv?id=" + encodeURIComponent(id)).then(function (c) {
sid = id; clear(); hello.hidden = (c.turns || []).length > 0;
(c.turns || []).forEach(function (t) { addMe(t.q); addIt(t); });
$("side").classList.remove("open"); convs();
});
}
function fresh() { sid = newId(); clear(); hello.hidden = false; $("side").classList.remove("open"); convs(); q.focus(); }
function grow() { q.style.height = "auto"; q.style.height = Math.min(q.scrollHeight, 192) + "px"; }
q.addEventListener("input", function () { grow(); send.disabled = busy || !q.value.trim(); });
q.addEventListener("keydown", function (e) { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); ask(q.value); } });
$("form").addEventListener("submit", function (e) { e.preventDefault(); ask(q.value); });
$("new").onclick = fresh;
$("menu").onclick = function () { $("side").classList.toggle("open"); };
$("tries").addEventListener("click", function (e) {
var b = e.target.closest("button"); if (!b) return;
if (b.dataset.fill) { q.value = b.dataset.q; grow(); send.disabled = false; q.focus(); } else ask(b.dataset.q);
});
// the satellites tab
function tab(which) {
$("view-chat").hidden = which !== "chat"; $("view-sat").hidden = which !== "sat"; $("view-mac").hidden = which !== "mac";
$("tab-chat").setAttribute("aria-selected", which === "chat"); $("tab-sat").setAttribute("aria-selected", which === "sat");
$("tab-mac").setAttribute("aria-selected", which === "mac");
if (which === "sat") sats();
if (which === "mac" && !$("macframe").src) $("macframe").src = "/static/machines.html";
}
$("tab-chat").onclick = function () { tab("chat"); };
$("tab-sat").onclick = function () { tab("sat"); };
$("tab-mac").onclick = function () { tab("mac"); };
var satsLoaded = false;
function sats() {
if (satsLoaded) return;
api("/api/orbiters").then(function (r) {
satsLoaded = true;
var box = $("sats"); box.innerHTML = "";
(r.items || []).forEach(function (c) {
var d = document.createElement("article"); d.className = "sat";
var ready = !c.needs || !c.needs.length;
d.innerHTML = "<h2>" + esc(c.name) + "</h2><p>" + esc(c.good_for || "") + "</p>" +
'<div class="row"><span class="st ' + (ready ? "answered" : "offered") + '"><i></i>' + (ready ? "ready on this computer" : "needs " + esc(c.needs.join(", "))) + "</span>" +
"<code>oracle7.py " + esc(c.name) + "</code></div>" +
'<div class="row"><button' + (ready ? "" : " disabled") + ">Run its exam</button></div><div class=\"res\" hidden></div>";
var b = d.querySelector("button"), res = d.querySelector(".res");
b.onclick = function () {
b.disabled = true; b.textContent = "Running\u2026"; res.hidden = false; res.textContent = "running its exam from the pack";
api("/api/orbiters/exam", { name: c.name }).then(function (x) {
res.textContent = (x.status || "") + (x.summary ? "\n" + x.summary : "") + (x.detail ? "\n" + x.detail : "") + (x.error ? "\n" + x.error : "");
}).catch(function (e) { res.textContent = "did not answer: " + e.message; })
.then(function () { b.disabled = false; b.textContent = "Run its exam"; });
};
box.appendChild(d);
});
if (!(r.items || []).length) box.textContent = "No orbiters were found in this install.";
}).catch(function () { $("sats").textContent = "The workbench did not answer."; });
}
api("/api/state").then(function (s) {
var tip = s && (s.tip || s.head || (s.engine && s.engine.tip));
if (tip) $("ver").textContent = String(tip).replace("oracle_release_runtime_", "") + " · no language model";
}).catch(function () {});
convs();
})();
</script>
</body>
</html>