@artooi/agents-web-components 0.0.0-stage → 0.1.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/CHANGELOG.md +68 -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,97 @@
|
|
|
1
|
+
import { type AbstractAgent, HttpAgent } from "@ag-ui/client";
|
|
2
|
+
import type { Message } from "@ag-ui/core";
|
|
3
|
+
import { warnOnCrossOriginCredentials, withCredentials } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
/** Config for {@link createHttpAgent}. */
|
|
6
|
+
export interface HttpAgentOptions {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Cookie policy for the run request, as `fetch`'s own `credentials` mode.
|
|
11
|
+
* Unset leaves the browser default (`same-origin`), which sends no cookies
|
|
12
|
+
* to an agent endpoint on a different origin or subdomain. A
|
|
13
|
+
* cookie-authenticated cross-origin deployment needs `"include"` here plus a
|
|
14
|
+
* server answering with `Access-Control-Allow-Credentials: true` and a
|
|
15
|
+
* concrete origin.
|
|
16
|
+
*/
|
|
17
|
+
credentials?: RequestCredentials;
|
|
18
|
+
/**
|
|
19
|
+
* Live header source, re-read on every request, overlaid on `headers`.
|
|
20
|
+
* `HttpAgent` bakes static `headers` in at construction and the element
|
|
21
|
+
* caches the agent for the whole conversation, so rotating credentials (CSRF,
|
|
22
|
+
* short-lived JWT) must come through here.
|
|
23
|
+
*/
|
|
24
|
+
getHeaders?: () => Record<string, string>;
|
|
25
|
+
/** Stable conversation id, so the agent's runs share a thread. */
|
|
26
|
+
threadId?: string;
|
|
27
|
+
/** Rehydrated history to seed the agent with (durable conversation). */
|
|
28
|
+
initialMessages?: readonly Message[];
|
|
29
|
+
/**
|
|
30
|
+
* AG-UI shared state to seed the agent with. `@ag-ui/client` sends it as
|
|
31
|
+
* `RunAgentInput.state` on every run and replaces it in place when the
|
|
32
|
+
* server streams `STATE_SNAPSHOT` / `STATE_DELTA`.
|
|
33
|
+
*/
|
|
34
|
+
initialState?: Readonly<Record<string, unknown>>;
|
|
35
|
+
/**
|
|
36
|
+
* Origins, besides the document's own, this agent may carry the host's
|
|
37
|
+
* credentials to.
|
|
38
|
+
*
|
|
39
|
+
* Running the agent on another subdomain is a normal deployment and stays
|
|
40
|
+
* supported, so a cross-origin endpoint is not refused — it is *announced*,
|
|
41
|
+
* once per origin, on the console. Listing an origin here says the
|
|
42
|
+
* destination was chosen deliberately and silences the notice for it.
|
|
43
|
+
*
|
|
44
|
+
* Entries are compared as serialized origins (`https://agent.example.com`,
|
|
45
|
+
* scheme and port included), which is what `URL.origin` produces.
|
|
46
|
+
*/
|
|
47
|
+
trustedOrigins?: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Build an AG-UI {@link HttpAgent} pointed at `endpoint`.
|
|
52
|
+
*
|
|
53
|
+
* The default agent factory for `<ag-ui-chat>`; tests and advanced hosts
|
|
54
|
+
* override the element's `agentFactory` to inject a different
|
|
55
|
+
* {@link AbstractAgent}.
|
|
56
|
+
*/
|
|
57
|
+
export function createHttpAgent(options: HttpAgentOptions): AbstractAgent {
|
|
58
|
+
const staticHeaders = options.headers ?? {};
|
|
59
|
+
const warned = new Set<string>();
|
|
60
|
+
return new HttpAgent({
|
|
61
|
+
url: options.endpoint,
|
|
62
|
+
headers: staticHeaders,
|
|
63
|
+
initialState: { ...(options.initialState ?? {}) },
|
|
64
|
+
// HttpAgent invokes its configured fetch as a method (`this.fetch(...)`),
|
|
65
|
+
// rebinding the global `fetch` to the agent instance — "Illegal invocation"
|
|
66
|
+
// in browsers. The wrapper keeps `fetch` a free call, and is also where the
|
|
67
|
+
// per-request `getHeaders()` overlay and the cookie policy go, the agent's
|
|
68
|
+
// own config having no seam for either.
|
|
69
|
+
fetch: (url, init) => {
|
|
70
|
+
const fresh = options.getHeaders?.();
|
|
71
|
+
// Only the names the *host* supplied. `HttpAgent` adds `Content-Type` and
|
|
72
|
+
// `Accept` to every request and neither is a credential, so reporting the
|
|
73
|
+
// outgoing header set wholesale would cry wolf on every plain request.
|
|
74
|
+
const credentialNames = [
|
|
75
|
+
...new Set([...Object.keys(staticHeaders), ...Object.keys(fresh ?? {})]),
|
|
76
|
+
].sort();
|
|
77
|
+
warnOnCrossOriginCredentials(url, credentialNames, options.trustedOrigins ?? [], warned);
|
|
78
|
+
if (fresh === undefined) {
|
|
79
|
+
return fetch(url, withCredentials(init, options.credentials));
|
|
80
|
+
}
|
|
81
|
+
const headers = new Headers(init?.headers);
|
|
82
|
+
for (const [name, value] of Object.entries(fresh)) {
|
|
83
|
+
headers.set(name, value);
|
|
84
|
+
}
|
|
85
|
+
return fetch(url, withCredentials({ ...init, headers }, options.credentials));
|
|
86
|
+
},
|
|
87
|
+
// Spread conditionally: under `exactOptionalPropertyTypes` an explicit
|
|
88
|
+
// `undefined` is not assignable to an optional field.
|
|
89
|
+
...(options.threadId !== undefined ? { threadId: options.threadId } : {}),
|
|
90
|
+
...(options.initialMessages !== undefined
|
|
91
|
+
? { initialMessages: [...options.initialMessages] }
|
|
92
|
+
: {}),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Signature of the agent factory the element calls to build its agent. */
|
|
97
|
+
export type AgentFactory = (options: HttpAgentOptions) => AbstractAgent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ELEMENT_TAG } from "../constants.js";
|
|
2
|
+
import { AgUiChat } from "./ag_ui_chat.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Register the `<ag-ui-chat>` Custom Element.
|
|
6
|
+
*
|
|
7
|
+
* Idempotent: a second call, or one after this package's `AgUiChat` already
|
|
8
|
+
* holds the tag, is a no-op. If another class holds the tag it throws naming
|
|
9
|
+
* the tag, because two copies of the element on one page (two bundles, or this
|
|
10
|
+
* package beside its predecessor) would otherwise run the other one. The class
|
|
11
|
+
* is not named: in a minified bundle its name is a one-letter identifier.
|
|
12
|
+
* Registration is an explicit step rather than an import side effect, so
|
|
13
|
+
* importing the package defines nothing and stays tree-shakeable.
|
|
14
|
+
*/
|
|
15
|
+
export function defineChat(): void {
|
|
16
|
+
const existing = customElements.get(ELEMENT_TAG);
|
|
17
|
+
if (existing === undefined) {
|
|
18
|
+
customElements.define(ELEMENT_TAG, AgUiChat);
|
|
19
|
+
} else if (existing !== AgUiChat) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`<${ELEMENT_TAG}> is already defined by another class: ` +
|
|
22
|
+
"a second copy of this package, or another package, is on the page",
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AttachmentRef } from "../attachment.js";
|
|
2
|
+
|
|
3
|
+
/** `detail` shape of the {@link ATTACHMENT_EVENT} CustomEvent. */
|
|
4
|
+
export interface AttachmentsDetail {
|
|
5
|
+
/** Durable refs for every file that has finished uploading. */
|
|
6
|
+
readonly attachments: readonly AttachmentRef[];
|
|
7
|
+
/** How many files are still uploading; a send now would leave these behind. */
|
|
8
|
+
readonly pending: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `detail` shape of the {@link CUSTOM_AGENT_EVENT} CustomEvent. */
|
|
2
|
+
export interface CustomAgentDetail {
|
|
3
|
+
/** The `CUSTOM` event's `name`, verbatim. An open string; never interpreted here. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** Its `value`, verbatim and unparsed. `unknown` because the protocol says nothing about it. */
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `detail` shape of the {@link DOCK_WIDTH_EVENT} CustomEvent. */
|
|
2
|
+
export interface DockWidthDetail {
|
|
3
|
+
/** The CSS px the docked panel covers at rest; 0 when it covers none of the page. */
|
|
4
|
+
readonly width: number;
|
|
5
|
+
/** The edge the panel docks against. */
|
|
6
|
+
readonly side: "left" | "right";
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** {@link FEEDBACK_EVENT} detail: what was rated, and how. */
|
|
2
|
+
export interface FeedbackDetail {
|
|
3
|
+
/** The rated message's text, as rendered. */
|
|
4
|
+
readonly content: string;
|
|
5
|
+
readonly rating: "up" | "down";
|
|
6
|
+
/**
|
|
7
|
+
* The AG-UI id of the rated assistant message: the id it streamed under, or
|
|
8
|
+
* the stored message's `id` when it was restored from history.
|
|
9
|
+
*
|
|
10
|
+
* What a host stores a rating against. `content` cannot be: two answers can
|
|
11
|
+
* read the same, and the text says nothing about which stored message it
|
|
12
|
+
* was. A restored message carries whatever id its store returns: the
|
|
13
|
+
* built-in browser store keeps the streamed ids, and a server-backed one
|
|
14
|
+
* keeps them only where the server persists the ids it streamed.
|
|
15
|
+
*/
|
|
16
|
+
readonly messageId: string;
|
|
17
|
+
/** The conversation the message belongs to: the element's thread when it was drawn. */
|
|
18
|
+
readonly threadId: string;
|
|
19
|
+
/**
|
|
20
|
+
* The run that streamed the message, as its `RUN_STARTED` named it.
|
|
21
|
+
*
|
|
22
|
+
* Present only on a message that arrived live. A restored one has none to
|
|
23
|
+
* give -- an AG-UI message carries no run id -- so the key is absent there
|
|
24
|
+
* rather than holding a value that only looks like one.
|
|
25
|
+
*/
|
|
26
|
+
readonly runId?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** `detail` shape of the {@link INVALIDATE_EVENT} CustomEvent. */
|
|
2
|
+
export interface InvalidateDetail {
|
|
3
|
+
/**
|
|
4
|
+
* The resources that moved, as the server named them.
|
|
5
|
+
*
|
|
6
|
+
* **Opaque strings, and matching is exact.** `orders/42` does not imply
|
|
7
|
+
* `orders` -- a prefix rule would be this component guessing at a scheme it
|
|
8
|
+
* does not own, and `orders/1` would match `orders/11`. A server that wants
|
|
9
|
+
* the collection refreshed names it. Your own matching may be hierarchical,
|
|
10
|
+
* because in your vocabulary the scheme is known.
|
|
11
|
+
*/
|
|
12
|
+
readonly keys: readonly string[];
|
|
13
|
+
/** What caused the write -- usually the tool's name. `null` when unstated. */
|
|
14
|
+
readonly reason: string | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ToolRun } from "./tool_run.js";
|
|
2
|
+
|
|
3
|
+
/** `detail` shape of the {@link RUN_FINISHED_EVENT} CustomEvent. */
|
|
4
|
+
export interface RunFinishedDetail {
|
|
5
|
+
/**
|
|
6
|
+
* The thread the run belonged to, fixed when its client was built. Not always
|
|
7
|
+
* the thread on screen: a run stopped by a new chat or a thread switch still
|
|
8
|
+
* reports once its request closes, and by then another thread is.
|
|
9
|
+
*/
|
|
10
|
+
readonly threadId: string;
|
|
11
|
+
/** In settle order. Empty when the interaction called no tools. */
|
|
12
|
+
readonly tools: readonly ToolRun[];
|
|
13
|
+
/**
|
|
14
|
+
* Every key announced during the interaction, de-duplicated, first-seen order.
|
|
15
|
+
*
|
|
16
|
+
* **This is the field that makes adoption one line** for a host already
|
|
17
|
+
* listening here, and the `else` is the whole compatibility story:
|
|
18
|
+
*
|
|
19
|
+
* ```js
|
|
20
|
+
* if (detail.invalidated.length > 0) refetchOnly(detail.invalidated);
|
|
21
|
+
* else if (detail.tools.some((t) => t.side === "server")) refetchEverything();
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Empty against a server that announces nothing, so an old server and a new
|
|
25
|
+
* client fall through to the coarse refetch that shipped before either.
|
|
26
|
+
*/
|
|
27
|
+
readonly invalidated: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* How the interaction ended: `"completed"` when it ran to its end, `"stopped"`
|
|
30
|
+
* when Stop, a new chat or a thread switch cut it off, `"failed"` when the
|
|
31
|
+
* agent reported an error. Reported for a run the conversation has left
|
|
32
|
+
* behind too, so a host can tell a cancelled run's late event from the live
|
|
33
|
+
* run's own. A host should ignore a value it does not know.
|
|
34
|
+
*/
|
|
35
|
+
readonly outcome: "completed" | "stopped" | "failed";
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentRef } from "../attachment.js";
|
|
2
|
+
|
|
3
|
+
/** `detail` shape of the {@link SUBMIT_EVENT} CustomEvent. */
|
|
4
|
+
export interface SubmitDetail {
|
|
5
|
+
readonly content: string;
|
|
6
|
+
/** Durable refs for the files attached to this message (empty when none). */
|
|
7
|
+
readonly attachments: readonly AttachmentRef[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** `detail` shape of the {@link THREAD_EVENT} CustomEvent. */
|
|
2
|
+
export interface ThreadDetail {
|
|
3
|
+
/** The thread now on screen. */
|
|
4
|
+
readonly threadId: string;
|
|
5
|
+
/**
|
|
6
|
+
* The thread on screen before the change: the one the previous event
|
|
7
|
+
* reported, and `null` before the first, as at the restore when the element
|
|
8
|
+
* first connects. Equal to `threadId` when the same thread was restored
|
|
9
|
+
* again (`reload()`, the element connecting again).
|
|
10
|
+
*/
|
|
11
|
+
readonly previousThreadId: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* What changed it:
|
|
14
|
+
*
|
|
15
|
+
* - `new`: `newChat()` or the built-in New chat button.
|
|
16
|
+
* - `switch`: `switchThread()` or a row picked in the conversation list.
|
|
17
|
+
* - `delete`: the active thread was deleted, and a fresh one took its place.
|
|
18
|
+
* - `restore`: the stored thread was replayed, on connect or by `reload()`.
|
|
19
|
+
* - `rescope`: a `user-key` change handed the element to another principal,
|
|
20
|
+
* live or while it was out of the document.
|
|
21
|
+
*
|
|
22
|
+
* A closed set today; a host should ignore a reason it does not know, so a
|
|
23
|
+
* later one can be added without breaking it.
|
|
24
|
+
*/
|
|
25
|
+
readonly reason: "new" | "switch" | "delete" | "restore" | "rescope";
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `detail` shape of the {@link THREAD_TITLE_EVENT} CustomEvent. */
|
|
2
|
+
export interface ThreadTitleDetail {
|
|
3
|
+
/** The thread on screen. */
|
|
4
|
+
readonly threadId: string;
|
|
5
|
+
/** Its title, as `threadTitle` reads it now; `""` for a thread with nothing sent. */
|
|
6
|
+
readonly title: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** One tool that ran during an interaction, as {@link RunFinishedDetail} lists it. */
|
|
2
|
+
export interface ToolRun {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
/**
|
|
5
|
+
* Where it executed. `"server"` is the one a data-rendering host cares about:
|
|
6
|
+
* a `"client"` tool ran in the host's own handler, so the host already knows
|
|
7
|
+
* whatever it did.
|
|
8
|
+
*/
|
|
9
|
+
readonly side: "server" | "client";
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `detail` shape of the {@link UNREAD_EVENT} CustomEvent. */
|
|
2
|
+
export interface UnreadDetail {
|
|
3
|
+
/** Unseen answers across every thread: what the launcher badge shows. */
|
|
4
|
+
readonly unread: number;
|
|
5
|
+
/**
|
|
6
|
+
* The threads whose unseen answers this change marked or cleared; empty when
|
|
7
|
+
* none did (a collapse toggle still reports the total).
|
|
8
|
+
*/
|
|
9
|
+
readonly threadIds: readonly string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an opt-in flag attribute on `element` the way HTML reads a boolean
|
|
3
|
+
* attribute.
|
|
4
|
+
*
|
|
5
|
+
* Present means on: bare (`data-prompt-chips`), empty (`=""`), or any value
|
|
6
|
+
* except the literal `"false"`. Comparing against `"true"` instead would make
|
|
7
|
+
* the bare spelling every native boolean attribute uses silently disable the
|
|
8
|
+
* feature it names. `="false"` still turns it off.
|
|
9
|
+
*/
|
|
10
|
+
export function readFlag(element: Element, name: string): boolean {
|
|
11
|
+
const value = element.getAttribute(name);
|
|
12
|
+
return value !== null && value !== "false";
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a JSON-valued attribute on `element`, saying so when it will not parse.
|
|
3
|
+
*
|
|
4
|
+
* `null` for an absent attribute, and `null` again for one that is not JSON --
|
|
5
|
+
* but not quietly the second time. Quoting JSON inside an HTML attribute is
|
|
6
|
+
* fiddly, and the result of getting it wrong is indistinguishable from the
|
|
7
|
+
* feature being switched off: no chips appear, or the strings stay English,
|
|
8
|
+
* with nothing anywhere saying why. That is the same failure `data-paste-attach`
|
|
9
|
+
* already reports for a value it cannot read.
|
|
10
|
+
*
|
|
11
|
+
* Console only. A page author's typo is not the reader's business, nothing the
|
|
12
|
+
* reader did was refused, and the degraded widget is still perfectly usable.
|
|
13
|
+
*/
|
|
14
|
+
export function readJsonAttribute(element: Element, name: string): unknown {
|
|
15
|
+
const raw = element.getAttribute(name);
|
|
16
|
+
if (raw === null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(raw);
|
|
21
|
+
} catch {
|
|
22
|
+
console.warn(
|
|
23
|
+
`<ag-ui-chat>: ${name} is not valid JSON, so it was ignored entirely and ` +
|
|
24
|
+
"the built-in default is being used. Check the quoting -- JSON inside " +
|
|
25
|
+
"an HTML attribute needs single quotes around the attribute value, or " +
|
|
26
|
+
"its own double quotes escaped.",
|
|
27
|
+
);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MAX_TOOL_ROUNDS } from "../constants.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The tool-round budget from `element`'s `data-max-tool-rounds`, for one send.
|
|
5
|
+
*
|
|
6
|
+
* Anything unparseable becomes `NaN`, which {@link AgUiClient} rejects along
|
|
7
|
+
* with a bound below one -- so the two ways of setting this are validated in
|
|
8
|
+
* one place rather than agreeing by coincidence.
|
|
9
|
+
*/
|
|
10
|
+
export function readMaxToolRounds(element: Element): number {
|
|
11
|
+
const attr = element.getAttribute("data-max-tool-rounds");
|
|
12
|
+
return attr === null ? MAX_TOOL_ROUNDS : Number.parseInt(attr, 10);
|
|
13
|
+
}
|