@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,200 @@
|
|
|
1
|
+
import { SUBAGENT_PHASE } from "../../constants.js";
|
|
2
|
+
import { fillUiString } from "../fill_ui_string.js";
|
|
3
|
+
import type { UiStrings } from "../ui_strings.js";
|
|
4
|
+
import { SubAgentPanel, type SubAgentPhase, type SubAgentUpdate } from "./subagent_panel.js";
|
|
5
|
+
import { subAgentUpdate } from "./subagent_update.js";
|
|
6
|
+
import type { ToolCallCard } from "./tool_call_card.js";
|
|
7
|
+
|
|
8
|
+
/** What delegated progress needs from the element that owns it. */
|
|
9
|
+
export interface SubAgentProgressHost {
|
|
10
|
+
/** The tool card drawn for a call id, which a delegation's panel hangs off. */
|
|
11
|
+
readonly card: (callId: string) => ToolCallCard | undefined;
|
|
12
|
+
/** The resolved string table. */
|
|
13
|
+
readonly strings: () => UiStrings;
|
|
14
|
+
/** Keep the transcript at its foot, if the reader is there. */
|
|
15
|
+
readonly follow: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A delegated sub-agent's progress, hung off the card that delegated: the live
|
|
20
|
+
* panels by delegation, and which delegation each child run belongs to.
|
|
21
|
+
*
|
|
22
|
+
* Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
|
|
23
|
+
* instance.
|
|
24
|
+
*/
|
|
25
|
+
export class SubAgentProgress {
|
|
26
|
+
readonly #host: SubAgentProgressHost;
|
|
27
|
+
/**
|
|
28
|
+
* The live delegation panels, keyed by the **parent's** `delegate_task` call
|
|
29
|
+
* id — which is what the wire keys a sub-agent's progress on, so this map and
|
|
30
|
+
* the element's tool cards answer to the same key.
|
|
31
|
+
*
|
|
32
|
+
* Kept beside the cards rather than on them, so a card stays a card: the tool
|
|
33
|
+
* card holds the slot and this holds what went into it, the same division the
|
|
34
|
+
* approval prompt already uses.
|
|
35
|
+
*/
|
|
36
|
+
readonly #subagentPanels = new Map<string, SubAgentPanel>();
|
|
37
|
+
/**
|
|
38
|
+
* Which delegation each live `subagentRunId` belongs to.
|
|
39
|
+
*
|
|
40
|
+
* The protocol's closing events -- `SUBAGENT_FINISHED` and `SUBAGENT_ERROR`
|
|
41
|
+
* -- carry the child's run id and nothing else, while everything drawn here
|
|
42
|
+
* is keyed on the parent's `delegate_task` call id. `SUBAGENT_STARTED` is the
|
|
43
|
+
* one event carrying both, so the pairing is recorded there and read back on
|
|
44
|
+
* the close. A close naming a run this never saw open is dropped, which is
|
|
45
|
+
* the same refusal a step for an undrawn card gets.
|
|
46
|
+
*/
|
|
47
|
+
readonly #subagentRunDelegations = new Map<string, string>();
|
|
48
|
+
|
|
49
|
+
constructor(host: SubAgentProgressHost) {
|
|
50
|
+
this.#host = host;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Draw one step of a delegated sub-agent's progress, on the card that
|
|
55
|
+
* delegated.
|
|
56
|
+
*
|
|
57
|
+
* `delegationId` is the parent's own `delegate_task` tool-call id, so the
|
|
58
|
+
* attachment point is a card this element already drew on `TOOL_CALL_START`.
|
|
59
|
+
* Without this a run that hands work to a sub-agent reads as a stall, the
|
|
60
|
+
* card sitting at "running…" for the child's whole duration, so the narration
|
|
61
|
+
* goes *into* that card rather than a second element with the same identity.
|
|
62
|
+
*
|
|
63
|
+
* A progress event for a call this client never drew is dropped. It has no
|
|
64
|
+
* card to attach to, and inventing a floating one is precisely the alternative
|
|
65
|
+
* that was rejected: parent and child interleave in the transcript with
|
|
66
|
+
* nothing marking whose is whose, and the persisted transcript -- which never
|
|
67
|
+
* held the progress at all -- would not match what was on screen.
|
|
68
|
+
*
|
|
69
|
+
* Nothing here writes to the conversation store. `CUSTOM` never enters
|
|
70
|
+
* `agent.messages`, so a reload mid-run leaves the tool card and loses the
|
|
71
|
+
* nested detail, which is the intended behaviour rather than a gap.
|
|
72
|
+
*/
|
|
73
|
+
report(value: unknown): void {
|
|
74
|
+
const update = subAgentUpdate(value);
|
|
75
|
+
if (update === null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.#apply(update);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Open a delegation, on `SUBAGENT_STARTED`. */
|
|
82
|
+
start(subagentRunId: string, agent: string, parentToolCallId: string | null): void {
|
|
83
|
+
// A delegation naming no parent call names no card, and a floating
|
|
84
|
+
// panel is exactly what attaching to the card was chosen over.
|
|
85
|
+
if (parentToolCallId === null) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.#subagentRunDelegations.set(subagentRunId, parentToolCallId);
|
|
89
|
+
this.#apply({
|
|
90
|
+
delegationId: parentToolCallId,
|
|
91
|
+
agent: agent === "" ? null : agent,
|
|
92
|
+
phase: SUBAGENT_PHASE.STARTED,
|
|
93
|
+
status: fillUiString(this.#host.strings().subAgentDelegatedTo, { agent }),
|
|
94
|
+
tool: null,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Settle a delegation that completed, on `SUBAGENT_FINISHED`. */
|
|
99
|
+
finish(subagentRunId: string): void {
|
|
100
|
+
this.#close(subagentRunId, SUBAGENT_PHASE.FINISHED, null);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Settle a delegation that failed, on `SUBAGENT_ERROR`. */
|
|
104
|
+
fail(subagentRunId: string, message: string): void {
|
|
105
|
+
// The server's own words, which the contract keeps to the sub-agent's
|
|
106
|
+
// name. Passed through as the status line and set with textContent
|
|
107
|
+
// downstream, never parsed as markup.
|
|
108
|
+
//
|
|
109
|
+
// The message is required by the protocol and can still arrive empty,
|
|
110
|
+
// which would settle the row to a blank line -- a delegation that reads
|
|
111
|
+
// as having said nothing rather than as having failed. The fallback was
|
|
112
|
+
// written and documented in UiStrings and never wired up, so until now
|
|
113
|
+
// the only reader who knew it existed was the one reading the string
|
|
114
|
+
// table.
|
|
115
|
+
this.#close(
|
|
116
|
+
subagentRunId,
|
|
117
|
+
SUBAGENT_PHASE.FAILED,
|
|
118
|
+
message === "" ? this.#host.strings().subAgentFailed : message,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Forget every delegation. The panels go with the cards they hung off.
|
|
124
|
+
* Nothing restores them: the progress rode the imperative carrier and was
|
|
125
|
+
* never persisted, which is the correct half of that split -- a delegation
|
|
126
|
+
* that was live before this transcript was wiped is not live now.
|
|
127
|
+
*/
|
|
128
|
+
clear(): void {
|
|
129
|
+
this.#subagentPanels.clear();
|
|
130
|
+
this.#subagentRunDelegations.clear();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Settle the delegation a closing lifecycle event names.
|
|
135
|
+
*
|
|
136
|
+
* `status` is the server's text on a failure and `null` on a success, where
|
|
137
|
+
* the wording is this element's own -- the protocol's finish event carries no
|
|
138
|
+
* message, which is the better shape for a localised UI and the reason
|
|
139
|
+
* {@link UiStrings.subAgentFinished} exists.
|
|
140
|
+
*
|
|
141
|
+
* The pairing is deliberately not deleted on close. A panel outlives the
|
|
142
|
+
* delegation it drew, the map is cleared with the transcript alongside the
|
|
143
|
+
* panels, and forgetting the id here would only make a duplicate close draw
|
|
144
|
+
* nothing instead of drawing the same settled row again.
|
|
145
|
+
*/
|
|
146
|
+
#close(subagentRunId: string, phase: SubAgentPhase, status: string | null): void {
|
|
147
|
+
const delegationId = this.#subagentRunDelegations.get(subagentRunId);
|
|
148
|
+
if (delegationId === undefined) {
|
|
149
|
+
// A close naming a delegation this never saw open -- the same refusal a
|
|
150
|
+
// step for an undrawn card gets, and the same reason.
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const agent = this.#subagentPanels.get(delegationId)?.agent ?? null;
|
|
154
|
+
this.#apply({
|
|
155
|
+
delegationId,
|
|
156
|
+
agent,
|
|
157
|
+
phase,
|
|
158
|
+
status: status === null ? this.#finishedLine(agent) : status,
|
|
159
|
+
tool: null,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** The row's line for a delegation that completed, named if its name is known. */
|
|
164
|
+
#finishedLine(agent: string | null): string {
|
|
165
|
+
const strings = this.#host.strings();
|
|
166
|
+
return agent === null
|
|
167
|
+
? strings.subAgentWorking
|
|
168
|
+
: fillUiString(strings.subAgentFinished, { agent });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Fold one already-narrowed update into the delegation's panel.
|
|
173
|
+
*
|
|
174
|
+
* The join point of the two carriers, and the reason it is separate from
|
|
175
|
+
* {@link report}: a `CUSTOM` step arrives as `unknown` and has to be vouched
|
|
176
|
+
* for, while a lifecycle event arrives typed off the protocol and has nothing
|
|
177
|
+
* left to check. Both end up here, so the panel has one way in and the phases
|
|
178
|
+
* stay a single state machine regardless of which wire they came from.
|
|
179
|
+
*/
|
|
180
|
+
#apply(update: SubAgentUpdate): void {
|
|
181
|
+
const card = this.#host.card(update.delegationId);
|
|
182
|
+
if (card === undefined) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
let panel = this.#subagentPanels.get(update.delegationId);
|
|
186
|
+
if (panel === undefined) {
|
|
187
|
+
// Created on whichever phase arrives first rather than only on `started`.
|
|
188
|
+
// The contract says exactly one opens a delegation, and a client that
|
|
189
|
+
// insisted on it would answer a server that dropped one frame by showing
|
|
190
|
+
// nothing at all for the rest of the run.
|
|
191
|
+
panel = new SubAgentPanel(this.#host.strings());
|
|
192
|
+
this.#subagentPanels.set(update.delegationId, panel);
|
|
193
|
+
card.subagentSlot.appendChild(panel.element);
|
|
194
|
+
}
|
|
195
|
+
panel.report(update);
|
|
196
|
+
// The card grew, and the transcript is usually pinned to the foot while a
|
|
197
|
+
// run is in flight.
|
|
198
|
+
this.#host.follow();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow one `ag_ui.subagent` payload into a {@link SubAgentUpdate}.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of the panel for the reason `chartSpecFrom` is kept out of the
|
|
5
|
+
* renderer: the panel's job is drawing, and a value that reaches it has already
|
|
6
|
+
* been vouched for.
|
|
7
|
+
*
|
|
8
|
+
* **The three lifecycle phases are still accepted here, deliberately.** A current
|
|
9
|
+
* server sends only `tool_call` and `tool_result` on this carrier -- the
|
|
10
|
+
* delegation's lifetime moved to the protocol's `SUBAGENT_*` events -- but a
|
|
11
|
+
* server one release older sends all five, and this element is published and
|
|
12
|
+
* vendored separately from it. Continuing to narrow the older shape costs
|
|
13
|
+
* nothing (the panel needs those phases as visual states regardless) and is the
|
|
14
|
+
* difference between a mixed-version pair that degrades and one that shows a
|
|
15
|
+
* delegation which never opens.
|
|
16
|
+
*
|
|
17
|
+
* Defensive about the payload, not about the name. A `CUSTOM` event's `value` is
|
|
18
|
+
* `unknown` by the protocol, so a server can put anything there, and a malformed
|
|
19
|
+
* announcement must not take a run down with it — the same rule the invalidation
|
|
20
|
+
* channel applies to the same field. What is refused here is only what cannot be
|
|
21
|
+
* rendered at all: without a `delegationId` there is no card to attach to, and
|
|
22
|
+
* without a known `phase` there is no state to be in. Everything else degrades to
|
|
23
|
+
* `null`, which the panel reads as "said nothing about this".
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { SUBAGENT_PHASE } from "../../constants.js";
|
|
27
|
+
import type { SubAgentPhase, SubAgentTool, SubAgentUpdate } from "./subagent_panel.js";
|
|
28
|
+
|
|
29
|
+
const PHASES: readonly string[] = Object.values(SUBAGENT_PHASE);
|
|
30
|
+
|
|
31
|
+
/** A record view of `value`, or `null` for anything that is not an object. */
|
|
32
|
+
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
33
|
+
// `typeof null` is "object", and an array is one too — neither carries the
|
|
34
|
+
// keys below, and both arrive from a JSON decoder without any warning.
|
|
35
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return value as Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A non-empty string, or `null`. */
|
|
42
|
+
function asText(value: unknown): string | null {
|
|
43
|
+
return typeof value === "string" && value !== "" ? value : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The `tool` record the two tool phases carry.
|
|
48
|
+
*
|
|
49
|
+
* All-or-nothing: the contract states all three keys on every tool phase, so a
|
|
50
|
+
* partial record is a payload this client does not understand rather than a step
|
|
51
|
+
* to draw half of. A step row keyed by an empty id would also collide with the
|
|
52
|
+
* next one, silently merging two of the child's calls into one row.
|
|
53
|
+
*/
|
|
54
|
+
function asTool(value: unknown): SubAgentTool | null {
|
|
55
|
+
const record = asRecord(value);
|
|
56
|
+
if (record === null) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const toolCallId = asText(record["toolCallId"]);
|
|
60
|
+
const name = asText(record["name"]);
|
|
61
|
+
const ok = record["ok"];
|
|
62
|
+
if (toolCallId === null || name === null) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (ok !== null && typeof ok !== "boolean") {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return { toolCallId, name, ok };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Narrow an `ag_ui.subagent` `CUSTOM` value, or `null` if it cannot be drawn. */
|
|
72
|
+
export function subAgentUpdate(value: unknown): SubAgentUpdate | null {
|
|
73
|
+
const record = asRecord(value);
|
|
74
|
+
if (record === null) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const delegationId = asText(record["delegationId"]);
|
|
78
|
+
const phase = record["phase"];
|
|
79
|
+
if (delegationId === null || typeof phase !== "string" || !PHASES.includes(phase)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
delegationId,
|
|
84
|
+
phase: phase as SubAgentPhase,
|
|
85
|
+
agent: asText(record["agent"]),
|
|
86
|
+
status: asText(record["status"]),
|
|
87
|
+
tool: asTool(record["tool"]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { fillUiString } from "../fill_ui_string.js";
|
|
2
|
+
import { DEFAULT_UI_STRINGS, type UiStrings } from "../ui_strings.js";
|
|
3
|
+
|
|
4
|
+
/** Below this, a reasoning block is too short to time and its header reads `thoughts`. */
|
|
5
|
+
const TIMED_FROM_MS = 1000;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A muted "thinking" region for a reasoning model's streamed chain-of-thought.
|
|
9
|
+
*
|
|
10
|
+
* Sits at the top of the current answer group. Its header reads `thinking`
|
|
11
|
+
* while the model reasons, and {@link settle} stops the clock and names how
|
|
12
|
+
* long it took ("Thought for 4s"). {@link stream} replaces the body with the
|
|
13
|
+
* running buffer, which opens expanded and folds away on {@link collapse},
|
|
14
|
+
* once the answer's first text token arrives.
|
|
15
|
+
*
|
|
16
|
+
* The header is a disclosure only while there is text behind it. A provider
|
|
17
|
+
* that reasons without sending any -- redacted thinking, or reasoning with
|
|
18
|
+
* its summaries off -- still opens and closes a block, and a toggle there
|
|
19
|
+
* folded and unfolded an empty, ruled box. Until the buffer has text the
|
|
20
|
+
* header is a plain label and the body is not drawn; the first text turns the
|
|
21
|
+
* label into the toggle, and the body comes with it.
|
|
22
|
+
*
|
|
23
|
+
* Pure DOM. The host inserts {@link element}; all visible chrome text comes
|
|
24
|
+
* from {@link UiStrings}. The clock is injectable so the timing is testable.
|
|
25
|
+
*/
|
|
26
|
+
export class ThoughtsBlock {
|
|
27
|
+
/** The block's root element; insert this at the top of the answer group. */
|
|
28
|
+
readonly element: HTMLDivElement;
|
|
29
|
+
|
|
30
|
+
readonly #label: HTMLSpanElement;
|
|
31
|
+
readonly #body: HTMLPreElement;
|
|
32
|
+
readonly #toggle: HTMLButtonElement;
|
|
33
|
+
readonly #strings: UiStrings;
|
|
34
|
+
readonly #now: () => number;
|
|
35
|
+
/** When the running round started, or `null` once {@link settle} stopped the clock. */
|
|
36
|
+
#startedAt: number | null;
|
|
37
|
+
/** The reasoning time of the rounds already settled, in milliseconds. */
|
|
38
|
+
#elapsed = 0;
|
|
39
|
+
#collapsed = false;
|
|
40
|
+
#hasText = false;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Build the block as reasoning starts, which is when its clock starts.
|
|
44
|
+
*
|
|
45
|
+
* @param strings - The resolved string table.
|
|
46
|
+
* @param now - The clock, in milliseconds; `performance.now` unless a test
|
|
47
|
+
* supplies its own.
|
|
48
|
+
*/
|
|
49
|
+
constructor(
|
|
50
|
+
strings: UiStrings = DEFAULT_UI_STRINGS,
|
|
51
|
+
now: () => number = () => performance.now(),
|
|
52
|
+
) {
|
|
53
|
+
this.#strings = strings;
|
|
54
|
+
this.#now = now;
|
|
55
|
+
this.#startedAt = now();
|
|
56
|
+
|
|
57
|
+
this.element = document.createElement("div");
|
|
58
|
+
this.element.className = "thoughts";
|
|
59
|
+
this.element.setAttribute("part", "thoughts");
|
|
60
|
+
// Lets CSS animate the header while the model is still reasoning; dropped
|
|
61
|
+
// when the block settles.
|
|
62
|
+
this.element.setAttribute("data-streaming", "");
|
|
63
|
+
|
|
64
|
+
this.#toggle = document.createElement("button");
|
|
65
|
+
this.#toggle.type = "button";
|
|
66
|
+
this.#toggle.className = "thoughts-toggle";
|
|
67
|
+
this.#toggle.setAttribute("part", "thoughts-toggle");
|
|
68
|
+
this.#toggle.setAttribute("aria-expanded", "true");
|
|
69
|
+
|
|
70
|
+
this.#label = document.createElement("span");
|
|
71
|
+
this.#label.className = "thoughts-label";
|
|
72
|
+
this.#label.setAttribute("part", "thoughts-label");
|
|
73
|
+
this.#label.textContent = strings.thinking;
|
|
74
|
+
|
|
75
|
+
this.#body = document.createElement("pre");
|
|
76
|
+
this.#body.className = "thoughts-body";
|
|
77
|
+
this.#body.setAttribute("part", "thoughts-body");
|
|
78
|
+
this.#body.hidden = true;
|
|
79
|
+
|
|
80
|
+
this.#toggle.addEventListener("click", () => {
|
|
81
|
+
this.#setCollapsed(!this.#collapsed);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// The label stands alone until there is text for the toggle to open onto.
|
|
85
|
+
this.element.append(this.#label, this.#body);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A further round of reasoning in the same turn, after a tool call settled
|
|
90
|
+
* the first: restart the clock and the live header. The rounds' times add
|
|
91
|
+
* up. Ignored while the clock is already running.
|
|
92
|
+
*/
|
|
93
|
+
begin(): void {
|
|
94
|
+
if (this.#startedAt !== null) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.#startedAt = this.#now();
|
|
98
|
+
this.element.setAttribute("data-streaming", "");
|
|
99
|
+
this.#label.textContent = this.#strings.thinking;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Replace the reasoning body with the running buffer (the full text so far). */
|
|
103
|
+
stream(buffer: string): void {
|
|
104
|
+
this.#body.textContent = buffer;
|
|
105
|
+
this.#setHasText(buffer.trim() !== "");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Stop the clock and settle the header to how long the reasoning took.
|
|
110
|
+
*
|
|
111
|
+
* Called when reasoning ends, or by whatever arrives first in its place --
|
|
112
|
+
* the answer's text, a tool call, or the turn ending -- so the live label
|
|
113
|
+
* never outlives the reasoning. Idempotent: only the first call after a
|
|
114
|
+
* start counts.
|
|
115
|
+
*/
|
|
116
|
+
settle(): void {
|
|
117
|
+
if (this.#startedAt === null) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.#elapsed += this.#now() - this.#startedAt;
|
|
121
|
+
this.#startedAt = null;
|
|
122
|
+
this.element.removeAttribute("data-streaming");
|
|
123
|
+
this.#label.textContent =
|
|
124
|
+
this.#elapsed < TIMED_FROM_MS
|
|
125
|
+
? this.#strings.thoughts
|
|
126
|
+
: fillUiString(this.#strings.thoughtFor, {
|
|
127
|
+
seconds: Math.round(this.#elapsed / TIMED_FROM_MS),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Fold the region away when the answer's first text token arrives, settling
|
|
133
|
+
* the header first. Idempotent, since the per-token text handler calls it
|
|
134
|
+
* repeatedly.
|
|
135
|
+
*/
|
|
136
|
+
collapse(): void {
|
|
137
|
+
this.settle();
|
|
138
|
+
if (this.#collapsed) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.#setCollapsed(true);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Swap the header between the plain label and the toggle around it. */
|
|
145
|
+
#setHasText(hasText: boolean): void {
|
|
146
|
+
if (hasText === this.#hasText) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.#hasText = hasText;
|
|
150
|
+
if (hasText) {
|
|
151
|
+
this.#toggle.append(this.#label);
|
|
152
|
+
this.element.prepend(this.#toggle);
|
|
153
|
+
} else {
|
|
154
|
+
this.#toggle.remove();
|
|
155
|
+
this.element.prepend(this.#label);
|
|
156
|
+
}
|
|
157
|
+
this.#setCollapsed(this.#collapsed);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#setCollapsed(collapsed: boolean): void {
|
|
161
|
+
this.#collapsed = collapsed;
|
|
162
|
+
this.#body.hidden = collapsed || !this.#hasText;
|
|
163
|
+
this.#toggle.setAttribute("aria-expanded", String(!collapsed));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The collapsible reasoning region over an assistant turn.
|
|
2
|
+
export const THOUGHTS_STYLES: string = `
|
|
3
|
+
/* ── Thoughts region ────────────────────────────────────────────
|
|
4
|
+
A muted, collapsible chain-of-thought at the top of the answer group: open
|
|
5
|
+
while the model reasons, folded once the answer text starts. A block with
|
|
6
|
+
no text is a label alone, with no toggle and no body. */
|
|
7
|
+
.thoughts {
|
|
8
|
+
align-self: stretch;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 4px;
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
color: var(--_muted);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.thoughts-toggle {
|
|
17
|
+
align-self: flex-start;
|
|
18
|
+
border: none;
|
|
19
|
+
padding: 0;
|
|
20
|
+
background: none;
|
|
21
|
+
font: inherit;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: var(--_muted);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.thoughts-toggle::before {
|
|
29
|
+
content: var(--_disclosure-expanded) " ";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.thoughts-toggle[aria-expanded="false"]::before {
|
|
33
|
+
content: var(--_disclosure-collapsed) " ";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* The label is the whole header while the reasoning has no text, a plain line
|
|
37
|
+
with nothing to open; once there is text it sits inside the toggle, which
|
|
38
|
+
sets the same weight. */
|
|
39
|
+
.thoughts-label {
|
|
40
|
+
align-self: flex-start;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* A gentle pulse on the label while reasoning is still streaming. */
|
|
45
|
+
.thoughts[data-streaming] .thoughts-label {
|
|
46
|
+
animation: ag-ui-thoughts-pulse 1.4s ease-in-out infinite;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes ag-ui-thoughts-pulse {
|
|
50
|
+
0%, 100% { opacity: 0.55; }
|
|
51
|
+
50% { opacity: 1; }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.thoughts-body {
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding: 4px 0 4px 10px;
|
|
57
|
+
border-left: 2px solid var(--_border);
|
|
58
|
+
max-height: 220px;
|
|
59
|
+
overflow: auto;
|
|
60
|
+
white-space: pre-wrap;
|
|
61
|
+
word-break: break-word;
|
|
62
|
+
font-family: inherit;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.thoughts-body[hidden] {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (prefers-reduced-motion: reduce) {
|
|
70
|
+
.thoughts[data-streaming] .thoughts-label {
|
|
71
|
+
animation: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|