fi-glass 1.2.0 → 1.3.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.
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, CSSProperties } from 'react';
3
3
  import { ToolCall, AgentTurnState, GuardRejection, AgentPlan, AgentTurnStatus, AgentHook, ChatMessage, VoiceAdapter } from '@free-intelligence/core';
4
4
  import { LucideIcon } from 'lucide-react';
5
5
 
@@ -227,9 +227,20 @@ interface AgentConversation {
227
227
  }
228
228
  declare function useAgentConversation(agent: AgentHook, options?: UseAgentConversationOptions): AgentConversation;
229
229
 
230
+ type AgentConversationSurfaceLayout = 'viewport' | 'contained';
230
231
  interface AgentConversationSurfaceProps {
231
232
  /** The conversation state + actions from `useAgentConversation`. */
232
233
  conversation: AgentConversation;
234
+ /**
235
+ * FG-2 (canary-driven, activist-os): how the surface root sizes itself.
236
+ * - `"viewport"` (DEFAULT): root is `height: 100dvh` — the full-page behavior
237
+ * every existing consumer relies on.
238
+ * - `"contained"`: root is `height: 100%` + `minHeight: 0` + `overflow: hidden`,
239
+ * so it fills whatever fixed-height cell an app shell gives it (header + main
240
+ * + artifacts rail + footer) and scrolls the transcript internally instead of
241
+ * forcing page scroll.
242
+ */
243
+ layout?: AgentConversationSurfaceLayout;
233
244
  /** Composer placeholder copy (app-owned). */
234
245
  composerPlaceholder?: string;
235
246
  /** Label for the new-conversation button. Default: "New chat". */
@@ -397,7 +408,7 @@ interface AgentConversationSurfaceProps {
397
408
  /** Class for the disclosure toggle button. */
398
409
  collapseToggleClassName?: string;
399
410
  }
400
- declare function AgentConversationSurface({ conversation, composerPlaceholder, newChatLabel, showNewChatButton, emptyState, aboveComposer, agentPanelProps, composerBoxClassName, composerAreaClassName, composerTextareaClassName, composerControlsClassName, showCopyAction, renderHeader, renderBadge, renderActions, messageBubbleClassName, voiceAdapter, micSlotClassName, micButtonClassName, onVoiceError, voiceVisualizerClassName, voiceVisualizerBarClassName, showSendButton, sendButtonClassName, sendButtonIconClassName, sendLabel, composerAppend, onComposerAppendConsumed, micSlotOverride, errorClassName, retryLabel, dismissLabel, retryButtonClassName, dismissButtonClassName, autoScroll, scrollToBottomLabel, scrollToBottomClassName, scrollToBottomIconClassName, collapseUserMessages, collapseMaxHeight, showMoreLabel, showLessLabel, collapseToggleClassName, }: AgentConversationSurfaceProps): react.JSX.Element;
411
+ declare function AgentConversationSurface({ conversation, layout, composerPlaceholder, newChatLabel, showNewChatButton, emptyState, aboveComposer, agentPanelProps, composerBoxClassName, composerAreaClassName, composerTextareaClassName, composerControlsClassName, showCopyAction, renderHeader, renderBadge, renderActions, messageBubbleClassName, voiceAdapter, micSlotClassName, micButtonClassName, onVoiceError, voiceVisualizerClassName, voiceVisualizerBarClassName, showSendButton, sendButtonClassName, sendButtonIconClassName, sendLabel, composerAppend, onComposerAppendConsumed, micSlotOverride, errorClassName, retryLabel, dismissLabel, retryButtonClassName, dismissButtonClassName, autoScroll, scrollToBottomLabel, scrollToBottomClassName, scrollToBottomIconClassName, collapseUserMessages, collapseMaxHeight, showMoreLabel, showLessLabel, collapseToggleClassName, }: AgentConversationSurfaceProps): react.JSX.Element;
401
412
 
402
413
  interface ScrollToBottomButtonProps {
403
414
  onClick: () => void;
@@ -410,4 +421,18 @@ interface ScrollToBottomButtonProps {
410
421
  }
411
422
  declare function ScrollToBottomButton({ onClick, label, className, iconClassName, }: ScrollToBottomButtonProps): react.JSX.Element;
412
423
 
413
- export { type AgentClassNames, type AgentConversation, AgentConversationSurface, type AgentConversationSurfaceProps, type AgentIconSet, AgentPanel, type AgentPanelProps, type AppHandledError, DEFAULT_TURN_TIMEOUT_MS, PlanChecklist, type PlanChecklistProps, ScrollToBottomButton, type ScrollToBottomButtonProps, SourcesPanel, type SourcesPanelProps, StepsPanel, type StepsPanelProps, type ToolCategory, type ToolVisualStatus, type TurnError, type UseAgentConversationOptions, classifyTool, defaultAgentIcons, latestOpenToolIndex, resolveIcons, shortToolName, toolIcon, toolVisualStatus, useAgentConversation };
424
+ type AgentWorkspaceShellVisual = 'aurora' | 'midnight' | 'clinical';
425
+ type AgentWorkspaceShellDensity = 'compact' | 'comfortable' | 'spacious';
426
+ interface AgentWorkspaceShellProps {
427
+ visual?: AgentWorkspaceShellVisual;
428
+ density?: AgentWorkspaceShellDensity;
429
+ header?: ReactNode;
430
+ conversation: ReactNode;
431
+ rail?: ReactNode;
432
+ footer?: ReactNode;
433
+ className?: string;
434
+ style?: CSSProperties;
435
+ }
436
+ declare function AgentWorkspaceShell({ visual, density, header, conversation, rail, footer, className, style, }: AgentWorkspaceShellProps): react.JSX.Element;
437
+
438
+ export { type AgentClassNames, type AgentConversation, AgentConversationSurface, type AgentConversationSurfaceLayout, type AgentConversationSurfaceProps, type AgentIconSet, AgentPanel, type AgentPanelProps, AgentWorkspaceShell, type AgentWorkspaceShellDensity, type AgentWorkspaceShellProps, type AgentWorkspaceShellVisual, type AppHandledError, DEFAULT_TURN_TIMEOUT_MS, PlanChecklist, type PlanChecklistProps, ScrollToBottomButton, type ScrollToBottomButtonProps, SourcesPanel, type SourcesPanelProps, StepsPanel, type StepsPanelProps, type ToolCategory, type ToolVisualStatus, type TurnError, type UseAgentConversationOptions, classifyTool, defaultAgentIcons, latestOpenToolIndex, resolveIcons, shortToolName, toolIcon, toolVisualStatus, useAgentConversation };
@@ -1653,6 +1653,7 @@ function ScrollToBottomButton({
1653
1653
  import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
1654
1654
  function AgentConversationSurface({
1655
1655
  conversation,
1656
+ layout = "viewport",
1656
1657
  composerPlaceholder,
1657
1658
  newChatLabel = "New chat",
1658
1659
  showNewChatButton = true,
@@ -1746,12 +1747,13 @@ function AgentConversationSurface({
1746
1747
  send(t);
1747
1748
  };
1748
1749
  const canSend = input.trim().length > 0 && !isStreaming;
1750
+ const rootStyle = layout === "contained" ? { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, overflow: "hidden" } : { display: "flex", flexDirection: "column", height: "100dvh" };
1749
1751
  return (
1750
1752
  // B3-FIGLASS-15: the ROOT is full-width — the fluid cap (100% minus a 60px
1751
1753
  // gutter) lives on INNER content wrappers (transcript + composer), never on
1752
1754
  // the scroll container, so the scrollbar renders at the viewport edge like
1753
1755
  // ChatGPT/AURITY /chat instead of glued to the centered column.
1754
- /* @__PURE__ */ jsxs19("div", { style: { display: "flex", flexDirection: "column", height: "100dvh" }, children: [
1756
+ /* @__PURE__ */ jsxs19("div", { style: rootStyle, children: [
1755
1757
  /* @__PURE__ */ jsxs19("div", { style: { position: "relative", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
1756
1758
  /* @__PURE__ */ jsx26(
1757
1759
  "div",
@@ -1969,9 +1971,64 @@ function AgentConversationSurface({
1969
1971
  ] })
1970
1972
  );
1971
1973
  }
1974
+
1975
+ // src/agent/AgentWorkspaceShell.tsx
1976
+ import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
1977
+ function AgentWorkspaceShell({
1978
+ visual = "aurora",
1979
+ density = "comfortable",
1980
+ header,
1981
+ conversation,
1982
+ rail,
1983
+ footer,
1984
+ className,
1985
+ style
1986
+ }) {
1987
+ const rootStyle = {
1988
+ display: "flex",
1989
+ flexDirection: "column",
1990
+ height: "100dvh",
1991
+ minHeight: 0,
1992
+ overflow: "hidden"
1993
+ };
1994
+ const mainStyle = {
1995
+ display: "grid",
1996
+ gridTemplateColumns: rail ? "minmax(0, 1fr) minmax(280px, 360px)" : "minmax(0, 1fr)",
1997
+ flex: "1 1 auto",
1998
+ minHeight: 0,
1999
+ overflow: "hidden"
2000
+ };
2001
+ const conversationStyle = { minHeight: 0, overflow: "hidden" };
2002
+ const railStyle = { minHeight: 0, overflowY: "auto" };
2003
+ const rootClassName = [
2004
+ "fi-agent-workspace",
2005
+ `fi-visual-${visual}`,
2006
+ `fi-density-${density}`,
2007
+ className
2008
+ ].filter(Boolean).join(" ");
2009
+ return /* @__PURE__ */ jsxs20(
2010
+ "div",
2011
+ {
2012
+ "data-fi-workspace": "agent",
2013
+ "data-fi-visual": visual,
2014
+ "data-fi-density": density,
2015
+ className: rootClassName,
2016
+ style: { ...rootStyle, ...style },
2017
+ children: [
2018
+ header != null && /* @__PURE__ */ jsx27("div", { "data-fi-slot": "header", children: header }),
2019
+ /* @__PURE__ */ jsxs20("div", { "data-fi-slot": "main", style: mainStyle, children: [
2020
+ /* @__PURE__ */ jsx27("div", { "data-fi-slot": "conversation", style: conversationStyle, children: conversation }),
2021
+ rail != null && /* @__PURE__ */ jsx27("div", { "data-fi-slot": "rail", style: railStyle, children: rail })
2022
+ ] }),
2023
+ footer != null && /* @__PURE__ */ jsx27("div", { "data-fi-slot": "footer", children: footer })
2024
+ ]
2025
+ }
2026
+ );
2027
+ }
1972
2028
  export {
1973
2029
  AgentConversationSurface,
1974
2030
  AgentPanel,
2031
+ AgentWorkspaceShell,
1975
2032
  DEFAULT_TURN_TIMEOUT_MS,
1976
2033
  PlanChecklist,
1977
2034
  ScrollToBottomButton,