@streamoid/agent 0.5.15 → 0.5.16

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import React__default, { createContext, useContext, useRef, useLayoutEffect, useEffect, useId as useId$1, useInsertionEffect as useInsertionEffect$1, useMemo, useCallback, Children, isValidElement, useState, Fragment as Fragment$1, createElement, forwardRef, Component, memo as memo$2, createRef, cloneElement, useReducer, useTransition, useSyncExternalStore } from "react";
4
- import { ScThinkingStepIcon, ScSubAgent, ScInChatMessage, ScButton, ScFileField, ScTodoList, ScMediaSelect, ScMediaApproval, ScHDivider, ScSelection, ScCheckbox, ScSelect, ScTextField, ScTextArea, ScBriefCard, ScCxoCopilotLogo, ScOnlyField, ScMenuOptions } from "@streamoid/ui";
4
+ import { ScThinkingStepIcon, ScSubAgent, ScInChatMessage, ScButton, ScFileField, ScTodoList, ScMediaSelect, ScMediaApproval, ScHDivider, ScSelection, ScCheckbox, ScSelect, ScTextField, ScTextArea, ScOnlyField, ScMenuOptions } from "@streamoid/ui";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { createPortal, flushSync } from "react-dom";
7
7
  import { SiconDown, SiconClose, SiconAttach, SiconSearch, SiconPlus, SiconMore } from "@streamoid/icons";
@@ -130302,6 +130302,37 @@ function AppChain({ apps: e }) {
130302
130302
  ] })
130303
130303
  ] }, t)) });
130304
130304
  }
