web: run pipelines from the browser and quiet background chat
Add the Run pipeline dialog with prompt, server directory and a per-run notification choice; add --notify auto/on/off to run and retry; move the live tool call onto the tool-count line and tick the reasoning duration; stop chat frames from repainting a different screen.
This commit is contained in:
+22
-4
@@ -37,7 +37,7 @@ type options struct {
|
||||
harness string
|
||||
url, name, prompt, title, template, workspace, paths, key, opencode, model string
|
||||
retryMode, retryStage, retryInputFile string
|
||||
option, feedback, evidence, actor string
|
||||
option, feedback, evidence, actor, notifyMode string
|
||||
output string
|
||||
conflict string
|
||||
kind string
|
||||
@@ -146,6 +146,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
f.StringVar(&o.key, "request-key", "", "Idempotency key (default: generated unique key)")
|
||||
f.IntVar(&o.version, "version", 0, "Version to run (default: latest)")
|
||||
f.StringVar(&o.model, "model", "", "Override the model for every stage of this run (PROVIDER/MODEL)")
|
||||
f.StringVar(&o.notifyMode, "notify", "auto", "Notifications for this run: auto (pipeline), on, or off")
|
||||
o.stageModels = stageModelFlags{}
|
||||
f.Var(o.stageModels, "stage-model", "Override one stage's model; repeatable (STAGE=PROVIDER/MODEL); beats --model")
|
||||
f.BoolVar(&o.wait, "wait", false, "In JSON mode, wait for a terminal run state")
|
||||
@@ -165,6 +166,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
f.IntVar(&o.retryVisit, "visit", 0, "1-based occurrence of --stage in the recorded execution")
|
||||
f.IntVar(&o.version, "version", 0, "Explicit published version of the same pipeline (default: source version)")
|
||||
f.StringVar(&o.retryInputFile, "input-file", "", "JSON object merged into the selected stage input; '-' reads stdin")
|
||||
f.StringVar(&o.notifyMode, "notify", "auto", "Notifications for this retry: auto, on, or off")
|
||||
case "cancel", "draft-delete":
|
||||
f.BoolVar(&o.yes, "yes", false, "Confirm this action without an interactive prompt")
|
||||
case "retention":
|
||||
@@ -930,6 +932,14 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
if o.retryMode != "resume" && o.retryMode != "restart" {
|
||||
return fmt.Errorf("--mode must be resume or restart")
|
||||
}
|
||||
switch strings.ToLower(strings.TrimSpace(o.notifyMode)) {
|
||||
case "", "auto":
|
||||
o.notifyMode = "auto"
|
||||
case "on", "off":
|
||||
o.notifyMode = strings.ToLower(strings.TrimSpace(o.notifyMode))
|
||||
default:
|
||||
return fmt.Errorf("--notify must be auto, on or off")
|
||||
}
|
||||
if key == "" {
|
||||
key = fmt.Sprintf("retry-%d-%d", os.Getpid(), time.Now().UnixNano())
|
||||
}
|
||||
@@ -966,7 +976,7 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
if o.retryVisit < 0 {
|
||||
return fmt.Errorf("--visit must be positive")
|
||||
}
|
||||
r, err := call(protocol.Message{Type: typeName, RunID: id, RequestKey: key, RetryMode: o.retryMode, RetryStage: o.retryStage, RetryVisit: o.retryVisit, RetryVersion: o.version, RetryInput: retryInput})
|
||||
r, err := call(protocol.Message{Type: typeName, RunID: id, RequestKey: key, RetryMode: o.retryMode, RetryStage: o.retryStage, RetryVisit: o.retryVisit, RetryVersion: o.version, RetryInput: retryInput, NotifyMode: o.notifyMode})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1277,6 +1287,14 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
|
||||
return err
|
||||
}
|
||||
}
|
||||
switch strings.ToLower(strings.TrimSpace(o.notifyMode)) {
|
||||
case "", "auto":
|
||||
o.notifyMode = "auto"
|
||||
case "on", "off":
|
||||
o.notifyMode = strings.ToLower(strings.TrimSpace(o.notifyMode))
|
||||
default:
|
||||
return fmt.Errorf("--notify must be auto, on or off")
|
||||
}
|
||||
if o.yes && (o.name == "" || strings.TrimSpace(o.prompt) == "") {
|
||||
return fmt.Errorf("--yes requires a pipeline and nonempty prompt")
|
||||
}
|
||||
@@ -1291,7 +1309,7 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
|
||||
if o.wait || o.key != "" || o.version > 0 {
|
||||
return fmt.Errorf("--wait, --request-key and --version require --json")
|
||||
}
|
||||
_, err := tea.NewProgram(tui.NewRun(ctx, o.url, tui.RunOptions{Pipeline: o.name, Prompt: o.prompt, Title: o.title, Workspace: workspace, Yes: o.yes, AllowTools: o.allow, WritePaths: paths, Model: o.model, StageModels: o.stageModels}), tea.WithContext(ctx), tea.WithAltScreen()).Run()
|
||||
_, err := tea.NewProgram(tui.NewRun(ctx, o.url, tui.RunOptions{Pipeline: o.name, Prompt: o.prompt, Title: o.title, Workspace: workspace, Yes: o.yes, AllowTools: o.allow, WritePaths: paths, Model: o.model, StageModels: o.stageModels, NotifyMode: o.notifyMode}), tea.WithContext(ctx), tea.WithAltScreen()).Run()
|
||||
return err
|
||||
}
|
||||
if o.name == "" || strings.TrimSpace(o.prompt) == "" {
|
||||
@@ -1313,7 +1331,7 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
|
||||
if key == "" {
|
||||
key = fmt.Sprintf("cli-%d-%d", os.Getpid(), time.Now().UnixNano())
|
||||
}
|
||||
r, err := call(protocol.Message{Type: protocol.RunPipeline, PipelineID: p.ID, Version: version, RequestKey: key, Workspace: workspace, Title: o.title, Input: map[string]any{"prompt": o.prompt}, AllowTools: o.allow, WritePaths: paths, Model: o.model, StageModels: o.stageModels})
|
||||
r, err := call(protocol.Message{Type: protocol.RunPipeline, PipelineID: p.ID, Version: version, RequestKey: key, Workspace: workspace, Title: o.title, Input: map[string]any{"prompt": o.prompt}, AllowTools: o.allow, WritePaths: paths, Model: o.model, StageModels: o.stageModels, NotifyMode: o.notifyMode})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import (
|
||||
type RunOverrides struct {
|
||||
Model string
|
||||
StageModels map[string]string
|
||||
// NotifyMode is auto, on or off for this run. Empty means auto.
|
||||
NotifyMode string
|
||||
}
|
||||
|
||||
// CreateRun inserts a run and derives its title from the prompt. It is the entry
|
||||
@@ -61,15 +63,15 @@ func (s *Store) CreateRunTitled(ctx context.Context, d *protocol.PipelineDetail,
|
||||
defer s.mu.Unlock()
|
||||
var id, pid int64
|
||||
var version int
|
||||
var oldInput, oldWorkspace, oldPaths, oldModel, oldStageModels string
|
||||
var oldInput, oldWorkspace, oldPaths, oldModel, oldStageModels, oldNotify string
|
||||
var oldTools bool
|
||||
err = s.db.QueryRowContext(ctx, "SELECT id,pipeline_id,version,input_json,workspace,write_paths,allow_tools,model,stage_models FROM pipeline_runs WHERE request_key=?", key).Scan(&id, &pid, &version, &oldInput, &oldWorkspace, &oldPaths, &oldTools, &oldModel, &oldStageModels)
|
||||
err = s.db.QueryRowContext(ctx, "SELECT id,pipeline_id,version,input_json,workspace,write_paths,allow_tools,model,stage_models,notify_mode FROM pipeline_runs WHERE request_key=?", key).Scan(&id, &pid, &version, &oldInput, &oldWorkspace, &oldPaths, &oldTools, &oldModel, &oldStageModels, &oldNotify)
|
||||
if err == nil {
|
||||
var oldParent int64
|
||||
if err := s.db.QueryRowContext(ctx, "SELECT COALESCE((SELECT original_run_id FROM run_retries WHERE run_id=?),0)", id).Scan(&oldParent); err != nil {
|
||||
return 0, false, err
|
||||
}
|
||||
if pid != d.ID || version != d.Version || oldInput != string(encoded) || oldWorkspace != workspace || oldPaths != string(writes) || oldTools != tools || oldParent != parent || oldModel != overrides.Model || oldStageModels != string(encodedModels) {
|
||||
if pid != d.ID || version != d.Version || oldInput != string(encoded) || oldWorkspace != workspace || oldPaths != string(writes) || oldTools != tools || oldParent != parent || oldModel != overrides.Model || oldStageModels != string(encodedModels) || oldNotify != notifyMode(overrides.NotifyMode) {
|
||||
return 0, false, fmt.Errorf("request key already used for a different run")
|
||||
}
|
||||
return id, false, nil
|
||||
@@ -82,7 +84,7 @@ func (s *Store) CreateRunTitled(ctx context.Context, d *protocol.PipelineDetail,
|
||||
return 0, false, err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
result, err := tx.ExecContext(ctx, "INSERT INTO pipeline_runs(pipeline_id,version,request_key,workspace,allow_tools,write_paths,input_json,title,title_source,title_model,model,stage_models) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", d.ID, d.Version, key, workspace, tools, string(writes), string(encoded), title.Text, title.Source, title.Model, overrides.Model, string(encodedModels))
|
||||
result, err := tx.ExecContext(ctx, "INSERT INTO pipeline_runs(pipeline_id,version,request_key,workspace,allow_tools,write_paths,input_json,title,title_source,title_model,model,stage_models,notify_mode) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", d.ID, d.Version, key, workspace, tools, string(writes), string(encoded), title.Text, title.Source, title.Model, overrides.Model, string(encodedModels), notifyMode(overrides.NotifyMode))
|
||||
if err != nil {
|
||||
return 0, false, err
|
||||
}
|
||||
@@ -101,6 +103,26 @@ func (s *Store) CreateRunTitled(ctx context.Context, d *protocol.PipelineDetail,
|
||||
return id, true, nil
|
||||
}
|
||||
|
||||
func notifyMode(value string) string {
|
||||
switch strings.ToLower(strings.TrimSpace(value)) {
|
||||
case "on", "off":
|
||||
return strings.ToLower(strings.TrimSpace(value))
|
||||
default:
|
||||
return "auto"
|
||||
}
|
||||
}
|
||||
|
||||
// RunNotifyMode returns the stored per-run notification override (auto, on or
|
||||
// off). It lets a restarted server honor an existing run's silence.
|
||||
func (s *Store) RunNotifyMode(ctx context.Context, id int64) (string, error) {
|
||||
var mode string
|
||||
err := s.db.QueryRowContext(ctx, "SELECT notify_mode FROM pipeline_runs WHERE id=?", id).Scan(&mode)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return notifyMode(mode), nil
|
||||
}
|
||||
|
||||
// resolveRunTitle guarantees a stored run title is never empty: a title supplied
|
||||
// by the caller (a model generation) is kept verbatim, and an absent one is
|
||||
// derived from the prompt's first line. The fallback is server-owned and never
|
||||
|
||||
@@ -12,7 +12,7 @@ func (s *Store) initRuns() error {
|
||||
id INTEGER PRIMARY KEY, pipeline_id INTEGER NOT NULL, version INTEGER NOT NULL,
|
||||
request_key TEXT NOT NULL UNIQUE, workspace TEXT NOT NULL, allow_tools INTEGER NOT NULL,
|
||||
title TEXT NOT NULL DEFAULT '', title_source TEXT NOT NULL DEFAULT '', title_model TEXT NOT NULL DEFAULT '',
|
||||
model TEXT NOT NULL DEFAULT '', stage_models TEXT NOT NULL DEFAULT '{}',
|
||||
model TEXT NOT NULL DEFAULT '', stage_models TEXT NOT NULL DEFAULT '{}', notify_mode TEXT NOT NULL DEFAULT 'auto',
|
||||
write_paths TEXT NOT NULL, input_json TEXT NOT NULL, output_json TEXT NOT NULL DEFAULT '{}',
|
||||
status TEXT NOT NULL DEFAULT 'queued', outcome TEXT NOT NULL DEFAULT '', current_stage TEXT NOT NULL DEFAULT '',
|
||||
diagnostic TEXT NOT NULL DEFAULT '', created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, finished_at TEXT,
|
||||
@@ -62,6 +62,9 @@ CREATE TABLE IF NOT EXISTS retry_checkpoints (
|
||||
if err := s.migrateRunTitles(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.addColumnIfMissing("pipeline_runs", "notify_mode", "TEXT NOT NULL DEFAULT 'auto'"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.dropResourceSchema(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -153,6 +153,9 @@ type Message struct {
|
||||
// them; the same fields are echoed on the run record.
|
||||
Model string `json:"model,omitempty"`
|
||||
StageModels map[string]string `json:"stage_models,omitempty"`
|
||||
// NotifyMode is auto (definition), on (ensure run-level attention) or off
|
||||
// (silence this run). It is optional so older clients keep auto.
|
||||
NotifyMode string `json:"notify_mode,omitempty"`
|
||||
// Empty (or "resume") retries the failed visit; "restart" starts at the
|
||||
// entry stage. Older clients omit this field and retain resume behavior.
|
||||
RetryMode string `json:"retry_mode,omitempty"`
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func (r *runner) notifyStep(id int64, name, workspace string, policy *protocol.NotificationPolicy, step protocol.RunStep) {
|
||||
if policy == nil {
|
||||
if r.notifyMode(id) == "off" || policy == nil {
|
||||
return
|
||||
}
|
||||
event := "success"
|
||||
@@ -183,6 +183,40 @@ func (r *runner) attentionAlready(id int64, sequence int, event string) bool {
|
||||
return r.attentionSent[id][fmt.Sprintf("%d:%s", sequence, event)]
|
||||
}
|
||||
|
||||
func (r *runner) setNotifyMode(id int64, mode string) {
|
||||
mode = strings.ToLower(strings.TrimSpace(mode))
|
||||
if mode != "on" && mode != "off" {
|
||||
mode = "auto"
|
||||
}
|
||||
r.notifyMu.Lock()
|
||||
r.notifyModes[id] = mode
|
||||
r.notifyMu.Unlock()
|
||||
}
|
||||
|
||||
func (r *runner) notifyMode(id int64) string {
|
||||
r.notifyMu.Lock()
|
||||
mode := r.notifyModes[id]
|
||||
r.notifyMu.Unlock()
|
||||
if mode != "" {
|
||||
return mode
|
||||
}
|
||||
if r.store != nil {
|
||||
if stored, err := r.store.RunNotifyMode(r.ctx, id); err == nil && stored != "" {
|
||||
r.notifyMu.Lock()
|
||||
r.notifyModes[id] = stored
|
||||
r.notifyMu.Unlock()
|
||||
return stored
|
||||
}
|
||||
}
|
||||
return "auto"
|
||||
}
|
||||
|
||||
func (r *runner) forgetNotifyMode(id int64) {
|
||||
r.notifyMu.Lock()
|
||||
delete(r.notifyModes, id)
|
||||
r.notifyMu.Unlock()
|
||||
}
|
||||
|
||||
// forgetAttention drops a run's delivered-event set once it is terminal, so the
|
||||
// registry is bounded by the runs still in flight.
|
||||
func (r *runner) forgetAttention(id int64) {
|
||||
@@ -206,6 +240,9 @@ func runAttentionClick(id int64) string {
|
||||
// A run that needs nobody produces nothing, and a delivery failure is logged and
|
||||
// never fails the run: this is a best-effort alert, not persisted run evidence.
|
||||
func (r *runner) notifyRun(id int64, name, status string, sequence int, currentStage, diagnostic string) {
|
||||
if r.notifyMode(id) == "off" {
|
||||
return
|
||||
}
|
||||
event := runAttentionEvent(status)
|
||||
if event == "" {
|
||||
return
|
||||
|
||||
@@ -70,6 +70,10 @@ type runner struct {
|
||||
// default — so neither republishes the same genuine event.
|
||||
attentionMu sync.Mutex
|
||||
attentionSent map[int64]map[string]bool
|
||||
// notifyMu guards notifyModes: the per-run auto/on/off override recorded at
|
||||
// admission. It is separate from the stage's own notify policy.
|
||||
notifyMu sync.Mutex
|
||||
notifyModes map[int64]string
|
||||
}
|
||||
|
||||
func newRunner(ctx context.Context, s *pipeline.Store) (*runner, error) {
|
||||
@@ -97,7 +101,7 @@ func newRunner(ctx context.Context, s *pipeline.Store) (*runner, error) {
|
||||
return nil, err
|
||||
}
|
||||
root := filepath.Join(s.Directory(), "artifacts")
|
||||
return &runner{ctx: ctx, store: s, artifactsRoot: root, active: map[int64]activeRun{}, idents: map[int64]runIdentity{}, attentionSent: map[int64]map[string]bool{}, exportSession: stage.ExportSession}, nil
|
||||
return &runner{ctx: ctx, store: s, artifactsRoot: root, active: map[int64]activeRun{}, idents: map[int64]runIdentity{}, attentionSent: map[int64]map[string]bool{}, notifyModes: map[int64]string{}, exportSession: stage.ExportSession}, nil
|
||||
}
|
||||
|
||||
func (r *runner) start(request protocol.Message, retryOf ...int64) (*protocol.RunDetail, error) {
|
||||
@@ -263,10 +267,11 @@ func (r *runner) start(request protocol.Message, retryOf ...int64) (*protocol.Ru
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
id, created, err := r.store.CreateRunTitled(r.ctx, d, request.RequestKey, workspace, request.AllowTools, request.WritePaths, request.Input, pipeline.RunOverrides{Model: request.Model, StageModels: request.StageModels}, runTitle, retryOf...)
|
||||
id, created, err := r.store.CreateRunTitled(r.ctx, d, request.RequestKey, workspace, request.AllowTools, request.WritePaths, request.Input, pipeline.RunOverrides{Model: request.Model, StageModels: request.StageModels, NotifyMode: request.NotifyMode}, runTitle, retryOf...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.setNotifyMode(id, request.NotifyMode)
|
||||
// The run row now exists: read it once for its resolved identity (pipeline
|
||||
// id/name, the store-derived title, the pinned version), so the queued frame
|
||||
// and every later frame carry what a client needs to render a brand-new run
|
||||
@@ -658,7 +663,11 @@ func (r *runner) retry(request protocol.Message) (*protocol.RunDetail, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return r.start(protocol.Message{PipelineID: original.PipelineID, Version: version, RequestKey: request.RequestKey, RetryMode: mode, RetrySource: original.ID, RetryStage: request.RetryStage, RetryVisit: request.RetryVisit, RetryInput: request.RetryInput, Workspace: original.Workspace, Input: original.Input, AllowTools: original.AllowTools, WritePaths: original.WritePaths, Model: original.Model, StageModels: original.StageModels}, original.ID)
|
||||
notifyMode := request.NotifyMode
|
||||
if notifyMode == "" {
|
||||
notifyMode, _ = r.store.RunNotifyMode(r.ctx, original.ID)
|
||||
}
|
||||
return r.start(protocol.Message{PipelineID: original.PipelineID, Version: version, RequestKey: request.RequestKey, RetryMode: mode, RetrySource: original.ID, RetryStage: request.RetryStage, RetryVisit: request.RetryVisit, RetryInput: request.RetryInput, Workspace: original.Workspace, Input: original.Input, AllowTools: original.AllowTools, WritePaths: original.WritePaths, Model: original.Model, StageModels: original.StageModels, NotifyMode: notifyMode}, original.ID)
|
||||
}
|
||||
|
||||
func (r *runner) cancel(id int64) error {
|
||||
@@ -1272,6 +1281,7 @@ func (r *runner) finishRunState(id int64, name, workspace, status, outcome, diag
|
||||
r.notifyRun(id, name, status, sequence, currentStage, diagnostic)
|
||||
// The run is terminal: nothing more can notify for it.
|
||||
r.forgetAttention(id)
|
||||
r.forgetNotifyMode(id)
|
||||
}
|
||||
|
||||
// completedSteps counts the completed steps of a run detail; resume uses it to
|
||||
|
||||
@@ -17,6 +17,7 @@ type RunOptions struct {
|
||||
// through to the run request without adding a TUI picker (that is a follow-up).
|
||||
Model string
|
||||
StageModels map[string]string
|
||||
NotifyMode string
|
||||
}
|
||||
|
||||
func NewRun(ctx context.Context, url string, options RunOptions) Model {
|
||||
|
||||
@@ -147,7 +147,7 @@ func (m *Model) startSelectedRun() tea.Cmd {
|
||||
m.runCollapsed = nil
|
||||
m.runDetail = nil
|
||||
m.runTop = 0
|
||||
request := protocol.Message{Type: protocol.RunPipeline, PipelineID: m.detail.ID, Version: m.detail.Version, RequestKey: fmt.Sprintf("tui-%d", time.Now().UnixNano()), Title: m.cliOptions.Title, Input: initialRunInput(m.runTask), AllowTools: m.runHasMutationTools(), WritePaths: m.runPaths, Workspace: m.runWorkspace, Model: m.cliOptions.Model, StageModels: m.cliOptions.StageModels}
|
||||
request := protocol.Message{Type: protocol.RunPipeline, PipelineID: m.detail.ID, Version: m.detail.Version, RequestKey: fmt.Sprintf("tui-%d", time.Now().UnixNano()), Title: m.cliOptions.Title, Input: initialRunInput(m.runTask), AllowTools: m.runHasMutationTools(), WritePaths: m.runPaths, Workspace: m.runWorkspace, Model: m.cliOptions.Model, StageModels: m.cliOptions.StageModels, NotifyMode: m.cliOptions.NotifyMode}
|
||||
updated, cmd := m.runRequest(request)
|
||||
*m = updated.(Model)
|
||||
return cmd
|
||||
|
||||
@@ -165,6 +165,9 @@ to it, but the server never lists it and a reload drops it.
|
||||
| B2 | Pipeline list mini graph | `list_pipelines` (`shape`) | done — each summary now carries the current version's parsed graph as `shape`; the browser draws a label-free miniature from the real `layoutGraph` with terminal-free stage routes. The row shows the name, the shape and only `{N stages}`; the cryptic `id {n} · v{n} · …` line is gone. Verified at 390×844 against the live server: 9 rows, 9 miniatures, and the detail still owns the full Graph tab. Additive field; older clients ignore it. |
|
||||
| B3 | Equal phone dock cells | — | done — the narrow dock is a four-cell grid (one cell per destination plus Search) with a subgrid for the tablist, so every control has the same width and height. At 390×844 the measured widths are 92/92/92/92 and the row is 48px high. The phone shell uses `100svh` so a browser toolbar cannot hide the tab row while leaving only the Connected/Settings status row visible. |
|
||||
| B4 | Full-height pipeline Source | — | done — the Source block no longer caps itself at `60vh`; it is as tall as its content and the detail pane owns the scroll. Verified at 390×844: a 4386px definition sits in the full pane (656px viewport) and scrolls. |
|
||||
| B14 | Run a pipeline from the web | `run_pipeline` | done — the pipeline detail has a Run action that opens a dialog with the prompt, an absolute server working-directory field with recent-directory suggestions, and a per-run notification choice (pipeline default / notify / silent). The request carries `pipeline_id`, the pinned version, a fresh request key, `workspace`, `input.prompt` and `notify_mode` only when overriding. A live probe started a real run from the dialog with `notify_mode=off` and the server stored that mode; the run was canceled. |
|
||||
| B15 | Per-run notification override | `notify_mode` | done — `pipelines run --notify auto\|on\|off` (and the same option on retry) records the override with the run. Off suppresses both stage policies and run-level waiting/failed alerts; auto follows the definition; on keeps run-level attention. The mode is stored in `pipeline_runs`, reloaded after a restart, and inherited by a retry unless overridden. |
|
||||
| B16 | One live status line for tools | — | done — the current tool call now shares the `N tools called` line; the separate bottom per-tool line is gone and the lower indicator appears only while no tool is running. The live reasoning label's duration ticks every second without waiting for a frame. Chat frames for a background session no longer repaint a Runs/Pipelines screen: verified a synthetic stream while opening run 12's detail left the run screen interactive with no per-frame replacements. |
|
||||
| B13 | Codex chat backend | `chat_backends`, `chat_create.backend` | done — OpenCode stays the default. `chat_backends` lists `codex` when the Codex App Server control socket is present; New chat shows a harness choice, the selected backend is stored on the operator-session row and echoed on every session. The Codex adapter connects to the existing App Server over its Unix WebSocket, maps `thread/start`, `turn/start`, `thread/read`, item/tool events, `item/tool/requestUserInput` to the existing question card, and carries the native user-message id so optimistic and history turns reconcile. Verified live: created a Codex chat from the browser, sent a prompt, saw the streamed answer, read it back through `chat_messages`, and saw the Codex chip and title in the list. Claude is not advertised yet: its OAuth session is expired and the SDK/CLI sidecar is still to be built. |
|
||||
| B12 | One detail header, optimistic sends, thinking above the bubble | — | done — every non-chat detail (pipeline, run, template) now extracts its own `#detailTitle` into a shared `.detail-head` with the same 44px chevron Back control; on phones the button and title are vertically centred, and on wide screens the back control is hidden while the title stays in the header. Chat/create already use the same control. Sending now appends the operator's optimistic user turn immediately (using the native message id OpenCode persists), so the running placeholder cannot appear before their message. While a turn runs, Send stays present beside Stop; a follow-up is queued. The reasoning/thinking block moved outside and above the answer bubble, like the tool summary below it. |
|
||||
| B11 | Enter composes; live shell bars stay in place | — | done — Enter now inserts a newline (a real CDP Enter produced `first\n` and no prompt), while Ctrl/Cmd+Enter sends; a slash draft still runs its command on Enter. The chat star reserves a 26px corner in the row head, so it no longer covers Streaming/New/Idle. Background-shell frames patch the tasks bar in place instead of full-rendering the pane, keeping the composer mounted. The shell cache was bumped to v2 so an installed PWA picks up these client changes. |
|
||||
|
||||
@@ -965,3 +965,22 @@
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* The current tool call shares the count line. It is the one live element on
|
||||
that row, so tool handoffs do not add or remove a second status line. */
|
||||
.chat-tool-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
text-align: left;
|
||||
}
|
||||
.chat-tool-current {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--muted);
|
||||
font-weight: var(--weight-regular);
|
||||
}
|
||||
|
||||
@@ -671,3 +671,26 @@
|
||||
border-radius: var(--radius-card);
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
/* Run pipeline dialog: prompt, server working directory and per-run notify. */
|
||||
.pipeline-actions { display: flex; gap: 8px; margin: 2px 0 12px; }
|
||||
.run-start-dialog .confirm-panel {
|
||||
width: min(560px, calc(100vw - 32px));
|
||||
max-height: calc(100dvh - 32px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.run-start-field { display: grid; gap: 6px; margin-top: 12px; }
|
||||
.run-start-label { font-size: 12px; color: var(--color-muted); }
|
||||
.run-start-prompt {
|
||||
width: 100%;
|
||||
min-height: 120px;
|
||||
padding: 10px 12px;
|
||||
resize: vertical;
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-control);
|
||||
font: inherit;
|
||||
}
|
||||
.run-start-helper { font-size: 12px; }
|
||||
.run-start-error { margin-top: 8px; color: var(--color-bad); font-size: 12px; }
|
||||
|
||||
@@ -176,6 +176,9 @@ const state = {
|
||||
pipelineGraph: null,
|
||||
// Expanded by default; a collapse is remembered (graphPrefs.js).
|
||||
pipelineGraphExpanded: readGraphExpanded(),
|
||||
// The Run pipeline dialog: pipeline/version, prompt, working directory,
|
||||
// notification mode and its loading/error state.
|
||||
runStart: null,
|
||||
// Gallery or list for run artifacts; a per-operator choice (artifactViewPrefs.js).
|
||||
artifactView: readArtifactView(),
|
||||
// Starred chat sessions: filled from chat_sessions (server-shared).
|
||||
|
||||
@@ -46,6 +46,7 @@ export const Protocol = Object.freeze({
|
||||
// The run-level operator actions (R11–R14). Each replies with a `run` (or
|
||||
// `run_started` for retry) envelope carrying the updated run detail; mirrors
|
||||
// internal/protocol/runs.go and Message.kt.
|
||||
RUN_PIPELINE: "run_pipeline",
|
||||
CANCEL_RUN: "cancel_run",
|
||||
RETRY_RUN: "retry_run",
|
||||
DECIDE_RUN: "decide_run",
|
||||
|
||||
@@ -181,6 +181,29 @@ export class PipelinesRepository {
|
||||
}
|
||||
|
||||
/** Cancels a run; mirrors PipelinesRepository.cancelRun (exactly run_id). */
|
||||
/**
|
||||
* Starts a fresh run of one pipeline version. `notifyMode` is auto, on or off;
|
||||
* auto omits the field so the pipeline definition applies.
|
||||
*/
|
||||
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "" } = {}) {
|
||||
const request = {
|
||||
type: Protocol.RUN_PIPELINE,
|
||||
pipeline_id: Number(pipelineId),
|
||||
version: Number(version),
|
||||
request_key: newChatOperationId(),
|
||||
workspace: String(workspace ?? "").trim(),
|
||||
input: { prompt: String(prompt ?? "") },
|
||||
};
|
||||
if (String(title ?? "").trim() !== "") request.title = String(title).trim();
|
||||
const mode = String(notifyMode ?? "auto").trim().toLowerCase();
|
||||
if (mode === "on" || mode === "off") request.notify_mode = mode;
|
||||
const response = await this.#client.call(request);
|
||||
if (!response.run_detail) {
|
||||
throw new ProtocolError("The server returned no run detail.");
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
async cancelRun(id) {
|
||||
const response = await this.#client.call({ type: Protocol.CANCEL_RUN, run_id: id });
|
||||
if (!response.run_detail) {
|
||||
|
||||
+46
-49
@@ -685,6 +685,10 @@ let chatRenderMode = null;
|
||||
* scroller and leave the composer DOM untouched.
|
||||
*/
|
||||
function scheduleChatRender(mode = "full") {
|
||||
// A background chat must never repaint the screen the operator is using.
|
||||
// Folding its frames into state is enough; the chat list/detail paint when the
|
||||
// operator returns to Chat.
|
||||
if (state.view !== "chat") return;
|
||||
if (mode === "full" || chatRenderMode == null) chatRenderMode = mode === "full" ? "full" : chatRenderMode ?? "transcript";
|
||||
if (chatRenderScheduled) return;
|
||||
chatRenderScheduled = true;
|
||||
@@ -692,6 +696,7 @@ function scheduleChatRender(mode = "full") {
|
||||
chatRenderScheduled = false;
|
||||
const chosen = chatRenderMode;
|
||||
chatRenderMode = null;
|
||||
if (state.view !== "chat") return;
|
||||
if (chosen === "transcript" && refreshChatTranscript(state.chatActiveId)) return;
|
||||
renderContent();
|
||||
};
|
||||
@@ -768,7 +773,7 @@ function onChatEvent(frame) {
|
||||
const historySyncTimers = new Map();
|
||||
const historySyncedFor = new Map();
|
||||
function scheduleHistorySync(sessionId, messageId) {
|
||||
if (!messageId || sessionId !== state.chatActiveId) return;
|
||||
if (!messageId || state.view !== "chat" || sessionId !== state.chatActiveId) return;
|
||||
if (historySyncedFor.get(sessionId) === messageId) return;
|
||||
historySyncedFor.set(sessionId, messageId);
|
||||
if (historySyncTimers.has(sessionId)) return;
|
||||
@@ -812,7 +817,7 @@ function onChatPermission(frame) {
|
||||
next.permissionError = "";
|
||||
}
|
||||
state.chatThreads.set(sessionId, next);
|
||||
if (sessionId === state.chatActiveId) scheduleChatRender();
|
||||
if (state.view === "chat" && sessionId === state.chatActiveId) scheduleChatRender();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1331,7 +1336,7 @@ function onChatFrame(message) {
|
||||
const running = runningAfterFrame(thread.running, frame);
|
||||
if (queued === thread.queued && running === thread.running) return;
|
||||
setThread(sessionId, { queued, running });
|
||||
if (sessionId === state.chatActiveId) {
|
||||
if (state.view === "chat" && sessionId === state.chatActiveId) {
|
||||
refreshChatComposerState(sessionId);
|
||||
scheduleChatRender("transcript");
|
||||
}
|
||||
@@ -2539,13 +2544,15 @@ function renderChatTranscript(
|
||||
else {
|
||||
const streaming = running && index === lastAgent;
|
||||
const elapsed = (part) => threadToolElapsedMillis(thread, part, now);
|
||||
transcript.append(renderChatAgentTurn(row.turn, streaming, elapsed));
|
||||
transcript.append(renderChatAgentTurn(row.turn, streaming, elapsed, thread));
|
||||
}
|
||||
});
|
||||
// The running indicator sits under the transcript, after the last agent turn:
|
||||
// a spinner, the phase headline, the turn's elapsed, then one line per running
|
||||
// tool (a call over 60 s is tinted and marked `· long`).
|
||||
if (running && thread) transcript.append(renderChatRunningIndicator(thread, now));
|
||||
if (running && thread && threadRunningTools(thread.messages).length === 0) {
|
||||
transcript.append(renderChatRunningIndicator(thread, now));
|
||||
}
|
||||
// The conversation's local command lines sit after the turns, full width and
|
||||
// deliberately unlike a message bubble (see ChatCommandNoticeItem).
|
||||
for (const notice of notices) transcript.append(renderChatCommandNotice(sessionId, notice));
|
||||
@@ -2823,26 +2830,6 @@ function renderChatRunningIndicator(thread, now) {
|
||||
}),
|
||||
);
|
||||
wrap.append(head);
|
||||
// One stable detail line for the whole turn. Rendering one line per in-flight
|
||||
// tool made the transcript grow and shrink for every call, which bounced the
|
||||
// text (and the composer) while a turn streamed. The line updates in place to
|
||||
// the longest-running call; the tool chip in the turn still lists every call.
|
||||
const running = threadRunningTools(thread.messages);
|
||||
const chosen =
|
||||
running.find((part) => toolLongRunning(threadToolElapsedMillis(thread, part, now))) ??
|
||||
running[0] ??
|
||||
null;
|
||||
if (chosen) {
|
||||
wrap.append(renderChatRunningTool(thread, chosen, now));
|
||||
} else {
|
||||
wrap.append(
|
||||
h(
|
||||
"div",
|
||||
{ class: "chat-running-tool" },
|
||||
h("span", { class: "chat-running-tool-text", text: "Preparing the next step…" }),
|
||||
),
|
||||
);
|
||||
}
|
||||
return wrap;
|
||||
}
|
||||
|
||||
@@ -2885,14 +2872,14 @@ function renderChatUserMessage(message) {
|
||||
}
|
||||
|
||||
/** One folded agent reply, left-aligned: reasoning, tool-call chip, answer. */
|
||||
function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0) {
|
||||
function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0, thread = null) {
|
||||
const wrap = h("div", { class: "chat-turn chat-turn-agent" });
|
||||
const bubble = h("div", { class: "chat-bubble agent-bubble" });
|
||||
const steps = turn.reasoningSteps;
|
||||
// Thinking is evidence about the turn, not part of the answer bubble. Keep it
|
||||
// outside and above the message, the way the tool summary sits outside and
|
||||
// below it.
|
||||
if (steps.length > 0) wrap.append(renderChatReasoning(turn, streaming));
|
||||
if (steps.length > 0) wrap.append(renderChatReasoning(turn, streaming, thread));
|
||||
if (turn.answer.trim() !== "") bubble.append(renderMarkdown(turn.answer));
|
||||
if (bubble.childElementCount > 0) wrap.append(bubble);
|
||||
// The tool summary is a quiet line beside the message, not a highlighted chip
|
||||
@@ -2913,9 +2900,9 @@ function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0) {
|
||||
* `Reasoning · N steps`), a live one `Thinking…`/`Thinking · N steps`. Live
|
||||
* elapsed time is C5's; this renders the parts' own timing.
|
||||
*/
|
||||
function renderChatReasoning(turn, streaming = false) {
|
||||
function renderChatReasoning(turn, streaming = false, thread = null) {
|
||||
const expanded = state.chatReasoning.has(turn.key);
|
||||
const block = h("div", { class: "chat-reasoning" });
|
||||
const block = h("div", { class: `chat-reasoning${streaming ? " chat-reasoning-live" : ""}` });
|
||||
const toggle = h("button", {
|
||||
class: "chat-reasoning-toggle",
|
||||
type: "button",
|
||||
@@ -2930,11 +2917,16 @@ function renderChatReasoning(turn, streaming = false) {
|
||||
}),
|
||||
);
|
||||
const label = reasoningLabel(turn.reasoningSteps.length, streaming);
|
||||
const elapsedMillis = turnElapsedMillis(turn.parts);
|
||||
// A live turn has no completed timing envelope yet, so measure from the
|
||||
// thread's running clock; the one-second clock refreshes this label in place.
|
||||
const elapsedMillis = streaming
|
||||
? threadElapsedMillis(thread, Date.now())
|
||||
: turnElapsedMillis(turn.parts);
|
||||
const duration = elapsedMillis == null ? null : formatDuration(Math.trunc(elapsedMillis / 1000));
|
||||
toggle.append(
|
||||
h("span", {
|
||||
class: "chat-reasoning-label",
|
||||
"data-live-steps": streaming ? String(turn.reasoningSteps.length) : null,
|
||||
text: duration == null ? label : `${label} · ${duration}`,
|
||||
}),
|
||||
);
|
||||
@@ -2986,6 +2978,7 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
|
||||
"aria-expanded": "false",
|
||||
"aria-haspopup": "dialog",
|
||||
});
|
||||
const currentTool = running ? parts.filter((part) => toolRunning(part)).at(-1) ?? null : null;
|
||||
if (running) {
|
||||
chip.append(h("span", { class: "spinner chat-tool-spinner", "aria-hidden": "true" }));
|
||||
} else {
|
||||
@@ -2998,6 +2991,19 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
|
||||
);
|
||||
}
|
||||
chip.append(h("span", { class: "chat-tool-label", text: toolCallsLabel(count) }));
|
||||
// The live call lives on the same line as the count instead of in a second
|
||||
// status line below the transcript. The chip therefore updates in place while
|
||||
// the count and the rest of the row remain stable.
|
||||
if (currentTool) {
|
||||
const detail = toolDetail(currentTool);
|
||||
const name = toolLabel(currentTool);
|
||||
chip.append(
|
||||
h("span", {
|
||||
class: "chat-tool-current",
|
||||
text: detail == null ? name : `${name} ${detail}`,
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (long) chip.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
|
||||
chip.append(
|
||||
h("span", {
|
||||
@@ -3754,30 +3760,21 @@ function stopChatClock() {
|
||||
/** Refresh the running indicator in place from the thread's own state at [now]. */
|
||||
function updateChatIndicator(now) {
|
||||
const thread = state.chatActiveId ? state.chatThreads.get(state.chatActiveId) : null;
|
||||
if (!thread?.running) return;
|
||||
// The live reasoning label is a second continuous clock: "Thinking · N steps ·
|
||||
// 1m 2s" must keep counting even when no frame arrives.
|
||||
const liveReasoning = document.querySelector("#chatTranscript .chat-reasoning-live .chat-reasoning-label");
|
||||
if (liveReasoning) {
|
||||
const steps = Number(liveReasoning.dataset.liveSteps) || 0;
|
||||
const duration = formatDuration(Math.trunc(threadElapsedMillis(thread, now) / 1000));
|
||||
liveReasoning.textContent = `${reasoningLabel(steps, true)} · ${duration}`;
|
||||
}
|
||||
const el = document.getElementById("chatRunning");
|
||||
if (!thread?.running || !el) return;
|
||||
if (!el) return;
|
||||
const label = el.querySelector(".chat-running-label");
|
||||
if (label) label.textContent = turnPhaseLabel(threadPhase(thread, now) ?? TURN_PHASE_WAITING);
|
||||
const elapsed = el.querySelector(".chat-running-elapsed");
|
||||
if (elapsed) elapsed.textContent = `\u00b7 ${formatDuration(Math.trunc(threadElapsedMillis(thread, now) / 1000))}`;
|
||||
const running = threadRunningTools(thread.messages);
|
||||
const chosen =
|
||||
running.find((part) => toolLongRunning(threadToolElapsedMillis(thread, part, now))) ??
|
||||
running[0] ??
|
||||
null;
|
||||
const line = el.querySelector(".chat-running-tool");
|
||||
if (line) {
|
||||
const text = line.querySelector(".chat-running-tool-text");
|
||||
if (text && chosen) text.textContent = runningToolText(chosen);
|
||||
const age = chosen ? threadToolElapsedMillis(thread, chosen, now) : 0;
|
||||
const toolElapsed = line.querySelector(".chat-running-tool-elapsed");
|
||||
if (toolElapsed) toolElapsed.textContent = chosen ? formatToolDuration(age) : "";
|
||||
const mark = line.querySelector(".chat-tool-long");
|
||||
if (chosen && toolLongRunning(age) && !mark) {
|
||||
line.classList.add("chat-running-tool-long");
|
||||
line.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
+178
-1
@@ -29,10 +29,11 @@ import { statusIcon } from "../statusIcon.js";
|
||||
import { writeGraphExpanded } from "../graphPrefs.js";
|
||||
|
||||
export function createPipelinesView(rt) {
|
||||
const { state, repo } = rt;
|
||||
const { state, repo, modal } = rt;
|
||||
const renderContent = (...args) => rt.renderContent(...args);
|
||||
const selectPipeline = (...args) => rt.selectPipeline(...args);
|
||||
const pushRoute = (...args) => rt.pushRoute(...args);
|
||||
const applyRoute = (...args) => rt.applyRoute(...args);
|
||||
|
||||
|
||||
function renderPipelineList() {
|
||||
@@ -374,6 +375,171 @@ function pipelineGlyph() {
|
||||
return svg;
|
||||
}
|
||||
|
||||
/** Open the Run pipeline dialog for [pipeline]. */
|
||||
async function openRunDialog(pipeline) {
|
||||
const pipelineId = Number(pipeline?.id) || 0;
|
||||
if (pipelineId <= 0) return;
|
||||
const start = {
|
||||
pipelineId,
|
||||
version: Number(pipeline?.version) || Number(pipeline?.latest_version) || 0,
|
||||
name: String(pipeline?.name ?? ""),
|
||||
prompt: "",
|
||||
workspace: String(state.workspace ?? "").startsWith("/") ? state.workspace : "",
|
||||
notifyMode: "auto",
|
||||
directories: [],
|
||||
loading: true,
|
||||
sending: false,
|
||||
error: "",
|
||||
};
|
||||
state.runStart = start;
|
||||
renderContent();
|
||||
try {
|
||||
const directories = await repo.chatDirectories();
|
||||
start.directories = Array.isArray(directories)
|
||||
? directories.filter((entry) => typeof entry === "string" && entry.startsWith("/"))
|
||||
: [];
|
||||
} catch (error) {
|
||||
start.directories = [];
|
||||
start.error = describeError(error);
|
||||
}
|
||||
if (!start.workspace && start.directories.length) start.workspace = start.directories[0];
|
||||
start.loading = false;
|
||||
if (state.runStart === start) renderContent();
|
||||
}
|
||||
|
||||
function closeRunDialog() {
|
||||
state.runStart = null;
|
||||
renderContent();
|
||||
}
|
||||
|
||||
async function startRun() {
|
||||
const start = state.runStart;
|
||||
if (!start || start.sending) return;
|
||||
const prompt = start.prompt.trim();
|
||||
if (prompt === "") {
|
||||
start.error = "Enter a prompt for this run.";
|
||||
renderContent();
|
||||
return;
|
||||
}
|
||||
if (!start.workspace.startsWith("/")) {
|
||||
start.error = "Choose an absolute working directory on the server.";
|
||||
renderContent();
|
||||
return;
|
||||
}
|
||||
start.sending = true;
|
||||
start.error = "";
|
||||
renderContent();
|
||||
try {
|
||||
const run = await repo.runPipeline({
|
||||
pipelineId: start.pipelineId,
|
||||
version: start.version,
|
||||
prompt,
|
||||
workspace: start.workspace,
|
||||
notifyMode: start.notifyMode,
|
||||
title: "",
|
||||
});
|
||||
state.runStart = null;
|
||||
await applyRoute({ kind: "run", id: run.id });
|
||||
} catch (error) {
|
||||
if (state.runStart !== start) return;
|
||||
start.sending = false;
|
||||
start.error = describeError(error);
|
||||
renderContent();
|
||||
}
|
||||
}
|
||||
|
||||
function renderRunStartDialog() {
|
||||
const start = state.runStart;
|
||||
const overlay = h("div", {
|
||||
class: "confirm-dialog run-start-dialog",
|
||||
role: "dialog",
|
||||
"aria-modal": "true",
|
||||
"aria-label": `Run ${start.name || "pipeline"}`,
|
||||
});
|
||||
overlay.addEventListener("click", (event) => {
|
||||
if (event.target === overlay) closeRunDialog();
|
||||
});
|
||||
const panel = h("div", { class: "confirm-panel" });
|
||||
panel.append(h("h2", { class: "confirm-title", text: `Run ${start.name || "pipeline"}` }));
|
||||
|
||||
const promptField = h("label", { class: "run-start-field", for: "runPrompt" });
|
||||
promptField.append(h("span", { class: "run-start-label", text: "Prompt" }));
|
||||
const prompt = h("textarea", {
|
||||
id: "runPrompt",
|
||||
class: "run-start-prompt",
|
||||
rows: "5",
|
||||
placeholder: "What should this run do?",
|
||||
spellcheck: "false",
|
||||
oninput: (event) => { start.prompt = event.target.value; },
|
||||
});
|
||||
prompt.value = start.prompt;
|
||||
promptField.append(prompt);
|
||||
panel.append(promptField);
|
||||
|
||||
const listId = "runWorkspaceChoices";
|
||||
const datalist = h("datalist", { id: listId });
|
||||
for (const directory of start.directories) datalist.append(h("option", { value: directory }));
|
||||
const workField = h("label", { class: "run-start-field", for: "runWorkspace" });
|
||||
workField.append(h("span", { class: "run-start-label", text: "Working directory (on the server)" }));
|
||||
const work = h("input", {
|
||||
id: "runWorkspace",
|
||||
type: "text",
|
||||
list: listId,
|
||||
value: start.workspace,
|
||||
spellcheck: "false",
|
||||
autocomplete: "off",
|
||||
placeholder: "/absolute/path/on/the/server",
|
||||
oninput: (event) => { start.workspace = event.target.value; },
|
||||
});
|
||||
workField.append(work, datalist);
|
||||
workField.append(h("span", { class: "run-start-helper muted", text: "Choose a recent directory or type an absolute path." }));
|
||||
panel.append(workField);
|
||||
|
||||
const notifyField = h("label", { class: "run-start-field", for: "runNotify" });
|
||||
notifyField.append(h("span", { class: "run-start-label", text: "Notifications for this run" }));
|
||||
const notify = h("select", { id: "runNotify", onchange: (event) => { start.notifyMode = event.target.value; } });
|
||||
for (const [value, label] of [
|
||||
["auto", "Pipeline default"],
|
||||
["on", "Notify me"],
|
||||
["off", "Silent"],
|
||||
]) {
|
||||
const option = h("option", { value, text: label });
|
||||
option.selected = start.notifyMode === value;
|
||||
notify.append(option);
|
||||
}
|
||||
notifyField.append(notify);
|
||||
panel.append(notifyField);
|
||||
|
||||
if (start.loading) panel.append(h("div", { class: "run-start-helper muted", text: "Loading directories…" }));
|
||||
if (start.error) panel.append(h("div", { class: "run-start-error", role: "alert", text: start.error }));
|
||||
|
||||
const actions = h("div", { class: "confirm-actions" });
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "ghost run-start-cancel",
|
||||
type: "button",
|
||||
text: "Cancel",
|
||||
disabled: start.sending,
|
||||
onclick: closeRunDialog,
|
||||
}),
|
||||
h("button", {
|
||||
class: "primary run-start-confirm",
|
||||
type: "button",
|
||||
text: start.sending ? "Starting…" : "Run",
|
||||
disabled: start.sending,
|
||||
onclick: startRun,
|
||||
}),
|
||||
);
|
||||
panel.append(actions);
|
||||
overlay.append(panel);
|
||||
modal.stage("run-start", overlay, {
|
||||
onClose: closeRunDialog,
|
||||
triggerSelector: ".run-pipeline",
|
||||
fallbackSelectors: ["#detailTitle", "#pane-main"],
|
||||
});
|
||||
return overlay;
|
||||
}
|
||||
|
||||
function renderPipelineDetail() {
|
||||
const d = state.pipelineDetail;
|
||||
const pane = h("div", { class: "detail" });
|
||||
@@ -382,6 +548,16 @@ function renderPipelineDetail() {
|
||||
return pane;
|
||||
}
|
||||
pane.append(h("h1", { class: "detail-title", id: "detailTitle", tabindex: "-1", text: d.name || `pipeline ${d.id}` }));
|
||||
pane.append(
|
||||
h("div", { class: "pipeline-actions" },
|
||||
h("button", {
|
||||
class: "primary run-pipeline",
|
||||
type: "button",
|
||||
text: "Run",
|
||||
onclick: () => openRunDialog(d),
|
||||
}),
|
||||
),
|
||||
);
|
||||
if (state.pipelineTab === "graph") {
|
||||
pane.append(h("p", { class: "graph-note muted", text: graphNote() }));
|
||||
const stages = d.graph?.stages ?? [];
|
||||
@@ -466,6 +642,7 @@ function renderPipelineDetail() {
|
||||
}
|
||||
pane.append(body);
|
||||
}
|
||||
if (state.runStart) pane.append(renderRunStartDialog());
|
||||
return pane;
|
||||
}
|
||||
|
||||
|
||||
+24
-16
@@ -6241,20 +6241,23 @@ try {
|
||||
"the running tool",
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 1300));
|
||||
const runningIndicator = await indicator();
|
||||
const runningChip = await page.evaluate(`(() => {
|
||||
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
|
||||
return {
|
||||
current: chip?.querySelector(".chat-tool-current")?.textContent ?? "",
|
||||
spinner: !!chip?.querySelector(".chat-tool-spinner"),
|
||||
indicator: !!document.querySelector("#chatRunning"),
|
||||
};
|
||||
})()`);
|
||||
if (
|
||||
!runningIndicator ||
|
||||
!runningIndicator.spinner ||
|
||||
runningIndicator.label !== "Running a tool…" ||
|
||||
!/^· \d/.test(runningIndicator.elapsed) ||
|
||||
runningIndicator.tools.length < 1
|
||||
!runningChip.spinner ||
|
||||
!runningChip.current.includes("shell") ||
|
||||
!runningChip.current.includes("npm run build") ||
|
||||
runningChip.indicator
|
||||
) {
|
||||
throw new Error(`C5: the running indicator is wrong: ${JSON.stringify(runningIndicator)}`);
|
||||
throw new Error(`C5: the current-tool chip is wrong: ${JSON.stringify(runningChip)}`);
|
||||
}
|
||||
console.log(
|
||||
` running indicator: spinner=${runningIndicator.spinner}, "${runningIndicator.label}", "${runningIndicator.elapsed}", ` +
|
||||
`${runningIndicator.tools.length} running-tool line(s) — "${runningIndicator.tools[0].text}"`,
|
||||
);
|
||||
console.log(` current tool on the count line: "${runningChip.current}" (no second indicator)`);
|
||||
await shot("57-chat-running.png");
|
||||
|
||||
// 3. A second running tool that started 61 s ago (protocol `time.ran`): the
|
||||
@@ -6276,13 +6279,18 @@ try {
|
||||
],
|
||||
"the long-running tool",
|
||||
);
|
||||
const longCall = await indicator();
|
||||
const longLine = longCall?.tools.find((line) => line.long !== "");
|
||||
if (!longLine || !longLine.longTinted || !longLine.long.includes("long")) {
|
||||
throw new Error(`C5: no tinted long-running tool line: ${JSON.stringify(longCall)}`);
|
||||
const longCall = await page.evaluate(`(() => {
|
||||
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
|
||||
return {
|
||||
current: chip?.querySelector(".chat-tool-current")?.textContent ?? "",
|
||||
long: chip?.querySelector(".chat-tool-long")?.textContent ?? "",
|
||||
};
|
||||
})()`);
|
||||
if (!longCall.current.includes("npm run long") || !longCall.long.includes("long")) {
|
||||
throw new Error(`C5: the long-running tool is not on the count line: ${JSON.stringify(longCall)}`);
|
||||
}
|
||||
const agentsWithTwoIds = await agentCount();
|
||||
console.log(` long-call line: "${longLine.text}${longLine.long}" tinted=${longLine.longTinted}`);
|
||||
console.log(` long-call chip: "${longCall.current}${longCall.long}"`);
|
||||
if (agentsWithTwoIds - agentBefore > 1) {
|
||||
throw new Error(`C5: two assistant message ids fragmented the live turn into ${agentsWithTwoIds} bubbles`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user