@agent-native/core 0.108.0 → 0.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +25 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/client.ts +162 -17
- package/corpus/core/src/a2a/correlation.ts +50 -0
- package/corpus/core/src/a2a/handlers.ts +200 -14
- package/corpus/core/src/a2a/index.ts +7 -1
- package/corpus/core/src/a2a/invoke.ts +77 -1
- package/corpus/core/src/a2a/server.ts +13 -1
- package/corpus/core/src/a2a/task-store.ts +146 -6
- package/corpus/core/src/a2a/types.ts +32 -0
- package/corpus/core/src/action.ts +5 -2
- package/corpus/core/src/agent/production-agent.ts +33 -4
- package/corpus/core/src/client/AssistantChat.tsx +648 -603
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +31 -4
- package/corpus/core/src/client/agent-chat-adapter.ts +23 -37
- package/corpus/core/src/client/agent-sidebar-state.ts +4 -0
- package/corpus/core/src/client/analytics.ts +84 -0
- package/corpus/core/src/client/chat/message-components.tsx +94 -22
- package/corpus/core/src/client/chat/tool-call-display.tsx +170 -47
- package/corpus/core/src/client/chat/use-agent-chat-lifecycle-tracking.ts +74 -0
- package/corpus/core/src/client/chat-thread-url.ts +11 -0
- package/corpus/core/src/client/error-capture.ts +12 -0
- package/corpus/core/src/client/extensions/ExtensionSlot.tsx +37 -1
- package/corpus/core/src/client/index.ts +2 -0
- package/corpus/core/src/client/route-chunk-recovery.ts +20 -8
- package/corpus/core/src/client/session-replay.ts +31 -0
- package/corpus/core/src/client/use-run-stuck-detection.ts +27 -1
- package/corpus/core/src/db/client.ts +55 -0
- package/corpus/core/src/extensions/actions.ts +2 -14
- package/corpus/core/src/extensions/store.ts +1 -1
- package/corpus/core/src/localization/default-messages.ts +3 -0
- package/corpus/core/src/mcp/build-server.ts +2 -2
- package/corpus/core/src/observability/traces.ts +172 -19
- package/corpus/core/src/progress/actions.ts +4 -2
- package/corpus/core/src/provider-api/index.ts +205 -105
- package/corpus/core/src/scripts/call-agent.ts +190 -19
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +112 -25
- package/corpus/core/src/server/agent-chat-plugin.ts +136 -4
- package/corpus/core/src/styles/agent-conversation.css +7 -0
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +19 -0
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +19 -0
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +19 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +19 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +49 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +7 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/performance/SKILL.md +13 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +29 -10
- package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +54 -23
- package/corpus/templates/analytics/.builder/skills/apollo/SKILL.md +19 -41
- package/corpus/templates/analytics/.builder/skills/commonroom/SKILL.md +20 -35
- package/corpus/templates/analytics/.builder/skills/github/SKILL.md +23 -67
- package/corpus/templates/analytics/.builder/skills/pylon/SKILL.md +25 -43
- package/corpus/templates/analytics/AGENTS.md +22 -13
- package/corpus/templates/analytics/actions/account-deep-dive.ts +1 -0
- package/corpus/templates/analytics/actions/configure-gong-native-insights.ts +29 -0
- package/corpus/templates/analytics/actions/content-calendar-schema.ts +8 -4
- package/corpus/templates/analytics/actions/content-calendar.ts +12 -4
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +2 -1
- package/corpus/templates/analytics/actions/gong-calls.ts +113 -22
- package/corpus/templates/analytics/actions/gong-native-insights.ts +166 -0
- package/corpus/templates/analytics/actions/hubspot-deals.ts +190 -46
- package/corpus/templates/analytics/actions/pylon-issues.ts +123 -0
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +1 -1
- package/corpus/templates/analytics/actions/slack-messages.ts +179 -27
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +48 -152
- package/corpus/templates/analytics/app/components/ui/chart.tsx +1 -1
- package/corpus/templates/analytics/app/hooks/use-chart-tooltip-flip.ts +21 -6
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +13 -0
- package/corpus/templates/analytics/app/i18n-data.ts +134 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +181 -30
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +6 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +4 -3
- package/corpus/templates/analytics/changelog/2026-07-17-analytics-now-includes-a-default-alert-for-spikes-in-stuck-agent-chats.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-dashboard-editors-can-add-shared-extensions-or-opt-into-per-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-dashboard-extensions-show-a-loading-skeleton.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-errors-now-group-repeat-failures-consistently-and-keep-priva.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-gong-transcript-reviews-now-batch-bounded-call-windows-for-f.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-hubspot-deal-filters-now-run-in-hubspot-before-paging-result.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-notion-content-calendars-now-discover-the-matching-database-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-pylon-dashboard-reads-now-use-the-paginated-issue-search-api.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-slack-reads-no-longer-join-channels-and-report-pagination-coverage.md +6 -0
- package/corpus/templates/analytics/docs/schemas/first-party-analytics.md +23 -14
- package/corpus/templates/analytics/docs/schemas/tracked-events.md +5 -1
- package/corpus/templates/analytics/server/handlers/notion.ts +14 -3
- package/corpus/templates/analytics/server/handlers/slack.ts +182 -29
- package/corpus/templates/analytics/server/jobs/analytics-alerts.ts +3 -3
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +2 -6
- package/corpus/templates/analytics/server/lib/analytics-alerts.ts +209 -87
- package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +6 -2
- package/corpus/templates/analytics/server/lib/error-capture.ts +75 -8
- package/corpus/templates/analytics/server/lib/gong-native-policy.ts +72 -0
- package/corpus/templates/analytics/server/lib/gong.ts +54 -66
- package/corpus/templates/analytics/server/lib/hubspot.ts +40 -3
- package/corpus/templates/analytics/server/lib/notion.ts +83 -8
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +4 -0
- package/corpus/templates/analytics/server/lib/slack.ts +242 -90
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +3 -3
- package/corpus/templates/analytics/server/routes/api/pylon/accounts.get.ts +42 -1
- package/corpus/templates/analytics/server/routes/api/pylon/issues.get.ts +71 -1
- package/corpus/templates/analytics/server/routes/api/test-connection.post.ts +44 -4
- package/corpus/templates/clips/actions/finalize-recording.ts +541 -62
- package/corpus/templates/clips/app/components/library/bulk-action-toolbar.tsx +19 -1
- package/corpus/templates/clips/app/components/library/create-folder-dialog.tsx +123 -0
- package/corpus/templates/clips/app/components/library/library-grid.tsx +42 -4
- package/corpus/templates/clips/app/components/library/recording-card.tsx +30 -0
- package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +17 -2
- package/corpus/templates/clips/app/components/player/video-player.tsx +14 -2
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +2 -2
- package/corpus/templates/clips/app/entry.client.tsx +6 -1
- package/corpus/templates/clips/app/i18n/ar-SA.ts +12 -1
- package/corpus/templates/clips/app/i18n/de-DE.ts +12 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +12 -1
- package/corpus/templates/clips/app/i18n/es-ES.ts +11 -1
- package/corpus/templates/clips/app/i18n/fr-FR.ts +11 -1
- package/corpus/templates/clips/app/i18n/hi-IN.ts +10 -1
- package/corpus/templates/clips/app/i18n/ja-JP.ts +12 -1
- package/corpus/templates/clips/app/i18n/ko-KR.ts +11 -1
- package/corpus/templates/clips/app/i18n/pt-BR.ts +11 -1
- package/corpus/templates/clips/app/i18n/zh-CN.ts +11 -1
- package/corpus/templates/clips/app/i18n/zh-TW.ts +11 -1
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +72 -1
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -1
- package/corpus/templates/clips/app/routes/record.tsx +3 -3
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +6 -3
- package/corpus/templates/clips/changelog/2026-07-17-choose-which-workspace-receives-new-clips-recordings-and-des.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-clips-now-retries-storage-verification-in-the-background-ins.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-create-folders-directly-from-the-move-menu.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-failed-desktop-uploads-now-offer-a-direct-way-to-reopen-clip.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-fixed-broken-thumbnail-icons-appearing-over-playable-clip-em.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-playback-comments-stay-readable-at-faster-playback-speeds.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/finalize-recovery.ts +3 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +3 -3
- package/corpus/templates/clips/desktop/src/app.tsx +19 -7
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +111 -13
- package/corpus/templates/clips/desktop/src/lib/upload-verification.ts +16 -7
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +2 -4
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/live_upload.rs +32 -15
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +45 -18
- package/corpus/templates/clips/server/jobs/media-verification.ts +130 -0
- package/corpus/templates/clips/server/lib/builder-media-compression.ts +15 -0
- package/corpus/templates/clips/server/lib/media-verification-state.ts +38 -0
- package/corpus/templates/clips/server/lib/player-thumbnail-url.ts +31 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +10 -3
- package/corpus/templates/clips/server/plugins/auth.ts +5 -5
- package/corpus/templates/clips/server/plugins/calendar-jobs.ts +2 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +12 -2
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +6 -1
- package/corpus/templates/clips/server/routes/api/thumbnail/[recordingId].get.ts +340 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +24 -7
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +91 -7
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/status.get.ts +14 -0
- package/corpus/templates/clips/shared/finalize-recovery.ts +61 -2
- package/corpus/templates/clips/shared/share-meta.ts +1 -1
- package/corpus/templates/content/app/entry.client.tsx +6 -1
- package/corpus/templates/dispatch/AGENTS.md +5 -0
- package/corpus/templates/dispatch/changelog/2026-07-17-apps-page-links-to-other-available-apps.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-17-curated-template-remixes.md +6 -0
- package/corpus/templates/mail/app/entry.client.tsx +6 -1
- package/corpus/templates/slides/.agents/skills/slide-images/SKILL.md +11 -7
- package/corpus/templates/slides/.env.example +0 -1
- package/corpus/templates/slides/AGENTS.md +4 -0
- package/corpus/templates/slides/DEVELOPING.md +2 -2
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +1 -1
- package/corpus/templates/slides/actions/logo-config.ts +6 -7
- package/corpus/templates/slides/actions/search-images.ts +11 -39
- package/corpus/templates/slides/actions/search-logos.ts +5 -52
- package/corpus/templates/slides/app/components/editor/ImageSearchPanel.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/LogoSearchPanel.tsx +16 -26
- package/corpus/templates/slides/app/entry.client.tsx +6 -1
- package/corpus/templates/slides/server/lib/media-search-providers.ts +216 -0
- package/corpus/templates/slides/server/register-secrets.ts +30 -0
- package/dist/a2a/client.d.ts +47 -1
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +94 -12
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/correlation.d.ts +10 -0
- package/dist/a2a/correlation.d.ts.map +1 -0
- package/dist/a2a/correlation.js +40 -0
- package/dist/a2a/correlation.js.map +1 -0
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +147 -15
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/index.d.ts +4 -4
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js +2 -2
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/invoke.d.ts +29 -2
- package/dist/a2a/invoke.d.ts.map +1 -1
- package/dist/a2a/invoke.js +33 -1
- package/dist/a2a/invoke.js.map +1 -1
- package/dist/a2a/server.d.ts.map +1 -1
- package/dist/a2a/server.js +14 -1
- package/dist/a2a/server.js.map +1 -1
- package/dist/a2a/task-store.d.ts +12 -1
- package/dist/a2a/task-store.d.ts.map +1 -1
- package/dist/a2a/task-store.js +96 -6
- package/dist/a2a/task-store.js.map +1 -1
- package/dist/a2a/types.d.ts +27 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/action.d.ts +5 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +14 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +19 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +14 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +158 -136
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +27 -4
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +21 -39
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-sidebar-state.d.ts +1 -0
- package/dist/client/agent-sidebar-state.d.ts.map +1 -1
- package/dist/client/agent-sidebar-state.js +4 -0
- package/dist/client/agent-sidebar-state.js.map +1 -1
- package/dist/client/analytics.d.ts +14 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +67 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +8 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +62 -19
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +6 -0
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +83 -14
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/chat/use-agent-chat-lifecycle-tracking.d.ts +8 -0
- package/dist/client/chat/use-agent-chat-lifecycle-tracking.d.ts.map +1 -0
- package/dist/client/chat/use-agent-chat-lifecycle-tracking.js +51 -0
- package/dist/client/chat/use-agent-chat-lifecycle-tracking.js.map +1 -0
- package/dist/client/chat-thread-url.d.ts +2 -0
- package/dist/client/chat-thread-url.d.ts.map +1 -0
- package/dist/client/chat-thread-url.js +12 -0
- package/dist/client/chat-thread-url.js.map +1 -0
- package/dist/client/error-capture.d.ts.map +1 -1
- package/dist/client/error-capture.js +7 -0
- package/dist/client/error-capture.js.map +1 -1
- package/dist/client/extensions/ExtensionSlot.d.ts +3 -1
- package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionSlot.js +28 -3
- package/dist/client/extensions/ExtensionSlot.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/route-chunk-recovery.d.ts.map +1 -1
- package/dist/client/route-chunk-recovery.js +14 -9
- package/dist/client/route-chunk-recovery.js.map +1 -1
- package/dist/client/session-replay.d.ts +15 -0
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +20 -0
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
- package/dist/client/use-run-stuck-detection.js +25 -1
- package/dist/client/use-run-stuck-detection.js.map +1 -1
- package/dist/db/client.d.ts +7 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +33 -0
- package/dist/db/client.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +2 -10
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/store.js +1 -1
- package/dist/extensions/store.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/build-server.d.ts +2 -0
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +2 -2
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +5 -5
- package/dist/observability/traces.d.ts +9 -0
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +137 -19
- package/dist/observability/traces.js.map +1 -1
- package/dist/progress/actions.d.ts.map +1 -1
- package/dist/progress/actions.js +3 -2
- package/dist/progress/actions.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +91 -8
- package/dist/provider-api/index.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +140 -17
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/action-filters-a2a.d.ts +24 -2
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.js +62 -7
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +118 -5
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/agent-conversation.css +7 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +20 -0
- package/dist/templates/default/app/i18n/de-DE.ts +20 -0
- package/dist/templates/default/app/i18n/en-US.ts +20 -0
- package/dist/templates/default/app/i18n/es-ES.ts +20 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +21 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +19 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +20 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +19 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +20 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +19 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +19 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +49 -0
- package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +7 -1
- package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +13 -0
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
- package/package.json +1 -1
- package/src/templates/default/app/i18n/ar-SA.ts +20 -0
- package/src/templates/default/app/i18n/de-DE.ts +20 -0
- package/src/templates/default/app/i18n/en-US.ts +20 -0
- package/src/templates/default/app/i18n/es-ES.ts +20 -0
- package/src/templates/default/app/i18n/fr-FR.ts +21 -0
- package/src/templates/default/app/i18n/hi-IN.ts +19 -0
- package/src/templates/default/app/i18n/ja-JP.ts +20 -0
- package/src/templates/default/app/i18n/ko-KR.ts +19 -0
- package/src/templates/default/app/i18n/pt-BR.ts +20 -0
- package/src/templates/default/app/i18n/zh-CN.ts +19 -0
- package/src/templates/default/app/i18n/zh-TW.ts +19 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +49 -0
- package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +7 -1
- package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +13 -0
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
- package/corpus/templates/analytics/server/handlers/github.ts +0 -200
- package/corpus/templates/analytics/server/handlers/pylon.ts +0 -43
- package/corpus/templates/analytics/server/lib/apollo.ts +0 -167
- package/corpus/templates/analytics/server/lib/commonroom.ts +0 -149
- package/corpus/templates/analytics/server/lib/github.ts +0 -660
- package/corpus/templates/analytics/server/lib/mixpanel.ts +0 -156
- package/corpus/templates/analytics/server/lib/posthog.ts +0 -194
- package/corpus/templates/analytics/server/lib/pylon.ts +0 -109
- package/corpus/templates/analytics/server/routes/api/github/graphql.post.ts +0 -1
- package/corpus/templates/analytics/server/routes/api/github/issue.get.ts +0 -1
- package/corpus/templates/analytics/server/routes/api/github/org-prs.get.ts +0 -1
- package/corpus/templates/analytics/server/routes/api/github/pr.get.ts +0 -1
- package/corpus/templates/analytics/server/routes/api/github/prs.get.ts +0 -1
- package/corpus/templates/analytics/server/routes/api/github/search.get.ts +0 -1
- package/corpus/templates/slides/actions/fetch-logos.ts +0 -90
- package/corpus/templates/slides/actions/image-search.ts +0 -64
- package/corpus/templates/slides/actions/import-github.ts +0 -182
- package/corpus/templates/slides/actions/logo-lookup.ts +0 -113
|
@@ -753,10 +753,15 @@ export function MultiTabAssistantChat({
|
|
|
753
753
|
const [urlThreadId, setUrlThreadId] = useState<string | null>(() =>
|
|
754
754
|
threadUrlSyncEnabled
|
|
755
755
|
? threadRouteControlsActiveThread
|
|
756
|
-
? (routeThreadId ??
|
|
756
|
+
? (routeThreadId ?? readUrlThreadId(threadUrlParamName))
|
|
757
757
|
: readUrlThreadId(threadUrlParamName)
|
|
758
758
|
: null,
|
|
759
759
|
);
|
|
760
|
+
const [deepLinkedThreadId] = useState<string | null>(() =>
|
|
761
|
+
threadUrlSyncEnabled ? null : readUrlThreadId(DEFAULT_THREAD_URL_PARAM),
|
|
762
|
+
);
|
|
763
|
+
const [activeDeepLinkedThreadId, setActiveDeepLinkedThreadId] =
|
|
764
|
+
useState(deepLinkedThreadId);
|
|
760
765
|
const urlThreadIdRef = useRef(urlThreadId);
|
|
761
766
|
urlThreadIdRef.current = urlThreadId;
|
|
762
767
|
|
|
@@ -780,8 +785,28 @@ export function MultiTabAssistantChat({
|
|
|
780
785
|
|
|
781
786
|
useEffect(() => {
|
|
782
787
|
if (!threadUrlSyncEnabled || !threadRouteControlsActiveThread) return;
|
|
783
|
-
setUrlThreadId(routeThreadId ??
|
|
784
|
-
}, [
|
|
788
|
+
setUrlThreadId(routeThreadId ?? readUrlThreadId(threadUrlParamName));
|
|
789
|
+
}, [
|
|
790
|
+
routeThreadId,
|
|
791
|
+
threadRouteControlsActiveThread,
|
|
792
|
+
threadUrlParamName,
|
|
793
|
+
threadUrlSyncEnabled,
|
|
794
|
+
]);
|
|
795
|
+
|
|
796
|
+
useEffect(() => {
|
|
797
|
+
if (threadUrlSyncEnabled) return;
|
|
798
|
+
const update = () =>
|
|
799
|
+
setActiveDeepLinkedThreadId(readUrlThreadId(DEFAULT_THREAD_URL_PARAM));
|
|
800
|
+
const uninstallHistoryPatch = installHistoryThreadUrlPatch();
|
|
801
|
+
update();
|
|
802
|
+
window.addEventListener("popstate", update);
|
|
803
|
+
window.addEventListener(THREAD_URL_CHANGED_EVENT, update);
|
|
804
|
+
return () => {
|
|
805
|
+
uninstallHistoryPatch();
|
|
806
|
+
window.removeEventListener("popstate", update);
|
|
807
|
+
window.removeEventListener(THREAD_URL_CHANGED_EVENT, update);
|
|
808
|
+
};
|
|
809
|
+
}, [threadUrlSyncEnabled]);
|
|
785
810
|
|
|
786
811
|
const writeThreadUrl = useCallback(
|
|
787
812
|
(threadId: string | null, options: { replace?: boolean } = {}): void => {
|
|
@@ -856,7 +881,9 @@ export function MultiTabAssistantChat({
|
|
|
856
881
|
renameThread,
|
|
857
882
|
} = useChatThreads(apiUrl, storageKey, null, {
|
|
858
883
|
restoreActiveThread,
|
|
859
|
-
routeThreadId: threadUrlSyncEnabled
|
|
884
|
+
routeThreadId: threadUrlSyncEnabled
|
|
885
|
+
? urlThreadId
|
|
886
|
+
: (activeDeepLinkedThreadId ?? undefined),
|
|
860
887
|
});
|
|
861
888
|
|
|
862
889
|
const switchThread = useCallback(
|
|
@@ -1875,6 +1875,10 @@ export function createAgentChatAdapter(
|
|
|
1875
1875
|
}
|
|
1876
1876
|
};
|
|
1877
1877
|
|
|
1878
|
+
const canAttachRun = (candidateRunId: string, candidateTurnId: string) =>
|
|
1879
|
+
attemptedRunIds.includes(candidateRunId) ||
|
|
1880
|
+
(candidateTurnId.length > 0 && candidateTurnId === turnId);
|
|
1881
|
+
|
|
1878
1882
|
const preparingActionStateForRun = (
|
|
1879
1883
|
id: string | null,
|
|
1880
1884
|
): PreparingActionState | undefined => {
|
|
@@ -2097,15 +2101,13 @@ export function createAgentChatAdapter(
|
|
|
2097
2101
|
}
|
|
2098
2102
|
const active = await activeRes.json();
|
|
2099
2103
|
if (active?.active && active.runId) {
|
|
2100
|
-
|
|
2101
|
-
const activeStatus =
|
|
2102
|
-
typeof active.status === "string" ? active.status : "";
|
|
2104
|
+
const activeRunId = String(active.runId);
|
|
2103
2105
|
const activeTurnId =
|
|
2104
2106
|
typeof active.turnId === "string" ? active.turnId : "";
|
|
2105
|
-
if (
|
|
2107
|
+
if (!canAttachRun(activeRunId, activeTurnId)) {
|
|
2106
2108
|
return false;
|
|
2107
2109
|
}
|
|
2108
|
-
|
|
2110
|
+
updateCurrentRunDispatchMode(active.dispatchMode);
|
|
2109
2111
|
const previousRunId = runId;
|
|
2110
2112
|
runId = activeRunId;
|
|
2111
2113
|
if (!attemptedRunIds.includes(activeRunId)) {
|
|
@@ -2172,17 +2174,17 @@ export function createAgentChatAdapter(
|
|
|
2172
2174
|
typeof active.dispatchMode === "string"
|
|
2173
2175
|
? active.dispatchMode
|
|
2174
2176
|
: "";
|
|
2177
|
+
const activeTurnId =
|
|
2178
|
+
typeof active.turnId === "string" ? active.turnId : "";
|
|
2179
|
+
if (!canAttachRun(activeRunId, activeTurnId)) return false;
|
|
2175
2180
|
updateCurrentRunDispatchMode(dispatchMode);
|
|
2176
2181
|
if (activeRunId === interruptedRunId) {
|
|
2177
2182
|
if (dispatchMode.startsWith("background")) continue;
|
|
2178
2183
|
return false;
|
|
2179
2184
|
}
|
|
2180
|
-
const activeTurnId =
|
|
2181
|
-
typeof active.turnId === "string" ? active.turnId : "";
|
|
2182
2185
|
const activeStatus =
|
|
2183
2186
|
typeof active.status === "string" ? active.status : "";
|
|
2184
2187
|
if (!dispatchMode.startsWith("background")) return false;
|
|
2185
|
-
if (activeTurnId && activeTurnId !== turnId) return false;
|
|
2186
2188
|
if (activeStatus !== "running" && activeStatus !== "starting") {
|
|
2187
2189
|
return false;
|
|
2188
2190
|
}
|
|
@@ -2548,10 +2550,7 @@ export function createAgentChatAdapter(
|
|
|
2548
2550
|
// Only follow runs belonging to THIS turn (server-chained
|
|
2549
2551
|
// successors reuse the turnId) or runs we already attached to.
|
|
2550
2552
|
const isOurRun =
|
|
2551
|
-
activeRunId !== null &&
|
|
2552
|
-
(attemptedRunIds.includes(activeRunId) ||
|
|
2553
|
-
!activeTurnId ||
|
|
2554
|
-
activeTurnId === turnId);
|
|
2553
|
+
activeRunId !== null && canAttachRun(activeRunId, activeTurnId);
|
|
2555
2554
|
|
|
2556
2555
|
if (activeRunId && isOurRun) {
|
|
2557
2556
|
lastSeenActive = active;
|
|
@@ -3100,12 +3099,19 @@ export function createAgentChatAdapter(
|
|
|
3100
3099
|
// active run is one this adapter already consumed, reconnecting
|
|
3101
3100
|
// to it replays the terminal auto_continue and exits instead of
|
|
3102
3101
|
// posting the continuation. Wait for stale/previous active runs
|
|
3103
|
-
// to clear and retry THIS prompt.
|
|
3104
|
-
//
|
|
3105
|
-
|
|
3102
|
+
// to clear and retry THIS prompt. An unknown run reported to an
|
|
3103
|
+
// internal continuation is only adoptable after /runs/active
|
|
3104
|
+
// proves it carries this turnId; a bare 409 run id is not
|
|
3105
|
+
// enough ownership evidence.
|
|
3106
|
+
if (
|
|
3106
3107
|
activeRunId !== null &&
|
|
3107
|
-
|
|
3108
|
-
|
|
3108
|
+
internalContinuationRequest &&
|
|
3109
|
+
!attemptedRunIds.includes(activeRunId)
|
|
3110
|
+
) {
|
|
3111
|
+
const reconnected = yield* reconnectActiveRunForThread();
|
|
3112
|
+
if (reconnected) return;
|
|
3113
|
+
}
|
|
3114
|
+
const shouldRetryConflictingActiveRun = activeRunId !== null;
|
|
3109
3115
|
if (shouldRetryConflictingActiveRun) {
|
|
3110
3116
|
queuedConflictRetries += 1;
|
|
3111
3117
|
if (queuedConflictRetries <= MAX_QUEUED_CONFLICT_RETRIES) {
|
|
@@ -3157,26 +3163,6 @@ export function createAgentChatAdapter(
|
|
|
3157
3163
|
clearActiveRun();
|
|
3158
3164
|
return;
|
|
3159
3165
|
}
|
|
3160
|
-
if (activeRunId) {
|
|
3161
|
-
try {
|
|
3162
|
-
const previousRunId = runId;
|
|
3163
|
-
runId = activeRunId;
|
|
3164
|
-
if (!attemptedRunIds.includes(runId)) {
|
|
3165
|
-
attemptedRunIds.push(runId);
|
|
3166
|
-
}
|
|
3167
|
-
reconnectCursorForRun(activeRunId, previousRunId);
|
|
3168
|
-
if (threadId) {
|
|
3169
|
-
setActiveRun({ threadId, runId, lastSeq });
|
|
3170
|
-
}
|
|
3171
|
-
const reconnected = yield* reconnectCurrentRun();
|
|
3172
|
-
if (reconnected) return;
|
|
3173
|
-
await delay(1000, abortSignal);
|
|
3174
|
-
if (abortSignal.aborted) return;
|
|
3175
|
-
continue;
|
|
3176
|
-
} catch {
|
|
3177
|
-
// Fall through to the generic response handling below.
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
3166
|
}
|
|
3181
3167
|
|
|
3182
3168
|
if (res.status === 401 || res.status === 403) {
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
AGENT_SIDEBAR_QUERY_PARAM,
|
|
3
3
|
AGENT_SIDEBAR_QUERY_VALUE_CLOSED,
|
|
4
4
|
} from "../shared/agent-sidebar-url.js";
|
|
5
|
+
import { hasChatThreadDeepLink } from "./chat-thread-url.js";
|
|
6
|
+
|
|
7
|
+
export { hasChatThreadDeepLink } from "./chat-thread-url.js";
|
|
5
8
|
|
|
6
9
|
export const SIDEBAR_OPEN_KEY = "agent-native-sidebar-open";
|
|
7
10
|
export const SIDEBAR_STATE_CHANGE_EVENT = "agent-panel:state-change";
|
|
@@ -139,6 +142,7 @@ export function getInitialAgentSidebarOpen(
|
|
|
139
142
|
): boolean {
|
|
140
143
|
const urlOverride = getAgentSidebarUrlOpenOverride();
|
|
141
144
|
if (urlOverride !== null) return urlOverride;
|
|
145
|
+
if (hasChatThreadDeepLink()) return true;
|
|
142
146
|
|
|
143
147
|
// On mobile viewports the sidebar would cover most of the screen, so
|
|
144
148
|
// always start closed regardless of any persisted desktop preference.
|
|
@@ -64,6 +64,10 @@ type PageviewTrackingState = {
|
|
|
64
64
|
lastPageviewKey: string | null;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
type AgentChatTrackingState = {
|
|
68
|
+
seen: Map<string, number>;
|
|
69
|
+
};
|
|
70
|
+
|
|
67
71
|
/**
|
|
68
72
|
* First-party, Sentry-style error capture configuration. Pass `true`/`false`
|
|
69
73
|
* to force on/off, or an options object to tune it. When omitted, error
|
|
@@ -173,6 +177,11 @@ export const AGENT_NATIVE_EXCEPTION_EVENT_NAME = "$exception";
|
|
|
173
177
|
const PAGEVIEW_TRACKING_STATE_KEY = Symbol.for(
|
|
174
178
|
"agent-native.client.pageviewTracking",
|
|
175
179
|
);
|
|
180
|
+
const AGENT_CHAT_TRACKING_STATE_KEY = Symbol.for(
|
|
181
|
+
"agent-native.client.agentChatTracking",
|
|
182
|
+
);
|
|
183
|
+
const AGENT_CHAT_LIFECYCLE_DEDUPE_TTL_MS = 10 * 60 * 1_000;
|
|
184
|
+
const MAX_AGENT_CHAT_LIFECYCLE_DEDUPE_KEYS = 1_000;
|
|
176
185
|
|
|
177
186
|
const LLM_CONNECTION_STORAGE_KEY = "agent-native.llm_connection_status";
|
|
178
187
|
const LLM_CONNECTION_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -1045,6 +1054,81 @@ function getPageviewTrackingState(): PageviewTrackingState {
|
|
|
1045
1054
|
return g[PAGEVIEW_TRACKING_STATE_KEY];
|
|
1046
1055
|
}
|
|
1047
1056
|
|
|
1057
|
+
function getAgentChatTrackingState(): AgentChatTrackingState {
|
|
1058
|
+
const g = globalThis as typeof globalThis & {
|
|
1059
|
+
[AGENT_CHAT_TRACKING_STATE_KEY]?: AgentChatTrackingState;
|
|
1060
|
+
};
|
|
1061
|
+
if (!g[AGENT_CHAT_TRACKING_STATE_KEY]) {
|
|
1062
|
+
g[AGENT_CHAT_TRACKING_STATE_KEY] = { seen: new Map() };
|
|
1063
|
+
}
|
|
1064
|
+
return g[AGENT_CHAT_TRACKING_STATE_KEY];
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
export type AgentChatLifecycleEvent = {
|
|
1068
|
+
phase: "surface-mounted" | "run-observed" | "run-stopped";
|
|
1069
|
+
surface?: string;
|
|
1070
|
+
threadId?: string;
|
|
1071
|
+
runId?: string;
|
|
1072
|
+
tabId?: string;
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Record a content-free, browser-session-linked chat lifecycle marker and add
|
|
1077
|
+
* the same marker to session replay when replay is configured. The bounded
|
|
1078
|
+
* global de-dupe survives React Strict Mode remounts without retaining keys
|
|
1079
|
+
* forever.
|
|
1080
|
+
*/
|
|
1081
|
+
export function trackAgentChatLifecycle(input: AgentChatLifecycleEvent): void {
|
|
1082
|
+
if (typeof window === "undefined") return;
|
|
1083
|
+
const surface = input.surface?.trim() || "app";
|
|
1084
|
+
const dedupeKey = [
|
|
1085
|
+
input.phase,
|
|
1086
|
+
surface,
|
|
1087
|
+
input.threadId ?? "",
|
|
1088
|
+
input.runId ?? "",
|
|
1089
|
+
input.tabId ?? "",
|
|
1090
|
+
].join(":");
|
|
1091
|
+
const state = getAgentChatTrackingState();
|
|
1092
|
+
const now = Date.now();
|
|
1093
|
+
for (const [key, seenAt] of state.seen) {
|
|
1094
|
+
if (now - seenAt >= AGENT_CHAT_LIFECYCLE_DEDUPE_TTL_MS) {
|
|
1095
|
+
state.seen.delete(key);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
if (state.seen.has(dedupeKey)) return;
|
|
1099
|
+
state.seen.set(dedupeKey, now);
|
|
1100
|
+
while (state.seen.size > MAX_AGENT_CHAT_LIFECYCLE_DEDUPE_KEYS) {
|
|
1101
|
+
const oldestKey = state.seen.keys().next().value;
|
|
1102
|
+
if (oldestKey === undefined) break;
|
|
1103
|
+
state.seen.delete(oldestKey);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
void (async () => {
|
|
1107
|
+
const replayResult =
|
|
1108
|
+
_sessionReplayOptions && _trackingContentCaptureEnabled
|
|
1109
|
+
? await startConfiguredSessionReplay(_sessionReplayOptions)
|
|
1110
|
+
: null;
|
|
1111
|
+
const properties = {
|
|
1112
|
+
phase: input.phase,
|
|
1113
|
+
chat_surface: surface,
|
|
1114
|
+
...(input.threadId ? { thread_id: input.threadId } : {}),
|
|
1115
|
+
...(input.runId ? { run_id: input.runId } : {}),
|
|
1116
|
+
...(input.tabId ? { chat_tab_id: input.tabId } : {}),
|
|
1117
|
+
replay_status: replayResult?.started
|
|
1118
|
+
? "active"
|
|
1119
|
+
: (replayResult?.reason ?? "not-configured"),
|
|
1120
|
+
};
|
|
1121
|
+
trackEvent("agent_chat_lifecycle", properties);
|
|
1122
|
+
_sessionReplayModuleForCapture?.emitSessionReplayAgentChatEvent?.({
|
|
1123
|
+
phase: input.phase,
|
|
1124
|
+
surface,
|
|
1125
|
+
...(input.threadId ? { threadId: input.threadId } : {}),
|
|
1126
|
+
...(input.runId ? { runId: input.runId } : {}),
|
|
1127
|
+
...(input.tabId ? { tabId: input.tabId } : {}),
|
|
1128
|
+
});
|
|
1129
|
+
})();
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1048
1132
|
export function configureTracking(options: ConfigureTrackingOptions): void {
|
|
1049
1133
|
const publicKey = options.key || options.publicKey;
|
|
1050
1134
|
if (publicKey) {
|
|
@@ -72,7 +72,10 @@ import {
|
|
|
72
72
|
import {
|
|
73
73
|
ToolCallFallback,
|
|
74
74
|
FilesChangedSummary,
|
|
75
|
+
ASSISTANT_VISIBLE_TOOL_CALL_LIMIT,
|
|
75
76
|
ChatRunningContext,
|
|
77
|
+
ChatRunDurationContext,
|
|
78
|
+
RanToolsSummary,
|
|
76
79
|
ReasoningCell,
|
|
77
80
|
WorkedForSummary,
|
|
78
81
|
} from "./tool-call-display.js";
|
|
@@ -820,7 +823,7 @@ function assistantMessageStatusIsTerminal(message: {
|
|
|
820
823
|
return statusType === "complete" || statusType === "incomplete";
|
|
821
824
|
}
|
|
822
825
|
|
|
823
|
-
function messageTextFromContent(content: unknown): string {
|
|
826
|
+
export function messageTextFromContent(content: unknown): string {
|
|
824
827
|
if (typeof content === "string") return content;
|
|
825
828
|
if (!Array.isArray(content)) return "";
|
|
826
829
|
return content
|
|
@@ -829,14 +832,10 @@ function messageTextFromContent(content: unknown): string {
|
|
|
829
832
|
const record = part as {
|
|
830
833
|
type?: unknown;
|
|
831
834
|
text?: unknown;
|
|
832
|
-
result?: unknown;
|
|
833
835
|
};
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
values.push(record.result);
|
|
838
|
-
}
|
|
839
|
-
return values;
|
|
836
|
+
return record.type === "text" && typeof record.text === "string"
|
|
837
|
+
? [record.text]
|
|
838
|
+
: [];
|
|
840
839
|
})
|
|
841
840
|
.join("\n");
|
|
842
841
|
}
|
|
@@ -874,10 +873,10 @@ export function shouldShowAssistantMessageFooter({
|
|
|
874
873
|
hasUnresolvedTool?: boolean;
|
|
875
874
|
}): boolean {
|
|
876
875
|
if (!hasRenderableContent) return false;
|
|
877
|
-
if (chatRunning) return false;
|
|
878
876
|
if (!isLast) return true;
|
|
877
|
+
if (chatRunning) return false;
|
|
879
878
|
if (hasUnresolvedTool) return false;
|
|
880
|
-
return
|
|
879
|
+
return statusIsTerminal;
|
|
881
880
|
}
|
|
882
881
|
|
|
883
882
|
export function shouldShowAssistantWorkSummary({
|
|
@@ -954,16 +953,77 @@ export function isCollapsibleAssistantWorkPart(part: {
|
|
|
954
953
|
);
|
|
955
954
|
}
|
|
956
955
|
|
|
957
|
-
function
|
|
958
|
-
type?: string;
|
|
959
|
-
|
|
960
|
-
|
|
956
|
+
export function getAssistantToolSummaryInfo(
|
|
957
|
+
parts: readonly { type?: string; toolName?: string }[],
|
|
958
|
+
): { startIndex: number; hiddenToolCount: number } {
|
|
959
|
+
const toolCallIndices = parts.reduce<number[]>((indices, part, index) => {
|
|
960
|
+
if (part.type === "tool-call" && isCollapsibleAssistantWorkPart(part)) {
|
|
961
|
+
indices.push(index);
|
|
962
|
+
}
|
|
963
|
+
return indices;
|
|
964
|
+
}, []);
|
|
965
|
+
|
|
966
|
+
if (toolCallIndices.length <= ASSISTANT_VISIBLE_TOOL_CALL_LIMIT) {
|
|
967
|
+
return { startIndex: -1, hiddenToolCount: 0 };
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
const startIndex =
|
|
971
|
+
toolCallIndices[
|
|
972
|
+
toolCallIndices.length - ASSISTANT_VISIBLE_TOOL_CALL_LIMIT
|
|
973
|
+
]!;
|
|
974
|
+
return {
|
|
975
|
+
startIndex,
|
|
976
|
+
hiddenToolCount: toolCallIndices.length - ASSISTANT_VISIBLE_TOOL_CALL_LIMIT,
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function groupAssistantWorkParts(
|
|
981
|
+
part: {
|
|
982
|
+
type?: string;
|
|
983
|
+
toolName?: string;
|
|
984
|
+
},
|
|
985
|
+
index: number,
|
|
986
|
+
parts: readonly { type?: string; toolName?: string }[],
|
|
987
|
+
): ["group-work"] | ["group-work", "group-ran-tools"] | null {
|
|
961
988
|
if (isCollapsibleAssistantWorkPart(part)) {
|
|
989
|
+
const { startIndex } = getAssistantToolSummaryInfo(parts);
|
|
990
|
+
if (isAssistantToolSummaryPart(parts, index, startIndex)) {
|
|
991
|
+
return ["group-work", "group-ran-tools"];
|
|
992
|
+
}
|
|
962
993
|
return ["group-work"];
|
|
963
994
|
}
|
|
964
995
|
return null;
|
|
965
996
|
}
|
|
966
997
|
|
|
998
|
+
function isAssistantToolSummaryPart(
|
|
999
|
+
parts: readonly { type?: string; toolName?: string }[],
|
|
1000
|
+
index: number,
|
|
1001
|
+
startIndex: number,
|
|
1002
|
+
): boolean {
|
|
1003
|
+
if (startIndex < 0 || index >= startIndex) return false;
|
|
1004
|
+
if (!isCollapsibleAssistantWorkPart(parts[index]!)) return false;
|
|
1005
|
+
|
|
1006
|
+
let segmentStart = index;
|
|
1007
|
+
while (
|
|
1008
|
+
segmentStart > 0 &&
|
|
1009
|
+
isCollapsibleAssistantWorkPart(parts[segmentStart - 1]!)
|
|
1010
|
+
) {
|
|
1011
|
+
segmentStart--;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
let segmentEnd = index + 1;
|
|
1015
|
+
while (
|
|
1016
|
+
segmentEnd < startIndex &&
|
|
1017
|
+
isCollapsibleAssistantWorkPart(parts[segmentEnd]!)
|
|
1018
|
+
) {
|
|
1019
|
+
segmentEnd++;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return parts
|
|
1023
|
+
.slice(segmentStart, segmentEnd)
|
|
1024
|
+
.some((candidate) => candidate.type === "tool-call");
|
|
1025
|
+
}
|
|
1026
|
+
|
|
967
1027
|
export function AssistantMessage() {
|
|
968
1028
|
const [restoreState, setRestoreState] = useState<
|
|
969
1029
|
"idle" | "confirming" | "restoring"
|
|
@@ -971,6 +1031,7 @@ export function AssistantMessage() {
|
|
|
971
1031
|
const messageRuntime = useMessageRuntime();
|
|
972
1032
|
const thread = useThread();
|
|
973
1033
|
const chatRunning = React.useContext(ChatRunningContext);
|
|
1034
|
+
const lastRunDurationMs = React.useContext(ChatRunDurationContext);
|
|
974
1035
|
const msg = messageRuntime.getState();
|
|
975
1036
|
const timestamp = formatMessageTimestamp(msg.createdAt);
|
|
976
1037
|
const isLast =
|
|
@@ -1001,16 +1062,17 @@ export function AssistantMessage() {
|
|
|
1001
1062
|
}
|
|
1002
1063
|
return;
|
|
1003
1064
|
}
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1065
|
+
if (!chatRunning && isLast && capturedDurationMs == null) {
|
|
1066
|
+
const durationMs =
|
|
1067
|
+
lastRunDurationMs ??
|
|
1068
|
+
(runStartedAtRef.current == null
|
|
1069
|
+
? null
|
|
1070
|
+
: Date.now() - runStartedAtRef.current);
|
|
1071
|
+
if (durationMs == null) return;
|
|
1072
|
+
setCapturedDurationMs(durationMs);
|
|
1011
1073
|
runStartedAtRef.current = null;
|
|
1012
1074
|
}
|
|
1013
|
-
}, [chatRunning, isLast, capturedDurationMs]);
|
|
1075
|
+
}, [chatRunning, isLast, capturedDurationMs, lastRunDurationMs]);
|
|
1014
1076
|
|
|
1015
1077
|
// Animate collapse only when this message just finished running in-session.
|
|
1016
1078
|
const wasRunningRef = useRef(false);
|
|
@@ -1124,6 +1186,16 @@ export function AssistantMessage() {
|
|
|
1124
1186
|
</WorkedForSummary>
|
|
1125
1187
|
);
|
|
1126
1188
|
}
|
|
1189
|
+
case "group-ran-tools": {
|
|
1190
|
+
const toolCount = part.indices.filter(
|
|
1191
|
+
(index) => msgContent?.[index]?.type === "tool-call",
|
|
1192
|
+
).length;
|
|
1193
|
+
return (
|
|
1194
|
+
<RanToolsSummary toolCount={toolCount}>
|
|
1195
|
+
{children}
|
|
1196
|
+
</RanToolsSummary>
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1127
1199
|
case "text":
|
|
1128
1200
|
return <MarkdownText />;
|
|
1129
1201
|
case "reasoning":
|