web: shared chat stars, pipeline mini graphs and agent questions
- Persist chat stars in the operator-session registry (chat_star) so every browser/device shows the same Starred group; migrate old local stars once. - Add a compact pipeline graph shape to list responses and draw a lightweight list miniature; replace the cryptic id/version line with the stage count. - Surface OpenCode form questions as a chat card (chat_answer), replay a pending form to late subscribers, and notify for background questions. - Make the mobile dock's Search cell equal to every destination, keep the tab row visible with 100svh, and let Source use the full pane height. - Let a fresh sign-in auto-connect to its own origin; use a Lax session cookie with Expires so Remember me survives app/link launches. - Keep shipped starters and the skill agnostic: no repository paths, project areas or personal device commands; add Diagnose/Fix and Research starters. - Refresh the installed skill and document the new browser conventions.
This commit is contained in:
@@ -30,6 +30,10 @@ type OperatorSession struct {
|
||||
// so every client sees the same thing; the session and its history are never
|
||||
// deleted, and reopening clears it back to 0.
|
||||
ClosedAt int64
|
||||
// StarredAt is the epoch-millisecond time the operator starred this session,
|
||||
// or 0 while unstarred. It lives on the server so the starred group is shared
|
||||
// by every browser and device.
|
||||
StarredAt int64
|
||||
}
|
||||
|
||||
// ChatCreateBootstrap is the durable progress record for one chat_create
|
||||
@@ -58,7 +62,8 @@ func (s *Store) initOperatorSessions() error {
|
||||
_, err := s.db.Exec(`CREATE TABLE IF NOT EXISTS operator_sessions (
|
||||
session_id TEXT PRIMARY KEY, directory TEXT NOT NULL, title TEXT NOT NULL DEFAULT '',
|
||||
tag TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL, last_used_at INTEGER NOT NULL,
|
||||
closed_at INTEGER NOT NULL DEFAULT 0, ephemeral INTEGER NOT NULL DEFAULT 0);
|
||||
closed_at INTEGER NOT NULL DEFAULT 0, starred_at INTEGER NOT NULL DEFAULT 0,
|
||||
ephemeral INTEGER NOT NULL DEFAULT 0);
|
||||
CREATE INDEX IF NOT EXISTS operator_sessions_recent ON operator_sessions(last_used_at DESC);`)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -134,6 +139,11 @@ func (s *Store) migrateOperatorSessions() error {
|
||||
if err := s.addColumnIfMissing("operator_sessions", "closed_at", "INTEGER NOT NULL DEFAULT 0"); err != nil {
|
||||
return err
|
||||
}
|
||||
// starred_at records the shared star. Existing sessions default to 0
|
||||
// (unstarred); the column is independent of closed_at.
|
||||
if err := s.addColumnIfMissing("operator_sessions", "starred_at", "INTEGER NOT NULL DEFAULT 0"); err != nil {
|
||||
return err
|
||||
}
|
||||
// ephemeral marks a chat created for automated verification. It is hidden from
|
||||
// OperatorSessions but still a real row, so the session stays usable and
|
||||
// closable. Existing rows default to 0 (a normal, listed chat).
|
||||
@@ -202,14 +212,26 @@ func (s *Store) ReopenOperatorSession(ctx context.Context, sessionID string) err
|
||||
return err
|
||||
}
|
||||
|
||||
// SetOperatorSessionStar records the shared star state in one UPDATE. A session
|
||||
// id that is not an operator session updates no row and is not an error, so a
|
||||
// pipeline-owned run session is never affected.
|
||||
func (s *Store) SetOperatorSessionStar(ctx context.Context, sessionID string, starred bool) error {
|
||||
at := int64(0)
|
||||
if starred {
|
||||
at = time.Now().UnixMilli()
|
||||
}
|
||||
_, err := s.db.ExecContext(ctx, "UPDATE operator_sessions SET starred_at=? WHERE session_id=?", at, sessionID)
|
||||
return err
|
||||
}
|
||||
|
||||
// OperatorSession returns one operator session by id. found is false when the id
|
||||
// is not a recorded operator session (so a pipeline-owned run session is never
|
||||
// returned). It is one indexed lookup and never mutates the row.
|
||||
func (s *Store) OperatorSession(ctx context.Context, sessionID string) (OperatorSession, bool, error) {
|
||||
var session OperatorSession
|
||||
row := s.db.QueryRowContext(ctx, `SELECT session_id,directory,title,tag,created_at,last_used_at,closed_at
|
||||
row := s.db.QueryRowContext(ctx, `SELECT session_id,directory,title,tag,created_at,last_used_at,closed_at,starred_at
|
||||
FROM operator_sessions WHERE session_id=? AND tag <> ''`, sessionID)
|
||||
if err := row.Scan(&session.ID, &session.Directory, &session.Title, &session.Tag, &session.CreatedAt, &session.UpdatedAt, &session.ClosedAt); err != nil {
|
||||
if err := row.Scan(&session.ID, &session.Directory, &session.Title, &session.Tag, &session.CreatedAt, &session.UpdatedAt, &session.ClosedAt, &session.StarredAt); err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return OperatorSession{}, false, nil
|
||||
}
|
||||
@@ -228,7 +250,7 @@ FROM operator_sessions WHERE session_id=? AND tag <> ''`, sessionID)
|
||||
// operator can still see and reopen what they finished. It is one bounded
|
||||
// statement; recency is never mutated here.
|
||||
func (s *Store) OperatorSessions(ctx context.Context) ([]OperatorSession, error) {
|
||||
rows, err := s.db.QueryContext(ctx, `SELECT session_id,directory,title,tag,created_at,last_used_at,closed_at
|
||||
rows, err := s.db.QueryContext(ctx, `SELECT session_id,directory,title,tag,created_at,last_used_at,closed_at,starred_at
|
||||
FROM operator_sessions WHERE tag <> '' AND ephemeral = 0 ORDER BY last_used_at DESC, session_id LIMIT ?`, operatorSessionListLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -237,7 +259,7 @@ FROM operator_sessions WHERE tag <> '' AND ephemeral = 0 ORDER BY last_used_at D
|
||||
sessions := []OperatorSession{}
|
||||
for rows.Next() {
|
||||
var session OperatorSession
|
||||
if err := rows.Scan(&session.ID, &session.Directory, &session.Title, &session.Tag, &session.CreatedAt, &session.UpdatedAt, &session.ClosedAt); err != nil {
|
||||
if err := rows.Scan(&session.ID, &session.Directory, &session.Title, &session.Tag, &session.CreatedAt, &session.UpdatedAt, &session.ClosedAt, &session.StarredAt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sessions = append(sessions, session)
|
||||
|
||||
Reference in New Issue
Block a user