130305
+ function BriefCard({
130306
+ description: e,
130307
+ children: t,
130308
+ onActivate: n,
130309
+ className: o = "",
130310
+ ...s
130311
+ }) {
130312
+ return /* @__PURE__ */ jsx(
130313
+ "div",
130314
+ {
130315
+ role: "button",
130316
+ tabIndex: 0,
130317
+ onClick: n,
130318
+ onKeyDown: (c) => {
130319
+ c.key !== "Enter" && c.key !== " " || (c.preventDefault(), n());
130320
+ },
130321
+ className: [
130322
+ "sa-brief-card sa-brief-card group/brief cursor-pointer outline-none",
130323
+ "focus-visible:ring-2 focus-visible:ring-[var(--alias-border-focus)]",
130324
+ "focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--alias-surface-base)]",
130325
+ o
130326
+ ].join(" "),
130327
+ ...s,
130328
+ children: /* @__PURE__ */ jsxs("div", { className: "sa-brief-card-inner", children: [
130329
+ /* @__PURE__ */ jsx("span", { "aria-hidden": !0, className: "sa-brief-card-glow" }),
130330
+ /* @__PURE__ */ jsx("p", { className: "sa-brief-card-desc", children: e }),
130331
+ t && /* @__PURE__ */ jsx("div", { className: "mt-auto w-full pt-[10px]", children: t })
130332
+ ] })
130333
+ }
130334
+ );
130335
+ }
130305
130336
  function QuickPrompt({
130306
130337
  title: e,
130307
130338
  value: t,
@@ -130311,30 +130342,21 @@ function QuickPrompt({
130311
130342
  onClick: l,
130312
130343
  className: c = ""
130313
130344
  }) {
130314
- const f = t ?? e, h = n || e, g = useId$1(), b = (T) => {
130315
- T.key !== "Enter" && T.key !== " " || (T.preventDefault(), l?.(f));
130316
- }, E = /* @__PURE__ */ jsx(
130317
- ScBriefCard,
130345
+ const f = t ?? e, h = n || e, g = useId$1(), b = /* @__PURE__ */ jsx(
130346
+ BriefCard,
130318
130347
  {
130319
- role: "button",
130320
- tabIndex: 0,
130321
130348
  "aria-label": e,
130322
130349
  "aria-describedby": o ? g : void 0,
130323
130350
  description: h,
130324
- className: [
130325
- "cursor-pointer outline-none transition-transform",
130326
- "focus-visible:ring-2 focus-visible:ring-[var(--alias-border-focus)]",
130327
- "focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--alias-surface-base)]"
130328
- ].join(" "),
130329
- onClick: () => l?.(f),
130330
- onKeyDown: b
130351
+ onActivate: () => l?.(f),
130352
+ className: "min-h-0 flex-1",
130353
+ children: /* @__PURE__ */ jsx(AppChain, { apps: s })
130331
130354
  }
130332
- ), R = s.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mt-[6px] px-[2px]", children: /* @__PURE__ */ jsx(AppChain, { apps: s }) }) : null;
130355
+ );
130333
130356
  return o ? (
130334
130357
  // Same hover-reveal idiom as the Products pills below the composer.
130335
130358
  /* @__PURE__ */ jsxs("div", { className: `group relative flex flex-col ${c}`, "data-id": "quick-prompt", children: [
130336
- E,
130337
- R,
130359
+ b,
130338
130360
  /* @__PURE__ */ jsxs(
130339
130361
  "div",
130340
130362
  {
@@ -130362,10 +130384,7 @@ function QuickPrompt({
130362
130384
  }
130363
130385
  )
130364
130386
  ] })
130365
- ) : /* @__PURE__ */ jsxs("div", { className: `flex flex-col ${c}`, "data-id": "quick-prompt", children: [
130366
- E,
130367
- R
130368
- ] });
130387
+ ) : /* @__PURE__ */ jsx("div", { className: `flex flex-col ${c}`, "data-id": "quick-prompt", children: b });
130369
130388
  }
130370
130389
  const FIELD_RE = /^([A-Za-z][A-Za-z0-9 /&-]{0,40}?)\s*:\s*(.+)$/, UPLOAD_VERB_RE = /^(upload|attach|add|drop)\b/i;
130371
130390
  function splitSegments(e) {
@@ -130470,15 +130489,22 @@ function QuickPromptSkeleton({ className: e = "" }) {
130470
130489
  );
130471
130490
  }
130472
130491
  function EmptyChatHero() {
130473
- return /* @__PURE__ */ jsxs(
130492
+ return /* @__PURE__ */ jsx(
130474
130493
  "div",
130475
130494
  {
130476
- className: "flex w-full flex-col items-center gap-[24px]",
130495
+ className: "flex w-full flex-col items-center gap-[10px] pt-[110px]",
130477
130496
  "data-id": "empty-chat-hero",
130478
- children: [
130479
- /* @__PURE__ */ jsx(ScCxoCopilotLogo, {}),
130480
- /* @__PURE__ */ jsx("p", { className: "w-full text-center text-[18px] leading-[26px] text-[var(--alias-text---icons-primary)]", children: "Start with a task. Review outputs. Approve." })
130481
- ]
130497
+ children: /* @__PURE__ */ jsx("h1", { className: "m-0 w-full text-center text-[24px] font-semibold leading-[32px] tracking-[-0.01em] text-[var(--alias-text---icons-primary)]", children: "Run your retail operations from here." })
130498
+ }
130499
+ );
130500
+ }
130501
+ function EmptyChatSubheading() {
130502
+ return /* @__PURE__ */ jsx(
130503
+ "p",
130504
+ {
130505
+ "data-id": "empty-chat-subheading",
130506
+ className: "m-0 w-full pt-[12px] text-center text-[14px] leading-[20px] text-[var(--alias-text---icons-tertiary)]",
130507
+ children: "Plan, design, shoot, list. You decide what moves forward."
130482
130508
  }
130483
130509
  );
130484
130510
  }
@@ -130565,27 +130591,33 @@ function EmptyChatBelow({
130565
130591
  {
130566
130592
  role: "status",
130567
130593
  "aria-label": "Loading quick prompts",
130568
- className: "flex w-full min-w-0 flex-row flex-wrap items-start justify-center gap-[16px]",
130594
+ className: "flex w-full min-w-0 flex-row flex-wrap items-stretch justify-center gap-[16px]",
130569
130595
  children: Array.from({ length: QUICK_PROMPT_SKELETON_COUNT }).map((R, T) => /* @__PURE__ */ jsx(QuickPromptSkeleton, {}, `quick-prompt-skeleton-${T}`))
130570
130596
  }
130571
130597
  ) : (
130572
130598
  // No inner scroll container even when expanded: the chat pane
130573
130599
  // above already scrolls, and clipping here would cut off the
130574
130600
  // hover panel that says what each task needs.
130575
- t.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex w-full min-w-0 flex-row flex-wrap items-start justify-center gap-[16px]", children: t.map((R) => /* @__PURE__ */ jsx(
130576
- QuickPrompt,
130601
+ t.length > 0 && /* @__PURE__ */ jsx(
130602
+ "div",
130577
130603
  {
130578
- title: R.title,
130579
- value: R.value,
130580
- description: R.description,
130581
- icon: R.icon,
130582
- hints: readBriefHints(R.meta),
130583
- apps: readBriefApps(R.meta),
130584
- onClick: (T) => o?.(R, T),
130585
- className: "flex-1 basis-[220px] min-w-[220px]"
130586
- },
130587
- `${R.title}:${R.value ?? R.title}`
130588
- )) })
130604
+ className: "flex w-full min-w-0 flex-row flex-wrap items-stretch justify-center gap-[16px]",
130605
+ children: t.map((R) => /* @__PURE__ */ jsx(
130606
+ QuickPrompt,
130607
+ {
130608
+ title: R.title,
130609
+ value: R.value,
130610
+ description: R.description,
130611
+ icon: R.icon,
130612
+ hints: readBriefHints(R.meta),
130613
+ apps: readBriefApps(R.meta),
130614
+ onClick: (T) => o?.(R, T),
130615
+ className: "flex-1 basis-[220px] min-w-[220px]"
130616
+ },
130617
+ `${R.title}:${R.value ?? R.title}`
130618
+ ))
130619
+ }
130620
+ )
130589
130621
  )
