Merge branch 'main' into web-run-polish

This commit is contained in:
2026-10-19 20:11:08 +01:00
33 changed files with 3249 additions and 831 deletions
+47
View File
@@ -0,0 +1,47 @@
# Stage turns
Stage turns are file-based. Each visit gets its own directory under the run:
```
<run>/stages/01-implementer/input.md
<run>/stages/01-implementer/memory.md
<run>/stages/01-implementer/output.md
<run>/stages/01-implementer/private/
<run>/public/
```
`internal/turn.Layout` derives those paths deterministically (the sequence is
zero-padded to two digits). `Paths.Ensure` creates the turn, private and public
directories idempotently; it never deletes or rewrites existing files.
The first turn's `input.md` is the run prompt. A later turn's input is the
previous turn's output under a `# Previous turn output` heading. Memory is
plain markdown: one `## <stage> · visit <n>` section per completed turn, with
that turn's output verbatim followed by a system-written list of files added to
`public/`. List entries are relative to the run directory, sorted, and unique.
Input, memory and output are stored per turn, and private artifacts stay in the
turn's `private/` directory while shared artifacts go to the run-level
`public/` directory.
## Outcome-only output contract
A turn's `output.md` must contain exactly one outcome section and may contain any
markdown after it. The outcome section is an ATX heading named `outcome` (any
level) followed by the first non-blank line, which must be exactly one of the
stage's allowed outcome words:
```md
## outcome
success
# Result
The rest of the output is the body, preserved verbatim.
```
Matching trims whitespace and compares case-insensitively, returning the
canonical allowed spelling. Text before the heading is ignored. Headings and
words inside fenced code blocks (triple backticks or tildes) are ignored, so a
diff or code sample cannot add a false outcome. Missing, duplicate, empty, or unknown
outcomes are explicit errors; the parser never guesses, repairs the text, or
looks for any other section.
+52
View File
@@ -0,0 +1,52 @@
// Package turn owns the file layout and markdown contracts for file-based
// stage turns. It deliberately has no dependency on the server, protocol or
// stage packages: callers persist and execute turns, while this package keeps
// their paths and plain-markdown shapes deterministic.
package turn
import (
"fmt"
"os"
"path/filepath"
)
// Paths is the complete on-disk layout for one stage visit.
type Paths struct {
RunDir string
Sequence int
StageKey string
TurnDir string
InputPath string
MemoryPath string
OutputPath string
PrivateDir string
PublicDir string
}
// Layout returns the deterministic paths for a stage turn. The sequence is
// zero-padded to two digits; longer sequences keep all of their digits.
func Layout(runDir string, sequence int, stageKey string) Paths {
turnDir := filepath.Join(runDir, "stages", fmt.Sprintf("%02d-%s", sequence, stageKey))
return Paths{
RunDir: runDir,
Sequence: sequence,
StageKey: stageKey,
TurnDir: turnDir,
InputPath: filepath.Join(turnDir, "input.md"),
MemoryPath: filepath.Join(turnDir, "memory.md"),
OutputPath: filepath.Join(turnDir, "output.md"),
PrivateDir: filepath.Join(turnDir, "private"),
PublicDir: filepath.Join(runDir, "public"),
}
}
// Ensure creates the turn, private and run-level public directories. It is
// idempotent and never removes or rewrites anything already present.
func (p Paths) Ensure() error {
for _, dir := range []string{p.TurnDir, p.PrivateDir, p.PublicDir} {
if err := os.MkdirAll(dir, 0o700); err != nil {
return fmt.Errorf("turn: create %s: %w", dir, err)
}
}
return nil
}
+70
View File
@@ -0,0 +1,70 @@
package turn
import (
"os"
"path/filepath"
"testing"
)
func TestLayoutIsDeterministic(t *testing.T) {
runDir := filepath.Join(t.TempDir(), "run")
want := Paths{
RunDir: runDir,
Sequence: 2,
StageKey: "implementer",
TurnDir: filepath.Join(runDir, "stages", "02-implementer"),
InputPath: filepath.Join(runDir, "stages", "02-implementer", "input.md"),
MemoryPath: filepath.Join(runDir, "stages", "02-implementer", "memory.md"),
OutputPath: filepath.Join(runDir, "stages", "02-implementer", "output.md"),
PrivateDir: filepath.Join(runDir, "stages", "02-implementer", "private"),
PublicDir: filepath.Join(runDir, "public"),
}
got := Layout(runDir, 2, "implementer")
if got != want {
t.Fatalf("Layout() = %#v, want %#v", got, want)
}
if again := Layout(runDir, 2, "implementer"); again != got {
t.Fatalf("Layout() is not deterministic: %#v then %#v", got, again)
}
}
func TestLayoutSupportsLongSequences(t *testing.T) {
got := Layout("/runs/one", 123, "review")
want := filepath.Join("/runs/one", "stages", "123-review")
if got.TurnDir != want {
t.Fatalf("TurnDir = %q, want %q", got.TurnDir, want)
}
}
func TestPathsEnsureIsIdempotentAndPreservesFiles(t *testing.T) {
paths := Layout(t.TempDir(), 1, "build")
if err := paths.Ensure(); err != nil {
t.Fatalf("Ensure() error: %v", err)
}
for _, dir := range []string{paths.TurnDir, paths.PrivateDir, paths.PublicDir} {
info, err := os.Stat(dir)
if err != nil {
t.Fatalf("stat %s: %v", dir, err)
}
if !info.IsDir() {
t.Fatalf("%s is not a directory", dir)
}
}
kept := filepath.Join(paths.PrivateDir, "keep.txt")
if err := os.WriteFile(kept, []byte("preserve me"), 0o600); err != nil {
t.Fatal(err)
}
if err := paths.Ensure(); err != nil {
t.Fatalf("second Ensure() error: %v", err)
}
body, err := os.ReadFile(kept)
if err != nil {
t.Fatalf("read preserved file: %v", err)
}
if string(body) != "preserve me" {
t.Fatalf("preserved file = %q", body)
}
if _, err := os.Stat(paths.InputPath); !os.IsNotExist(err) {
t.Fatalf("Ensure() should not create the input file, stat error = %v", err)
}
}
+170
View File
@@ -0,0 +1,170 @@
package turn
import (
"errors"
"fmt"
"strings"
)
var (
// ErrEmptyOutput means the turn produced no markdown at all.
ErrEmptyOutput = errors.New("turn output: empty")
// ErrMissingOutcome means no outcome heading and value were found.
ErrMissingOutcome = errors.New("turn output: missing outcome")
// ErrDuplicateOutcome means more than one outcome heading was found.
ErrDuplicateOutcome = errors.New("turn output: duplicate outcome")
// ErrOutcomeNotAllowed means the value was not one of the declared words.
ErrOutcomeNotAllowed = errors.New("turn output: outcome not allowed")
)
// ParseOutput extracts the single outcome section from a turn's markdown.
//
// A heading whose text is "outcome" (any ATX level) is followed by the first
// non-blank line, which must contain exactly one allowed word. Matching is
// trim-and-lower-case, and the canonical spelling from allowedOutcomes is
// returned. Everything after that value line is the body, preserved byte for
// byte. Text before the outcome heading is ignored. Headings and values inside
// fenced code blocks are never considered.
func ParseOutput(markdown string, allowedOutcomes []string) (Outcome string, Body string, err error) {
if strings.TrimSpace(markdown) == "" {
return "", "", ErrEmptyOutput
}
lines := markdownLines(markdown)
var headings []int
var fence fenceState
for i, line := range lines {
if fence.open() {
if fence.closes(line.text) {
fence = fenceState{}
}
continue
}
if marker, ok := openingFence(line.text); ok {
fence = marker
continue
}
if isOutcomeHeading(line.text) {
headings = append(headings, i)
}
}
switch len(headings) {
case 0:
return "", "", ErrMissingOutcome
case 1:
default:
return "", "", fmt.Errorf("%w: found %d outcome headings", ErrDuplicateOutcome, len(headings))
}
heading := headings[0]
value := heading + 1
for value < len(lines) && strings.TrimSpace(lines[value].text) == "" {
value++
}
if value == len(lines) {
return "", "", fmt.Errorf("%w: outcome heading has no value", ErrMissingOutcome)
}
word := strings.TrimSpace(lines[value].text)
canonical, ok := allowedOutcome(word, allowedOutcomes)
if !ok {
return "", "", fmt.Errorf("%w: %q", ErrOutcomeNotAllowed, word)
}
return canonical, markdown[lines[value].next:], nil
}
func allowedOutcome(word string, outcomes []string) (string, bool) {
key := strings.ToLower(word)
for _, outcome := range outcomes {
outcome = strings.TrimSpace(outcome)
if outcome != "" && strings.ToLower(outcome) == key {
return outcome, true
}
}
return "", false
}
type markdownLine struct {
text string
next int
}
// markdownLines records each line's content without its line ending and the
// byte position immediately after that line ending. Body slices therefore keep
// CRLF and every other byte exactly as supplied.
func markdownLines(markdown string) []markdownLine {
lines := make([]markdownLine, 0, strings.Count(markdown, "\n")+1)
for start := 0; start < len(markdown); {
next := len(markdown)
text := markdown[start:]
if relative := strings.IndexByte(markdown[start:], '\n'); relative >= 0 {
next = start + relative + 1
text = markdown[start : start+relative]
}
lines = append(lines, markdownLine{
text: strings.TrimSuffix(text, "\r"),
next: next,
})
if next == len(markdown) {
break
}
start = next
}
return lines
}
func isOutcomeHeading(text string) bool {
text = strings.TrimSpace(text)
hashes := 0
for hashes < len(text) && text[hashes] == '#' {
hashes++
}
if hashes == 0 || hashes == len(text) {
return false
}
// Markdown ATX headings require whitespace between the marker and text.
if text[hashes] != ' ' && text[hashes] != '\t' {
return false
}
return strings.EqualFold(strings.TrimSpace(text[hashes:]), "outcome")
}
type fenceState struct {
char byte
length int
}
func (f fenceState) open() bool {
return f.length > 0
}
func (f fenceState) closes(text string) bool {
char, length, ok := fenceMarker(text)
if !ok || char != f.char || length < f.length {
return false
}
trimmed := strings.TrimLeft(text, " \t")
return strings.TrimSpace(trimmed[length:]) == ""
}
func openingFence(text string) (fenceState, bool) {
char, length, ok := fenceMarker(text)
if !ok {
return fenceState{}, false
}
return fenceState{char: char, length: length}, true
}
func fenceMarker(text string) (byte, int, bool) {
trimmed := strings.TrimLeft(text, " \t")
if len(trimmed) < 3 || (trimmed[0] != '`' && trimmed[0] != '~') {
return 0, 0, false
}
char := trimmed[0]
length := 0
for length < len(trimmed) && trimmed[length] == char {
length++
}
if length < 3 {
return 0, 0, false
}
return char, length, true
}
+137
View File
@@ -0,0 +1,137 @@
package turn
import (
"errors"
"testing"
)
func TestParseOutput(t *testing.T) {
allowed := []string{"success", "blocked", "rejected"}
tests := []struct {
name string
input string
outcome string
body string
err error
}{
{
name: "leading commentary is ignored and trailing section is body",
input: "Checking the work first.\n\n## outcome\nsuccess\n\n# Result\n\nThe work is complete.\n",
outcome: "success",
body: "\n# Result\n\nThe work is complete.\n",
},
{
name: "diff embedding an outcome line cannot confuse the parser",
input: "# outcome\nblocked\n\n```diff\n+# outcome success\n+unrelated change\n```\n",
outcome: "blocked",
body: "\n```diff\n+# outcome success\n+unrelated change\n```\n",
},
{
name: "fenced headings before the real outcome are ignored",
input: "```md\n# outcome\nfailed\n```\n\n~~~\n## outcome\nrejected\n~~~\n\n# outcome\nSUCCESS\n\nbody",
outcome: "success",
body: "\nbody",
},
{
name: "CRLF line endings",
input: "leading\r\n\r\n## outcome\r\n\r\nsuccess\r\n\r\nbody\r\n",
outcome: "success",
body: "\r\nbody\r\n",
},
{
name: "arbitrary markdown body is preserved exactly",
input: "# outcome\nsuccess\n\n## Heading\n\n- item\n\n```go\nfmt.Println(\"hi\")\n```\n\n# outcome is discussed here\n",
outcome: "success",
body: "\n## Heading\n\n- item\n\n```go\nfmt.Println(\"hi\")\n```\n\n# outcome is discussed here\n",
},
{
name: "duplicate outcome",
input: "# outcome\nsuccess\n\n# outcome\nblocked\n",
err: ErrDuplicateOutcome,
},
{
name: "duplicate inside a fence is ignored",
input: "```\n# outcome\nsuccess\n```\n\n# outcome\nblocked\n",
outcome: "blocked",
},
{
name: "unknown outcome word",
input: "# outcome\nmaybe\n",
err: ErrOutcomeNotAllowed,
},
{
name: "extra text on the outcome line",
input: "# outcome\nsuccess please\n",
err: ErrOutcomeNotAllowed,
},
{
name: "value inside a fence is not an outcome value",
input: "# outcome\n```\nsuccess\n```\n",
err: ErrOutcomeNotAllowed,
},
{
name: "empty output",
input: "",
err: ErrEmptyOutput,
},
{
name: "whitespace-only output",
input: " \r\n\t\n",
err: ErrEmptyOutput,
},
{
name: "missing outcome heading",
input: "# Result\nsuccess\n",
err: ErrMissingOutcome,
},
{
name: "outcome heading without a value",
input: "# outcome\n\n",
err: ErrMissingOutcome,
},
{
name: "fenced outcome is not a real outcome",
input: "```\n# outcome\nsuccess\n```\n",
err: ErrMissingOutcome,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
outcome, body, err := ParseOutput(test.input, allowed)
if test.err != nil {
if !errors.Is(err, test.err) {
t.Fatalf("error = %v, want %v", err, test.err)
}
if outcome != "" || body != "" {
t.Fatalf("error result = (%q, %q), want empty", outcome, body)
}
return
}
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if outcome != test.outcome || body != test.body {
t.Fatalf("ParseOutput() = (%q, %q), want (%q, %q)", outcome, body, test.outcome, test.body)
}
})
}
}
func TestParseOutputReturnsCanonicalOutcome(t *testing.T) {
outcome, body, err := ParseOutput("#### Outcome\n\n Success \n\nrest", []string{" success ", "blocked"})
if err != nil {
t.Fatalf("ParseOutput() error: %v", err)
}
if outcome != "success" {
t.Fatalf("outcome = %q, want canonical %q", outcome, "success")
}
if body != "\nrest" {
t.Fatalf("body = %q, want %q", body, "\nrest")
}
}
func TestParseOutputRequiresWhitespaceAfterHeadingMarker(t *testing.T) {
if _, _, err := ParseOutput("#outcome\nsuccess\n", []string{"success"}); !errors.Is(err, ErrMissingOutcome) {
t.Fatalf("error = %v, want missing outcome", err)
}
}
+74
View File
@@ -0,0 +1,74 @@
package turn
import (
"fmt"
"sort"
"strings"
)
// RenderInput renders the markdown a turn receives. The first turn receives the
// run prompt as-is. Later turns receive the previous turn's output verbatim
// under a heading; prompt is not repeated.
func RenderInput(prompt string, previousOutput string) string {
if strings.TrimSpace(previousOutput) == "" {
return prompt
}
return "# Previous turn output\n\n" + previousOutput
}
// MemoryEntry is one completed turn in a later turn's memory file. Output is
// the turn's markdown body, without the outcome section. PublicFiles are paths
// relative to the run directory, so the public prefix is retained.
type MemoryEntry struct {
Stage string
Visit int
Output string
PublicFiles []string
}
// RenderMemory renders completed turns in the order supplied. Each turn's output
// is embedded verbatim; the file list is system-written from PublicFiles and is
// sorted and deduplicated so the result is deterministic.
func RenderMemory(entries []MemoryEntry) string {
var b strings.Builder
for i, entry := range entries {
if i > 0 {
b.WriteString("\n")
}
fmt.Fprintf(&b, "## %s · visit %d\n\n", entry.Stage, entry.Visit)
if entry.Output != "" {
b.WriteString(entry.Output)
if !strings.HasSuffix(entry.Output, "\n") {
b.WriteString("\n")
}
b.WriteString("\n")
}
b.WriteString("Files added to public/:\n")
files := sortedUnique(entry.PublicFiles)
if len(files) == 0 {
b.WriteString("- _(none)_\n")
continue
}
for _, file := range files {
b.WriteString("- ")
b.WriteString(file)
b.WriteString("\n")
}
}
return b.String()
}
func sortedUnique(values []string) []string {
if len(values) == 0 {
return nil
}
sorted := append([]string(nil), values...)
sort.Strings(sorted)
unique := sorted[:0]
for _, value := range sorted {
if len(unique) == 0 || unique[len(unique)-1] != value {
unique = append(unique, value)
}
}
return unique
}
+74
View File
@@ -0,0 +1,74 @@
package turn
import (
"strings"
"testing"
)
func TestRenderInputFirstTurnIsTheRunPrompt(t *testing.T) {
prompt := "# Task\n\nImplement the thing.\n"
if got := RenderInput(prompt, ""); got != prompt {
t.Fatalf("first turn input = %q, want prompt verbatim", got)
}
if got := RenderInput(prompt, " \r\n\t"); got != prompt {
t.Fatalf("blank previous output should behave as the first turn, got %q", got)
}
}
func TestRenderInputLaterTurnShowsOnlyPreviousOutput(t *testing.T) {
previous := "## Result\n\n- changed `internal/turn`\n\n```diff\n+new line\n```\n"
got := RenderInput("the original prompt", previous)
want := "# Previous turn output\n\n" + previous
if got != want {
t.Fatalf("later turn input = %q, want %q", got, want)
}
if strings.Contains(got, "the original prompt") {
t.Fatal("later turn input repeated the run prompt")
}
}
func TestRenderMemory(t *testing.T) {
entries := []MemoryEntry{
{
Stage: "planner",
Visit: 1,
Output: "# Plan\n\nDo the work.",
PublicFiles: []string{"public/b.md", "public/a.md", "public/a.md"},
},
{
Stage: "reviewer",
Visit: 2,
Output: "No public files.\n",
},
}
want := "## planner · visit 1\n\n" +
"# Plan\n\nDo the work.\n\n" +
"Files added to public/:\n- public/a.md\n- public/b.md\n\n" +
"## reviewer · visit 2\n\n" +
"No public files.\n\n" +
"Files added to public/:\n- _(none)_\n"
if got := RenderMemory(entries); got != want {
t.Fatalf("RenderMemory() = %q, want %q", got, want)
}
if again := RenderMemory(entries); again != want {
t.Fatalf("RenderMemory() is not deterministic: %q", again)
}
}
func TestRenderMemoryEmbedsOutputVerbatim(t *testing.T) {
output := "## Notes\n\n```md\n# outcome success\n```\n\nlast line without newline"
entries := []MemoryEntry{{Stage: "build", Visit: 3, Output: output, PublicFiles: []string{"public/report.md"}}}
got := RenderMemory(entries)
if !strings.Contains(got, output) {
t.Fatalf("output was not embedded verbatim:\n%s", got)
}
if !strings.Contains(got, "- public/report.md\n") {
t.Fatalf("public file list missing:\n%s", got)
}
}
func TestRenderMemoryEmpty(t *testing.T) {
if got := RenderMemory(nil); got != "" {
t.Fatalf("RenderMemory(nil) = %q, want empty", got)
}
}
+3 -2
View File
@@ -28,13 +28,14 @@ not this one, decides whether a feature is done.
| `src/serverUrl.js` | `data/transport/ServerUrl.kt` | `validateServerUrl`, `resolveArtifactUrl` |
| `src/client.js` | `data/transport/PipelinesClient.kt` | one reused socket, id matching, timeout, backoff. **DOM-free** |
| `src/repository.js` | `data/PipelinesRepository.kt` | typed request builders |
| `src/app.js` | `ui/**` | page shell: boot, state, client wiring, connection/banner, navigation/routes, render dispatch, header |
| `src/app.js` | `ui/**` | page shell: boot, state, client wiring, navigation/routes, render dispatch, persistent rail/workspace/dock |
| `src/shell.js` | `ui/WindowSize.kt`, `ui/components/DetailTabs.kt` | pure shell model: destinations, view/route mapping, roving-tabindex arithmetic, status words |
| `src/dom.js` | — | `h()`, shared DOM helpers and clipboard/share actions |
| `src/format.js` | `ui/Format.kt` (DOM-facing bits) | status tone and error-text helpers |
| `src/views/*.js` | `ui/**` | one module per destination/dialog surface: attention, settings, pipelines, templates, runs, runDetail, chat, search, dialogs |
| `index.html`, `*.css` | — | shell + area styles linked in a fixed order |
| `serve.mjs` | — | static server + `/connect` proxy |
| `test/*.test.mjs` | `app/src/test/**` | `node --test`, no server needed |
| `test/*.test.mjs` | `app/src/test/**` | `node --test`, no server needed (including the shell/tab helpers) |
| `test/smoke.mjs` | — | protocol smoke against a live server |
| `test/browser.mjs` | — | zero-dep Chrome DevTools driver |
| `test/ui-smoke.mjs` | UI review captures | live browser check + screenshots |
+10 -10
View File
File diff suppressed because one or more lines are too long
+5 -4
View File
@@ -34,9 +34,10 @@ node serve.mjs --host 0.0.0.0 # reachable from other devices (trusted LAN/VP
node serve.mjs --port 8095 --pipelines 127.0.0.1:8080
```
The page prefills its URL field with `ws://<this page's host><port>/connect` — the
proxy — so the usual flow is: open the page, press **Connect**. Nothing is baked
in.
The page's Server URL field (in **Settings → Connection**) prefills with
`ws://<this page's host><port>/connect` — the proxy. Press **Connect** there the
first time; the endpoint is then remembered and re-opened on later loads. Nothing
is baked in.
On a deployment where ntfy already uses 8090, pick another port for the page
(e.g. `--port 8095`). The page is a foreground Node process, not a service.
@@ -109,7 +110,7 @@ proxy.
To open the page from another device, bind `--host 0.0.0.0` and use this
machine's LAN or Tailscale address for the page (e.g.
`http://100.85.25.33:8095/`), then press Connect. Both hops are plaintext, so
`http://100.85.25.33:8095/`), then press Connect in Settings. Both hops are plaintext, so
there is no mixed-content block; only do this on a trusted tailnet/VPN.
## Verification notes
+167 -178
View File
@@ -1,135 +1,124 @@
/* Throwaway spike styling. Dark-first, echoing the Android client's theme. */
/* Base layer: the dark palette comes from design/tokens/tokens.css (linked
first); this file only paints shared primitives. The shell grid lives in
shell.css, list/detail surfaces in lists.css. */
:root {
color-scheme: dark;
--bg: #0e1513;
--surface: #171f1d;
--surface-2: #1f2a27;
--border: #2c3a36;
--text: #e2e8e6;
--muted: #9db0ab;
--accent: #7fd1bb;
--ok: #6bd39a;
--warn: #e6c268;
--bad: #ef8a8a;
}
* { box-sizing: border-box; }
html,
body {
height: 100%;
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
overflow: hidden;
background: var(--color-bg);
color: var(--color-text);
font: var(--type-body);
-webkit-font-smoothing: antialiased;
}
.topbar {
display: flex;
gap: 16px;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
background: var(--surface);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 2;
flex-wrap: wrap;
}
.brand { display: flex; gap: 8px; align-items: baseline; }
.brand strong { font-size: 16px; }
.connbar { display: flex; gap: 8px; align-items: center; flex: 1 1 420px; justify-content: flex-end; }
input[type="text"] {
flex: 1 1 260px;
min-width: 200px;
padding: 7px 10px;
background: var(--surface-2);
color: var(--text);
border: 1px solid var(--border);
border-radius: 8px;
button,
input,
select,
textarea {
font: inherit;
color: inherit;
}
button {
font: inherit;
padding: 7px 12px;
border-radius: 8px;
border: 1px solid var(--border);
background: var(--surface-2);
color: var(--text);
min-height: var(--density-control-height);
padding: 0 var(--space-control-pad-inline);
border-radius: var(--radius-control);
border: 1px solid var(--color-border);
background: var(--color-surface-2);
color: var(--color-text);
cursor: pointer;
transition: background var(--motion-fast) var(--ease-standard),
border-color var(--motion-fast) var(--ease-standard);
}
button:hover { border-color: var(--accent); }
button.ghost { background: transparent; }
button:hover { background: var(--color-elevated); }
button:active { background: var(--color-elevated-2); }
button.ghost { background: transparent; border-color: transparent; color: var(--color-muted); }
button.ghost:hover { background: var(--tint-hover); color: var(--color-text); }
button:disabled { opacity: var(--opacity-disabled); cursor: not-allowed; }
.tabs { display: flex; gap: 4px; align-items: center; padding: 10px 16px 0; }
.tabs .spacer { flex: 1; }
.tab { border-color: transparent; background: transparent; }
.tab.active { background: var(--surface-2); border-color: var(--border); color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 16px; padding: 16px; align-items: start; }
@media (max-width: 760px) {
.split { grid-template-columns: 1fr; }
.artifact-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
input[type="text"],
input[type="search"],
select,
textarea {
min-height: var(--density-control-height);
padding: 0 var(--space-s);
background: var(--color-surface-2);
color: var(--color-text);
border: 1px solid var(--color-border);
border-radius: var(--radius-control);
}
.list, .detail {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
}
a { color: var(--color-accent); }
.list {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--color-surface);
}
.row {
display: block;
width: 100%;
min-height: 0;
text-align: left;
border: 0;
border-bottom: 1px solid var(--border);
border-bottom: 1px solid var(--color-divider);
border-radius: 0;
background: transparent;
padding: 10px 12px;
padding: var(--space-s) var(--space-m);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.row-head { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.row-title { font-weight: 600; }
.row-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.row:hover { background: var(--tint-hover); }
.row.selected { background: var(--tint-selected); box-shadow: inset 3px 0 0 var(--color-accent); }
.row-head { display: flex; gap: var(--space-xs); justify-content: space-between; align-items: center; min-width: 0; }
.row-title { display: block; max-width: 100%; font-weight: var(--weight-semibold); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: block; color: var(--color-muted); font-size: 12px; line-height: 16px; margin-top: 2px; }
.detail { padding: 16px; }
.detail h2 { margin: 0 0 12px; display: flex; gap: 10px; align-items: center; }
.detail h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: none; }
.kv { display: grid; gap: 4px; }
.kv { display: grid; gap: var(--space-2xs); }
.kv.tight { margin-top: 6px; }
.kv-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.kv-key { color: var(--muted); }
.kv-val { word-break: break-word; }
.kv-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--space-s); }
.kv-key { color: var(--color-muted); }
.kv-val { word-break: break-word; min-width: 0; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stages li { display: flex; gap: 8px; align-items: center; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); }
.stages li { display: flex; gap: var(--space-xs); align-items: center; }
.steps { display: grid; gap: 8px; }
.step { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.step-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.steps { display: grid; gap: var(--space-xs); }
.step { border-bottom: 1px solid var(--color-divider); padding: var(--space-s) 0; }
.step-head { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
.artifacts { margin-top: 8px; font-size: 12px; }
.artifacts a { color: var(--accent); margin-right: 10px; }
.artifacts-summary { color: var(--accent); }
.artifacts { margin-top: var(--space-xs); font-size: 12px; }
.artifacts a { color: var(--color-accent); margin-right: 10px; }
.artifacts-summary { color: var(--color-accent); }
.artifacts-note { margin-top: 2px; }
.artifact-hint { margin: 4px 0; }
/* Run-level artifacts gallery: group headers + a fitting tile grid. */
.artifacts-header { margin-top: 18px; }
.artifact-gallery { display: grid; gap: 12px; }
.artifact-group-head { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 4px; }
.artifacts-header { margin-top: var(--space-m); }
.artifact-gallery { display: grid; gap: var(--space-s); }
.artifact-group-head { color: var(--color-muted); font-size: 12px; font-weight: var(--weight-semibold); margin-top: 4px; }
.artifact-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 10px;
gap: var(--space-xs);
}
.artifact-tile {
@@ -140,15 +129,15 @@ button.ghost { background: transparent; }
justify-content: center;
gap: 4px;
min-height: 120px;
padding: 10px;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 10px;
padding: var(--space-xs);
background: var(--color-surface-2);
border: 1px solid var(--color-divider);
border-radius: var(--radius-card);
overflow: hidden;
text-align: center;
}
.artifact-tile.clickable { cursor: pointer; }
.artifact-tile.clickable:hover { border-color: var(--accent); }
.artifact-tile.clickable:hover { border-color: var(--color-accent); }
.artifact-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.artifact-poster {
display: flex;
@@ -159,22 +148,23 @@ button.ghost { background: transparent; }
border-radius: 50%;
background: rgba(0, 0, 0, 0.45);
}
.artifact-play { font-size: 18px; color: var(--text); }
.artifact-kind { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.artifact-name { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-size { color: var(--muted); font-size: 11px; }
.artifact-play { font-size: 18px; color: var(--color-text); }
.artifact-kind { color: var(--color-muted); font-size: 11px; text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); }
.artifact-name { font-size: 12px; font-weight: var(--weight-semibold); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-size { color: var(--color-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.artifact-actions { position: absolute; top: 8px; right: 6px; display: flex; gap: 4px; }
.artifact-action {
padding: 2px 6px;
min-height: 24px;
padding: 0 6px;
font-size: 10px;
border-radius: 6px;
border-radius: var(--radius-s);
background: rgba(14, 21, 19, 0.72);
}
.artifact-action:disabled { opacity: 0.4; cursor: not-allowed; }
/* The per-visit session export link / notice (parity R9). */
.session-export { margin-top: 6px; font-size: 12px; }
.session-link { color: var(--accent); }
.session-link { color: var(--color-accent); }
/* Full-screen artifact viewer overlay. */
.artifact-viewer {
@@ -183,106 +173,105 @@ button.ghost { background: transparent; }
z-index: 20;
display: flex;
flex-direction: column;
gap: 12px;
gap: var(--space-s);
padding: 20px;
background: rgba(0, 0, 0, 0.86);
}
.viewer-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.viewer-title { font-size: 15px; font-weight: 600; }
.viewer-position { font-size: 12px; }
.viewer-head { display: flex; align-items: baseline; gap: var(--space-s); flex-wrap: wrap; }
.viewer-title { font-size: 15px; font-weight: var(--weight-semibold); }
.viewer-position { font-size: 12px; font-variant-numeric: tabular-nums; }
.viewer-board { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 32px;
color: var(--muted);
gap: var(--space-s);
padding: var(--space-xl);
color: var(--color-muted);
}
.viewer-placeholder .artifact-play { font-size: 40px; }
.viewer-nav { display: flex; gap: 8px; justify-content: center; }
.viewer-nav { display: flex; gap: var(--space-xs); justify-content: center; }
.viewer-page:disabled { opacity: 0.4; cursor: not-allowed; }
.viewer-actions { display: flex; gap: 8px; justify-content: flex-end; }
.viewer-actions { display: flex; gap: var(--space-xs); justify-content: flex-end; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--border); color: var(--muted); }
.chip {
display: inline-block;
flex: none;
padding: 1px 8px;
border-radius: var(--radius-pill);
font-size: 11px;
line-height: 16px;
border: 1px solid var(--color-divider);
color: var(--color-muted);
font-variant-numeric: tabular-nums;
}
/* The app-owned status hues (RunStatusPalette): status is never colour-only,
every chip still carries its own label. */
.chip-running, .chip-active { color: #7fb2f0; border-color: #7fb2f0; }
.chip-waiting { color: #8edff5; border-color: #8edff5; }
.chip-succeeded { color: var(--ok); border-color: var(--ok); }
.chip-failed { color: var(--bad); border-color: var(--bad); }
.chip-canceled { color: #889391; border-color: #889391; }
.chip-interrupted { color: var(--warn); border-color: var(--warn); }
.chip-queued { color: #9aa6a2; border-color: #9aa6a2; }
.chip-blocked { color: #f0a35e; border-color: #f0a35e; }
.chip-skipped { color: #a8b8c8; border-color: #a8b8c8; }
.chip-running, .chip-active { color: var(--status-running); border-color: var(--status-running); }
.chip-waiting { color: var(--status-waiting); border-color: var(--status-waiting); }
.chip-succeeded { color: var(--status-succeeded); border-color: var(--status-succeeded); }
.chip-failed { color: var(--status-failed); border-color: var(--status-failed); }
.chip-canceled { color: var(--status-canceled); border-color: var(--status-canceled); }
.chip-interrupted { color: var(--status-interrupted); border-color: var(--status-interrupted); }
.chip-queued { color: var(--status-queued); border-color: var(--status-queued); }
.chip-blocked { color: var(--status-blocked); border-color: var(--status-blocked); }
.chip-skipped { color: var(--status-skipped); border-color: var(--status-skipped); }
.chip-unknown { color: var(--status-unknown); border-color: var(--status-unknown); }
.dot::before { content: "●"; margin-right: 6px; }
.dot.ok::before { color: var(--ok); }
.dot.warn::before { color: var(--warn); }
.dot.bad::before { color: var(--bad); }
.dot.idle::before { color: var(--muted); }
.state { color: var(--muted); white-space: nowrap; }
.dot::before { content: "\25cf"; margin-right: 6px; }
.dot.ok::before { color: var(--color-ok); }
.dot.warn::before { color: var(--color-warn); }
.dot.bad::before { color: var(--color-bad); }
.dot.idle::before { color: var(--color-muted); }
.state { color: var(--color-muted); white-space: nowrap; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.pad { padding: 12px; }
.muted { color: var(--color-muted); }
.ok { color: var(--color-ok); }
.warn { color: var(--color-warn); }
.bad { color: var(--color-bad); }
.pad { padding: var(--space-s); }
.banner { padding: 8px 16px; }
.banner.warn { background: #2a2410; color: var(--warn); }
.banner.error { background: #2c1616; color: var(--bad); }
.banner { padding: var(--space-xs) var(--space-m); }
.banner.warn { background: var(--tint-warn-soft); color: var(--color-warn); }
.banner.error { background: var(--tint-bad-soft); color: var(--color-bad); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
Transport: the persistent connection banner (T5) and the live badge. The
banner is in normal flow directly under the header, so it can never cover the
content; its container colours follow ConnectionBanner.kt's Material roles
(surfaceVariant idle/connecting, errorContainer disconnected, primary
connected). Hand-written, on the app's dark palette.
--------------------------------------------------------------------------- */
.conn-banner {
display: flex;
gap: 10px;
align-items: center;
padding: 8px 16px;
font-size: 13px;
border-bottom: 1px solid var(--border);
background: var(--surface-2);
color: var(--text);
code {
background: var(--color-surface-2);
padding: 1px 6px;
border-radius: var(--radius-xs);
font: var(--type-code);
}
.conn-banner[hidden] { display: none; }
.conn-banner-dot::before { content: "\25cf"; }
.conn-banner-text { font-weight: 500; }
.conn-build { margin-left: auto; color: var(--muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.conn-warning { color: var(--warn); font-weight: 600; }
/* Idle: surfaceVariant (never an error colour — nothing is wrong yet). */
.conn-idle { background: var(--surface-2); color: var(--muted); }
.conn-idle .conn-banner-dot::before { color: var(--muted); }
/* Connecting: surfaceVariant with a warm dot, matching the state badge. */
.conn-connecting { background: var(--surface-2); color: var(--muted); }
.conn-connecting .conn-banner-dot::before { color: var(--warn); }
/* Disconnected: errorContainer. */
.conn-error { background: #2c1616; color: var(--bad); }
.conn-error .conn-banner-dot::before { color: var(--bad); }
.conn-error .conn-build { color: var(--muted); }
/* Connected: an explicit green (primary) state, the page's one visible
difference from ConnectionBanner.kt, which renders nothing once connected. */
.conn-ok { background: #12251b; color: var(--ok); }
.conn-ok .conn-banner-dot::before { color: var(--ok); }
/* Live-stream badge (LiveBadge.kt): a dot plus the honest word, so colour is
never the only signal. */
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-muted); white-space: nowrap; }
.live-badge .live-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live-live { color: var(--ok); }
.live-reconnecting { color: var(--warn); }
.live-live { color: var(--color-ok); }
.live-reconnecting { color: var(--color-warn); }
.live-reconnecting .live-dot { opacity: 0.4; }
.live-not-live { color: var(--muted); }
.live-not-live { color: var(--color-muted); }
.live-not-live .live-dot { opacity: 0.4; }
/* One 8px-grid rhythm for every pane heading. */
.pane-head {
display: flex;
flex: 0 0 auto;
gap: var(--space-xs);
align-items: center;
justify-content: space-between;
min-width: 0;
padding: var(--space-s) var(--space-m);
border-bottom: 1px solid var(--color-divider);
}
.pane-title { margin: 0; min-width: 0; font: var(--type-title-small); letter-spacing: var(--tracking-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-subtitle { margin: 2px 0 0; color: var(--color-muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
+22 -11
View File
@@ -4,7 +4,8 @@
is untrusted model output, so every node is built with textContent.
--------------------------------------------------------------------------- */
.chat-list { display: flex; flex-direction: column; }
.chat-list { display: flex; flex-direction: column; min-height: 0; }
.chat-rows { flex: 1 1 auto; min-height: 0; align-content: start; padding-bottom: 180px; }
/* A row's Chat actions menu hangs below the button. `.list` clips its children
for the rounded corners, which cut the panel off at the list's bottom edge and
made the final rows' Hide/Rename items unclickable. Unclip only while a menu is
@@ -181,8 +182,17 @@
.chat-activity-streaming { color: var(--accent); }
.chat-activity-new { color: #7fb2f0; }
.chat-detail { display: flex; flex-direction: column; gap: 10px; }
.chat-bar { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.chat-detail {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
gap: var(--space-xs);
padding: var(--space-m);
overflow: hidden;
}
.chat-create { overflow-y: auto; overscroll-behavior: contain; }
.chat-bar { flex: 0 0 auto; display: flex; gap: var(--space-s); align-items: flex-start; justify-content: space-between; }
.chat-bar-titles { display: grid; gap: 2px; min-width: 0; }
.chat-bar-title { margin: 0; font-size: 16px; }
.chat-bar-meta { font-size: 12px; }
@@ -190,18 +200,19 @@
.chat-load-older { white-space: nowrap; font-size: 12px; }
.chat-transcript-empty { padding: 24px 12px; }
.chat-transcript-wrap { position: relative; flex: 1 1 auto; min-height: 320px; }
.chat-transcript-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.chat-transcript {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
gap: 10px;
max-height: min(62vh, 660px);
gap: var(--space-xs);
overflow-y: auto;
padding: 12px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 10px;
overscroll-behavior: contain;
padding: var(--space-s);
background: var(--color-bg);
border: 1px solid var(--color-divider);
border-radius: var(--radius-card);
}
.chat-turn { display: flex; }
.chat-turn-user { justify-content: flex-end; }
@@ -542,7 +553,7 @@
/* The composer at the foot of a conversation (C8/C9). The field grows 1–6 rows;
the primary control turns from Send to Stop while a turn is in flight. */
.chat-composer { display: grid; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.chat-composer { flex: 0 0 auto; display: grid; gap: var(--space-xs); padding-top: 6px; border-top: 1px solid var(--color-divider); }
.chat-queued { font-size: 12px; color: var(--muted); }
.chat-attachment-strip { display: flex; flex-wrap: wrap; gap: 8px; }
+1
View File
@@ -214,6 +214,7 @@
--layout-rail: 200px;
--layout-list-min: 200px;
--layout-list-max: 360px;
--layout-detail-min: 200px;
--layout-dock: 60px;
--layout-hairline: 1px;
--layout-measure: 72ch;
+27 -7
View File
@@ -2,9 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Pipelines — web spike</title>
<meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-content" />
<title>Pipelines</title>
<link rel="stylesheet" href="./design/tokens/tokens.css" />
<link rel="stylesheet" href="./base.css" />
<link rel="stylesheet" href="./shell.css" />
<link rel="stylesheet" href="./lists.css" />
<link rel="stylesheet" href="./run-detail.css" />
<link rel="stylesheet" href="./chat.css" />
@@ -13,11 +15,29 @@
<link rel="stylesheet" href="./settings.css" />
</head>
<body>
<noscript>This spike needs JavaScript to open the WebSocket connection.</noscript>
<div id="noscript-hint" class="banner warn">
Trusted LAN/VPN only. The Pipelines server has no authentication and is not
internet-safe.
</div>
<noscript>This page needs JavaScript to open the WebSocket connection.</noscript>
<!-- The 24px glyphs the rail and the narrow destination bar draw. Decorative:
every control that uses one also carries a visible label. -->
<svg class="icon-sprite" aria-hidden="true" focusable="false">
<symbol id="icon-pipelines" viewBox="0 0 24 24">
<path d="M5 4h6v6H5zM13 14h6v6h-6zM8 10v7h5" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" />
</symbol>
<symbol id="icon-runs" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="8" fill="none" stroke="currentColor" stroke-width="1.7" />
<path d="M12 7v5l3 2" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" />
</symbol>
<symbol id="icon-chat" viewBox="0 0 24 24">
<path d="M4 5h16v11H9l-5 4z" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" />
</symbol>
<symbol id="icon-settings" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.7" />
<path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M18.4 5.6L17 7M7 17l-1.4 1.4" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" />
</symbol>
<symbol id="icon-search" viewBox="0 0 24 24">
<circle cx="10.5" cy="10.5" r="6" fill="none" stroke="currentColor" stroke-width="1.7" />
<path d="M15 15l5 5" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" />
</symbol>
</svg>
<script type="module" src="./src/app.js"></script>
</body>
</html>
+7 -15
View File
@@ -84,11 +84,11 @@
.filter-check input { accent-color: var(--accent); }
.filter-menu { min-width: 240px; max-width: 340px; grid-template-columns: minmax(0, 1fr); }
/* The list body is the scroll container so the day headers can stick to its top
without depending on the (wrapping) top bar's height. */
/* The list body is the scroll container (shell.css gives it its height); the
day headers stick to its top. */
.run-scroll {
max-height: calc(100vh - 210px);
overflow-y: auto;
min-height: 0;
align-content: start;
}
.metrics {
@@ -173,10 +173,10 @@
/* --- Templates gallery + detail ------------------------------------------ */
.pane-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 12px 0; }
.pane-head h2 { margin: 0; font-size: 16px; }
.pane-head .pane-title { margin: 0; font-size: 16px; }
.gallery { padding-bottom: 8px; }
.cards { display: grid; gap: 8px; padding: 10px 12px; }
.cards { display: grid; gap: var(--space-xs); padding: var(--space-s); align-content: start; }
.card {
display: block;
width: 100%;
@@ -201,10 +201,6 @@
.card-desc:empty { display: none; }
.card-meta { display: block; color: var(--accent); font-size: 12px; margin-top: 4px; }
.tabstrip { display: flex; gap: 4px; margin: -4px 0 12px; }
.minitab { border-color: transparent; background: transparent; padding: 5px 10px; }
.minitab.active { background: var(--surface-2); border-color: var(--border); color: var(--accent); }
.tabbody h2 { margin-top: 0; }
.tabbody .body { margin: 0 0 12px; }
.meta-line { color: var(--muted); font-size: 12px; margin-top: 4px; }
@@ -248,11 +244,7 @@
.empty { display: grid; gap: 10px; justify-items: start; }
/* Pipeline detail: tab strip, collapsible sections, source block. */
.detail-tabs { display: flex; gap: 4px; margin: 10px 0 12px; border-bottom: 1px solid var(--border); }
.detail-tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 6px 10px; }
.detail-tab:hover { border-color: transparent; color: var(--text); }
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Pipeline detail: collapsible sections, source block. */
.detail-subtitle { font-size: 12px; margin-bottom: 10px; }
.monospace { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
+2 -1
View File
@@ -6,7 +6,8 @@
.run-tab-body { display: grid; gap: 10px; }
.run-detail-title { margin: 0; font-size: 18px; }
.run-detail-title { margin: 0; font: var(--type-title); letter-spacing: var(--tracking-tight); }
.run-title-row { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; min-width: 0; }
.run-chip-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.run-identity { font-size: 12px; }
+19 -6
View File
@@ -6,17 +6,21 @@
--------------------------------------------------------------------------- */
.settings {
display: grid;
gap: 22px;
gap: var(--space-l);
max-width: 720px;
margin: 0 auto;
padding: 18px 16px 48px;
padding: var(--space-l) var(--space-m) var(--space-3xl);
}
.settings-section { display: grid; gap: 10px; }
.settings-page-title {
margin: 0;
font: var(--type-display);
letter-spacing: var(--tracking-tight);
}
.settings-section { display: grid; gap: var(--space-xs); }
.settings-title {
margin: 0;
font-size: 15px;
font-weight: 600;
color: var(--text);
font: var(--type-title-small);
color: var(--color-text);
}
.settings-field { display: grid; gap: 6px; }
.settings-field-label { font-size: 12px; color: var(--muted); }
@@ -60,6 +64,15 @@
.settings-status.status-error .settings-status-line:first-child { color: var(--bad); }
.settings-status.status-connecting .settings-status-line:first-child,
.settings-status.status-connecting .settings-status-head .settings-status-line { color: var(--warn); }
.settings-protocol-warning {
margin: 0;
padding: var(--space-xs) var(--space-s);
border: 1px solid var(--color-warn);
border-radius: var(--radius-control);
background: var(--tint-warn-soft);
color: var(--color-warn);
font-size: 12px;
}
.settings-warning {
display: grid;
gap: 6px;
+561
View File
@@ -0,0 +1,561 @@
/* ===========================================================================
The persistent app shell (L2/L3/L4): 200px destination rail + workspace on
wide; workspace + bottom destination bar on narrow. The document never
scrolls: every pane owns its one scroller.
=========================================================================== */
html,
body {
height: 100%;
overflow: hidden;
}
body {
height: 100vh;
height: 100dvh;
}
.icon-sprite {
position: absolute;
width: 0;
height: 0;
overflow: hidden;
}
.icon {
width: var(--icon-rail);
height: var(--icon-rail);
flex: none;
fill: none;
}
/* The first focusable on every route: invisible until focused. */
.skip-link {
position: fixed;
z-index: calc(var(--layer-toast) + 1);
top: 8px;
left: 8px;
padding: 8px 12px;
border-radius: var(--radius-control);
background: var(--color-elevated);
color: var(--color-text);
border: 1px solid var(--color-border);
transform: translateY(-160%);
}
.skip-link:focus {
transform: none;
}
.app-root {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
min-height: 0;
overflow: hidden;
background: var(--color-bg);
}
/* ---- Workspace ---------------------------------------------------------- */
.workspace {
flex: 1 1 auto;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
outline: none;
}
/* The destination tabpanel inside the main landmark: it takes the workspace's
height and never scrolls itself (its panes own their scrollers). */
.pane-main {
flex: 1 1 auto;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
outline: none;
}
.content {
flex: 1 1 auto;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-layout {
flex: 1 1 auto;
min-width: 0;
min-height: 0;
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
overflow: hidden;
}
.list-pane,
.detail-pane {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.list-pane { background: var(--color-surface); }
.detail-pane { background: var(--color-bg); }
/* One scroller per pane. */
.list-scroll,
.pane-scroll,
.settings-pane {
flex: 1 1 auto;
min-height: 0;
min-width: 0;
overflow-y: auto;
overflow-x: hidden;
overscroll-behavior: contain;
scrollbar-gutter: stable;
}
.list-pane > .list,
.list-pane > .gallery {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--color-surface);
}
/* A detail body that scrolls inside the pane; the section rail/strip stays
outside it. */
.detail-pane > .pane-scroll > .detail,
.detail-pane > .pane-scroll > .detail.run-detail {
min-height: 100%;
padding: var(--space-m);
background: transparent;
border: 0;
border-radius: 0;
}
.detail-pane > .pane-scroll > .detail > h1,
.detail-pane > .pane-scroll > .detail > .run-tab-body > h1 {
margin-top: 0;
}
/* Narrow Back-to-list controls. */
.pane-back {
display: none;
flex: 0 0 auto;
padding: var(--space-xs) var(--space-m) 0;
background: var(--color-bg);
}
.pane-back button {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: var(--density-control-height-small);
font-size: 13px;
color: var(--color-muted);
background: transparent;
border-color: transparent;
}
.pane-back button:hover { color: var(--color-text); background: var(--tint-hover); }
/* ---- Destination rail (wide) ------------------------------------------- */
.app-rail { display: none; }
.rail-brand {
display: flex;
align-items: center;
gap: var(--space-xs);
min-height: 48px;
padding: 0 var(--space-s);
margin-bottom: var(--space-xs);
color: var(--color-text);
font: var(--type-title-small);
letter-spacing: var(--tracking-tight);
}
.rail-brand-mark {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border-radius: 8px;
background: var(--tint-selected-strong);
color: var(--color-accent);
font-size: 13px;
font-weight: var(--weight-semibold);
}
.rail-destinations,
.rail-tablist {
display: flex;
flex-direction: column;
gap: var(--space-3xs);
min-width: 0;
}
.rail-item,
.rail-search {
display: flex;
align-items: center;
gap: var(--space-s);
width: 100%;
min-height: var(--density-touch-target);
padding: 0 var(--space-s);
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
text-align: left;
text-decoration: none;
font-size: 14px;
font-weight: var(--weight-medium);
}
.rail-item:hover,
.rail-search:hover {
background: var(--tint-hover);
color: var(--color-text);
}
.rail-item[aria-selected="true"] {
position: relative;
background: var(--tint-selected);
color: var(--color-text);
font-weight: var(--weight-semibold);
}
.rail-item[aria-selected="true"]::before {
content: "";
position: absolute;
left: 0;
top: 10px;
bottom: 10px;
width: 3px;
border-radius: 3px;
background: var(--color-accent);
}
.rail-item .icon,
.rail-search .icon { color: currentColor; }
.rail-search { margin-top: var(--space-xs); }
.rail-search[aria-expanded="true"] { background: var(--tint-selected); color: var(--color-text); }
.rail-badge {
margin-left: auto;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 9px;
background: var(--color-accent);
color: var(--color-bg);
font-size: 11px;
font-weight: var(--weight-semibold);
font-variant-numeric: tabular-nums;
line-height: 18px;
text-align: center;
}
.rail-badge[hidden] { display: none; }
.rail-divider {
height: 1px;
flex: none;
margin: var(--space-s) var(--space-xs);
background: var(--color-divider);
}
.rail-sections { display: none; min-height: 0; }
.rail-sections.has-sections { display: block; }
.rail-heading {
margin: 0 0 var(--space-2xs);
padding: 0 var(--space-s);
color: var(--color-faint);
font: var(--type-label);
letter-spacing: var(--tracking-eyebrow);
text-transform: uppercase;
}
.rail-tab {
display: flex;
align-items: center;
gap: var(--space-xs);
width: 100%;
min-height: var(--density-control-height);
padding: 0 var(--space-s);
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
text-align: left;
font-size: 13px;
}
.rail-tab:hover { background: var(--tint-hover); color: var(--color-text); }
.rail-tab[aria-selected="true"] {
background: var(--tint-selected);
color: var(--color-text);
font-weight: var(--weight-semibold);
box-shadow: inset 2px 0 0 var(--color-accent);
}
.rail-footer {
margin-top: auto;
padding-top: var(--space-s);
border-top: 1px solid var(--color-divider);
}
/* The compact dot+word status control; always a Settings shortcut. */
.shell-status {
display: flex;
align-items: center;
gap: var(--space-xs);
width: 100%;
min-height: var(--density-control-height);
padding: 0 var(--space-s);
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
font-size: 12px;
text-align: left;
}
.shell-status:hover { background: var(--tint-hover); color: var(--color-text); }
.shell-status-dot {
width: 8px;
height: 8px;
flex: none;
border-radius: 50%;
background: currentColor;
}
.shell-status[data-state="connected"] { color: var(--color-ok); }
.shell-status[data-state="connecting"] { color: var(--color-warn); }
.shell-status[data-state="disconnected"] { color: var(--color-bad); }
.shell-status[data-state="idle"],
.shell-status[data-state="unconfigured"] { color: var(--color-muted); }
.shell-status-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---- Section strip (narrow) -------------------------------------------- */
.section-strip {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: var(--space-3xs);
min-width: 0;
padding: 4px var(--space-xs);
background: var(--color-surface);
border-top: 1px solid var(--color-divider);
overflow-x: auto;
overflow-y: hidden;
overscroll-behavior-x: contain;
scrollbar-width: none;
}
.section-strip::-webkit-scrollbar { display: none; }
.section-strip:empty { display: none; }
.strip-tab {
flex: 0 0 auto;
min-height: var(--density-touch-target);
display: inline-flex;
align-items: center;
padding: 0 var(--space-xs);
border: 1px solid transparent;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
font-size: 12px;
white-space: nowrap;
}
.strip-tab:hover { background: var(--tint-hover); color: var(--color-text); }
.strip-tab[aria-selected="true"] {
color: var(--color-text);
background: var(--color-surface-2);
border-color: var(--color-divider);
box-shadow: inset 0 -2px 0 var(--color-accent);
font-weight: var(--weight-semibold);
}
/* ---- Bottom destination bar (narrow) ----------------------------------- */
.destination-dock {
flex: 0 0 auto;
display: flex;
flex-direction: column;
gap: 2px;
padding: 2px var(--space-xs) calc(4px + env(safe-area-inset-bottom, 0px));
background: var(--color-surface);
border-top: 1px solid var(--color-divider);
}
.dock-status {
align-self: flex-start;
width: auto;
min-height: 26px;
padding: 0 var(--space-xs);
font-size: 11px;
}
.dock-row { display: flex; align-items: stretch; gap: 2px; min-width: 0; }
.dock-tabs { display: flex; flex: 1 1 auto; min-width: 0; gap: 2px; }
.dock-item {
position: relative;
flex: 1 1 0;
min-width: 0;
min-height: 48px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
padding: 4px 2px;
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
text-decoration: none;
font-size: 11px;
line-height: 14px;
}
.dock-item .icon { width: var(--icon-list); height: var(--icon-list); }
.dock-item-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-item:hover { background: var(--tint-hover); color: var(--color-text); }
.dock-item[aria-selected="true"] {
background: var(--tint-selected);
color: var(--color-accent);
font-weight: var(--weight-semibold);
}
.dock-badge {
position: absolute;
top: 3px;
right: 6px;
min-width: 16px;
height: 16px;
padding: 0 4px;
border-radius: 8px;
background: var(--color-accent);
color: var(--color-bg);
font-size: 10px;
font-weight: var(--weight-semibold);
font-variant-numeric: tabular-nums;
line-height: 16px;
text-align: center;
}
.dock-badge[hidden] { display: none; }
.dock-search {
flex: 0 0 56px;
min-height: 48px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--color-muted);
font-size: 11px;
}
.dock-search .icon { width: var(--icon-list); height: var(--icon-list); }
.dock-search[aria-expanded="true"] { background: var(--tint-selected); color: var(--color-text); }
/* ---- Shared pane text --------------------------------------------------- */
.detail-title {
margin: 0 0 var(--space-s);
font: var(--type-title);
letter-spacing: var(--tracking-tight);
overflow-wrap: anywhere;
}
.pane-head-actions { display: flex; gap: var(--space-2xs); align-items: center; flex: none; }
.pane-head-text { min-width: 0; }
.search-field-row { display: flex; gap: var(--space-xs); align-items: center; min-width: 0; }
.search-field-row .search-input { flex: 1 1 auto; }
.run-row-meta,
.metric-value,
.timeline-duration,
.artifact-size { font-variant-numeric: tabular-nums; }
.search-host {
flex: 0 0 auto;
min-width: 0;
background: var(--color-surface);
border-bottom: 1px solid var(--color-divider);
}
.search-host:empty { display: none; }
.search-host .search-panel { padding: var(--space-s) var(--space-m); }
.search-input { flex: 1 1 240px; min-width: 0; }
/* ---- Wide layout (one breakpoint, 600px) -------------------------------- */
@media (min-width: 600px) {
.app-root { flex-direction: row; }
.app-rail {
display: flex;
flex-direction: column;
flex: 0 0 var(--layout-rail);
width: var(--layout-rail);
min-height: 0;
padding: var(--space-s) var(--space-xs);
background: var(--color-surface);
border-right: 1px solid var(--color-divider);
}
.workspace {
padding-top: env(safe-area-inset-top, 0px);
}
.app-rail {
/* Below 900px the rail gives up width it does not need so the detail pane
keeps a readable measure at the 600px switch. */
flex-basis: 168px;
width: 168px;
}
.pane-layout {
/* A grid track is sized from its MAX before the free track is resolved, so
minmax(200px, 360px) beside 1fr took 360px and clipped the detail to 40px
at 600px. Cap the list where the workspace is narrow; widen it only when
there is room for both. */
grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
}
.list-pane { border-right: 1px solid var(--color-divider); }
.pane-back { display: none; }
.section-strip { display: none; }
.destination-dock { display: none; }
}
@media (min-width: 900px) {
.app-rail { flex-basis: var(--layout-rail); width: var(--layout-rail); }
.pane-layout {
grid-template-columns: minmax(220px, var(--layout-list-max)) minmax(0, 1fr);
}
}
/* ---- Narrow layout ------------------------------------------------------ */
@media (max-width: 599px) {
.pane-layout { position: relative; }
.pane-layout > .list-pane,
.pane-layout > .detail-pane {
grid-area: 1 / 1;
display: none;
}
.pane-layout[data-active-pane="list"] > .list-pane,
.pane-layout[data-active-pane="detail"] > .detail-pane {
display: flex;
}
.pane-back { display: block; }
.pane-head { padding: var(--space-xs) var(--space-s); }
.detail-pane > .pane-scroll > .detail { padding: var(--space-s); }
.settings-pane > .settings { padding: var(--space-s) var(--space-s) var(--space-l); }
}
+668 -217
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -122,11 +122,12 @@ function isProtocol(value) {
}
/**
* The header's compact connection state badge. It is the page's own indicator
* (Android renders the same facts in SettingsScreen.kt's connection card): the
* one job it does that ConnectionBanner.kt's banner text does not is name the
* retry attempt while disconnected, so "reason + retrying + attempt" are all
* visible at a glance. `tone` names the dot colour class (ok/warn/bad/idle).
* The compact connection state helper behind the shell's dot+word control and
* the Settings status card. It is the page's own indicator (Android renders the
* same facts in SettingsScreen.kt's connection card): the one job it does that
* ConnectionBanner.kt's banner text does not is name the retry attempt while
* disconnected, so "reason + retrying + attempt" are all visible at a glance.
* `tone` names the dot colour class (ok/warn/bad/idle).
*/
export function stateBadge(connection) {
const c = connection ?? {};
+13 -6
View File
@@ -1338,14 +1338,21 @@ export function mount(container, graph, options = {}) {
selectNode(key, { notify: false });
// The pane is still detached while the caller builds the detail, so reveal
// it on the next frame, once renderContent has put it in the document. The
// sticky top bar must stay clear of the pane head: scroll to the pane's top
// minus the bar's own measured height (CSS scroll-margin-top is the
// fallback for browsers that reveal it another way).
// detail's own `.pane-scroll` is the only scroller in the shell: move it,
// never the never-scrolling document.
const reveal = () => {
if (typeof pane.getBoundingClientRect !== "function") return;
const topbar = document.querySelector(".topbar");
const bar = topbar?.getBoundingClientRect?.().height ?? 0;
const top = pane.getBoundingClientRect().top + (window.scrollY ?? 0) - bar - 12;
const scroller = pane.closest(".pane-scroll");
if (scroller) {
const top =
pane.getBoundingClientRect().top -
scroller.getBoundingClientRect().top +
scroller.scrollTop -
12;
scroller.scrollTop = Math.max(0, top);
return;
}
const top = pane.getBoundingClientRect().top + (window.scrollY ?? 0) - 12;
window.scrollTo?.({ top: Math.max(0, top), behavior: "instant" });
};
if (typeof requestAnimationFrame === "function") requestAnimationFrame(reveal);
+107
View File
@@ -0,0 +1,107 @@
// The persistent app shell's pure model (L2/L3/L4): the four destinations, the
// roving-tabindex arithmetic shared by the destination and section tablists, the
// compact connection word shown in the rail/dock, and the view -> destination
// mapping. Deliberately DOM-free, so every branch is unit-testable in Node.
//
// The rail is the wide presentation; the bottom dock is the narrow one. Both
// render the same DESTINATIONS model (roles: tablist + tab, aria-current on the
// route as well as aria-selected). Templates stays a route but not a
// destination: it is reached from Settings, the card that owns its entry point.
/** The four destinations, in Android's destination-bar order. */
export const DESTINATIONS = Object.freeze([
Object.freeze({ key: "pipelines", label: "Pipelines", path: "/pipelines", icon: "pipelines" }),
Object.freeze({ key: "runs", label: "Runs", path: "/runs", icon: "runs" }),
Object.freeze({ key: "chat", label: "Chat", path: "/chat", icon: "chat" }),
Object.freeze({ key: "settings", label: "Settings", path: "/settings", icon: "settings" }),
]);
/** The destination key that owns a view. Templates is reached from Settings. */
export function destinationForView(view) {
switch (view) {
case "runs":
return "runs";
case "chat":
return "chat";
case "settings":
case "templates":
return "settings";
default:
return "pipelines";
}
}
/** The index of a destination key in DESTINATIONS (0 for an unknown key). */
export function destinationIndex(key) {
const index = DESTINATIONS.findIndex((item) => item.key === key);
return index < 0 ? 0 : index;
}
/** Roving tabindex: the selected tab is the only stop in its tablist. */
export function rovingTabindex(selectedIndex, index) {
return selectedIndex === index ? "0" : "-1";
}
/**
* The next index after one of the roving-tablist keys, or -1 when the key is not
* one this tablist handles. ArrowLeft/ArrowRight always move (both tablists use
* a horizontal axis in the narrow strip); ArrowUp/ArrowDown are also accepted
* because the wide rail is vertical. Home/End jump to the ends. Movement wraps,
* as WAI-ARIA's tabs pattern recommends.
*/
export function tabIndexForKey(key, index, count, { vertical = false } = {}) {
if (!Number.isInteger(index) || !Number.isInteger(count) || count <= 0 || index < 0 || index >= count) {
return -1;
}
const last = count - 1;
switch (key) {
case "ArrowRight":
return index >= last ? 0 : index + 1;
case "ArrowLeft":
return index <= 0 ? last : index - 1;
case "ArrowDown":
return vertical ? (index >= last ? 0 : index + 1) : -1;
case "ArrowUp":
return vertical ? (index <= 0 ? last : index - 1) : -1;
case "Home":
return 0;
case "End":
return last;
default:
return -1;
}
}
/**
* The compact connection word for the shell status control. It deliberately does
* not repeat the banner's full sentence: the dot's tone carries the state and
* the word always names it, so colour is never the only signal. With no endpoint
* configured, the shell says exactly that instead of asking for a URL (Settings
* is the only place that asks).
*/
export function shellStatus(connection, { hasEndpoint = false } = {}) {
const c = connection ?? {};
switch (c.kind) {
case "connected":
return { text: "Connected", tone: "ok", state: "connected" };
case "connecting":
return { text: "Connecting\u2026", tone: "warn", state: "connecting" };
case "disconnected":
return { text: "Disconnected", tone: "bad", state: "disconnected" };
default:
return hasEndpoint
? { text: "Not connected", tone: "idle", state: "idle" }
: { text: "Not configured", tone: "idle", state: "unconfigured" };
}
}
/**
* The section tabs for the current detail. `tabs` is the model's own
* `{key,label}` list, `active` the selected key. No detail means no tablist.
*/
export function sectionModel(model) {
const tabs = Array.isArray(model?.tabs) ? model.tabs : [];
if (!tabs.length) return { tabs: [], active: -1 };
const active = Math.max(0, tabs.findIndex((tab) => tab.key === model.active));
return { tabs, active };
}
+22 -15
View File
@@ -43,7 +43,7 @@ export function createAttentionView(rt) {
/**
* The attention bell action, shown in the top bar on every view (R15). Its
* The attention bell action, shown in the Runs list heading (R15). Its
* accessible name comes from `attentionBadgeLabel`; the visible badge is drawn
* only when something genuinely needs the operator, and the count comes from the
* same pure model the sheet reads.
@@ -83,22 +83,29 @@ function attentionCount() {
* loads, without rebuilding the header and disturbing the URL field.
*/
function refreshAttentionBell() {
const button = document.querySelector("#attentionBell");
if (!button) return;
const count = attentionCount();
const label = attentionBadgeLabel(count);
button.setAttribute("aria-label", label);
button.title = label;
let badge = button.querySelector(".attention-badge");
if (count > 0) {
if (!badge) {
badge = h("span", { class: "attention-badge", "aria-hidden": "true" });
button.append(badge);
const button = document.querySelector("#attentionBell");
if (button) {
button.setAttribute("aria-label", label);
button.title = label;
let badge = button.querySelector(".attention-badge");
if (count > 0) {
if (!badge) {
badge = h("span", { class: "attention-badge", "aria-hidden": "true" });
button.append(badge);
}
badge.dataset.count = String(count);
badge.textContent = String(count);
} else if (badge) {
badge.remove();
}
badge.dataset.count = String(count);
badge.textContent = String(count);
} else if (badge) {
badge.remove();
}
// The Runs destination mirrors the same count, so an operator on any surface
// can see that something needs attention without first opening Runs.
for (const destinationBadge of document.querySelectorAll("[data-attention-badge]")) {
destinationBadge.hidden = count <= 0;
destinationBadge.textContent = count > 0 ? String(count) : "";
}
}
@@ -106,7 +113,7 @@ function refreshAttentionBell() {
/**
* The attention sheet: the ordered list from the pure `attentionEntries` model,
* opened from the bell in the top bar. It is a single managed dialog — Escape,
* opened from the bell in the Runs heading. It is a single managed dialog — Escape,
* a backdrop click and the Close button all close it — with the exact app
* wording: title `Needs you`, rows of status icon + the run label + the
* `{pipeline} · {detail}` line + a trailing `Dismiss`, and the empty state
+20 -6
View File
@@ -258,6 +258,7 @@ export function createChatView(rt) {
let chatClock = null;
let chatNow = Date.now();
const renderContent = (...args) => rt.renderContent(...args);
const focusDetailHeading = (...args) => rt.focusDetailHeading(...args);
const renderActionFailedDialog = (...args) => rt.views.dialogs.renderActionFailedDialog(...args);
/** Remember one conversation's scroll position (index of the first visible row). */
@@ -406,6 +407,7 @@ function startNewChat() {
state.chatCreate = newChatCreateState(newChatOperationId());
state.chatDirectoriesError = "";
renderContent();
focusDetailHeading();
loadChatDirectories();
}
@@ -504,6 +506,7 @@ async function openChatSession(id) {
error: "",
});
renderContent();
focusDetailHeading();
// Attach the shared live stream once per session per connection; its failure is
// non-fatal — history stays usable and the badge reads "not live".
subscribeChatSession(id);
@@ -511,6 +514,9 @@ async function openChatSession(id) {
// only after the next pushed shell frame.
loadChatShells(id);
await loadChatHistory(id);
// The history load repaints the pane; keep the row activation's focus contract
// true after it lands, not only for the loading paint.
focusDetailHeading();
}
/** Replace one conversation's fields, keeping every other field intact. */
@@ -1443,7 +1449,7 @@ function renderChatList() {
}),
);
list.append(toolbar);
const rows = h("div", { id: "chatRows", class: "chat-rows" });
const rows = h("div", { id: "chatRows", class: "chat-rows list-scroll" });
fillChatRows(rows);
list.append(rows);
return list;
@@ -1620,7 +1626,13 @@ function renderChatCreate() {
},
h("span", { class: "chat-create-back-glyph", "aria-hidden": "true", text: "←" }),
),
h("h2", { class: "chat-bar-title chat-create-title", text: CHAT_CREATE_TITLE }),
// The create pane is a chat detail too: its title is the route's h1.
h("h1", {
class: "chat-bar-title chat-create-title",
id: "detailTitle",
tabindex: "-1",
text: CHAT_CREATE_TITLE,
}),
);
pane.append(bar);
@@ -1799,14 +1811,16 @@ function renderChatConversation() {
const thread = state.chatThreads.get(state.chatActiveId) ?? null;
const title = effective ? sessionTitle(effective) : state.chatActiveId.slice(0, 18);
// The pending approval card (C10), derived from the stored frame plus the local
// answer. While it is actionable the top bar offers a jump control and the
// answer. While it is actionable the chat pane offers a jump control and the
// running indicator stands down (a turn blocked on a decision is not generating).
const approval = approvalCard(thread?.permission, thread?.permissionAnswer);
const awaiting = approval?.actionable === true;
const bar = h("div", { class: "chat-bar" });
const titles = h("div", { class: "chat-bar-titles" });
titles.append(h("h2", { class: "chat-bar-title", text: title }));
// The open conversation is the route's one h1; the list heading above becomes
// its h2 while the detail is open.
titles.append(h("h1", { class: "chat-bar-title", id: "detailTitle", tabindex: "-1", text: title }));
const meta = chatHeaderMeta({
model: session?.model,
tag: session?.tag,
@@ -2151,7 +2165,7 @@ function renderChatTranscript(
// deliberately unlike a message bubble (see ChatCommandNoticeItem).
for (const notice of notices) transcript.append(renderChatCommandNotice(sessionId, notice));
// The approval card is the transcript's last item (C10) — after the notices and
// after the running indicator when it is shown — so the top bar's jump control
// after the running indicator when it is shown — so the pane's jump control
// and a fresh card both land at the end.
if (approval) transcript.append(renderChatApproval(sessionId, approval));
wrap.append(transcript);
@@ -2173,7 +2187,7 @@ function renderChatTranscript(
return wrap;
}
/** The top bar's approval jump control (C10), naming the pending request. */
/** The chat pane's approval jump control (C10), naming the pending request. */
function approvalJumpButton() {
return h("button", {
class: "ghost chat-approval-jump",
+7 -19
View File
@@ -35,7 +35,7 @@ export function createPipelinesView(rt) {
function renderPipelineList() {
const list = h("div", { class: "list" });
list.append(renderPipelineControls());
const rows = h("div", { id: "pipelineRows" });
const rows = h("div", { id: "pipelineRows", class: "list-scroll" });
fillPipelineRows(rows);
list.append(rows);
return list;
@@ -259,7 +259,11 @@ function renderPipelineRow(pipeline, latestRuns, runsKnown, now) {
}
return h(
"button",
{ class: `row${state.selectedPipelineId === pipeline.id ? " selected" : ""}`, onclick: () => selectPipeline(pipeline) },
{
class: `row${state.selectedPipelineId === pipeline.id ? " selected" : ""}`,
"data-pipeline-id": String(pipeline.id),
onclick: () => selectPipeline(pipeline),
},
...children,
);
}
@@ -271,23 +275,7 @@ function renderPipelineDetail() {
pane.append(h("div", { class: "muted pad", text: "Select a pipeline." }));
return pane;
}
pane.append(h("h2", { text: d.name || `pipeline ${d.id}` }));
pane.append(
h(
"div",
{ class: "detail-tabs" },
...PIPELINE_DETAIL_TABS.map((tab) =>
h("button", {
class: `detail-tab${state.pipelineTab === tab.key ? " active" : ""}`,
text: tab.label,
onclick: () => {
state.pipelineTab = tab.key;
renderContent();
},
}),
),
),
);
pane.append(h("h1", { class: "detail-title", id: "detailTitle", tabindex: "-1", text: d.name || `pipeline ${d.id}` }));
if (state.pipelineTab === "graph") {
pane.append(h("p", { class: "graph-note muted", text: graphNote() }));
const stages = d.graph?.stages ?? [];
+8 -17
View File
@@ -123,24 +123,16 @@ function renderRunDetail(now = Date.now()) {
// the Android run detail does, so opening the run is enough — no tab hunt.
const decision = pendingDecision(d);
if (decision) pane.append(renderDecisionCard(decision));
pane.append(
h("h1", {
class: "run-detail-title",
id: "detailTitle",
tabindex: "-1",
text: runLabelFor(d),
}),
);
const actions = renderRunActions(d);
if (actions) pane.append(actions);
pane.append(
h(
"div",
{ class: "detail-tabs" },
...RENDERED_RUN_TABS.map((tab) =>
h("button", {
class: `detail-tab${state.runTab === tab.key ? " active" : ""}`,
text: tab.label,
onclick: () => {
state.runTab = tab.key;
renderContent();
},
}),
),
),
);
if (state.runTab === "graph") {
pane.append(renderRunGraphTab(d));
} else if (state.runTab === "input") {
@@ -702,7 +694,6 @@ function renderRunActions(d) {
function renderRunTitleRow(d) {
const row = h("div", { class: "run-title-row" });
row.append(h("h2", { class: "run-detail-title", text: runLabelFor(d) }));
if (state.renameValue == null) {
row.append(
h("button", {
+2 -1
View File
@@ -35,7 +35,7 @@ function renderRunList(now = Date.now()) {
const pane = h("div", { class: "list runs" });
pane.append(renderRunToolbar());
const scroll = h("div", { class: "run-scroll" });
const scroll = h("div", { class: "run-scroll list-scroll" });
if (state.loading && !state.runs.length) {
scroll.append(h("div", { class: "muted pad", text: "Loading…" }));
pane.append(scroll);
@@ -121,6 +121,7 @@ function renderRunRow(run, now) {
const identity = runIdentity(run.title, run.name);
const row = h("button", {
class: `row run-row${state.selectedRunId === run.id ? " selected" : ""}`,
"data-run-id": String(run.id),
onclick: () => selectRun(run.id),
});
+47 -4
View File
@@ -1,6 +1,6 @@
// Omni-search: the top-bar panel, kind/sort controls, rows and result routing.
// Debounce/staleness/ordering/empty-state decisions are pure in search.js; this
// module owns the DOM and the route hand-off.
// Omni-search: the shell's Search control, kind/sort controls, rows and result
// routing. Debounce/staleness/ordering/empty-state decisions are pure in
// search.js; this module owns the DOM and the route hand-off.
import { h } from "../dom.js";
import { describeError } from "../format.js";
@@ -28,6 +28,9 @@ export function createSearchView(rt) {
const { state, repo, searchHost } = rt;
let searchTimer = null;
let searchEdit = null;
// Where focus goes when the panel closes: the rail or dock Search control that
// opened it, so Escape/Close never drops the operator on <body>.
let searchTriggerId = null;
const renderHeader = (...args) => rt.renderHeader(...args);
const renderContent = (...args) => rt.renderContent(...args);
const selectPipeline = (...args) => rt.selectPipeline(...args);
@@ -40,6 +43,8 @@ export function createSearchView(rt) {
/** Open the search field and ask for focus; the current view is left alone. */
function openSearch() {
if (state.searchOpen) return;
const trigger = document.activeElement;
searchTriggerId = trigger && trigger.id ? trigger.id : null;
state.searchOpen = true;
state.searchError = "";
state.searchFocusPending = true;
@@ -68,6 +73,9 @@ function closeSearch() {
state.searchFocusPending = false;
renderHeader();
renderSearch();
const trigger = searchTriggerId ? document.getElementById(searchTriggerId) : null;
searchTriggerId = null;
if (trigger && trigger.getClientRects().length > 0) trigger.focus();
}
function cancelSearchDebounce() {
@@ -220,6 +228,35 @@ function renderSearch() {
);
sortSelect.value = state.searchSort;
const fieldRow = h(
"div",
{ class: "search-field-row" },
h("input", {
id: "searchInput",
class: "search-input",
type: "text",
placeholder: "Search pipelines, runs and artifacts",
value: state.searchQuery,
spellcheck: "false",
autocomplete: "off",
"aria-label": "Search",
oninput: (event) => onSearchInput(event.target.value),
onkeydown: (event) => {
if (event.key === "Enter") {
event.preventDefault();
sendSearchNow();
}
},
}),
h("button", {
id: "searchClose",
class: "ghost search-close",
type: "button",
text: "Close search",
onclick: () => closeSearch(),
}),
);
const controls = h(
"div",
{ class: "search-controls" },
@@ -241,7 +278,13 @@ function renderSearch() {
const area = h("div", { id: "searchResults", class: "search-results", "aria-live": "polite" });
fillSearchResults(area);
searchHost.replaceChildren(h("div", { id: "searchPanel", class: "search-panel" }, controls, area));
searchHost.replaceChildren(
h("div", { id: "searchPanel", class: "search-panel", role: "search", "aria-label": "Search" }, fieldRow, controls, area),
);
if (state.searchFocusPending) {
document.getElementById("searchInput")?.focus();
state.searchFocusPending = false;
}
}
/**
+10 -2
View File
@@ -26,7 +26,8 @@ import {
notificationEnvironment,
notificationPermissionState,
} from "../notify.js";
import { bannerState } from "../connection.js";
import { bannerState, protocolMismatch } from "../connection.js";
import { PROTOCOL_VERSION } from "../protocol.js";
export function createSettingsView(rt) {
const { state, repo, setServerUrlDraft, endpointConfigured } = rt;
@@ -48,6 +49,7 @@ export function createSettingsView(rt) {
function renderSettingsView() {
const pane = h("div", { class: "settings" });
pane.append(
h("h1", { class: "settings-page-title", id: "detailTitle", tabindex: "-1", text: "Settings" }),
renderSettingsConnection(),
renderSettingsWorkspace(),
renderSettingsNotifications(),
@@ -138,6 +140,12 @@ function renderSettingsConnection() {
card.append(h("p", { class: "settings-status-line", text: line }));
});
section.append(card, renderTrustWarning());
const warning = protocolMismatch(PROTOCOL_VERSION, state.serverProtocol);
if (warning) {
section.append(
h("p", { class: "settings-warning-line settings-protocol-warning", role: "alert", text: warning }),
);
}
return section;
}
@@ -223,7 +231,7 @@ function renderTrustWarning() {
/**
* Route a Settings connection control through the page's existing single client,
* mirroring AppViewModel: Disconnect closes the shared socket, Connect is
* connect-only (validate + persist + open — never the header's toggle), and
* connect-only (validate + persist + open — never a toggle), and
* Reconnect re-opens the same validated endpoint now. Nothing here opens a second
* connection.
*/
+5 -30
View File
@@ -27,6 +27,7 @@ import {
export function createTemplatesView(rt) {
const { state, repo } = rt;
const renderContent = (...args) => rt.renderContent(...args);
const focusDetailHeading = (...args) => rt.focusDetailHeading(...args);
const pushRoute = (...args) => rt.pushRoute(...args);
const setError = (...args) => rt.setError(...args);
const refreshPipelines = (...args) => rt.views.pipelines.refreshPipelines(...args);
@@ -60,14 +61,6 @@ function templateGraphFor(key) {
function renderTemplateGallery() {
const pane = h("div", { class: "list gallery" });
pane.append(
h(
"div",
{ class: "pane-head" },
h("h2", { text: "Templates" }),
h("button", { class: "ghost", text: "Refresh templates", onclick: () => loadTemplates(true) }),
),
);
if (state.templateLoading && !state.templates.length) {
pane.append(h("div", { class: "muted pad", text: "Loading templates…" }));
return pane;
@@ -76,7 +69,7 @@ function renderTemplateGallery() {
pane.append(h("div", { class: "muted pad", text: "No templates are available on this server." }));
return pane;
}
const cards = h("div", { class: "cards" });
const cards = h("div", { class: "cards list-scroll" });
for (const entry of state.templates) {
const card = templateCard(entry, templateGraphFor(entry.key));
cards.append(
@@ -84,6 +77,7 @@ function renderTemplateGallery() {
"button",
{
class: `card${state.selectedTemplateKey === entry.key ? " selected" : ""}`,
"data-template-key": entry.key,
onclick: () => selectTemplate(entry.key),
},
h("span", { class: "card-name", text: templateGalleryName(card.name) }),
@@ -105,15 +99,7 @@ function renderTemplateDetail() {
}
const graph = templateGraphFor(entry.key);
pane.append(renderTemplateDetailActions());
pane.append(
h(
"div",
{ class: "tabstrip" },
templateTabButton("summary", "Summary"),
templateTabButton("graph", "Graph"),
templateTabButton("source", "Source"),
),
);
pane.append(h("h1", { class: "detail-title", id: "detailTitle", tabindex: "-1", text: templateDetailName(entry) }));
if (state.templateTab === "graph") pane.append(renderTemplateGraphTab(graph));
else if (state.templateTab === "source") pane.append(renderTemplateSourceTab(entry, graph));
else pane.append(renderTemplateSummaryTab(entry, graph));
@@ -287,20 +273,8 @@ async function createFromTemplate(entry) {
renderContent();
}
function templateTabButton(tab, label) {
return h("button", {
class: `minitab${state.templateTab === tab ? " active" : ""}`,
text: label,
onclick: () => {
state.templateTab = tab;
renderContent();
},
});
}
function renderTemplateSummaryTab(entry, graph) {
const wrap = h("div", { class: "tabbody" });
wrap.append(h("h2", { text: templateDetailName(entry) }));
if ((entry.description ?? "").trim()) {
wrap.append(h("p", { class: "body", text: entry.description }));
}
@@ -392,6 +366,7 @@ function selectTemplate(key) {
state.selectedTemplateKey = key || null;
resetTemplateCreateState();
renderContent();
if (key) focusDetailHeading();
}
return {
+9
View File
@@ -186,6 +186,15 @@ export async function launchChrome({ width = 1440, height = 900, chromePath } =
const api = {
targetId,
/** Resize the emulated viewport at the driver's fixed device scale. */
async resize(width, height) {
await session("Emulation.setDeviceMetricsOverride", {
width,
height,
deviceScaleFactor: 1,
mobile: false,
});
},
async evaluate(expression) {
const result = await session("Runtime.evaluate", {
expression,
+96
View File
@@ -0,0 +1,96 @@
import test from "node:test";
import assert from "node:assert/strict";
import {
DESTINATIONS,
destinationForView,
destinationIndex,
rovingTabindex,
sectionModel,
shellStatus,
tabIndexForKey,
} from "../src/shell.js";
test("the shell has exactly four destinations in order", () => {
assert.deepEqual(
DESTINATIONS.map((item) => item.key),
["pipelines", "runs", "chat", "settings"],
);
for (const item of DESTINATIONS) {
assert.equal(typeof item.label, "string");
assert.ok(item.label.length > 0);
assert.equal(item.path, `/${item.key}`);
}
});
test("views map onto the destination that owns them", () => {
assert.equal(destinationForView("pipelines"), "pipelines");
assert.equal(destinationForView("runs"), "runs");
assert.equal(destinationForView("chat"), "chat");
assert.equal(destinationForView("settings"), "settings");
// Templates is reached from Settings; it is a route but not a destination.
assert.equal(destinationForView("templates"), "settings");
assert.equal(destinationIndex("chat"), 2);
assert.equal(destinationIndex("missing"), 0);
});
test("roving tabindex keeps exactly one tab in the tab order", () => {
assert.equal(rovingTabindex(0, 0), "0");
assert.equal(rovingTabindex(0, 1), "-1");
assert.deepEqual(
[0, 1, 2, 3].map((index) => rovingTabindex(2, index)),
["-1", "-1", "0", "-1"],
);
});
test("tab keys move, wrap and jump to the ends", () => {
assert.equal(tabIndexForKey("ArrowRight", 0, 4), 1);
assert.equal(tabIndexForKey("ArrowRight", 3, 4), 0);
assert.equal(tabIndexForKey("ArrowLeft", 0, 4), 3);
assert.equal(tabIndexForKey("ArrowLeft", 2, 4), 1);
assert.equal(tabIndexForKey("Home", 2, 4), 0);
assert.equal(tabIndexForKey("End", 2, 4), 3);
// Vertical tablists accept Up/Down as well; horizontal ones ignore them.
assert.equal(tabIndexForKey("ArrowDown", 1, 4, { vertical: true }), 2);
assert.equal(tabIndexForKey("ArrowUp", 0, 4, { vertical: true }), 3);
assert.equal(tabIndexForKey("ArrowDown", 1, 4), -1);
assert.equal(tabIndexForKey("Enter", 1, 4), -1);
// A non-key or an impossible list never moves focus.
assert.equal(tabIndexForKey("ArrowRight", 0, 0), -1);
assert.equal(tabIndexForKey("ArrowRight", -1, 4), -1);
});
test("the shell status names every connection state without colour", () => {
assert.deepEqual(shellStatus({ kind: "connected" }), {
text: "Connected",
tone: "ok",
state: "connected",
});
assert.equal(shellStatus({ kind: "connecting", attempt: 2 }).text, "Connecting\u2026");
assert.equal(shellStatus({ kind: "disconnected", reason: "closed" }).text, "Disconnected");
assert.deepEqual(shellStatus({ kind: "idle" }, { hasEndpoint: true }), {
text: "Not connected",
tone: "idle",
state: "idle",
});
assert.deepEqual(shellStatus({ kind: "idle" }, { hasEndpoint: false }), {
text: "Not configured",
tone: "idle",
state: "unconfigured",
});
});
test("sectionModel keeps one active tab and no tablist without a detail", () => {
const model = {
tabs: [
{ key: "summary", label: "Summary" },
{ key: "graph", label: "Graph" },
],
active: "graph",
};
assert.deepEqual(sectionModel(model), { tabs: model.tabs, active: 1 });
assert.deepEqual(sectionModel({ tabs: [], active: "summary" }), { tabs: [], active: -1 });
assert.deepEqual(sectionModel({ tabs: model.tabs, active: "missing" }), {
tabs: model.tabs,
active: 0,
});
});
+781 -275
View File
File diff suppressed because it is too large Load Diff