web: unify mobile back and audit controls and link pipeline run history
This commit is contained in:
@@ -3,11 +3,13 @@ package server
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -30,13 +32,40 @@ func TestRunAdmissionBrowserLostResponse(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
items, _ := store.List(ctx)
|
items, _ := store.List(ctx)
|
||||||
|
// A second pipeline/run proves the Runs button applies a real filter, not
|
||||||
|
// merely navigation to a list that coincidentally has one row.
|
||||||
|
if _, err := store.Submit(ctx, "Other fixture", pipeline.Template([]string{"other"}, true)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
all, _ := store.List(ctx)
|
||||||
|
for _, item := range all {
|
||||||
|
if item.ID != items[0].ID {
|
||||||
|
definition, _ := store.Get(ctx, item.ID, 1)
|
||||||
|
if _, _, err := store.CreateRun(ctx, definition, "unrelated-fixture", t.TempDir(), false, nil, map[string]any{"prompt": "unrelated"}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
handler := Handler(ctx, store).(*runHandler)
|
handler := Handler(ctx, store).(*runHandler)
|
||||||
defer func() { cancel(); WaitRuns(handler) }()
|
defer func() { cancel(); WaitRuns(handler) }()
|
||||||
|
finish := make(chan struct{})
|
||||||
|
var once sync.Once
|
||||||
handler.runner.execute = func(ctx context.Context, _ stage.Definition, _ stage.Values) (stage.Result, error) {
|
handler.runner.execute = func(ctx context.Context, _ stage.Definition, _ stage.Values) (stage.Result, error) {
|
||||||
<-ctx.Done()
|
select {
|
||||||
return stage.Result{}, ctx.Err()
|
case <-ctx.Done():
|
||||||
|
return stage.Result{}, ctx.Err()
|
||||||
|
case <-finish:
|
||||||
|
return stage.Result{Outcome: "success", Output: stage.Values{"markdown": "# Scratch report\n\nVerified fixture output."}}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
srv := httptest.NewServer(handler)
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
if req.URL.Path == "/complete-fixture" && req.Method == http.MethodPost {
|
||||||
|
once.Do(func() { close(finish) })
|
||||||
|
w.WriteHeader(http.StatusNoContent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
handler.ServeHTTP(w, req)
|
||||||
|
}))
|
||||||
defer srv.Close()
|
defer srv.Close()
|
||||||
cmd := exec.CommandContext(ctx, "node", "../../web/test/run-admission-probe.mjs", strings.TrimPrefix(srv.URL, "http://"), fmt.Sprint(items[0].ID), t.TempDir())
|
cmd := exec.CommandContext(ctx, "node", "../../web/test/run-admission-probe.mjs", strings.TrimPrefix(srv.URL, "http://"), fmt.Sprint(items[0].ID), t.TempDir())
|
||||||
if output, err := cmd.CombinedOutput(); err != nil {
|
if output, err := cmd.CombinedOutput(); err != nil {
|
||||||
@@ -45,7 +74,13 @@ func TestRunAdmissionBrowserLostResponse(t *testing.T) {
|
|||||||
t.Log(string(output))
|
t.Log(string(output))
|
||||||
}
|
}
|
||||||
runs, err := store.ListRuns(ctx)
|
runs, err := store.ListRuns(ctx)
|
||||||
if err != nil || len(runs) != 1 {
|
count := 0
|
||||||
t.Fatalf("lost response duplicated run: %d %v", len(runs), err)
|
for _, run := range runs {
|
||||||
|
if run.PipelineID == items[0].ID {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil || count != 1 {
|
||||||
|
t.Fatalf("lost response duplicated run: %d %v", count, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func TestChatBrowserLifecycleAndModelDialog(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fake.models = []protocol.ChatModel{{ID: "model-a", Provider: "fixture", Name: "Model Alpha"}, {ID: "model-b", Provider: "fixture", Name: "Model Beta"}}
|
fake.models = []protocol.ChatModel{{ID: "model-a", Provider: "fixture", Name: "Model Alpha"}, {ID: "model-b", Provider: "fixture", Name: "Model Beta"}}
|
||||||
fake.messages = []protocol.ChatMessage{
|
fake.messages = []protocol.ChatMessage{
|
||||||
{ID: "msg_user", Role: protocol.ChatRoleUser, Parts: []protocol.ChatPart{{Type: "text", Text: "Scratch prompt"}}},
|
{ID: "msg_user", Role: protocol.ChatRoleUser, Parts: []protocol.ChatPart{{Type: "text", Text: strings.Repeat("Earlier scratch prompt line\n", 100)}}},
|
||||||
{ID: "msg_answer", Role: protocol.ChatRoleAssistant, Parts: []protocol.ChatPart{{Type: "reasoning", Text: "Controlled reasoning evidence"}, {Type: "text", Text: "Controlled answer"}}},
|
{ID: "msg_answer", Role: protocol.ChatRoleAssistant, Parts: []protocol.ChatPart{{Type: "reasoning", Text: "Controlled reasoning evidence"}, {Type: "text", Text: "Controlled answer"}}},
|
||||||
}
|
}
|
||||||
handler := HandlerWithOptions(ctx, Options{Chat: browserModelFixture{fake}}, store)
|
handler := HandlerWithOptions(ctx, Options{Chat: browserModelFixture{fake}}, store)
|
||||||
|
|||||||
+9
-7
@@ -1151,20 +1151,22 @@
|
|||||||
.chat-create-backend { padding: 6px 12px; border: 1px solid var(--border); color: var(--muted); }
|
.chat-create-backend { padding: 6px 12px; border: 1px solid var(--border); color: var(--muted); }
|
||||||
.chat-create-backend.selected { border-color: var(--accent); background: var(--tint-selected); color: var(--text); }
|
.chat-create-backend.selected { border-color: var(--accent); background: var(--tint-selected); color: var(--text); }
|
||||||
.chat-backend-logo {
|
.chat-backend-logo {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 54px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex: none;
|
flex: none;
|
||||||
margin-left: auto;
|
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
color: var(--muted);
|
color: var(--color-text);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.chat-backend-logo svg { width: 18px; height: 18px; display: block; }
|
.chat-backend-logo svg { width: 18px; height: 18px; display: block; }
|
||||||
.chat-backend-logo.chat-backend-opencode { color: var(--accent); }
|
.chat-backend-logo[data-activity="streaming"] { color: var(--accent); }
|
||||||
.chat-backend-logo.chat-backend-codex { color: #9ecb8f; }
|
.chat-backend-logo[data-activity="new"] { color: var(--ok); }
|
||||||
.chat-backend-logo.chat-backend-claude { color: #d8b46a; }
|
.chat-row .row-head { padding-right: 86px; }
|
||||||
.chat-backend-logo.chat-backend-pi { color: #c58fb0; }
|
|
||||||
.chat-backend-chip {
|
.chat-backend-chip {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
padding: 1px 6px;
|
padding: 1px 6px;
|
||||||
@@ -1194,5 +1196,5 @@
|
|||||||
.chat-send, .chat-stop, .chat-attach, .chat-model-button, .chat-model-option,
|
.chat-send, .chat-stop, .chat-attach, .chat-model-button, .chat-model-option,
|
||||||
.chat-new { min-height: 48px; }
|
.chat-new { min-height: 48px; }
|
||||||
.chat-row .chat-star, .chat-row .chat-menu-button { width: 48px; height: 48px; }
|
.chat-row .chat-star, .chat-row .chat-menu-button { width: 48px; height: 48px; }
|
||||||
.chat-row .row-head { padding-right: 54px; }
|
.chat-row .row-head { padding-right: 86px; }
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-4
@@ -608,7 +608,7 @@
|
|||||||
.audit-tab {
|
.audit-tab {
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: var(--radius-control);
|
border-radius: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font: inherit;
|
font: inherit;
|
||||||
@@ -620,23 +620,35 @@
|
|||||||
/* Match the app's other tab selection exactly: the panel surface and a bottom
|
/* Match the app's other tab selection exactly: the panel surface and a bottom
|
||||||
accent, never the rail's tinted left bar. */
|
accent, never the rail's tinted left bar. */
|
||||||
.audit-tab.active {
|
.audit-tab.active {
|
||||||
background: var(--color-bg);
|
background: transparent;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
font-weight: var(--weight-semibold);
|
font-weight: var(--weight-semibold);
|
||||||
box-shadow: inset 0 -2px 0 var(--color-accent);
|
box-shadow: inset 0 -2px 0 var(--color-accent);
|
||||||
}
|
}
|
||||||
.audit-body { min-height: 0; overflow: auto; padding: 16px 18px; }
|
.audit-body { min-height: 0; overflow: auto; padding: 16px 18px; }
|
||||||
|
.audit-back { display: none; }
|
||||||
.audit-doc { max-width: var(--layout-measure); }
|
.audit-doc { max-width: var(--layout-measure); }
|
||||||
.audit-definition { display: grid; gap: 6px; }
|
.audit-definition { display: grid; gap: 6px; }
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 599px) {
|
||||||
|
.audit-viewer { padding: 8px; }
|
||||||
|
.audit-panel { width: 100%; border-radius: 10px; max-height: calc(100svh - 16px); overflow: hidden; }
|
||||||
|
.audit-head { align-items: center; gap: 8px; padding: 4px 8px; }
|
||||||
|
.audit-back { display: inline-flex; }
|
||||||
|
.audit-head .audit-close { display: none; }
|
||||||
|
.audit-title { font-size: 18px; line-height: 24px; }
|
||||||
|
.audit-subtitle { margin-top: 2px; line-height: 18px; overflow-wrap: anywhere; }
|
||||||
|
.audit-body { padding: 12px; overscroll-behavior: contain; }
|
||||||
.audit-layout { grid-template-columns: 1fr; }
|
.audit-layout { grid-template-columns: 1fr; }
|
||||||
.audit-tabs {
|
.audit-tabs {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
padding: 0 4px;
|
||||||
|
gap: 0;
|
||||||
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
.audit-tab { white-space: nowrap; }
|
.audit-tab { min-height: 48px; padding: 0 12px; flex: 0 0 auto; white-space: nowrap; font-size: 14px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,21 @@
|
|||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
.run-toolbar .spacer { flex: 1; }
|
.run-toolbar .spacer { flex: 1; }
|
||||||
|
.run-toolbar .pipeline-filter-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--color-text);
|
||||||
|
padding: 4px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.pipeline-filter-chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
@media (max-width: 599px) {
|
||||||
|
.run-toolbar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
|
||||||
|
.run-toolbar .pipeline-filter-chip { max-width: 100%; min-height: 44px; }
|
||||||
|
}
|
||||||
.run-toolbar button.ghost { padding: 4px 10px; font-size: 12px; }
|
.run-toolbar button.ghost { padding: 4px 10px; font-size: 12px; }
|
||||||
.filter-btn.active { border-color: var(--accent); color: var(--accent); }
|
.filter-btn.active { border-color: var(--accent); color: var(--accent); }
|
||||||
|
|
||||||
|
|||||||
@@ -708,3 +708,24 @@ button.back-button:hover { background: var(--color-elevated); }
|
|||||||
.detail-head .back-button { display: none; }
|
.detail-head .back-button { display: none; }
|
||||||
.detail-head { padding-top: var(--space-s); }
|
.detail-head { padding-top: var(--space-s); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mobile Back is one quiet chevron with a consistent finger-sized target—not
|
||||||
|
a mixture of boxed arrows, text arrows and desktop-sized controls. */
|
||||||
|
@media (max-width: 599px) {
|
||||||
|
button.back-button {
|
||||||
|
display: inline-flex;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
min-width: 48px;
|
||||||
|
min-height: 48px;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: var(--radius-control);
|
||||||
|
}
|
||||||
|
button.back-button:active { background: var(--tint-selected); }
|
||||||
|
.back-button .back-chevron { width: 24px; height: 24px; }
|
||||||
|
.detail-head { min-height: 56px; gap: 8px; padding: 4px 12px; }
|
||||||
|
.stage-pane-bar { min-height: 56px; gap: 8px; padding: 4px 8px; }
|
||||||
|
.stage-pane-title { font-size: 18px; line-height: 24px; }
|
||||||
|
.stage-pane-body { padding: 12px; overscroll-behavior: contain; }
|
||||||
|
}
|
||||||
|
|||||||
+8
-1
@@ -1017,7 +1017,9 @@ function closeDetail(view) {
|
|||||||
restoreListFocus(restore);
|
restoreListFocus(restore);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const route = { kind: view };
|
const route = view === "runs" && state.runFilters.pipelineId != null
|
||||||
|
? { kind: "runs", pipelineId: state.runFilters.pipelineId }
|
||||||
|
: { kind: view };
|
||||||
pushRoute(route);
|
pushRoute(route);
|
||||||
applyRoute(route);
|
applyRoute(route);
|
||||||
restoreListFocus(restore);
|
restoreListFocus(restore);
|
||||||
@@ -1525,6 +1527,11 @@ async function applyRoute(route) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r.kind === "runs") {
|
if (r.kind === "runs") {
|
||||||
|
if (r.pipelineId != null) {
|
||||||
|
state.runFilters = { ...defaultRunFilters(), pipelineId: r.pipelineId };
|
||||||
|
} else {
|
||||||
|
state.runFilters = { ...state.runFilters, pipelineId: null };
|
||||||
|
}
|
||||||
state.selectedRunId = null;
|
state.selectedRunId = null;
|
||||||
state.runDetail = null;
|
state.runDetail = null;
|
||||||
state.runStagePane = null;
|
state.runStagePane = null;
|
||||||
|
|||||||
+5
-2
@@ -137,7 +137,10 @@ export function parseRoute(pathname, search = "") {
|
|||||||
if (rest.length) return { ...DEFAULT_ROUTE };
|
if (rest.length) return { ...DEFAULT_ROUTE };
|
||||||
|
|
||||||
if (head === "pipelines" && second == null) return { kind: "pipelines" };
|
if (head === "pipelines" && second == null) return { kind: "pipelines" };
|
||||||
if (head === "runs" && second == null) return { kind: "runs" };
|
if (head === "runs" && second == null) {
|
||||||
|
const pipelineId = parseId(params?.get("pipeline") ?? "");
|
||||||
|
return pipelineId == null ? { kind: "runs" } : { kind: "runs", pipelineId };
|
||||||
|
}
|
||||||
if (head === "chat") {
|
if (head === "chat") {
|
||||||
if (second == null) return { kind: "chat" };
|
if (second == null) return { kind: "chat" };
|
||||||
if (third == null) {
|
if (third == null) {
|
||||||
@@ -241,7 +244,7 @@ export function serializeRoute(route) {
|
|||||||
case "pipelines":
|
case "pipelines":
|
||||||
return "/pipelines";
|
return "/pipelines";
|
||||||
case "runs":
|
case "runs":
|
||||||
return "/runs";
|
return parseId(String(r.pipelineId ?? "")) == null ? "/runs" : `/runs?pipeline=${r.pipelineId}`;
|
||||||
case "chat":
|
case "chat":
|
||||||
return "/chat";
|
return "/chat";
|
||||||
case "chatSession": {
|
case "chatSession": {
|
||||||
|
|||||||
+25
-5
@@ -779,6 +779,7 @@ function onChatEvent(frame) {
|
|||||||
const wasQueued = thread.queued === true;
|
const wasQueued = thread.queued === true;
|
||||||
const next = applyChatEvent(thread, frame, Date.now());
|
const next = applyChatEvent(thread, frame, Date.now());
|
||||||
state.chatThreads.set(sessionId, next);
|
state.chatThreads.set(sessionId, next);
|
||||||
|
refreshChatRowActivity(sessionId, next);
|
||||||
if (state.view === "chat" && sessionId === state.chatActiveId) {
|
if (state.view === "chat" && sessionId === state.chatActiveId) {
|
||||||
// The composer's Stop lives outside the transcript. A step frame changes
|
// The composer's Stop lives outside the transcript. A step frame changes
|
||||||
// running here, so update the mounted primary control now; the transcript-only
|
// running here, so update the mounted primary control now; the transcript-only
|
||||||
@@ -1637,6 +1638,11 @@ async function sendChatPrompt(sessionId, session) {
|
|||||||
operation_id: operationId,
|
operation_id: operationId,
|
||||||
parts: [{ type: "text", text }, ...fileParts],
|
parts: [{ type: "text", text }, ...fileParts],
|
||||||
};
|
};
|
||||||
|
// Sending is an explicit request to see the new turn, even if the operator
|
||||||
|
// had scrolled up to read earlier history. Later manual scrolling still wins.
|
||||||
|
state.chatFollowing = true;
|
||||||
|
state.chatAnchor = null;
|
||||||
|
state.chatPending = null;
|
||||||
setThread(sessionId, {
|
setThread(sessionId, {
|
||||||
draft: "",
|
draft: "",
|
||||||
attachments: [],
|
attachments: [],
|
||||||
@@ -2077,10 +2083,9 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
|
|||||||
});
|
});
|
||||||
const head = h("span", { class: "row-head" });
|
const head = h("span", { class: "row-head" });
|
||||||
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
|
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
|
||||||
head.append(chatBackendLogo(session.backend));
|
|
||||||
// Only the status word, coloured, with no dot and no operator chip. A closed
|
// Only the status word, coloured, with no dot and no operator chip. A closed
|
||||||
// session says so here instead of carrying a second chip.
|
// session says so here instead of carrying a second chip.
|
||||||
const statusWord = session.closed ? "Closed" : badge;
|
const statusWord = session.closed ? "Closed" : activity === "streaming" ? "" : badge;
|
||||||
const statusClass = session.closed ? "chat-activity-closed" : `chat-activity-${activity}`;
|
const statusClass = session.closed ? "chat-activity-closed" : `chat-activity-${activity}`;
|
||||||
if (statusWord) {
|
if (statusWord) {
|
||||||
head.append(h("span", { class: `chat-activity ${statusClass}`, text: statusWord }));
|
head.append(h("span", { class: `chat-activity ${statusClass}`, text: statusWord }));
|
||||||
@@ -2096,10 +2101,24 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
|
|||||||
if (model !== "") {
|
if (model !== "") {
|
||||||
sessionButton.append(h("span", { class: "row-meta chat-row-model muted", text: model }));
|
sessionButton.append(h("span", { class: "row-meta chat-row-model muted", text: model }));
|
||||||
}
|
}
|
||||||
row.append(sessionButton, renderChatActionsMenu(session, duplicateTitles));
|
row.append(sessionButton, chatBackendLogo(session.backend, activity), renderChatActionsMenu(session, duplicateTitles));
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Keep the fixed harness mark current without repainting the list or its rows. */
|
||||||
|
function refreshChatRowActivity(sessionId, thread) {
|
||||||
|
const row = document.querySelector(`#chatRows .chat-row[data-session="${CSS.escape(sessionId)}"]`);
|
||||||
|
const icon = row?.querySelector(".chat-backend-logo");
|
||||||
|
if (!icon) return;
|
||||||
|
const session = state.chatSessions.find((entry) => entry.id === sessionId);
|
||||||
|
const unseen = session && isChatSessionUnseen(session, { activeId: state.chatActiveId, seen: state.chatSeen, opened: true });
|
||||||
|
const activity = sessionActivity(thread?.running === true, unseen);
|
||||||
|
icon.dataset.activity = activity;
|
||||||
|
const label = chatBackendLabel(session?.backend || "opencode");
|
||||||
|
icon.setAttribute("aria-label", activity === "streaming" ? `${label} · Running` : label);
|
||||||
|
icon.title = activity === "streaming" ? `${label} · Running` : label;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The create pane (C2): the app's NewChatPane. A back control leaves without
|
* The create pane (C2): the app's NewChatPane. A back control leaves without
|
||||||
* creating, then the directory error / loading / picker states in the app's own
|
* creating, then the directory error / loading / picker states in the app's own
|
||||||
@@ -2107,13 +2126,14 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
|
|||||||
* server string is set with textContent.
|
* server string is set with textContent.
|
||||||
*/
|
*/
|
||||||
/** One agent's mark on the right of its chat row. */
|
/** One agent's mark on the right of its chat row. */
|
||||||
function chatBackendLogo(backend) {
|
function chatBackendLogo(backend, activity = "idle") {
|
||||||
const value = String(backend ?? "").trim().toLowerCase() || "opencode";
|
const value = String(backend ?? "").trim().toLowerCase() || "opencode";
|
||||||
const label = chatBackendLabel(value);
|
const label = chatBackendLabel(value);
|
||||||
const wrap = h("span", {
|
const wrap = h("span", {
|
||||||
class: `chat-backend-logo chat-backend-${value}`,
|
class: `chat-backend-logo chat-backend-${value}`,
|
||||||
title: label,
|
title: label,
|
||||||
"aria-label": label,
|
"aria-label": activity === "streaming" ? `${label} · Running` : label,
|
||||||
|
"data-activity": activity,
|
||||||
});
|
});
|
||||||
const NS = "http://www.w3.org/2000/svg";
|
const NS = "http://www.w3.org/2000/svg";
|
||||||
const svg = document.createElementNS(NS, "svg");
|
const svg = document.createElementNS(NS, "svg");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// the rendered/raw diff viewer, the artifact viewer, the human-decision sheet,
|
// the rendered/raw diff viewer, the artifact viewer, the human-decision sheet,
|
||||||
// the shared cancel/retry confirm and the shared Action-failed report.
|
// the shared cancel/retry confirm and the shared Action-failed report.
|
||||||
|
|
||||||
import { h, canCopyLink, canShare, copyArtifactLink, copyText, shareArtifact } from "../dom.js";
|
import { backChevronIcon, h, canCopyLink, canShare, copyArtifactLink, copyText, shareArtifact } from "../dom.js";
|
||||||
import { changeKindTone, describeError } from "../format.js";
|
import { changeKindTone, describeError } from "../format.js";
|
||||||
import {
|
import {
|
||||||
BINARY_DIFF_MESSAGE,
|
BINARY_DIFF_MESSAGE,
|
||||||
@@ -856,6 +856,7 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
|||||||
h(
|
h(
|
||||||
"div",
|
"div",
|
||||||
{ class: "audit-head" },
|
{ class: "audit-head" },
|
||||||
|
h("button", { class: "ghost back-button audit-back", type: "button", "aria-label": "Back to stage", title: "Back to stage", onclick: close }, backChevronIcon()),
|
||||||
h(
|
h(
|
||||||
"div",
|
"div",
|
||||||
{ class: "audit-titles" },
|
{ class: "audit-titles" },
|
||||||
@@ -868,7 +869,7 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
|||||||
const nav = h("nav", {
|
const nav = h("nav", {
|
||||||
class: "audit-tabs",
|
class: "audit-tabs",
|
||||||
role: "tablist",
|
role: "tablist",
|
||||||
"aria-orientation": "vertical",
|
"aria-orientation": window.matchMedia("(max-width: 599px)").matches ? "horizontal" : "vertical",
|
||||||
"aria-label": "Audit sections",
|
"aria-label": "Audit sections",
|
||||||
});
|
});
|
||||||
const body = h("div", {
|
const body = h("div", {
|
||||||
@@ -901,8 +902,8 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
|||||||
onkeydown: (event) => {
|
onkeydown: (event) => {
|
||||||
const index = available.findIndex((entry) => entry.key === tab.key);
|
const index = available.findIndex((entry) => entry.key === tab.key);
|
||||||
let next = -1;
|
let next = -1;
|
||||||
if (event.key === "ArrowDown") next = (index + 1) % available.length;
|
if (event.key === "ArrowDown" || event.key === "ArrowRight") next = (index + 1) % available.length;
|
||||||
else if (event.key === "ArrowUp") next = (index - 1 + available.length) % available.length;
|
else if (event.key === "ArrowUp" || event.key === "ArrowLeft") next = (index - 1 + available.length) % available.length;
|
||||||
else if (event.key === "Home") next = 0;
|
else if (event.key === "Home") next = 0;
|
||||||
else if (event.key === "End") next = available.length - 1;
|
else if (event.key === "End") next = available.length - 1;
|
||||||
if (next < 0) return;
|
if (next < 0) return;
|
||||||
|
|||||||
@@ -399,6 +399,7 @@ async function openRunDialog(pipeline) {
|
|||||||
start.prompt = start.intent.prompt;
|
start.prompt = start.intent.prompt;
|
||||||
start.workspace = start.intent.workspace;
|
start.workspace = start.intent.workspace;
|
||||||
start.notifyMode = start.intent.notifyMode;
|
start.notifyMode = start.intent.notifyMode;
|
||||||
|
start.outputFormat = start.intent.outputFormat ?? "";
|
||||||
start.error = "A previous launch has an unknown result. Check/retry reconciles that same request; it will not start a duplicate.";
|
start.error = "A previous launch has an unknown result. Check/retry reconciles that same request; it will not start a duplicate.";
|
||||||
}
|
}
|
||||||
state.runStart = start;
|
state.runStart = start;
|
||||||
@@ -549,7 +550,7 @@ function renderRunStartDialog() {
|
|||||||
|
|
||||||
const outputField = h("label", { class: "run-start-field", for: "runOutputFormat" });
|
const outputField = h("label", { class: "run-start-field", for: "runOutputFormat" });
|
||||||
outputField.append(h("span", { class: "run-start-label", text: "Report format" }));
|
outputField.append(h("span", { class: "run-start-label", text: "Report format" }));
|
||||||
const outputFormat = h("select", { id: "runOutputFormat", onchange: (event) => { start.outputFormat = event.target.value; } });
|
const outputFormat = h("select", { id: "runOutputFormat", disabled: start.intent != null, onchange: (event) => { start.outputFormat = event.target.value; } });
|
||||||
for (const [value, label] of [["", "No report requirement"], ["html", "HTML report"], ["markdown", "Markdown report"]]) {
|
for (const [value, label] of [["", "No report requirement"], ["html", "HTML report"], ["markdown", "Markdown report"]]) {
|
||||||
const option = h("option", { value, text: label });
|
const option = h("option", { value, text: label });
|
||||||
option.selected = start.outputFormat === value;
|
option.selected = start.outputFormat === value;
|
||||||
@@ -605,6 +606,18 @@ function renderPipelineDetail() {
|
|||||||
text: "Run",
|
text: "Run",
|
||||||
onclick: () => openRunDialog(d),
|
onclick: () => openRunDialog(d),
|
||||||
}),
|
}),
|
||||||
|
h("button", {
|
||||||
|
class: "pipeline-runs",
|
||||||
|
type: "button",
|
||||||
|
text: "Runs",
|
||||||
|
title: `View runs of ${d.name || "this pipeline"}`,
|
||||||
|
onclick: () => {
|
||||||
|
const route = { kind: "runs", pipelineId: d.id };
|
||||||
|
state.openMenu = null;
|
||||||
|
pushRoute(route);
|
||||||
|
applyRoute(route);
|
||||||
|
},
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// The Run dialog is an overlay; append it before the tab branches so Graph
|
// The Run dialog is an overlay; append it before the tab branches so Graph
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// the run's artifact gallery. Pure models live in runDetail.js, changes.js,
|
// the run's artifact gallery. Pure models live in runDetail.js, changes.js,
|
||||||
// artifacts.js and actions.js; dialogs are delegated to dialogs.js.
|
// artifacts.js and actions.js; dialogs are delegated to dialogs.js.
|
||||||
|
|
||||||
import { h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
import { backChevronIcon, h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||||
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
||||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||||
import { runStateOf, runStatusLabel } from "../runs.js";
|
import { runStateOf, runStatusLabel } from "../runs.js";
|
||||||
@@ -708,12 +708,12 @@ function renderStagePane(d) {
|
|||||||
"div",
|
"div",
|
||||||
{ class: "stage-pane-bar" },
|
{ class: "stage-pane-bar" },
|
||||||
h("button", {
|
h("button", {
|
||||||
class: "stage-pane-back",
|
class: "ghost back-button stage-pane-back",
|
||||||
type: "button",
|
type: "button",
|
||||||
"aria-label": "Back",
|
"aria-label": "Back to run",
|
||||||
text: "\u2190 Back",
|
title: "Back to run",
|
||||||
onclick: closeStagePane,
|
onclick: closeStagePane,
|
||||||
}),
|
}, backChevronIcon()),
|
||||||
h(
|
h(
|
||||||
"div",
|
"div",
|
||||||
{ class: "stage-pane-titles" },
|
{ class: "stage-pane-titles" },
|
||||||
|
|||||||
@@ -200,6 +200,19 @@ function renderRunToolbar() {
|
|||||||
h("span", { class: "spacer" }),
|
h("span", { class: "spacer" }),
|
||||||
renderAttentionBell(),
|
renderAttentionBell(),
|
||||||
);
|
);
|
||||||
|
const pipelineId = state.runFilters.pipelineId;
|
||||||
|
if (pipelineId != null) {
|
||||||
|
const name = state.pipelines.find((pipeline) => pipeline.id === pipelineId)?.name ??
|
||||||
|
state.runs.find((run) => run.pipeline_id === pipelineId)?.name ?? `Pipeline ${pipelineId}`;
|
||||||
|
const chip = h("button", {
|
||||||
|
class: "pipeline-filter-chip",
|
||||||
|
type: "button",
|
||||||
|
"aria-label": `Clear pipeline filter: ${name}`,
|
||||||
|
title: `Showing only ${name}`,
|
||||||
|
onclick: () => setPipelineFilter(null),
|
||||||
|
}, h("span", { text: name }), h("span", { "aria-hidden": "true", text: "×" }));
|
||||||
|
toolbar.insertBefore(chip, toolbar.querySelector(".spacer"));
|
||||||
|
}
|
||||||
return toolbar;
|
return toolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,6 +315,7 @@ function toggleStatusFilter(status) {
|
|||||||
|
|
||||||
function setPipelineFilter(pipelineId) {
|
function setPipelineFilter(pipelineId) {
|
||||||
state.runFilters = { ...state.runFilters, pipelineId };
|
state.runFilters = { ...state.runFilters, pipelineId };
|
||||||
|
if (state.selectedRunId == null) rt.pushRoute(pipelineId == null ? { kind: "runs" } : { kind: "runs", pipelineId });
|
||||||
closeMenu();
|
closeMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,6 +326,7 @@ function setTimeRangeFilter(timeRange) {
|
|||||||
|
|
||||||
function clearRunFilters() {
|
function clearRunFilters() {
|
||||||
state.runFilters = defaultRunFilters();
|
state.runFilters = defaultRunFilters();
|
||||||
|
if (state.selectedRunId == null) rt.pushRoute({ kind: "runs" });
|
||||||
closeMenu();
|
closeMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,8 +92,23 @@ try {
|
|||||||
await page.click(".chat-back");
|
await page.click(".chat-back");
|
||||||
await page.waitForSelector("#chatRows");
|
await page.waitForSelector("#chatRows");
|
||||||
assert.equal(await page.evaluate("document.querySelector('#chatRows').scrollTop"), scroll);
|
assert.equal(await page.evaluate("document.querySelector('#chatRows').scrollTop"), scroll);
|
||||||
|
// Activity changes color in place; it must not move the harness mark or add a
|
||||||
|
// Streaming label to the row.
|
||||||
|
const iconRect = await page.evaluate(`(() => { const icon=document.querySelector('#chatRows .chat-row[data-session="${sessionId}"] .chat-backend-logo'); window.__icon=icon; const r=icon.getBoundingClientRect(); return [r.x,r.y,r.width,r.height]; })()`);
|
||||||
|
await emit({ message_id:"msg_answer",kind:"step",step:{status:"started"} });
|
||||||
|
assert.equal(await page.evaluate("window.__icon.dataset.activity"), "streaming");
|
||||||
|
assert.equal(await page.evaluate("document.querySelectorAll('#chatRows .chat-activity-streaming').length"), 0);
|
||||||
|
assert.deepEqual(await page.evaluate("(() => { const r=window.__icon.getBoundingClientRect(); return [r.x,r.y,r.width,r.height]; })()"), iconRect);
|
||||||
|
await emit({ message_id:"msg_answer",kind:"step",step:{status:"ended"} });
|
||||||
|
await page.evaluate(`document.querySelector('#chatRows .chat-row[data-session="${sessionId}"] .chat-session-button').click()`);
|
||||||
|
await page.waitForSelector("#chatInput");
|
||||||
|
await page.waitForSelector("#chatTranscript");
|
||||||
|
await page.evaluate("(() => { const t=document.querySelector('#chatTranscript'); t.dispatchEvent(new WheelEvent('wheel',{deltaY:-240,bubbles:true})); t.scrollTop=0; t.dispatchEvent(new Event('scroll')); })()");
|
||||||
|
await page.fill("#chatInput", "New message must scroll into view");
|
||||||
|
await page.click("#chatSend");
|
||||||
|
await eventually(() => page.evaluate("(() => { const t=document.querySelector('#chatTranscript'); return t.textContent.includes('New message must scroll into view') && t.scrollHeight-t.scrollTop-t.clientHeight<3; })()"));
|
||||||
assert.deepEqual(await page.evaluate("window.__errors"), []);
|
assert.deepEqual(await page.evaluate("window.__errors"), []);
|
||||||
console.log("Model dialog focus, intermediate/terminal steps, keyboard composer identity/caret and Back scroll restoration passed.");
|
console.log("Model dialog, stable activity mark, keyboard/caret, Back restoration and send-to-bottom passed.");
|
||||||
} finally {
|
} finally {
|
||||||
await browser?.close();
|
await browser?.close();
|
||||||
serve.kill("SIGTERM");
|
serve.kill("SIGTERM");
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ import {
|
|||||||
|
|
||||||
const defaultRoute = () => ({ ...DEFAULT_ROUTE });
|
const defaultRoute = () => ({ ...DEFAULT_ROUTE });
|
||||||
|
|
||||||
|
test("pipeline-specific Runs links survive reload and ignore invalid filter ids", () => {
|
||||||
|
assert.deepEqual(parseRoute("/runs?pipeline=27"), { kind: "runs", pipelineId: 27 });
|
||||||
|
assert.equal(serializeRoute({ kind: "runs", pipelineId: 27 }), "/runs?pipeline=27");
|
||||||
|
assert.deepEqual(parseRoute("/runs?pipeline=bad"), { kind: "runs" });
|
||||||
|
assert.equal(serializeRoute({ kind: "runs", pipelineId: -1 }), "/runs");
|
||||||
|
});
|
||||||
|
|
||||||
test("default destination: empty, root, unknown and malformed paths", () => {
|
test("default destination: empty, root, unknown and malformed paths", () => {
|
||||||
for (const path of [
|
for (const path of [
|
||||||
undefined,
|
undefined,
|
||||||
|
|||||||
@@ -91,6 +91,43 @@ try {
|
|||||||
if (process.env.PIPELINES_CAPTURE_DIR) {
|
if (process.env.PIPELINES_CAPTURE_DIR) {
|
||||||
await page.screenshot(join(process.env.PIPELINES_CAPTURE_DIR, "single-admitted-run.png"));
|
await page.screenshot(join(process.env.PIPELINES_CAPTURE_DIR, "single-admitted-run.png"));
|
||||||
}
|
}
|
||||||
|
const runId = await page.evaluate("Number(location.pathname.split('/')[2])");
|
||||||
|
assert.equal((await fetch(`http://${target}/complete-fixture`, { method: "POST" })).status, 204);
|
||||||
|
await page.goto(`http://127.0.0.1:${port}/runs/${runId}/stage/work`);
|
||||||
|
await page.waitForSelector(".stage-pane-back");
|
||||||
|
const back = await page.evaluate("(() => { const b=document.querySelector('.stage-pane-back'); const r=b.getBoundingClientRect(); return {width:r.width,height:r.height,svg:!!b.querySelector('svg'),text:b.textContent}; })()");
|
||||||
|
assert.equal(Math.round(back.width), 48);
|
||||||
|
assert.equal(Math.round(back.height), 48);
|
||||||
|
assert.equal(back.svg, true);
|
||||||
|
assert.equal(back.text, "");
|
||||||
|
await page.click(".audit-open");
|
||||||
|
await page.waitForSelector(".audit-viewer");
|
||||||
|
for (const width of [390, 420]) {
|
||||||
|
await page.resize(width, 844);
|
||||||
|
await eventually(() => page.evaluate("document.querySelector('.audit-viewer').getAnimations({subtree:true}).every(a => a.playState !== 'running')"));
|
||||||
|
const measured = await page.evaluate("(() => { const v=document.querySelector('.audit-panel'); const tab=v.querySelector('.audit-tab.active'); const b=v.querySelector('.audit-back'); return {radius:getComputedStyle(tab).borderRadius,tabHeight:tab.getBoundingClientRect().height,backWidth:b.getBoundingClientRect().width,backHeight:b.getBoundingClientRect().height,panelWidth:v.getBoundingClientRect().width,pageWidth:document.documentElement.scrollWidth}; })()");
|
||||||
|
assert.equal(measured.radius, "0px");
|
||||||
|
assert.ok(Math.round(measured.tabHeight) >= 48);
|
||||||
|
assert.equal(Math.round(measured.backWidth), 48);
|
||||||
|
assert.equal(Math.round(measured.backHeight), 48);
|
||||||
|
assert.ok(measured.pageWidth <= width && measured.panelWidth <= width);
|
||||||
|
if (process.env.PIPELINES_CAPTURE_DIR) {
|
||||||
|
await eventually(() => page.evaluate("document.querySelector('.audit-viewer').getAnimations({subtree:true}).every(a => a.playState !== 'running')"));
|
||||||
|
await page.screenshot(join(process.env.PIPELINES_CAPTURE_DIR, `mobile-audit-${width}.png`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await page.click(".audit-back");
|
||||||
|
await page.click(".stage-pane-back");
|
||||||
|
await page.goto(pipeline);
|
||||||
|
await page.waitForSelector(".pipeline-runs");
|
||||||
|
await page.click(".pipeline-runs");
|
||||||
|
await eventually(() => page.evaluate(`location.pathname === '/runs' && location.search === '?pipeline=${pipelineId}'`));
|
||||||
|
await page.waitForSelector(".pipeline-filter-chip");
|
||||||
|
assert.equal(await page.evaluate("document.querySelectorAll('.list.runs .run-row').length"), 1);
|
||||||
|
await page.goto(`http://127.0.0.1:${port}/runs?pipeline=${pipelineId}`);
|
||||||
|
await page.waitForSelector(".pipeline-filter-chip");
|
||||||
|
assert.equal(await page.evaluate("document.querySelectorAll('.list.runs .run-row').length"), 1);
|
||||||
|
if (process.env.PIPELINES_CAPTURE_DIR) await page.screenshot(join(process.env.PIPELINES_CAPTURE_DIR, "pipeline-filtered-runs.png"));
|
||||||
console.log("Lost launch acknowledgement + reload reconciled to the single admitted run.");
|
console.log("Lost launch acknowledgement + reload reconciled to the single admitted run.");
|
||||||
} finally {
|
} finally {
|
||||||
await browser?.close();
|
await browser?.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user