@workerdeck/ui 0.21.0 → 0.23.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 (40) hide show
  1. package/README.md +3 -2
  2. package/build/{SessionPanel-BjNAnWMF.d.mts → SessionPanel-BobynUo4.d.mts} +75 -5
  3. package/build/{SessionPanel-DNuPKg5c.mjs → SessionPanel-DUt2VzXG.mjs} +672 -231
  4. package/build/SessionPanel-DUt2VzXG.mjs.map +1 -0
  5. package/build/index.d.mts +54 -21
  6. package/build/index.mjs +7 -6
  7. package/build/index.mjs.map +1 -1
  8. package/build/scoped.css +3611 -0
  9. package/build/workspace.d.mts +7 -1
  10. package/build/workspace.mjs +4 -2
  11. package/build/workspace.mjs.map +1 -1
  12. package/package.json +10 -6
  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/Response.tsx +4 -0
  18. package/src/components/agent/Scrubber.tsx +248 -0
  19. package/src/components/agent/SessionList.tsx +3 -1
  20. package/src/components/agent/SessionPanel.tsx +132 -16
  21. package/src/components/agent/SessionSteps.tsx +10 -4
  22. package/src/components/agent/SessionWorkspace.tsx +8 -0
  23. package/src/components/agent/SkillsDialog.tsx +3 -2
  24. package/src/components/agent/StatusBar.tsx +3 -3
  25. package/src/components/agent/Transcript.tsx +147 -73
  26. package/src/components/agent/UsageDialog.tsx +3 -1
  27. package/src/components/agent/scrubber-marks.ts +277 -0
  28. package/src/components/terminal/PermissionPrompt.tsx +3 -0
  29. package/src/components/terminal/QuestionPrompt.tsx +3 -0
  30. package/src/components/terminal/StatusLine.tsx +3 -1
  31. package/src/components/ui/AlertDialog.tsx +23 -20
  32. package/src/components/ui/Dialog.tsx +26 -23
  33. package/src/components/ui/Menu.tsx +20 -17
  34. package/src/components/ui/PortalScope.tsx +27 -0
  35. package/src/components/ui/Select.tsx +19 -16
  36. package/src/components/ui/Tooltip.tsx +13 -10
  37. package/src/styles/scoped.entry.css +16 -0
  38. package/src/styles/terminal.css +1 -1
  39. package/src/styles/theme.css +213 -0
  40. package/build/SessionPanel-DNuPKg5c.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'`
@@ -2,6 +2,7 @@ import * as _$react from "react";
2
2
  import { ReactNode } from "react";
3
3
  import { LucideIcon } from "lucide-react";
4
4
  import { ModelOption, PermissionMode } from "@workerdeck/protocol";
5
+ import * as _$_workerdeck_react0 from "@workerdeck/react";
5
6
  import { ConnectionState, TranscriptState, UseToolCallHostOptions } from "@workerdeck/react";
6
7
  import { WorkerDeckClient } from "@workerdeck/client";
7
8
 
