@workerdeck/ui 0.20.0 → 0.22.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.
Files changed (43) hide show
  1. package/README.md +3 -2
  2. package/build/{SessionPanel-CnU_IJ3-.d.mts → SessionPanel-13l25ubU.d.mts} +55 -7
  3. package/build/{SessionPanel-CHktI2CF.mjs → SessionPanel-DgwjH4Ve.mjs} +642 -231
  4. package/build/SessionPanel-DgwjH4Ve.mjs.map +1 -0
  5. package/build/index.d.mts +309 -53
  6. package/build/index.mjs +534 -397
  7. package/build/index.mjs.map +1 -1
  8. package/build/scoped.css +3547 -0
  9. package/build/workspace.d.mts +10 -1
  10. package/build/workspace.mjs +4 -2
  11. package/build/workspace.mjs.map +1 -1
  12. package/package.json +15 -7
  13. package/src/components/agent/Composer.tsx +10 -10
  14. package/src/components/agent/ContextDialog.tsx +3 -2
  15. package/src/components/agent/Conversation.tsx +1 -1
  16. package/src/components/agent/McpDialog.tsx +3 -1
  17. package/src/components/agent/Scrubber.tsx +248 -0
  18. package/src/components/agent/SessionBrowser.tsx +113 -293
  19. package/src/components/agent/SessionItem.tsx +538 -0
  20. package/src/components/agent/SessionList.tsx +3 -1
  21. package/src/components/agent/SessionPanel.tsx +112 -21
  22. package/src/components/agent/SessionStatusIcon.tsx +43 -0
  23. package/src/components/agent/SessionSteps.tsx +118 -61
  24. package/src/components/agent/SessionWorkspace.tsx +11 -0
  25. package/src/components/agent/SkillsDialog.tsx +3 -2
  26. package/src/components/agent/StatusBar.tsx +1 -1
  27. package/src/components/agent/Transcript.tsx +147 -73
  28. package/src/components/agent/UsageDialog.tsx +3 -1
  29. package/src/components/agent/scrubber-marks.ts +277 -0
  30. package/src/components/terminal/PermissionPrompt.tsx +3 -0
  31. package/src/components/terminal/QuestionPrompt.tsx +3 -0
  32. package/src/components/terminal/StatusLine.tsx +3 -1
  33. package/src/components/ui/AlertDialog.tsx +23 -20
  34. package/src/components/ui/Dialog.tsx +26 -23
  35. package/src/components/ui/Menu.tsx +20 -17
  36. package/src/components/ui/PortalScope.tsx +27 -0
  37. package/src/components/ui/Select.tsx +19 -16
  38. package/src/components/ui/Tooltip.tsx +13 -10
  39. package/src/index.ts +5 -1
  40. package/src/styles/scoped.entry.css +16 -0
  41. package/src/styles/terminal.css +1 -1
  42. package/src/styles/theme.css +223 -8
  43. package/build/SessionPanel-CHktI2CF.mjs.map +0 -1
package/README.md CHANGED
@@ -127,9 +127,10 @@ lose by forgetting a second mount isn't one.
127
127
  scoping — file an issue with your case.
128
128
  - Dark mode is driven **only** by `[data-theme='dark']` on the root element (the Tailwind
129
129
  `dark:` variant is remapped to it); `prefers-color-scheme` is not consulted at CSS level.
130
- - The session surface centers its content at `--wd-content-max-w` (default `48rem`).
130
+ - The session surface centers its content at `--wd-transcript-max-width` (default `48rem`).
131
131
  Embedders in narrow docks (a VS Code bottom panel, a drawer) set it to `100%` for
132
- edge-to-edge content. Every component also carries `data-slot` attributes for targeted
132
+ edge-to-edge content. Other geometry tokens: `--wd-status-bar-height`, `--wd-composer-padding`,
133
+ `--wd-transcript-row-gap`. Every component also carries `data-slot` attributes for targeted
133
134
  overrides — e.g. `[data-slot='composer-hint']` is the "Enter to send" line, which a host
134
135
  whose vertical space is precious can `display: none`.
135
136
  - `SessionPanel` can hand its dialog surfaces to the embedder: `panelSurface: 'external'`