130590
130622
  ] }),
130591
130623
  /* @__PURE__ */ jsxs("div", { className: "w-full pb-[8px]", children: [
@@ -130930,6 +130962,15 @@ function briefsForRole(e, t) {
130930
130962
  return !s || s === n;
130931
130963
  }) : e.filter((o) => !normalizeSpecializationKey(o.specialization_key));
130932
130964
  }
130965
+ const EMPTY_CHAT_BRIEF_LIMIT = 3;
130966
+ function pickEmptyChatBriefs(e, t, n = EMPTY_CHAT_BRIEF_LIMIT) {
130967
+ return e.map((o, s) => ({ brief: o, index: s })).sort((o, s) => {
130968
+ const l = +!normalizeSpecializationKey(o.brief.specialization_key) - +!normalizeSpecializationKey(s.brief.specialization_key);
130969
+ if (l !== 0) return l;
130970
+ const c = t(s.brief) - t(o.brief);
130971
+ return c !== 0 ? c : o.index - s.index;
130972
+ }).slice(0, n).map((o) => o.brief);
130973
+ }
130933
130974
  function extractClipboardImageFiles(e) {
130934
130975
  return e?.items ? Array.from(e.items).flatMap((t) => {
130935
130976
  if (t.kind !== "file" || !t.type.startsWith("image/"))
@@ -135159,7 +135200,10 @@ function ChatScreen() {
135159
135200
  }
135160
135201
  }
135161
135202
  return Wn;
135162
- }, [b, ki, Sn]), tu = En ? sr : Wt.filter((Ot) => Ot.show_in_empty_chat), Fu = En || Wt.some((Ot) => !Ot.show_in_empty_chat), Ws = useMemo(
135203
+ }, [b, ki, Sn]), tu = En ? sr : pickEmptyChatBriefs(
135204
+ Wt.filter((Ot) => Ot.show_in_empty_chat),
135205
+ (Ot) => readBriefApps(Ot.meta).length
135206
+ ), Fu = En || Wt.some((Ot) => !Ot.show_in_empty_chat), Ws = useMemo(
135163
135207
  () => ur.map((Ot) => ({ id: Ot.key, label: Ot.label })),
135164
135208
  [ur]
135165
135209
  ), ia = useMemo(() => {
@@ -136244,25 +136288,28 @@ function ChatScreen() {
136244
136288
  ]
136245
136289
  }
136246
136290
  ),
136247
- Ea && /* @__PURE__ */ jsx("div", { className: "mb-auto shrink-0 overflow-visible px-3 pb-4 sm:px-6", children: /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[800px]", children: /* @__PURE__ */ jsx(
136248
- EmptyChatBelow,
136249
- {
136250
- quickPrompts: tu.map((Ot) => ({
136251
- title: Ot.title,
136252
- description: Ot.text,
136253
- value: Ot.text,
136254
- meta: Ot.meta
136255
- })),
136256
- isLoadingQuickPrompts: En ? br : Tn,
136257
- onPromptCardClick: rp,
136258
- onToggleQuickPrompts: Fu ? Gc : void 0,
136259
- onManageQuickPromptsClick: Pu,
136260
- quickPromptsExpanded: En,
136261
- quickPromptRoles: Ws,
136262
- activeQuickPromptRole: ta,
136263
- onQuickPromptRoleChange: _r
136264
- }
136265
- ) }) })
136291
+ Ea && /* @__PURE__ */ jsx("div", { className: "mb-auto shrink-0 overflow-visible px-3 pb-4 sm:px-6", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-[800px]", children: [
136292
+ /* @__PURE__ */ jsx(EmptyChatSubheading, {}),
136293
+ /* @__PURE__ */ jsx(
136294
+ EmptyChatBelow,
136295
+ {
136296
+ quickPrompts: tu.map((Ot) => ({
136297
+ title: Ot.title,
136298
+ description: Ot.text,
136299
+ value: Ot.text,
136300
+ meta: Ot.meta
136301
+ })),
136302
+ isLoadingQuickPrompts: En ? br : Tn,
136303
+ onPromptCardClick: rp,
136304
+ onToggleQuickPrompts: Fu ? Gc : void 0,
136305
+ onManageQuickPromptsClick: Pu,
136306
+ quickPromptsExpanded: En,
136307
+ quickPromptRoles: Ws,
136308
+ activeQuickPromptRole: ta,
136309
+ onQuickPromptRoleChange: _r
136310
+ }
136311
+ )
136312
+ ] }) })
136266
136313
  ]
136267
136314
  }
136268
136315
  ),