@spunto/design-system 0.77.0 → 0.78.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "description": "Spunto's shared design system — green tokens (conservatory + sprout), color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -228,6 +228,11 @@ function CustomizeLink({ tile, href }: { tile: TaskAppTile; href?: (tile: TaskAp
228
228
  )
229
229
  }
230
230
 
231
+ /** Anything to draw in a block — a tile with only `links` has none: its links go to the header. */
232
+ function hasBody(tile: TaskAppTile): boolean {
233
+ return !!(tile.meters?.length || tile.facts?.length || tile.items?.length || tile.lists?.length)
234
+ }
235
+
231
236
  export function TaskDetails({
232
237
  task,
233
238
  variant = "sidebar",
@@ -248,7 +253,11 @@ export function TaskDetails({
248
253
  }: TaskDetailsProps) {
249
254
  const sheet = useContext(TaskDetailsSheetContext)
250
255
  const meta = task.meta && Object.keys(task.meta).length > 0 ? task.meta : null
251
- const links = task.links && task.links.length > 0 ? task.links : null
256
+ // The task's own links, then those its org's apps add (Spunto IDE: « Open IDE »), once each.
257
+ const allLinks = [...(task.links ?? []), ...(appTiles ?? []).flatMap((tile) => tile.links ?? [])].filter(
258
+ (link, i, list) => list.findIndex((l) => l.url === link.url) === i,
259
+ )
260
+ const links = allLinks.length > 0 ? allLinks : null
252
261
  const metadata = task.metadata && Object.keys(task.metadata).length > 0 ? Object.entries(task.metadata) : null
253
262
  const ran = task.completedAt ? taskSpan(task.startedAt ?? task.createdAt, task.completedAt) : null
254
263
  // `baseBranch: null` is the project's default — saying so ("project default") on every task of a
@@ -360,7 +369,7 @@ export function TaskDetails({
360
369
 
361
370
  {/* What only the harness knows about its session (its quota, its MCP servers, its skills…),
362
371
  from the task's agent app — Session's numbers stay ours, the same for every harness. */}
363
- {appTiles?.filter((tile) => tile.session).map((tile) => (
372
+ {appTiles?.filter((tile) => tile.session && hasBody(tile)).map((tile) => (
364
373
  <Block key={tile.appId} id={`app:${tile.appId}`} variant={variant} title={tile.title} hint={tile.appName === tile.title ? undefined : tile.appName}>
365
374
  <TaskAppTileContent tile={tile} onAction={onAppTileAction && ((item, action) => onAppTileAction(tile, item, action))} />
366
375
  <CustomizeLink tile={tile} href={appTileSettingsHref} />
@@ -369,7 +378,7 @@ export function TaskDetails({
369
378
 
370
379
  {/* What the org's apps make of the links the conversation shared — GitHub: the pull requests
371
380
  it talked about, with where each one stands. */}
372
- {appTiles?.filter((tile) => !tile.session).map((tile) => (
381
+ {appTiles?.filter((tile) => !tile.session && hasBody(tile)).map((tile) => (
373
382
  <Block key={tile.appId} id={`app:${tile.appId}`} variant={variant} title={tile.title} hint={tile.appName === tile.title ? undefined : tile.appName}>
374
383
  <TaskAppTileContent tile={tile} onAction={onAppTileAction && ((item, action) => onAppTileAction(tile, item, action))} />
375
384
  <CustomizeLink tile={tile} href={appTileSettingsHref} />
@@ -548,6 +548,26 @@ describe("TaskDetails", () => {
548
548
  expect(screen.queryByText("Fix the login")).toBeNull()
549
549
  })
550
550
 
551
+ it("adds the links an app gives to the task's own, and draws no block for an app with nothing else", () => {
552
+ window.localStorage.clear()
553
+ const { container } = render(
554
+ <TaskDetails
555
+ task={task({ links: [{ label: "BAC-78", url: "https://cms.test/BAC-78" }] })}
556
+ appTiles={[
557
+ { appId: "github", appName: "GitHub", title: "Pull requests", items: [{ title: "github row" }] },
558
+ { appId: "ide", appName: "Spunto IDE", title: "IDE", links: [{ url: "https://sbx-a-code.test/", label: "Open IDE" }] },
559
+ ]}
560
+ commands={[]}
561
+ />,
562
+ )
563
+ expect(screen.getByText("Links")).toBeTruthy()
564
+ expect(screen.getByText("BAC-78").closest("a")?.getAttribute("href")).toBe("https://cms.test/BAC-78")
565
+ expect(screen.getByText("Open IDE").closest("a")?.getAttribute("href")).toBe("https://sbx-a-code.test/")
566
+ const blocks = [...container.querySelectorAll("[data-block]")].map((el) => el.getAttribute("data-block"))
567
+ expect(blocks).not.toContain("app:ide")
568
+ expect(blocks).toContain("app:github")
569
+ })
570
+
551
571
  it("remembers a block the reader opened, in every conversation", () => {
552
572
  window.localStorage.clear()
553
573
  const first = render(<TaskDetails task={task({ id: "t1", prompt: "First prompt" })} commands={[]} />)
@@ -309,6 +309,8 @@ export interface TaskAppTile {
309
309
  facts?: TaskAppTileFact[]
310
310
  items?: TaskAppTileItem[]
311
311
  lists?: TaskAppTileList[]
312
+ /** Links the app adds to the task's own « Links », in the header — not drawn in its block (Spunto IDE: « Open IDE »). */
313
+ links?: TaskLink[]
312
314
  }
313
315
 
314
316
  // ── Machine ──────────────────────────────────────────────────────────────────────────────────