@octaviaflow/core 3.1.0-beta.118 → 3.1.0-beta.119

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.
@@ -3832,10 +3832,10 @@ function NodeGlyph({ status }) {
3832
3832
  }
3833
3833
  }
3834
3834
  var ChatToolTrace = (0, import_react36.forwardRef)(
3835
- function ChatToolTrace2({ calls, summary, defaultOpen = false, className, ...rest }, ref) {
3835
+ function ChatToolTrace2({ calls, summary, defaultOpen = false, autoOpen = true, className, ...rest }, ref) {
3836
3836
  const count = calls?.length ?? 0;
3837
3837
  const running = (calls ?? []).some((c) => c.status === "running" || c.status === "pending");
3838
- const [open, setOpen] = (0, import_react36.useState)(defaultOpen || running);
3838
+ const [open, setOpen] = (0, import_react36.useState)(defaultOpen || autoOpen && running);
3839
3839
  const defaultSummary = running ? "Working\u2026" : `Used ${count} ${count === 1 ? "tool" : "tools"}`;
3840
3840
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3841
3841
  "details",
@@ -4168,6 +4168,36 @@ function AssistantHeaderButton({
4168
4168
  }
4169
4169
  );
4170
4170
  }
4171
+ function stepSummary(steps) {
4172
+ const running = steps.find((s) => s.status === "running" || s.status === "pending");
4173
+ if (running) return running.name;
4174
+ const only = steps.length === 1 ? steps[0] : void 0;
4175
+ if (!only) return void 0;
4176
+ return only.result == null ? only.name : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4177
+ only.name,
4178
+ " \xB7 ",
4179
+ only.result
4180
+ ] });
4181
+ }
4182
+ function ReplyText({ message }) {
4183
+ return typeof message.content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4184
+ "span",
4185
+ {
4186
+ className: cn("ods-assistant__text", message.streaming && "ods-assistant__text--streaming"),
4187
+ children: message.content
4188
+ }
4189
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4190
+ "div",
4191
+ {
4192
+ className: cn(
4193
+ "ods-assistant__text",
4194
+ "ods-assistant__text--rich",
4195
+ message.streaming && "ods-assistant__text--streaming"
4196
+ ),
4197
+ children: message.content
4198
+ }
4199
+ );
4200
+ }
4171
4201
  function Block({
4172
4202
  block,
4173
4203
  busy,
@@ -4217,6 +4247,7 @@ function AssistantConversation({
4217
4247
  context,
4218
4248
  aura = "normal",
4219
4249
  hideHeader = false,
4250
+ layout = "comfortable",
4220
4251
  state: stateProp,
4221
4252
  greeting,
4222
4253
  suggestions,
@@ -4241,8 +4272,10 @@ function AssistantConversation({
4241
4272
  const state = stateProp ?? assistantStateOf(messages, busy, typing, { error: Boolean(error) });
4242
4273
  const statusLine = STATE_LINE[state] || subtitle;
4243
4274
  const tone = STATUS_TONE[state];
4275
+ const compact = layout === "compact";
4276
+ const said = (body) => compact ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ods-assistant__answer", children: body }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatBubble, { variant: "bot", hideAvatar: true, children: body });
4244
4277
  const header = hideHeader ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "ods-assistant__header", children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AssistantOrb, { state, size: "md", children: avatar }),
4278
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AssistantOrb, { state, size: compact ? "sm" : "md", children: avatar }),
4246
4279
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "ods-assistant__heading", children: [
4247
4280
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { id: nameId, className: "ods-assistant__name", children: name }),
4248
4281
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -4257,34 +4290,14 @@ function AssistantConversation({
4257
4290
  actions && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ods-assistant__actions", children: actions })
4258
4291
  ] });
4259
4292
  const thread = /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4260
- greeting && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatBubble, { variant: "bot", hideAvatar: true, children: greeting }),
4293
+ greeting && said(greeting),
4261
4294
  messages.map(
4262
4295
  (m) => m.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatBubble, { variant: "user", hideAvatar: true, children: m.content }, m.id) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "ods-assistant__reply", children: [
4263
- m.steps && m.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatToolTrace, { calls: m.steps }),
4264
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatBubble, { variant: "bot", hideAvatar: true, children: m.content ? (
4265
- // Plain text keeps its line breaks; rendered content (markdown,
4266
- // lists) is block content and lays out its own lines.
4267
- typeof m.content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4268
- "span",
4269
- {
4270
- className: cn(
4271
- "ods-assistant__text",
4272
- m.streaming && "ods-assistant__text--streaming"
4273
- ),
4274
- children: m.content
4275
- }
4276
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4277
- "div",
4278
- {
4279
- className: cn(
4280
- "ods-assistant__text",
4281
- "ods-assistant__text--rich",
4282
- m.streaming && "ods-assistant__text--streaming"
4283
- ),
4284
- children: m.content
4285
- }
4286
- )
4287
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatThinking, { variant: "shimmer", label: m.status || "Thinking\u2026", size: "sm" }) }),
4296
+ m.steps && m.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatToolTrace, { calls: m.steps, summary: stepSummary(m.steps), autoOpen: false }),
4297
+ m.content ? said(/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ReplyText, { message: m })) : (
4298
+ // While a step runs, its line already says what is happening.
4299
+ !m.steps?.some((st) => st.status === "running") && said(/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatThinking, { variant: "shimmer", label: m.status || "Thinking\u2026", size: "sm" }))
4300
+ ),
4288
4301
  m.blocks && m.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ods-assistant__blocks", children: m.blocks.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4289
4302
  Block,
4290
4303
  {
@@ -4325,7 +4338,7 @@ function AssistantConversation({
4325
4338
  ...rest,
4326
4339
  state,
4327
4340
  intensity: aura,
4328
- className: cn("ods-assistant", className),
4341
+ className: cn("ods-assistant", compact && "ods-assistant--compact", className),
4329
4342
  children: replacement ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "ods-assistant__replacement", children: [
4330
4343
  header,
4331
4344
  context && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ods-assistant__context", children: context }),