@athenaintel/react 0.55.0 → 0.57.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 +84 -1
- package/dist/agent-runtime/src/answer-label.cjs +8 -2
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
- package/dist/agent-runtime/src/answer-label.d.ts +10 -4
- package/dist/agent-runtime/src/answer-label.js +8 -2
- package/dist/agent-runtime/src/answer-label.js.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +6 -3
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +6 -3
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/edit-command.cjs +40 -19
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.d.ts +2 -0
- package/dist/agent-runtime/src/edit-command.js +41 -20
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +8 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +9 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js +8 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/history-store.cjs +426 -0
- package/dist/agent-runtime/src/history-store.cjs.map +1 -0
- package/dist/agent-runtime/src/history-store.d.ts +282 -0
- package/dist/agent-runtime/src/history-store.js +426 -0
- package/dist/agent-runtime/src/history-store.js.map +1 -0
- package/dist/agent-runtime/src/inbound-channel.cjs +96 -0
- package/dist/agent-runtime/src/inbound-channel.cjs.map +1 -0
- package/dist/agent-runtime/src/inbound-channel.d.ts +75 -0
- package/dist/agent-runtime/src/inbound-channel.js +96 -0
- package/dist/agent-runtime/src/inbound-channel.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +6 -5
- package/dist/agent-runtime/src/interrupts.cjs +45 -3
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +51 -4
- package/dist/agent-runtime/src/interrupts.js +46 -4
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/message-window.cjs +43 -5
- package/dist/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/agent-runtime/src/message-window.d.ts +26 -2
- package/dist/agent-runtime/src/message-window.js +44 -6
- package/dist/agent-runtime/src/message-window.js.map +1 -1
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
- package/dist/agent-runtime/src/offline-status.d.ts +110 -4
- package/dist/agent-runtime/src/offline-status.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +1 -0
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
- package/dist/agent-runtime/src/tool-metadata.cjs +16 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +16 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +8 -16
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +1 -9
- package/dist/agent-runtime/src/use-deep-agent-thread.js +9 -17
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +86 -79
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +2 -27
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js +89 -82
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -1
- package/dist/auth/AthenaSSOProvider.cjs +54 -12
- package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
- package/dist/auth/AthenaSSOProvider.d.ts +23 -2
- package/dist/auth/AthenaSSOProvider.js +54 -12
- package/dist/auth/AthenaSSOProvider.js.map +1 -1
- package/dist/auth/index.cjs +2 -0
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sign-back-in.cjs +141 -0
- package/dist/auth/sign-back-in.cjs.map +1 -0
- package/dist/auth/sign-back-in.d.ts +117 -0
- package/dist/auth/sign-back-in.js +141 -0
- package/dist/auth/sign-back-in.js.map +1 -0
- package/dist/chat/AthenaChat.cjs +7 -2
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.js +7 -2
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +6 -2
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +8 -1
- package/dist/chat/StatewireApprovalCard.js +7 -3
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +6 -5
- package/dist/chat/super-grouping/CollapsibleGroup.js +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -1
- package/dist/chat/super-grouping/earlier-steps-button.cjs +5 -6
- package/dist/chat/super-grouping/earlier-steps-button.cjs.map +1 -1
- package/dist/chat/super-grouping/earlier-steps-button.d.ts +6 -6
- package/dist/chat/super-grouping/earlier-steps-button.js +5 -6
- package/dist/chat/super-grouping/earlier-steps-button.js.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.cjs +1 -0
- package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.js +1 -0
- package/dist/chat/super-grouping/toolkit-map.js.map +1 -1
- package/dist/chat/super-grouping/use-turn-steps.cjs +3 -3
- package/dist/chat/super-grouping/use-turn-steps.js +1 -1
- package/dist/chat-ui/index.cjs +4 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +1 -0
- package/dist/chat-ui/index.js +5 -1
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/messages/inbound-channel-message.cjs +219 -0
- package/dist/chat-ui/messages/inbound-channel-message.cjs.map +1 -0
- package/dist/chat-ui/messages/inbound-channel-message.d.ts +60 -0
- package/dist/chat-ui/messages/inbound-channel-message.js +219 -0
- package/dist/chat-ui/messages/inbound-channel-message.js.map +1 -0
- package/dist/chat-ui/messages/inbound-channel-reader.cjs +184 -0
- package/dist/chat-ui/messages/inbound-channel-reader.cjs.map +1 -0
- package/dist/chat-ui/messages/inbound-channel-reader.d.ts +65 -0
- package/dist/chat-ui/messages/inbound-channel-reader.js +184 -0
- package/dist/chat-ui/messages/inbound-channel-reader.js.map +1 -0
- package/dist/chat-ui/messages/message-components.cjs +18 -14
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +7 -0
- package/dist/chat-ui/messages/message-components.js +19 -15
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +0 -4
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +5 -7
- package/dist/chat-ui/thread/statewire-history-edge.js +1 -5
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/composer/sign-back-in-draft.cjs +62 -0
- package/dist/composer/sign-back-in-draft.cjs.map +1 -0
- package/dist/composer/sign-back-in-draft.d.ts +34 -0
- package/dist/composer/sign-back-in-draft.js +62 -0
- package/dist/composer/sign-back-in-draft.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +6 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +60 -14
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +60 -14
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/statewire-window-context.cjs.map +1 -1
- package/dist/provider/statewire-window-context.d.ts +8 -8
- package/dist/provider/statewire-window-context.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/auth.cjs +11 -0
- package/dist/runtime/auth.cjs.map +1 -1
- package/dist/runtime/auth.d.ts +18 -1
- package/dist/runtime/auth.js +11 -0
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +0 -2
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +5 -5
- package/dist/runtime/useAthenaStatewireRuntime.js +0 -2
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/agent-runtime/src/history-pages.cjs +0 -279
- package/dist/agent-runtime/src/history-pages.cjs.map +0 -1
- package/dist/agent-runtime/src/history-pages.d.ts +0 -252
- package/dist/agent-runtime/src/history-pages.js +0 -279
- package/dist/agent-runtime/src/history-pages.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleGroup.cjs","sources":["../../../src/chat/super-grouping/CollapsibleGroup.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\nimport { cn } from '../../lib/utils';\nimport { createToolBasedGroupingFunction, type GroupingFunction } from './grouping-function';\nimport { defaultGetToolGroupKey } from './toolkit-map';\n\n/**\n * Per-toolkit theme: the brand color that tints the group header, and an\n * optional icon URL a host serves (Olympus ships toolkit SVGs; the SDK does\n * not bundle images, so it tints only).\n */\nexport type ToolkitTheme = {\n /** Hex brand color for this toolkit. */\n color: string;\n /** Absolute or root-relative URL of the toolkit icon, when the host has one. */\n icon?: string;\n};\n\n/** Brand colors keyed by toolkit display name — the group keys the grouping function emits. */\nexport const TOOLKIT_THEMES: Record<string, ToolkitTheme> = {\n Web: { color: '#7BCCFA' },\n Document: { color: '#4586F9' },\n 'Document (Word)': { color: '#4586F9' },\n Notebook: { color: '#FFAB00' },\n Python: { color: '#00A76F' },\n Spreadsheet: { color: '#00A76F' },\n Email: { color: '#B584FF' },\n AOP: { color: '#336DFF' },\n App: { color: '#7336F5' },\n Presentation: { color: '#F56B36' },\n 'User Interface': { color: '#7336F5' },\n Canvas: { color: '#002542' },\n Computer: { color: '#3E0042' },\n Database: { color: '#7336F5' },\n 'Chrome Browser': { color: '#4285F4' },\n};\n\nexport const DEFAULT_TOOLKIT_THEME: ToolkitTheme = { color: '#919EAB' };\n\nconst DEFAULT_GROUPING = createToolBasedGroupingFunction(defaultGetToolGroupKey);\n\n/**\n * The grouping in force for the message being rendered. `SuperGroupingCard`\n * provides it so each `CollapsibleGroup` can tell whether it is the last\n * grouped block (the one that opens by default while the run is live) without\n * being handed the function as a prop through `GroupedMessageParts`, and\n * whether the card keeps its tool UIs mounted while hidden (`mountHidden`:\n * its turn is active, or a deep link targets it).\n */\nconst SuperGroupingContext = createContext<{\n groupingFunction: GroupingFunction;\n mountHidden?: boolean;\n} | null>(null);\n\nexport const SuperGroupingProvider = SuperGroupingContext.Provider;\n\n/** Whether the group a tool UI renders in has mounted its tool UIs; outside a group, always. */\nconst GroupToolUIsMountedContext = createContext(true);\n\n/**\n * A tool call's UI inside a `CollapsibleGroup`: rendered once the group first\n * needs its tool UIs (see `CollapsibleGroup`). `GroupedMessageParts` renders\n * every tool call through it.\n */\nexport function GroupToolUI({ children }: { children: ReactNode }) {\n return useContext(GroupToolUIsMountedContext) ? <>{children}</> : null;\n}\n\nexport interface CollapsibleGroupProps {\n /** Group key from the grouping function (toolkit display name); `undefined` for ungrouped parts. */\n groupKey: string | undefined;\n /** Indices of the parts belonging to this group. */\n indices: number[];\n children?: ReactNode;\n /** Host toolkit themes (colors, icons), merged over the built-in colors. */\n themes?: Record<string, ToolkitTheme>;\n /**\n * Keep the group open regardless of the run state — a host rule such as\n * \"an unsubmitted email draft stays visible\". The user's own toggle still\n * wins once used.\n */\n forceOpen?: boolean;\n /**\n * Do not open the live group by default (screenshot-heavy browser-control\n * runs hold hundreds of actions); the user can still expand it.\n */\n compactWhileRunning?: boolean;\n /**\n * Mount the tool UIs while collapsed (hidden), so a host that needs to find\n * one — a deep link into one of its tool calls — can. The card a group\n * renders in asks the same while its turn is active or its `mountDetails` is\n * set.\n */\n mountHidden?: boolean;\n /** Extra header controls, rendered as siblings of the toggle (never nested buttons). */\n headerActions?: ReactNode;\n /** The grouping used to find the last grouped block; defaults to the card's, then the SDK's. */\n groupingFunction?: GroupingFunction;\n className?: string;\n}\n\n/**\n * Per-toolkit collapsible block inside the grouped details panel — \"Using\n * Spreadsheet Toolkit · 4 tool calls\" — used by the SDK, Olympus, and the\n * Chrome extension. The last grouped block opens by default while the message\n * is running and settles closed; the user's toggle is remembered for the\n * mounted block.\n *\n * The group's tool UIs (the tool calls `GroupedMessageParts` renders through\n * `GroupToolUI`) mount the first time they are needed — the group opens, its\n * turn is running (live tool UIs run their effects), or a host asks\n * (`mountHidden`) — and stay mounted after. A finished turn's collapsed groups\n * mount none of their tool UIs, which a long run holds hundreds of. The rest\n * of the body renders from the start: the agent's text between the calls is\n * part of the message that selections, in-page find and links into the\n * message count.\n *\n * Selector discipline: one raw `s.message.content` read; every per-group\n * derivation (grouping, counts) runs in `useMemo` off it, so the grouping\n * pass happens once per content change instead of once per selector pass.\n */\nexport const CollapsibleGroup = ({\n groupKey,\n indices,\n children,\n themes,\n forceOpen = false,\n compactWhileRunning = false,\n mountHidden = false,\n headerActions,\n groupingFunction,\n className,\n}: CollapsibleGroupProps) => {\n const panelId = useId();\n const isMessageRunning = useAuiState((s) => s.message.status?.type === 'running');\n const messageContent = useAuiState((s) =>\n s.message.role === 'assistant' ? s.message.content : undefined,\n );\n const superGrouping = useContext(SuperGroupingContext);\n const grouping = groupingFunction ?? superGrouping?.groupingFunction ?? DEFAULT_GROUPING;\n\n const lastIndex = indices.at(-1);\n const isLastGroup = useMemo(() => {\n if (!messageContent) return false;\n const lastGroup = grouping(messageContent)\n .filter((group) => group.indices.length > 1)\n .at(-1);\n return lastGroup?.indices.at(-1) === lastIndex;\n }, [messageContent, grouping, lastIndex]);\n\n const toolCallCount = useMemo(\n () =>\n messageContent\n ? indices.reduce(\n (count, index) => (messageContent[index]?.type === 'tool-call' ? count + 1 : count),\n 0,\n )\n : 0,\n [messageContent, indices],\n );\n\n const theme = useMemo<ToolkitTheme>(\n () => (groupKey ? { ...TOOLKIT_THEMES, ...themes }[groupKey] ?? DEFAULT_TOOLKIT_THEME : DEFAULT_TOOLKIT_THEME),\n [groupKey, themes],\n );\n\n const [userOpened, setOpen] = useState<boolean>();\n const autoOpen = isLastGroup && isMessageRunning && !compactWhileRunning;\n const open = userOpened ?? (autoOpen || forceOpen);\n\n const mountToolUIs =\n open || isMessageRunning || mountHidden || superGrouping?.mountHidden === true;\n const [toolUIsMounted, setToolUIsMounted] = useState(mountToolUIs);\n // Adjusting state during render is React's sanctioned derived-state pattern.\n if (mountToolUIs && !toolUIsMounted) setToolUIsMounted(true);\n\n if (!groupKey || indices.length <= 1) return <>{children}</>;\n\n const toggle = () => setOpen(!open);\n\n return (\n <div\n data-slot=\"collapsible-group\"\n data-group-key={groupKey}\n className={cn('my-4 rounded-2xl border shadow-sm', className)}\n style={{\n borderColor: `${theme.color}33`,\n background: `linear-gradient(to right, ${theme.color}0d, transparent, ${theme.color}0d)`,\n }}\n >\n <div className=\"flex w-full items-center rounded-2xl\">\n <button\n type=\"button\"\n onClick={toggle}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex min-w-0 flex-1 items-center justify-between gap-3 rounded-2xl px-5 py-3 text-left transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n <span className=\"flex min-w-0 items-center gap-3 text-foreground/90\">\n {theme.icon ? (\n <img src={theme.icon} alt=\"\" aria-hidden=\"true\" className=\"size-5 shrink-0\" />\n ) : (\n <span\n className=\"inline-block size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: theme.color }}\n aria-hidden=\"true\"\n />\n )}\n <span className=\"truncate text-sm font-semibold\">\n {isMessageRunning ? 'Using ' : 'Used '}\n {groupKey} Toolkit\n </span>\n </span>\n <span className=\"shrink-0 text-xs font-medium text-muted-foreground\">\n {toolCallCount} tool {toolCallCount === 1 ? 'call' : 'calls'}\n </span>\n </button>\n <div className=\"flex shrink-0 items-center gap-1 pr-3 pl-1\">\n {headerActions}\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={open ? 'Collapse toolkit group' : 'Expand toolkit group'}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n {open ? <ChevronUp size={16} /> : <ChevronDown size={16} />}\n </button>\n </div>\n </div>\n\n <div\n id={panelId}\n className={cn(\n 'grid overflow-hidden border-t transition-[grid-template-rows] duration-200 ease-in-out motion-reduce:transition-none',\n open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',\n )}\n style={{ borderColor: `${theme.color}33` }}\n >\n <div className=\"overflow-hidden\">\n <GroupToolUIsMountedContext.Provider value={toolUIsMounted}>\n <div className=\"flex flex-col gap-2 px-5 py-4\">{children}</div>\n </GroupToolUIsMountedContext.Provider>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["createToolBasedGroupingFunction","defaultGetToolGroupKey","createContext","useContext","jsx","Fragment","groupingFunction","useId","useAuiState","useMemo","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UAEFA,2BAAAA,KAAC,OAAA,EAAI,WAAU,8CACZ,UAAA;AAAA,YAAA;AAAA,YACDP,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,cAAY,OAAO,2BAA2B;AAAA,gBAC9C,iBAAe;AAAA,gBACf,iBAAe;AAAA,gBACf,WAAU;AAAA,gBAET,UAAA,sCAAQS,YAAAA,WAAA,EAAU,MAAM,IAAI,IAAKT,2BAAAA,IAACU,YAAAA,aAAA,EAAY,MAAM,GAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3D,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QAEAV,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAWQ,OAAAA;AAAAA,cACT;AAAA,cACA,OAAO,oBAAoB;AAAA,YAAA;AAAA,YAE7B,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,KAAA;AAAA,YAEpC,yCAAC,OAAA,EAAI,WAAU,mBACb,UAAAR,2BAAAA,IAAC,2BAA2B,UAA3B,EAAoC,OAAO,gBAC1C,yCAAC,OAAA,EAAI,WAAU,iCAAiC,UAAS,GAC3D,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CollapsibleGroup.cjs","sources":["../../../src/chat/super-grouping/CollapsibleGroup.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\nimport { cn } from '../../lib/utils';\nimport { createToolBasedGroupingFunction, type GroupingFunction } from './grouping-function';\nimport { defaultGetToolGroupKey } from './toolkit-map';\n\n/**\n * Per-toolkit theme: the brand color that tints the group header, and an\n * optional icon URL a host serves (Olympus ships toolkit SVGs; the SDK does\n * not bundle images, so it tints only).\n */\nexport type ToolkitTheme = {\n /** Hex brand color for this toolkit. */\n color: string;\n /** Absolute or root-relative URL of the toolkit icon, when the host has one. */\n icon?: string;\n};\n\n/** Brand colors keyed by toolkit display name — the group keys the grouping function emits. */\nexport const TOOLKIT_THEMES: Record<string, ToolkitTheme> = {\n Web: { color: '#7BCCFA' },\n Document: { color: '#4586F9' },\n 'Document (Word)': { color: '#4586F9' },\n Notebook: { color: '#FFAB00' },\n Python: { color: '#00A76F' },\n Spreadsheet: { color: '#00A76F' },\n Email: { color: '#B584FF' },\n AOP: { color: '#336DFF' },\n App: { color: '#7336F5' },\n Presentation: { color: '#F56B36' },\n 'User Interface': { color: '#7336F5' },\n Canvas: { color: '#002542' },\n Computer: { color: '#3E0042' },\n Database: { color: '#7336F5' },\n 'Chrome Browser': { color: '#4285F4' },\n};\n\nexport const DEFAULT_TOOLKIT_THEME: ToolkitTheme = { color: '#919EAB' };\n\nconst DEFAULT_GROUPING = createToolBasedGroupingFunction(defaultGetToolGroupKey);\n\n/**\n * The grouping in force for the message being rendered. `SuperGroupingCard`\n * provides it so each `CollapsibleGroup` can tell whether it is the last\n * grouped block (the one that opens while the run is live, when a host turns\n * `compactWhileRunning` off) without\n * being handed the function as a prop through `GroupedMessageParts`, and\n * whether the card keeps its tool UIs mounted while hidden (`mountHidden`:\n * its turn is active, or a deep link targets it).\n */\nconst SuperGroupingContext = createContext<{\n groupingFunction: GroupingFunction;\n mountHidden?: boolean;\n} | null>(null);\n\nexport const SuperGroupingProvider = SuperGroupingContext.Provider;\n\n/** Whether the group a tool UI renders in has mounted its tool UIs; outside a group, always. */\nconst GroupToolUIsMountedContext = createContext(true);\n\n/**\n * A tool call's UI inside a `CollapsibleGroup`: rendered once the group first\n * needs its tool UIs (see `CollapsibleGroup`). `GroupedMessageParts` renders\n * every tool call through it.\n */\nexport function GroupToolUI({ children }: { children: ReactNode }) {\n return useContext(GroupToolUIsMountedContext) ? <>{children}</> : null;\n}\n\nexport interface CollapsibleGroupProps {\n /** Group key from the grouping function (toolkit display name); `undefined` for ungrouped parts. */\n groupKey: string | undefined;\n /** Indices of the parts belonging to this group. */\n indices: number[];\n children?: ReactNode;\n /** Host toolkit themes (colors, icons), merged over the built-in colors. */\n themes?: Record<string, ToolkitTheme>;\n /**\n * Keep the group open regardless of the run state — a host rule such as\n * \"an unsubmitted email draft stays visible\". The user's own toggle still\n * wins once used.\n */\n forceOpen?: boolean;\n /**\n * Keep the live group collapsed while its turn runs, so only its header's\n * count moves as calls land (default). Pass `false` to open the last grouped\n * block while the run is live and close it when the run settles.\n */\n compactWhileRunning?: boolean;\n /**\n * Mount the tool UIs while collapsed (hidden), so a host that needs to find\n * one — a deep link into one of its tool calls — can. The card a group\n * renders in asks the same while its turn is active or its `mountDetails` is\n * set.\n */\n mountHidden?: boolean;\n /** Extra header controls, rendered as siblings of the toggle (never nested buttons). */\n headerActions?: ReactNode;\n /** The grouping used to find the last grouped block; defaults to the card's, then the SDK's. */\n groupingFunction?: GroupingFunction;\n className?: string;\n}\n\n/**\n * Per-toolkit collapsible block inside the grouped details panel — \"Using\n * Spreadsheet Toolkit · 4 tool calls\" — used by the SDK, Olympus, and the\n * Chrome extension. A live group stays collapsed and counts its calls up\n * (unless `compactWhileRunning` is off); the user's toggle is remembered for\n * the mounted block.\n *\n * The group's tool UIs (the tool calls `GroupedMessageParts` renders through\n * `GroupToolUI`) mount the first time they are needed — the group opens, its\n * turn is running (live tool UIs run their effects), or a host asks\n * (`mountHidden`) — and stay mounted after. A finished turn's collapsed groups\n * mount none of their tool UIs, which a long run holds hundreds of. The rest\n * of the body renders from the start: the agent's text between the calls is\n * part of the message that selections, in-page find and links into the\n * message count.\n *\n * Selector discipline: one raw `s.message.content` read; every per-group\n * derivation (grouping, counts) runs in `useMemo` off it, so the grouping\n * pass happens once per content change instead of once per selector pass.\n */\nexport const CollapsibleGroup = ({\n groupKey,\n indices,\n children,\n themes,\n forceOpen = false,\n compactWhileRunning = true,\n mountHidden = false,\n headerActions,\n groupingFunction,\n className,\n}: CollapsibleGroupProps) => {\n const panelId = useId();\n const isMessageRunning = useAuiState((s) => s.message.status?.type === 'running');\n const messageContent = useAuiState((s) =>\n s.message.role === 'assistant' ? s.message.content : undefined,\n );\n const superGrouping = useContext(SuperGroupingContext);\n const grouping = groupingFunction ?? superGrouping?.groupingFunction ?? DEFAULT_GROUPING;\n\n const lastIndex = indices.at(-1);\n const isLastGroup = useMemo(() => {\n if (!messageContent) return false;\n const lastGroup = grouping(messageContent)\n .filter((group) => group.indices.length > 1)\n .at(-1);\n return lastGroup?.indices.at(-1) === lastIndex;\n }, [messageContent, grouping, lastIndex]);\n\n const toolCallCount = useMemo(\n () =>\n messageContent\n ? indices.reduce(\n (count, index) => (messageContent[index]?.type === 'tool-call' ? count + 1 : count),\n 0,\n )\n : 0,\n [messageContent, indices],\n );\n\n const theme = useMemo<ToolkitTheme>(\n () => (groupKey ? { ...TOOLKIT_THEMES, ...themes }[groupKey] ?? DEFAULT_TOOLKIT_THEME : DEFAULT_TOOLKIT_THEME),\n [groupKey, themes],\n );\n\n const [userOpened, setOpen] = useState<boolean>();\n const autoOpen = isLastGroup && isMessageRunning && !compactWhileRunning;\n const open = userOpened ?? (autoOpen || forceOpen);\n\n const mountToolUIs =\n open || isMessageRunning || mountHidden || superGrouping?.mountHidden === true;\n const [toolUIsMounted, setToolUIsMounted] = useState(mountToolUIs);\n // Adjusting state during render is React's sanctioned derived-state pattern.\n if (mountToolUIs && !toolUIsMounted) setToolUIsMounted(true);\n\n if (!groupKey || indices.length <= 1) return <>{children}</>;\n\n const toggle = () => setOpen(!open);\n\n return (\n <div\n data-slot=\"collapsible-group\"\n data-group-key={groupKey}\n className={cn('my-4 rounded-2xl border shadow-sm', className)}\n style={{\n borderColor: `${theme.color}33`,\n background: `linear-gradient(to right, ${theme.color}0d, transparent, ${theme.color}0d)`,\n }}\n >\n <div className=\"flex w-full items-center rounded-2xl\">\n <button\n type=\"button\"\n onClick={toggle}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex min-w-0 flex-1 items-center justify-between gap-3 rounded-2xl px-5 py-3 text-left transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n <span className=\"flex min-w-0 items-center gap-3 text-foreground/90\">\n {theme.icon ? (\n <img src={theme.icon} alt=\"\" aria-hidden=\"true\" className=\"size-5 shrink-0\" />\n ) : (\n <span\n className=\"inline-block size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: theme.color }}\n aria-hidden=\"true\"\n />\n )}\n <span className=\"truncate text-sm font-semibold\">\n {isMessageRunning ? 'Using ' : 'Used '}\n {groupKey} Toolkit\n </span>\n </span>\n <span className=\"shrink-0 text-xs font-medium text-muted-foreground\">\n {toolCallCount} tool {toolCallCount === 1 ? 'call' : 'calls'}\n </span>\n </button>\n <div className=\"flex shrink-0 items-center gap-1 pr-3 pl-1\">\n {headerActions}\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={open ? 'Collapse toolkit group' : 'Expand toolkit group'}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n {open ? <ChevronUp size={16} /> : <ChevronDown size={16} />}\n </button>\n </div>\n </div>\n\n <div\n id={panelId}\n className={cn(\n 'grid overflow-hidden border-t transition-[grid-template-rows] duration-200 ease-in-out motion-reduce:transition-none',\n open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',\n )}\n style={{ borderColor: `${theme.color}33` }}\n >\n <div className=\"overflow-hidden\">\n <GroupToolUIsMountedContext.Provider value={toolUIsMounted}>\n <div className=\"flex flex-col gap-2 px-5 py-4\">{children}</div>\n </GroupToolUIsMountedContext.Provider>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["createToolBasedGroupingFunction","defaultGetToolGroupKey","createContext","useContext","jsx","Fragment","groupingFunction","useId","useAuiState","useMemo","useState","jsxs","cn","ChevronUp","ChevronDown"],"mappings":";;;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CACZ,UAAA;AAAA,YAAA;AAAA,YACDP,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,cAAY,OAAO,2BAA2B;AAAA,gBAC9C,iBAAe;AAAA,gBACf,iBAAe;AAAA,gBACf,WAAU;AAAA,gBAET,UAAA,sCAAQS,YAAAA,WAAA,EAAU,MAAM,IAAI,IAAKT,2BAAAA,IAACU,YAAAA,aAAA,EAAY,MAAM,GAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3D,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QAEAV,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAWQ,OAAAA;AAAAA,cACT;AAAA,cACA,OAAO,oBAAoB;AAAA,YAAA;AAAA,YAE7B,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,KAAA;AAAA,YAEpC,yCAAC,OAAA,EAAI,WAAU,mBACb,UAAAR,2BAAAA,IAAC,2BAA2B,UAA3B,EAAoC,OAAO,gBAC1C,yCAAC,OAAA,EAAI,WAAU,iCAAiC,UAAS,GAC3D,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;;"}
|
|
@@ -41,8 +41,9 @@ export interface CollapsibleGroupProps {
|
|
|
41
41
|
*/
|
|
42
42
|
forceOpen?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Keep the live group collapsed while its turn runs, so only its header's
|
|
45
|
+
* count moves as calls land (default). Pass `false` to open the last grouped
|
|
46
|
+
* block while the run is live and close it when the run settles.
|
|
46
47
|
*/
|
|
47
48
|
compactWhileRunning?: boolean;
|
|
48
49
|
/**
|
|
@@ -61,9 +62,9 @@ export interface CollapsibleGroupProps {
|
|
|
61
62
|
/**
|
|
62
63
|
* Per-toolkit collapsible block inside the grouped details panel — "Using
|
|
63
64
|
* Spreadsheet Toolkit · 4 tool calls" — used by the SDK, Olympus, and the
|
|
64
|
-
* Chrome extension.
|
|
65
|
-
*
|
|
66
|
-
* mounted block.
|
|
65
|
+
* Chrome extension. A live group stays collapsed and counts its calls up
|
|
66
|
+
* (unless `compactWhileRunning` is off); the user's toggle is remembered for
|
|
67
|
+
* the mounted block.
|
|
67
68
|
*
|
|
68
69
|
* The group's tool UIs (the tool calls `GroupedMessageParts` renders through
|
|
69
70
|
* `GroupToolUI`) mount the first time they are needed — the group opens, its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleGroup.js","sources":["../../../src/chat/super-grouping/CollapsibleGroup.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\nimport { cn } from '../../lib/utils';\nimport { createToolBasedGroupingFunction, type GroupingFunction } from './grouping-function';\nimport { defaultGetToolGroupKey } from './toolkit-map';\n\n/**\n * Per-toolkit theme: the brand color that tints the group header, and an\n * optional icon URL a host serves (Olympus ships toolkit SVGs; the SDK does\n * not bundle images, so it tints only).\n */\nexport type ToolkitTheme = {\n /** Hex brand color for this toolkit. */\n color: string;\n /** Absolute or root-relative URL of the toolkit icon, when the host has one. */\n icon?: string;\n};\n\n/** Brand colors keyed by toolkit display name — the group keys the grouping function emits. */\nexport const TOOLKIT_THEMES: Record<string, ToolkitTheme> = {\n Web: { color: '#7BCCFA' },\n Document: { color: '#4586F9' },\n 'Document (Word)': { color: '#4586F9' },\n Notebook: { color: '#FFAB00' },\n Python: { color: '#00A76F' },\n Spreadsheet: { color: '#00A76F' },\n Email: { color: '#B584FF' },\n AOP: { color: '#336DFF' },\n App: { color: '#7336F5' },\n Presentation: { color: '#F56B36' },\n 'User Interface': { color: '#7336F5' },\n Canvas: { color: '#002542' },\n Computer: { color: '#3E0042' },\n Database: { color: '#7336F5' },\n 'Chrome Browser': { color: '#4285F4' },\n};\n\nexport const DEFAULT_TOOLKIT_THEME: ToolkitTheme = { color: '#919EAB' };\n\nconst DEFAULT_GROUPING = createToolBasedGroupingFunction(defaultGetToolGroupKey);\n\n/**\n * The grouping in force for the message being rendered. `SuperGroupingCard`\n * provides it so each `CollapsibleGroup` can tell whether it is the last\n * grouped block (the one that opens by default while the run is live) without\n * being handed the function as a prop through `GroupedMessageParts`, and\n * whether the card keeps its tool UIs mounted while hidden (`mountHidden`:\n * its turn is active, or a deep link targets it).\n */\nconst SuperGroupingContext = createContext<{\n groupingFunction: GroupingFunction;\n mountHidden?: boolean;\n} | null>(null);\n\nexport const SuperGroupingProvider = SuperGroupingContext.Provider;\n\n/** Whether the group a tool UI renders in has mounted its tool UIs; outside a group, always. */\nconst GroupToolUIsMountedContext = createContext(true);\n\n/**\n * A tool call's UI inside a `CollapsibleGroup`: rendered once the group first\n * needs its tool UIs (see `CollapsibleGroup`). `GroupedMessageParts` renders\n * every tool call through it.\n */\nexport function GroupToolUI({ children }: { children: ReactNode }) {\n return useContext(GroupToolUIsMountedContext) ? <>{children}</> : null;\n}\n\nexport interface CollapsibleGroupProps {\n /** Group key from the grouping function (toolkit display name); `undefined` for ungrouped parts. */\n groupKey: string | undefined;\n /** Indices of the parts belonging to this group. */\n indices: number[];\n children?: ReactNode;\n /** Host toolkit themes (colors, icons), merged over the built-in colors. */\n themes?: Record<string, ToolkitTheme>;\n /**\n * Keep the group open regardless of the run state — a host rule such as\n * \"an unsubmitted email draft stays visible\". The user's own toggle still\n * wins once used.\n */\n forceOpen?: boolean;\n /**\n * Do not open the live group by default (screenshot-heavy browser-control\n * runs hold hundreds of actions); the user can still expand it.\n */\n compactWhileRunning?: boolean;\n /**\n * Mount the tool UIs while collapsed (hidden), so a host that needs to find\n * one — a deep link into one of its tool calls — can. The card a group\n * renders in asks the same while its turn is active or its `mountDetails` is\n * set.\n */\n mountHidden?: boolean;\n /** Extra header controls, rendered as siblings of the toggle (never nested buttons). */\n headerActions?: ReactNode;\n /** The grouping used to find the last grouped block; defaults to the card's, then the SDK's. */\n groupingFunction?: GroupingFunction;\n className?: string;\n}\n\n/**\n * Per-toolkit collapsible block inside the grouped details panel — \"Using\n * Spreadsheet Toolkit · 4 tool calls\" — used by the SDK, Olympus, and the\n * Chrome extension. The last grouped block opens by default while the message\n * is running and settles closed; the user's toggle is remembered for the\n * mounted block.\n *\n * The group's tool UIs (the tool calls `GroupedMessageParts` renders through\n * `GroupToolUI`) mount the first time they are needed — the group opens, its\n * turn is running (live tool UIs run their effects), or a host asks\n * (`mountHidden`) — and stay mounted after. A finished turn's collapsed groups\n * mount none of their tool UIs, which a long run holds hundreds of. The rest\n * of the body renders from the start: the agent's text between the calls is\n * part of the message that selections, in-page find and links into the\n * message count.\n *\n * Selector discipline: one raw `s.message.content` read; every per-group\n * derivation (grouping, counts) runs in `useMemo` off it, so the grouping\n * pass happens once per content change instead of once per selector pass.\n */\nexport const CollapsibleGroup = ({\n groupKey,\n indices,\n children,\n themes,\n forceOpen = false,\n compactWhileRunning = false,\n mountHidden = false,\n headerActions,\n groupingFunction,\n className,\n}: CollapsibleGroupProps) => {\n const panelId = useId();\n const isMessageRunning = useAuiState((s) => s.message.status?.type === 'running');\n const messageContent = useAuiState((s) =>\n s.message.role === 'assistant' ? s.message.content : undefined,\n );\n const superGrouping = useContext(SuperGroupingContext);\n const grouping = groupingFunction ?? superGrouping?.groupingFunction ?? DEFAULT_GROUPING;\n\n const lastIndex = indices.at(-1);\n const isLastGroup = useMemo(() => {\n if (!messageContent) return false;\n const lastGroup = grouping(messageContent)\n .filter((group) => group.indices.length > 1)\n .at(-1);\n return lastGroup?.indices.at(-1) === lastIndex;\n }, [messageContent, grouping, lastIndex]);\n\n const toolCallCount = useMemo(\n () =>\n messageContent\n ? indices.reduce(\n (count, index) => (messageContent[index]?.type === 'tool-call' ? count + 1 : count),\n 0,\n )\n : 0,\n [messageContent, indices],\n );\n\n const theme = useMemo<ToolkitTheme>(\n () => (groupKey ? { ...TOOLKIT_THEMES, ...themes }[groupKey] ?? DEFAULT_TOOLKIT_THEME : DEFAULT_TOOLKIT_THEME),\n [groupKey, themes],\n );\n\n const [userOpened, setOpen] = useState<boolean>();\n const autoOpen = isLastGroup && isMessageRunning && !compactWhileRunning;\n const open = userOpened ?? (autoOpen || forceOpen);\n\n const mountToolUIs =\n open || isMessageRunning || mountHidden || superGrouping?.mountHidden === true;\n const [toolUIsMounted, setToolUIsMounted] = useState(mountToolUIs);\n // Adjusting state during render is React's sanctioned derived-state pattern.\n if (mountToolUIs && !toolUIsMounted) setToolUIsMounted(true);\n\n if (!groupKey || indices.length <= 1) return <>{children}</>;\n\n const toggle = () => setOpen(!open);\n\n return (\n <div\n data-slot=\"collapsible-group\"\n data-group-key={groupKey}\n className={cn('my-4 rounded-2xl border shadow-sm', className)}\n style={{\n borderColor: `${theme.color}33`,\n background: `linear-gradient(to right, ${theme.color}0d, transparent, ${theme.color}0d)`,\n }}\n >\n <div className=\"flex w-full items-center rounded-2xl\">\n <button\n type=\"button\"\n onClick={toggle}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex min-w-0 flex-1 items-center justify-between gap-3 rounded-2xl px-5 py-3 text-left transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n <span className=\"flex min-w-0 items-center gap-3 text-foreground/90\">\n {theme.icon ? (\n <img src={theme.icon} alt=\"\" aria-hidden=\"true\" className=\"size-5 shrink-0\" />\n ) : (\n <span\n className=\"inline-block size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: theme.color }}\n aria-hidden=\"true\"\n />\n )}\n <span className=\"truncate text-sm font-semibold\">\n {isMessageRunning ? 'Using ' : 'Used '}\n {groupKey} Toolkit\n </span>\n </span>\n <span className=\"shrink-0 text-xs font-medium text-muted-foreground\">\n {toolCallCount} tool {toolCallCount === 1 ? 'call' : 'calls'}\n </span>\n </button>\n <div className=\"flex shrink-0 items-center gap-1 pr-3 pl-1\">\n {headerActions}\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={open ? 'Collapse toolkit group' : 'Expand toolkit group'}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n {open ? <ChevronUp size={16} /> : <ChevronDown size={16} />}\n </button>\n </div>\n </div>\n\n <div\n id={panelId}\n className={cn(\n 'grid overflow-hidden border-t transition-[grid-template-rows] duration-200 ease-in-out motion-reduce:transition-none',\n open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',\n )}\n style={{ borderColor: `${theme.color}33` }}\n >\n <div className=\"overflow-hidden\">\n <GroupToolUIsMountedContext.Provider value={toolUIsMounted}>\n <div className=\"flex flex-col gap-2 px-5 py-4\">{children}</div>\n </GroupToolUIsMountedContext.Provider>\n </div>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqBO,MAAM,iBAA+C;AAAA,EAC1D,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,mBAAmB,EAAE,OAAO,UAAA;AAAA,EAC5B,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,QAAQ,EAAE,OAAO,UAAA;AAAA,EACjB,aAAa,EAAE,OAAO,UAAA;AAAA,EACtB,OAAO,EAAE,OAAO,UAAA;AAAA,EAChB,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,cAAc,EAAE,OAAO,UAAA;AAAA,EACvB,kBAAkB,EAAE,OAAO,UAAA;AAAA,EAC3B,QAAQ,EAAE,OAAO,UAAA;AAAA,EACjB,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,kBAAkB,EAAE,OAAO,UAAA;AAC7B;AAEO,MAAM,wBAAsC,EAAE,OAAO,UAAA;AAE5D,MAAM,mBAAmB,gCAAgC,sBAAsB;AAU/E,MAA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AAK,WAAU,kCACb,UAAA;AAAA,oBAAA,mBAAmB,WAAW;AAAA,oBAC9B;AAAA,oBAAS;AAAA,kBAAA,EAAA,CACZ;AAAA,gBAAA,GACF;AAAA,gBACA,qBAAC,QAAA,EAAK,WAAU,sDACb,UAAA;AAAA,kBAAA;AAAA,kBAAc;AAAA,kBAAO,kBAAkB,IAAI,SAAS;AAAA,gBAAA,EAAA,CACvD;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAEF,qBAAC,OAAA,EAAI,WAAU,8CACZ,UAAA;AAAA,YAAA;AAAA,YACD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,cAAY,OAAO,2BAA2B;AAAA,gBAC9C,iBAAe;AAAA,gBACf,iBAAe;AAAA,gBACf,WAAU;AAAA,gBAET,UAAA,2BAAQ,WAAA,EAAU,MAAM,IAAI,IAAK,oBAAC,aAAA,EAAY,MAAM,GAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3D,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QAEA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAW;AAAA,cACT;AAAA,cACA,OAAO,oBAAoB;AAAA,YAAA;AAAA,YAE7B,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,KAAA;AAAA,YAEpC,8BAAC,OAAA,EAAI,WAAU,mBACb,UAAA,oBAAC,2BAA2B,UAA3B,EAAoC,OAAO,gBAC1C,8BAAC,OAAA,EAAI,WAAU,iCAAiC,UAAS,GAC3D,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"CollapsibleGroup.js","sources":["../../../src/chat/super-grouping/CollapsibleGroup.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\nimport { cn } from '../../lib/utils';\nimport { createToolBasedGroupingFunction, type GroupingFunction } from './grouping-function';\nimport { defaultGetToolGroupKey } from './toolkit-map';\n\n/**\n * Per-toolkit theme: the brand color that tints the group header, and an\n * optional icon URL a host serves (Olympus ships toolkit SVGs; the SDK does\n * not bundle images, so it tints only).\n */\nexport type ToolkitTheme = {\n /** Hex brand color for this toolkit. */\n color: string;\n /** Absolute or root-relative URL of the toolkit icon, when the host has one. */\n icon?: string;\n};\n\n/** Brand colors keyed by toolkit display name — the group keys the grouping function emits. */\nexport const TOOLKIT_THEMES: Record<string, ToolkitTheme> = {\n Web: { color: '#7BCCFA' },\n Document: { color: '#4586F9' },\n 'Document (Word)': { color: '#4586F9' },\n Notebook: { color: '#FFAB00' },\n Python: { color: '#00A76F' },\n Spreadsheet: { color: '#00A76F' },\n Email: { color: '#B584FF' },\n AOP: { color: '#336DFF' },\n App: { color: '#7336F5' },\n Presentation: { color: '#F56B36' },\n 'User Interface': { color: '#7336F5' },\n Canvas: { color: '#002542' },\n Computer: { color: '#3E0042' },\n Database: { color: '#7336F5' },\n 'Chrome Browser': { color: '#4285F4' },\n};\n\nexport const DEFAULT_TOOLKIT_THEME: ToolkitTheme = { color: '#919EAB' };\n\nconst DEFAULT_GROUPING = createToolBasedGroupingFunction(defaultGetToolGroupKey);\n\n/**\n * The grouping in force for the message being rendered. `SuperGroupingCard`\n * provides it so each `CollapsibleGroup` can tell whether it is the last\n * grouped block (the one that opens while the run is live, when a host turns\n * `compactWhileRunning` off) without\n * being handed the function as a prop through `GroupedMessageParts`, and\n * whether the card keeps its tool UIs mounted while hidden (`mountHidden`:\n * its turn is active, or a deep link targets it).\n */\nconst SuperGroupingContext = createContext<{\n groupingFunction: GroupingFunction;\n mountHidden?: boolean;\n} | null>(null);\n\nexport const SuperGroupingProvider = SuperGroupingContext.Provider;\n\n/** Whether the group a tool UI renders in has mounted its tool UIs; outside a group, always. */\nconst GroupToolUIsMountedContext = createContext(true);\n\n/**\n * A tool call's UI inside a `CollapsibleGroup`: rendered once the group first\n * needs its tool UIs (see `CollapsibleGroup`). `GroupedMessageParts` renders\n * every tool call through it.\n */\nexport function GroupToolUI({ children }: { children: ReactNode }) {\n return useContext(GroupToolUIsMountedContext) ? <>{children}</> : null;\n}\n\nexport interface CollapsibleGroupProps {\n /** Group key from the grouping function (toolkit display name); `undefined` for ungrouped parts. */\n groupKey: string | undefined;\n /** Indices of the parts belonging to this group. */\n indices: number[];\n children?: ReactNode;\n /** Host toolkit themes (colors, icons), merged over the built-in colors. */\n themes?: Record<string, ToolkitTheme>;\n /**\n * Keep the group open regardless of the run state — a host rule such as\n * \"an unsubmitted email draft stays visible\". The user's own toggle still\n * wins once used.\n */\n forceOpen?: boolean;\n /**\n * Keep the live group collapsed while its turn runs, so only its header's\n * count moves as calls land (default). Pass `false` to open the last grouped\n * block while the run is live and close it when the run settles.\n */\n compactWhileRunning?: boolean;\n /**\n * Mount the tool UIs while collapsed (hidden), so a host that needs to find\n * one — a deep link into one of its tool calls — can. The card a group\n * renders in asks the same while its turn is active or its `mountDetails` is\n * set.\n */\n mountHidden?: boolean;\n /** Extra header controls, rendered as siblings of the toggle (never nested buttons). */\n headerActions?: ReactNode;\n /** The grouping used to find the last grouped block; defaults to the card's, then the SDK's. */\n groupingFunction?: GroupingFunction;\n className?: string;\n}\n\n/**\n * Per-toolkit collapsible block inside the grouped details panel — \"Using\n * Spreadsheet Toolkit · 4 tool calls\" — used by the SDK, Olympus, and the\n * Chrome extension. A live group stays collapsed and counts its calls up\n * (unless `compactWhileRunning` is off); the user's toggle is remembered for\n * the mounted block.\n *\n * The group's tool UIs (the tool calls `GroupedMessageParts` renders through\n * `GroupToolUI`) mount the first time they are needed — the group opens, its\n * turn is running (live tool UIs run their effects), or a host asks\n * (`mountHidden`) — and stay mounted after. A finished turn's collapsed groups\n * mount none of their tool UIs, which a long run holds hundreds of. The rest\n * of the body renders from the start: the agent's text between the calls is\n * part of the message that selections, in-page find and links into the\n * message count.\n *\n * Selector discipline: one raw `s.message.content` read; every per-group\n * derivation (grouping, counts) runs in `useMemo` off it, so the grouping\n * pass happens once per content change instead of once per selector pass.\n */\nexport const CollapsibleGroup = ({\n groupKey,\n indices,\n children,\n themes,\n forceOpen = false,\n compactWhileRunning = true,\n mountHidden = false,\n headerActions,\n groupingFunction,\n className,\n}: CollapsibleGroupProps) => {\n const panelId = useId();\n const isMessageRunning = useAuiState((s) => s.message.status?.type === 'running');\n const messageContent = useAuiState((s) =>\n s.message.role === 'assistant' ? s.message.content : undefined,\n );\n const superGrouping = useContext(SuperGroupingContext);\n const grouping = groupingFunction ?? superGrouping?.groupingFunction ?? DEFAULT_GROUPING;\n\n const lastIndex = indices.at(-1);\n const isLastGroup = useMemo(() => {\n if (!messageContent) return false;\n const lastGroup = grouping(messageContent)\n .filter((group) => group.indices.length > 1)\n .at(-1);\n return lastGroup?.indices.at(-1) === lastIndex;\n }, [messageContent, grouping, lastIndex]);\n\n const toolCallCount = useMemo(\n () =>\n messageContent\n ? indices.reduce(\n (count, index) => (messageContent[index]?.type === 'tool-call' ? count + 1 : count),\n 0,\n )\n : 0,\n [messageContent, indices],\n );\n\n const theme = useMemo<ToolkitTheme>(\n () => (groupKey ? { ...TOOLKIT_THEMES, ...themes }[groupKey] ?? DEFAULT_TOOLKIT_THEME : DEFAULT_TOOLKIT_THEME),\n [groupKey, themes],\n );\n\n const [userOpened, setOpen] = useState<boolean>();\n const autoOpen = isLastGroup && isMessageRunning && !compactWhileRunning;\n const open = userOpened ?? (autoOpen || forceOpen);\n\n const mountToolUIs =\n open || isMessageRunning || mountHidden || superGrouping?.mountHidden === true;\n const [toolUIsMounted, setToolUIsMounted] = useState(mountToolUIs);\n // Adjusting state during render is React's sanctioned derived-state pattern.\n if (mountToolUIs && !toolUIsMounted) setToolUIsMounted(true);\n\n if (!groupKey || indices.length <= 1) return <>{children}</>;\n\n const toggle = () => setOpen(!open);\n\n return (\n <div\n data-slot=\"collapsible-group\"\n data-group-key={groupKey}\n className={cn('my-4 rounded-2xl border shadow-sm', className)}\n style={{\n borderColor: `${theme.color}33`,\n background: `linear-gradient(to right, ${theme.color}0d, transparent, ${theme.color}0d)`,\n }}\n >\n <div className=\"flex w-full items-center rounded-2xl\">\n <button\n type=\"button\"\n onClick={toggle}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex min-w-0 flex-1 items-center justify-between gap-3 rounded-2xl px-5 py-3 text-left transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n <span className=\"flex min-w-0 items-center gap-3 text-foreground/90\">\n {theme.icon ? (\n <img src={theme.icon} alt=\"\" aria-hidden=\"true\" className=\"size-5 shrink-0\" />\n ) : (\n <span\n className=\"inline-block size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: theme.color }}\n aria-hidden=\"true\"\n />\n )}\n <span className=\"truncate text-sm font-semibold\">\n {isMessageRunning ? 'Using ' : 'Used '}\n {groupKey} Toolkit\n </span>\n </span>\n <span className=\"shrink-0 text-xs font-medium text-muted-foreground\">\n {toolCallCount} tool {toolCallCount === 1 ? 'call' : 'calls'}\n </span>\n </button>\n <div className=\"flex shrink-0 items-center gap-1 pr-3 pl-1\">\n {headerActions}\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={open ? 'Collapse toolkit group' : 'Expand toolkit group'}\n aria-expanded={open}\n aria-controls={panelId}\n className=\"flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-black/5 dark:hover:bg-white/5\"\n >\n {open ? <ChevronUp size={16} /> : <ChevronDown size={16} />}\n </button>\n </div>\n </div>\n\n <div\n id={panelId}\n className={cn(\n 'grid overflow-hidden border-t transition-[grid-template-rows] duration-200 ease-in-out motion-reduce:transition-none',\n open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',\n )}\n style={{ borderColor: `${theme.color}33` }}\n >\n <div className=\"overflow-hidden\">\n <GroupToolUIsMountedContext.Provider value={toolUIsMounted}>\n <div className=\"flex flex-col gap-2 px-5 py-4\">{children}</div>\n </GroupToolUIsMountedContext.Provider>\n </div>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqBO,MAAM,iBAA+C;AAAA,EAC1D,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,mBAAmB,EAAE,OAAO,UAAA;AAAA,EAC5B,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,QAAQ,EAAE,OAAO,UAAA;AAAA,EACjB,aAAa,EAAE,OAAO,UAAA;AAAA,EACtB,OAAO,EAAE,OAAO,UAAA;AAAA,EAChB,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,KAAK,EAAE,OAAO,UAAA;AAAA,EACd,cAAc,EAAE,OAAO,UAAA;AAAA,EACvB,kBAAkB,EAAE,OAAO,UAAA;AAAA,EAC3B,QAAQ,EAAE,OAAO,UAAA;AAAA,EACjB,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,UAAU,EAAE,OAAO,UAAA;AAAA,EACnB,kBAAkB,EAAE,OAAO,UAAA;AAC7B;AAEO,MAAM,wBAAsC,EAAE,OAAO,UAAA;AAE5D,MAAM,mBAAmB,gCAAgC,sBAAsB;AAW/E,MAAM,uBAAuB,cAGnB,IAAI;AAEP,MAAM,wBAAwB,qBAAqB;AAG1D,MAAM,6BAA6B,cAAc,IAAI;AAO9C,SAAS,YAAY,EAAE,YAAqC;AACjE,SAAO,WAAW,0BAA0B,IAAI,oBAAA,UAAA,EAAG,UAAS,IAAM;AACpE;AAwDO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,sBAAsB;AAAA,EACtB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACF,MAA6B;AAC3B,QAAM,UAAU,MAAA;AAChB,QAAM,mBAAmB,YAAY,CAAC,MAAA;;AAAM,oBAAE,QAAQ,WA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2BAA2B;AAAA,gBAC9C,iBAAe;AAAA,gBACf,iBAAe;AAAA,gBACf,WAAU;AAAA,gBAET,UAAA,2BAAQ,WAAA,EAAU,MAAM,IAAI,IAAK,oBAAC,aAAA,EAAY,MAAM,GAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3D,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QAEA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAW;AAAA,cACT;AAAA,cACA,OAAO,oBAAoB;AAAA,YAAA;AAAA,YAE7B,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,KAAA;AAAA,YAEpC,8BAAC,OAAA,EAAI,WAAU,mBACb,UAAA,oBAAC,2BAA2B,UAA3B,EAAoC,OAAO,gBAC1C,8BAAC,OAAA,EAAI,WAAU,iCAAiC,UAAS,GAC3D,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -4,10 +4,9 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const react = require("@assistant-ui/react");
|
|
5
5
|
const lucideReact = require("lucide-react");
|
|
6
6
|
const require$$0 = require("react");
|
|
7
|
-
const
|
|
7
|
+
const historyStore = require("../../agent-runtime/src/history-store.cjs");
|
|
8
8
|
const errors = require("../../agent-runtime/src/errors.cjs");
|
|
9
9
|
function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
10
|
-
const historyPages = statewireWindowContext.useStatewireHistoryPages();
|
|
11
10
|
const send = react.useAuiState(
|
|
12
11
|
(s) => {
|
|
13
12
|
var _a;
|
|
@@ -16,13 +15,13 @@ function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
|
16
15
|
);
|
|
17
16
|
const [loading, setLoading] = require$$0.useState(false);
|
|
18
17
|
const loadSteps = require$$0.useCallback(() => {
|
|
19
|
-
if (marker.hiddenSteps === 0 || loading || !
|
|
18
|
+
if (marker.hiddenSteps === 0 || loading || !send) return;
|
|
20
19
|
setLoading(true);
|
|
21
|
-
|
|
20
|
+
historyStore.loadDeepAgentTurnSteps({ send, marker }).catch((error) => {
|
|
22
21
|
if (error instanceof Error && errors.isStatewireChannelTeardown(error)) return;
|
|
23
22
|
console.warn("[AthenaChat] history/page steps failed:", error);
|
|
24
23
|
}).finally(() => setLoading(false));
|
|
25
|
-
}, [
|
|
24
|
+
}, [loading, marker, send]);
|
|
26
25
|
const autoLoadedTurn = require$$0.useRef(null);
|
|
27
26
|
const wantsNewest = autoLoad && marker.before === void 0 && marker.hiddenSteps > 0;
|
|
28
27
|
require$$0.useEffect(() => {
|
|
@@ -30,7 +29,7 @@ function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
|
30
29
|
autoLoadedTurn.current = marker.turn;
|
|
31
30
|
loadSteps();
|
|
32
31
|
}, [wantsNewest, marker.turn, loadSteps]);
|
|
33
|
-
if (marker.hiddenSteps === 0 || !
|
|
32
|
+
if (marker.hiddenSteps === 0 || !send) return null;
|
|
34
33
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
34
|
"button",
|
|
36
35
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"earlier-steps-button.cjs","sources":["../../../src/chat/super-grouping/earlier-steps-button.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport {
|
|
1
|
+
{"version":3,"file":"earlier-steps-button.cjs","sources":["../../../src/chat/super-grouping/earlier-steps-button.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport {\n type DeepAgentHistorySend,\n isStatewireChannelTeardown,\n loadDeepAgentTurnSteps,\n} from '@athenaintel/agent-runtime';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { TurnStepsControlProps } from './use-turn-steps';\n\n/**\n * \"Show 600 earlier steps\": fetches the next (older) steps a turn of older\n * history left out (`history/page` with its `turn`, into the conversation's\n * history store through `loadDeepAgentTurnSteps`), newest first, until none\n * are left. With `autoLoad` (an opened card) it fetches the newest page by\n * itself, once per turn; a failed or further page is the reader's to ask for,\n * never a retry loop. Renders nothing for a turn with no steps left, or with\n * no thread to ask. `AthenaProvider` provides it (`TurnStepsControlContext`).\n */\nexport function EarlierStepsButton({ marker, autoLoad = false }: TurnStepsControlProps) {\n const send = useAuiState(\n (s) => (s.thread.extras as { sendCommand?: DeepAgentHistorySend } | undefined)?.sendCommand,\n );\n const [loading, setLoading] = useState(false);\n const loadSteps = useCallback(() => {\n if (marker.hiddenSteps === 0 || loading || !send) return;\n setLoading(true);\n loadDeepAgentTurnSteps({ send, marker })\n .catch((error: unknown) => {\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn('[AthenaChat] history/page steps failed:', error);\n })\n .finally(() => setLoading(false));\n }, [loading, marker, send]);\n const autoLoadedTurn = useRef<string | null>(null);\n const wantsNewest = autoLoad && marker.before === undefined && marker.hiddenSteps > 0;\n useEffect(() => {\n if (!wantsNewest || autoLoadedTurn.current === marker.turn) return;\n autoLoadedTurn.current = marker.turn;\n loadSteps();\n }, [wantsNewest, marker.turn, loadSteps]);\n if (marker.hiddenSteps === 0 || !send) return null;\n return (\n <button\n type=\"button\"\n data-slot=\"turn-earlier-steps\"\n onClick={loadSteps}\n disabled={loading}\n className=\"flex w-fit items-center gap-1.5 rounded py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-70\"\n >\n <ChevronRight aria-hidden=\"true\" className=\"size-3\" />\n {loading\n ? 'Loading earlier steps…'\n : `Show ${marker.hiddenSteps} earlier ${marker.hiddenSteps === 1 ? 'step' : 'steps'}`}\n </button>\n );\n}\n"],"names":["useAuiState","useState","useCallback","loadDeepAgentTurnSteps","isStatewireChannelTeardown","useRef","useEffect","jsxs","jsx","ChevronRight"],"mappings":";;;;;;;;AAmBO,SAAS,mBAAmB,EAAE,QAAQ,WAAW,SAAgC;AACtF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{ TurnStepsControlProps } from './use-turn-steps';
|
|
2
2
|
/**
|
|
3
3
|
* "Show 600 earlier steps": fetches the next (older) steps a turn of older
|
|
4
|
-
* history left out (`history/page` with its `turn`,
|
|
5
|
-
* store
|
|
6
|
-
* (an opened card) it fetches the newest page by
|
|
7
|
-
* failed or further page is the reader's to ask for,
|
|
8
|
-
* Renders nothing for a turn with no steps left, or with
|
|
9
|
-
* `AthenaProvider` provides it (`TurnStepsControlContext`).
|
|
4
|
+
* history left out (`history/page` with its `turn`, into the conversation's
|
|
5
|
+
* history store through `loadDeepAgentTurnSteps`), newest first, until none
|
|
6
|
+
* are left. With `autoLoad` (an opened card) it fetches the newest page by
|
|
7
|
+
* itself, once per turn; a failed or further page is the reader's to ask for,
|
|
8
|
+
* never a retry loop. Renders nothing for a turn with no steps left, or with
|
|
9
|
+
* no thread to ask. `AthenaProvider` provides it (`TurnStepsControlContext`).
|
|
10
10
|
*/
|
|
11
11
|
export declare function EarlierStepsButton({ marker, autoLoad }: TurnStepsControlProps): import("react").JSX.Element | null;
|
|
@@ -2,10 +2,9 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useAuiState } from "@assistant-ui/react";
|
|
3
3
|
import { ChevronRight } from "lucide-react";
|
|
4
4
|
import { useState, useCallback, useRef, useEffect } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { loadDeepAgentTurnSteps } from "../../agent-runtime/src/history-store.js";
|
|
6
6
|
import { isStatewireChannelTeardown } from "../../agent-runtime/src/errors.js";
|
|
7
7
|
function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
8
|
-
const historyPages = useStatewireHistoryPages();
|
|
9
8
|
const send = useAuiState(
|
|
10
9
|
(s) => {
|
|
11
10
|
var _a;
|
|
@@ -14,13 +13,13 @@ function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
|
14
13
|
);
|
|
15
14
|
const [loading, setLoading] = useState(false);
|
|
16
15
|
const loadSteps = useCallback(() => {
|
|
17
|
-
if (marker.hiddenSteps === 0 || loading || !
|
|
16
|
+
if (marker.hiddenSteps === 0 || loading || !send) return;
|
|
18
17
|
setLoading(true);
|
|
19
|
-
|
|
18
|
+
loadDeepAgentTurnSteps({ send, marker }).catch((error) => {
|
|
20
19
|
if (error instanceof Error && isStatewireChannelTeardown(error)) return;
|
|
21
20
|
console.warn("[AthenaChat] history/page steps failed:", error);
|
|
22
21
|
}).finally(() => setLoading(false));
|
|
23
|
-
}, [
|
|
22
|
+
}, [loading, marker, send]);
|
|
24
23
|
const autoLoadedTurn = useRef(null);
|
|
25
24
|
const wantsNewest = autoLoad && marker.before === void 0 && marker.hiddenSteps > 0;
|
|
26
25
|
useEffect(() => {
|
|
@@ -28,7 +27,7 @@ function EarlierStepsButton({ marker, autoLoad = false }) {
|
|
|
28
27
|
autoLoadedTurn.current = marker.turn;
|
|
29
28
|
loadSteps();
|
|
30
29
|
}, [wantsNewest, marker.turn, loadSteps]);
|
|
31
|
-
if (marker.hiddenSteps === 0 || !
|
|
30
|
+
if (marker.hiddenSteps === 0 || !send) return null;
|
|
32
31
|
return /* @__PURE__ */ jsxs(
|
|
33
32
|
"button",
|
|
34
33
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"earlier-steps-button.js","sources":["../../../src/chat/super-grouping/earlier-steps-button.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport {
|
|
1
|
+
{"version":3,"file":"earlier-steps-button.js","sources":["../../../src/chat/super-grouping/earlier-steps-button.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport {\n type DeepAgentHistorySend,\n isStatewireChannelTeardown,\n loadDeepAgentTurnSteps,\n} from '@athenaintel/agent-runtime';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { TurnStepsControlProps } from './use-turn-steps';\n\n/**\n * \"Show 600 earlier steps\": fetches the next (older) steps a turn of older\n * history left out (`history/page` with its `turn`, into the conversation's\n * history store through `loadDeepAgentTurnSteps`), newest first, until none\n * are left. With `autoLoad` (an opened card) it fetches the newest page by\n * itself, once per turn; a failed or further page is the reader's to ask for,\n * never a retry loop. Renders nothing for a turn with no steps left, or with\n * no thread to ask. `AthenaProvider` provides it (`TurnStepsControlContext`).\n */\nexport function EarlierStepsButton({ marker, autoLoad = false }: TurnStepsControlProps) {\n const send = useAuiState(\n (s) => (s.thread.extras as { sendCommand?: DeepAgentHistorySend } | undefined)?.sendCommand,\n );\n const [loading, setLoading] = useState(false);\n const loadSteps = useCallback(() => {\n if (marker.hiddenSteps === 0 || loading || !send) return;\n setLoading(true);\n loadDeepAgentTurnSteps({ send, marker })\n .catch((error: unknown) => {\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn('[AthenaChat] history/page steps failed:', error);\n })\n .finally(() => setLoading(false));\n }, [loading, marker, send]);\n const autoLoadedTurn = useRef<string | null>(null);\n const wantsNewest = autoLoad && marker.before === undefined && marker.hiddenSteps > 0;\n useEffect(() => {\n if (!wantsNewest || autoLoadedTurn.current === marker.turn) return;\n autoLoadedTurn.current = marker.turn;\n loadSteps();\n }, [wantsNewest, marker.turn, loadSteps]);\n if (marker.hiddenSteps === 0 || !send) return null;\n return (\n <button\n type=\"button\"\n data-slot=\"turn-earlier-steps\"\n onClick={loadSteps}\n disabled={loading}\n className=\"flex w-fit items-center gap-1.5 rounded py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-70\"\n >\n <ChevronRight aria-hidden=\"true\" className=\"size-3\" />\n {loading\n ? 'Loading earlier steps…'\n : `Show ${marker.hiddenSteps} earlier ${marker.hiddenSteps === 1 ? 'step' : 'steps'}`}\n </button>\n );\n}\n"],"names":[],"mappings":";;;;;;AAmBO,SAAS,mBAAmB,EAAE,QAAQ,WAAW,SAAgC;AACtF,QAAM,OAAO;AAAA,IACX,CAAC,MAAA;;AAAO,qBAAE,OAAO,WAAT,mBAAwE;AAAA;AAAA,EAAA;AAElF,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,YAAY,YAAY,MAAM;AAClC,QAAI,OAAO,gBAAgB,KAAK,WAAW,CAAC,KAAM;AAClD,eAAW,IAAI;AACf,2BAAuB,EAAE,MAAM,OAAA,CAAQ,EACpC,MAAM,CAAC,UAAmB;AACzB,UAAI,iBAAiB,SAAS,2BAA2B,KAAK,EAAG;AACjE,cAAQ,KAAK,2CAA2C,KAAK;AAAA,IAC/D,CAAC,EACA,QAAQ,MAAM,WAAW,KAAK,CAAC;AAAA,EACpC,GAAG,CAAC,SAAS,QAAQ,IAAI,CAAC;AAC1B,QAAM,iBAAiB,OAAsB,IAAI;AACjD,QAAM,cAAc,YAAY,OAAO,WAAW,UAAa,OAAO,cAAc;AACpF,YAAU,MAAM;AACd,QAAI,CAAC,eAAe,eAAe,YAAY,OAAO,KAAM;AAC5D,mBAAe,UAAU,OAAO;AAChC,cAAA;AAAA,EACF,GAAG,CAAC,aAAa,OAAO,MAAM,SAAS,CAAC;AACxC,MAAI,OAAO,gBAAgB,KAAK,CAAC,KAAM,QAAO;AAC9C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,aAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,oBAAC,cAAA,EAAa,eAAY,QAAO,WAAU,UAAS;AAAA,QACnD,UACG,2BACA,QAAQ,OAAO,WAAW,YAAY,OAAO,gBAAgB,IAAI,SAAS,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG3F;"}
|
|
@@ -44,6 +44,7 @@ const DEFAULT_TOOL_TO_TOOLKIT = {
|
|
|
44
44
|
capture_slide_screenshot: "Presentation",
|
|
45
45
|
capture_slide_screenshots: "Presentation",
|
|
46
46
|
restore_presentation_slides: "Presentation",
|
|
47
|
+
restore_spreadsheet_sheets: "Spreadsheet",
|
|
47
48
|
// Studio presentation PTC
|
|
48
49
|
CreatePresentation: "Presentation",
|
|
49
50
|
OpenPresentation: "Presentation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit-map.cjs","sources":["../../../src/chat/super-grouping/toolkit-map.ts"],"sourcesContent":["/**\n * Static map of tool names → toolkit group display key, mirroring Olympus's\n * runtime `toolDefinitionsStore` output. The SDK doesn't ship a backend-fetched\n * toolkit catalog, so this provides the same grouping behavior using the names\n * the agent typically calls. Consumers can override via the `getToolGroupKey`\n * prop on `<AthenaChat>`.\n *\n * Keys here are toolkit *display* names (what users see in the toolkit\n * selector), not toolkit IDs — they match Olympus's\n * `getToolkitToGroupKeyMap()` output.\n */\nconst DEFAULT_TOOL_TO_TOOLKIT: Record<string, string> = {\n // Web\n search: 'Web',\n browse: 'Web',\n web_search: 'Web',\n search_web: 'Web',\n web_scrape: 'Web',\n scrape_web: 'Web',\n\n // Document\n create_new_document: 'Document',\n create_document_from_markdown: 'Document',\n append_markdown_to_athena_document: 'Document',\n replace_markdown_in_athena_document: 'Document',\n delete_blocks_from_athena_document: 'Document',\n convert_athena_doc_to_pdf: 'Document',\n convert_to_pdf: 'Document',\n\n // Word document (Studio)\n CreateDocument: 'Document (Word)',\n CreateParagraph: 'Document (Word)',\n OpenDocument: 'Document (Word)',\n execute_word_commands: 'Document (Word)',\n create_new_word_document: 'Document (Word)',\n\n // Spreadsheet\n create_new_sheet: 'Spreadsheet',\n update_sheet_range: 'Spreadsheet',\n format_sheet_range: 'Spreadsheet',\n bulk_format_sheet_range: 'Spreadsheet',\n create_table: 'Spreadsheet',\n update_table: 'Spreadsheet',\n update_chart: 'Spreadsheet',\n // Studio sheet PTC\n CreateWorkbook: 'Spreadsheet',\n AddSheet: 'Spreadsheet',\n OpenWorkbook: 'Spreadsheet',\n\n // Visualizations\n create_chart: 'Visualizations (Charts, Dashboards, Figures)',\n create_new_figure: 'Visualizations (Charts, Dashboards, Figures)',\n\n // Presentation\n create_powerpoint_deck: 'Presentation',\n create_presentation_pptx_studio: 'Presentation',\n execute_presentation_code: 'Presentation',\n capture_slide_screenshot: 'Presentation',\n capture_slide_screenshots: 'Presentation',\n restore_presentation_slides: 'Presentation',\n // Studio presentation PTC\n CreatePresentation: 'Presentation',\n OpenPresentation: 'Presentation',\n AddSlide: 'Presentation',\n\n // Notebook\n create_new_notebook: 'Notebook',\n run_notebook_cell: 'Notebook',\n\n // Python / code execution\n run_python_code: 'Python',\n run_python: 'Python',\n\n // Database\n run_sql: 'Database',\n run_database_sql: 'Database',\n run_sql_query_tool: 'Database',\n execute_sql: 'Database',\n describe_database: 'Database',\n list_database_tables: 'Database',\n get_database_table_schema: 'Database',\n\n // Email / calendar\n search_email: 'Email',\n unified_email_search: 'Email',\n\n // Media\n capture_moment: 'Computer',\n};\n\n/**\n * Tools that should never participate in grouping — even when surrounded by\n * tools of the same toolkit. Mirrors Olympus's `UNGROUPED_TOOLS`.\n */\nconst UNGROUPED_TOOLS: readonly string[] = [\n 'read_asset',\n 'read_full_asset',\n 'ask',\n 'open_asset_in_workspace',\n 'create_email_draft',\n 'unified_email_create_draft',\n 'unified_email_send',\n 'unified_email_edit_draft',\n];\n\n/**\n * Generic sandbox runtime tools shared across many toolkits (notebook,\n * computer, session sandbox, …). Mirrors Olympus's `CONTEXT_ONLY_TOOLS`:\n * they never start a toolkit group on their own — they only inherit the\n * surrounding group.\n */\nconst CONTEXT_ONLY_TOOLS: readonly string[] = [\n 'execute',\n 'ls',\n 'read_file',\n 'write_file',\n 'edit_file',\n 'glob',\n 'grep',\n];\n\n/**\n * Group display keys for toolkits that target a sandbox and therefore contain\n * the shared runtime tools. Context-only tools may only inherit these groups —\n * an open Web or Email group must not absorb a sandbox call.\n */\nconst SANDBOX_TOOLKIT_GROUPS: readonly string[] = ['Notebook', 'Computer', 'Session Sandbox'];\n\nexport type ToolGroupKeyOptions = {\n /** Display name of the surrounding group, when one is already open. */\n preferredGroupKey?: string;\n /**\n * Distinct tool names the message called. Hosts with a toolkit catalog use\n * it to attribute a tool shared by several toolkits to the one the message\n * leans on; the default map ignores it.\n */\n calledToolNames?: ReadonlySet<string>;\n};\n\n/**\n * Default `getToolGroupKey` implementation used by the SDK's tool grouping.\n * Returns the toolkit display key for a tool name, or `undefined` if the tool\n * is ungrouped or unknown. Context-only tools inherit the surrounding group\n * and are otherwise ungrouped.\n *\n * Override per-app by passing `getToolGroupKey` (or a whole `groupingFunction`) to\n * `SuperGroupingCard`.\n */\nexport const defaultGetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n): string | undefined => {\n if (UNGROUPED_TOOLS.includes(toolName)) return undefined;\n if (CONTEXT_ONLY_TOOLS.includes(toolName)) {\n const preferred = options?.preferredGroupKey;\n return preferred && SANDBOX_TOOLKIT_GROUPS.includes(preferred) ? preferred : undefined;\n }\n return DEFAULT_TOOL_TO_TOOLKIT[toolName];\n};\n\nexport type GetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n) => string | undefined;\n"],"names":[],"mappings":";;AAWA,MAAM,0BAAkD;AAAA;AAAA,EAEtD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAGZ,qBAAqB;AAAA,EACrB,+BAA+B;AAAA,EAC/B,oCAAoC;AAAA,EACpC,qCAAqC;AAAA,EACrC,oCAAoC;AAAA,EACpC,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA;AAAA,EAGhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,0BAA0B;AAAA;AAAA,EAG1B,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA;AAAA,EAEd,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,cAAc;AAAA;AAAA,EAGd,cAAc;AAAA,EACd,mBAAmB;AAAA;AAAA,EAGnB,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,2BAA2B;AAAA,EAC3B,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"toolkit-map.cjs","sources":["../../../src/chat/super-grouping/toolkit-map.ts"],"sourcesContent":["/**\n * Static map of tool names → toolkit group display key, mirroring Olympus's\n * runtime `toolDefinitionsStore` output. The SDK doesn't ship a backend-fetched\n * toolkit catalog, so this provides the same grouping behavior using the names\n * the agent typically calls. Consumers can override via the `getToolGroupKey`\n * prop on `<AthenaChat>`.\n *\n * Keys here are toolkit *display* names (what users see in the toolkit\n * selector), not toolkit IDs — they match Olympus's\n * `getToolkitToGroupKeyMap()` output.\n */\nconst DEFAULT_TOOL_TO_TOOLKIT: Record<string, string> = {\n // Web\n search: 'Web',\n browse: 'Web',\n web_search: 'Web',\n search_web: 'Web',\n web_scrape: 'Web',\n scrape_web: 'Web',\n\n // Document\n create_new_document: 'Document',\n create_document_from_markdown: 'Document',\n append_markdown_to_athena_document: 'Document',\n replace_markdown_in_athena_document: 'Document',\n delete_blocks_from_athena_document: 'Document',\n convert_athena_doc_to_pdf: 'Document',\n convert_to_pdf: 'Document',\n\n // Word document (Studio)\n CreateDocument: 'Document (Word)',\n CreateParagraph: 'Document (Word)',\n OpenDocument: 'Document (Word)',\n execute_word_commands: 'Document (Word)',\n create_new_word_document: 'Document (Word)',\n\n // Spreadsheet\n create_new_sheet: 'Spreadsheet',\n update_sheet_range: 'Spreadsheet',\n format_sheet_range: 'Spreadsheet',\n bulk_format_sheet_range: 'Spreadsheet',\n create_table: 'Spreadsheet',\n update_table: 'Spreadsheet',\n update_chart: 'Spreadsheet',\n // Studio sheet PTC\n CreateWorkbook: 'Spreadsheet',\n AddSheet: 'Spreadsheet',\n OpenWorkbook: 'Spreadsheet',\n\n // Visualizations\n create_chart: 'Visualizations (Charts, Dashboards, Figures)',\n create_new_figure: 'Visualizations (Charts, Dashboards, Figures)',\n\n // Presentation\n create_powerpoint_deck: 'Presentation',\n create_presentation_pptx_studio: 'Presentation',\n execute_presentation_code: 'Presentation',\n capture_slide_screenshot: 'Presentation',\n capture_slide_screenshots: 'Presentation',\n restore_presentation_slides: 'Presentation',\n restore_spreadsheet_sheets: 'Spreadsheet',\n // Studio presentation PTC\n CreatePresentation: 'Presentation',\n OpenPresentation: 'Presentation',\n AddSlide: 'Presentation',\n\n // Notebook\n create_new_notebook: 'Notebook',\n run_notebook_cell: 'Notebook',\n\n // Python / code execution\n run_python_code: 'Python',\n run_python: 'Python',\n\n // Database\n run_sql: 'Database',\n run_database_sql: 'Database',\n run_sql_query_tool: 'Database',\n execute_sql: 'Database',\n describe_database: 'Database',\n list_database_tables: 'Database',\n get_database_table_schema: 'Database',\n\n // Email / calendar\n search_email: 'Email',\n unified_email_search: 'Email',\n\n // Media\n capture_moment: 'Computer',\n};\n\n/**\n * Tools that should never participate in grouping — even when surrounded by\n * tools of the same toolkit. Mirrors Olympus's `UNGROUPED_TOOLS`.\n */\nconst UNGROUPED_TOOLS: readonly string[] = [\n 'read_asset',\n 'read_full_asset',\n 'ask',\n 'open_asset_in_workspace',\n 'create_email_draft',\n 'unified_email_create_draft',\n 'unified_email_send',\n 'unified_email_edit_draft',\n];\n\n/**\n * Generic sandbox runtime tools shared across many toolkits (notebook,\n * computer, session sandbox, …). Mirrors Olympus's `CONTEXT_ONLY_TOOLS`:\n * they never start a toolkit group on their own — they only inherit the\n * surrounding group.\n */\nconst CONTEXT_ONLY_TOOLS: readonly string[] = [\n 'execute',\n 'ls',\n 'read_file',\n 'write_file',\n 'edit_file',\n 'glob',\n 'grep',\n];\n\n/**\n * Group display keys for toolkits that target a sandbox and therefore contain\n * the shared runtime tools. Context-only tools may only inherit these groups —\n * an open Web or Email group must not absorb a sandbox call.\n */\nconst SANDBOX_TOOLKIT_GROUPS: readonly string[] = ['Notebook', 'Computer', 'Session Sandbox'];\n\nexport type ToolGroupKeyOptions = {\n /** Display name of the surrounding group, when one is already open. */\n preferredGroupKey?: string;\n /**\n * Distinct tool names the message called. Hosts with a toolkit catalog use\n * it to attribute a tool shared by several toolkits to the one the message\n * leans on; the default map ignores it.\n */\n calledToolNames?: ReadonlySet<string>;\n};\n\n/**\n * Default `getToolGroupKey` implementation used by the SDK's tool grouping.\n * Returns the toolkit display key for a tool name, or `undefined` if the tool\n * is ungrouped or unknown. Context-only tools inherit the surrounding group\n * and are otherwise ungrouped.\n *\n * Override per-app by passing `getToolGroupKey` (or a whole `groupingFunction`) to\n * `SuperGroupingCard`.\n */\nexport const defaultGetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n): string | undefined => {\n if (UNGROUPED_TOOLS.includes(toolName)) return undefined;\n if (CONTEXT_ONLY_TOOLS.includes(toolName)) {\n const preferred = options?.preferredGroupKey;\n return preferred && SANDBOX_TOOLKIT_GROUPS.includes(preferred) ? preferred : undefined;\n }\n return DEFAULT_TOOL_TO_TOOLKIT[toolName];\n};\n\nexport type GetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n) => string | undefined;\n"],"names":[],"mappings":";;AAWA,MAAM,0BAAkD;AAAA;AAAA,EAEtD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAGZ,qBAAqB;AAAA,EACrB,+BAA+B;AAAA,EAC/B,oCAAoC;AAAA,EACpC,qCAAqC;AAAA,EACrC,oCAAoC;AAAA,EACpC,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA;AAAA,EAGhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,0BAA0B;AAAA;AAAA,EAG1B,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,oBAAo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|
|
@@ -42,6 +42,7 @@ const DEFAULT_TOOL_TO_TOOLKIT = {
|
|
|
42
42
|
capture_slide_screenshot: "Presentation",
|
|
43
43
|
capture_slide_screenshots: "Presentation",
|
|
44
44
|
restore_presentation_slides: "Presentation",
|
|
45
|
+
restore_spreadsheet_sheets: "Spreadsheet",
|
|
45
46
|
// Studio presentation PTC
|
|
46
47
|
CreatePresentation: "Presentation",
|
|
47
48
|
OpenPresentation: "Presentation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit-map.js","sources":["../../../src/chat/super-grouping/toolkit-map.ts"],"sourcesContent":["/**\n * Static map of tool names → toolkit group display key, mirroring Olympus's\n * runtime `toolDefinitionsStore` output. The SDK doesn't ship a backend-fetched\n * toolkit catalog, so this provides the same grouping behavior using the names\n * the agent typically calls. Consumers can override via the `getToolGroupKey`\n * prop on `<AthenaChat>`.\n *\n * Keys here are toolkit *display* names (what users see in the toolkit\n * selector), not toolkit IDs — they match Olympus's\n * `getToolkitToGroupKeyMap()` output.\n */\nconst DEFAULT_TOOL_TO_TOOLKIT: Record<string, string> = {\n // Web\n search: 'Web',\n browse: 'Web',\n web_search: 'Web',\n search_web: 'Web',\n web_scrape: 'Web',\n scrape_web: 'Web',\n\n // Document\n create_new_document: 'Document',\n create_document_from_markdown: 'Document',\n append_markdown_to_athena_document: 'Document',\n replace_markdown_in_athena_document: 'Document',\n delete_blocks_from_athena_document: 'Document',\n convert_athena_doc_to_pdf: 'Document',\n convert_to_pdf: 'Document',\n\n // Word document (Studio)\n CreateDocument: 'Document (Word)',\n CreateParagraph: 'Document (Word)',\n OpenDocument: 'Document (Word)',\n execute_word_commands: 'Document (Word)',\n create_new_word_document: 'Document (Word)',\n\n // Spreadsheet\n create_new_sheet: 'Spreadsheet',\n update_sheet_range: 'Spreadsheet',\n format_sheet_range: 'Spreadsheet',\n bulk_format_sheet_range: 'Spreadsheet',\n create_table: 'Spreadsheet',\n update_table: 'Spreadsheet',\n update_chart: 'Spreadsheet',\n // Studio sheet PTC\n CreateWorkbook: 'Spreadsheet',\n AddSheet: 'Spreadsheet',\n OpenWorkbook: 'Spreadsheet',\n\n // Visualizations\n create_chart: 'Visualizations (Charts, Dashboards, Figures)',\n create_new_figure: 'Visualizations (Charts, Dashboards, Figures)',\n\n // Presentation\n create_powerpoint_deck: 'Presentation',\n create_presentation_pptx_studio: 'Presentation',\n execute_presentation_code: 'Presentation',\n capture_slide_screenshot: 'Presentation',\n capture_slide_screenshots: 'Presentation',\n restore_presentation_slides: 'Presentation',\n // Studio presentation PTC\n CreatePresentation: 'Presentation',\n OpenPresentation: 'Presentation',\n AddSlide: 'Presentation',\n\n // Notebook\n create_new_notebook: 'Notebook',\n run_notebook_cell: 'Notebook',\n\n // Python / code execution\n run_python_code: 'Python',\n run_python: 'Python',\n\n // Database\n run_sql: 'Database',\n run_database_sql: 'Database',\n run_sql_query_tool: 'Database',\n execute_sql: 'Database',\n describe_database: 'Database',\n list_database_tables: 'Database',\n get_database_table_schema: 'Database',\n\n // Email / calendar\n search_email: 'Email',\n unified_email_search: 'Email',\n\n // Media\n capture_moment: 'Computer',\n};\n\n/**\n * Tools that should never participate in grouping — even when surrounded by\n * tools of the same toolkit. Mirrors Olympus's `UNGROUPED_TOOLS`.\n */\nconst UNGROUPED_TOOLS: readonly string[] = [\n 'read_asset',\n 'read_full_asset',\n 'ask',\n 'open_asset_in_workspace',\n 'create_email_draft',\n 'unified_email_create_draft',\n 'unified_email_send',\n 'unified_email_edit_draft',\n];\n\n/**\n * Generic sandbox runtime tools shared across many toolkits (notebook,\n * computer, session sandbox, …). Mirrors Olympus's `CONTEXT_ONLY_TOOLS`:\n * they never start a toolkit group on their own — they only inherit the\n * surrounding group.\n */\nconst CONTEXT_ONLY_TOOLS: readonly string[] = [\n 'execute',\n 'ls',\n 'read_file',\n 'write_file',\n 'edit_file',\n 'glob',\n 'grep',\n];\n\n/**\n * Group display keys for toolkits that target a sandbox and therefore contain\n * the shared runtime tools. Context-only tools may only inherit these groups —\n * an open Web or Email group must not absorb a sandbox call.\n */\nconst SANDBOX_TOOLKIT_GROUPS: readonly string[] = ['Notebook', 'Computer', 'Session Sandbox'];\n\nexport type ToolGroupKeyOptions = {\n /** Display name of the surrounding group, when one is already open. */\n preferredGroupKey?: string;\n /**\n * Distinct tool names the message called. Hosts with a toolkit catalog use\n * it to attribute a tool shared by several toolkits to the one the message\n * leans on; the default map ignores it.\n */\n calledToolNames?: ReadonlySet<string>;\n};\n\n/**\n * Default `getToolGroupKey` implementation used by the SDK's tool grouping.\n * Returns the toolkit display key for a tool name, or `undefined` if the tool\n * is ungrouped or unknown. Context-only tools inherit the surrounding group\n * and are otherwise ungrouped.\n *\n * Override per-app by passing `getToolGroupKey` (or a whole `groupingFunction`) to\n * `SuperGroupingCard`.\n */\nexport const defaultGetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n): string | undefined => {\n if (UNGROUPED_TOOLS.includes(toolName)) return undefined;\n if (CONTEXT_ONLY_TOOLS.includes(toolName)) {\n const preferred = options?.preferredGroupKey;\n return preferred && SANDBOX_TOOLKIT_GROUPS.includes(preferred) ? preferred : undefined;\n }\n return DEFAULT_TOOL_TO_TOOLKIT[toolName];\n};\n\nexport type GetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n) => string | undefined;\n"],"names":[],"mappings":"AAWA,MAAM,0BAAkD;AAAA;AAAA,EAEtD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAGZ,qBAAqB;AAAA,EACrB,+BAA+B;AAAA,EAC/B,oCAAoC;AAAA,EACpC,qCAAqC;AAAA,EACrC,oCAAoC;AAAA,EACpC,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA;AAAA,EAGhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,0BAA0B;AAAA;AAAA,EAG1B,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA;AAAA,EAEd,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,cAAc;AAAA;AAAA,EAGd,cAAc;AAAA,EACd,mBAAmB;AAAA;AAAA,EAGnB,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,2BAA2B;AAAA,EAC3B,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"toolkit-map.js","sources":["../../../src/chat/super-grouping/toolkit-map.ts"],"sourcesContent":["/**\n * Static map of tool names → toolkit group display key, mirroring Olympus's\n * runtime `toolDefinitionsStore` output. The SDK doesn't ship a backend-fetched\n * toolkit catalog, so this provides the same grouping behavior using the names\n * the agent typically calls. Consumers can override via the `getToolGroupKey`\n * prop on `<AthenaChat>`.\n *\n * Keys here are toolkit *display* names (what users see in the toolkit\n * selector), not toolkit IDs — they match Olympus's\n * `getToolkitToGroupKeyMap()` output.\n */\nconst DEFAULT_TOOL_TO_TOOLKIT: Record<string, string> = {\n // Web\n search: 'Web',\n browse: 'Web',\n web_search: 'Web',\n search_web: 'Web',\n web_scrape: 'Web',\n scrape_web: 'Web',\n\n // Document\n create_new_document: 'Document',\n create_document_from_markdown: 'Document',\n append_markdown_to_athena_document: 'Document',\n replace_markdown_in_athena_document: 'Document',\n delete_blocks_from_athena_document: 'Document',\n convert_athena_doc_to_pdf: 'Document',\n convert_to_pdf: 'Document',\n\n // Word document (Studio)\n CreateDocument: 'Document (Word)',\n CreateParagraph: 'Document (Word)',\n OpenDocument: 'Document (Word)',\n execute_word_commands: 'Document (Word)',\n create_new_word_document: 'Document (Word)',\n\n // Spreadsheet\n create_new_sheet: 'Spreadsheet',\n update_sheet_range: 'Spreadsheet',\n format_sheet_range: 'Spreadsheet',\n bulk_format_sheet_range: 'Spreadsheet',\n create_table: 'Spreadsheet',\n update_table: 'Spreadsheet',\n update_chart: 'Spreadsheet',\n // Studio sheet PTC\n CreateWorkbook: 'Spreadsheet',\n AddSheet: 'Spreadsheet',\n OpenWorkbook: 'Spreadsheet',\n\n // Visualizations\n create_chart: 'Visualizations (Charts, Dashboards, Figures)',\n create_new_figure: 'Visualizations (Charts, Dashboards, Figures)',\n\n // Presentation\n create_powerpoint_deck: 'Presentation',\n create_presentation_pptx_studio: 'Presentation',\n execute_presentation_code: 'Presentation',\n capture_slide_screenshot: 'Presentation',\n capture_slide_screenshots: 'Presentation',\n restore_presentation_slides: 'Presentation',\n restore_spreadsheet_sheets: 'Spreadsheet',\n // Studio presentation PTC\n CreatePresentation: 'Presentation',\n OpenPresentation: 'Presentation',\n AddSlide: 'Presentation',\n\n // Notebook\n create_new_notebook: 'Notebook',\n run_notebook_cell: 'Notebook',\n\n // Python / code execution\n run_python_code: 'Python',\n run_python: 'Python',\n\n // Database\n run_sql: 'Database',\n run_database_sql: 'Database',\n run_sql_query_tool: 'Database',\n execute_sql: 'Database',\n describe_database: 'Database',\n list_database_tables: 'Database',\n get_database_table_schema: 'Database',\n\n // Email / calendar\n search_email: 'Email',\n unified_email_search: 'Email',\n\n // Media\n capture_moment: 'Computer',\n};\n\n/**\n * Tools that should never participate in grouping — even when surrounded by\n * tools of the same toolkit. Mirrors Olympus's `UNGROUPED_TOOLS`.\n */\nconst UNGROUPED_TOOLS: readonly string[] = [\n 'read_asset',\n 'read_full_asset',\n 'ask',\n 'open_asset_in_workspace',\n 'create_email_draft',\n 'unified_email_create_draft',\n 'unified_email_send',\n 'unified_email_edit_draft',\n];\n\n/**\n * Generic sandbox runtime tools shared across many toolkits (notebook,\n * computer, session sandbox, …). Mirrors Olympus's `CONTEXT_ONLY_TOOLS`:\n * they never start a toolkit group on their own — they only inherit the\n * surrounding group.\n */\nconst CONTEXT_ONLY_TOOLS: readonly string[] = [\n 'execute',\n 'ls',\n 'read_file',\n 'write_file',\n 'edit_file',\n 'glob',\n 'grep',\n];\n\n/**\n * Group display keys for toolkits that target a sandbox and therefore contain\n * the shared runtime tools. Context-only tools may only inherit these groups —\n * an open Web or Email group must not absorb a sandbox call.\n */\nconst SANDBOX_TOOLKIT_GROUPS: readonly string[] = ['Notebook', 'Computer', 'Session Sandbox'];\n\nexport type ToolGroupKeyOptions = {\n /** Display name of the surrounding group, when one is already open. */\n preferredGroupKey?: string;\n /**\n * Distinct tool names the message called. Hosts with a toolkit catalog use\n * it to attribute a tool shared by several toolkits to the one the message\n * leans on; the default map ignores it.\n */\n calledToolNames?: ReadonlySet<string>;\n};\n\n/**\n * Default `getToolGroupKey` implementation used by the SDK's tool grouping.\n * Returns the toolkit display key for a tool name, or `undefined` if the tool\n * is ungrouped or unknown. Context-only tools inherit the surrounding group\n * and are otherwise ungrouped.\n *\n * Override per-app by passing `getToolGroupKey` (or a whole `groupingFunction`) to\n * `SuperGroupingCard`.\n */\nexport const defaultGetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n): string | undefined => {\n if (UNGROUPED_TOOLS.includes(toolName)) return undefined;\n if (CONTEXT_ONLY_TOOLS.includes(toolName)) {\n const preferred = options?.preferredGroupKey;\n return preferred && SANDBOX_TOOLKIT_GROUPS.includes(preferred) ? preferred : undefined;\n }\n return DEFAULT_TOOL_TO_TOOLKIT[toolName];\n};\n\nexport type GetToolGroupKey = (\n toolName: string,\n options?: ToolGroupKeyOptions\n) => string | undefined;\n"],"names":[],"mappings":"AAWA,MAAM,0BAAkD;AAAA;AAAA,EAEtD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAGZ,qBAAqB;AAAA,EACrB,+BAA+B;AAAA,EAC/B,oCAAoC;AAAA,EACpC,qCAAqC;AAAA,EACrC,oCAAoC;AAAA,EACpC,2BAA2B;AA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AS,QAAQ,EAAG,QAAO;AAC/C,MAAI,mBAAmB,SAAS,QAAQ,GAAG;AACzC,UAAM,YAAY,mCAAS;AAC3B,WAAO,aAAa,uBAAuB,SAAS,SAAS,IAAI,YAAY;AAAA,EAC/E;AACA,SAAO,wBAAwB,QAAQ;AACzC;"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const react = require("@assistant-ui/react");
|
|
4
4
|
const require$$0 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const historyStore = require("../../agent-runtime/src/history-store.cjs");
|
|
6
6
|
function rawTurnStepsMarker(message) {
|
|
7
7
|
var _a;
|
|
8
8
|
for (const source of react.getExternalStoreMessages(message)) {
|
|
9
|
-
const marker = (_a = source == null ? void 0 : source.additional_kwargs) == null ? void 0 : _a[
|
|
9
|
+
const marker = (_a = source == null ? void 0 : source.additional_kwargs) == null ? void 0 : _a[historyStore.DEEP_AGENT_TURN_STEPS_KEY];
|
|
10
10
|
if (marker !== void 0) return marker;
|
|
11
11
|
}
|
|
12
12
|
return void 0;
|
|
@@ -14,7 +14,7 @@ function rawTurnStepsMarker(message) {
|
|
|
14
14
|
function useTurnStepsMarker() {
|
|
15
15
|
const raw = react.useAuiState((s) => rawTurnStepsMarker(s.message));
|
|
16
16
|
return require$$0.useMemo(
|
|
17
|
-
() => raw === void 0 ? void 0 :
|
|
17
|
+
() => raw === void 0 ? void 0 : historyStore.readTurnStepsMarker({ additional_kwargs: { [historyStore.DEEP_AGENT_TURN_STEPS_KEY]: raw } }),
|
|
18
18
|
[raw]
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAuiState, getExternalStoreMessages } from "@assistant-ui/react";
|
|
2
2
|
import { createContext, useMemo, useContext } from "react";
|
|
3
|
-
import { readTurnStepsMarker, DEEP_AGENT_TURN_STEPS_KEY } from "../../agent-runtime/src/history-
|
|
3
|
+
import { readTurnStepsMarker, DEEP_AGENT_TURN_STEPS_KEY } from "../../agent-runtime/src/history-store.js";
|
|
4
4
|
function rawTurnStepsMarker(message) {
|
|
5
5
|
var _a;
|
|
6
6
|
for (const source of getExternalStoreMessages(message)) {
|
package/dist/chat-ui/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ const runningIndicator = require("./messages/running-indicator.cjs");
|
|
|
36
36
|
const signInCard = require("./auth/sign-in-card.cjs");
|
|
37
37
|
const runtimeMessage = require("./messages/runtime-message.cjs");
|
|
38
38
|
const wakeMarker = require("./messages/wake-marker.cjs");
|
|
39
|
+
const inboundChannelMessage = require("./messages/inbound-channel-message.cjs");
|
|
39
40
|
const handoffArrivalDivider = require("./messages/handoff-arrival-divider.cjs");
|
|
40
41
|
const answerLabel = require("./messages/answer-label.cjs");
|
|
41
42
|
const voiceDelegationCard = require("./messages/voice-delegation-card.cjs");
|
|
@@ -147,6 +148,9 @@ exports.SignInTextField = signInCard.SignInTextField;
|
|
|
147
148
|
exports.RuntimeMessageCard = runtimeMessage.RuntimeMessageCard;
|
|
148
149
|
exports.WakeMarkerCard = wakeMarker.WakeMarkerCard;
|
|
149
150
|
exports.WakeMarkerMessage = wakeMarker.WakeMarkerMessage;
|
|
151
|
+
exports.InboundChannelLine = inboundChannelMessage.InboundChannelLine;
|
|
152
|
+
exports.InboundChannelSubject = inboundChannelMessage.InboundChannelSubject;
|
|
153
|
+
exports.withInboundMessageBody = inboundChannelMessage.withInboundMessageBody;
|
|
150
154
|
exports.HandoffArrivalAfterMessage = handoffArrivalDivider.HandoffArrivalAfterMessage;
|
|
151
155
|
exports.HandoffArrivalDivider = handoffArrivalDivider.HandoffArrivalDivider;
|
|
152
156
|
exports.HandoffArrivalScope = handoffArrivalDivider.HandoffArrivalScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chat-ui/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { TextShimmerLoader, ThreadRunningIndicator, } from "./messages/running-i
|
|
|
46
46
|
export { SignInCard, SignInConsent, SignInFallbackSection, SignInSecondaryButton, SignInSelect, SignInTextField, } from "./auth/sign-in-card";
|
|
47
47
|
export { RuntimeMessageCard, type RuntimeMessageCardProps } from "./messages/runtime-message";
|
|
48
48
|
export { WakeMarkerCard, type WakeMarkerCardProps, WakeMarkerMessage, } from "./messages/wake-marker";
|
|
49
|
+
export { InboundChannelLine, InboundChannelSubject, withInboundMessageBody, } from "./messages/inbound-channel-message";
|
|
49
50
|
export { HandoffArrivalAfterMessage, HandoffArrivalDivider, type HandoffArrivalDividerProps, HandoffArrivalScope, } from "./messages/handoff-arrival-divider";
|
|
50
51
|
export { AnswerLabel, type AnswerLabelProps, AnswerLabelScope, type AnswerLabelScopeProps, } from "./messages/answer-label";
|
|
51
52
|
export { VoiceDelegationCard, type VoiceDelegationCardProps, VoiceDelegationMessage, } from "./messages/voice-delegation-card";
|
package/dist/chat-ui/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import { TextShimmerLoader, ThreadRunningIndicator } from "./messages/running-in
|
|
|
34
34
|
import { SignInCard, SignInConsent, SignInFallbackSection, SignInSecondaryButton, SignInSelect, SignInTextField } from "./auth/sign-in-card.js";
|
|
35
35
|
import { RuntimeMessageCard } from "./messages/runtime-message.js";
|
|
36
36
|
import { WakeMarkerCard, WakeMarkerMessage } from "./messages/wake-marker.js";
|
|
37
|
+
import { InboundChannelLine, InboundChannelSubject, withInboundMessageBody } from "./messages/inbound-channel-message.js";
|
|
37
38
|
import { HandoffArrivalAfterMessage, HandoffArrivalDivider, HandoffArrivalScope } from "./messages/handoff-arrival-divider.js";
|
|
38
39
|
import { AnswerLabel, AnswerLabelScope } from "./messages/answer-label.js";
|
|
39
40
|
import { VoiceDelegationCard, VoiceDelegationMessage } from "./messages/voice-delegation-card.js";
|
|
@@ -83,6 +84,8 @@ export {
|
|
|
83
84
|
HandoffCursorReveal,
|
|
84
85
|
HistoryEdgeRow,
|
|
85
86
|
IconButton,
|
|
87
|
+
InboundChannelLine,
|
|
88
|
+
InboundChannelSubject,
|
|
86
89
|
MESSAGE_ARRIVAL_ANIMATION_CLASS,
|
|
87
90
|
MarkdownText,
|
|
88
91
|
MentionAuthCtx,
|
|
@@ -167,6 +170,7 @@ export {
|
|
|
167
170
|
useReadThreadReadingCursor,
|
|
168
171
|
useStatewireApprovalRequest,
|
|
169
172
|
useStatewireToolOutputs,
|
|
170
|
-
webpageMentionFingerprint
|
|
173
|
+
webpageMentionFingerprint,
|
|
174
|
+
withInboundMessageBody
|
|
171
175
|
};
|
|
172
176
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|