@workerdeck/ui 0.12.0 → 0.15.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 (32) hide show
  1. package/README.md +19 -0
  2. package/build/{SessionPanel-NQ8ksCfj.mjs → SessionPanel-DI1NO4l8.mjs} +223 -163
  3. package/build/SessionPanel-DI1NO4l8.mjs.map +1 -0
  4. package/build/{SessionPanel-Dy9lQrOV.d.mts → SessionPanel-J2U8v88q.d.mts} +86 -8
  5. package/build/index.d.mts +118 -7
  6. package/build/index.mjs +355 -169
  7. package/build/index.mjs.map +1 -1
  8. package/build/workspace.d.mts +13 -1
  9. package/build/workspace.mjs +7 -2
  10. package/build/workspace.mjs.map +1 -1
  11. package/package.json +4 -4
  12. package/src/components/agent/Composer.tsx +112 -37
  13. package/src/components/agent/EngineIcon.tsx +97 -0
  14. package/src/components/agent/Loader.tsx +4 -1
  15. package/src/components/agent/Message.tsx +12 -5
  16. package/src/components/agent/QuestionPrompt.tsx +1 -1
  17. package/src/components/agent/SessionBrowser.tsx +266 -138
  18. package/src/components/agent/SessionPanel.tsx +149 -48
  19. package/src/components/agent/SessionWorkspace.tsx +17 -0
  20. package/src/components/agent/StatusBar.tsx +58 -12
  21. package/src/components/agent/Transcript.tsx +2 -3
  22. package/src/components/agent/line-prompt.tsx +2 -2
  23. package/src/components/agent/transcript-variant.tsx +14 -0
  24. package/src/components/ui/Badge.tsx +6 -1
  25. package/src/components/ui/Empty.tsx +56 -0
  26. package/src/components/ui/Menu.tsx +1 -1
  27. package/src/components/ui/Select.tsx +1 -1
  28. package/src/components/ui/Splitter.tsx +14 -0
  29. package/src/components/ui/Tooltip.tsx +1 -1
  30. package/src/index.ts +11 -1
  31. package/src/styles/theme.css +77 -15
  32. package/build/SessionPanel-NQ8ksCfj.mjs.map +0 -1
@@ -102,7 +102,7 @@ function Badge({ className, variant = "neutral", mono, dot, children, ...props }
102
102
  ...props,
103
103
  children: [dot ? /* @__PURE__ */ jsx("span", {
104
104
  "aria-hidden": true,
105
- className: "size-1.5 rounded-full bg-current"
105
+ className: "size-1.5 shrink-0 self-center rounded-full bg-current"
106
106
  }) : null, children]
107
107
  });
108
108
  }
