@artooi/agents-web-components 0.0.0-stage → 0.1.1
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/CHANGELOG.md +77 -0
- package/LICENSE +21 -0
- package/README.md +4397 -2
- package/dist/agents-web-components.bundle.js +5708 -0
- package/dist/agents-web-components.bundle.js.map +7 -0
- package/dist/bundle.d.ts +3 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/chat.d.ts +3 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +16373 -0
- package/dist/chat.js.map +7 -0
- package/dist/chunk-ARNLFGCC.js +7715 -0
- package/dist/chunk-ARNLFGCC.js.map +7 -0
- package/dist/constants.d.ts +575 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/activity_registration.d.ts +19 -0
- package/dist/core/activity_registration.d.ts.map +1 -0
- package/dist/core/activity_registry.d.ts +46 -0
- package/dist/core/activity_registry.d.ts.map +1 -0
- package/dist/core/activity_renderer.d.ts +20 -0
- package/dist/core/activity_renderer.d.ts.map +1 -0
- package/dist/core/ag_ui_chat.d.ts +836 -0
- package/dist/core/ag_ui_chat.d.ts.map +1 -0
- package/dist/core/agui_client.d.ts +370 -0
- package/dist/core/agui_client.d.ts.map +1 -0
- package/dist/core/attachment.d.ts +42 -0
- package/dist/core/attachment.d.ts.map +1 -0
- package/dist/core/chat_registry.d.ts +23 -0
- package/dist/core/chat_registry.d.ts.map +1 -0
- package/dist/core/client_seed.d.ts +27 -0
- package/dist/core/client_seed.d.ts.map +1 -0
- package/dist/core/conversation_store.d.ts +195 -0
- package/dist/core/conversation_store.d.ts.map +1 -0
- package/dist/core/create_http_agent.d.ts +57 -0
- package/dist/core/create_http_agent.d.ts.map +1 -0
- package/dist/core/define_chat.d.ts +13 -0
- package/dist/core/define_chat.d.ts.map +1 -0
- package/dist/core/events/attachments_detail.d.ts +9 -0
- package/dist/core/events/attachments_detail.d.ts.map +1 -0
- package/dist/core/events/bar_height_detail.d.ts +6 -0
- package/dist/core/events/bar_height_detail.d.ts.map +1 -0
- package/dist/core/events/custom_agent_detail.d.ts +8 -0
- package/dist/core/events/custom_agent_detail.d.ts.map +1 -0
- package/dist/core/events/dock_width_detail.d.ts +8 -0
- package/dist/core/events/dock_width_detail.d.ts.map +1 -0
- package/dist/core/events/feedback_detail.d.ts +28 -0
- package/dist/core/events/feedback_detail.d.ts.map +1 -0
- package/dist/core/events/invalidate_detail.d.ts +16 -0
- package/dist/core/events/invalidate_detail.d.ts.map +1 -0
- package/dist/core/events/maximize_detail.d.ts +5 -0
- package/dist/core/events/maximize_detail.d.ts.map +1 -0
- package/dist/core/events/run_finished_detail.d.ts +36 -0
- package/dist/core/events/run_finished_detail.d.ts.map +1 -0
- package/dist/core/events/state_detail.d.ts +5 -0
- package/dist/core/events/state_detail.d.ts.map +1 -0
- package/dist/core/events/submit_detail.d.ts +8 -0
- package/dist/core/events/submit_detail.d.ts.map +1 -0
- package/dist/core/events/thread_detail.d.ts +27 -0
- package/dist/core/events/thread_detail.d.ts.map +1 -0
- package/dist/core/events/thread_title_detail.d.ts +8 -0
- package/dist/core/events/thread_title_detail.d.ts.map +1 -0
- package/dist/core/events/toggle_detail.d.ts +5 -0
- package/dist/core/events/toggle_detail.d.ts.map +1 -0
- package/dist/core/events/tool_run.d.ts +11 -0
- package/dist/core/events/tool_run.d.ts.map +1 -0
- package/dist/core/events/unread_detail.d.ts +11 -0
- package/dist/core/events/unread_detail.d.ts.map +1 -0
- package/dist/core/message_role.d.ts +4 -0
- package/dist/core/message_role.d.ts.map +1 -0
- package/dist/core/read_flag.d.ts +11 -0
- package/dist/core/read_flag.d.ts.map +1 -0
- package/dist/core/read_json_attribute.d.ts +15 -0
- package/dist/core/read_json_attribute.d.ts.map +1 -0
- package/dist/core/read_max_tool_rounds.d.ts +9 -0
- package/dist/core/read_max_tool_rounds.d.ts.map +1 -0
- package/dist/core/remote_conversation_store.d.ts +71 -0
- package/dist/core/remote_conversation_store.d.ts.map +1 -0
- package/dist/core/run_handlers.d.ts +85 -0
- package/dist/core/run_handlers.d.ts.map +1 -0
- package/dist/core/run_index.d.ts +58 -0
- package/dist/core/run_index.d.ts.map +1 -0
- package/dist/core/storage_scope.d.ts +118 -0
- package/dist/core/storage_scope.d.ts.map +1 -0
- package/dist/core/tool_outcome.d.ts +27 -0
- package/dist/core/tool_outcome.d.ts.map +1 -0
- package/dist/core/transcribe_audio.d.ts +32 -0
- package/dist/core/transcribe_audio.d.ts.map +1 -0
- package/dist/core/upload_attachment.d.ts +44 -0
- package/dist/core/upload_attachment.d.ts.map +1 -0
- package/dist/core/utils.d.ts +117 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/dom/animations.d.ts +122 -0
- package/dist/dom/animations.d.ts.map +1 -0
- package/dist/dom/dom_driver.d.ts +28 -0
- package/dist/dom/dom_driver.d.ts.map +1 -0
- package/dist/dom/highlight_overlay.d.ts +39 -0
- package/dist/dom/highlight_overlay.d.ts.map +1 -0
- package/dist/dom/native_setter.d.ts +5 -0
- package/dist/dom/native_setter.d.ts.map +1 -0
- package/dist/dom/ring_color.d.ts +16 -0
- package/dist/dom/ring_color.d.ts.map +1 -0
- package/dist/dom/utils.d.ts +3 -0
- package/dist/dom/utils.d.ts.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +223 -0
- package/dist/index.js.map +7 -0
- package/dist/skills/fill_template.d.ts +16 -0
- package/dist/skills/fill_template.d.ts.map +1 -0
- package/dist/skills/parse_skills.d.ts +8 -0
- package/dist/skills/parse_skills.d.ts.map +1 -0
- package/dist/skills/skill.d.ts +33 -0
- package/dist/skills/skill.d.ts.map +1 -0
- package/dist/skills/skill_catalog.d.ts +69 -0
- package/dist/skills/skill_catalog.d.ts.map +1 -0
- package/dist/skills/skill_name_from.d.ts +12 -0
- package/dist/skills/skill_name_from.d.ts.map +1 -0
- package/dist/tools/chat_surface_tools.d.ts +77 -0
- package/dist/tools/chat_surface_tools.d.ts.map +1 -0
- package/dist/tools/client_tool_registry.d.ts +58 -0
- package/dist/tools/client_tool_registry.d.ts.map +1 -0
- package/dist/tools/is_destructive.d.ts +14 -0
- package/dist/tools/is_destructive.d.ts.map +1 -0
- package/dist/tools/is_navigates.d.ts +9 -0
- package/dist/tools/is_navigates.d.ts.map +1 -0
- package/dist/tools/page_action_tools.d.ts +30 -0
- package/dist/tools/page_action_tools.d.ts.map +1 -0
- package/dist/tools/page_map.d.ts +16 -0
- package/dist/tools/page_map.d.ts.map +1 -0
- package/dist/tools/page_state.d.ts +27 -0
- package/dist/tools/page_state.d.ts.map +1 -0
- package/dist/tools/parse_tool_catalog.d.ts +21 -0
- package/dist/tools/parse_tool_catalog.d.ts.map +1 -0
- package/dist/tools/route_map.d.ts +37 -0
- package/dist/tools/route_map.d.ts.map +1 -0
- package/dist/tools/tool_catalog.d.ts +86 -0
- package/dist/tools/tool_catalog.d.ts.map +1 -0
- package/dist/tools/tool_dispatch.d.ts +82 -0
- package/dist/tools/tool_dispatch.d.ts.map +1 -0
- package/dist/ui/charts/chart_block.d.ts +57 -0
- package/dist/ui/charts/chart_block.d.ts.map +1 -0
- package/dist/ui/charts/chart_spec_from.d.ts +12 -0
- package/dist/ui/charts/chart_spec_from.d.ts.map +1 -0
- package/dist/ui/charts/chart_styles.d.ts +2 -0
- package/dist/ui/charts/chart_styles.d.ts.map +1 -0
- package/dist/ui/charts/chart_tool.d.ts +15 -0
- package/dist/ui/charts/chart_tool.d.ts.map +1 -0
- package/dist/ui/composer/attachment_styles.d.ts +2 -0
- package/dist/ui/composer/attachment_styles.d.ts.map +1 -0
- package/dist/ui/composer/attachment_tray.d.ts +53 -0
- package/dist/ui/composer/attachment_tray.d.ts.map +1 -0
- package/dist/ui/composer/auto_grow.d.ts +10 -0
- package/dist/ui/composer/auto_grow.d.ts.map +1 -0
- package/dist/ui/composer/build_composer.d.ts +32 -0
- package/dist/ui/composer/build_composer.d.ts.map +1 -0
- package/dist/ui/composer/composer_attachments.d.ts +57 -0
- package/dist/ui/composer/composer_attachments.d.ts.map +1 -0
- package/dist/ui/composer/composer_styles.d.ts +2 -0
- package/dist/ui/composer/composer_styles.d.ts.map +1 -0
- package/dist/ui/composer/composer_voice.d.ts +48 -0
- package/dist/ui/composer/composer_voice.d.ts.map +1 -0
- package/dist/ui/composer/skill_styles.d.ts +2 -0
- package/dist/ui/composer/skill_styles.d.ts.map +1 -0
- package/dist/ui/composer/skills_menu.d.ts +34 -0
- package/dist/ui/composer/skills_menu.d.ts.map +1 -0
- package/dist/ui/composer/voice_input.d.ts +46 -0
- package/dist/ui/composer/voice_input.d.ts.map +1 -0
- package/dist/ui/excerpts/attach_copy_buttons.d.ts +13 -0
- package/dist/ui/excerpts/attach_copy_buttons.d.ts.map +1 -0
- package/dist/ui/excerpts/copy_payload.d.ts +30 -0
- package/dist/ui/excerpts/copy_payload.d.ts.map +1 -0
- package/dist/ui/excerpts/page_quote_offer.d.ts +33 -0
- package/dist/ui/excerpts/page_quote_offer.d.ts.map +1 -0
- package/dist/ui/excerpts/place_offer.d.ts +9 -0
- package/dist/ui/excerpts/place_offer.d.ts.map +1 -0
- package/dist/ui/excerpts/quote_selection.d.ts +66 -0
- package/dist/ui/excerpts/quote_selection.d.ts.map +1 -0
- package/dist/ui/excerpts/transcript_quote_offer.d.ts +57 -0
- package/dist/ui/excerpts/transcript_quote_offer.d.ts.map +1 -0
- package/dist/ui/fill_ui_string.d.ts +32 -0
- package/dist/ui/fill_ui_string.d.ts.map +1 -0
- package/dist/ui/history/checkpoint_menu.d.ts +41 -0
- package/dist/ui/history/checkpoint_menu.d.ts.map +1 -0
- package/dist/ui/history/conversation_history.d.ts +317 -0
- package/dist/ui/history/conversation_history.d.ts.map +1 -0
- package/dist/ui/history/history_styles.d.ts +2 -0
- package/dist/ui/history/history_styles.d.ts.map +1 -0
- package/dist/ui/history/relative_time.d.ts +23 -0
- package/dist/ui/history/relative_time.d.ts.map +1 -0
- package/dist/ui/history/thread_drawer.d.ts +64 -0
- package/dist/ui/history/thread_drawer.d.ts.map +1 -0
- package/dist/ui/history/utils.d.ts +2 -0
- package/dist/ui/history/utils.d.ts.map +1 -0
- package/dist/ui/interrupts/approval_card.d.ts +64 -0
- package/dist/ui/interrupts/approval_card.d.ts.map +1 -0
- package/dist/ui/interrupts/approval_styles.d.ts +2 -0
- package/dist/ui/interrupts/approval_styles.d.ts.map +1 -0
- package/dist/ui/interrupts/confirmation_card.d.ts +51 -0
- package/dist/ui/interrupts/confirmation_card.d.ts.map +1 -0
- package/dist/ui/interrupts/confirmation_styles.d.ts +2 -0
- package/dist/ui/interrupts/confirmation_styles.d.ts.map +1 -0
- package/dist/ui/interrupts/pending_decision.d.ts +22 -0
- package/dist/ui/interrupts/pending_decision.d.ts.map +1 -0
- package/dist/ui/interrupts/question_card.d.ts +49 -0
- package/dist/ui/interrupts/question_card.d.ts.map +1 -0
- package/dist/ui/interrupts/question_styles.d.ts +2 -0
- package/dist/ui/interrupts/question_styles.d.ts.map +1 -0
- package/dist/ui/place/place.d.ts +17 -0
- package/dist/ui/place/place.d.ts.map +1 -0
- package/dist/ui/place/place_chip.d.ts +26 -0
- package/dist/ui/place/place_chip.d.ts.map +1 -0
- package/dist/ui/place/place_from_route.d.ts +9 -0
- package/dist/ui/place/place_from_route.d.ts.map +1 -0
- package/dist/ui/place/place_styles.d.ts +2 -0
- package/dist/ui/place/place_styles.d.ts.map +1 -0
- package/dist/ui/placement/clamp_launcher.d.ts +20 -0
- package/dist/ui/placement/clamp_launcher.d.ts.map +1 -0
- package/dist/ui/placement/clamp_panel.d.ts +13 -0
- package/dist/ui/placement/clamp_panel.d.ts.map +1 -0
- package/dist/ui/placement/collapse_styles.d.ts +2 -0
- package/dist/ui/placement/collapse_styles.d.ts.map +1 -0
- package/dist/ui/placement/dock_styles.d.ts +2 -0
- package/dist/ui/placement/dock_styles.d.ts.map +1 -0
- package/dist/ui/placement/embedded_styles.d.ts +2 -0
- package/dist/ui/placement/embedded_styles.d.ts.map +1 -0
- package/dist/ui/placement/launcher_drag.d.ts +49 -0
- package/dist/ui/placement/launcher_drag.d.ts.map +1 -0
- package/dist/ui/placement/launcher_placement.d.ts +77 -0
- package/dist/ui/placement/launcher_placement.d.ts.map +1 -0
- package/dist/ui/placement/launcher_styles.d.ts +2 -0
- package/dist/ui/placement/launcher_styles.d.ts.map +1 -0
- package/dist/ui/placement/page_styles.d.ts +2 -0
- package/dist/ui/placement/page_styles.d.ts.map +1 -0
- package/dist/ui/placement/panel_drag.d.ts +40 -0
- package/dist/ui/placement/panel_drag.d.ts.map +1 -0
- package/dist/ui/placement/panel_placement.d.ts +173 -0
- package/dist/ui/placement/panel_placement.d.ts.map +1 -0
- package/dist/ui/placement/place_widget.d.ts +31 -0
- package/dist/ui/placement/place_widget.d.ts.map +1 -0
- package/dist/ui/placement/preset_styles.d.ts +2 -0
- package/dist/ui/placement/preset_styles.d.ts.map +1 -0
- package/dist/ui/placement/resize_handle.d.ts +78 -0
- package/dist/ui/placement/resize_handle.d.ts.map +1 -0
- package/dist/ui/placement/resize_styles.d.ts +2 -0
- package/dist/ui/placement/resize_styles.d.ts.map +1 -0
- package/dist/ui/placement/sidebar_styles.d.ts +2 -0
- package/dist/ui/placement/sidebar_styles.d.ts.map +1 -0
- package/dist/ui/placement/small_viewport_styles.d.ts +2 -0
- package/dist/ui/placement/small_viewport_styles.d.ts.map +1 -0
- package/dist/ui/placement/surface_for.d.ts +93 -0
- package/dist/ui/placement/surface_for.d.ts.map +1 -0
- package/dist/ui/progress/prettify_tool_name.d.ts +11 -0
- package/dist/ui/progress/prettify_tool_name.d.ts.map +1 -0
- package/dist/ui/progress/run_announcer.d.ts +41 -0
- package/dist/ui/progress/run_announcer.d.ts.map +1 -0
- package/dist/ui/progress/run_notice.d.ts +21 -0
- package/dist/ui/progress/run_notice.d.ts.map +1 -0
- package/dist/ui/progress/run_notice_styles.d.ts +2 -0
- package/dist/ui/progress/run_notice_styles.d.ts.map +1 -0
- package/dist/ui/progress/subagent_panel.d.ts +101 -0
- package/dist/ui/progress/subagent_panel.d.ts.map +1 -0
- package/dist/ui/progress/subagent_progress.d.ts +57 -0
- package/dist/ui/progress/subagent_progress.d.ts.map +1 -0
- package/dist/ui/progress/subagent_update.d.ts +28 -0
- package/dist/ui/progress/subagent_update.d.ts.map +1 -0
- package/dist/ui/progress/thoughts_block.d.ts +57 -0
- package/dist/ui/progress/thoughts_block.d.ts.map +1 -0
- package/dist/ui/progress/thoughts_styles.d.ts +2 -0
- package/dist/ui/progress/thoughts_styles.d.ts.map +1 -0
- package/dist/ui/progress/tool_call_card.d.ts +167 -0
- package/dist/ui/progress/tool_call_card.d.ts.map +1 -0
- package/dist/ui/progress/tool_group_styles.d.ts +2 -0
- package/dist/ui/progress/tool_group_styles.d.ts.map +1 -0
- package/dist/ui/progress/tool_step_group.d.ts +50 -0
- package/dist/ui/progress/tool_step_group.d.ts.map +1 -0
- package/dist/ui/progress/tool_step_styles.d.ts +2 -0
- package/dist/ui/progress/tool_step_styles.d.ts.map +1 -0
- package/dist/ui/shell/adopt_styles.d.ts +28 -0
- package/dist/ui/shell/adopt_styles.d.ts.map +1 -0
- package/dist/ui/shell/build_header.d.ts +45 -0
- package/dist/ui/shell/build_header.d.ts.map +1 -0
- package/dist/ui/shell/build_launcher.d.ts +33 -0
- package/dist/ui/shell/build_launcher.d.ts.map +1 -0
- package/dist/ui/shell/collapse_glyph.d.ts +14 -0
- package/dist/ui/shell/collapse_glyph.d.ts.map +1 -0
- package/dist/ui/shell/frame_styles.d.ts +2 -0
- package/dist/ui/shell/frame_styles.d.ts.map +1 -0
- package/dist/ui/shell/glyph_slot.d.ts +7 -0
- package/dist/ui/shell/glyph_slot.d.ts.map +1 -0
- package/dist/ui/shell/header_button.d.ts +11 -0
- package/dist/ui/shell/header_button.d.ts.map +1 -0
- package/dist/ui/shell/icon_element.d.ts +12 -0
- package/dist/ui/shell/icon_element.d.ts.map +1 -0
- package/dist/ui/shell/is_unread_badge_enabled.d.ts +10 -0
- package/dist/ui/shell/is_unread_badge_enabled.d.ts.map +1 -0
- package/dist/ui/shell/read_launcher_icon_url.d.ts +8 -0
- package/dist/ui/shell/read_launcher_icon_url.d.ts.map +1 -0
- package/dist/ui/shell/theme_styles.d.ts +2 -0
- package/dist/ui/shell/theme_styles.d.ts.map +1 -0
- package/dist/ui/shell/token_styles.d.ts +2 -0
- package/dist/ui/shell/token_styles.d.ts.map +1 -0
- package/dist/ui/styles.d.ts +2 -0
- package/dist/ui/styles.d.ts.map +1 -0
- package/dist/ui/themes/classic_styles.d.ts +2 -0
- package/dist/ui/themes/classic_styles.d.ts.map +1 -0
- package/dist/ui/themes/classic_tokens.d.ts +2 -0
- package/dist/ui/themes/classic_tokens.d.ts.map +1 -0
- package/dist/ui/themes/code_tokens.d.ts +2 -0
- package/dist/ui/themes/code_tokens.d.ts.map +1 -0
- package/dist/ui/themes/ledger_styles.d.ts +2 -0
- package/dist/ui/themes/ledger_styles.d.ts.map +1 -0
- package/dist/ui/themes/ledger_tokens.d.ts +2 -0
- package/dist/ui/themes/ledger_tokens.d.ts.map +1 -0
- package/dist/ui/themes/modern_styles.d.ts +2 -0
- package/dist/ui/themes/modern_styles.d.ts.map +1 -0
- package/dist/ui/themes/quiet_styles.d.ts +2 -0
- package/dist/ui/themes/quiet_styles.d.ts.map +1 -0
- package/dist/ui/themes/scheme_styles.d.ts +2 -0
- package/dist/ui/themes/scheme_styles.d.ts.map +1 -0
- package/dist/ui/themes/soft_styles.d.ts +2 -0
- package/dist/ui/themes/soft_styles.d.ts.map +1 -0
- package/dist/ui/themes/soft_tokens.d.ts +2 -0
- package/dist/ui/themes/soft_tokens.d.ts.map +1 -0
- package/dist/ui/themes/theme_hosts.d.ts +15 -0
- package/dist/ui/themes/theme_hosts.d.ts.map +1 -0
- package/dist/ui/transcript/answer_actions.d.ts +50 -0
- package/dist/ui/transcript/answer_actions.d.ts.map +1 -0
- package/dist/ui/transcript/answer_stream.d.ts +56 -0
- package/dist/ui/transcript/answer_stream.d.ts.map +1 -0
- package/dist/ui/transcript/attachment_chip_styles.d.ts +2 -0
- package/dist/ui/transcript/attachment_chip_styles.d.ts.map +1 -0
- package/dist/ui/transcript/attachment_chips.d.ts +21 -0
- package/dist/ui/transcript/attachment_chips.d.ts.map +1 -0
- package/dist/ui/transcript/build_transcript.d.ts +21 -0
- package/dist/ui/transcript/build_transcript.d.ts.map +1 -0
- package/dist/ui/transcript/greeting_styles.d.ts +2 -0
- package/dist/ui/transcript/greeting_styles.d.ts.map +1 -0
- package/dist/ui/transcript/groups_tool_steps.d.ts +13 -0
- package/dist/ui/transcript/groups_tool_steps.d.ts.map +1 -0
- package/dist/ui/transcript/message_action_styles.d.ts +2 -0
- package/dist/ui/transcript/message_action_styles.d.ts.map +1 -0
- package/dist/ui/transcript/message_actions.d.ts +74 -0
- package/dist/ui/transcript/message_actions.d.ts.map +1 -0
- package/dist/ui/transcript/message_styles.d.ts +2 -0
- package/dist/ui/transcript/message_styles.d.ts.map +1 -0
- package/dist/ui/transcript/render_markdown.d.ts +40 -0
- package/dist/ui/transcript/render_markdown.d.ts.map +1 -0
- package/dist/ui/transcript/render_or_warn.d.ts +16 -0
- package/dist/ui/transcript/render_or_warn.d.ts.map +1 -0
- package/dist/ui/transcript/reveal_words.d.ts +8 -0
- package/dist/ui/transcript/reveal_words.d.ts.map +1 -0
- package/dist/ui/transcript/starter_chips.d.ts +21 -0
- package/dist/ui/transcript/starter_chips.d.ts.map +1 -0
- package/dist/ui/transcript/stick_to_bottom.d.ts +55 -0
- package/dist/ui/transcript/stick_to_bottom.d.ts.map +1 -0
- package/dist/ui/transcript/suggestion_chips.d.ts +29 -0
- package/dist/ui/transcript/suggestion_chips.d.ts.map +1 -0
- package/dist/ui/transcript/transcript.d.ts +196 -0
- package/dist/ui/transcript/transcript.d.ts.map +1 -0
- package/dist/ui/transcript/transcript_styles.d.ts +2 -0
- package/dist/ui/transcript/transcript_styles.d.ts.map +1 -0
- package/dist/ui/ui_strings.d.ts +352 -0
- package/dist/ui/ui_strings.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +86 -3
- package/src/bundle.ts +2 -0
- package/src/chat.ts +2 -0
- package/src/constants.ts +650 -0
- package/src/core/activity_registration.ts +19 -0
- package/src/core/activity_registry.ts +133 -0
- package/src/core/activity_renderer.ts +19 -0
- package/src/core/ag_ui_chat.ts +3966 -0
- package/src/core/agui_client.ts +1028 -0
- package/src/core/attachment.ts +62 -0
- package/src/core/chat_registry.ts +53 -0
- package/src/core/client_seed.ts +27 -0
- package/src/core/conversation_store.ts +478 -0
- package/src/core/create_http_agent.ts +97 -0
- package/src/core/define_chat.ts +25 -0
- package/src/core/events/attachments_detail.ts +9 -0
- package/src/core/events/bar_height_detail.ts +5 -0
- package/src/core/events/custom_agent_detail.ts +7 -0
- package/src/core/events/dock_width_detail.ts +7 -0
- package/src/core/events/feedback_detail.ts +27 -0
- package/src/core/events/invalidate_detail.ts +15 -0
- package/src/core/events/maximize_detail.ts +4 -0
- package/src/core/events/run_finished_detail.ts +36 -0
- package/src/core/events/state_detail.ts +4 -0
- package/src/core/events/submit_detail.ts +8 -0
- package/src/core/events/thread_detail.ts +26 -0
- package/src/core/events/thread_title_detail.ts +7 -0
- package/src/core/events/toggle_detail.ts +4 -0
- package/src/core/events/tool_run.ts +10 -0
- package/src/core/events/unread_detail.ts +10 -0
- package/src/core/message_role.ts +4 -0
- package/src/core/read_flag.ts +13 -0
- package/src/core/read_json_attribute.ts +30 -0
- package/src/core/read_max_tool_rounds.ts +13 -0
- package/src/core/remote_conversation_store.ts +279 -0
- package/src/core/run_handlers.ts +524 -0
- package/src/core/run_index.ts +114 -0
- package/src/core/storage_scope.ts +291 -0
- package/src/core/tool_outcome.ts +39 -0
- package/src/core/transcribe_audio.ts +76 -0
- package/src/core/upload_attachment.ts +130 -0
- package/src/core/utils.ts +230 -0
- package/src/dom/animations.ts +341 -0
- package/src/dom/dom_driver.ts +91 -0
- package/src/dom/highlight_overlay.ts +204 -0
- package/src/dom/native_setter.ts +40 -0
- package/src/dom/ring_color.ts +206 -0
- package/src/dom/utils.ts +5 -0
- package/src/index.ts +220 -0
- package/src/skills/fill_template.ts +31 -0
- package/src/skills/parse_skills.ts +31 -0
- package/src/skills/skill.ts +32 -0
- package/src/skills/skill_catalog.ts +172 -0
- package/src/skills/skill_name_from.ts +19 -0
- package/src/tools/chat_surface_tools.ts +183 -0
- package/src/tools/client_tool_registry.ts +80 -0
- package/src/tools/is_destructive.ts +17 -0
- package/src/tools/is_navigates.ts +12 -0
- package/src/tools/page_action_tools.ts +123 -0
- package/src/tools/page_map.ts +26 -0
- package/src/tools/page_state.ts +57 -0
- package/src/tools/parse_tool_catalog.ts +41 -0
- package/src/tools/route_map.ts +132 -0
- package/src/tools/tool_catalog.ts +334 -0
- package/src/tools/tool_dispatch.ts +453 -0
- package/src/ui/charts/chart_block.ts +519 -0
- package/src/ui/charts/chart_spec_from.ts +125 -0
- package/src/ui/charts/chart_styles.ts +63 -0
- package/src/ui/charts/chart_tool.ts +72 -0
- package/src/ui/composer/attachment_styles.ts +71 -0
- package/src/ui/composer/attachment_tray.ts +295 -0
- package/src/ui/composer/auto_grow.ts +12 -0
- package/src/ui/composer/build_composer.ts +114 -0
- package/src/ui/composer/composer_attachments.ts +324 -0
- package/src/ui/composer/composer_styles.ts +177 -0
- package/src/ui/composer/composer_voice.ts +93 -0
- package/src/ui/composer/skill_styles.ts +120 -0
- package/src/ui/composer/skills_menu.ts +188 -0
- package/src/ui/composer/voice_input.ts +282 -0
- package/src/ui/excerpts/attach_copy_buttons.ts +73 -0
- package/src/ui/excerpts/copy_payload.ts +156 -0
- package/src/ui/excerpts/page_quote_offer.ts +203 -0
- package/src/ui/excerpts/place_offer.ts +24 -0
- package/src/ui/excerpts/quote_selection.ts +345 -0
- package/src/ui/excerpts/transcript_quote_offer.ts +175 -0
- package/src/ui/fill_ui_string.ts +41 -0
- package/src/ui/history/checkpoint_menu.ts +300 -0
- package/src/ui/history/conversation_history.ts +1169 -0
- package/src/ui/history/history_styles.ts +492 -0
- package/src/ui/history/relative_time.ts +50 -0
- package/src/ui/history/thread_drawer.ts +471 -0
- package/src/ui/history/utils.ts +11 -0
- package/src/ui/interrupts/approval_card.ts +202 -0
- package/src/ui/interrupts/approval_styles.ts +52 -0
- package/src/ui/interrupts/confirmation_card.ts +138 -0
- package/src/ui/interrupts/confirmation_styles.ts +114 -0
- package/src/ui/interrupts/pending_decision.ts +33 -0
- package/src/ui/interrupts/question_card.ts +213 -0
- package/src/ui/interrupts/question_styles.ts +73 -0
- package/src/ui/place/place.ts +16 -0
- package/src/ui/place/place_chip.ts +146 -0
- package/src/ui/place/place_from_route.ts +27 -0
- package/src/ui/place/place_styles.ts +108 -0
- package/src/ui/placement/clamp_launcher.ts +38 -0
- package/src/ui/placement/clamp_panel.ts +30 -0
- package/src/ui/placement/collapse_styles.ts +472 -0
- package/src/ui/placement/dock_styles.ts +116 -0
- package/src/ui/placement/embedded_styles.ts +14 -0
- package/src/ui/placement/launcher_drag.ts +206 -0
- package/src/ui/placement/launcher_placement.ts +133 -0
- package/src/ui/placement/launcher_styles.ts +189 -0
- package/src/ui/placement/page_styles.ts +47 -0
- package/src/ui/placement/panel_drag.ts +138 -0
- package/src/ui/placement/panel_placement.ts +1975 -0
- package/src/ui/placement/place_widget.ts +64 -0
- package/src/ui/placement/preset_styles.ts +49 -0
- package/src/ui/placement/resize_handle.ts +229 -0
- package/src/ui/placement/resize_styles.ts +201 -0
- package/src/ui/placement/sidebar_styles.ts +113 -0
- package/src/ui/placement/small_viewport_styles.ts +70 -0
- package/src/ui/placement/surface_for.ts +183 -0
- package/src/ui/progress/prettify_tool_name.ts +16 -0
- package/src/ui/progress/run_announcer.ts +67 -0
- package/src/ui/progress/run_notice.ts +61 -0
- package/src/ui/progress/run_notice_styles.ts +52 -0
- package/src/ui/progress/subagent_panel.ts +227 -0
- package/src/ui/progress/subagent_progress.ts +200 -0
- package/src/ui/progress/subagent_update.ts +89 -0
- package/src/ui/progress/thoughts_block.ts +165 -0
- package/src/ui/progress/thoughts_styles.ts +74 -0
- package/src/ui/progress/tool_call_card.ts +429 -0
- package/src/ui/progress/tool_group_styles.ts +313 -0
- package/src/ui/progress/tool_step_group.ts +317 -0
- package/src/ui/progress/tool_step_styles.ts +486 -0
- package/src/ui/shell/adopt_styles.ts +34 -0
- package/src/ui/shell/build_header.ts +121 -0
- package/src/ui/shell/build_launcher.ts +79 -0
- package/src/ui/shell/collapse_glyph.ts +42 -0
- package/src/ui/shell/frame_styles.ts +147 -0
- package/src/ui/shell/glyph_slot.ts +12 -0
- package/src/ui/shell/header_button.ts +22 -0
- package/src/ui/shell/icon_element.ts +33 -0
- package/src/ui/shell/is_unread_badge_enabled.ts +11 -0
- package/src/ui/shell/read_launcher_icon_url.ts +9 -0
- package/src/ui/shell/theme_styles.ts +11 -0
- package/src/ui/shell/token_styles.ts +480 -0
- package/src/ui/styles.ts +110 -0
- package/src/ui/themes/classic_styles.ts +32 -0
- package/src/ui/themes/classic_tokens.ts +51 -0
- package/src/ui/themes/code_tokens.ts +21 -0
- package/src/ui/themes/ledger_styles.ts +169 -0
- package/src/ui/themes/ledger_tokens.ts +33 -0
- package/src/ui/themes/modern_styles.ts +80 -0
- package/src/ui/themes/quiet_styles.ts +118 -0
- package/src/ui/themes/scheme_styles.ts +26 -0
- package/src/ui/themes/soft_styles.ts +149 -0
- package/src/ui/themes/soft_tokens.ts +29 -0
- package/src/ui/themes/theme_hosts.ts +14 -0
- package/src/ui/transcript/answer_actions.ts +165 -0
- package/src/ui/transcript/answer_stream.ts +123 -0
- package/src/ui/transcript/attachment_chip_styles.ts +116 -0
- package/src/ui/transcript/attachment_chips.ts +82 -0
- package/src/ui/transcript/build_transcript.ts +67 -0
- package/src/ui/transcript/greeting_styles.ts +171 -0
- package/src/ui/transcript/groups_tool_steps.ts +16 -0
- package/src/ui/transcript/message_action_styles.ts +155 -0
- package/src/ui/transcript/message_actions.ts +234 -0
- package/src/ui/transcript/message_styles.ts +262 -0
- package/src/ui/transcript/render_markdown.ts +181 -0
- package/src/ui/transcript/render_or_warn.ts +22 -0
- package/src/ui/transcript/reveal_words.ts +41 -0
- package/src/ui/transcript/starter_chips.ts +42 -0
- package/src/ui/transcript/stick_to_bottom.ts +126 -0
- package/src/ui/transcript/suggestion_chips.ts +73 -0
- package/src/ui/transcript/transcript.ts +555 -0
- package/src/ui/transcript/transcript_styles.ts +153 -0
- package/src/ui/ui_strings.ts +550 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import type { Context, Tool } from "@ag-ui/core";
|
|
2
|
+
import { type ToolGroupDisplayMode } from "../constants.js";
|
|
3
|
+
import type { Skill } from "../skills/skill.js";
|
|
4
|
+
import { type ChatCorner, type ChatSurfaceReport } from "../tools/chat_surface_tools.js";
|
|
5
|
+
import { type ClientTool } from "../tools/client_tool_registry.js";
|
|
6
|
+
import { type ResolvePageTarget } from "../tools/page_action_tools.js";
|
|
7
|
+
import { type PageMap } from "../tools/page_map.js";
|
|
8
|
+
import { type PageState } from "../tools/page_state.js";
|
|
9
|
+
import { type RouteMap } from "../tools/route_map.js";
|
|
10
|
+
import type { RelativeTimeFormatter } from "../ui/history/relative_time.js";
|
|
11
|
+
import { type ApprovalRenderer } from "../ui/interrupts/approval_card.js";
|
|
12
|
+
import { type QuestionRenderer } from "../ui/interrupts/question_card.js";
|
|
13
|
+
import { type Place } from "../ui/place/place.js";
|
|
14
|
+
import { type ToolDisplayMode, type ToolPayloadFormatter } from "../ui/progress/tool_call_card.js";
|
|
15
|
+
import { type UiStrings } from "../ui/ui_strings.js";
|
|
16
|
+
import type { ActivityRegistration } from "./activity_registration.js";
|
|
17
|
+
import { type AttachmentRef } from "./attachment.js";
|
|
18
|
+
import { type ClientConversationStore, type NavigationCheckpoint } from "./conversation_store.js";
|
|
19
|
+
import { type AgentFactory } from "./create_http_agent.js";
|
|
20
|
+
import type { MessageRole } from "./message_role.js";
|
|
21
|
+
import { type TranscribeHandler } from "./transcribe_audio.js";
|
|
22
|
+
import { type UploadHandler } from "./upload_attachment.js";
|
|
23
|
+
/**
|
|
24
|
+
* `<ag-ui-chat>` — a framework-free chat sidebar Web Component over AG-UI.
|
|
25
|
+
*
|
|
26
|
+
* Owns the Shadow DOM shell (header, scrolling message list, input row),
|
|
27
|
+
* builds an {@link AgUiClient} on first send via the overridable
|
|
28
|
+
* {@link agentFactory}, and renders streaming assistant text plus tool-call
|
|
29
|
+
* activity. Emits a {@link SUBMIT_EVENT} for host visibility.
|
|
30
|
+
*
|
|
31
|
+
* The per-run frontend tool catalog and context come from {@link getTools} and
|
|
32
|
+
* {@link getContext}.
|
|
33
|
+
*/
|
|
34
|
+
export declare class AgUiChat extends HTMLElement {
|
|
35
|
+
#private;
|
|
36
|
+
/** Agent factory; override to inject a custom or fake agent (tests). */
|
|
37
|
+
agentFactory: AgentFactory;
|
|
38
|
+
/**
|
|
39
|
+
* Static extra HTTP headers, sent with every request this element makes: the
|
|
40
|
+
* agent run, the thread index and its messages, the tool and skill catalogs,
|
|
41
|
+
* the run index, uploads and transcription.
|
|
42
|
+
*
|
|
43
|
+
* For values fixed for the element's lifetime. A rotating credential belongs
|
|
44
|
+
* in {@link getHeaders} instead — only a re-assignment updates this, so a
|
|
45
|
+
* token captured here is pinned until the host assigns again.
|
|
46
|
+
*/
|
|
47
|
+
headers: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Live header source, called afresh immediately before every request — the
|
|
50
|
+
* way to supply rotating credentials, with nothing to re-assign or keep in
|
|
51
|
+
* sync.
|
|
52
|
+
*
|
|
53
|
+
* Composes with {@link headers} rather than replacing it: merged per key with
|
|
54
|
+
* `getHeaders()` winning, so a static `X-Client` and a rotating
|
|
55
|
+
* `Authorization` are configured independently and neither drops the other.
|
|
56
|
+
*/
|
|
57
|
+
getHeaders: (() => Record<string, string>) | null;
|
|
58
|
+
/**
|
|
59
|
+
* Origins, besides the page's own, that this element may send {@link headers}
|
|
60
|
+
* and {@link getHeaders} credentials to without saying so on the console.
|
|
61
|
+
*
|
|
62
|
+
* Seven attributes name a URL, and every one of them carries these headers.
|
|
63
|
+
* They are plain HTML, so a page that builds one from a query parameter or
|
|
64
|
+
* from tenant-authored configuration has handed an attacker the destination,
|
|
65
|
+
* and the token leaves on the element's first request. Naming the origins you
|
|
66
|
+
* expect turns that from silent into either confirmed or reported.
|
|
67
|
+
*
|
|
68
|
+
* A notice rather than a refusal: a cross-origin agent is a documented
|
|
69
|
+
* deployment, so refusing would break working installations to defend against
|
|
70
|
+
* a page that is already interpolating untrusted data into its own markup.
|
|
71
|
+
* Leaving this empty costs nothing but one console line per foreign origin.
|
|
72
|
+
*/
|
|
73
|
+
trustedOrigins: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Permit `<img>` in rendered assistant markdown. **Off by default**: a
|
|
76
|
+
* model-controlled image URL is fetched with no user interaction, which
|
|
77
|
+
* makes it a zero-click exfiltration channel for prompt-injected page
|
|
78
|
+
* data. Enable only when the content source is trusted.
|
|
79
|
+
*/
|
|
80
|
+
allowImages: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Replace the relative timestamps in the thread drawer and the checkpoint
|
|
83
|
+
* panel -- `"5m ago"`, `"2d ago"` -- with the host's own formatting.
|
|
84
|
+
*
|
|
85
|
+
* The built-in is locale-neutral on purpose: there is no `Intl` anywhere in
|
|
86
|
+
* this component, so it never disagrees with the page it is embedded in by
|
|
87
|
+
* guessing a locale. That is a good default and a bad requirement, which is
|
|
88
|
+
* what this is for.
|
|
89
|
+
*
|
|
90
|
+
* ```js
|
|
91
|
+
* const rtf = new Intl.RelativeTimeFormat("de", { numeric: "auto" });
|
|
92
|
+
* chat.formatRelativeTime = (ts) =>
|
|
93
|
+
* rtf.format(Math.round((ts - Date.now()) / 60000), "minute");
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
formatRelativeTime: RelativeTimeFormatter | null;
|
|
97
|
+
/** When true, destructive tools execute without a confirmation modal. */
|
|
98
|
+
autoConfirm: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* When true, the built-in `ask_user` frontend tool is offered to the agent:
|
|
101
|
+
* calling it renders an inline question card and returns the user's answer.
|
|
102
|
+
* Off by default, like the other built-in tool groups, so the advertised
|
|
103
|
+
* catalog does not change until a host asks for it.
|
|
104
|
+
*/
|
|
105
|
+
askUser: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Optional full replacement for the `ask_user` question UI, resolving with
|
|
108
|
+
* the answer; the same seam as {@link approvalRenderer}, styled via `strings`
|
|
109
|
+
* and the `question*` `::part()`s when left unset. Requires {@link askUser}.
|
|
110
|
+
* A renderer that throws or rejects hands the question to the built-in card,
|
|
111
|
+
* as a failing {@link approvalRenderer} does, unless Stop already fired.
|
|
112
|
+
*/
|
|
113
|
+
askUserRenderer: QuestionRenderer | null;
|
|
114
|
+
/**
|
|
115
|
+
* Optional full replacement for the server-side-tool approval UI: an approval
|
|
116
|
+
* interrupt invokes this instead of the built-in {@link requestApproval}
|
|
117
|
+
* card, resolving `true` to approve or `false` to deny. Style the built-in
|
|
118
|
+
* card via `strings` and the `approval*` `::part()`s instead. The gate itself
|
|
119
|
+
* is enabled server-side; this only changes how the decision is collected.
|
|
120
|
+
*/
|
|
121
|
+
approvalRenderer: ApprovalRenderer | null;
|
|
122
|
+
/**
|
|
123
|
+
* Let the user edit a gated call's arguments before approving it.
|
|
124
|
+
*
|
|
125
|
+
* Off by default and **an assertion about your server**, not a negotiation:
|
|
126
|
+
* AG-UI carries `editedArgs` in the resume payload and gates it on the
|
|
127
|
+
* agent's own `approveWithEdits` capability, which this component never sees
|
|
128
|
+
* -- capabilities are not on the wire it reads. So the host says whether its
|
|
129
|
+
* agent honours them. Turned on against a server that does not, the user
|
|
130
|
+
* would edit arguments it silently discards, which is worse than not
|
|
131
|
+
* offering.
|
|
132
|
+
*
|
|
133
|
+
* Only affects calls whose arguments are known here: an interrupt names a
|
|
134
|
+
* `toolCallId`, and the tool card for that call is where the arguments still
|
|
135
|
+
* are. An interrupt naming no card gets the plain approve/deny.
|
|
136
|
+
*/
|
|
137
|
+
approveWithEdits: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Optional per-call confirmation predicate. When set it is authoritative,
|
|
140
|
+
* deciding from the tool name and args whether this particular call needs
|
|
141
|
+
* confirmation — so one tool can be instant for some args and confirmed for
|
|
142
|
+
* others, which a static `x-destructive` flag cannot express. When unset the
|
|
143
|
+
* `x-destructive` flag decides. `autoConfirm` short-circuits both.
|
|
144
|
+
*/
|
|
145
|
+
confirmPredicate: ((toolName: string, args: Record<string, unknown>) => boolean | Promise<boolean>) | null;
|
|
146
|
+
/**
|
|
147
|
+
* Per-run frontend tool catalog provider. Defaults to the built-in
|
|
148
|
+
* `route.*` tools (when a {@link routeMap} is set) plus the tools registered
|
|
149
|
+
* via {@link registerTool} / {@link registerPageState}; override to supply a
|
|
150
|
+
* fully custom catalog.
|
|
151
|
+
*/
|
|
152
|
+
getTools: () => Tool[];
|
|
153
|
+
/**
|
|
154
|
+
* Per-run context provider. Defaults to the compact page map, when a
|
|
155
|
+
* {@link getPageMap} provider is set and {@link autoInjectPageMap} is on.
|
|
156
|
+
*
|
|
157
|
+
* Attachments are deliberately not restated here: the server derives its own
|
|
158
|
+
* manifest from the refs riding the messages.
|
|
159
|
+
*/
|
|
160
|
+
getContext: () => Context[];
|
|
161
|
+
/**
|
|
162
|
+
* Navigable routes the agent can jump to via the built-in `route.*` tools.
|
|
163
|
+
* While {@link getPlace} is unset, the route matching the current path also
|
|
164
|
+
* stands in as the place: the chip names it and the place entry carries it.
|
|
165
|
+
* No summary of the map itself is sent.
|
|
166
|
+
*/
|
|
167
|
+
routeMap: RouteMap;
|
|
168
|
+
/**
|
|
169
|
+
* Optional client-side router. When set (an SPA), `navigate_to_route` routes
|
|
170
|
+
* in-page and the run loop continues; when unset (an MPA like the admin), it
|
|
171
|
+
* falls back to `window.location` and the resumable-loop machinery applies.
|
|
172
|
+
*/
|
|
173
|
+
navigate: ((path: string) => void) | null;
|
|
174
|
+
/** Provider for the per-run page map; see {@link getContext}. */
|
|
175
|
+
getPageMap: (() => PageMap) | null;
|
|
176
|
+
/** Whether to auto-inject the page map into context each run. */
|
|
177
|
+
autoInjectPageMap: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Where in the app the user is. The chip in the composer's tool row draws it,
|
|
180
|
+
* and every tool round sends it as one `place` context entry from the same
|
|
181
|
+
* read, after whatever {@link getContext} returns, so a host that replaces
|
|
182
|
+
* that keeps it. Read before every round, on connect, on expand, when the
|
|
183
|
+
* composer gains focus, on `popstate` and `hashchange`, when the conversation
|
|
184
|
+
* changes, and on {@link refreshPlace}.
|
|
185
|
+
*
|
|
186
|
+
* When unset, the {@link routeMap} route matching `location.pathname` stands
|
|
187
|
+
* in: its title (else its id) as the label, its group as the detail, the
|
|
188
|
+
* path as the href. With neither, no chip is drawn and nothing is sent; a
|
|
189
|
+
* host with a route map that wants no chip sets `() => null`.
|
|
190
|
+
*
|
|
191
|
+
* The chip's eye toggle withholds the place, and with it the page: a round
|
|
192
|
+
* whose place is withheld sends no `page_map` entry, whatever
|
|
193
|
+
* {@link getContext} returns, and offers no `read_page`. It holds for the
|
|
194
|
+
* same place, lapses when a different place is read, and is not persisted.
|
|
195
|
+
*/
|
|
196
|
+
getPlace: (() => Place | null) | null;
|
|
197
|
+
/**
|
|
198
|
+
* Persistence for the conversation + navigation checkpoint. Defaults to
|
|
199
|
+
* per-tab `sessionStorage` so the chat survives full page reloads; inject a
|
|
200
|
+
* server-backed store for cross-tab/device durability.
|
|
201
|
+
*/
|
|
202
|
+
conversationStore: ClientConversationStore;
|
|
203
|
+
/**
|
|
204
|
+
* How attached files are uploaded. `null` (default) uses the built-in
|
|
205
|
+
* multipart `POST` to `data-attachments-url`; a custom {@link UploadHandler}
|
|
206
|
+
* swaps the transport without changing the tray, the chips, or the AG-UI
|
|
207
|
+
* wire. When set, the 📎 affordance appears even with no
|
|
208
|
+
* `data-attachments-url`, and the handler owns its own endpoint and headers.
|
|
209
|
+
*/
|
|
210
|
+
uploadHandler: UploadHandler | null;
|
|
211
|
+
/**
|
|
212
|
+
* How recorded voice clips are transcribed. `null` (default) POSTs the clip
|
|
213
|
+
* to `data-transcribe-url`; a custom {@link TranscribeHandler} swaps the
|
|
214
|
+
* transport without touching the mic button. When set, the 🎤 affordance
|
|
215
|
+
* appears even with no `data-transcribe-url`.
|
|
216
|
+
*/
|
|
217
|
+
transcribeHandler: TranscribeHandler | null;
|
|
218
|
+
/**
|
|
219
|
+
* Builds the tool result a navigating tool resumes with after the page
|
|
220
|
+
* reloads. Defaults to the landed URL; a host (e.g. the admin package) can
|
|
221
|
+
* override to include a page snapshot or post-reload validation errors.
|
|
222
|
+
*/
|
|
223
|
+
navigationResult: (checkpoint: NavigationCheckpoint) => unknown;
|
|
224
|
+
/**
|
|
225
|
+
* Named values used to fill a skill prompt's `{placeholder}`s before send
|
|
226
|
+
* (e.g. `{ model: "Order", selected_ids: "1,2" }`). A host (the admin) sets
|
|
227
|
+
* this from the current page; a missing placeholder blocks the send.
|
|
228
|
+
*/
|
|
229
|
+
skillContext: () => Record<string, unknown>;
|
|
230
|
+
/**
|
|
231
|
+
* Friendly display labels for tool-call cards, keyed by tool name. The
|
|
232
|
+
* fallback when a tool has no `x-summary` in its own schema, which chiefly
|
|
233
|
+
* means server-side tools: AG-UI streams only the tool-call name, so their
|
|
234
|
+
* schema never reaches the browser. Client tools should prefer `x-summary`.
|
|
235
|
+
*/
|
|
236
|
+
toolSummaries: Record<string, string>;
|
|
237
|
+
/**
|
|
238
|
+
* Optional presentation hook for the two payload regions of a tool-call card
|
|
239
|
+
* -- the arguments and the result. Unset (the default) leaves both
|
|
240
|
+
* pretty-printed as JSON.
|
|
241
|
+
*
|
|
242
|
+
* The seam exists because a wide result has no good rendering as JSON: a
|
|
243
|
+
* thirty-field row is a wall of text where the host wanted a table, or a
|
|
244
|
+
* sentence. `ClientTool.render` cannot answer it -- it is handed the
|
|
245
|
+
* *arguments* only, and a server-side tool has no `ClientTool` at all, so the
|
|
246
|
+
* result region was the one part of the transcript a host could not reach.
|
|
247
|
+
*
|
|
248
|
+
* **Presentation, not translation.** The card and the model already read
|
|
249
|
+
* separate copies of a tool result: the model's is maintained by
|
|
250
|
+
* `@ag-ui/client` from the same event and persisted with the history, and the
|
|
251
|
+
* card has always shown that string reformatted. So a formatter changes what
|
|
252
|
+
* the person reads and nothing the agent reads -- which makes restyling safe
|
|
253
|
+
* and *rewording* a way to make the card disagree with the prose beside it.
|
|
254
|
+
* Rename a value on the server, where it reaches both.
|
|
255
|
+
*
|
|
256
|
+
* Read at render time rather than captured, so a host that sets it from a
|
|
257
|
+
* framework effect after the first card still formats the results that settle
|
|
258
|
+
* afterwards. See {@link ToolPayloadFormatter}.
|
|
259
|
+
*/
|
|
260
|
+
formatToolPayload: ToolPayloadFormatter | null;
|
|
261
|
+
/**
|
|
262
|
+
* Localizable UI strings — a partial override merged over the English
|
|
263
|
+
* {@link DEFAULT_UI_STRINGS}. Resolved once on connect (so set it before the
|
|
264
|
+
* element is appended); the `data-strings` JSON attribute is the markup
|
|
265
|
+
* equivalent, and this property wins key-by-key over it.
|
|
266
|
+
*/
|
|
267
|
+
strings: Partial<UiStrings>;
|
|
268
|
+
/**
|
|
269
|
+
* Resolve a `scroll_to` / `drag_and_drop` target string to a host-page
|
|
270
|
+
* element (or `null`). Defaults to a CSS-selector lookup; override to map
|
|
271
|
+
* page-map element ids. The page-action tools are opt-in via the
|
|
272
|
+
* `data-page-actions` attribute (`"scroll"` / `"drag"` / `"chat"`).
|
|
273
|
+
*/
|
|
274
|
+
resolvePageTarget: ResolvePageTarget;
|
|
275
|
+
constructor();
|
|
276
|
+
/** Attributes the element reacts to after it has been connected. */
|
|
277
|
+
static get observedAttributes(): string[];
|
|
278
|
+
attributeChangedCallback(name: string, previous: string | null, value: string | null): void;
|
|
279
|
+
/**
|
|
280
|
+
* Declare a frontend tool the agent may call.
|
|
281
|
+
*
|
|
282
|
+
* **A handler's thrown message leaves the browser.** When a handler rejects,
|
|
283
|
+
* its `Error.message` is posted back as that call's tool result — into the
|
|
284
|
+
* conversation, on to the AG-UI endpoint, persisted server-side, and
|
|
285
|
+
* forwarded to the model provider on every later round. That is deliberate,
|
|
286
|
+
* since it is what lets the agent recover from a failure it caused; but it
|
|
287
|
+
* means an internal hostname, a signed URL or a stack-derived path in a
|
|
288
|
+
* rethrown error is disclosed to parties the host never chose. Throw the
|
|
289
|
+
* message you would be content for the model to read, and log the detail.
|
|
290
|
+
*/
|
|
291
|
+
registerTool(tool: ClientTool): void;
|
|
292
|
+
/**
|
|
293
|
+
* AG-UI **shared state** for this conversation — the protocol's own state
|
|
294
|
+
* channel, sent as `RunAgentInput.state` on every run and replaced in place
|
|
295
|
+
* when the server streams `STATE_SNAPSHOT` / `STATE_DELTA`. Assigning seeds
|
|
296
|
+
* the next run; reading returns whatever the agent last applied.
|
|
297
|
+
*
|
|
298
|
+
* Listen for {@link STATE_EVENT} to react to server-driven changes. Distinct
|
|
299
|
+
* from {@link registerPageState}, which exposes host state as ordinary tools.
|
|
300
|
+
*/
|
|
301
|
+
get sharedState(): Readonly<Record<string, unknown>>;
|
|
302
|
+
set sharedState(state: Readonly<Record<string, unknown>>);
|
|
303
|
+
/** Bind a piece of host page state to `read_<name>` / `set_<name>` tools. */
|
|
304
|
+
registerPageState(binding: PageState): void;
|
|
305
|
+
/** The AG-UI endpoint URL, read from the `endpoint` attribute. */
|
|
306
|
+
get endpoint(): string;
|
|
307
|
+
set endpoint(value: string);
|
|
308
|
+
/**
|
|
309
|
+
* Who the stored conversation belongs to, from the `user-key` attribute.
|
|
310
|
+
*
|
|
311
|
+
* Set it to whatever identifies the signed-in principal — a user id, an
|
|
312
|
+
* account id, a hash of one. The value joins the storage namespace, so two
|
|
313
|
+
* principals in the same tab cannot read each other's transcript, and
|
|
314
|
+
* **changing it purges what the previous one left behind**.
|
|
315
|
+
*
|
|
316
|
+
* That purge is the reason this is a live attribute rather than a
|
|
317
|
+
* connect-time one. `sessionStorage` survives same-tab navigation, so it
|
|
318
|
+
* survives a logout; and a single-page app signs out through its own router
|
|
319
|
+
* without remounting anything, so there is no other moment at which the
|
|
320
|
+
* element could find out. The host naming the new principal — or dropping the
|
|
321
|
+
* attribute — is the signal.
|
|
322
|
+
*
|
|
323
|
+
* Absent means exactly today's behaviour, which is why nothing breaks by
|
|
324
|
+
* leaving it off: the conversation is scoped to the element and to nobody in
|
|
325
|
+
* particular, and on a shared workstation it carries into whoever signs in
|
|
326
|
+
* next in the same tab.
|
|
327
|
+
*
|
|
328
|
+
* The first value to arrive is treated as a host naming the user who was
|
|
329
|
+
* already there, not as a handover: the conversation in progress moves into
|
|
330
|
+
* the principal's namespace rather than being destroyed, so an element
|
|
331
|
+
* configured by an async auth handshake keeps what is on screen.
|
|
332
|
+
*/
|
|
333
|
+
get userKey(): string;
|
|
334
|
+
set userKey(value: string);
|
|
335
|
+
/**
|
|
336
|
+
* The signed-in user's display name, from the `user-name` attribute, for the
|
|
337
|
+
* greeting an empty conversation shows under `placement="page"`.
|
|
338
|
+
*
|
|
339
|
+
* Presentation only. Unlike {@link userKey} it scopes nothing and is never
|
|
340
|
+
* sent to the server. Absent or blank means the nameless greeting. Live: a
|
|
341
|
+
* name that arrives after the element connected replaces the greeting on
|
|
342
|
+
* screen.
|
|
343
|
+
*/
|
|
344
|
+
get userName(): string;
|
|
345
|
+
set userName(value: string);
|
|
346
|
+
/**
|
|
347
|
+
* Cookie policy for **every** request this element makes, as `fetch`'s own
|
|
348
|
+
* `credentials` mode (`"omit"` / `"same-origin"` / `"include"`). Mirrored to
|
|
349
|
+
* the `credentials` attribute, so markup embeds can set it without script.
|
|
350
|
+
*
|
|
351
|
+
* `null` (the default) leaves the browser's `same-origin` default in place,
|
|
352
|
+
* which sends no cookies at all to an endpoint on a different origin — and
|
|
353
|
+
* the request goes out anonymously rather than failing, so the symptom is a
|
|
354
|
+
* 401 from a server that looks correctly configured. A cookie-authenticated
|
|
355
|
+
* cross-origin deployment wants `"include"`, plus
|
|
356
|
+
* `Access-Control-Allow-Credentials: true` and a concrete, non-wildcard
|
|
357
|
+
* `Access-Control-Allow-Origin` on the server.
|
|
358
|
+
*
|
|
359
|
+
* Read per request, so a late assignment applies to everything after it.
|
|
360
|
+
* `"omit"` cannot be honoured by the built-in upload transport, an
|
|
361
|
+
* `XMLHttpRequest` with only a two-state cookie switch; every other endpoint
|
|
362
|
+
* honours all three modes.
|
|
363
|
+
*/
|
|
364
|
+
get credentials(): RequestCredentials | null;
|
|
365
|
+
set credentials(value: RequestCredentials | null);
|
|
366
|
+
/**
|
|
367
|
+
* How much detail tool-call cards show, from the `data-tool-display`
|
|
368
|
+
* attribute (`grouped` / `minimal` / `inline` / `compact` / `full`).
|
|
369
|
+
* Defaults to `grouped`, for an absent attribute and for a value the
|
|
370
|
+
* element does not know; `full` is the per-call card default before
|
|
371
|
+
* `grouped` existed.
|
|
372
|
+
*
|
|
373
|
+
* The four card modes are applied by the shadow CSS from the attribute
|
|
374
|
+
* itself, so changing between them restyles every card already in the
|
|
375
|
+
* transcript. Whether calls fold into a step group is decided as each card
|
|
376
|
+
* is built: switching to `grouped` folds only the calls drawn afterwards,
|
|
377
|
+
* and switching away flattens the existing groups, again by CSS.
|
|
378
|
+
*/
|
|
379
|
+
get toolDisplay(): ToolDisplayMode;
|
|
380
|
+
set toolDisplay(value: ToolDisplayMode);
|
|
381
|
+
/**
|
|
382
|
+
* How an opened step group draws its calls, from the
|
|
383
|
+
* `data-tool-group-display` attribute (`full` / `compact` / `minimal` /
|
|
384
|
+
* `inline`). Defaults to `full`, for an absent attribute and for a value the
|
|
385
|
+
* element does not know, which is what a group drew before the attribute.
|
|
386
|
+
*
|
|
387
|
+
* Read only while `toolDisplay` is `grouped`: under a card mode the groups
|
|
388
|
+
* are flattened into that mode's cards. Applied by the shadow CSS from the
|
|
389
|
+
* attribute itself, so changing it restyles groups already on screen.
|
|
390
|
+
*/
|
|
391
|
+
get toolGroupDisplay(): ToolGroupDisplayMode;
|
|
392
|
+
set toolGroupDisplay(value: ToolGroupDisplayMode);
|
|
393
|
+
/**
|
|
394
|
+
* The host's own constructed stylesheets, adopted after the built-in one.
|
|
395
|
+
*
|
|
396
|
+
* The escape hatch for structure that neither the tokens nor the parts
|
|
397
|
+
* reach. Per element, like the built-in sheet: two elements on one page can
|
|
398
|
+
* carry different sheets. Constructed sheets are not subject to a
|
|
399
|
+
* `style-src` policy, so this works under the same strict CSP the
|
|
400
|
+
* built-in sheet does. Setting it re-adopts at once; the array is copied, so
|
|
401
|
+
* mutating the one passed in changes nothing until it is set again.
|
|
402
|
+
*
|
|
403
|
+
* Unstable: reaches shadow class names, which may change in any minor.
|
|
404
|
+
*/
|
|
405
|
+
get extraStyles(): readonly CSSStyleSheet[];
|
|
406
|
+
set extraStyles(sheets: readonly CSSStyleSheet[]);
|
|
407
|
+
connectedCallback(): void;
|
|
408
|
+
/**
|
|
409
|
+
* Re-run everything the element loads on startup — the tool-label catalog,
|
|
410
|
+
* the backend skill catalog and the thread's history — with the transport
|
|
411
|
+
* configuration as it stands now.
|
|
412
|
+
*
|
|
413
|
+
* For a host that can only configure the element after the fact (a token
|
|
414
|
+
* fetched in a passive effect, an async auth handshake), this re-issues the
|
|
415
|
+
* startup requests authenticated, without removing and re-inserting the node.
|
|
416
|
+
*
|
|
417
|
+
* A reload, not a merge: the in-flight run is cancelled and the transcript is
|
|
418
|
+
* rebuilt from persisted history, so anything streamed since is dropped. Call
|
|
419
|
+
* it once, when configuration lands, not between turns.
|
|
420
|
+
*/
|
|
421
|
+
reload(): Promise<void>;
|
|
422
|
+
/**
|
|
423
|
+
* Tear down live resources when the element leaves the DOM: cancel the
|
|
424
|
+
* in-flight run so its stream closes, abort in-flight uploads so they do not
|
|
425
|
+
* orphan server-side files, and release the mic so the browser's recording
|
|
426
|
+
* indicator clears. Without this a removed element leaks all three.
|
|
427
|
+
*/
|
|
428
|
+
disconnectedCallback(): void;
|
|
429
|
+
/**
|
|
430
|
+
* Put `text` into the composer as a markdown quotation, and focus it.
|
|
431
|
+
*
|
|
432
|
+
* Deliberately **not** a send. Quoting is how a question narrows to one part
|
|
433
|
+
* of an answer, so the quotation is the preamble and the question is what
|
|
434
|
+
* comes next -- the caret is left after it, on its own line.
|
|
435
|
+
*
|
|
436
|
+
* This is also the seam for the half of this feature the component cannot
|
|
437
|
+
* build: selection in the **host page**. A widget mounted beside a table can
|
|
438
|
+
* be asked about a row, and nothing in a chat's own transcript can offer
|
|
439
|
+
* that. A host reads its own selection, however it likes, and calls this.
|
|
440
|
+
*
|
|
441
|
+
* No-ops on text that is empty or only whitespace.
|
|
442
|
+
*/
|
|
443
|
+
quote(text: string): void;
|
|
444
|
+
/**
|
|
445
|
+
* Offer to quote what the user selects in the **host page**, not just in the
|
|
446
|
+
* transcript. Returns a function that stops offering.
|
|
447
|
+
*
|
|
448
|
+
* The same select-then-offer gesture, over a table, a diff, a report -- the
|
|
449
|
+
* surface the user actually works in, which is the half of quoting no hosted
|
|
450
|
+
* chat can reach. Opt-in, because it listens on the host's document and that
|
|
451
|
+
* is theirs to grant.
|
|
452
|
+
*
|
|
453
|
+
* Deliberately **not** a four-line recipe, which is how this shipped first
|
|
454
|
+
* and was wrong: a page listener that quotes every settled selection appends
|
|
455
|
+
* to the composer on every drag made to read, to copy or to fix a typo -- and
|
|
456
|
+
* it cannot tell a selection in the page's prose from one inside the user's
|
|
457
|
+
* own half-typed `<input>`, because Chrome reports a field's internal
|
|
458
|
+
* selection as an ordinary range over the field's *wrapper*. See
|
|
459
|
+
* {@link attachQuoteOffer} for the guards.
|
|
460
|
+
*
|
|
461
|
+
* Detached automatically when the element leaves the document; a host that
|
|
462
|
+
* re-mounts it calls this again.
|
|
463
|
+
*/
|
|
464
|
+
offerQuoteInPage(within?: HTMLElement): () => void;
|
|
465
|
+
/**
|
|
466
|
+
* Replace the host-supplied (client) skill catalog. Merged after the embedded
|
|
467
|
+
* and fetched skills (so a client skill overrides a same-named server one).
|
|
468
|
+
*/
|
|
469
|
+
setSkills(skills: readonly Skill[]): void;
|
|
470
|
+
/** Whether the widget is collapsed (reflected as the `collapsed` attribute). */
|
|
471
|
+
get collapsed(): boolean;
|
|
472
|
+
set collapsed(value: boolean);
|
|
473
|
+
/**
|
|
474
|
+
* Read {@link getPlace} (or the route map standing in) again and redraw the
|
|
475
|
+
* chip. A single-page app calls this after its router moves, since a
|
|
476
|
+
* `pushState` fires no event; history traversal and hash changes are caught
|
|
477
|
+
* without it. Does nothing before the element connects.
|
|
478
|
+
*/
|
|
479
|
+
refreshPlace(): void;
|
|
480
|
+
/**
|
|
481
|
+
* Set the collapsed state: reflect the `collapsed` attribute, persist it
|
|
482
|
+
* per-tab, and emit a {@link TOGGLE_EVENT} so a host can mirror the state in
|
|
483
|
+
* its own chrome.
|
|
484
|
+
*/
|
|
485
|
+
setCollapsed(collapsed: boolean, options?: {
|
|
486
|
+
readonly announce?: boolean;
|
|
487
|
+
}): void;
|
|
488
|
+
/**
|
|
489
|
+
* Answers the user has not seen, totalled across threads: each finished while
|
|
490
|
+
* the panel was collapsed, and is read once its thread is on screen with the
|
|
491
|
+
* panel expanded. The launcher's badge renders this; {@link UNREAD_EVENT}
|
|
492
|
+
* announces every change and the threads it touched, so a host chrome can
|
|
493
|
+
* render its own instead.
|
|
494
|
+
*/
|
|
495
|
+
get unread(): number;
|
|
496
|
+
/**
|
|
497
|
+
* The thread on screen; `null` before the element first connects.
|
|
498
|
+
*
|
|
499
|
+
* Only reads. `conversationStore.threadId()` mints and stores a thread when
|
|
500
|
+
* the store points at none, so a host asking which conversation is showing
|
|
501
|
+
* could start one; this never does. {@link THREAD_EVENT} says when it changes.
|
|
502
|
+
*/
|
|
503
|
+
get threadId(): string | null;
|
|
504
|
+
/**
|
|
505
|
+
* The title of the thread on screen; `""` while nothing has been sent in it,
|
|
506
|
+
* and before the element connects.
|
|
507
|
+
*
|
|
508
|
+
* A title renamed here, or one the conversation list shows that the thread's
|
|
509
|
+
* messages do not derive (a server's own), wins. Otherwise it is the first
|
|
510
|
+
* user message, and a bare skill `/token` reads as the catalog's title for
|
|
511
|
+
* that skill, else as the token in words. `title-text="auto"` draws it in the
|
|
512
|
+
* header; {@link THREAD_TITLE_EVENT} says when it changes.
|
|
513
|
+
*/
|
|
514
|
+
get threadTitle(): string;
|
|
515
|
+
/**
|
|
516
|
+
* Whether an interaction is in flight: the composer's own state, the one that
|
|
517
|
+
* shows Stop. It spans every tool round, a retry and a checkpoint
|
|
518
|
+
* continuation as well as a send, which {@link SUBMIT_EVENT} alone does not.
|
|
519
|
+
* Reflected as `data-running` on the element, for a host's CSS.
|
|
520
|
+
*/
|
|
521
|
+
get running(): boolean;
|
|
522
|
+
/**
|
|
523
|
+
* The height of the bottom bar in CSS px, and 0 when none is drawn: under
|
|
524
|
+
* any collapse-to but "bar", and on a phone while the panel is open, where
|
|
525
|
+
* the panel is the screen. The bar is fixed over the page, so a host pads
|
|
526
|
+
* its own page by this much; {@link BAR_HEIGHT_EVENT} says when it changes.
|
|
527
|
+
*/
|
|
528
|
+
get barHeight(): number;
|
|
529
|
+
/**
|
|
530
|
+
* The width in CSS px a docked panel covers at rest, and 0 when it covers
|
|
531
|
+
* none of the page: the rail while collapsed to it, the panel while open, 0
|
|
532
|
+
* under every other placement, under collapse-to="none" or a launcher while
|
|
533
|
+
* collapsed, on a phone while open (the panel is the screen) and under
|
|
534
|
+
* --ag-ui-position: static, where the host's layout already makes room. The
|
|
535
|
+
* panel is fixed over the page, so a host pads its own by this much;
|
|
536
|
+
* {@link DOCK_WIDTH_EVENT} says when it changes, never per animation frame.
|
|
537
|
+
*/
|
|
538
|
+
get dockWidth(): number;
|
|
539
|
+
/**
|
|
540
|
+
* The element the panel rises from under collapse-to="none", right-aligned
|
|
541
|
+
* to it: typically the host's own button in its own bar. Takes precedence
|
|
542
|
+
* over the anchor attribute, which names one by selector. One that resolves
|
|
543
|
+
* to nothing leaves the panel in its placement's own corner, with a console
|
|
544
|
+
* warning.
|
|
545
|
+
*/
|
|
546
|
+
get anchor(): Element | null;
|
|
547
|
+
set anchor(value: Element | null);
|
|
548
|
+
/**
|
|
549
|
+
* Describe the panel to whoever is asking -- in practice the agent, through
|
|
550
|
+
* the opt-in chat-surface tools.
|
|
551
|
+
*
|
|
552
|
+
* `movable` folds two separate reasons into the one answer a caller needs:
|
|
553
|
+
* a placement that places itself owns its position, and a panel that fills
|
|
554
|
+
* the screen has nowhere to go. Reporting them apart would make every caller
|
|
555
|
+
* re-derive the same conjunction. A corner panel docked under
|
|
556
|
+
* `collapse-to="bar"` or `"none"` is movable on a wide viewport, like the
|
|
557
|
+
* corner panel it is.
|
|
558
|
+
*/
|
|
559
|
+
describeSurface(): ChatSurfaceReport;
|
|
560
|
+
/**
|
|
561
|
+
* Send the panel to a corner, and report whether it went.
|
|
562
|
+
*
|
|
563
|
+
* A third claimant on the axes a placement and a user drag already share, and
|
|
564
|
+
* it takes them the same way the drag does rather than inventing a second
|
|
565
|
+
* mechanism: the same commit path, so the launcher travels with the panel,
|
|
566
|
+
* the corner it opens from is re-picked, and switching placement hands
|
|
567
|
+
* everything back. What it must not do is claim a move it did not make --
|
|
568
|
+
* hence the boolean, and hence {@link describeSurface} existing so a caller
|
|
569
|
+
* can ask first. A docked panel moves too, within the room above its bar or
|
|
570
|
+
* anchor, and remembers the spot as a header drag would.
|
|
571
|
+
*/
|
|
572
|
+
moveTo(corner: ChatCorner, options?: {
|
|
573
|
+
readonly announce?: boolean;
|
|
574
|
+
}): boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Drop the size the user dragged in the current placement, and its stored
|
|
577
|
+
* copy, so the placement's default and the host's `--ag-ui-width` /
|
|
578
|
+
* `--ag-ui-height` apply again. Other placements keep theirs.
|
|
579
|
+
* Under `collapse-to="bar"` or `"none"` it also returns a panel the user
|
|
580
|
+
* dragged off its dock to the dock, and forgets the stored spot; a corner
|
|
581
|
+
* panel keeps a dragged position.
|
|
582
|
+
*/
|
|
583
|
+
resetSize(): void;
|
|
584
|
+
/**
|
|
585
|
+
* Whether the panel is maximized (reflected as the `maximized` attribute).
|
|
586
|
+
* Never stored: a reload opens at the placement's own size.
|
|
587
|
+
*/
|
|
588
|
+
get maximized(): boolean;
|
|
589
|
+
set maximized(value: boolean);
|
|
590
|
+
/**
|
|
591
|
+
* Grow the open panel to `--ag-ui-maximized-width` / `--ag-ui-maximized-height`,
|
|
592
|
+
* or restore it to the size it had, and emit a {@link MAXIMIZE_EVENT}. Refused
|
|
593
|
+
* where the header offers no control: `page`, `full`, `embedded`, an unknown
|
|
594
|
+
* placement, and a viewport of 600px or less.
|
|
595
|
+
*/
|
|
596
|
+
setMaximized(maximized: boolean): void;
|
|
597
|
+
/** Flip the maximized state. Bound to the built-in header control. */
|
|
598
|
+
toggleMaximized(): void;
|
|
599
|
+
/** Flip the collapsed state. Bound to the built-in header toggle. */
|
|
600
|
+
toggleCollapsed(): void;
|
|
601
|
+
/**
|
|
602
|
+
* Flip the scheme word of the `theme` attribute between `light` and `dark`
|
|
603
|
+
* and persist the choice per tab. Bound to the optional built-in header theme
|
|
604
|
+
* toggle (`data-theme-toggle`). The theme name and any host words are kept:
|
|
605
|
+
* `soft` becomes `soft dark`, and `soft dark` becomes `soft light`. With no
|
|
606
|
+
* scheme word (`auto`, or a host rule setting `color-scheme` on the element),
|
|
607
|
+
* it flips away from the scheme the panel is drawn in.
|
|
608
|
+
*/
|
|
609
|
+
toggleTheme(): void;
|
|
610
|
+
/**
|
|
611
|
+
* Open the thread-history drawer: the imperative route to the control that
|
|
612
|
+
* renders as `::part(history-button)`.
|
|
613
|
+
*
|
|
614
|
+
* A host that hides `::part(header)` for its own title bar hides the history,
|
|
615
|
+
* new-chat and collapse buttons with it. Each has a method so that chrome can
|
|
616
|
+
* be rebuilt: this one, {@link openCheckpoints}, {@link newChat},
|
|
617
|
+
* {@link toggleCollapsed} and {@link toggleTheme}.
|
|
618
|
+
*/
|
|
619
|
+
openThreads(options?: {
|
|
620
|
+
readonly anchor?: Element;
|
|
621
|
+
}): void;
|
|
622
|
+
/**
|
|
623
|
+
* Open the checkpoints panel (the `::part(checkpoints-button)` route).
|
|
624
|
+
*
|
|
625
|
+
* It lists the runs the `data-runs-url` server reports as continuable;
|
|
626
|
+
* without that attribute the built-in button is never rendered and this opens
|
|
627
|
+
* an empty panel.
|
|
628
|
+
*/
|
|
629
|
+
openCheckpoints(): void;
|
|
630
|
+
/** Close the conversation list, if it is open. */
|
|
631
|
+
closeThreads(): void;
|
|
632
|
+
/** Close the checkpoints panel, if it is open. */
|
|
633
|
+
closeCheckpoints(): void;
|
|
634
|
+
/**
|
|
635
|
+
* Put a stored thread on screen, as picking it in the conversation list does,
|
|
636
|
+
* for a host that lists conversations in its own chrome.
|
|
637
|
+
*
|
|
638
|
+
* Resolves once the thread has been replayed, when {@link THREAD_EVENT} has
|
|
639
|
+
* fired; a second call for the thread already loading settles with that load.
|
|
640
|
+
* If the store rejects the load, the element stays on the thread it was on,
|
|
641
|
+
* fires nothing, and the promise rejects with the store's error.
|
|
642
|
+
* **A run in flight is cancelled**, as the list and {@link newChat} do;
|
|
643
|
+
* a host that would rather wait reads {@link running} first. The thread
|
|
644
|
+
* already on screen is left alone, and so is everything before the element
|
|
645
|
+
* connects, since until then it has no store to read the thread from.
|
|
646
|
+
*/
|
|
647
|
+
switchThread(threadId: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Delete a stored thread, as the conversation list's delete does. Deleting the
|
|
650
|
+
* thread on screen cancels its run and puts a fresh thread in its place, and
|
|
651
|
+
* {@link THREAD_EVENT} reports it; deleting another leaves the screen alone.
|
|
652
|
+
* Does nothing before the element connects.
|
|
653
|
+
*/
|
|
654
|
+
deleteThread(threadId: string): void;
|
|
655
|
+
/**
|
|
656
|
+
* Open the checkpoints panel, or close it if it is already open — what the
|
|
657
|
+
* built-in checkpoints button does, because a control that opens a panel is read as the
|
|
658
|
+
* control that also dismisses it. {@link openCheckpoints} stays open-only for a
|
|
659
|
+
* host that means exactly that.
|
|
660
|
+
*/
|
|
661
|
+
toggleCheckpoints(): void;
|
|
662
|
+
/**
|
|
663
|
+
* Start a fresh conversation: drop the in-memory run state, clear the
|
|
664
|
+
* transcript, and mint a new thread id.
|
|
665
|
+
*
|
|
666
|
+
* The conversation being left is kept, and stays in the history drawer to
|
|
667
|
+
* return to. Deleting one is the drawer row's own action; a button that
|
|
668
|
+
* starts something new must not be the button that destroys what was there.
|
|
669
|
+
*
|
|
670
|
+
* Focus moves to the composer, unless the widget is collapsed and the
|
|
671
|
+
* composer is not on screen: starting a conversation is a request to type
|
|
672
|
+
* one. The page is not scrolled to bring the composer into view.
|
|
673
|
+
*/
|
|
674
|
+
newChat(): void;
|
|
675
|
+
/**
|
|
676
|
+
* Ask the same question again and replace the answer.
|
|
677
|
+
*
|
|
678
|
+
* History is truncated to the most recent user message inclusive and the run
|
|
679
|
+
* repeats, so the agent answers what it was asked rather than being told its
|
|
680
|
+
* last answer was wrong. Returns `false` when there is nothing to retry, or
|
|
681
|
+
* while anything that holds a send is in flight: a run, a send or another
|
|
682
|
+
* retry whose run has not started yet, a checkpoint continuation, or a
|
|
683
|
+
* restore of the stored conversation that is still loading. It does not wait
|
|
684
|
+
* for a restore as a send does: nothing is on screen to retry yet, and after
|
|
685
|
+
* the load it would re-ask the previous visit's last question. Also `false`
|
|
686
|
+
* when host code it
|
|
687
|
+
* runs before its run starts -- the store's save, or an activity or tool
|
|
688
|
+
* renderer the replay draws through -- has stopped it by starting a new chat
|
|
689
|
+
* or changing `user-key`. A tool or context provider that stops it does so
|
|
690
|
+
* inside the client's resume, past the last point this can see: nothing is
|
|
691
|
+
* sent, and this resolves `true`, because both a run starting and a Stop let
|
|
692
|
+
* go of the hold it checks. Rejects with the store's error when the store
|
|
693
|
+
* refuses the save, and then the conversation is as it was.
|
|
694
|
+
*
|
|
695
|
+
* Public because a host with its own message UI wants the same button, and
|
|
696
|
+
* because the failed-run notice reaches it from outside the action row.
|
|
697
|
+
*
|
|
698
|
+
* **A retried turn re-runs its tools**, which for a page-driving agent is not
|
|
699
|
+
* neutral: the previous attempt already clicked what it clicked, and this
|
|
700
|
+
* does not undo it. Confirmation still applies, so a destructive tool asks
|
|
701
|
+
* again -- unless the user waived it for this session.
|
|
702
|
+
*/
|
|
703
|
+
retryLastTurn(): Promise<boolean>;
|
|
704
|
+
/**
|
|
705
|
+
* Append a message bubble and return it.
|
|
706
|
+
*
|
|
707
|
+
* Assistant content renders as sanitised markdown/HTML; user content stays
|
|
708
|
+
* literal text, which also avoids rendering user-authored markup.
|
|
709
|
+
*
|
|
710
|
+
* Assistant bubbles land in the current answer group, opening one if needed;
|
|
711
|
+
* a user bubble closes the prior group and sits directly in the list, the
|
|
712
|
+
* well wrapping only the assistant turn.
|
|
713
|
+
*/
|
|
714
|
+
appendMessage(role: MessageRole, content: string): HTMLDivElement;
|
|
715
|
+
/**
|
|
716
|
+
* Send a message as if the user had typed it — renders the user bubble,
|
|
717
|
+
* dispatches {@link SUBMIT_EVENT}, and starts the run.
|
|
718
|
+
*
|
|
719
|
+
* The programmatic half of the composer, for a host driving its own input.
|
|
720
|
+
* Everything the built-in Send does happens here; Send reads the composer,
|
|
721
|
+
* clears it, and calls this.
|
|
722
|
+
*
|
|
723
|
+
* `attachments` are durable {@link AttachmentRef}s — what {@link attachFile}
|
|
724
|
+
* resolves to and what {@link ATTACHMENT_EVENT} reports.
|
|
725
|
+
*
|
|
726
|
+
* Resolves `true` once the turn has been handed to the client for its run,
|
|
727
|
+
* which is when the interaction settles, frontend-tool rounds included; a
|
|
728
|
+
* run a tool or context provider then stops still counts, as it does for
|
|
729
|
+
* {@link retryLastTurn}. Resolves `false` when nothing was sent.
|
|
730
|
+
*
|
|
731
|
+
* Nothing is sent for an empty message, nor while a run or a picked
|
|
732
|
+
* checkpoint's continuation is in flight, since a second concurrent run
|
|
733
|
+
* would orphan the first. A send is in flight from the moment it is taken
|
|
734
|
+
* rather than from its run's start, so nothing is sent from a
|
|
735
|
+
* {@link SUBMIT_EVENT} listener or for a second call in the same task
|
|
736
|
+
* either. Nor with no `endpoint`, which says so in the transcript. Nor
|
|
737
|
+
* behind a reload's restore that will resume a run a navigating tool
|
|
738
|
+
* interrupted, since that restore ends by starting the run.
|
|
739
|
+
*
|
|
740
|
+
* **While the element restores a stored conversation with no run to resume
|
|
741
|
+
* -- on connect, {@link reload}, a thread picked from the drawer, a change
|
|
742
|
+
* from one `user-key` to another -- it waits, then sends.** The turn has to follow the
|
|
743
|
+
* conversation it is part of: sent at once, it went out without it, the
|
|
744
|
+
* conversation was then drawn under it, and its save replaced the stored
|
|
745
|
+
* one. So the bubble, the {@link SUBMIT_EVENT} and the request all come after
|
|
746
|
+
* the replay, by the length of the store's load. A New chat, a thread
|
|
747
|
+
* switch, a change from one `user-key` to another, a reload or the element
|
|
748
|
+
* leaving the page while it waits drops it, resolving `false`: the
|
|
749
|
+
* conversation it was addressed to is no longer on screen. Leaving the page
|
|
750
|
+
* resolves it only once the load answers or the element is back, since
|
|
751
|
+
* that is when the restore learns it was stopped. A first `user-key` on an
|
|
752
|
+
* anonymous conversation adopts it rather than replacing it, and stops
|
|
753
|
+
* nothing. A second call while one waits is
|
|
754
|
+
* refused, as a second call in the same task is.
|
|
755
|
+
*
|
|
756
|
+
* Unlike the built-in Send it does not queue: it returns, and the caller
|
|
757
|
+
* keeps what it tried to send. Nor does it consult the tray -- what you pass
|
|
758
|
+
* is what is sent.
|
|
759
|
+
*/
|
|
760
|
+
sendMessage(content: string, attachments?: readonly AttachmentRef[]): Promise<boolean>;
|
|
761
|
+
/**
|
|
762
|
+
* Queue a file for upload into the attachment tray, exactly as the file
|
|
763
|
+
* picker and drag-and-drop do — validation, progress chip, and all.
|
|
764
|
+
*
|
|
765
|
+
* Returns `false` when uploads are not configured (no `data-attachments-url`
|
|
766
|
+
* and no {@link uploadHandler}) — the only signal a host gets, since the tray
|
|
767
|
+
* does not exist to report anything then.
|
|
768
|
+
*
|
|
769
|
+
* Uploading is asynchronous: watch {@link ATTACHMENT_EVENT} for the resulting
|
|
770
|
+
* {@link AttachmentRef} and pass it to {@link sendMessage} once `pending`
|
|
771
|
+
* reaches zero.
|
|
772
|
+
*/
|
|
773
|
+
attachFile(file: File): boolean;
|
|
774
|
+
/**
|
|
775
|
+
* Turn on chart rendering, by whichever route this consumer wants.
|
|
776
|
+
*
|
|
777
|
+
* Both routes converge on one renderer deliberately. Built apart they become
|
|
778
|
+
* two chart implementations with two sets of bugs, and the choice between them
|
|
779
|
+
* is about *where the data lives* rather than how a bar should look:
|
|
780
|
+
*
|
|
781
|
+
* - `"tool"` registers the built-in `render_chart`. The agent decides a chart
|
|
782
|
+
* helps and calls it, so the numbers are in its context and it can discuss
|
|
783
|
+
* them afterwards. Costs one model round, and works over any transport.
|
|
784
|
+
* - `"activity"` draws a server-pushed `ACTIVITY_SNAPSHOT` of type `chart`.
|
|
785
|
+
* No round trip, and the data never enters the model's context at all —
|
|
786
|
+
* which is what makes it the one for a large or sensitive dataset. Only this
|
|
787
|
+
* route can update a chart in place as the server computes.
|
|
788
|
+
*
|
|
789
|
+
* Off unless asked for, both of them: a component that renders whatever
|
|
790
|
+
* arrives is not something to switch on for everybody.
|
|
791
|
+
*/
|
|
792
|
+
enableCharts(routes?: readonly ("tool" | "activity")[]): void;
|
|
793
|
+
/**
|
|
794
|
+
* Teach this element to draw one kind of AG-UI activity.
|
|
795
|
+
*
|
|
796
|
+
* `activity_type` is one of exactly two fields the protocol leaves an open
|
|
797
|
+
* string, and it is the **content** one: an activity is materialised into a
|
|
798
|
+
* message, persisted with the thread, and replayed on every restore. Its
|
|
799
|
+
* sibling `CUSTOM` carries an imperative and is dispatched to the page
|
|
800
|
+
* instead ({@link CUSTOM_AGENT_EVENT}).
|
|
801
|
+
*
|
|
802
|
+
* That asymmetry decides which carrier a server should use. Content has a
|
|
803
|
+
* place in the conversation and should come back; an imperative has no place
|
|
804
|
+
* and no meaning once acted on.
|
|
805
|
+
*
|
|
806
|
+
* ```js
|
|
807
|
+
* chat.registerActivityRenderer({
|
|
808
|
+
* type: "build_status",
|
|
809
|
+
* render: (content) => {
|
|
810
|
+
* const el = document.createElement("div");
|
|
811
|
+
* el.textContent = `Build ${content.status}`;
|
|
812
|
+
* return el;
|
|
813
|
+
* },
|
|
814
|
+
* });
|
|
815
|
+
* ```
|
|
816
|
+
*
|
|
817
|
+
* Registering a type twice replaces the earlier renderer, so a host can
|
|
818
|
+
* override a built-in -- `chart` and `compaction` are registrations like any
|
|
819
|
+
* other, not privileged branches.
|
|
820
|
+
*
|
|
821
|
+
* ⚠ `render` runs again on every thread load. See {@link ActivityRenderer}
|
|
822
|
+
* for what that requires of it.
|
|
823
|
+
*/
|
|
824
|
+
registerActivityRenderer(registration: ActivityRegistration): void;
|
|
825
|
+
/**
|
|
826
|
+
* Activity types that arrived with nobody registered to draw them.
|
|
827
|
+
*
|
|
828
|
+
* Deliberately the only trace an unhandled activity leaves. Ignoring an
|
|
829
|
+
* unknown name is the protocol's own answer and the whole point of an open
|
|
830
|
+
* field, so warning would fire on every forward-compatible server -- but
|
|
831
|
+
* "nothing happened and nothing was said" is impossible to debug, so the set
|
|
832
|
+
* is readable. Accumulates for the element's lifetime, across threads.
|
|
833
|
+
*/
|
|
834
|
+
get unhandledActivityTypes(): readonly string[];
|
|
835
|
+
}
|
|
836
|
+
//# sourceMappingURL=ag_ui_chat.d.ts.map
|