@niwa-labs/ui-kit 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +29 -2
- package/package.json +31 -4
- package/src/agent/diff-view.tsx +62 -0
- package/src/agent/execution-track.tsx +201 -0
- package/src/agent/guard.ts +121 -0
- package/src/agent/guarded-action.tsx +272 -0
- package/src/agent/id-chip.tsx +102 -0
- package/src/agent/markdown.tsx +34 -0
- package/src/agent/payload.ts +42 -0
- package/src/agent/phase-plan.tsx +183 -0
- package/src/agent/plan-impact.ts +104 -0
- package/src/agent/state.tsx +75 -0
- package/src/agent/tool-call.tsx +106 -0
- package/src/agent/transcript.tsx +88 -0
- package/src/execution-track.css +327 -0
- package/src/index.ts +76 -0
- package/src/lib/cn.ts +19 -0
- package/src/page-layout.css +183 -0
- package/src/theme.css +136 -0
- package/src/ui/badge.tsx +32 -0
- package/src/ui/button.tsx +38 -0
- package/src/ui/collapsible.tsx +13 -0
- package/src/ui/data-value.tsx +211 -0
- package/src/ui/message.tsx +81 -0
- package/src/ui/page-layout.tsx +33 -0
- package/src/ui/schema-view.tsx +144 -0
- package/src/ui/spinner.tsx +16 -0
- package/src/ui/tabs.tsx +63 -0
- package/src/ui/tooltip.tsx +50 -0
- package/src/ui/trace.tsx +100 -0
- package/test/browser.test.ts +13 -0
- package/test/diff-view.test.tsx +50 -0
- package/test/guard.test.ts +113 -0
- package/test/guarded-action.test.tsx +229 -0
- package/test/helpers.test.ts +83 -0
- package/test/phase-plan.test.tsx +146 -0
- package/test/plan.test.ts +71 -0
- package/test/render.test.tsx +62 -0
- package/test/structured-values.test.tsx +31 -0
- package/test/tabs.test.tsx +90 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** Consequences shown by the plan before the owner confirms a recompute or stop. */
|
|
2
|
+
|
|
3
|
+
import type { WorkState } from "./state.tsx";
|
|
4
|
+
|
|
5
|
+
export type PlanStep = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
state: WorkState;
|
|
9
|
+
/** The step acts outside the run (a push, a message, a payment); running it again may repeat the effect. */
|
|
10
|
+
effect?: boolean | undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type PlanPhase<S extends PlanStep = PlanStep> = {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
state: WorkState;
|
|
17
|
+
steps: readonly S[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A phase, or one step inside it. */
|
|
21
|
+
export type PlanTarget = { phase: string; step?: string | undefined };
|
|
22
|
+
|
|
23
|
+
export type RecomputeImpact = {
|
|
24
|
+
/** Recorded steps in the selected phase, or the selected step itself. */
|
|
25
|
+
selected: number;
|
|
26
|
+
/** Selected steps the plan marks as having an effect, regardless of their last outcome. */
|
|
27
|
+
flagged: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type StopImpact = {
|
|
31
|
+
/** The steps that are running or waiting inside the target and will stop. */
|
|
32
|
+
stopping: number;
|
|
33
|
+
/** The steps after the target, or not yet started inside it, that will not start. */
|
|
34
|
+
notStarting: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type Flat = { phase: string; step: PlanStep };
|
|
38
|
+
|
|
39
|
+
function flatten(phases: readonly PlanPhase[]): Flat[] {
|
|
40
|
+
return phases.flatMap((phase) => phase.steps.map((step) => ({ phase: phase.id, step })));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The index of the first step of the target in the flat order, or -1 when the plan has no such target. */
|
|
44
|
+
function startOf(flat: readonly Flat[], target: PlanTarget): number {
|
|
45
|
+
return flat.findIndex((f) => f.phase === target.phase && (target.step === undefined || f.step.id === target.step));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Whether `f` lies inside the target. */
|
|
49
|
+
function inside(f: Flat, target: PlanTarget): boolean {
|
|
50
|
+
return f.phase === target.phase && (target.step === undefined || f.step.id === target.step);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function selectedSteps(phases: readonly PlanPhase[], target: PlanTarget): readonly PlanStep[] {
|
|
54
|
+
const phase = phases.find((one) => one.id === target.phase);
|
|
55
|
+
return phase?.steps.filter((step) => target.step === undefined || step.id === target.step) ?? [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Display order gives no information about which calls a workflow can reuse in another branch. */
|
|
59
|
+
export function recomputeImpact(phases: readonly PlanPhase[], target: PlanTarget): RecomputeImpact {
|
|
60
|
+
const selected = selectedSteps(phases, target);
|
|
61
|
+
return { selected: selected.length, flagged: selected.filter((step) => step.effect).length };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function stopImpact(phases: readonly PlanPhase[], target: PlanTarget): StopImpact {
|
|
65
|
+
const flat = flatten(phases);
|
|
66
|
+
const start = startOf(flat, target);
|
|
67
|
+
if (start < 0) return { stopping: 0, notStarting: 0 };
|
|
68
|
+
let stopping = 0;
|
|
69
|
+
let notStarting = 0;
|
|
70
|
+
for (const f of flat.slice(start)) {
|
|
71
|
+
if (inside(f, target) && (f.step.state === "running" || f.step.state === "waiting")) stopping += 1;
|
|
72
|
+
else if (f.step.state === "pending") notStarting += 1;
|
|
73
|
+
}
|
|
74
|
+
return { stopping, notStarting };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function steps(n: number): string {
|
|
78
|
+
return n === 1 ? "1 step" : `${n} steps`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The name of a target as the owner sees it. */
|
|
82
|
+
export function targetTitle(phases: readonly PlanPhase[], target: PlanTarget): string {
|
|
83
|
+
const phase = phases.find((p) => p.id === target.phase);
|
|
84
|
+
if (phase === undefined) return target.step ?? target.phase;
|
|
85
|
+
if (target.step === undefined) return phase.title;
|
|
86
|
+
return phase.steps.find((s) => s.id === target.step)?.title ?? target.step;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function describeRecompute(phases: readonly PlanPhase[], target: PlanTarget): string {
|
|
90
|
+
const { selected, flagged } = recomputeImpact(phases, target);
|
|
91
|
+
const title = targetTitle(phases, target);
|
|
92
|
+
const selection = target.step === undefined ? `Recompute “${title}” (${steps(selected)} in this phase).` : `Recompute “${title}”.`;
|
|
93
|
+
const effects = flagged > 0 ? ` ${steps(flagged)} in this selection ${flagged === 1 ? "is" : "are"} marked as having an effect.` : "";
|
|
94
|
+
const uncertainty = selectedSteps(phases, target).some((step) => step.state === "unknown") ? " A selected step has an unknown outcome." : "";
|
|
95
|
+
return `${selection}${effects}${uncertainty} Previously sent messages or other external changes may be repeated.`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function describeStop(phases: readonly PlanPhase[], target: PlanTarget): string {
|
|
99
|
+
const impact = stopImpact(phases, target);
|
|
100
|
+
let text = `Stop “${targetTitle(phases, target)}”`;
|
|
101
|
+
text += impact.stopping > 0 ? `: ${steps(impact.stopping)} running stop` : "";
|
|
102
|
+
if (impact.notStarting > 0) text += `${impact.stopping > 0 ? "," : ":"} ${steps(impact.notStarting)} will not start`;
|
|
103
|
+
return text + ".";
|
|
104
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state of anything that runs: a run, a phase, a step, a session, a request. One small ring
|
|
3
|
+
* shows it everywhere, so the same state reads the same on every page.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ComponentProps } from "react";
|
|
7
|
+
|
|
8
|
+
import { cn } from "../lib/cn.ts";
|
|
9
|
+
|
|
10
|
+
export type WorkState =
|
|
11
|
+
/** Not started yet. */
|
|
12
|
+
| "pending"
|
|
13
|
+
| "running"
|
|
14
|
+
/** Stopped until someone answers: the owner, another agent, a timer. */
|
|
15
|
+
| "waiting"
|
|
16
|
+
| "done"
|
|
17
|
+
| "failed"
|
|
18
|
+
/** The call ended without a confirmed result. */
|
|
19
|
+
| "unknown"
|
|
20
|
+
/** Stopped by someone before it finished. */
|
|
21
|
+
| "stopped"
|
|
22
|
+
/** Will not run: a condition or the plan left it out. */
|
|
23
|
+
| "skipped"
|
|
24
|
+
/** Not run again: its result was kept from an earlier pass. */
|
|
25
|
+
| "reused";
|
|
26
|
+
|
|
27
|
+
export const WORK_STATE_LABEL: Readonly<Record<WorkState, string>> = {
|
|
28
|
+
pending: "Pending",
|
|
29
|
+
running: "Running",
|
|
30
|
+
waiting: "Waiting",
|
|
31
|
+
done: "Done",
|
|
32
|
+
failed: "Failed",
|
|
33
|
+
unknown: "Outcome unknown",
|
|
34
|
+
stopped: "Stopped",
|
|
35
|
+
skipped: "Skipped",
|
|
36
|
+
reused: "Reused",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Whether the work can still change by itself. */
|
|
40
|
+
export function isSettled(state: WorkState): boolean {
|
|
41
|
+
return state === "done" || state === "failed" || state === "unknown" || state === "stopped" || state === "skipped" || state === "reused";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const RING: Readonly<Record<WorkState, string>> = {
|
|
45
|
+
pending: "border-state-idle border-dashed",
|
|
46
|
+
running: "border-state-running border-t-transparent motion-safe:animate-spin",
|
|
47
|
+
waiting: "border-state-waiting bg-state-waiting/30",
|
|
48
|
+
done: "border-state-done bg-state-done",
|
|
49
|
+
failed: "border-state-failed bg-state-failed",
|
|
50
|
+
unknown: "border-state-waiting border-dashed",
|
|
51
|
+
stopped: "border-state-idle bg-state-idle",
|
|
52
|
+
skipped: "border-state-idle opacity-50",
|
|
53
|
+
reused: "border-state-done",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type StateRingProps = Omit<ComponentProps<"span">, "children"> & {
|
|
57
|
+
state: WorkState;
|
|
58
|
+
/** Text read by a screen reader and shown as the native tooltip; the state's name by default. */
|
|
59
|
+
label?: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function StateRing({ state, label, className, ...props }: StateRingProps) {
|
|
63
|
+
const text = label ?? WORK_STATE_LABEL[state];
|
|
64
|
+
return (
|
|
65
|
+
<span
|
|
66
|
+
data-slot="state-ring"
|
|
67
|
+
data-state={state}
|
|
68
|
+
role="img"
|
|
69
|
+
aria-label={text}
|
|
70
|
+
title={text}
|
|
71
|
+
className={cn("inline-block size-3 shrink-0 rounded-full border-2", RING[state], className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { DataValue } from "../ui/data-value.tsx";
|
|
2
|
+
/**
|
|
3
|
+
* A tool call inside a turn: what was called, with what, and what came back. Closed it is one
|
|
4
|
+
* line; open it shows the input and the output.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { WrenchIcon } from "lucide-react";
|
|
8
|
+
import type { ReactNode } from "react";
|
|
9
|
+
|
|
10
|
+
import { cn } from "../lib/cn.ts";
|
|
11
|
+
import {
|
|
12
|
+
Trace,
|
|
13
|
+
TraceCollapsible,
|
|
14
|
+
TraceCollapsibleContent,
|
|
15
|
+
TraceCollapsibleTrigger,
|
|
16
|
+
TraceDescription,
|
|
17
|
+
TraceIcon,
|
|
18
|
+
TraceLine,
|
|
19
|
+
TraceTitle,
|
|
20
|
+
type TraceStatus,
|
|
21
|
+
} from "../ui/trace.tsx";
|
|
22
|
+
import { formatDuration } from "./payload.ts";
|
|
23
|
+
import { StateRing, type WorkState } from "./state.tsx";
|
|
24
|
+
|
|
25
|
+
export type ToolCallState = Extract<WorkState, "pending" | "running" | "waiting" | "done" | "failed" | "stopped">;
|
|
26
|
+
|
|
27
|
+
export type ToolCallProps = {
|
|
28
|
+
/** The tool's name. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** What the call did, in words; the name when absent. */
|
|
31
|
+
title?: ReactNode;
|
|
32
|
+
state: ToolCallState;
|
|
33
|
+
/** The input as sent: structured fields use the same presentation as action results. */
|
|
34
|
+
input?: unknown;
|
|
35
|
+
/** The output as received. */
|
|
36
|
+
output?: unknown;
|
|
37
|
+
/** Why the call failed. */
|
|
38
|
+
error?: string | undefined;
|
|
39
|
+
durationMs?: number | undefined;
|
|
40
|
+
/** Open at first. Failed calls start open. */
|
|
41
|
+
defaultOpen?: boolean | undefined;
|
|
42
|
+
/** Shown in place of the icon, e.g. the tool's own icon. */
|
|
43
|
+
icon?: ReactNode;
|
|
44
|
+
className?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function traceStatus(state: ToolCallState): TraceStatus | undefined {
|
|
48
|
+
if (state === "running") return "running";
|
|
49
|
+
if (state === "failed") return "error";
|
|
50
|
+
if (state === "pending") return "pending";
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function Payload({ label, value }: { label: string; value: unknown }) {
|
|
55
|
+
if (value === undefined || value === "") return null;
|
|
56
|
+
return (
|
|
57
|
+
<div className="flex min-w-0 flex-col gap-1">
|
|
58
|
+
<span className="text-xs font-medium uppercase tracking-wide text-muted-foreground/80">{label}</span>
|
|
59
|
+
<DataValue value={value}/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function ToolCall({
|
|
65
|
+
name,
|
|
66
|
+
title,
|
|
67
|
+
state,
|
|
68
|
+
input,
|
|
69
|
+
output,
|
|
70
|
+
error,
|
|
71
|
+
durationMs,
|
|
72
|
+
defaultOpen,
|
|
73
|
+
icon,
|
|
74
|
+
className,
|
|
75
|
+
}: ToolCallProps) {
|
|
76
|
+
const hasBody = input !== undefined || output !== undefined || error !== undefined;
|
|
77
|
+
const line = (
|
|
78
|
+
<TraceLine status={traceStatus(state)}>
|
|
79
|
+
<TraceIcon>{icon ?? <WrenchIcon />}</TraceIcon>
|
|
80
|
+
<TraceTitle>{title ?? name}</TraceTitle>
|
|
81
|
+
{durationMs === undefined ? null : <TraceDescription>{formatDuration(durationMs)}</TraceDescription>}
|
|
82
|
+
<StateRing state={state} className="size-2.5" />
|
|
83
|
+
</TraceLine>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Trace data-slot="tool-call" data-tool={name} data-state={state} className={cn("min-w-0", className)}>
|
|
88
|
+
{hasBody ? (
|
|
89
|
+
<TraceCollapsible defaultOpen={defaultOpen ?? state === "failed"}>
|
|
90
|
+
<TraceCollapsibleTrigger>{line}</TraceCollapsibleTrigger>
|
|
91
|
+
<TraceCollapsibleContent className="flex flex-col gap-2">
|
|
92
|
+
<Payload label="Аргументы" value={input} />
|
|
93
|
+
{error === undefined ? <Payload label="Результат" value={output} /> : null}
|
|
94
|
+
{error === undefined ? null : (
|
|
95
|
+
<div className="rounded-md bg-destructive/10 px-2 py-1.5 font-mono text-xs whitespace-pre-wrap text-destructive">
|
|
96
|
+
<DataValue value={error}/>
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</TraceCollapsibleContent>
|
|
100
|
+
</TraceCollapsible>
|
|
101
|
+
) : (
|
|
102
|
+
line
|
|
103
|
+
)}
|
|
104
|
+
</Trace>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A long list that grows at the bottom: the turns of a session, the records of a run. Only the
|
|
3
|
+
* rows in view are rendered. While the reader is at the bottom the list follows new rows; once
|
|
4
|
+
* they scroll up it stays where they are, and a button brings them back.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
8
|
+
import { ArrowDownIcon } from "lucide-react";
|
|
9
|
+
import type { Key, ReactNode } from "react";
|
|
10
|
+
import { useStickToBottom } from "use-stick-to-bottom";
|
|
11
|
+
|
|
12
|
+
import { cn } from "../lib/cn.ts";
|
|
13
|
+
import { Button } from "../ui/button.tsx";
|
|
14
|
+
|
|
15
|
+
export type TranscriptProps<T> = {
|
|
16
|
+
items: readonly T[];
|
|
17
|
+
/** A key that stays with an item while the list grows. */
|
|
18
|
+
itemKey: (item: T, index: number) => Key;
|
|
19
|
+
renderItem: (item: T, index: number) => ReactNode;
|
|
20
|
+
/** A first guess of a row's height in pixels; rows are measured once rendered. */
|
|
21
|
+
estimateSize?: ((index: number) => number) | undefined;
|
|
22
|
+
/** Rows rendered beyond the visible ones on each side. */
|
|
23
|
+
overscan?: number | undefined;
|
|
24
|
+
/** Shown when there are no items. */
|
|
25
|
+
empty?: ReactNode;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function Transcript<T>({
|
|
30
|
+
items,
|
|
31
|
+
itemKey,
|
|
32
|
+
renderItem,
|
|
33
|
+
estimateSize = () => 72,
|
|
34
|
+
overscan = 6,
|
|
35
|
+
empty,
|
|
36
|
+
className,
|
|
37
|
+
}: TranscriptProps<T>) {
|
|
38
|
+
const stick = useStickToBottom({ initial: "instant", resize: "smooth" });
|
|
39
|
+
const virtualizer = useVirtualizer({
|
|
40
|
+
count: items.length,
|
|
41
|
+
getScrollElement: () => stick.scrollRef.current,
|
|
42
|
+
estimateSize,
|
|
43
|
+
overscan,
|
|
44
|
+
getItemKey: (index) => {
|
|
45
|
+
const item = items[index];
|
|
46
|
+
return item === undefined ? index : itemKey(item, index);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div data-slot="transcript" className={cn("relative flex min-h-0 flex-1 flex-col", className)}>
|
|
52
|
+
<div ref={stick.scrollRef} className="min-h-0 flex-1 overflow-y-auto overscroll-contain" role="log" aria-live="polite">
|
|
53
|
+
{items.length === 0 ? (
|
|
54
|
+
<div className="flex h-full items-center justify-center p-6 text-sm text-muted-foreground">{empty}</div>
|
|
55
|
+
) : (
|
|
56
|
+
<div ref={stick.contentRef} className="relative w-full" style={{ height: virtualizer.getTotalSize() }}>
|
|
57
|
+
{virtualizer.getVirtualItems().map((row) => {
|
|
58
|
+
const item = items[row.index];
|
|
59
|
+
if (item === undefined) return null;
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
key={row.key}
|
|
63
|
+
data-index={row.index}
|
|
64
|
+
ref={virtualizer.measureElement}
|
|
65
|
+
className="absolute inset-x-0 top-0"
|
|
66
|
+
style={{ transform: `translateY(${row.start}px)` }}
|
|
67
|
+
>
|
|
68
|
+
{renderItem(item, row.index)}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
{stick.isAtBottom ? null : (
|
|
76
|
+
<Button
|
|
77
|
+
variant="outline"
|
|
78
|
+
size="icon-sm"
|
|
79
|
+
aria-label="Scroll to the latest"
|
|
80
|
+
className="absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full shadow-sm"
|
|
81
|
+
onClick={() => void stick.scrollToBottom()}
|
|
82
|
+
>
|
|
83
|
+
<ArrowDownIcon />
|
|
84
|
+
</Button>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
.nw-sequence,
|
|
2
|
+
.nw-track,
|
|
3
|
+
.nw-branches {
|
|
4
|
+
list-style: none;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
}
|
|
8
|
+
.nw-sequence {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
gap: 8px 20px;
|
|
12
|
+
margin: 10px 0 14px;
|
|
13
|
+
}
|
|
14
|
+
.nw-sequence li,
|
|
15
|
+
.nw-phase-title {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: 7px;
|
|
19
|
+
}
|
|
20
|
+
.nw-sequence li {
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
font: 13px/1.35 system-ui;
|
|
23
|
+
}
|
|
24
|
+
.nw-sequence li > div {
|
|
25
|
+
padding-top: 3px;
|
|
26
|
+
}
|
|
27
|
+
.nw-sequence small,
|
|
28
|
+
.nw-track small {
|
|
29
|
+
display: block;
|
|
30
|
+
color: var(--muted-foreground);
|
|
31
|
+
font: 12px/1.45 system-ui;
|
|
32
|
+
}
|
|
33
|
+
.nw-node {
|
|
34
|
+
display: grid;
|
|
35
|
+
flex: none;
|
|
36
|
+
place-items: center;
|
|
37
|
+
width: 24px;
|
|
38
|
+
height: 24px;
|
|
39
|
+
font-family: inherit;
|
|
40
|
+
font-size: 13px;
|
|
41
|
+
font-weight: 580;
|
|
42
|
+
border: 1px solid currentColor;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
color: var(--state-done);
|
|
45
|
+
}
|
|
46
|
+
.nw-node[data-state="pending"] {
|
|
47
|
+
color: var(--muted-foreground);
|
|
48
|
+
opacity: 0.65;
|
|
49
|
+
}
|
|
50
|
+
.nw-node[data-state="running"] {
|
|
51
|
+
color: var(--state-running);
|
|
52
|
+
background: color-mix(in srgb, var(--state-running) 18%, var(--card));
|
|
53
|
+
}
|
|
54
|
+
.nw-node[data-state="waiting"] {
|
|
55
|
+
color: var(--state-waiting);
|
|
56
|
+
}
|
|
57
|
+
.nw-node:is([data-state="failed"], [data-state="stopped"]) {
|
|
58
|
+
color: var(--destructive);
|
|
59
|
+
}
|
|
60
|
+
.nw-track {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
padding: 10px 0;
|
|
64
|
+
}
|
|
65
|
+
.nw-phase {
|
|
66
|
+
position: relative;
|
|
67
|
+
flex: 1 0 125px;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
}
|
|
70
|
+
.nw-phase:not(:last-child)::before {
|
|
71
|
+
content: "";
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 13px;
|
|
74
|
+
left: 15px;
|
|
75
|
+
right: 0;
|
|
76
|
+
height: 2px;
|
|
77
|
+
background: var(--border);
|
|
78
|
+
}
|
|
79
|
+
.nw-phase-title {
|
|
80
|
+
position: relative;
|
|
81
|
+
width: fit-content;
|
|
82
|
+
max-width: 100%;
|
|
83
|
+
padding-right: 7px;
|
|
84
|
+
background: var(--card);
|
|
85
|
+
font-family: inherit;
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
font-weight: 580;
|
|
88
|
+
overflow-wrap: anywhere;
|
|
89
|
+
}
|
|
90
|
+
.nw-phase-title .nw-node[data-state="running"] {
|
|
91
|
+
width: 29px;
|
|
92
|
+
height: 29px;
|
|
93
|
+
}
|
|
94
|
+
.nw-branches {
|
|
95
|
+
position: relative;
|
|
96
|
+
margin: 7px 5px 0 12px;
|
|
97
|
+
padding-left: 9px;
|
|
98
|
+
border-left: 1px solid var(--border);
|
|
99
|
+
}
|
|
100
|
+
.nw-branch {
|
|
101
|
+
position: relative;
|
|
102
|
+
padding: 3px 4px;
|
|
103
|
+
overflow-wrap: anywhere;
|
|
104
|
+
}
|
|
105
|
+
.nw-branch::before {
|
|
106
|
+
content: "";
|
|
107
|
+
position: absolute;
|
|
108
|
+
width: 8px;
|
|
109
|
+
height: 1px;
|
|
110
|
+
left: -9px;
|
|
111
|
+
top: 12px;
|
|
112
|
+
background: var(--muted-foreground);
|
|
113
|
+
}
|
|
114
|
+
.nw-branches:has(> [data-activity="working"], > [data-activity="timer"]) {
|
|
115
|
+
border-color: var(--state-running);
|
|
116
|
+
}
|
|
117
|
+
.nw-step {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: baseline;
|
|
120
|
+
gap: 7px;
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
font: 500 13px/1.35 system-ui;
|
|
123
|
+
}
|
|
124
|
+
.nw-step > i {
|
|
125
|
+
flex: none;
|
|
126
|
+
font: 16px/1 system-ui;
|
|
127
|
+
color: var(--muted-foreground);
|
|
128
|
+
}
|
|
129
|
+
.nw-branch:is([data-kind="question"], [data-kind="agent"]) .nw-step > i {
|
|
130
|
+
align-self: center;
|
|
131
|
+
display: grid;
|
|
132
|
+
place-items: center;
|
|
133
|
+
width: 21px;
|
|
134
|
+
height: 21px;
|
|
135
|
+
border-radius: 6px;
|
|
136
|
+
background: var(--state-running);
|
|
137
|
+
color: var(--background);
|
|
138
|
+
font: 700 13px/1 system-ui;
|
|
139
|
+
}
|
|
140
|
+
.nw-branch[data-kind="question"] .nw-step > i {
|
|
141
|
+
background: var(--state-waiting);
|
|
142
|
+
}
|
|
143
|
+
.nw-step > em {
|
|
144
|
+
font-style: normal;
|
|
145
|
+
color: var(--muted-foreground);
|
|
146
|
+
}
|
|
147
|
+
.nw-branch[data-activity="working"] .nw-step > em {
|
|
148
|
+
align-self: center;
|
|
149
|
+
width: 16px;
|
|
150
|
+
height: 16px;
|
|
151
|
+
flex: none;
|
|
152
|
+
border: 2px solid var(--border);
|
|
153
|
+
border-top-color: var(--state-running);
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
}
|
|
156
|
+
.nw-track-inspect { display: block; overflow: visible; }
|
|
157
|
+
.nw-phase-index { display:flex; flex-wrap:wrap; gap:5px; list-style:none; margin:0 0 12px; padding:0; }
|
|
158
|
+
.nw-phase-index .nw-phase { flex: 1 1 9rem; }
|
|
159
|
+
.nw-phase-index .nw-phase::before { display:none; }
|
|
160
|
+
.nw-phase-index .nw-phase-title { width:100%; height:100%; align-items:flex-start; text-align:left; padding:7px; border:1px solid var(--border); border-radius:5px; }
|
|
161
|
+
.nw-phase-index .nw-phase-title[aria-pressed="true"] { background:var(--accent); border-color:var(--ring); }
|
|
162
|
+
.nw-track .nw-fork {
|
|
163
|
+
color: var(--state-running);
|
|
164
|
+
margin: 5px 0 0 12px;
|
|
165
|
+
}
|
|
166
|
+
.nw-prompt {
|
|
167
|
+
white-space: pre-wrap;
|
|
168
|
+
}
|
|
169
|
+
.nw-duration {
|
|
170
|
+
position: relative;
|
|
171
|
+
height: 4px;
|
|
172
|
+
margin: 6px 0;
|
|
173
|
+
background: var(--border);
|
|
174
|
+
}
|
|
175
|
+
.nw-duration i {
|
|
176
|
+
position: absolute;
|
|
177
|
+
height: 100%;
|
|
178
|
+
min-width: 2px;
|
|
179
|
+
max-width: 100%;
|
|
180
|
+
background: var(--state-done);
|
|
181
|
+
}
|
|
182
|
+
.nw-branch[data-activity="working"] .nw-duration i {
|
|
183
|
+
background: var(--state-running);
|
|
184
|
+
}
|
|
185
|
+
.nw-countdown {
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
font-variant-numeric: tabular-nums;
|
|
188
|
+
}
|
|
189
|
+
.nw-activity[data-activity]::before {
|
|
190
|
+
content: "";
|
|
191
|
+
display: inline-block;
|
|
192
|
+
width: 0.55em;
|
|
193
|
+
height: 0.55em;
|
|
194
|
+
margin-right: 0.4em;
|
|
195
|
+
border-radius: 50%;
|
|
196
|
+
background: var(--motion-color, var(--state-running));
|
|
197
|
+
vertical-align: 0.08em;
|
|
198
|
+
}
|
|
199
|
+
.nw-activity[data-activity="human"] {
|
|
200
|
+
--motion-color: var(--state-waiting);
|
|
201
|
+
}
|
|
202
|
+
.nw-activity[data-activity="timer"] {
|
|
203
|
+
--motion-color: #9fd3c7;
|
|
204
|
+
}
|
|
205
|
+
.nw-activity[data-activity="paused"] {
|
|
206
|
+
--motion-color: #f0c674;
|
|
207
|
+
}
|
|
208
|
+
.nw-activity[data-activity="starting"]::before {
|
|
209
|
+
background: none;
|
|
210
|
+
border: 2px solid var(--muted-foreground);
|
|
211
|
+
border-top-color: transparent;
|
|
212
|
+
}
|
|
213
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
214
|
+
.nw-branch:is([data-activity="working"], [data-activity="timer"])::before,
|
|
215
|
+
.nw-phase:has(+ .nw-phase .nw-branch:is([data-activity="working"], [data-activity="timer"]))::before {
|
|
216
|
+
height: 3px;
|
|
217
|
+
background:
|
|
218
|
+
linear-gradient(90deg, transparent, #76cfff, #e3faff, transparent) -50% 0/38% 100% no-repeat,
|
|
219
|
+
#43627b;
|
|
220
|
+
animation: nw-across 1.8s linear infinite;
|
|
221
|
+
}
|
|
222
|
+
.nw-branches:has(.nw-branch:is([data-activity="working"], [data-activity="timer"]))::before {
|
|
223
|
+
content: "";
|
|
224
|
+
position: absolute;
|
|
225
|
+
inset: 0 auto 0 -2px;
|
|
226
|
+
width: 3px;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
background: linear-gradient(180deg, transparent, #9ce1ff, transparent) 0 -60%/100% 36% no-repeat;
|
|
229
|
+
animation: nw-down 1.8s linear infinite;
|
|
230
|
+
}
|
|
231
|
+
.nw-phase:has(.nw-branch[data-activity="working"]) .nw-node {
|
|
232
|
+
animation: nw-pulse 2.5s ease-out infinite;
|
|
233
|
+
}
|
|
234
|
+
.nw-branch[data-activity="working"] .nw-step > em {
|
|
235
|
+
animation: nw-spin 1.6s linear infinite;
|
|
236
|
+
}
|
|
237
|
+
.nw-activity[data-activity="working"]::before {
|
|
238
|
+
animation: nw-ring 1.4s ease-out infinite;
|
|
239
|
+
}
|
|
240
|
+
.nw-activity[data-activity="human"]::before {
|
|
241
|
+
animation: nw-blink 1.1s ease-in-out infinite;
|
|
242
|
+
}
|
|
243
|
+
.nw-activity[data-activity="timer"]::before {
|
|
244
|
+
animation: nw-breathe 3s ease-in-out infinite;
|
|
245
|
+
}
|
|
246
|
+
.nw-activity[data-activity="paused"]::before {
|
|
247
|
+
animation: nw-blink 2s steps(2, jump-none) infinite;
|
|
248
|
+
}
|
|
249
|
+
.nw-activity[data-activity="starting"]::before {
|
|
250
|
+
animation: nw-spin 0.9s linear infinite;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
@keyframes nw-across {
|
|
254
|
+
to {
|
|
255
|
+
background-position: 150% 0;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
@keyframes nw-down {
|
|
259
|
+
to {
|
|
260
|
+
background-position: 0 160%;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
@keyframes nw-pulse {
|
|
264
|
+
50% {
|
|
265
|
+
box-shadow: 0 0 0 3px #41637b;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
@keyframes nw-spin {
|
|
269
|
+
to {
|
|
270
|
+
transform: rotate(1turn);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
@keyframes nw-ring {
|
|
274
|
+
from {
|
|
275
|
+
box-shadow: 0 0 0 0 var(--state-running);
|
|
276
|
+
}
|
|
277
|
+
to {
|
|
278
|
+
box-shadow: 0 0 0 0.5em transparent;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
@keyframes nw-blink {
|
|
282
|
+
50% {
|
|
283
|
+
opacity: 0.25;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
@keyframes nw-breathe {
|
|
287
|
+
50% {
|
|
288
|
+
transform: scale(0.6);
|
|
289
|
+
opacity: 0.6;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.nw-mini {display:inline-flex; flex-wrap:wrap; gap:4px 12px; font-size:12px; color:var(--muted-foreground)}
|
|
294
|
+
.nw-mini > span {display:inline-flex; align-items:center; gap:4px; overflow-wrap:anywhere}
|
|
295
|
+
.nw-mini i {flex:none}
|
|
296
|
+
.nw-loose-steps h3 {font-size:13px;font-weight:600}
|
|
297
|
+
.nw-phase-index .nw-phase[data-activity="working"] .nw-node {color:var(--state-running)}
|
|
298
|
+
.nw-mini i {
|
|
299
|
+
width: 9px;
|
|
300
|
+
height: 5px;
|
|
301
|
+
background: var(--border);
|
|
302
|
+
}
|
|
303
|
+
.nw-mini [data-state="done"] {
|
|
304
|
+
background: var(--state-done);
|
|
305
|
+
}
|
|
306
|
+
.nw-mini [data-state="current"] {
|
|
307
|
+
background: var(--state-running);
|
|
308
|
+
}
|
|
309
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
310
|
+
.nw-mini [data-activity="timer"] {
|
|
311
|
+
width: 18px;
|
|
312
|
+
background:
|
|
313
|
+
linear-gradient(90deg, transparent, #e3faff, transparent) -50% 0/50% 100% no-repeat,
|
|
314
|
+
#497b96;
|
|
315
|
+
animation: nw-across 1.8s linear infinite;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@media (max-width: 600px) {
|
|
320
|
+
.nw-track[data-detail="false"] { display: block; overflow: visible; }
|
|
321
|
+
.nw-track[data-detail="false"] .nw-phase { margin-left: 12px; padding: 0 0 10px 20px; }
|
|
322
|
+
.nw-track[data-detail="false"] .nw-phase:not(:last-child) { border-left: 1px solid var(--border); }
|
|
323
|
+
.nw-track[data-detail="false"] .nw-phase::before { display: none; }
|
|
324
|
+
.nw-track[data-detail="false"] .nw-phase-title { margin-left: -33px; width: auto; }
|
|
325
|
+
.nw-track[data-detail="false"] .nw-phase:last-child { padding-bottom: 0; }
|
|
326
|
+
.nw-track[data-detail="false"] .nw-branches { margin: 4px 0 0 0; }
|
|
327
|
+
}
|