@page-speed/agent-everywhere 0.5.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 +58 -0
- package/dist/index.cjs +464 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +153 -1
- package/dist/index.d.ts +153 -1
- package/dist/index.js +461 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -141,6 +141,64 @@ run fully controlled with no provider. For 100%-custom UI, read the session
|
|
|
141
141
|
directly with `useNativeAgent()`. The connection is lazy by default
|
|
142
142
|
(`connectionStrategy="eager"` to pre-connect on mount).
|
|
143
143
|
|
|
144
|
+
### AgentWorkspace — the page-level AI layout wrapper
|
|
145
|
+
|
|
146
|
+
`AgentWorkspace` composes the native pieces into a full workspace layout: an
|
|
147
|
+
optional left panel, the host's page content in a growing center column with the
|
|
148
|
+
prompt composer docked at the bottom, an optional right panel, and a
|
|
149
|
+
conversation layer that **slides in over the center content** when the shared
|
|
150
|
+
session activates (and slides away on `reset()`).
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import {
|
|
154
|
+
NativeAgentProvider,
|
|
155
|
+
AgentWorkspace,
|
|
156
|
+
AgentWorkspacePanelToggle,
|
|
157
|
+
} from '@page-speed/agent-everywhere';
|
|
158
|
+
|
|
159
|
+
<NativeAgentProvider resolveSocketUrl={resolveSocketUrl} websiteId={id} pageCategoryId="pages">
|
|
160
|
+
<AgentWorkspace
|
|
161
|
+
className="h-dvh"
|
|
162
|
+
leftPanel={<KnowledgePanel />} // omit → no panel, no toggle
|
|
163
|
+
rightPanel={<AnalyticsPanel />} // widths via left/rightPanelWidth
|
|
164
|
+
composerPlaceholder="Describe a site-wide change…"
|
|
165
|
+
composerHint="Agents render live, interactive artifacts inline."
|
|
166
|
+
>
|
|
167
|
+
<YourPage />
|
|
168
|
+
</AgentWorkspace>
|
|
169
|
+
</NativeAgentProvider>;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Every region is independently optional and controllable:
|
|
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}`.
|
|
181
|
+
- **Panels** collapse/expand with a smooth width-collapse animation (the
|
|
182
|
+
outer rail animates to `0` while the inner wrapper keeps its open width, so
|
|
183
|
+
content clips out instead of reflowing). Uncontrolled by default;
|
|
184
|
+
controlled via `leftPanelOpen`/`onLeftPanelOpenChange` (and the right-side
|
|
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.
|
|
189
|
+
- **Conversation layer** auto-opens on the first submit (or `activate()`),
|
|
190
|
+
can be minimized back to the page without ending the session (a
|
|
191
|
+
"View conversation" chip appears in the dock), and accepts a custom node via
|
|
192
|
+
`conversation` for decorated transcripts. Controlled via `conversationOpen`.
|
|
193
|
+
- **Composer dock** renders `AgentWorkspaceComposer` — a pill input with an
|
|
194
|
+
auto-growing textarea (Enter submits, Shift+Enter inserts a newline), an
|
|
195
|
+
optional attach affordance (`onAttach`), and a circular send button. Pass
|
|
196
|
+
`composer={false}` to drop it, a node to replace it, or `onComposerSubmit`
|
|
197
|
+
to intercept submits.
|
|
198
|
+
- **Programmatic control** from anywhere inside: `useAgentWorkspace()` exposes
|
|
199
|
+
`toggleLeftPanel`, `setRightPanelOpen`, `openConversation`,
|
|
200
|
+
`closeConversation`, and friends for dynamic layout scenarios.
|
|
201
|
+
|
|
144
202
|
### Inline confirmation / proposed-plan panels
|
|
145
203
|
|
|
146
204
|
Confirmation and proposed-plan panels flow **inline in the transcript** — attach
|
package/dist/index.cjs
CHANGED
|
@@ -8552,6 +8552,465 @@ function AgentConversation({
|
|
|
8552
8552
|
)
|
|
8553
8553
|
] });
|
|
8554
8554
|
}
|
|
8555
|
+
var AgentWorkspaceContext = React4.createContext(null);
|
|
8556
|
+
function useAgentWorkspace() {
|
|
8557
|
+
const ctx = React4.useContext(AgentWorkspaceContext);
|
|
8558
|
+
if (!ctx) {
|
|
8559
|
+
throw new Error(
|
|
8560
|
+
"useAgentWorkspace must be used within an <AgentWorkspace>."
|
|
8561
|
+
);
|
|
8562
|
+
}
|
|
8563
|
+
return ctx;
|
|
8564
|
+
}
|
|
8565
|
+
function useAgentWorkspaceOptional() {
|
|
8566
|
+
return React4.useContext(AgentWorkspaceContext);
|
|
8567
|
+
}
|
|
8568
|
+
var noop2 = () => {
|
|
8569
|
+
};
|
|
8570
|
+
function warnDev2(message) {
|
|
8571
|
+
const env = globalThis.process?.env;
|
|
8572
|
+
if (env && env.NODE_ENV !== "production") {
|
|
8573
|
+
console.warn(`[AgentWorkspaceComposer] ${message}`);
|
|
8574
|
+
}
|
|
8575
|
+
}
|
|
8576
|
+
var LINE_HEIGHT_PX2 = 20;
|
|
8577
|
+
var VERTICAL_PADDING_PX2 = 16;
|
|
8578
|
+
function AgentWorkspaceComposer({
|
|
8579
|
+
value: valueProp,
|
|
8580
|
+
onChange,
|
|
8581
|
+
onSubmit,
|
|
8582
|
+
loading: loadingProp,
|
|
8583
|
+
disabled = false,
|
|
8584
|
+
placeholder = "Ask anything\u2026",
|
|
8585
|
+
onAttach,
|
|
8586
|
+
leftActions,
|
|
8587
|
+
minRows = 1,
|
|
8588
|
+
maxRows = 6,
|
|
8589
|
+
autoFocus = false,
|
|
8590
|
+
className,
|
|
8591
|
+
inputClassName
|
|
8592
|
+
}) {
|
|
8593
|
+
const agent = useNativeAgentOptional();
|
|
8594
|
+
const workspace = useAgentWorkspaceOptional();
|
|
8595
|
+
const [draft, setDraft] = React4.useState("");
|
|
8596
|
+
const textareaRef = React4.useRef(null);
|
|
8597
|
+
const propsControlEditing = valueProp !== void 0 || onChange !== void 0;
|
|
8598
|
+
const value = propsControlEditing ? valueProp ?? "" : agent ? agent.input : draft;
|
|
8599
|
+
const handleChange = propsControlEditing ? onChange ?? noop2 : agent ? agent.setInput : setDraft;
|
|
8600
|
+
const loading = loadingProp ?? agent?.isResponding ?? false;
|
|
8601
|
+
const resize = React4.useCallback(() => {
|
|
8602
|
+
const el = textareaRef.current;
|
|
8603
|
+
if (!el) return;
|
|
8604
|
+
el.style.height = "auto";
|
|
8605
|
+
const maxHeight = maxRows * LINE_HEIGHT_PX2 + VERTICAL_PADDING_PX2;
|
|
8606
|
+
const minHeight = minRows * LINE_HEIGHT_PX2 + VERTICAL_PADDING_PX2;
|
|
8607
|
+
const next = Math.min(Math.max(el.scrollHeight, minHeight), maxHeight);
|
|
8608
|
+
el.style.height = `${next}px`;
|
|
8609
|
+
el.style.overflowY = el.scrollHeight > maxHeight ? "auto" : "hidden";
|
|
8610
|
+
}, [maxRows, minRows]);
|
|
8611
|
+
React4.useLayoutEffect(() => {
|
|
8612
|
+
resize();
|
|
8613
|
+
}, [value, resize]);
|
|
8614
|
+
const handleSubmit = React4.useCallback(
|
|
8615
|
+
(e) => {
|
|
8616
|
+
e?.preventDefault();
|
|
8617
|
+
if (!value.trim() || disabled || loading) return;
|
|
8618
|
+
workspace?.openConversation();
|
|
8619
|
+
if (onSubmit) {
|
|
8620
|
+
onSubmit(value);
|
|
8621
|
+
return;
|
|
8622
|
+
}
|
|
8623
|
+
if (!propsControlEditing && agent) {
|
|
8624
|
+
agent.submit();
|
|
8625
|
+
return;
|
|
8626
|
+
}
|
|
8627
|
+
warnDev2(
|
|
8628
|
+
"submit was ignored: provide `onSubmit`, or render inside a <NativeAgentProvider>."
|
|
8629
|
+
);
|
|
8630
|
+
},
|
|
8631
|
+
[value, disabled, loading, workspace, onSubmit, propsControlEditing, agent]
|
|
8632
|
+
);
|
|
8633
|
+
const handleKeyDown = React4.useCallback(
|
|
8634
|
+
(e) => {
|
|
8635
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
8636
|
+
e.preventDefault();
|
|
8637
|
+
handleSubmit();
|
|
8638
|
+
}
|
|
8639
|
+
},
|
|
8640
|
+
[handleSubmit]
|
|
8641
|
+
);
|
|
8642
|
+
const attach = leftActions ?? (onAttach ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8643
|
+
"button",
|
|
8644
|
+
{
|
|
8645
|
+
type: "button",
|
|
8646
|
+
onClick: onAttach,
|
|
8647
|
+
"aria-label": "Attach",
|
|
8648
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
|
|
8649
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Paperclip, { className: "size-4" })
|
|
8650
|
+
}
|
|
8651
|
+
) : null);
|
|
8652
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8653
|
+
"form",
|
|
8654
|
+
{
|
|
8655
|
+
onSubmit: handleSubmit,
|
|
8656
|
+
className: cn(
|
|
8657
|
+
"flex items-end gap-2 rounded-2xl border border-border bg-background p-2 shadow-sm transition-colors focus-within:border-foreground/30",
|
|
8658
|
+
className
|
|
8659
|
+
),
|
|
8660
|
+
children: [
|
|
8661
|
+
attach,
|
|
8662
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8663
|
+
"textarea",
|
|
8664
|
+
{
|
|
8665
|
+
ref: textareaRef,
|
|
8666
|
+
value,
|
|
8667
|
+
onChange: (e) => handleChange(e.target.value),
|
|
8668
|
+
onKeyDown: handleKeyDown,
|
|
8669
|
+
placeholder,
|
|
8670
|
+
disabled,
|
|
8671
|
+
autoFocus,
|
|
8672
|
+
rows: minRows,
|
|
8673
|
+
className: cn(
|
|
8674
|
+
"flex-1 resize-none border-0 bg-transparent px-1 py-2 text-sm leading-5 shadow-none outline-none",
|
|
8675
|
+
"placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0",
|
|
8676
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
8677
|
+
inputClassName
|
|
8678
|
+
)
|
|
8679
|
+
}
|
|
8680
|
+
),
|
|
8681
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8682
|
+
"button",
|
|
8683
|
+
{
|
|
8684
|
+
type: "submit",
|
|
8685
|
+
"aria-label": "Send",
|
|
8686
|
+
disabled: !value.trim() || disabled || loading,
|
|
8687
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition-opacity disabled:opacity-30",
|
|
8688
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "size-4" })
|
|
8689
|
+
}
|
|
8690
|
+
)
|
|
8691
|
+
]
|
|
8692
|
+
}
|
|
8693
|
+
);
|
|
8694
|
+
}
|
|
8695
|
+
function AgentWorkspacePanelToggle({
|
|
8696
|
+
side,
|
|
8697
|
+
open: openProp,
|
|
8698
|
+
onToggle,
|
|
8699
|
+
className
|
|
8700
|
+
}) {
|
|
8701
|
+
const workspace = useAgentWorkspaceOptional();
|
|
8702
|
+
const propsControlled = openProp !== void 0 || onToggle !== void 0;
|
|
8703
|
+
if (!propsControlled && workspace) {
|
|
8704
|
+
const hasPanel = side === "left" ? workspace.hasLeftPanel : workspace.hasRightPanel;
|
|
8705
|
+
if (!hasPanel) return null;
|
|
8706
|
+
}
|
|
8707
|
+
const open = propsControlled ? openProp ?? false : side === "left" ? workspace?.leftPanelOpen ?? false : workspace?.rightPanelOpen ?? false;
|
|
8708
|
+
const handleToggle = propsControlled ? onToggle : side === "left" ? workspace?.toggleLeftPanel : workspace?.toggleRightPanel;
|
|
8709
|
+
const Icon = side === "left" ? lucideReact.PanelLeft : lucideReact.PanelRight;
|
|
8710
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8711
|
+
"button",
|
|
8712
|
+
{
|
|
8713
|
+
type: "button",
|
|
8714
|
+
onClick: handleToggle,
|
|
8715
|
+
"aria-label": side === "left" ? "Toggle left panel" : "Toggle right panel",
|
|
8716
|
+
"aria-pressed": open,
|
|
8717
|
+
className: cn(
|
|
8718
|
+
"flex size-8 items-center justify-center rounded-lg transition-colors",
|
|
8719
|
+
open ? "bg-secondary text-foreground" : "text-muted-foreground hover:bg-secondary",
|
|
8720
|
+
className
|
|
8721
|
+
),
|
|
8722
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" })
|
|
8723
|
+
}
|
|
8724
|
+
);
|
|
8725
|
+
}
|
|
8726
|
+
var inertProps = (inert) => inert ? { inert: "" } : {};
|
|
8727
|
+
function useOpenState(controlled, defaultOpen, onChange) {
|
|
8728
|
+
const [internal, setInternal] = React4.useState(defaultOpen);
|
|
8729
|
+
const isControlled = controlled !== void 0;
|
|
8730
|
+
const open = isControlled ? controlled : internal;
|
|
8731
|
+
const onChangeRef = React4.useRef(onChange);
|
|
8732
|
+
React4.useEffect(() => {
|
|
8733
|
+
onChangeRef.current = onChange;
|
|
8734
|
+
}, [onChange]);
|
|
8735
|
+
const setOpen = React4.useCallback(
|
|
8736
|
+
(next) => {
|
|
8737
|
+
if (!isControlled) setInternal(next);
|
|
8738
|
+
onChangeRef.current?.(next);
|
|
8739
|
+
},
|
|
8740
|
+
[isControlled]
|
|
8741
|
+
);
|
|
8742
|
+
return [open, setOpen];
|
|
8743
|
+
}
|
|
8744
|
+
function AgentWorkspace({
|
|
8745
|
+
children,
|
|
8746
|
+
leftPanel,
|
|
8747
|
+
rightPanel,
|
|
8748
|
+
leftPanelWidth = 320,
|
|
8749
|
+
rightPanelWidth = 460,
|
|
8750
|
+
defaultLeftPanelOpen = true,
|
|
8751
|
+
defaultRightPanelOpen = true,
|
|
8752
|
+
leftPanelOpen: leftPanelOpenProp,
|
|
8753
|
+
rightPanelOpen: rightPanelOpenProp,
|
|
8754
|
+
onLeftPanelOpenChange,
|
|
8755
|
+
onRightPanelOpenChange,
|
|
8756
|
+
showPanelToggles = false,
|
|
8757
|
+
showHeader,
|
|
8758
|
+
showConversationHeader,
|
|
8759
|
+
headerActions,
|
|
8760
|
+
headerStatus,
|
|
8761
|
+
conversation,
|
|
8762
|
+
conversationOpen: conversationOpenProp,
|
|
8763
|
+
onConversationOpenChange,
|
|
8764
|
+
conversationTitle = "AI Assistant",
|
|
8765
|
+
composer = true,
|
|
8766
|
+
composerPlaceholder,
|
|
8767
|
+
composerHint,
|
|
8768
|
+
onComposerSubmit,
|
|
8769
|
+
className,
|
|
8770
|
+
contentClassName,
|
|
8771
|
+
conversationClassName,
|
|
8772
|
+
leftPanelClassName,
|
|
8773
|
+
rightPanelClassName,
|
|
8774
|
+
composerClassName
|
|
8775
|
+
}) {
|
|
8776
|
+
const agent = useNativeAgentOptional();
|
|
8777
|
+
const hasLeftPanel = leftPanel !== void 0 && leftPanel !== null;
|
|
8778
|
+
const hasRightPanel = rightPanel !== void 0 && rightPanel !== null;
|
|
8779
|
+
const [leftOpen, setLeftOpen] = useOpenState(
|
|
8780
|
+
leftPanelOpenProp,
|
|
8781
|
+
defaultLeftPanelOpen,
|
|
8782
|
+
onLeftPanelOpenChange
|
|
8783
|
+
);
|
|
8784
|
+
const [rightOpen, setRightOpen] = useOpenState(
|
|
8785
|
+
rightPanelOpenProp,
|
|
8786
|
+
defaultRightPanelOpen,
|
|
8787
|
+
onRightPanelOpenChange
|
|
8788
|
+
);
|
|
8789
|
+
const [conversationOpen, setConversationOpen] = useOpenState(
|
|
8790
|
+
conversationOpenProp,
|
|
8791
|
+
false,
|
|
8792
|
+
onConversationOpenChange
|
|
8793
|
+
);
|
|
8794
|
+
const isActive = agent?.isActive ?? false;
|
|
8795
|
+
const wasActiveRef = React4.useRef(false);
|
|
8796
|
+
React4.useEffect(() => {
|
|
8797
|
+
if (isActive !== wasActiveRef.current) {
|
|
8798
|
+
wasActiveRef.current = isActive;
|
|
8799
|
+
setConversationOpen(isActive);
|
|
8800
|
+
}
|
|
8801
|
+
}, [isActive, setConversationOpen]);
|
|
8802
|
+
const value = React4.useMemo(
|
|
8803
|
+
() => ({
|
|
8804
|
+
hasLeftPanel,
|
|
8805
|
+
hasRightPanel,
|
|
8806
|
+
leftPanelOpen: leftOpen,
|
|
8807
|
+
rightPanelOpen: rightOpen,
|
|
8808
|
+
setLeftPanelOpen: setLeftOpen,
|
|
8809
|
+
setRightPanelOpen: setRightOpen,
|
|
8810
|
+
toggleLeftPanel: () => setLeftOpen(!leftOpen),
|
|
8811
|
+
toggleRightPanel: () => setRightOpen(!rightOpen),
|
|
8812
|
+
conversationOpen,
|
|
8813
|
+
setConversationOpen,
|
|
8814
|
+
openConversation: () => setConversationOpen(true),
|
|
8815
|
+
closeConversation: () => setConversationOpen(false)
|
|
8816
|
+
}),
|
|
8817
|
+
[
|
|
8818
|
+
hasLeftPanel,
|
|
8819
|
+
hasRightPanel,
|
|
8820
|
+
leftOpen,
|
|
8821
|
+
rightOpen,
|
|
8822
|
+
setLeftOpen,
|
|
8823
|
+
setRightOpen,
|
|
8824
|
+
conversationOpen,
|
|
8825
|
+
setConversationOpen
|
|
8826
|
+
]
|
|
8827
|
+
);
|
|
8828
|
+
const showDock = composer !== false;
|
|
8829
|
+
const dockNode = composer === true || composer === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8830
|
+
AgentWorkspaceComposer,
|
|
8831
|
+
{
|
|
8832
|
+
placeholder: composerPlaceholder,
|
|
8833
|
+
onSubmit: onComposerSubmit
|
|
8834
|
+
}
|
|
8835
|
+
) : composer;
|
|
8836
|
+
const headerVisible = showHeader ?? showConversationHeader ?? true;
|
|
8837
|
+
const statusLine = headerStatus ?? (agent ? agent.error ?? agent.statusLabel : null);
|
|
8838
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgentWorkspaceContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8839
|
+
"div",
|
|
8840
|
+
{
|
|
8841
|
+
"data-conversation-open": conversationOpen || void 0,
|
|
8842
|
+
className: cn(
|
|
8843
|
+
"flex h-full w-full overflow-hidden bg-background text-foreground",
|
|
8844
|
+
className
|
|
8845
|
+
),
|
|
8846
|
+
children: [
|
|
8847
|
+
hasLeftPanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8848
|
+
"aside",
|
|
8849
|
+
{
|
|
8850
|
+
"data-state": leftOpen ? "open" : "collapsed",
|
|
8851
|
+
"aria-hidden": !leftOpen || void 0,
|
|
8852
|
+
className: cn(
|
|
8853
|
+
"relative hidden h-full shrink-0 overflow-hidden border-r border-border transition-[width] duration-300 ease-in-out lg:block",
|
|
8854
|
+
!leftOpen && "border-r-0",
|
|
8855
|
+
leftPanelClassName
|
|
8856
|
+
),
|
|
8857
|
+
style: { width: leftOpen ? leftPanelWidth : 0 },
|
|
8858
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full", style: { width: leftPanelWidth }, children: leftPanel })
|
|
8859
|
+
}
|
|
8860
|
+
),
|
|
8861
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex h-full min-w-0 grow flex-col", children: [
|
|
8862
|
+
showPanelToggles && hasLeftPanel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 top-3 z-30 hidden lg:block", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8863
|
+
AgentWorkspacePanelToggle,
|
|
8864
|
+
{
|
|
8865
|
+
side: "left",
|
|
8866
|
+
className: "border border-border/60 bg-background/80 shadow-sm backdrop-blur"
|
|
8867
|
+
}
|
|
8868
|
+
) }),
|
|
8869
|
+
showPanelToggles && hasRightPanel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-3 z-30 hidden lg:block", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8870
|
+
AgentWorkspacePanelToggle,
|
|
8871
|
+
{
|
|
8872
|
+
side: "right",
|
|
8873
|
+
className: "border border-border/60 bg-background/80 shadow-sm backdrop-blur"
|
|
8874
|
+
}
|
|
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
|
+
),
|
|
8939
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative min-h-0 grow", children: [
|
|
8940
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8941
|
+
"div",
|
|
8942
|
+
{
|
|
8943
|
+
"aria-hidden": conversationOpen || void 0,
|
|
8944
|
+
...inertProps(conversationOpen),
|
|
8945
|
+
className: cn("h-full overflow-y-auto", contentClassName),
|
|
8946
|
+
children
|
|
8947
|
+
}
|
|
8948
|
+
),
|
|
8949
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8950
|
+
"div",
|
|
8951
|
+
{
|
|
8952
|
+
"data-state": conversationOpen ? "open" : "closed",
|
|
8953
|
+
"aria-hidden": !conversationOpen || void 0,
|
|
8954
|
+
...inertProps(!conversationOpen),
|
|
8955
|
+
className: cn(
|
|
8956
|
+
"absolute inset-0 z-20 flex flex-col bg-background transition-[opacity,transform] duration-300 ease-out",
|
|
8957
|
+
conversationOpen ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-8 opacity-0",
|
|
8958
|
+
conversationClassName
|
|
8959
|
+
),
|
|
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
|
+
) })
|
|
8967
|
+
}
|
|
8968
|
+
)
|
|
8969
|
+
] }),
|
|
8970
|
+
showDock && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8971
|
+
"div",
|
|
8972
|
+
{
|
|
8973
|
+
className: cn(
|
|
8974
|
+
"relative z-30 shrink-0 border-t border-border bg-background/80 px-4 py-3 backdrop-blur",
|
|
8975
|
+
composerClassName
|
|
8976
|
+
),
|
|
8977
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-3xl", children: [
|
|
8978
|
+
isActive && !conversationOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8979
|
+
"button",
|
|
8980
|
+
{
|
|
8981
|
+
type: "button",
|
|
8982
|
+
onClick: () => setConversationOpen(true),
|
|
8983
|
+
className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:border-foreground/20 hover:text-foreground",
|
|
8984
|
+
children: [
|
|
8985
|
+
agent?.isResponding ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "size-3" }),
|
|
8986
|
+
"View conversation"
|
|
8987
|
+
]
|
|
8988
|
+
}
|
|
8989
|
+
) }),
|
|
8990
|
+
dockNode,
|
|
8991
|
+
composerHint && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 text-center text-[11px] text-muted-foreground", children: composerHint })
|
|
8992
|
+
] })
|
|
8993
|
+
}
|
|
8994
|
+
)
|
|
8995
|
+
] }),
|
|
8996
|
+
hasRightPanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8997
|
+
"aside",
|
|
8998
|
+
{
|
|
8999
|
+
"data-state": rightOpen ? "open" : "collapsed",
|
|
9000
|
+
"aria-hidden": !rightOpen || void 0,
|
|
9001
|
+
className: cn(
|
|
9002
|
+
"relative hidden h-full shrink-0 overflow-hidden border-l border-border transition-[width] duration-300 ease-in-out lg:block",
|
|
9003
|
+
!rightOpen && "border-l-0",
|
|
9004
|
+
rightPanelClassName
|
|
9005
|
+
),
|
|
9006
|
+
style: { width: rightOpen ? rightPanelWidth : 0 },
|
|
9007
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full", style: { width: rightPanelWidth }, children: rightPanel })
|
|
9008
|
+
}
|
|
9009
|
+
)
|
|
9010
|
+
]
|
|
9011
|
+
}
|
|
9012
|
+
) });
|
|
9013
|
+
}
|
|
8555
9014
|
|
|
8556
9015
|
exports.AgentAvatar = AgentAvatar;
|
|
8557
9016
|
exports.AgentComposer = AgentComposer;
|
|
@@ -8559,6 +9018,9 @@ exports.AgentConversation = AgentConversation;
|
|
|
8559
9018
|
exports.AgentHandoff = AgentHandoff;
|
|
8560
9019
|
exports.AgentProvider = AgentProvider;
|
|
8561
9020
|
exports.AgentSurface = AgentSurface;
|
|
9021
|
+
exports.AgentWorkspace = AgentWorkspace;
|
|
9022
|
+
exports.AgentWorkspaceComposer = AgentWorkspaceComposer;
|
|
9023
|
+
exports.AgentWorkspacePanelToggle = AgentWorkspacePanelToggle;
|
|
8562
9024
|
exports.AllocationBreakdown = AllocationBreakdown;
|
|
8563
9025
|
exports.AnalyticsDashboard = AnalyticsDashboard;
|
|
8564
9026
|
exports.Avatar = Avatar;
|
|
@@ -8672,6 +9134,8 @@ exports.useAgentBackend = useAgentBackend;
|
|
|
8672
9134
|
exports.useAgentInput = useAgentInput;
|
|
8673
9135
|
exports.useAgentLayout = useAgentLayout;
|
|
8674
9136
|
exports.useAgentMessages = useAgentMessages;
|
|
9137
|
+
exports.useAgentWorkspace = useAgentWorkspace;
|
|
9138
|
+
exports.useAgentWorkspaceOptional = useAgentWorkspaceOptional;
|
|
8675
9139
|
exports.useNativeAgent = useNativeAgent;
|
|
8676
9140
|
exports.useNativeAgentOptional = useNativeAgentOptional;
|
|
8677
9141
|
exports.useSemanticBuilder = useSemanticBuilder;
|