@workerdeck/ui 0.7.0 → 0.9.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/build/index.d.mts CHANGED
@@ -603,11 +603,16 @@ interface TranscriptProps {
603
603
  /** Builds the download URL for a delivered file (see FileCard). Typically
604
604
  * `(path) => client.sessionFileUrl(sessionId, path)`. */
605
605
  fileUrl?: (path: string) => string;
606
+ /** Builds the URL for an uploaded attachment. Typically
607
+ * `(id) => client.attachmentUrl(sessionId, id)`. Same-origin and
608
+ * cookie-authenticated, which is what lets an `<img src>` render one. */
609
+ attachmentUrl?: (attachmentId: string) => string;
606
610
  className?: string;
607
611
  }
608
612
  declare function Transcript({
609
613
  state,
610
614
  fileUrl,
615
+ attachmentUrl,
611
616
  className
612
617
  }: TranscriptProps): _$react.JSX.Element;
613
618
  //#endregion
package/build/index.mjs CHANGED
@@ -5015,11 +5015,14 @@ function NoticeRow({ item }) {
5015
5015
  children: item.text
5016
5016
  });
5017
5017
  }
5018
- function TranscriptItemView({ item, fileUrl }) {
5018
+ function TranscriptItemView({ item, fileUrl, attachmentUrl }) {
5019
5019
  switch (item.kind) {
5020
- case "user": return /* @__PURE__ */ jsx(Message, {
5020
+ case "user": return /* @__PURE__ */ jsxs(Message, {
5021
5021
  from: "user",
5022
- children: /* @__PURE__ */ jsx(MessageContent, { children: item.text })
5022
+ children: [item.attachments?.length ? /* @__PURE__ */ jsx(SentAttachments, {
5023
+ attachments: item.attachments,
5024
+ attachmentUrl
5025
+ }) : null, item.text ? /* @__PURE__ */ jsx(MessageContent, { children: item.text }) : null]
5023
5026
  });
5024
5027
  case "assistant_text": return /* @__PURE__ */ jsx(Message, {
5025
5028
  from: "assistant",
@@ -5052,7 +5055,25 @@ function showLoader(state) {
5052
5055
  if (last.kind === "thinking" && last.id === "streaming-thinking") return false;
5053
5056
  return last.kind !== "turn_result" || state.status === "running";
5054
5057
  }
5055
- function Transcript({ state, fileUrl, className }) {
5058
+ /** Files sent with a message: thumbnails for images, named chips for the rest.
5059
+ * References only — the bytes are fetched from the gateway. */
5060
+ function SentAttachments({ attachments, attachmentUrl }) {
5061
+ return /* @__PURE__ */ jsx("div", {
5062
+ className: "mb-1 flex flex-wrap justify-end gap-1.5",
5063
+ children: attachments.map((attachment) => {
5064
+ const href = attachmentUrl?.(attachment.id);
5065
+ return attachment.mediaType.startsWith("image/") && href ? /* @__PURE__ */ jsx("img", {
5066
+ src: href,
5067
+ alt: attachment.name,
5068
+ className: "size-20 rounded-md border border-border object-cover"
5069
+ }, attachment.id) : /* @__PURE__ */ jsx("span", {
5070
+ className: "rounded-full border border-border bg-surface px-2.5 py-1 text-body-xs text-fg-3",
5071
+ children: attachment.name
5072
+ }, attachment.id);
5073
+ })
5074
+ });
5075
+ }
5076
+ function Transcript({ state, fileUrl, attachmentUrl, className }) {
5056
5077
  return /* @__PURE__ */ jsxs(Conversation, {
5057
5078
  className,
5058
5079
  children: [/* @__PURE__ */ jsxs(ConversationContent, { children: [state.items.length === 0 && state.status !== "starting" ? /* @__PURE__ */ jsx("div", {
@@ -5060,7 +5081,8 @@ function Transcript({ state, fileUrl, className }) {
5060
5081
  children: "No messages yet."
5061
5082
  }) : state.items.map((item) => /* @__PURE__ */ jsx(TranscriptItemView, {
5062
5083
  item,
5063
- fileUrl
5084
+ fileUrl,
5085
+ attachmentUrl
5064
5086
  }, `${item.kind}:${item.id}`)), showLoader(state) ? /* @__PURE__ */ jsx(Loader, { label: state.status === "starting" ? "Starting session…" : void 0 }) : null] }), /* @__PURE__ */ jsx(ConversationScrollButton, {})]
5065
5087
  });
5066
5088
  }
@@ -5123,7 +5145,8 @@ function SessionPanel({ client, sessionId, header, className }) {
5123
5145
  }) : null,
5124
5146
  /* @__PURE__ */ jsx(Transcript, {
5125
5147
  state,
5126
- fileUrl: sessionId ? (path) => client.sessionFileUrl(sessionId, path) : void 0
5148
+ fileUrl: sessionId ? (path) => client.sessionFileUrl(sessionId, path) : void 0,
5149
+ attachmentUrl: sessionId ? (id) => client.attachmentUrl(sessionId, id) : void 0
5127
5150
  }),
5128
5151
  state.pendingApprovals.length > 0 ? /* @__PURE__ */ jsx("div", {
5129
5152
  className: "px-3 pb-2",