+
+
diff --git a/apps/web/src/shell/switcher.tsx b/apps/web/src/shell/switcher.tsx
index b9b68971..9c5bd530 100644
--- a/apps/web/src/shell/switcher.tsx
+++ b/apps/web/src/shell/switcher.tsx
@@ -4,7 +4,9 @@ import { AppWindow, X } from "lucide-react";
import { useEffect, useRef } from "react";
import { isMac } from "@codeworksh/widget/view";
+import { PixelLoader } from "@/components/loader";
import { registry } from "../widgets";
+import { runningAtom } from "../widgets/session/projects";
import { chromeAtom, chromeOf, focusedAtom, tabOwnerAtom } from "../wm/chrome";
import { deskAtom, deskKey } from "../wm/instances";
import {
@@ -32,6 +34,7 @@ export function Switcher({ workspaces, active }: SwitcherProps) {
const chrome = useAtomValue(chromeAtom);
const focusedOn = useAtomValue(focusedAtom);
const owners = useAtomValue(tabOwnerAtom);
+ const running = useAtomValue(runningAtom);
const navigate = useNavigate();
const remove = useAtomSet(deleteWorkspace, { mode: "promise" });
// No confirm, like a browser tab; closing the one on screen moves to a neighbour first.
@@ -103,6 +106,9 @@ export function Switcher({ workspaces, active }: SwitcherProps) {
{workspaces.map((workspace, index) => {
const current = workspace.id === active?.id;
const tab = showing(workspace);
+ const working = instances.some(
+ (instance) => (instance.tags & workspaceTag(workspace)) !== 0 && running.has(instance.id),
+ );
return (
-
+ {working ? : }
{tab}
diff --git a/apps/web/src/style.css b/apps/web/src/style.css
index 02a73893..5159d0fb 100644
--- a/apps/web/src/style.css
+++ b/apps/web/src/style.css
@@ -506,6 +506,28 @@
}
}
+@media (prefers-reduced-motion: no-preference) {
+ .pixel-loader-cell {
+ animation: pixel-loader 960ms steps(1, end) infinite;
+ }
+}
+
+@keyframes pixel-loader {
+ 0% {
+ opacity: 1;
+ }
+ 12.5% {
+ opacity: 0.65;
+ }
+ 25% {
+ opacity: 0.4;
+ }
+ 37.5%,
+ 100% {
+ opacity: 0.2;
+ }
+}
+
@keyframes zen-spin {
to {
transform: rotate(360deg);
@@ -552,8 +574,8 @@
color: color-mix(in srgb, var(--cw-ink) 80%, transparent);
}
-/* Only soften edges that have more settings content beyond them. */
-.settings-scroll {
+/* Only soften edges that have more scrollable content beyond them. */
+.scroll-fade {
mask-image: linear-gradient(
to bottom,
var(--scroll-top, black),
diff --git a/apps/web/src/widgets/session/projects.ts b/apps/web/src/widgets/session/projects.ts
index 8b4df37f..9c518d43 100644
--- a/apps/web/src/widgets/session/projects.ts
+++ b/apps/web/src/widgets/session/projects.ts
@@ -1,5 +1,6 @@
-import { useAtomValue } from "@effect/atom-react";
+import { useAtomSet, useAtomValue } from "@effect/atom-react";
import { AsyncResult, Atom } from "effect/reactivity";
+import { useEffect } from "react";
import { Server } from "../../kernel/rpc";
import { codeworkKey } from "../../kernel/servers";
@@ -7,6 +8,23 @@ import { codeworkKey } from "../../kernel/servers";
/** Every project with its sessions, as the sidebar lists them; refresh it once a new session exists. */
export const projectsAtom = Server.query("projects.list", undefined, { reactivityKeys: codeworkKey });
+/** Running session frames, keyed by instance so closing one never clears another's activity. */
+export const runningAtom = Atom.make
>(new Map()).pipe(Atom.keepAlive);
+
+export function useSessionRunning(instanceId: string, sessionId: string, running: boolean) {
+ const setRunning = useAtomSet(runningAtom);
+ useEffect(() => {
+ if (!running) return;
+ setRunning((current) => new Map(current).set(instanceId, sessionId));
+ return () =>
+ setRunning((current) => {
+ const next = new Map(current);
+ next.delete(instanceId);
+ return next;
+ });
+ }, [instanceId, sessionId, running, setRunning]);
+}
+
const listedAtom = Atom.family((id: string) =>
Atom.make((get) => {
const result = get(projectsAtom);
diff --git a/apps/web/src/widgets/session/view.tsx b/apps/web/src/widgets/session/view.tsx
index 46ae28ff..e1146d3a 100644
--- a/apps/web/src/widgets/session/view.tsx
+++ b/apps/web/src/widgets/session/view.tsx
@@ -6,7 +6,7 @@ import { Atom } from "effect/reactivity";
import { ChevronRight, CircleDashed, X } from "lucide-react";
import { createContext, memo, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
-import brand from "../../assets/codework.png";
+import { Logo } from "@/components/logo";
import { ComposerNotice, type Notice } from "@/components/banner";
import { Monogram } from "@/components/monogram";
import { useModelName, useModelsNotice } from "@/components/model";
@@ -15,7 +15,7 @@ import { SessionComposer } from "./composer";
import { Markdown } from "./markdown";
import { Message } from "./message";
import { Queue } from "./queue";
-import { projectsAtom, useListedSession } from "./projects";
+import { projectsAtom, useListedSession, useSessionRunning } from "./projects";
import { type Info, Json, type ThreadRef, threadKey, topics, type Update } from "./schema";
const decodeReply = Schema.decodeUnknownOption(Json.Reply);
@@ -61,6 +61,11 @@ type State =
type Ready = Extract;
+const isRunning = (state: Ready) => {
+ const last = state.messages.at(-1);
+ return state.running ?? (last?.role === "assistant" && last.state === "draft");
+};
+
/*
* The threads opened lately, as last shown: switching back to one renders it on the first frame
* while it catches up, instead of an empty frame until its first page loads.
@@ -378,6 +383,7 @@ function Conversation({
: loaded.queued,
};
}, [loaded, sent]);
+ useSessionRunning(instanceId, thread.sessionId, state.status === "ready" && isRunning(state));
const sending = useCallback(
(prompt: { readonly id: string; readonly text: string; readonly createdAt: number }) =>
setSent((current) => [
@@ -463,8 +469,7 @@ function Conversation({
const view = stand ?? state;
if (view.status === "loading") return ;
if (view.status === "failed") return {view.message}
;
- const last = view.messages.at(-1);
- const running = view.running ?? (last?.role === "assistant" && last.state === "draft");
+ const running = isRunning(view);
return (
@@ -1107,10 +1112,12 @@ function WorkLog({
) : (
<>
-
{expandable && (