@spunto/design-system 0.36.0 → 0.38.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/package.json
CHANGED
package/src/brand/logo.test.tsx
CHANGED
|
@@ -49,4 +49,21 @@ describe("SpuntoLogo", () => {
|
|
|
49
49
|
expect(spuntoLogoShapes("mark")).toHaveLength(3)
|
|
50
50
|
expect(spuntoLogoShapes("glyph")).toHaveLength(3 + 3 + 3 + 3 + 4)
|
|
51
51
|
})
|
|
52
|
+
|
|
53
|
+
it("draws the same shapes when working, only alive", () => {
|
|
54
|
+
const still = attrs(renderToStaticMarkup(<SpuntoLogo tone="pillars" />))
|
|
55
|
+
const alive = renderToStaticMarkup(<SpuntoLogo tone="pillars" working />)
|
|
56
|
+
const strip = ({ tag, x, y, width, height, rx, cx, cy, r, d, fill }: Record<string, string>) =>
|
|
57
|
+
({ tag, x, y, width, height, rx, cx, cy, r, d, fill })
|
|
58
|
+
expect(attrs(alive).map(strip)).toEqual(still.map(strip))
|
|
59
|
+
expect(alive).toContain("data-working")
|
|
60
|
+
// Every pillar on the wave, each at its own place on the lap.
|
|
61
|
+
const delays = [...alive.matchAll(/animation-delay:(-?[\d.]+)s/g)].map(([, d]) => d)
|
|
62
|
+
expect(delays).toHaveLength(13)
|
|
63
|
+
expect(new Set(delays).size).toBe(13)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it("stays still by default", () => {
|
|
67
|
+
expect(renderToStaticMarkup(<SpuntoLogo />)).not.toContain("data-working")
|
|
68
|
+
})
|
|
52
69
|
})
|
|
@@ -43,27 +43,93 @@ export interface SpuntoLogoProps extends Omit<SVGProps<SVGSVGElement>, "children
|
|
|
43
43
|
* SVG is hidden from assistive tech.
|
|
44
44
|
*/
|
|
45
45
|
title?: string
|
|
46
|
+
/**
|
|
47
|
+
* Draw it alive — for "something is happening right now" (an agent session
|
|
48
|
+
* working, say). The S turns half a turn, which lands it back on itself (its
|
|
49
|
+
* two brackets are 180° twins); the container breathes; and a wave of light
|
|
50
|
+
* runs round the pillars in the order of the story — Build, Ship, Run, then
|
|
51
|
+
* the fleet that sits over all of it. Off under `prefers-reduced-motion`.
|
|
52
|
+
* The keyframes live in `styles.css`.
|
|
53
|
+
*/
|
|
54
|
+
working?: boolean
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
const INK: SpuntoLogoPaint = { ink: "currentColor" }
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
type ShapeAttrs = Pick<SVGProps<SVGElement>, "className" | "style">
|
|
60
|
+
|
|
61
|
+
function Shape({ shape, fill, ...attrs }: { shape: SpuntoLogoShape; fill: string } & ShapeAttrs) {
|
|
51
62
|
switch (shape.kind) {
|
|
52
63
|
case "rect":
|
|
53
|
-
return <rect x={shape.x} y={shape.y} width={shape.w} height={shape.h} rx={shape.rx} fill={fill} />
|
|
64
|
+
return <rect x={shape.x} y={shape.y} width={shape.w} height={shape.h} rx={shape.rx} fill={fill} {...attrs} />
|
|
54
65
|
case "circle":
|
|
55
|
-
return <circle cx={shape.cx} cy={shape.cy} r={shape.r} fill={fill} />
|
|
66
|
+
return <circle cx={shape.cx} cy={shape.cy} r={shape.r} fill={fill} {...attrs} />
|
|
56
67
|
case "path":
|
|
57
|
-
return <path d={shape.d} fill={fill} />
|
|
68
|
+
return <path d={shape.d} fill={fill} {...attrs} />
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
71
|
|
|
72
|
+
/* The wave's route round the pillars: down the Build stack, along the belt,
|
|
73
|
+
up the Run lights, and back across the fleet — one loop, in story order,
|
|
74
|
+
that also happens to be a single counter-clockwise lap of the tile. */
|
|
75
|
+
const WAVE: Partial<Record<SpuntoLogoShape["role"], (n: number, count: number) => number>> = {
|
|
76
|
+
build: (n) => n,
|
|
77
|
+
ship: (n) => 3 + n,
|
|
78
|
+
run: (n, count) => 7 + (count - 1 - n),
|
|
79
|
+
fleet: (n, count) => 10 + (count - 1 - n),
|
|
80
|
+
}
|
|
81
|
+
const WAVE_LENGTH = 13
|
|
82
|
+
/** One lap of the wave, in seconds — `--spunto-logo-lap` in `styles.css`. */
|
|
83
|
+
const WAVE_LAP = 2.4
|
|
84
|
+
|
|
85
|
+
function WorkingShapes({ shapes, paint }: { shapes: SpuntoLogoShape[]; paint: SpuntoLogoPaint }) {
|
|
86
|
+
const fill = (s: SpuntoLogoShape) => spuntoLogoFill(paint, s.role) ?? paint.ink
|
|
87
|
+
const seen: Partial<Record<SpuntoLogoShape["role"], number>> = {}
|
|
88
|
+
const counts: Partial<Record<SpuntoLogoShape["role"], number>> = {}
|
|
89
|
+
for (const s of shapes) counts[s.role] = (counts[s.role] ?? 0) + 1
|
|
90
|
+
|
|
91
|
+
const tile = shapes.filter((s) => s.role === "tile")
|
|
92
|
+
const core = shapes.filter((s) => s.role === "core")
|
|
93
|
+
const pillars = shapes.filter((s) => s.role !== "tile" && s.role !== "core")
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
{tile.map((s, i) => (
|
|
98
|
+
<Shape key={`t${i}`} shape={s} fill={fill(s)} />
|
|
99
|
+
))}
|
|
100
|
+
<g data-slot="spunto-logo-core">
|
|
101
|
+
{core.map((s, i) => (
|
|
102
|
+
<Shape key={`c${i}`} shape={s} fill={fill(s)} {...dot(s)} />
|
|
103
|
+
))}
|
|
104
|
+
</g>
|
|
105
|
+
{pillars.map((s, i) => {
|
|
106
|
+
const n = seen[s.role] ?? 0
|
|
107
|
+
seen[s.role] = n + 1
|
|
108
|
+
const step = WAVE[s.role]?.(n, counts[s.role] ?? 1) ?? 0
|
|
109
|
+
return (
|
|
110
|
+
<Shape
|
|
111
|
+
key={`p${i}`}
|
|
112
|
+
shape={s}
|
|
113
|
+
fill={fill(s)}
|
|
114
|
+
className="spunto-logo-pillar"
|
|
115
|
+
style={{ animationDelay: `${((step / WAVE_LENGTH) * WAVE_LAP - WAVE_LAP).toFixed(3)}s` }}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
})}
|
|
119
|
+
</>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The container dot breathes on its own, inside the turning S. */
|
|
124
|
+
const dot = (s: SpuntoLogoShape): ShapeAttrs => (s.kind === "circle" ? { className: "spunto-logo-dot" } : {})
|
|
125
|
+
|
|
61
126
|
export function SpuntoLogo({
|
|
62
127
|
variant = "glyph",
|
|
63
128
|
tone = "flame",
|
|
64
129
|
paint: overrides,
|
|
65
130
|
size,
|
|
66
131
|
title,
|
|
132
|
+
working = false,
|
|
67
133
|
className,
|
|
68
134
|
...rest
|
|
69
135
|
}: SpuntoLogoProps) {
|
|
@@ -79,12 +145,15 @@ export function SpuntoLogo({
|
|
|
79
145
|
className={cn("shrink-0", className)}
|
|
80
146
|
role={title ? "img" : undefined}
|
|
81
147
|
aria-hidden={title ? undefined : true}
|
|
148
|
+
data-working={working || undefined}
|
|
82
149
|
{...rest}
|
|
83
150
|
>
|
|
84
151
|
{title && <title>{title}</title>}
|
|
85
|
-
{
|
|
86
|
-
<
|
|
87
|
-
)
|
|
152
|
+
{working ? (
|
|
153
|
+
<WorkingShapes shapes={shapes} paint={paint} />
|
|
154
|
+
) : (
|
|
155
|
+
shapes.map((shape, i) => <Shape key={i} shape={shape} fill={spuntoLogoFill(paint, shape.role) ?? paint.ink} />)
|
|
156
|
+
)}
|
|
88
157
|
</svg>
|
|
89
158
|
)
|
|
90
159
|
}
|
|
@@ -14,11 +14,13 @@ import {
|
|
|
14
14
|
ListChecksIcon,
|
|
15
15
|
Loader2Icon,
|
|
16
16
|
PlayIcon,
|
|
17
|
+
RotateCcwIcon,
|
|
17
18
|
SparklesIcon,
|
|
18
19
|
UserIcon,
|
|
19
20
|
WrenchIcon,
|
|
20
21
|
} from "lucide-react"
|
|
21
22
|
|
|
23
|
+
import { SpuntoLogo } from "../../brand"
|
|
22
24
|
import { cn } from "../../utils"
|
|
23
25
|
import { AgentMarkdown, renderInlineMarkdown } from "./agent-markdown"
|
|
24
26
|
import { TaskFiles, fileRefs } from "./task-attachments"
|
|
@@ -326,6 +328,34 @@ function BoundaryEntry({ event, hideSummary = false }: { event: TaskEvent; hideS
|
|
|
326
328
|
)
|
|
327
329
|
}
|
|
328
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Where a finished conversation was picked back up (`session.reopened`, written by the platform):
|
|
333
|
+
* everything above it was done — or had failed — and closed, everything below came after. On a
|
|
334
|
+
* worker shared with another task, it says which one, since both agents now work in one checkout.
|
|
335
|
+
*/
|
|
336
|
+
function ReopenedEntry({ event }: { event: TaskEvent }) {
|
|
337
|
+
const from = str(event.payload.from)
|
|
338
|
+
const shared = Array.isArray(event.payload.sharedWith)
|
|
339
|
+
? (event.payload.sharedWith as Record<string, unknown>[]).map((t) => str(t?.title)).filter(Boolean)
|
|
340
|
+
: []
|
|
341
|
+
const when = new Date(event.ts)
|
|
342
|
+
return (
|
|
343
|
+
<Entry>
|
|
344
|
+
<Marker icon={<RotateCcwIcon className="h-3 w-3" />} tone="muted" />
|
|
345
|
+
<p className="text-xs font-medium">Picked back up</p>
|
|
346
|
+
<p className="mt-0.5 text-[11px] text-muted-foreground">
|
|
347
|
+
{from === "failed" ? "The task had failed" : from === "done" ? "The task was done" : "The task was finished"}
|
|
348
|
+
{Number.isNaN(when.getTime()) ? "" : ` · ${when.toLocaleString()}`}
|
|
349
|
+
</p>
|
|
350
|
+
{shared.length > 0 && (
|
|
351
|
+
<p className="mt-1 text-[11px] leading-snug text-orange-600 dark:text-orange-400">
|
|
352
|
+
Its worker is shared with {shared.map((t) => `“${t}”`).join(", ")} — both work in the same checkout.
|
|
353
|
+
</p>
|
|
354
|
+
)}
|
|
355
|
+
</Entry>
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
|
|
329
359
|
function PendingEntry({ text, previews = [] }: { text: string; previews?: string[] }) {
|
|
330
360
|
return (
|
|
331
361
|
<Entry>
|
|
@@ -350,10 +380,18 @@ function PendingEntry({ text, previews = [] }: { text: string; previews?: string
|
|
|
350
380
|
)
|
|
351
381
|
}
|
|
352
382
|
|
|
383
|
+
/** The last row while the session can still move: the logo, alive. */
|
|
353
384
|
function WorkingEntry() {
|
|
354
385
|
return (
|
|
355
386
|
<Entry className="pb-0">
|
|
356
|
-
|
|
387
|
+
{/* The logo *is* the marker: its flame tile is opaque, so the rail stops behind it. */}
|
|
388
|
+
<SpuntoLogo
|
|
389
|
+
working
|
|
390
|
+
tone="flame"
|
|
391
|
+
size={24}
|
|
392
|
+
className="absolute left-0 top-0.5 -translate-x-1/2 shadow-sm"
|
|
393
|
+
data-slot="task-working"
|
|
394
|
+
/>
|
|
357
395
|
<p className="pt-1 text-[11px] text-muted-foreground">working…</p>
|
|
358
396
|
</Entry>
|
|
359
397
|
)
|
|
@@ -511,6 +549,7 @@ function Row({
|
|
|
511
549
|
if (row.event.type === "thinking") return <ThinkingEntry event={row.event} />
|
|
512
550
|
if (row.event.type === "plan") return <PlanEntry event={row.event} />
|
|
513
551
|
if (row.event.type === "message") return <MessageEntry event={row.event} attachmentUrl={attachmentUrl} />
|
|
552
|
+
if (row.event.type === "session.reopened") return <ReopenedEntry event={row.event} />
|
|
514
553
|
return <BoundaryEntry event={row.event} hideSummary={row.hideSummary} />
|
|
515
554
|
}
|
|
516
555
|
|
|
@@ -56,7 +56,7 @@ export interface TaskConversation extends TaskItem {
|
|
|
56
56
|
export interface TaskEvent {
|
|
57
57
|
seq: number
|
|
58
58
|
ts: string
|
|
59
|
-
/** `message` | `thinking` | `plan` | `tool.call` | `tool.result` | `session.started` | `session.ended` | `usage` | `session.title` | `session.background` | `raw` … */
|
|
59
|
+
/** `message` | `thinking` | `plan` | `tool.call` | `tool.result` | `session.started` | `session.ended` | `usage` | `session.title` | `session.background` | `session.reopened` | `raw` … */
|
|
60
60
|
type: string
|
|
61
61
|
payload: Record<string, unknown>
|
|
62
62
|
}
|
package/styles.css
CHANGED
|
@@ -612,6 +612,49 @@
|
|
|
612
612
|
[data-slot="image-pull"] * { transition-duration: 0.01ms !important; }
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
/* ---------------------------------------------------------------------------
|
|
616
|
+
SpuntoLogo — working.
|
|
617
|
+
`<SpuntoLogo working />`: the S makes a half turn and settles (its brackets
|
|
618
|
+
are 180° twins, so every turn lands on the same drawing — it reads as a
|
|
619
|
+
flick, never a spinner), the container dot breathes, and a light runs round
|
|
620
|
+
the pillars in story order. The per-pillar delay is an inline style, since
|
|
621
|
+
it depends on the shape's place on the route; the lap is 2.4 s (keep it in
|
|
622
|
+
step with `WAVE_LAP` in `brand/spunto-logo.tsx`).
|
|
623
|
+
--------------------------------------------------------------------------- */
|
|
624
|
+
@keyframes spunto-logo-turn {
|
|
625
|
+
0%, 55% { transform: rotate(0deg); }
|
|
626
|
+
80% { transform: rotate(192deg); }
|
|
627
|
+
90%, 100% { transform: rotate(180deg); }
|
|
628
|
+
}
|
|
629
|
+
@keyframes spunto-logo-breathe {
|
|
630
|
+
0%, 100% { transform: scale(1); }
|
|
631
|
+
50% { transform: scale(0.72); }
|
|
632
|
+
}
|
|
633
|
+
@keyframes spunto-logo-wave {
|
|
634
|
+
0% { opacity: 1; transform: scale(1.35); }
|
|
635
|
+
18% { opacity: 1; transform: scale(1); }
|
|
636
|
+
45%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
637
|
+
}
|
|
638
|
+
svg[data-working] [data-slot="spunto-logo-core"] {
|
|
639
|
+
transform-origin: 64px 64px;
|
|
640
|
+
animation: spunto-logo-turn 2.4s cubic-bezier(0.5, 0, 0.3, 1) infinite;
|
|
641
|
+
}
|
|
642
|
+
svg[data-working] .spunto-logo-dot {
|
|
643
|
+
transform-box: fill-box;
|
|
644
|
+
transform-origin: center;
|
|
645
|
+
animation: spunto-logo-breathe 1.2s ease-in-out infinite;
|
|
646
|
+
}
|
|
647
|
+
svg[data-working] .spunto-logo-pillar {
|
|
648
|
+
transform-box: fill-box;
|
|
649
|
+
transform-origin: center;
|
|
650
|
+
animation: spunto-logo-wave 2.4s ease-out infinite;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
@media (prefers-reduced-motion: reduce) {
|
|
654
|
+
/* Standing still, the logo is just the logo — every pillar lit, the S at rest. */
|
|
655
|
+
svg[data-working] * { animation: none; }
|
|
656
|
+
}
|
|
657
|
+
|
|
615
658
|
/* ---------------------------------------------------------------------------
|
|
616
659
|
FormSection — entrance.
|
|
617
660
|
A long form arrives as a stack of cards; each one lifts in slightly after the
|