@page-speed/agent-everywhere 0.6.0 → 0.7.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/README.md CHANGED
@@ -171,13 +171,21 @@ import {
171
171
 
172
172
  Every region is independently optional and controllable:
173
173
 
174
+ - **Workspace header** is persistent across the page and conversation states
175
+ so the chrome stays uniform: the left panel toggle, icon, title
176
+ (`conversationTitle`), and status line on the left; `headerActions` (your
177
+ page's primary action, e.g. a "+ New" button), the session reset, the
178
+ conversation chevron, and the right panel toggle on the right. Override the
179
+ status line with `headerStatus` (useful disconnected), or hide the bar with
180
+ `showHeader={false}`.
174
181
  - **Panels** collapse/expand with a smooth width-collapse animation (the
175
182
  outer rail animates to `0` while the inner wrapper keeps its open width, so
176
183
  content clips out instead of reflowing). Uncontrolled by default;
177
184
  controlled via `leftPanelOpen`/`onLeftPanelOpenChange` (and the right-side
178
- equivalents). Built-in floating toggles render in the top corners
179
- (`showPanelToggles={false}` to place `<AgentWorkspacePanelToggle side="…"/>`
180
- in your own chrome). Panels are gated to `lg:` viewports.
185
+ equivalents). The header hosts a toggle at each end; opt into extra
186
+ floating toggles with `showPanelToggles`, or place
187
+ `<AgentWorkspacePanelToggle side="…"/>` in your own chrome. Panels are
188
+ gated to `lg:` viewports.
181
189
  - **Conversation layer** auto-opens on the first submit (or `activate()`),
182
190
  can be minimized back to the page without ending the session (a
183
191
  "View conversation" chip appears in the dock), and accepts a custom node via
package/dist/index.cjs CHANGED
@@ -8753,12 +8753,15 @@ function AgentWorkspace({
8753
8753
  rightPanelOpen: rightPanelOpenProp,
8754
8754
  onLeftPanelOpenChange,
8755
8755
  onRightPanelOpenChange,
8756
- showPanelToggles = true,
8756
+ showPanelToggles = false,
8757
+ showHeader,
8758
+ showConversationHeader,
8759
+ headerActions,
8760
+ headerStatus,
8757
8761
  conversation,
8758
8762
  conversationOpen: conversationOpenProp,
8759
8763
  onConversationOpenChange,
8760
8764
  conversationTitle = "AI Assistant",
8761
- showConversationHeader = true,
8762
8765
  composer = true,
8763
8766
  composerPlaceholder,
8764
8767
  composerHint,
@@ -8830,7 +8833,8 @@ function AgentWorkspace({
8830
8833
  onSubmit: onComposerSubmit
8831
8834
  }
8832
8835
  ) : composer;
8833
- const statusLine = agent ? agent.error ?? agent.statusLabel : null;
8836
+ const headerVisible = showHeader ?? showConversationHeader ?? true;
8837
+ const statusLine = headerStatus ?? (agent ? agent.error ?? agent.statusLabel : null);
8834
8838
  return /* @__PURE__ */ jsxRuntime.jsx(AgentWorkspaceContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsxs(
8835
8839
  "div",
8836
8840
  {
@@ -8869,6 +8873,69 @@ function AgentWorkspace({
8869
8873
  className: "border border-border/60 bg-background/80 shadow-sm backdrop-blur"
8870
8874
  }
8871
8875
  ) }),
8876
+ headerVisible && /* @__PURE__ */ jsxRuntime.jsxs(
8877
+ "div",
8878
+ {
8879
+ "data-workspace-header": "",
8880
+ className: "flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-3 py-2.5",
8881
+ children: [
8882
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
8883
+ hasLeftPanel && /* @__PURE__ */ jsxRuntime.jsx(
8884
+ AgentWorkspacePanelToggle,
8885
+ {
8886
+ side: "left",
8887
+ className: "hidden lg:flex"
8888
+ }
8889
+ ),
8890
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "size-3.5" }) }),
8891
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
8892
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-medium", children: conversationTitle }),
8893
+ statusLine && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-muted-foreground", children: statusLine })
8894
+ ] })
8895
+ ] }),
8896
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
8897
+ headerActions,
8898
+ agent && /* @__PURE__ */ jsxRuntime.jsx(
8899
+ "button",
8900
+ {
8901
+ type: "button",
8902
+ onClick: () => agent.reset(),
8903
+ "aria-label": "Start a new conversation",
8904
+ title: "New conversation",
8905
+ className: "flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
8906
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "size-4" })
8907
+ }
8908
+ ),
8909
+ /* @__PURE__ */ jsxRuntime.jsx(
8910
+ "button",
8911
+ {
8912
+ type: "button",
8913
+ onClick: () => setConversationOpen(!conversationOpen),
8914
+ "aria-label": conversationOpen ? "Hide conversation" : "Show conversation",
8915
+ title: conversationOpen ? "Hide conversation" : "Show conversation",
8916
+ className: "flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
8917
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8918
+ lucideReact.ChevronDown,
8919
+ {
8920
+ className: cn(
8921
+ "size-4 transition-transform duration-200",
8922
+ !conversationOpen && "rotate-180"
8923
+ )
8924
+ }
8925
+ )
8926
+ }
8927
+ ),
8928
+ hasRightPanel && /* @__PURE__ */ jsxRuntime.jsx(
8929
+ AgentWorkspacePanelToggle,
8930
+ {
8931
+ side: "right",
8932
+ className: "hidden lg:flex"
8933
+ }
8934
+ )
8935
+ ] })
8936
+ ]
8937
+ }
8938
+ ),
8872
8939
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative min-h-0 grow", children: [
8873
8940
  /* @__PURE__ */ jsxRuntime.jsx(
8874
8941
  "div",
@@ -8879,7 +8946,7 @@ function AgentWorkspace({
8879
8946
  children
8880
8947
  }
8881
8948
  ),
8882
- /* @__PURE__ */ jsxRuntime.jsxs(
8949
+ /* @__PURE__ */ jsxRuntime.jsx(
8883
8950
  "div",
8884
8951
  {
8885
8952
  "data-state": conversationOpen ? "open" : "closed",
@@ -8890,52 +8957,13 @@ function AgentWorkspace({
8890
8957
  conversationOpen ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-8 opacity-0",
8891
8958
  conversationClassName
8892
8959
  ),
8893
- children: [
8894
- showConversationHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2.5", children: [
8895
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
8896
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "size-3.5" }) }),
8897
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
8898
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-medium", children: conversationTitle }),
8899
- statusLine && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-muted-foreground", children: statusLine })
8900
- ] })
8901
- ] }),
8902
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
8903
- (hasLeftPanel || hasRightPanel) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mr-1 hidden items-center gap-1 border-r border-border pr-2 lg:flex", children: [
8904
- /* @__PURE__ */ jsxRuntime.jsx(AgentWorkspacePanelToggle, { side: "left" }),
8905
- /* @__PURE__ */ jsxRuntime.jsx(AgentWorkspacePanelToggle, { side: "right" })
8906
- ] }),
8907
- agent && /* @__PURE__ */ jsxRuntime.jsx(
8908
- "button",
8909
- {
8910
- type: "button",
8911
- onClick: () => agent.reset(),
8912
- "aria-label": "Start a new conversation",
8913
- title: "New conversation",
8914
- className: "flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
8915
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "size-4" })
8916
- }
8917
- ),
8918
- /* @__PURE__ */ jsxRuntime.jsx(
8919
- "button",
8920
- {
8921
- type: "button",
8922
- onClick: () => setConversationOpen(false),
8923
- "aria-label": "Hide conversation",
8924
- title: "Hide conversation",
8925
- className: "flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
8926
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" })
8927
- }
8928
- )
8929
- ] })
8930
- ] }),
8931
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 grow", children: conversation ?? /* @__PURE__ */ jsxRuntime.jsx(
8932
- AgentConversation,
8933
- {
8934
- contentClassName: "mx-auto w-full max-w-3xl",
8935
- showAvatars: true
8936
- }
8937
- ) })
8938
- ]
8960
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 grow", children: conversation ?? /* @__PURE__ */ jsxRuntime.jsx(
8961
+ AgentConversation,
8962
+ {
8963
+ contentClassName: "mx-auto w-full max-w-3xl",
8964
+ showAvatars: true
8965
+ }
8966
+ ) })
8939
8967
  }
8940
8968
  )
8941
8969
  ] }),