@page-speed/agent-everywhere 0.6.0 → 0.8.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 +16 -3
- package/dist/index.cjs +169 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -8
- package/dist/index.d.ts +47 -8
- package/dist/index.js +169 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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).
|
|
179
|
-
|
|
180
|
-
in your own chrome
|
|
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
|
|
@@ -187,6 +195,11 @@ Every region is independently optional and controllable:
|
|
|
187
195
|
optional attach affordance (`onAttach`), and a circular send button. Pass
|
|
188
196
|
`composer={false}` to drop it, a node to replace it, or `onComposerSubmit`
|
|
189
197
|
to intercept submits.
|
|
198
|
+
- **Loading states**: render `<AgentWorkspaceSkeleton/>` while the page's data
|
|
199
|
+
loads — it mirrors the workspace geometry (panel rails, header, dock) with
|
|
200
|
+
pulsing placeholders so the resolved layout doesn't shift. Pass `children`
|
|
201
|
+
for a custom center skeleton, and `leftPanel={false}` / `rightPanel={false}`
|
|
202
|
+
/ `composer={false}` to match the page's configuration.
|
|
190
203
|
- **Programmatic control** from anywhere inside: `useAgentWorkspace()` exposes
|
|
191
204
|
`toggleLeftPanel`, `setRightPanelOpen`, `openConversation`,
|
|
192
205
|
`closeConversation`, and friends for dynamic layout scenarios.
|
package/dist/index.cjs
CHANGED
|
@@ -8753,12 +8753,15 @@ function AgentWorkspace({
|
|
|
8753
8753
|
rightPanelOpen: rightPanelOpenProp,
|
|
8754
8754
|
onLeftPanelOpenChange,
|
|
8755
8755
|
onRightPanelOpenChange,
|
|
8756
|
-
showPanelToggles =
|
|
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
|
|
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.
|
|
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
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
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
|
] }),
|
|
@@ -8983,6 +9011,96 @@ function AgentWorkspace({
|
|
|
8983
9011
|
}
|
|
8984
9012
|
) });
|
|
8985
9013
|
}
|
|
9014
|
+
var Pulse = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("animate-pulse rounded-md bg-muted", className) });
|
|
9015
|
+
var PanelSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", children: [
|
|
9016
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center justify-between px-4 pb-2 pt-4", children: [
|
|
9017
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-5 w-28" }),
|
|
9018
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "size-8 rounded-lg" })
|
|
9019
|
+
] }),
|
|
9020
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 grow space-y-4 overflow-hidden px-4 py-3", children: [3, 6].map((rows, section) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
9021
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3 w-24" }),
|
|
9022
|
+
Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
9023
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "size-4 shrink-0 rounded-full" }),
|
|
9024
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 grow space-y-1.5", children: [
|
|
9025
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3.5 w-3/4" }),
|
|
9026
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3 w-1/2" })
|
|
9027
|
+
] })
|
|
9028
|
+
] }, i))
|
|
9029
|
+
] }, section)) }),
|
|
9030
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 space-y-2 border-t border-border px-4 py-3", children: [
|
|
9031
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3 w-full" }),
|
|
9032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3 w-2/3" })
|
|
9033
|
+
] })
|
|
9034
|
+
] });
|
|
9035
|
+
var DefaultContentSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 p-6", children: [
|
|
9036
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9037
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-8 w-40" }),
|
|
9038
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-8 w-28" }),
|
|
9039
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "ml-auto h-8 w-20" })
|
|
9040
|
+
] }),
|
|
9041
|
+
Array.from({ length: 9 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-10 w-full" }, i))
|
|
9042
|
+
] });
|
|
9043
|
+
function AgentWorkspaceSkeleton({
|
|
9044
|
+
leftPanel = true,
|
|
9045
|
+
rightPanel = true,
|
|
9046
|
+
leftPanelWidth = 320,
|
|
9047
|
+
rightPanelWidth = 460,
|
|
9048
|
+
showHeader = true,
|
|
9049
|
+
composer = true,
|
|
9050
|
+
children,
|
|
9051
|
+
className
|
|
9052
|
+
}) {
|
|
9053
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9054
|
+
"div",
|
|
9055
|
+
{
|
|
9056
|
+
"data-workspace-skeleton": "",
|
|
9057
|
+
className: cn(
|
|
9058
|
+
"flex h-full w-full overflow-hidden bg-background text-foreground",
|
|
9059
|
+
className
|
|
9060
|
+
),
|
|
9061
|
+
children: [
|
|
9062
|
+
leftPanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9063
|
+
"aside",
|
|
9064
|
+
{
|
|
9065
|
+
"aria-hidden": true,
|
|
9066
|
+
className: "hidden h-full shrink-0 overflow-hidden border-r border-border lg:block",
|
|
9067
|
+
style: { width: leftPanelWidth },
|
|
9068
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PanelSkeleton, {})
|
|
9069
|
+
}
|
|
9070
|
+
),
|
|
9071
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-w-0 grow flex-col", children: [
|
|
9072
|
+
showHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2.5", children: [
|
|
9073
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
9074
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "hidden size-8 rounded-lg lg:block" }),
|
|
9075
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "size-7 rounded-md" }),
|
|
9076
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
9077
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-4 w-36" }),
|
|
9078
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-3 w-20" })
|
|
9079
|
+
] })
|
|
9080
|
+
] }),
|
|
9081
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
9082
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-8 w-20 rounded-md" }),
|
|
9083
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "size-8 rounded-lg" }),
|
|
9084
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "size-8 rounded-lg" }),
|
|
9085
|
+
/* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "hidden size-8 rounded-lg lg:block" })
|
|
9086
|
+
] })
|
|
9087
|
+
] }),
|
|
9088
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 grow overflow-hidden", children: children ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultContentSkeleton, {}) }),
|
|
9089
|
+
composer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-t border-border px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto w-full max-w-3xl", children: /* @__PURE__ */ jsxRuntime.jsx(Pulse, { className: "h-[52px] w-full rounded-2xl" }) }) })
|
|
9090
|
+
] }),
|
|
9091
|
+
rightPanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9092
|
+
"aside",
|
|
9093
|
+
{
|
|
9094
|
+
"aria-hidden": true,
|
|
9095
|
+
className: "hidden h-full shrink-0 overflow-hidden border-l border-border lg:block",
|
|
9096
|
+
style: { width: rightPanelWidth },
|
|
9097
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PanelSkeleton, {})
|
|
9098
|
+
}
|
|
9099
|
+
)
|
|
9100
|
+
]
|
|
9101
|
+
}
|
|
9102
|
+
);
|
|
9103
|
+
}
|
|
8986
9104
|
|
|
8987
9105
|
exports.AgentAvatar = AgentAvatar;
|
|
8988
9106
|
exports.AgentComposer = AgentComposer;
|
|
@@ -8993,6 +9111,7 @@ exports.AgentSurface = AgentSurface;
|
|
|
8993
9111
|
exports.AgentWorkspace = AgentWorkspace;
|
|
8994
9112
|
exports.AgentWorkspaceComposer = AgentWorkspaceComposer;
|
|
8995
9113
|
exports.AgentWorkspacePanelToggle = AgentWorkspacePanelToggle;
|
|
9114
|
+
exports.AgentWorkspaceSkeleton = AgentWorkspaceSkeleton;
|
|
8996
9115
|
exports.AllocationBreakdown = AllocationBreakdown;
|
|
8997
9116
|
exports.AnalyticsDashboard = AnalyticsDashboard;
|
|
8998
9117
|
exports.Avatar = Avatar;
|