@@ -134,7 +134,7 @@ const SelectContent = ({ className, align = "start", alignItemWithTrigger = fals
134
134
  alignItemWithTrigger,
135
135
  side,
136
136
  sideOffset,
137
- className: "isolate z-60 outline-none",
137
+ className: "isolate z-80 outline-none",
138
138
  children: /* @__PURE__ */ jsx(Select.Popup, {
139
139
  "data-slot": "select-content",
140
140
  className: cn("max-h-[min(24rem,var(--available-height))] min-w-[var(--anchor-width)] overflow-y-auto", "rounded-md border border-border bg-surface p-1 text-fg-1 shadow-(--shadow-lg) outline-none", className),
@@ -161,7 +161,7 @@ const MenuContent = ({ className, align = "end", side = "bottom", sideOffset = 6
161
161
  align,
162
162
  side,
163
163
  sideOffset,
164
- className: "isolate z-60 outline-none",
164
+ className: "isolate z-80 outline-none",
165
165
  children: /* @__PURE__ */ jsx(Menu.Popup, {
166
166
  "data-slot": "menu-content",
167
167
  className: cn("min-w-48 rounded-md border border-border bg-surface p-1 text-fg-1 shadow-(--shadow-lg) outline-none", "transition-[opacity,transform] duration-(--motion-base)", "data-starting-style:scale-95 data-starting-style:opacity-0", "data-ending-style:scale-95 data-ending-style:opacity-0", className),
@@ -239,7 +239,7 @@ const TooltipProvider = Tooltip.Provider;
239
239
  const TooltipContent = ({ className, side = "top", sideOffset = 6, ...props }) => /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
240
240
  side,
241
241
  sideOffset,
242
- className: "isolate z-60",
242
+ className: "isolate z-90",
243
243
  children: /* @__PURE__ */ jsx(Tooltip.Popup, {
244
244
  "data-slot": "tooltip-content",
245
245
  className: cn("rounded-md border border-border bg-surface px-2 py-1 text-label text-fg-2 shadow-(--shadow-md) outline-none", className),
@@ -401,7 +401,7 @@ function CodeBlock({ code, label, copyable = true, variant = "panel", className
401
401
  * Keyboard-operable and announced as a separator, because a pane you can only
402
402
  * size by dragging is a pane some people cannot size.
403
403
  */
404
- function Splitter({ orientation, value, onValueChange, min, max, step = 16, inverted, "aria-label": label, className }) {
404
+ function Splitter({ orientation, value, onValueChange, min, max, step = 16, defaultValue, inverted, "aria-label": label, className }) {
405
405
  const drag = useRef(null);
406
406
  const vertical = orientation === "vertical";
407
407
  const clamp = useCallback((next) => Math.min(max, Math.max(min, next)), [min, max]);
@@ -425,6 +425,9 @@ function Splitter({ orientation, value, onValueChange, min, max, step = 16, inve
425
425
  drag.current = null;
426
426
  if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
427
427
  };
428
+ const onDoubleClick = () => {
429
+ if (defaultValue !== void 0) onValueChange(clamp(defaultValue));
430
+ };
428
431
  const onKeyDown = (event) => {
429
432
  const grow = vertical ? "ArrowRight" : "ArrowDown";
430
433
  const shrink = vertical ? "ArrowLeft" : "ArrowUp";
@@ -449,6 +452,7 @@ function Splitter({ orientation, value, onValueChange, min, max, step = 16, inve
449
452
  onPointerMove,
450
453
  onPointerUp: endDrag,
451
454
  onPointerCancel: endDrag,
455
+ onDoubleClick,
452
456
  onKeyDown,
453
457
  className: cn("group relative shrink-0 touch-none bg-border transition-colors", "hover:bg-border-strong focus-visible:bg-accent focus-visible:outline-none", vertical ? "w-px cursor-col-resize" : "h-px cursor-row-resize", className),
454
458
  children: /* @__PURE__ */ jsx("span", {
@@ -4280,6 +4284,78 @@ function hashtagTrigger(opts = {}) {
4280
4284
  };
4281
4285
  }
4282
4286
  //#endregion
4287
+ //#region src/components/agent/transcript-variant.tsx
4288
+ const VariantContext = createContext("cards");
4289
+ function TranscriptVariantProvider({ value, children }) {
4290
+ return /* @__PURE__ */ jsx(VariantContext.Provider, {
4291
+ value,
4292
+ children
4293
+ });
4294
+ }
4295
+ function useTranscriptVariant() {
4296
+ return useContext(VariantContext);
4297
+ }
4298
+ /** True in `lines`, for the many `cond ? a : b` reads in the row components. */
4299
+ function useLines() {
4300
+ return useTranscriptVariant() === "lines";
4301
+ }
4302
+ const DensityContext = createContext("comfortable");
4303
+ function TranscriptDensityProvider({ value, children }) {
4304
+ return /* @__PURE__ */ jsx(DensityContext.Provider, {
4305
+ value,
4306
+ children
4307
+ });
4308
+ }
4309
+ function useTranscriptDensity() {
4310
+ return useContext(DensityContext);
4311
+ }
4312
+ /**
4313
+ * The gap between two rows, per variant and density — the whole of the density
4314
+ * feature, since it is the only vertical spacing between rows that exists.
4315
+ *
4316
+ * `className` goes on the **measured** wrapper (see `Transcript`), so the gap is
4317
+ * part of each row's measured height and no pixel constant is load-bearing.
4318
+ * `px` is fed to `estimateSize` alone, where being approximate is the contract:
4319
+ * it sets the scrollbar's length before rows mount and is replaced by a real
4320
+ * measurement the moment one does.
4321
+ *
4322
+ * `lines` + `compact` is the only combination with no gap at all: there the
4323
+ * row's own `py-0.5` is the entire separation, which is what makes it compact.
4324
+ */
4325
+ const ROW_GAP = {
4326
+ cards: {
4327
+ comfortable: {
4328
+ className: "pt-4",
4329
+ px: 16
4330
+ },
4331
+ compact: {
4332
+ className: "pt-2",
4333
+ px: 8
4334
+ }
4335
+ },
4336
+ lines: {
4337
+ comfortable: {
4338
+ className: "pt-4",
4339
+ px: 16
4340
+ },
4341
+ compact: { px: 0 }
4342
+ }
4343
+ };
4344
+ /**
4345
+ * The left gutter of a line item: one glyph, fixed width, so every row's text
4346
+ * starts on the same column no matter which kind of event it is. Decorative —
4347
+ * the row's own text says what it is.
4348
+ */
4349
+ function LineGlyph({ children, className }) {
4350
+ return /* @__PURE__ */ jsx("span", {
4351
+ "aria-hidden": true,
4352
+ className: cn("w-3.5 shrink-0 select-none text-center font-mono text-label leading-5 text-fg-4", className),
4353
+ children
4354
+ });
4355
+ }
4356
+ /** Body text metrics for a line item — tighter than the card variant's. */
4357
+ const LINE_TEXT = "text-body-sm leading-5";
4358
+ //#endregion
4283
4359
  //#region src/components/agent/Composer.tsx
4284
4360
  /** CLI names may carry display annotations (e.g. "foo (MCP)") the parser rejects. */
4285
4361
  const cleanName = (name) => name.replace(/\s*\(MCP\)$/i, "");
@@ -4332,6 +4408,7 @@ function matchScore(query, haystacks) {
4332
4408
  */
4333
4409
  function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message the agent…", commands, skills, onSearchFiles, attachments, toolbar, layout = "stacked", className, ref }) {
4334
4410
  const inline = layout === "inline";
4411
+ const lines = useLines();
4335
4412
  const { bind, plainText, isEmpty, clear, focus } = usePromptAreaState();
4336
4413
  const fileInput = useRef(null);
4337
4414
  const [dragging, setDragging] = useState(false);
@@ -4457,7 +4534,7 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
4457
4534
  e.target.value = "";
4458
4535
  }
4459
4536
  }) : null;
4460
- const attach = !!attachments && !attachments.disabled ? /* @__PURE__ */ jsxs(Fragment$1, { children: [fileField, inline ? /* @__PURE__ */ jsx(GlyphButton, {
4537
+ const attach = !!attachments && !attachments.disabled ? /* @__PURE__ */ jsxs(Fragment$1, { children: [fileField, lines ? /* @__PURE__ */ jsx(GlyphButton, {
4461
4538
  label: "Attach files",
4462
4539
  disabled,
4463
4540
  onClick: () => fileInput.current?.click(),
@@ -4471,7 +4548,7 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
4471
4548
  children: /* @__PURE__ */ jsx(Paperclip, { className: "size-4" })
4472
4549
  })] }) : null;
4473
4550
  const interrupting = busy && !canSend;
4474
- const submitButton = inline ? /* @__PURE__ */ jsx(GlyphButton, {
4551
+ const submitButton = lines ? /* @__PURE__ */ jsx(GlyphButton, {
4475
4552
  label: interrupting ? "Interrupt" : "Send",
4476
4553
  disabled: !interrupting && !canSend,
4477
4554
  onClick: interrupting ? onInterrupt : submit,
@@ -4492,24 +4569,81 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
4492
4569
  onClick: submit,
4493
4570
  children: /* @__PURE__ */ jsx(ArrowUp, { className: "size-4" })
4494
4571
  });
4572
+ const dropHandlers = {
4573
+ onDragOver: (e) => {
4574
+ if (attachments && !attachments.disabled) {
4575
+ e.preventDefault();
4576
+ setDragging(true);
4577
+ }
4578
+ },
4579
+ onDragLeave: () => setDragging(false),
4580
+ onDrop: (e) => {
4581
+ if (!attachments || attachments.disabled) return;
4582
+ e.preventDefault();
4583
+ setDragging(false);
4584
+ pick(e.dataTransfer.files);
4585
+ }
4586
+ };
4587
+ const errorRow = attachments?.error ? /* @__PURE__ */ jsxs("div", {
4588
+ className: cn("mx-auto mt-1 flex w-full max-w-[var(--wd-content-max-w,48rem)] items-center gap-2 text-label text-danger", lines && "px-2"),
4589
+ children: [
4590
+ /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3 shrink-0" }),
4591
+ /* @__PURE__ */ jsx("span", {
4592
+ className: "min-w-0 flex-1",
4593
+ children: attachments.error
4594
+ }),
4595
+ /* @__PURE__ */ jsx("button", {
4596
+ type: "button",
4597
+ onClick: attachments.dismissError,
4598
+ "aria-label": "Dismiss",
4599
+ className: "shrink-0 opacity-70 hover:opacity-100",
4600
+ children: /* @__PURE__ */ jsx(X, { className: "size-3" })
4601
+ })
4602
+ ]
4603
+ }) : null;
4604
+ if (lines) return /* @__PURE__ */ jsxs("div", {
4605
+ "data-slot": "composer",
4606
+ className: cn("shrink-0", className),
4607
+ children: [/* @__PURE__ */ jsx("div", {
4608
+ ...dropHandlers,
4609
+ className: cn("flex min-h-[38px] flex-col justify-center", "border-t border-border bg-bg transition-colors", "focus-within:border-t-accent", dragging && "border-t-accent", disabled && "opacity-60"),
4610
+ children: /* @__PURE__ */ jsxs("div", {
4611
+ className: "mx-auto w-full max-w-[var(--wd-content-max-w,48rem)] px-2 py-1",
4612
+ children: [
4613
+ staged.length > 0 && attachments ? /* @__PURE__ */ jsx(AttachmentStrip, { attachments }) : null,
4614
+ /* @__PURE__ */ jsxs("div", {
4615
+ className: "flex items-end gap-1",
4616
+ children: [
4617
+ attach,
4618
+ /* @__PURE__ */ jsx(PromptArea, {
4619
+ ...bind,
4620
+ triggers,
4621
+ onSubmit: submit,
4622
+ disabled,
4623
+ placeholder: disabled ? "Session ended" : placeholder,
4624
+ minHeight: 20,
4625
+ maxHeight: 192,
4626
+ "aria-label": "Message the agent",
4627
+ className: "min-w-0 flex-1 py-0.5 text-body-sm text-text",
4628
+ onImagePaste: (file) => attachments?.add([file])
4629
+ }),
4630
+ submitButton
4631
+ ]
4632
+ }),
4633
+ toolbar ? /* @__PURE__ */ jsx("div", {
4634
+ className: "flex min-w-0 items-center gap-1 pt-1",
4635
+ children: toolbar
4636
+ }) : null
4637
+ ]
4638
+ })
4639
+ }), errorRow]
4640
+ });
4495
4641
  return /* @__PURE__ */ jsxs("div", {
4496
4642
  "data-slot": "composer",
4497
4643
  className: cn("px-3 pb-3", className),
4498
4644
  children: [/* @__PURE__ */ jsxs("div", {
4499
- onDragOver: (e) => {
4500
- if (attachments && !attachments.disabled) {
4501
- e.preventDefault();
4502
- setDragging(true);
4503
- }
4504
- },
4505
- onDragLeave: () => setDragging(false),
4506
- onDrop: (e) => {
4507
- if (!attachments || attachments.disabled) return;
4508
- e.preventDefault();
4509
- setDragging(false);
4510
- pick(e.dataTransfer.files);
4511
- },
4512
- className: cn("mx-auto w-full max-w-[var(--wd-content-max-w,48rem)] overflow-hidden rounded-lg border border-border bg-bg shadow-(--shadow-xs)", "transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30", dragging && "border-ring ring-2 ring-ring/30", disabled && "opacity-60"),
4645
+ ...dropHandlers,
4646
+ className: cn("mx-auto w-full max-w-[var(--wd-content-max-w,48rem)] overflow-hidden border border-border bg-bg", "transition-colors rounded-lg shadow-(--shadow-xs)", "focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30", dragging && "border-ring ring-2 ring-ring/30", disabled && "opacity-60"),
4513
4647
  children: [staged.length > 0 && attachments ? /* @__PURE__ */ jsx(AttachmentStrip, { attachments }) : null, inline ? /* @__PURE__ */ jsxs("div", {
4514
4648
  className: "flex items-end gap-1 p-1",
4515
4649
  children: [
@@ -4546,27 +4680,7 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
4546
4680
  children: [attach, toolbar]
4547
4681
  }), submitButton]
4548
4682
  })] })]
4549
- }), attachments?.error ? /* @__PURE__ */ jsxs("div", {
4550
- className: "mx-auto mt-1 flex w-full max-w-[var(--wd-content-max-w,48rem)] items-center gap-2 text-label text-danger",
4551
- children: [
4552
- /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3 shrink-0" }),
4553
- /* @__PURE__ */ jsx("span", {
4554
- className: "min-w-0 flex-1",
4555
- children: attachments.error
4556
- }),
4557
- /* @__PURE__ */ jsx("button", {
4558
- type: "button",
4559
- onClick: attachments.dismissError,
4560
- "aria-label": "Dismiss",
4561
- className: "shrink-0 opacity-70 hover:opacity-100",
4562
- children: /* @__PURE__ */ jsx(X, { className: "size-3" })
4563
- })
4564
- ]
4565
- }) : /* @__PURE__ */ jsx("div", {
4566
- "data-slot": "composer-hint",
4567
- className: "mx-auto mt-1 w-full max-w-[var(--wd-content-max-w,48rem)] text-center text-label text-fg-4",
4568
- children: "Enter to send · Shift+Enter for a new line"
4569
- })]
4683
+ }), errorRow]
4570
4684
  });
4571
4685
  }
4572
4686
  /**
@@ -5557,78 +5671,6 @@ function isMutatingTool(toolName) {
5557
5671
  }
5558
5672
  }
5559
5673
  //#endregion
5560
- //#region src/components/agent/transcript-variant.tsx
5561
- const VariantContext = createContext("cards");
5562
- function TranscriptVariantProvider({ value, children }) {
5563
- return /* @__PURE__ */ jsx(VariantContext.Provider, {
5564
- value,
5565
- children
5566
- });
5567
- }
5568
- function useTranscriptVariant() {
5569
- return useContext(VariantContext);
5570
- }
5571
- /** True in `lines`, for the many `cond ? a : b` reads in the row components. */
5572
- function useLines() {
5573
- return useTranscriptVariant() === "lines";
5574
- }
5575
- const DensityContext = createContext("comfortable");
5576
- function TranscriptDensityProvider({ value, children }) {
5577
- return /* @__PURE__ */ jsx(DensityContext.Provider, {
5578
- value,
5579
- children
5580
- });
5581
- }
5582
- function useTranscriptDensity() {
5583
- return useContext(DensityContext);
5584
- }
5585
- /**
5586
- * The gap between two rows, per variant and density — the whole of the density
5587
- * feature, since it is the only vertical spacing between rows that exists.
5588
- *
5589
- * `className` goes on the **measured** wrapper (see `Transcript`), so the gap is
5590
- * part of each row's measured height and no pixel constant is load-bearing.
5591
- * `px` is fed to `estimateSize` alone, where being approximate is the contract:
5592
- * it sets the scrollbar's length before rows mount and is replaced by a real
5593
- * measurement the moment one does.
5594
- *
5595
- * `lines` + `compact` is the only combination with no gap at all: there the
5596
- * row's own `py-0.5` is the entire separation, which is what makes it compact.
5597
- */
5598
- const ROW_GAP = {
5599
- cards: {
5600
- comfortable: {
5601
- className: "pt-4",
5602
- px: 16
5603
- },
5604
- compact: {
5605
- className: "pt-2",
5606
- px: 8
5607
- }
5608
- },
5609
- lines: {
5610
- comfortable: {
5611
- className: "pt-4",
5612
- px: 16
5613
- },
5614
- compact: { px: 0 }
5615
- }
5616
- };
5617
- /**
5618
- * The left gutter of a line item: one glyph, fixed width, so every row's text
5619
- * starts on the same column no matter which kind of event it is. Decorative —
5620
- * the row's own text says what it is.
5621
- */
5622
- function LineGlyph({ children, className }) {
5623
- return /* @__PURE__ */ jsx("span", {
5624
- "aria-hidden": true,
5625
- className: cn("w-3.5 shrink-0 select-none text-center font-mono text-label leading-5 text-fg-4", className),
5626
- children
5627
- });
5628
- }
5629
- /** Body text metrics for a line item — tighter than the card variant's. */
5630
- const LINE_TEXT = "text-body-sm leading-5";
5631
- //#endregion
5632
5674
  //#region src/components/agent/Response.tsx
5633
5675
  /**
5634
5676
  * Markdown on a terminal's grid.
@@ -5801,7 +5843,7 @@ function LineOptionList({ options, focused, onFocus, onChoose, active = true, la
5801
5843
  className: cn("flex w-full items-baseline gap-2 text-left outline-none", isFocused ? "bg-surface-hover" : "hover:bg-surface-hover/60"),
5802
5844
  children: [
5803
5845
  /* @__PURE__ */ jsx(LineGlyph, {
5804
- className: isFocused ? "text-accent" : void 0,
5846
+ className: isFocused ? "text-fg-1" : void 0,
5805
5847
  children: isFocused ? "❯" : " "
5806
5848
  }),
5807
5849
  /* @__PURE__ */ jsx("span", {
@@ -5841,7 +5883,7 @@ function LineInput({ value, onChange, onSubmit, onCancel, placeholder }) {
5841
5883
  return /* @__PURE__ */ jsxs("div", {
5842
5884
  className: "flex items-baseline gap-2",
5843
5885
  children: [/* @__PURE__ */ jsx(LineGlyph, {
5844
- className: "text-accent",
5886
+ className: "text-fg-3",
5845
5887
  children: "›"
5846
5888
  }), /* @__PURE__ */ jsx("input", {
5847
5889
  autoFocus: true,
@@ -6259,7 +6301,7 @@ function QuestionPrompt({ request, onAnswer, onDismiss, className }) {
6259
6301
  children: [/* @__PURE__ */ jsxs("div", {
6260
6302
  className: "flex items-baseline gap-2",
6261
6303
  children: [/* @__PURE__ */ jsx(LineGlyph, {
6262
- className: "text-info",
6304
+ className: "text-fg-3",
6263
6305
  children: "?"
6264
6306
  }), /* @__PURE__ */ jsxs("span", {
6265
6307
  className: "min-w-0 flex-1 text-body-sm leading-5 text-fg-1",
@@ -6683,14 +6725,17 @@ function RateLimitMeter({ label, info, now }) {
6683
6725
  ]
6684
6726
  }),
6685
6727
  children: /* @__PURE__ */ jsxs("span", {
6686
- className: cn("inline-flex cursor-default items-center gap-1 font-mono text-label", info.status === "rejected" ? "text-danger" : utilizationColor(pct ?? 0)),
6728
+ className: cn("cursor-default font-mono text-label whitespace-nowrap", info.status === "rejected" ? "text-danger" : utilizationColor(pct ?? 0)),
6687
6729
  children: [
6688
- /* @__PURE__ */ jsx(ProgressRing, { value: pct ?? 0 }),
6730
+ /* @__PURE__ */ jsx(ProgressRing, {
6731
+ value: pct ?? 0,
6732
+ className: "mr-1 inline-block align-middle"
6733
+ }),
6689
6734
  label,
6690
6735
  pct !== void 0 ? ` ${pct.toFixed(0)}%` : "",
6691
6736
  resetsAtMs !== void 0 ? /* @__PURE__ */ jsxs("span", {
6692
6737
  className: "text-fg-4",
6693
- children: ["· ", formatCountdown(resetsAtMs, now)]
6738
+ children: [" · ", formatCountdown(resetsAtMs, now)]
6694
6739
  }) : null
6695
6740
  ]
6696
6741
  })
@@ -6704,11 +6749,11 @@ function Slot({ onClick, hint, children }) {
6704
6749
  type: "button",
6705
6750
  onClick,
6706
6751
  "aria-label": hint,
6707
- className: "rounded-md px-1 py-0.5 transition-colors outline-none hover:bg-surface-hover focus-visible:bg-surface-hover",
6752
+ className: "rounded-md py-0.5 leading-4 transition-colors outline-none hover:bg-surface-hover focus-visible:bg-surface-hover",
6708
6753
  children
6709
6754
  });
6710
6755
  }
6711
- function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext, onOpenUsage, actions, className }) {
6756
+ function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext, onOpenUsage, controls, actions, placement = "top", className }) {
6712
6757
  const meta = STATUS_META[state.status];
6713
6758
  const now = useNow();
6714
6759
  const session = state.rateLimits?.five_hour;
@@ -6716,7 +6761,7 @@ function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext,
6716
6761
  const link = connection ?? (connected === false ? "reconnecting" : "live");
6717
6762
  return /* @__PURE__ */ jsxs("div", {
6718
6763
  "data-slot": "status-bar",
6719
- className: cn("flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5", className),
6764
+ className: cn("flex h-[38px] items-baseline gap-2 border-border bg-surface p-1.5", placement === "bottom" ? "border-t" : "border-b", className),
6720
6765
  children: [
6721
6766
  /* @__PURE__ */ jsx(Slot, {
6722
6767
  onClick: onOpenStatus,
@@ -6724,11 +6769,13 @@ function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext,
6724
6769
  children: link === "live" ? /* @__PURE__ */ jsxs(Badge, {
6725
6770
  variant: meta.variant,
6726
6771
  dot: !meta.busy,
6727
- children: [meta.busy ? /* @__PURE__ */ jsx(Spinner, { className: "size-3 text-current" }) : null, meta.label]
6772
+ className: "items-baseline",
6773
+ children: [meta.busy ? /* @__PURE__ */ jsx(Spinner, { className: "size-3 self-center text-current" }) : null, meta.label]
6728
6774
  }) : /* @__PURE__ */ jsxs(Badge, {
6729
6775
  variant: link === "offline" ? "danger" : "warning",
6730
6776
  dot: false,
6731
- children: [link === "offline" ? /* @__PURE__ */ jsx(WifiOff, { className: "size-3 text-current" }) : /* @__PURE__ */ jsx(RefreshCw, { className: "size-3 animate-spin text-current" }), link === "offline" ? "Offline" : "Reconnecting…"]
6777
+ className: "items-baseline",
6778
+ children: [link === "offline" ? /* @__PURE__ */ jsx(WifiOff, { className: "size-3 self-center text-current" }) : /* @__PURE__ */ jsx(RefreshCw, { className: "size-3 animate-spin self-center text-current" }), link === "offline" ? "Offline" : "Reconnecting…"]
6732
6779
  })
6733
6780
  }),
6734
6781
  state.capabilities.contextUsage && state.contextUsage ? /* @__PURE__ */ jsx(Slot, {
@@ -6740,7 +6787,7 @@ function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext,
6740
6787
  onClick: onOpenUsage,
6741
6788
  hint: "Plan usage",
6742
6789
  children: /* @__PURE__ */ jsxs("span", {
6743
- className: "inline-flex items-center gap-2",
6790
+ className: "inline-flex items-baseline gap-2",
6744
6791
  children: [session ? /* @__PURE__ */ jsx(RateLimitMeter, {
6745
6792
  label: "Session",
6746
6793
  info: session,
@@ -6752,6 +6799,7 @@ function StatusBar({ state, connected, connection, onOpenStatus, onOpenContext,
6752
6799
  }) : null]
6753
6800
  })
6754
6801
  }) : null,
6802
+ controls,
6755
6803
  /* @__PURE__ */ jsx("span", { className: "flex-1" }),
6756
6804
  /* @__PURE__ */ jsx("span", {
6757
6805
  className: "font-mono text-label text-fg-3",
@@ -6975,7 +7023,7 @@ function Loader({ label, startedAt, tokens, className }) {
6975
7023
  "data-slot": "loader",
6976
7024
  className: cn("flex items-baseline gap-2", className),
6977
7025
  children: [/* @__PURE__ */ jsx(LineGlyph, {
6978
- className: "text-accent",
7026
+ className: lines ? "text-fg-3" : "text-accent",
6979
7027
  children: pulse
6980
7028
  }), /* @__PURE__ */ jsxs("span", {
6981
7029
  className: "min-w-0 flex-1 text-body-sm leading-5 text-fg-3",
@@ -7000,9 +7048,12 @@ function Loader({ label, startedAt, tokens, className }) {
7000
7048
  /**
7001
7049
  * One chat turn row.
7002
7050
  *
7003
- * `cards`: user messages sit right in a bubble; assistant content is flat,
7004
- * full-width (the AI-chat convention assistant output is the page, user input
7005
- * is quoted).
7051
+ * `cards`: user messages sit in a bubble, assistant content is flat and
7052
+ * full-width. Both are **left-aligned**: the transcript is a log read top to
7053
+ * bottom, and an editor-shaped host (a full-width session view beside a sessions
7054
+ * rail) has no right edge to anchor to — a bubble drifting right in a 1600px
7055
+ * column separates a prompt from the reply it produced. The bubble alone is
7056
+ * enough to say who spoke.
7006
7057
  *
7007
7058
  * `lines`: both are left-aligned full-width line items behind a gutter glyph —
7008
7059
  * `❯` for what was typed, `●` for what the model said. No bubble: a prompt is
@@ -7014,7 +7065,7 @@ function Message({ from, className, children, ...props }) {
7014
7065
  return /* @__PURE__ */ jsx("div", {
7015
7066
  "data-slot": "message",
7016
7067
  "data-from": from,
7017
- className: cn("flex w-full", lines ? cn("flex-row gap-2", from === "user" && "-mx-1 rounded-sm bg-surface px-1") : cn("flex-col gap-1", from === "user" ? "items-end" : "items-start"), className),
7068
+ className: cn("flex w-full", lines ? cn("flex-row gap-2", from === "user" && "-mx-1 rounded-sm bg-surface px-1") : "flex-col items-start gap-1", className),
7018
7069
  ...props,
7019
7070
  children: lines ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(LineGlyph, {
7020
7071
  className: from === "user" ? "text-accent" : "text-fg-3",
@@ -7028,7 +7079,7 @@ function Message({ from, className, children, ...props }) {
7028
7079
  function MessageContent({ className, ...props }) {
7029
7080
  return /* @__PURE__ */ jsx("div", {
7030
7081
  "data-slot": "message-content",
7031
- className: cn("min-w-0", useLines() ? cn("w-full text-fg-1", LINE_TEXT, "in-data-[from=user]:whitespace-pre-wrap") : cn("text-body-sm leading-6 text-fg-1", "in-data-[from=user]:max-w-[85%] in-data-[from=user]:rounded-lg in-data-[from=user]:rounded-br-sm", "in-data-[from=user]:bg-accent-bg in-data-[from=user]:px-3 in-data-[from=user]:py-2", "in-data-[from=user]:whitespace-pre-wrap", "in-data-[from=assistant]:w-full"), className),
7082
+ className: cn("min-w-0", useLines() ? cn("w-full text-fg-1", LINE_TEXT, "in-data-[from=user]:whitespace-pre-wrap") : cn("text-body-sm leading-6 text-fg-1", "in-data-[from=user]:max-w-[85%] in-data-[from=user]:rounded-lg in-data-[from=user]:rounded-bl-sm", "in-data-[from=user]:bg-accent-bg in-data-[from=user]:px-3 in-data-[from=user]:py-2", "in-data-[from=user]:whitespace-pre-wrap", "in-data-[from=assistant]:w-full"), className),
7032
7083
  ...props
7033
7084
  });
7034
7085
  }
@@ -7614,7 +7665,7 @@ function RecapRow({ line, since }) {
7614
7665
  "data-slot": "recap",
7615
7666
  className: "flex items-baseline gap-2 py-0.5",
7616
7667
  children: [/* @__PURE__ */ jsx(LineGlyph, {
7617
- className: "text-accent",
7668
+ className: "text-fg-3",
7618
7669
  children: "※"
7619
7670
  }), /* @__PURE__ */ jsxs("span", {
7620
7671
  className: "min-w-0 flex-1 text-label leading-5 text-fg-3",
@@ -7710,7 +7761,7 @@ function showLoader(state) {
7710
7761
  * References only — the bytes are fetched from the gateway. */
7711
7762
  function SentAttachments({ attachments, attachmentUrl }) {
7712
7763
  return /* @__PURE__ */ jsx("div", {
7713
- className: cn("mb-1 flex flex-wrap gap-1.5", useLines() ? "justify-start" : "justify-end"),
7764
+ className: "mb-1 flex flex-wrap justify-start gap-1.5",
7714
7765
  children: attachments.map((attachment) => {
7715
7766
  const href = attachmentUrl?.(attachment.id);
7716
7767
  return attachment.mediaType.startsWith("image/") && href ? /* @__PURE__ */ jsx("img", {
@@ -8052,10 +8103,11 @@ const INTERACTIVE = [
8052
8103
  * the engine name — an absent capability hides the control instead of offering
8053
8104
  * one that can only fail.
8054
8105
  */
8055
- function SessionPanel({ client, sessionId, header, panelSurface = "internal", statusSurface = "internal", onOpenPanel, onVitals, transcriptVariant = "cards", transcriptDensity = "comfortable", controlsSurface = "internal", onControls, focusComposerOnClick = false, unseen, className }) {
8106
+ function SessionPanel({ client, sessionId, header, panelSurface = "internal", statusSurface = "internal", statusPlacement = "top", onOpenPanel, onVitals, transcriptVariant = "cards", transcriptDensity = "comfortable", transcriptFont = "sans", controlsSurface = "internal", onControls, focusComposerOnClick = false, unseen, readOnly = false, toolHost, className }) {
8056
8107
  const external = panelSurface === "external";
8057
8108
  const statusExternal = statusSurface === "external";
8058
- const controlsExternal = controlsSurface === "external";
8109
+ const controlsInStatus = controlsSurface === "status" && !statusExternal;
8110
+ const controlsExternal = controlsSurface === "external" || controlsInStatus;
8059
8111
  const [protocolError, setProtocolError] = useState(void 0);
8060
8112
  const [panel, setPanel] = useState();
8061
8113
  const { state, connection, protocolMismatch, models, effectiveModel, handle, send, approve, deny, interrupt, setModel, setPermissionMode, reconnectNow } = useClaudeSession(client, sessionId, { onProtocolError: setProtocolError });
@@ -8078,7 +8130,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8078
8130
  document.addEventListener("visibilitychange", onVisible);
8079
8131
  return () => document.removeEventListener("visibilitychange", onVisible);
8080
8132
  }, [reconnectNow]);
8081
- useToolCallHost(handle);
8133
+ useToolCallHost(handle, toolHost === false ? { enabled: false } : toolHost);
8082
8134
  const capabilities = state.capabilities;
8083
8135
  const onVitalsRef = useRef(onVitals);
8084
8136
  onVitalsRef.current = onVitals;
@@ -8204,8 +8256,32 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8204
8256
  ] })] });
8205
8257
  const menu = external ? null : actionsMenu;
8206
8258
  const headerTakesActions = typeof header === "function";
8259
+ const sessionControls = /* @__PURE__ */ jsxs(Fragment$1, { children: [models.length ? /* @__PURE__ */ jsx(ModelSelect, {
8260
+ models,
8261
+ model: effectiveModel,
8262
+ onModelChange: setModel,
8263
+ disabled: ended,
8264
+ className: controlsInStatus ? "h-5" : void 0
8265
+ }) : null, state.permissionMode ? /* @__PURE__ */ jsx(PermissionModeSelect, {
8266
+ mode: state.permissionMode,
8267
+ onModeChange: setPermissionMode,
8268
+ modes: capabilities.permissionModes,
8269
+ canBypass: state.session?.canBypassPermissions,
8270
+ disabled: ended,
8271
+ className: controlsInStatus ? "h-5" : void 0
8272
+ }) : null] });
8273
+ const statusBar = statusExternal ? null : /* @__PURE__ */ jsx(StatusBar, {
8274
+ state,
8275
+ connection,
8276
+ placement: statusPlacement,
8277
+ controls: controlsInStatus && !readOnly ? sessionControls : void 0,
8278
+ onOpenStatus: external && !onOpenPanel ? void 0 : () => openPanel("info"),
8279
+ onOpenContext: external && !onOpenPanel ? void 0 : () => openPanel("context"),
8280
+ onOpenUsage: external && !onOpenPanel ? void 0 : () => openPanel("usage"),
8281
+ actions: headerTakesActions ? void 0 : menu
8282
+ });
8207
8283
  const handleClick = (event) => {
8208
- if (!focusComposerOnClick) return;
8284
+ if (!focusComposerOnClick || readOnly) return;
8209
8285
  if (event.target?.closest(INTERACTIVE)) return;
8210
8286
  if (window.getSelection()?.isCollapsed === false) return;
8211
8287
  composerRef.current?.focus();
@@ -8216,18 +8292,12 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8216
8292
  value: transcriptDensity,
8217
8293
  children: /* @__PURE__ */ jsxs("div", {
8218
8294
  "data-slot": "session-panel",
8295
+ "data-agent-font": transcriptFont,
8219
8296
  onClick: handleClick,
8220
8297
  className: cn("flex h-full min-h-0 flex-col overflow-hidden bg-bg", className),
8221
8298
  children: [
8222
8299
  headerTakesActions ? header({ actions: menu }) : header,
8223
- statusExternal ? null : /* @__PURE__ */ jsx(StatusBar, {
8224
- state,
8225
- connection,
8226
- onOpenStatus: external && !onOpenPanel ? void 0 : () => openPanel("info"),
8227
- onOpenContext: external && !onOpenPanel ? void 0 : () => openPanel("context"),
8228
- onOpenUsage: external && !onOpenPanel ? void 0 : () => openPanel("usage"),
8229
- actions: headerTakesActions ? void 0 : menu
8230
- }),
8300
+ statusPlacement === "top" ? statusBar : null,
8231
8301
  protocolMismatch !== void 0 ? /* @__PURE__ */ jsxs(Notice, {
8232
8302
  level: "warning",
8233
8303
  children: [
@@ -8265,7 +8335,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8265
8335
  children: [
8266
8336
  /* @__PURE__ */ jsx("span", {
8267
8337
  "aria-hidden": true,
8268
- className: "select-none text-accent",
8338
+ className: cn("select-none", transcriptVariant === "lines" ? "text-fg-3" : "text-accent"),
8269
8339
  children: "※"
8270
8340
  }),
8271
8341
  /* @__PURE__ */ jsxs("span", {
@@ -8292,7 +8362,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8292
8362
  ]
8293
8363
  })
8294
8364
  }) : null,
8295
- capabilities.interactiveApprovals && state.pendingApprovals.length > 0 ? /* @__PURE__ */ jsx("div", {
8365
+ !readOnly && capabilities.interactiveApprovals && state.pendingApprovals.length > 0 ? /* @__PURE__ */ jsx("div", {
8296
8366
  className: "px-3 pb-2",
8297
8367
  children: /* @__PURE__ */ jsx("div", {
8298
8368
  className: "mx-auto flex w-full max-w-[var(--wd-content-max-w,48rem)] flex-col gap-2",
@@ -8307,7 +8377,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8307
8377
  }, request.id))
8308
8378
  })
8309
8379
  }) : null,
8310
- /* @__PURE__ */ jsx(Composer, {
8380
+ readOnly ? null : /* @__PURE__ */ jsx(Composer, {
8311
8381
  ref: composerRef,
8312
8382
  onSend: handleSend,
8313
8383
  onInterrupt: interrupt,
@@ -8321,19 +8391,9 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
8321
8391
  limit: 8
8322
8392
  }) : void 0,
8323
8393
  layout: controlsExternal ? "inline" : "stacked",
8324
- toolbar: controlsExternal ? void 0 : /* @__PURE__ */ jsxs(Fragment$1, { children: [models.length ? /* @__PURE__ */ jsx(ModelSelect, {
8325
- models,
8326
- model: effectiveModel,
8327
- onModelChange: setModel,
8328
- disabled: ended
8329
- }) : null, state.permissionMode ? /* @__PURE__ */ jsx(PermissionModeSelect, {
8330
- mode: state.permissionMode,
8331
- onModeChange: setPermissionMode,
8332
- modes: capabilities.permissionModes,
8333
- canBypass: state.session?.canBypassPermissions,
8334
- disabled: ended
8335
- }) : null] })
8394
+ toolbar: controlsExternal ? void 0 : sessionControls
8336
8395
  }),
8396
+ statusPlacement === "bottom" ? statusBar : null,
8337
8397
  !external ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
8338
8398
  /* @__PURE__ */ jsx(SessionInfoDialog, {
8339
8399
  state,
@@ -8469,6 +8529,6 @@ function Notice({ level, onDismiss, children }) {
8469
8529
  });
8470
8530
  }
8471
8531
  //#endregion
8472
- export { Tip as $, PermissionModeSelect as A, commandTrigger as B, TranscriptDensityProvider as C, Button as Ct, isMutatingTool as D, useTranscriptVariant as E, McpDialog as F, plainTextToSegments as G, mentionTrigger as H, HostFilesDialog as I, Splitter as J, segmentsToPlainText as K, ContextDialog as L, permissionModeMeta as M, ModelSelect as N, toolIcon as O, SkillsDialog as P, copyText as Q, Composer as R, Response as S, badgeVariants as St, useTranscriptDensity as T, cn as Tt, usePromptAreaState as U, hashtagTrigger as V, PromptArea as W, Spinner as X, CodeBlock as Y, CopyButton as Z, SessionInfoDialog as _, SelectItemText as _t, SessionEmptyState as a, DialogContent as at, parseUserQuestions as b, Input as bt, Message as c, DialogTrigger as ct, FileCard as d, MenuItem as dt, TooltipContent as et, Conversation as f, MenuSeparator as ft, STATUS_META as g, SelectItem as gt, StatusBar as h, SelectContent as ht, ToolCallCard as i, DialogClose as it, permissionModeChoices as j, PERMISSION_MODES as k, MessageContent as l, Menu$1 as lt, ConversationScrollButton as m, Select$1 as mt, UsageDialog as n, Dialog$1 as nt, Reasoning as o, DialogHeader as ot, ConversationContent as p, MenuTrigger as pt, ProgressRing as q, Transcript as r, DialogBody as rt, PromptTokenText as s, DialogRow as st, SessionPanel as t, TooltipProvider as tt, Loader as u, MenuContent as ut, QUESTION_BEHAVIORS as v, SelectTrigger as vt, TranscriptVariantProvider as w, buttonVariants as wt, PermissionPrompt as x, Badge as xt, QuestionPrompt as y, SelectValue as yt, skillPrompt as z };
8532
+ export { Tip as $, SkillsDialog as A, commandTrigger as B, isMutatingTool as C, Button as Ct, permissionModeChoices as D, PermissionModeSelect as E, skillPrompt as F, plainTextToSegments as G, mentionTrigger as H, TranscriptDensityProvider as I, Splitter as J, segmentsToPlainText as K, TranscriptVariantProvider as L, HostFilesDialog as M, ContextDialog as N, permissionModeMeta as O, Composer as P, copyText as Q, useTranscriptDensity as R, Response as S, badgeVariants as St, PERMISSION_MODES as T, cn as Tt, usePromptAreaState as U, hashtagTrigger as V, PromptArea as W, Spinner as X, CodeBlock as Y, CopyButton as Z, SessionInfoDialog as _, SelectItemText as _t, SessionEmptyState as a, DialogContent as at, parseUserQuestions as b, Input as bt, Message as c, DialogTrigger as ct, FileCard as d, MenuItem as dt, TooltipContent as et, Conversation as f, MenuSeparator as ft, STATUS_META as g, SelectItem as gt, StatusBar as h, SelectContent as ht, ToolCallCard as i, DialogClose as it, McpDialog as j, ModelSelect as k, MessageContent as l, Menu$1 as lt, ConversationScrollButton as m, Select$1 as mt, UsageDialog as n, Dialog$1 as nt, Reasoning as o, DialogHeader as ot, ConversationContent as p, MenuTrigger as pt, ProgressRing as q, Transcript as r, DialogBody as rt, PromptTokenText as s, DialogRow as st, SessionPanel as t, TooltipProvider as tt, Loader as u, MenuContent as ut, QUESTION_BEHAVIORS as v, SelectTrigger as vt, toolIcon as w, buttonVariants as wt, PermissionPrompt as x, Badge as xt, QuestionPrompt as y, SelectValue as yt, useTranscriptVariant as z };
8473
8533
 
8474
- //# sourceMappingURL=SessionPanel-NQ8ksCfj.mjs.map
8534
+ //# sourceMappingURL=SessionPanel-DI1NO4l8.mjs.map