@@ -389,10 +390,10 @@ interface SessionPanelProps {
389
390
  */
390
391
  onSubagentChange?: (toolUseId: string | undefined) => void;
391
392
  /**
392
- * Terminal theme only: hold the prompt of the turn you are reading at the top
393
- * of the transcript, as the Claude Code CLI does. The **real row** is pinned
394
- * rather than a copy drawn above it, so it lines up with the rows beneath by
395
- * construction see `TranscriptRows`.
393
+ * Hold the prompt of the turn you are reading at the top of the transcript.
394
+ * Works in both variants: the terminal clips to one line (as the CLI does),
395
+ * cards shows a frosted bar. The **real row** is pinned rather than a copy
396
+ * drawn above it, so it lines up with the rows beneath by construction.
396
397
  */
397
398
  stickyPrompt?: boolean;
398
399
  /**
@@ -505,6 +506,68 @@ interface SessionPanelProps {
505
506
  * the client cannot see.
506
507
  */
507
508
  cacheTranscript?: boolean;
509
+ /**
510
+ * Replaces the default empty state when the transcript has no messages. Pass
511
+ * your product's own onboarding content instead of WorkerDeck's generic
512
+ * "`>_` Tell the agent what to do." placeholder.
513
+ */
514
+ emptyState?: ReactNode;
515
+ /**
516
+ * Called when a link in the transcript is clicked. The embedder decides what
517
+ * happens: navigate in-app, open a browser tab, show a confirmation, or
518
+ * suppress.
519
+ *
520
+ * Return `true` (or a truthy value) to indicate the click was handled — the
521
+ * default action (`window.open(href, '_blank')`) is suppressed. Return
522
+ * `false` / `undefined` / nothing to let the browser open the link normally.
523
+ *
524
+ * Absent means "browser default" — links open in a new tab as Streamdown's
525
+ * `target="_blank"` intends. VS Code's webview overrides this through its own
526
+ * native handler (the "allow once / add to allowlist" dialog) and does not
527
+ * need this prop.
528
+ *
529
+ * **Typical embedder patterns:**
530
+ * - Relative URLs → in-app navigation, no confirmation
531
+ * - External URLs → confirmation dialog, or open unconditionally
532
+ * - Suppress all links → `() => true`
533
+ */
534
+ onLinkClick?: (href: string) => boolean | void;
535
+ /**
536
+ * Client-side tool handlers. Each key is a tool name the model can call; the
537
+ * handler receives the model's input and returns a result. The tool's
538
+ * **schema** must be registered server-side (via `tools` on
539
+ * `ProviderRunnerOptions`), but the handler runs here — right where the data
540
+ * the tool needs lives.
541
+ *
542
+ * Shorthand for `toolHost.clientTools`; when both are set, this wins for
543
+ * overlapping names.
544
+ *
545
+ * ```tsx
546
+ * <SessionPanel
547
+ * clientTools={{
548
+ * app_navigate: async (input) => {
549
+ * router.push((input as { path: string }).path)
550
+ * return { value: 'navigated' }
551
+ * },
552
+ * }}
553
+ * />
554
+ * ```
555
+ */
556
+ clientTools?: Record<string, _$_workerdeck_react0.ClientToolHandler>;
557
+ /**
558
+ * Base font size in **whole pixels**. Drives the overall scale of everything
559
+ * the panel draws — prompt, output, markdown, status bar — in both variants.
560
+ *
561
+ * Under the terminal theme it sets `--term-font-size` and derives
562
+ * `--term-line` at the CLI's own 13 : 18 ratio (unless {@link terminalMetrics}
563
+ * overrides those individually). Under cards it sets the panel root's
564
+ * `font-size`, which scales every `rem`/`em`-based token the type scale uses.
565
+ *
566
+ * Absent means "platform default": 13 px for the terminal theme, the
567
+ * inherited body size for cards. That is the right choice for a host that has
568
+ * no preference — the panel reads at the size the rest of the app does.
569
+ */
570
+ fontSize?: number;
508
571
  className?: string;
509
572
  }
510
573
  /** What an embedder needs to *change* a session it doesn't own the attach for. */
@@ -555,6 +618,9 @@ type SessionVitals = {
555
618
  * as its "seen" watermark while the panel is actually on screen, and compares
556
619
  * against later to know what is new. */
557
620
  itemCount: number;
621
+ /** Session-cumulative cost in USD. The internal status bar renders this via
622
+ * `formatCost`; an external host needs it to reproduce that reading. */
623
+ totalCostUsd: number;
558
624
  };
559
625
  /**
560
626
  * The all-in-one embeddable session surface: status bar, streaming transcript,
@@ -591,9 +657,13 @@ declare function SessionPanel({
591
657
  unseen,
592
658
  readOnly,
593
659
  toolHost,
660
+ clientTools,
594
661
  cacheTranscript,
662
+ emptyState,
663
+ onLinkClick,
664
+ fontSize,
595
665
  className
596
666
  }: SessionPanelProps): _$react.JSX.Element;
597
667
  //#endregion
598
668
  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 };
599
- //# sourceMappingURL=SessionPanel-BjNAnWMF.d.mts.map
669
+ //# sourceMappingURL=SessionPanel-BobynUo4.d.mts.map