@@ -340,8 +340,21 @@ interface SessionPanelProps {
340
340
  * need a live closure at the far end. Same shape and same reason as
341
341
  * {@link SessionPanelProps.reveal}.
342
342
  *
343
- * Hosts must clear their request on a session switch: a stale one replayed at
344
- * remount would open a frame the new transcript cannot answer.
343
+ * **Withdrawing the request closes the frame.** The prop going away without a
344
+ * remount is itself a request — "the conversation, plainly" and it leaves
345
+ * through the same path Back takes, so the reader lands on the Task row they
346
+ * came from. It has to mean that, because a host that keeps its request in
347
+ * route state (the dashboard's `?subagent=`) has exactly one way to say it:
348
+ * clear the search — which is what the sidebar's plain session click already
349
+ * navigated with, and what the browser's Back button re-arrives on. Before
350
+ * this, both were silently ignored and the frame outlived the address that
351
+ * claimed it was gone. Still not a controlled value: the panel enters and
352
+ * leaves frames on its own and *reports* through
353
+ * {@link SessionPanelProps.onSubagentChange}; only a **change** of the prop
354
+ * is a request.
355
+ *
356
+ * Hosts must still clear their request on a session switch: a stale one
357
+ * replayed at remount would open a frame the new transcript cannot answer.
345
358
  *
346
359
  * Claude-only in practice, and gated by data rather than by a flag — codex and
347
360
  * provider sessions have no `parentToolUseId`, so they grow no task blocks and
@@ -352,10 +365,34 @@ interface SessionPanelProps {
352
365
  nonce: number;
353
366
  };
354
367
  /**
355
- * Terminal theme only: hold the prompt of the turn you are reading at the top
356
- * of the transcript, as the Claude Code CLI does. The **real row** is pinned
357
- * rather than a copy drawn above it, so it lines up with the rows beneath by
358
- * construction see `TranscriptRows`.
368
+ * Which sub-agent the panel now has framed, or `undefined` for the session's
369
+ * own conversation the outward half of
370
+ * {@link SessionPanelProps.openSubagent}, and a *statement* where that one is
371
+ * a *request*. Deliberately not an echo: the panel enters frames the host
372
+ * never asked for (a Task row pressed in the transcript) and leaves them on
373
+ * its own (Back, Escape, a reveal), so a host that tracked only its own
374
+ * requests would be wrong within one click. No nonce, for the same reason —
375
+ * a state that arrives twice is the same state, where a request that arrives
376
+ * twice is two requests.
377
+ *
378
+ * Never fired for a fresh mount's initial `undefined`, and never fired from
379
+ * an unmount. The first would be a lie with consequences: the seeding effect
380
+ * consumes `openSubagent` in the same commit, so for one commit the state is
381
+ * `undefined` even though a frame is about to open, and a host folding
382
+ * reports into route state would clear the very `?subagent=` request the
383
+ * panel is in the middle of honouring. The second lets a panel keyed away on
384
+ * a session switch stomp what the host already believes about the next one.
385
+ * See the notify effect for the mechanics.
386
+ *
387
+ * What the sessions list's secondary selection feeds on: the row of the agent
388
+ * on screen takes the blue and its session's card steps back to grey.
389
+ */
390
+ onSubagentChange?: (toolUseId: string | undefined) => void;
391
+ /**
392
+ * Hold the prompt of the turn you are reading at the top of the transcript.
393
+ * Works in both variants: the terminal clips to one line (as the CLI does),
394
+ * cards shows a frosted bar. The **real row** is pinned rather than a copy
395
+ * drawn above it, so it lines up with the rows beneath by construction.
359
396
  */
360
397
  stickyPrompt?: boolean;
361
398
  /**
@@ -468,6 +505,12 @@ interface SessionPanelProps {
468
505
  * the client cannot see.
469
506
  */
470
507
  cacheTranscript?: boolean;
508
+ /**
509
+ * Replaces the default empty state when the transcript has no messages. Pass
510
+ * your product's own onboarding content instead of WorkerDeck's generic
511
+ * "`>_` Tell the agent what to do." placeholder.
512
+ */
513
+ emptyState?: ReactNode;
471
514
  className?: string;
472
515
  }
473
516
  /** What an embedder needs to *change* a session it doesn't own the attach for. */
@@ -518,6 +561,9 @@ type SessionVitals = {
518
561
  * as its "seen" watermark while the panel is actually on screen, and compares
519
562
  * against later to know what is new. */
520
563
  itemCount: number;
564
+ /** Session-cumulative cost in USD. The internal status bar renders this via
565
+ * `formatCost`; an external host needs it to reproduce that reading. */
566
+ totalCostUsd: number;
521
567
  };
522
568
  /**
523
569
  * The all-in-one embeddable session surface: status bar, streaming transcript,
@@ -546,6 +592,7 @@ declare function SessionPanel({
546
592
  scrubberMarks,
547
593
  reveal,
548
594
  openSubagent,
595
+ onSubagentChange,
549
596
  stickyPrompt,
550
597
  controlsSurface,
551
598
  onControls,
@@ -554,8 +601,9 @@ declare function SessionPanel({
554
601
  readOnly,
555
602
  toolHost,
556
603
  cacheTranscript,
604
+ emptyState,
557
605
  className
558
606
  }: SessionPanelProps): _$react.JSX.Element;
559
607
  //#endregion
560
608
  export { permissionModeChoices as C, PermissionModeSelectProps as S, useAffordances as _, SessionVitals as a, PermissionModeMeta as b, TranscriptDensityProvider as c, TranscriptVariantProvider as d, useTranscriptDensity as f, WithActions as g, TerminalAffordances as h, SessionSurfacePanel as i, TranscriptFont as l, CopyAction as m, SessionPanel as n, TerminalMetrics as o, useTranscriptVariant as p, SessionPanelProps as r, TranscriptDensity as s, SessionControls as t, TranscriptVariant as u, PERMISSION_MODES as v, permissionModeMeta as w, PermissionModeSelect as x, PermissionModeChoice as y };
561
- //# sourceMappingURL=SessionPanel-CnU_IJ3-.d.mts.map
609
+ //# sourceMappingURL=SessionPanel-13l25ubU.d.mts.map