@agent-native/core 0.189.0 → 0.190.0-nightly-20260925211446
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 +1 -1
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +10 -0
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +1 -1
- package/corpus/templates/analytics/AGENTS.md +11 -22
- package/corpus/templates/analytics/actions/list-data-dictionary.ts +7 -9
- package/corpus/templates/analytics/actions/search-analytics-query-catalog.ts +1 -1
- package/corpus/templates/analytics/app/components/AnalyticsReviewArtifactPreview.tsx +201 -0
- package/corpus/templates/analytics/app/i18n/en-US.ts +2 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +50 -3
- package/corpus/templates/analytics/changelog/2026-09-25-first-run-onboarding-records-setup-choices-and-builder-conne.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-human-review-previews-analytics-dashboards-as-real-charts.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-org-admins-can-review-agent-runs-from-settings.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-proactive-query-context.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +98 -2
- package/corpus/templates/analytics/server/lib/analytics-agent-context.ts +557 -0
- package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +217 -46
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +2 -2
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +39 -5
- package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +4 -0
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +268 -2
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +44 -9
- package/corpus/templates/calendar/AGENTS.md +5 -0
- package/corpus/templates/calendar/CHANGELOG.md +6 -0
- package/corpus/templates/calendar/actions/get-event-rules-status.ts +47 -0
- package/corpus/templates/calendar/actions/list-events.ts +50 -4
- package/corpus/templates/calendar/actions/undo-calendar-event-rule.ts +229 -0
- package/corpus/templates/calendar/actions/update-settings.ts +8 -0
- package/corpus/templates/calendar/app/i18n/en-US.ts +27 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +196 -1
- package/corpus/templates/calendar/changelog/2026-09-25-calendar-feeds-with-the-same-url-keep-their-own-names-and-co.md +6 -0
- package/corpus/templates/calendar/changelog/2026-09-25-calendar-invitation-rules-surface-expired-connections-and-un.md +6 -0
- package/corpus/templates/calendar/changelog/2026-09-25-restore-locally-hidden-events-from-activity-after-disconnect.md +6 -0
- package/corpus/templates/calendar/server/lib/calendar-settings.ts +44 -10
- package/corpus/templates/calendar/server/lib/google-api.ts +15 -1
- package/corpus/templates/calendar/server/lib/google-calendar.ts +1 -1
- package/corpus/templates/calendar/server/plugins/event-rules.ts +628 -0
- package/corpus/templates/calendar/shared/api.ts +13 -0
- package/corpus/templates/calendar/shared/settings.ts +71 -1
- package/corpus/templates/clips/actions/create-recording.ts +83 -2
- package/corpus/templates/clips/actions/finalize-recording.ts +610 -110
- package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -0
- package/corpus/templates/clips/actions/import-loom-recording.ts +2 -0
- package/corpus/templates/clips/actions/lib/create-recording-schema.ts +7 -0
- package/corpus/templates/clips/actions/lib/loom-import-job.ts +15 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +126 -26
- package/corpus/templates/clips/app/hooks/use-drop-video-upload.ts +75 -15
- package/corpus/templates/clips/app/routes/_app.r.$recordingId.tsx +5 -1
- package/corpus/templates/clips/app/routes/record.tsx +134 -40
- package/corpus/templates/clips/chrome-extension/src/background.ts +3 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +73 -16
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +188 -18
- package/corpus/templates/clips/desktop/src/lib/recording-request.ts +1 -0
- package/corpus/templates/clips/server/db/schema.ts +4 -0
- package/corpus/templates/clips/server/jobs/media-verification.ts +78 -4
- package/corpus/templates/clips/server/jobs/recording-failure-backfill.ts +142 -0
- package/corpus/templates/clips/server/lib/media-verification-state.ts +29 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +2 -0
- package/corpus/templates/clips/server/lib/recording-failures.ts +111 -0
- package/corpus/templates/clips/server/lib/recordings.ts +6 -1
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +8 -3
- package/corpus/templates/clips/server/lib/upload-lease.ts +25 -6
- package/corpus/templates/clips/server/plugins/calendar-jobs.ts +2 -0
- package/corpus/templates/clips/server/plugins/db.ts +18 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +48 -5
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +322 -31
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +223 -61
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/interrupt.post.ts +62 -4
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +74 -7
- package/corpus/templates/clips/shared/recording-core.ts +27 -0
- package/corpus/templates/design/actions/get-design.ts +35 -6
- package/corpus/templates/mail/.agents/skills/inbox-automations/SKILL.md +4 -0
- package/corpus/templates/mail/actions/consolidate-ai-filter-rules.ts +41 -0
- package/corpus/templates/mail/actions/get-ai-priority.ts +48 -8
- package/corpus/templates/mail/actions/record-ai-priority-feedback.ts +69 -0
- package/corpus/templates/mail/actions/update-mail-preferences.ts +2 -0
- package/corpus/templates/mail/app/components/email/EmailList.tsx +179 -32
- package/corpus/templates/mail/app/components/email/EmailListItem.tsx +97 -9
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +55 -1
- package/corpus/templates/mail/app/components/email/ImportanceFeedbackMenu.tsx +52 -0
- package/corpus/templates/mail/app/components/email/compose-autocomplete.ts +2 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +219 -188
- package/corpus/templates/mail/app/components/onboarding/AiInboxSetup.tsx +338 -0
- package/corpus/templates/mail/app/components/settings/AiFilterSection.tsx +597 -781
- package/corpus/templates/mail/app/components/settings/AiRulePromptField.tsx +37 -0
- package/corpus/templates/mail/app/global.css +42 -26
- package/corpus/templates/mail/app/hooks/use-ai-priority-feedback.ts +43 -0
- package/corpus/templates/mail/app/hooks/use-automations.ts +23 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +58 -3
- package/corpus/templates/mail/app/pages/InboxPage.tsx +47 -10
- package/corpus/templates/mail/changelog/2026-09-25-editing-importance-rules-preserves-disabled-instructions-and.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-handle-astral-unicode-letters-in-autocomplete-word-boundarie.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-jev-priority-feedback-and-inbox-settings.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-keep-existing-ai-filter-rules-intact-when-saving-a-prompt.md +6 -0
- package/corpus/templates/mail/server/lib/automation-engine.ts +21 -12
- package/corpus/templates/mail/server/lib/automations.ts +100 -1
- package/corpus/templates/mail/shared/types.ts +3 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +6 -0
- package/corpus/templates/plan/app/lib/plan-invite-suggestion.ts +43 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +249 -4
- package/corpus/templates/slides/actions/create-deck.ts +11 -1
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +117 -1
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +373 -330
- package/corpus/templates/slides/app/components/design-system/builder-index-response.ts +36 -5
- package/corpus/templates/slides/app/components/editor/BlockBubbleMenu.tsx +21 -53
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +347 -671
- package/corpus/templates/slides/app/components/editor/bullet-editing.ts +55 -8
- package/corpus/templates/slides/app/components/editor/in-place-text-session.ts +2082 -0
- package/corpus/templates/slides/app/components/editor/list-editing.ts +174 -16
- package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +497 -62
- package/corpus/templates/slides/app/components/editor/slide-text-targets.ts +102 -20
- package/corpus/templates/slides/app/context/DeckContext.tsx +9 -4
- package/corpus/templates/slides/app/global.css +7 -219
- package/corpus/templates/slides/app/i18n/en-US.ts +3 -0
- package/corpus/templates/slides/app/lib/sanitize-slide-html.ts +7 -0
- package/corpus/templates/slides/app/lib/slide-image-replacement.ts +203 -1
- package/corpus/templates/slides/app/lib/slide-source-map.ts +43 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +182 -4
- package/corpus/templates/slides/app/routes/settings.tsx +33 -2
- package/corpus/templates/slides/changelog/2026-09-25-improve-slides-design-system-setup-feedback.md +6 -0
- package/corpus/templates/slides/changelog/2026-09-25-org-admins-can-review-agent-runs-from-settings.md +6 -0
- package/corpus/templates/slides/changelog/2026-09-25-text-on-a-slide-is-now-edited-in-place-clicking-into-it-chan.md +6 -0
- package/corpus/templates/slides/package.json +0 -12
- package/corpus/templates/slides/scripts/edit-fidelity/README.md +4 -2
- package/corpus/templates/slides/scripts/edit-fidelity/run.ts +12 -3
- package/corpus/templates/slides/vite.config.ts +1 -10
- package/dist/agent/jev-tool-prefetch.d.ts +29 -3
- package/dist/agent/jev-tool-prefetch.js +161 -34
- package/dist/agent/production-agent.d.ts +11 -0
- package/dist/agent/production-agent.js +39 -8
- package/dist/app-config/runtime.d.ts +1 -0
- package/dist/app-config/runtime.js +4 -0
- package/dist/app-config/schema.d.ts +1 -0
- package/dist/client/AgentSidebar.d.ts +3 -1
- package/dist/client/AgentSidebar.js +8 -12
- package/dist/client/analytics/index.d.ts +1 -1
- package/dist/client/analytics/index.js +1 -1
- package/dist/client/analytics.d.ts +2 -0
- package/dist/client/analytics.js +9 -0
- package/dist/client/api-path.js +5 -2
- package/dist/client/chat/run-recovery.d.ts +0 -3
- package/dist/client/chat/run-recovery.js +13 -23
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/observability/ObservabilityDashboard.d.ts +3 -0
- package/dist/client/observability/ObservabilityDashboard.js +366 -71
- package/dist/client/observability/ObservabilityReviewSummaryButton.d.ts +4 -1
- package/dist/client/observability/ObservabilityReviewSummaryButton.js +13 -9
- package/dist/client/observability/OutputPreview.d.ts +9 -4
- package/dist/client/observability/OutputPreview.js +230 -52
- package/dist/client/onboarding/FirstRunOnboarding.js +67 -4
- package/dist/client/onboarding/use-onboarding.js +2 -0
- package/dist/client/sharing/ShareButton.d.ts +2 -0
- package/dist/client/sharing/ShareButton.js +1 -0
- package/dist/client/sharing/useShareButtonController.d.ts +1 -0
- package/dist/client/sharing/useShareButtonController.js +29 -8
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.js +9 -1
- package/dist/embeddings/index.d.ts +3 -1
- package/dist/embeddings/index.js +20 -10
- package/dist/jobs/sweep-hooks.d.ts +7 -0
- package/dist/jobs/sweep-hooks.js +28 -0
- package/dist/localization/default-messages.d.ts +1 -0
- package/dist/localization/default-messages.js +1 -0
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/actions/authorization.d.ts +1 -0
- package/dist/observability/actions/authorization.js +22 -0
- package/dist/observability/actions/get-observability-review-detail.d.ts +5 -0
- package/dist/observability/actions/get-observability-review-detail.js +10 -2
- package/dist/observability/actions/get-observability-review-summary-source.d.ts +2 -0
- package/dist/observability/actions/get-observability-review-summary-source.js +3 -2
- package/dist/observability/actions/save-observability-instruction-update.js +2 -1
- package/dist/observability/actions/save-observability-review-summary.js +21 -10
- package/dist/observability/migrations.js +25 -0
- package/dist/observability/reviews.d.ts +3 -1
- package/dist/observability/reviews.js +410 -53
- package/dist/observability/routes.d.ts +6 -6
- package/dist/observability/store.d.ts +15 -0
- package/dist/observability/store.js +131 -11
- package/dist/observability/types.d.ts +18 -0
- package/dist/org/handlers.d.ts +1 -1
- package/dist/org/index.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-chat/plugin-options.d.ts +4 -20
- package/dist/server/agent-chat/prompt-resources.d.ts +16 -0
- package/dist/server/agent-chat/prompt-resources.js +385 -22
- package/dist/server/agent-chat-plugin.d.ts +3 -1
- package/dist/server/agent-chat-plugin.js +149 -27
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -0
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core.js +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/request-context.d.ts +6 -3
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/settings/org-settings.d.ts +4 -2
- package/dist/settings/org-settings.js +3 -3
- package/dist/settings/store.d.ts +3 -1
- package/dist/settings/store.js +8 -3
- package/dist/styles/agent-native.css +5 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +1 -0
- package/dist/templates/default/app/i18n/de-DE.ts +1 -0
- package/dist/templates/default/app/i18n/en-US.ts +1 -0
- package/dist/templates/default/app/i18n/es-ES.ts +1 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +1 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +1 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +1 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +1 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +1 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +1 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +1 -0
- package/dist/tracking/registry.js +11 -4
- package/package.json +4 -3
- package/src/templates/default/app/i18n/ar-SA.ts +1 -0
- package/src/templates/default/app/i18n/de-DE.ts +1 -0
- package/src/templates/default/app/i18n/en-US.ts +1 -0
- package/src/templates/default/app/i18n/es-ES.ts +1 -0
- package/src/templates/default/app/i18n/fr-FR.ts +1 -0
- package/src/templates/default/app/i18n/hi-IN.ts +1 -0
- package/src/templates/default/app/i18n/ja-JP.ts +1 -0
- package/src/templates/default/app/i18n/ko-KR.ts +1 -0
- package/src/templates/default/app/i18n/pt-BR.ts +1 -0
- package/src/templates/default/app/i18n/zh-CN.ts +1 -0
- package/src/templates/default/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/slides/app/components/editor/SlideBubbleMenu.tsx +0 -488
- package/corpus/templates/slides/app/components/editor/SlideInlineEditor.tsx +0 -589
- package/corpus/templates/slides/app/components/editor/SlideRichTextEditor.tsx +0 -1347
- package/corpus/templates/slides/app/components/editor/SlideSlashMenu.tsx +0 -373
|
@@ -160,6 +160,7 @@ export const FIRST_PARTY_TEMPLATE_SCOPED_METRIC_KEYS = [
|
|
|
160
160
|
"activation-funnel",
|
|
161
161
|
"signup-method-conversion",
|
|
162
162
|
"onboarding-step-dropoff",
|
|
163
|
+
"onboarding-setup-choice",
|
|
163
164
|
"sharing-actions-by-app",
|
|
164
165
|
] as const;
|
|
165
166
|
const FIRST_PARTY_TEMPLATE_SQL_LIST = FIRST_PARTY_TEMPLATE_NAMES.map(
|
|
@@ -730,6 +731,50 @@ const FUNNEL_EVENTS_CTE = `WITH signup_identity AS (
|
|
|
730
731
|
FROM funnel_events e
|
|
731
732
|
JOIN signup_cohort c ON c.funnel_user_key = e.funnel_user_key
|
|
732
733
|
)`;
|
|
734
|
+
const ONBOARDING_EVENTS_CTE = `WITH auth_identity_bridge AS (
|
|
735
|
+
SELECT linked_email, MIN(auth_user_id) AS auth_user_id
|
|
736
|
+
FROM (
|
|
737
|
+
SELECT lower(COALESCE(
|
|
738
|
+
CASE WHEN NULLIF(e.user_key, '') LIKE '%@%.%' THEN e.user_key END,
|
|
739
|
+
CASE WHEN NULLIF(e.user_id, '') LIKE '%@%.%' THEN e.user_id END
|
|
740
|
+
)) AS linked_email,
|
|
741
|
+
NULLIF(e.properties::jsonb ->> 'auth_user_id', '') AS auth_user_id
|
|
742
|
+
FROM analytics_events e
|
|
743
|
+
WHERE ${DASHBOARD_TIME_RANGE_FILTER}
|
|
744
|
+
AND ${DASHBOARD_APP_FILTER}
|
|
745
|
+
AND ${FIRST_PARTY_TEMPLATE_FILTER}
|
|
746
|
+
) AS identities
|
|
747
|
+
WHERE linked_email IS NOT NULL
|
|
748
|
+
AND auth_user_id IS NOT NULL
|
|
749
|
+
GROUP BY linked_email
|
|
750
|
+
HAVING COUNT(DISTINCT auth_user_id) = 1
|
|
751
|
+
), scoped_onboarding_events AS (
|
|
752
|
+
SELECT e.*,
|
|
753
|
+
COALESCE(
|
|
754
|
+
NULLIF(e.properties::jsonb ->> 'auth_user_id', ''),
|
|
755
|
+
auth_identity_bridge.auth_user_id,
|
|
756
|
+
NULLIF(e.user_key, ''),
|
|
757
|
+
NULLIF(e.user_id, ''),
|
|
758
|
+
NULLIF(e.anonymous_id, '')
|
|
759
|
+
) AS funnel_user_key,
|
|
760
|
+
COALESCE(
|
|
761
|
+
CASE WHEN NULLIF(e.user_id, '') LIKE '%@%.%' THEN e.user_id END,
|
|
762
|
+
CASE WHEN NULLIF(e.user_key, '') LIKE '%@%.%' THEN e.user_key END,
|
|
763
|
+
CASE WHEN NULLIF(e.properties::jsonb ->> 'auth_user_id', '') LIKE '%@%.%' THEN e.properties::jsonb ->> 'auth_user_id' END
|
|
764
|
+
) AS funnel_user_email
|
|
765
|
+
FROM analytics_events e
|
|
766
|
+
LEFT JOIN auth_identity_bridge ON auth_identity_bridge.linked_email = lower(COALESCE(
|
|
767
|
+
CASE WHEN NULLIF(e.user_key, '') LIKE '%@%.%' THEN e.user_key END,
|
|
768
|
+
CASE WHEN NULLIF(e.user_id, '') LIKE '%@%.%' THEN e.user_id END
|
|
769
|
+
))
|
|
770
|
+
WHERE ${DASHBOARD_TIME_RANGE_FILTER}
|
|
771
|
+
AND ${DASHBOARD_APP_FILTER}
|
|
772
|
+
AND ${FIRST_PARTY_TEMPLATE_FILTER}
|
|
773
|
+
), onboarding_events AS (
|
|
774
|
+
SELECT * FROM scoped_onboarding_events
|
|
775
|
+
WHERE ${FUNNEL_EMAIL_FILTER}
|
|
776
|
+
AND lower(coalesce(funnel_user_email, '')) NOT LIKE '%+autoz%'
|
|
777
|
+
)`;
|
|
733
778
|
const SIGNIFICANT_ACTION_FILTER = `((event_name IN ('action_completed', 'core_action_completed') AND COALESCE(properties::jsonb ->> 'success', 'true') = 'true') OR event_name = 'app.first_action' OR (event_name = 'action.response' AND COALESCE(properties::jsonb ->> 'success', '') = 'true' AND COALESCE(upper(properties::jsonb ->> 'method'), '') <> 'GET'))`;
|
|
734
779
|
/**
|
|
735
780
|
* `action.response` fast-success rows are sampled at 10% client-side
|
|
@@ -861,7 +906,148 @@ const ACTIVATION_FUNNEL_SQL = `${FUNNEL_EVENTS_CTE}, funnel_users AS (
|
|
|
861
906
|
) action ON true
|
|
862
907
|
) SELECT 1 AS stage_order, 'Signup page viewed' AS stage, COUNT(*) FILTER (WHERE page_at IS NOT NULL) AS users FROM action_stage UNION ALL SELECT 2, 'Signup CTA clicked', COUNT(*) FILTER (WHERE cta_at IS NOT NULL) FROM action_stage UNION ALL SELECT 3, 'Signed up', COUNT(*) FILTER (WHERE signed_up_at IS NOT NULL) FROM action_stage UNION ALL SELECT 4, 'Onboarding started', COUNT(*) FILTER (WHERE started_at IS NOT NULL) FROM action_stage UNION ALL SELECT 5, 'Onboarding step reached', COUNT(*) FILTER (WHERE step_at IS NOT NULL) FROM action_stage UNION ALL SELECT 6, 'Onboarding completed', COUNT(*) FILTER (WHERE completed_at IS NOT NULL) FROM action_stage UNION ALL SELECT 7, 'Entered app', COUNT(*) FILTER (WHERE entered_at IS NOT NULL) FROM action_stage UNION ALL SELECT 8, 'First significant action', COUNT(*) FILTER (WHERE action_at IS NOT NULL) FROM action_stage ORDER BY stage_order`;
|
|
863
908
|
const SIGNUP_METHOD_CONVERSION_SQL = `${FUNNEL_EVENTS_CTE}, clicks AS (SELECT COALESCE(NULLIF(properties::jsonb ->> 'method', ''), 'unknown') AS method, COUNT(DISTINCT funnel_user_key) AS clicks FROM funnel_events WHERE event_name = 'auth.signup_clicked' AND ${FUNNEL_SCOPE_FILTER} GROUP BY 1), signups AS (SELECT COALESCE(NULLIF(properties::jsonb ->> 'signup_method', ''), CASE WHEN lower(properties::jsonb ->> 'auth_provider') = 'google' THEN 'google' ELSE 'unknown' END) AS method, COUNT(DISTINCT funnel_user_key) AS signups FROM funnel_events WHERE event_name = 'signup' AND ${FUNNEL_SCOPE_FILTER} GROUP BY 1), methods AS (SELECT method FROM clicks UNION SELECT method FROM signups) SELECT methods.method, COALESCE(clicks.clicks, 0) AS clicks, COALESCE(signups.signups, 0) AS signups, COALESCE(signups.signups::float / NULLIF(clicks.clicks, 0), 0) AS conversion_rate FROM methods LEFT JOIN clicks ON clicks.method = methods.method LEFT JOIN signups ON signups.method = methods.method ORDER BY clicks DESC NULLS LAST, methods.method`;
|
|
864
|
-
const ONBOARDING_STEP_DROPOFF_SQL = `${
|
|
909
|
+
const ONBOARDING_STEP_DROPOFF_SQL = `${ONBOARDING_EVENTS_CTE}, viewers AS (
|
|
910
|
+
SELECT DISTINCT funnel_user_key,
|
|
911
|
+
COALESCE(NULLIF(properties::jsonb ->> 'flow', ''), 'unknown') AS flow,
|
|
912
|
+
COALESCE(NULLIF(properties::jsonb ->> 'step_id', ''), 'unknown') AS step_id,
|
|
913
|
+
COALESCE(NULLIF(properties::jsonb ->> 'step_index', ''), '999') AS step_index
|
|
914
|
+
FROM onboarding_events
|
|
915
|
+
WHERE event_name = 'onboarding_step_viewed'
|
|
916
|
+
AND funnel_user_key IS NOT NULL
|
|
917
|
+
), views AS (
|
|
918
|
+
SELECT flow, step_id, step_index, COUNT(DISTINCT funnel_user_key) AS users_reached
|
|
919
|
+
FROM viewers
|
|
920
|
+
GROUP BY flow, step_id, step_index
|
|
921
|
+
), user_outcomes AS (
|
|
922
|
+
SELECT viewers.funnel_user_key, viewers.flow, viewers.step_id, viewers.step_index,
|
|
923
|
+
MAX(CASE WHEN events.event_name = 'onboarding_step_completed' THEN 1 ELSE 0 END) AS completed,
|
|
924
|
+
MAX(CASE WHEN events.event_name = 'onboarding_step_skipped' THEN 1 ELSE 0 END) AS skipped
|
|
925
|
+
FROM viewers
|
|
926
|
+
LEFT JOIN onboarding_events AS events
|
|
927
|
+
ON events.funnel_user_key = viewers.funnel_user_key
|
|
928
|
+
AND events.event_name IN ('onboarding_step_completed', 'onboarding_step_skipped')
|
|
929
|
+
AND COALESCE(NULLIF(events.properties::jsonb ->> 'flow', ''), 'unknown') = viewers.flow
|
|
930
|
+
AND COALESCE(NULLIF(events.properties::jsonb ->> 'step_id', ''), 'unknown') = viewers.step_id
|
|
931
|
+
GROUP BY viewers.funnel_user_key, viewers.flow, viewers.step_id, viewers.step_index
|
|
932
|
+
), outcomes AS (
|
|
933
|
+
SELECT flow, step_id, step_index,
|
|
934
|
+
SUM(completed) AS users_completed,
|
|
935
|
+
SUM(skipped) AS users_skipped,
|
|
936
|
+
SUM(CASE WHEN completed = 1 OR skipped = 1 THEN 1 ELSE 0 END) AS users_with_outcome
|
|
937
|
+
FROM user_outcomes
|
|
938
|
+
GROUP BY flow, step_id, step_index
|
|
939
|
+
)
|
|
940
|
+
SELECT views.flow, views.step_id, views.step_index, views.users_reached,
|
|
941
|
+
COALESCE(outcomes.users_completed, 0) AS users_completed,
|
|
942
|
+
COALESCE(outcomes.users_skipped, 0) AS users_skipped,
|
|
943
|
+
views.users_reached - COALESCE(outcomes.users_with_outcome, 0) AS users_no_recorded_outcome,
|
|
944
|
+
COALESCE(outcomes.users_completed::float / NULLIF(views.users_reached, 0), 0) AS completion_rate
|
|
945
|
+
FROM views
|
|
946
|
+
LEFT JOIN outcomes ON outcomes.flow = views.flow AND outcomes.step_id = views.step_id AND outcomes.step_index = views.step_index
|
|
947
|
+
ORDER BY views.step_index, views.flow, views.step_id`;
|
|
948
|
+
const ONBOARDING_SETUP_CHOICE_SQL = `${ONBOARDING_EVENTS_CTE}, choice_viewers AS (
|
|
949
|
+
SELECT DISTINCT funnel_user_key
|
|
950
|
+
FROM onboarding_events
|
|
951
|
+
WHERE event_name = 'onboarding_step_viewed'
|
|
952
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'flow', ''), '') = 'first_run'
|
|
953
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'step_id', ''), '') = 'choice'
|
|
954
|
+
AND funnel_user_key IS NOT NULL
|
|
955
|
+
), choices AS (
|
|
956
|
+
SELECT funnel_user_key,
|
|
957
|
+
COALESCE(NULLIF(properties::jsonb ->> 'method_id', ''), 'unknown') AS method_id,
|
|
958
|
+
NULLIF(properties::jsonb ->> 'onboarding_attempt_id', '') AS attempt_id,
|
|
959
|
+
timestamp::timestamptz AS clicked_at,
|
|
960
|
+
id
|
|
961
|
+
FROM onboarding_events
|
|
962
|
+
WHERE event_name = 'onboarding_method_clicked'
|
|
963
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'flow', ''), '') = 'first_run'
|
|
964
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'step_id', ''), '') = 'choice'
|
|
965
|
+
AND funnel_user_key IS NOT NULL
|
|
966
|
+
), ranked_choices AS (
|
|
967
|
+
SELECT choices.*,
|
|
968
|
+
ROW_NUMBER() OVER (PARTITION BY funnel_user_key ORDER BY clicked_at, id) AS choice_number
|
|
969
|
+
FROM choices
|
|
970
|
+
JOIN choice_viewers USING (funnel_user_key)
|
|
971
|
+
), first_choice_summary AS (
|
|
972
|
+
SELECT method_id, COUNT(DISTINCT funnel_user_key) AS first_choice_users
|
|
973
|
+
FROM ranked_choices
|
|
974
|
+
WHERE choice_number = 1
|
|
975
|
+
GROUP BY method_id
|
|
976
|
+
), selection_summary AS (
|
|
977
|
+
SELECT method_id,
|
|
978
|
+
COUNT(DISTINCT funnel_user_key) AS selected_users,
|
|
979
|
+
COUNT(*) AS method_clicks,
|
|
980
|
+
COUNT(DISTINCT attempt_id) AS selection_attempts
|
|
981
|
+
FROM choices
|
|
982
|
+
GROUP BY method_id
|
|
983
|
+
), starts AS (
|
|
984
|
+
SELECT funnel_user_key,
|
|
985
|
+
COALESCE(NULLIF(properties::jsonb ->> 'method_id', ''), 'unknown') AS method_id,
|
|
986
|
+
NULLIF(properties::jsonb ->> 'onboarding_attempt_id', '') AS attempt_id
|
|
987
|
+
FROM onboarding_events
|
|
988
|
+
WHERE event_name = 'onboarding_method_started'
|
|
989
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'flow', ''), '') = 'first_run'
|
|
990
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'step_id', ''), '') = 'choice'
|
|
991
|
+
AND funnel_user_key IS NOT NULL
|
|
992
|
+
), method_outcomes AS (
|
|
993
|
+
SELECT funnel_user_key,
|
|
994
|
+
COALESCE(NULLIF(properties::jsonb ->> 'method_id', ''), 'unknown') AS method_id,
|
|
995
|
+
NULLIF(properties::jsonb ->> 'onboarding_attempt_id', '') AS attempt_id,
|
|
996
|
+
COALESCE(NULLIF(properties::jsonb ->> 'outcome', ''), 'unknown') AS outcome
|
|
997
|
+
FROM onboarding_events
|
|
998
|
+
WHERE event_name = 'onboarding_method_outcome'
|
|
999
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'flow', ''), '') = 'first_run'
|
|
1000
|
+
AND COALESCE(NULLIF(properties::jsonb ->> 'step_id', ''), '') = 'choice'
|
|
1001
|
+
AND funnel_user_key IS NOT NULL
|
|
1002
|
+
), attempts AS (
|
|
1003
|
+
SELECT starts.funnel_user_key, starts.method_id, starts.attempt_id,
|
|
1004
|
+
MAX(CASE WHEN method_outcomes.outcome IN ('connected', 'already_connected') THEN 1 ELSE 0 END) AS connected,
|
|
1005
|
+
MAX(CASE WHEN method_outcomes.outcome = 'failed' THEN 1 ELSE 0 END) AS failed,
|
|
1006
|
+
MAX(CASE WHEN method_outcomes.outcome = 'handoff_failed' THEN 1 ELSE 0 END) AS handoff_failed,
|
|
1007
|
+
MAX(CASE WHEN method_outcomes.outcome = 'settings_opened' THEN 1 ELSE 0 END) AS settings_opened,
|
|
1008
|
+
MAX(CASE WHEN method_outcomes.outcome IS NOT NULL THEN 1 ELSE 0 END) AS has_outcome
|
|
1009
|
+
FROM starts
|
|
1010
|
+
LEFT JOIN method_outcomes
|
|
1011
|
+
ON method_outcomes.funnel_user_key = starts.funnel_user_key
|
|
1012
|
+
AND method_outcomes.method_id = starts.method_id
|
|
1013
|
+
AND method_outcomes.attempt_id = starts.attempt_id
|
|
1014
|
+
GROUP BY starts.funnel_user_key, starts.method_id, starts.attempt_id
|
|
1015
|
+
), attempt_summary AS (
|
|
1016
|
+
SELECT method_id,
|
|
1017
|
+
COUNT(DISTINCT CASE WHEN connected = 1 THEN attempt_id END) AS connection_success_attempts,
|
|
1018
|
+
COUNT(DISTINCT CASE WHEN failed = 1 THEN attempt_id END) AS connection_failure_attempts,
|
|
1019
|
+
COUNT(DISTINCT CASE WHEN handoff_failed = 1 THEN attempt_id END) AS handoff_failure_attempts,
|
|
1020
|
+
COUNT(DISTINCT CASE WHEN connected = 1 THEN funnel_user_key END) AS connection_success_users,
|
|
1021
|
+
COUNT(DISTINCT CASE WHEN failed = 1 THEN funnel_user_key END) AS connection_failure_users,
|
|
1022
|
+
COUNT(DISTINCT CASE WHEN connected = 0 AND failed = 0 AND has_outcome = 0 THEN attempt_id END) AS connection_no_outcome_attempts,
|
|
1023
|
+
COUNT(DISTINCT CASE WHEN settings_opened = 1 THEN attempt_id END) AS settings_handoff_attempts
|
|
1024
|
+
FROM attempts
|
|
1025
|
+
GROUP BY method_id
|
|
1026
|
+
), method_list AS (
|
|
1027
|
+
SELECT 'builder_create_account' AS method_id, 'Create Builder.io account' AS method_label
|
|
1028
|
+
UNION ALL SELECT 'builder_sign_in', 'Sign in with Builder.io account'
|
|
1029
|
+
UNION ALL SELECT 'custom_keys', 'Configure custom keys'
|
|
1030
|
+
)
|
|
1031
|
+
SELECT method_list.method_id, method_list.method_label,
|
|
1032
|
+
(SELECT COUNT(DISTINCT funnel_user_key) FROM choice_viewers) AS choice_screen_viewers,
|
|
1033
|
+
COALESCE(first_choice_summary.first_choice_users, 0) AS first_choice_users,
|
|
1034
|
+
COALESCE(first_choice_summary.first_choice_users::float / NULLIF((SELECT COUNT(DISTINCT funnel_user_key) FROM choice_viewers), 0), 0) AS first_choice_rate,
|
|
1035
|
+
COALESCE(selection_summary.selected_users, 0) AS selected_users,
|
|
1036
|
+
COALESCE(selection_summary.method_clicks, 0) AS method_clicks,
|
|
1037
|
+
COALESCE(selection_summary.selection_attempts, 0) AS selection_attempts,
|
|
1038
|
+
COALESCE(attempt_summary.connection_success_attempts, 0) AS connection_success_attempts,
|
|
1039
|
+
COALESCE(attempt_summary.connection_failure_attempts, 0) AS connection_failure_attempts,
|
|
1040
|
+
COALESCE(attempt_summary.handoff_failure_attempts, 0) AS handoff_failure_attempts,
|
|
1041
|
+
COALESCE(attempt_summary.connection_success_users, 0) AS connection_success_users,
|
|
1042
|
+
COALESCE(attempt_summary.connection_failure_users, 0) AS connection_failure_users,
|
|
1043
|
+
COALESCE(attempt_summary.connection_no_outcome_attempts, 0) AS connection_no_outcome_attempts,
|
|
1044
|
+
COALESCE(attempt_summary.settings_handoff_attempts, 0) AS settings_handoff_attempts,
|
|
1045
|
+
attempt_summary.connection_success_attempts::float / NULLIF(attempt_summary.connection_success_attempts + attempt_summary.connection_failure_attempts, 0) AS connection_success_rate
|
|
1046
|
+
FROM method_list
|
|
1047
|
+
LEFT JOIN first_choice_summary ON first_choice_summary.method_id = method_list.method_id
|
|
1048
|
+
LEFT JOIN selection_summary ON selection_summary.method_id = method_list.method_id
|
|
1049
|
+
LEFT JOIN attempt_summary ON attempt_summary.method_id = method_list.method_id
|
|
1050
|
+
ORDER BY method_list.method_id`;
|
|
865
1051
|
const SHARING_ACTIONS_BY_APP_SQL = `${FUNNEL_EVENTS_CTE} SELECT ${TEMPLATE_EXPR} AS app, event_name AS action, COUNT(*) AS events, COUNT(DISTINCT funnel_user_key) AS users FROM funnel_events WHERE event_name IN ('share_view', 'share_cta_click', 'share_invite_sent', 'share_visibility_change', 'share_link_copied') AND ${FUNNEL_SCOPE_FILTER} AND ${FIRST_PARTY_TEMPLATE_FILTER} GROUP BY 1, 2 ORDER BY app, events DESC`;
|
|
866
1052
|
|
|
867
1053
|
// --- Action reliability & latency (canonical action.response metric) -----
|
|
@@ -1793,16 +1979,96 @@ const ENTRIES: FirstPartyMetric[] = [
|
|
|
1793
1979
|
config: {
|
|
1794
1980
|
xKey: "step_id",
|
|
1795
1981
|
description:
|
|
1796
|
-
"Distinct
|
|
1982
|
+
"Distinct people who viewed, completed, skipped, or had no recorded outcome for each first-run or checklist step. Completion and skip counts can overlap if a person retries; no outcome means neither event was recorded. This is per-step reach, not a sequential funnel. +autoz identities are excluded.",
|
|
1797
1983
|
columns: [
|
|
1798
1984
|
{ key: "step_index", label: "Order" },
|
|
1985
|
+
{ key: "flow", label: "Flow" },
|
|
1799
1986
|
{ key: "step_id", label: "Step" },
|
|
1800
1987
|
{ key: "users_reached", label: "Reached", format: "number" },
|
|
1801
1988
|
{ key: "users_completed", label: "Completed", format: "number" },
|
|
1989
|
+
{ key: "users_skipped", label: "Skipped", format: "number" },
|
|
1990
|
+
{
|
|
1991
|
+
key: "users_no_recorded_outcome",
|
|
1992
|
+
label: "No outcome",
|
|
1993
|
+
format: "number",
|
|
1994
|
+
},
|
|
1802
1995
|
{ key: "completion_rate", label: "Completion", format: "percent" },
|
|
1803
1996
|
],
|
|
1804
1997
|
},
|
|
1805
1998
|
},
|
|
1999
|
+
{
|
|
2000
|
+
key: "onboarding-setup-choice",
|
|
2001
|
+
title: "First-run Setup Choices",
|
|
2002
|
+
chartType: "table",
|
|
2003
|
+
source: "first-party",
|
|
2004
|
+
width: 3,
|
|
2005
|
+
windowed: false,
|
|
2006
|
+
buildSql: fixed(ONBOARDING_SETUP_CHOICE_SQL),
|
|
2007
|
+
config: {
|
|
2008
|
+
description:
|
|
2009
|
+
"Choice-screen viewers, first selected setup path, repeat selections, and linked Builder connection outcomes. Rates use choice-screen viewers or resolved Builder outcomes as their denominator; started attempts with no outcome are unknown or abandoned, not assumed failures. Handoff failures are reported separately from Builder connection failures. A successful Builder outcome confirms credentials connected, not that a new external account was created. Account-exists is counted as a failed create-account attempt. +autoz identities are excluded.",
|
|
2010
|
+
columns: [
|
|
2011
|
+
{ key: "method_label", label: "Setup choice" },
|
|
2012
|
+
{
|
|
2013
|
+
key: "choice_screen_viewers",
|
|
2014
|
+
label: "Choice viewers",
|
|
2015
|
+
format: "number",
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
key: "first_choice_users",
|
|
2019
|
+
label: "First choice users",
|
|
2020
|
+
format: "number",
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
key: "first_choice_rate",
|
|
2024
|
+
label: "First choice rate",
|
|
2025
|
+
format: "percent",
|
|
2026
|
+
},
|
|
2027
|
+
{ key: "selected_users", label: "Ever selected", format: "number" },
|
|
2028
|
+
{ key: "method_clicks", label: "Selections", format: "number" },
|
|
2029
|
+
{
|
|
2030
|
+
key: "connection_success_users",
|
|
2031
|
+
label: "Connected users",
|
|
2032
|
+
format: "number",
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
key: "connection_failure_users",
|
|
2036
|
+
label: "Failed users",
|
|
2037
|
+
format: "number",
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
key: "connection_success_attempts",
|
|
2041
|
+
label: "Connected attempts",
|
|
2042
|
+
format: "number",
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
key: "connection_failure_attempts",
|
|
2046
|
+
label: "Failed attempts",
|
|
2047
|
+
format: "number",
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
key: "handoff_failure_attempts",
|
|
2051
|
+
label: "Handoff failures",
|
|
2052
|
+
format: "number",
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
key: "connection_no_outcome_attempts",
|
|
2056
|
+
label: "No outcome",
|
|
2057
|
+
format: "number",
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
key: "connection_success_rate",
|
|
2061
|
+
label: "Resolved success rate",
|
|
2062
|
+
format: "percent",
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
key: "settings_handoff_attempts",
|
|
2066
|
+
label: "Settings handoffs",
|
|
2067
|
+
format: "number",
|
|
2068
|
+
},
|
|
2069
|
+
],
|
|
2070
|
+
},
|
|
2071
|
+
},
|
|
1806
2072
|
{
|
|
1807
2073
|
key: "sharing-actions-by-app",
|
|
1808
2074
|
title: "Sharing Actions by App",
|
|
@@ -7,11 +7,16 @@ import {
|
|
|
7
7
|
} from "@agent-native/core/server";
|
|
8
8
|
import {
|
|
9
9
|
getRequestOrgId,
|
|
10
|
+
getRequestRunContext,
|
|
10
11
|
getRequestUserEmail,
|
|
11
12
|
} from "@agent-native/core/server";
|
|
12
13
|
|
|
13
14
|
import actionsRegistry from "../../.generated/actions-registry.js";
|
|
14
15
|
import { INITIAL_TOOL_NAMES } from "../lib/agent-chat-plan-mode";
|
|
16
|
+
import {
|
|
17
|
+
retrieveAnalyticsPromptReferences,
|
|
18
|
+
summarizeAnalyticsRun,
|
|
19
|
+
} from "../lib/analytics-agent-context";
|
|
15
20
|
import { ANALYTICS_CONNECTOR_CATALOG } from "../lib/analytics-connector-catalog";
|
|
16
21
|
import { credentialProviderConfigs } from "../lib/credential-keys";
|
|
17
22
|
import { isProductionServerlessRuntime } from "../lib/production-serverless-runtime.js";
|
|
@@ -43,7 +48,8 @@ import {
|
|
|
43
48
|
// Which actions return real data-source evidence is a fact each action states
|
|
44
49
|
// on itself (`grounding: true`). Reading it off the definitions here is what
|
|
45
50
|
// keeps the response guard from drifting behind a newly shipped source action.
|
|
46
|
-
|
|
51
|
+
const GROUNDING_ACTION_NAMES = deriveGroundingActionNames(actionsRegistry);
|
|
52
|
+
registerGroundingActions(GROUNDING_ACTION_NAMES);
|
|
47
53
|
|
|
48
54
|
const ANALYTICS_BACKGROUND_RUN_SOFT_TIMEOUT_MS = 13 * 60_000;
|
|
49
55
|
// A background job may legitimately spend minutes inside a provider/tool call,
|
|
@@ -266,10 +272,10 @@ function hasPartialDashboardBuild(
|
|
|
266
272
|
|
|
267
273
|
export const BOUNDED_STRUCTURED_LOOKUP_GUIDANCE =
|
|
268
274
|
"TRUST SIGNALS: Prefer a current `dashboardCertified: true` saved panel; a `favorite: true` panel is a weaker relevance signal. " +
|
|
269
|
-
|
|
275
|
+
'BOUNDED STRUCTURED LOOKUP FAST PATH — Treat existing analytics work like an engineer treats existing code: use the retrieved `<resource scope="analytics-catalog">` references when they fit the request. These bounded dictionary entries and dashboard panels provide definitions and query examples, never live results. For an ordinary count, aggregate, grouped metric, trend, or record lookup, preserve the strongest approved definition or saved query\'s source and business logic, adapt only the requested filters and explicit time window, then run one bounded query. If no preloaded reference fits, call `search-analytics-query-catalog` once with focused metric/entity terms; it searches accessible dashboards, saved queries, shipped patterns, and dictionary definitions. A user-named source wins, while a matching saved definition can still supply a proven query shape. If there is no useful match, inspect the likely source schema before asking about business meaning; do not ask the user for internal dataset, table, column, or SQL identifiers. Do not fan out across providers or load broad catalogs after a strong match. Once the query succeeds, answer with its source, time window, filters, row count, and only necessary caveats. Do not add unasked checks or breakdowns. The words `all`, `total`, or `exact` do not by themselves make it a corpus investigation. Never repeat an identical invalid or failed tool call, and never answer from a guess or unverified result. ';
|
|
270
276
|
|
|
271
277
|
export const INTERNAL_PRODUCT_USAGE_GUIDANCE =
|
|
272
|
-
"INTERNAL PRODUCT USAGE / CROSS-SOURCE ROUTING — Requests for product usage, AI credits, credit consumption, allowances, quotas, branch creation, branch creators, or user-level adoption by month are live data requests even when they say pull, export, or prepare a report. For workspace-wide internal Builder.io usage, route to Dispatch with `call-agent` and `list-dispatch-usage-metrics`; use its `monthlyByUser` and `workspaceAppCreationsByUserMonth` result. Do not ask for a user export or BigQuery schema on that path. For a named customer or account such as OCBC, preserve the customer scope and do not substitute workspace metrics.
|
|
278
|
+
"INTERNAL PRODUCT USAGE / CROSS-SOURCE ROUTING — Requests for product usage, AI credits, credit consumption, allowances, quotas, branch creation, branch creators, or user-level adoption by month are live data requests even when they say pull, export, or prepare a report. For workspace-wide internal Builder.io usage, route to Dispatch with `call-agent` and `list-dispatch-usage-metrics`; use its `monthlyByUser` and `workspaceAppCreationsByUserMonth` result. Do not ask for a user export or BigQuery schema on that path. For a named customer or account such as OCBC, preserve the customer scope and do not substitute workspace metrics. Use a relevant preloaded Analytics reference when available; if none fits, call `search-analytics-query-catalog`, then `list-data-dictionary` and `search-bigquery-schema` only when the catalog has no usable definition. `search-bigquery-schema` can search the configured project without a dataset, so do not ask the user for identifiers. Use the exact discovered schema in one bounded query, and resolve the named account identity before attributing rows to it. Limits, plans, or changelog metadata do not prove actual consumption or creator identity. Report the exact evidence gap if the source is unavailable. ";
|
|
273
279
|
|
|
274
280
|
export const ANALYTICS_ACCOUNT_HEALTH_GUIDANCE =
|
|
275
281
|
"ACCOUNT HEALTH / CUSTOMER SCOPE GUARD — Use this for a named customer, organization ID, account-health, QBR, renewal, contract-usage, risk, or adoption request. Treat a prompt-supplied org ID as a lookup key, not proof of row ownership: resolve it against canonical account data first, carry the resolved customer name plus organization/root-organization identifiers through every usage query, and stop if results contain a different customer, mixed IDs, or an unresolved identity. Use the account-health skill. Account health is incomplete until verified usage queries cover each requested product or feature dimension separately. Before warehouse SQL, use the catalog/dictionary and schema metadata. Do not run definitions marked deprecated or retired, or use a source whose freshness cannot be verified; use the current approved definition instead. Do not call a current partial-period snapshot a completed period without proving the period/as-of row and freshness. Distinguish contract metrics from similarly named platform metrics, total distinct contracted users from DAU/WAU, and actual usage from contracted capacity. Always surface utilization at or above 100%, report adoption window and coverage, and state gaps instead of inferring them. ";
|
|
@@ -320,7 +326,7 @@ export function analyticsSourceGuidanceOpening(): string {
|
|
|
320
326
|
// equivalent instruction sat ~7000 words deep. Threads that did call it used
|
|
321
327
|
// roughly a third the tool calls. Keep it first and keep it imperative.
|
|
322
328
|
"INTERNAL USAGE OVERRIDE — For workspace-wide Builder.io or AI credit spend, LLM usage by workspace member or month, or workspace app/Builder branch creation history, your FIRST tool call is `call-agent` for Dispatch with action `list-dispatch-usage-metrics`, scope `workspace`, and the requested `sinceDays`. Do not start with a user list, `search-bigquery-schema`, or a request for dataset/table/column names. If the request names a customer or account such as OCBC, preserve that customer scope and use the Analytics catalog/warehouse path instead of substituting workspace metrics. " +
|
|
323
|
-
"START HERE — For an ordinary metric, cohort, list, count, or trend question,
|
|
329
|
+
"START HERE — For an ordinary metric, cohort, list, count, or trend question, inspect any preloaded Analytics references first. If a reference fits, preserve its definition and query shape, then run one bounded live query. If the references are absent or inadequate, call `search-analytics-query-catalog` once with focused terms. For a request to replicate, clone, or adapt a dashboard, call `search-dashboard-references` first and inspect the returned dashboard before changing anything. Retrieved references are context, not live results. Use schema discovery only when no catalog reference is usable, then run one bounded query. " +
|
|
324
330
|
ANALYTICS_CROSS_APP_ROUTING_GUIDANCE +
|
|
325
331
|
'ONE BOUNDED CALL — List, filter, count, and cohort questions ("which X, excluding Y") are a single query, not a loop. Express the include filter, the exclude filter, and the aggregation in one SQL statement or one `run-code` script that filters server-side. Never page through a cohort across separate tool calls and never fan out per item to apply a filter; that is what turns a ten-second answer into a twenty-minute one. ' +
|
|
326
332
|
"Apply real-data requirements only when presenting analytics results, source records, or derived metrics. Do not call data-source tools for workflow migration, recurring-job setup, UI/code fixes, settings help, conceptual planning, or other non-data tasks unless the user explicitly asks for data. " +
|
|
@@ -347,7 +353,7 @@ function looksLikeSchemaDetailsRequest(text: string): boolean {
|
|
|
347
353
|
|
|
348
354
|
export function analyticsDataDictionaryRoutingContext(): string {
|
|
349
355
|
return `<data-dictionary-routing>
|
|
350
|
-
|
|
356
|
+
The system may preload a small set of relevant dictionary entries and saved dashboard panels in \`<resource scope="analytics-catalog">\`. Use a matching definition or query example as context, then query the live source; retrieved references never supply current values. If no preloaded reference fits, use \`search-analytics-query-catalog\` for focused dictionary and saved-dashboard search. Call \`list-data-dictionary\` separately when the catalog has no usable match or the user asks to browse or filter definitions. Treat approved entries as canonical, unreviewed human entries as unverified, and AI-generated unapproved entries as suggestions. If no matching definition or chart exists, inspect the likely source schema before asking about business meaning. Never ask the user to supply internal dataset, table, column, or SQL identifiers that configured actions can discover.
|
|
351
357
|
</data-dictionary-routing>`;
|
|
352
358
|
}
|
|
353
359
|
|
|
@@ -1289,6 +1295,36 @@ export async function searchDashboardMentions(query: string, event?: any) {
|
|
|
1289
1295
|
export default createAgentChatPlugin({
|
|
1290
1296
|
appId: "analytics",
|
|
1291
1297
|
onAgentTurnComplete: autosaveAnalyticsAfterAgentTurn,
|
|
1298
|
+
onAgentRunComplete: async (_scope, run) => {
|
|
1299
|
+
const properties = summarizeAnalyticsRun({
|
|
1300
|
+
events: run.events,
|
|
1301
|
+
preloadedReferenceCount:
|
|
1302
|
+
getRequestRunContext()?.analyticsJevPrefetch?.preloadedReferenceCount ??
|
|
1303
|
+
0,
|
|
1304
|
+
});
|
|
1305
|
+
const { track } = await import("@agent-native/core/tracking");
|
|
1306
|
+
await track("analytics_agent_run_outcome", properties);
|
|
1307
|
+
},
|
|
1308
|
+
prepareRequest: async ({
|
|
1309
|
+
ownerEmail,
|
|
1310
|
+
requestContext,
|
|
1311
|
+
contextPrefetchDeadlineAt,
|
|
1312
|
+
dispatchToBackground,
|
|
1313
|
+
}) => {
|
|
1314
|
+
if (
|
|
1315
|
+
!ownerEmail ||
|
|
1316
|
+
dispatchToBackground ||
|
|
1317
|
+
!looksLikeAnalyticsDataRequest(requestContext)
|
|
1318
|
+
) {
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
return retrieveAnalyticsPromptReferences({
|
|
1322
|
+
request: requestContext,
|
|
1323
|
+
email: ownerEmail,
|
|
1324
|
+
orgId: getRequestOrgId() || null,
|
|
1325
|
+
deadlineAt: contextPrefetchDeadlineAt,
|
|
1326
|
+
});
|
|
1327
|
+
},
|
|
1292
1328
|
// Resource prompt hydration performs additive schema checks. Keep that
|
|
1293
1329
|
// work out of production serverless cold starts; it is not needed for the
|
|
1294
1330
|
// dashboard's domain prompt and can contend with the request's DB queries.
|
|
@@ -1330,9 +1366,8 @@ export default createAgentChatPlugin({
|
|
|
1330
1366
|
return ctx.orgId;
|
|
1331
1367
|
},
|
|
1332
1368
|
extraContext: async () => {
|
|
1333
|
-
//
|
|
1334
|
-
//
|
|
1335
|
-
// render every organization metric before the model request starts.
|
|
1369
|
+
// Keep source-routing guidance static; request preparation retrieves only
|
|
1370
|
+
// a bounded set of matching references for Analytics data questions.
|
|
1336
1371
|
const sourceGuidance =
|
|
1337
1372
|
analyticsSourceGuidanceOpening() +
|
|
1338
1373
|
"DASHBOARD CREATION RULE — You may create dashboard artifacts, SQL panels, or other resources only when the user explicitly asks you to (e.g. 'build me a dashboard for...', 'save this analysis', 'add a chart for...'). Treat a requested saved analysis or deep-dive report as a dashboard request. Never create any resource proactively during research, trend analysis, or answering questions. If you think a dashboard would be useful, suggest it and wait for explicit confirmation before creating anything. Never add new items to the sidebar or modify existing dashboards without an explicit user directive. " +
|
|
@@ -1347,7 +1382,7 @@ export default createAgentChatPlugin({
|
|
|
1347
1382
|
"Use configured data sources and actions only. The built-in first-party Analytics source is an additional source and is always available through `query-agent-native-analytics`, even when no external provider credentials are connected. External provider actions remain available and are the authoritative path when the user names a provider or the data lives there. Call `data-source-status` when you need to know which external providers are connected, and treat provider actions as unavailable for analysis only if they return missing credentials, permission, syntax, quota, or network errors. " +
|
|
1348
1383
|
"The built-in `demo` dashboard source is a demo-environment Prometheus source reserved for the Node Exporter demo. It must never satisfy REAL_DATA_REQUIRED or be cited as user analytics evidence unless the user explicitly asks to inspect the demo dashboard. " +
|
|
1349
1384
|
"When the user names a provider such as first-party Analytics, BigQuery, HubSpot, Gong, Jira, Pylon, Slack, Sentry, GA4, or another connected source, that source is authoritative for the turn. Use its first-class query action when available; if it is not on the initial tool surface, use tool-search for that provider instead of loading unrelated catalogs. For an ordinary structured lookup, make one bounded query and stop on success. " +
|
|
1350
|
-
"Load provider API, corpus, staging, or code tools only when the user explicitly requests cross-source work, exhaustive unstructured-record coverage,
|
|
1385
|
+
"Load provider API, corpus, staging, or code tools only when the user explicitly requests cross-source work, exhaustive unstructured-record coverage, an absence claim that the first-class action cannot support, or a durable CSV export. For a compact first-party table, use the query action's Download CSV control. For durable CSV, use run-code with workspaceWrite and show-workspace-file. For an explicit XLSX workbook, use docs-search once to load the spreadsheet export workflow; run-code cannot import xlsx or exceljs packages. For broad data workflows, fetch every relevant page or an explicitly bounded cohort, preserve coverage counts, and state any uncovered records. " +
|
|
1351
1386
|
"For named deal, account, renewal, churn-risk, or customer deep dives that need HubSpot and Gong context, `account-deep-dive` can provide a bounded evidence bundle. Do not answer a requested transcript deep dive from call metadata alone. " +
|
|
1352
1387
|
"When the user refers to the current dashboard artifact, this analysis, this project, or asks to spin off, adapt, modify, or reuse a saved analysis, call `view-screen` first and use the returned dashboard details; for an explicitly named legacy analysis id, call `get-analysis` before responding and preserve its legacy deep link only for compatibility. " +
|
|
1353
1388
|
"If a query action fails because its arguments are invalid, correct the arguments once. Never repeat the identical failed call. For credential, permission, quota, network, or repeated schema failures, stop using that source for the turn and surface the actual error instead of trying unrelated providers. " +
|
|
@@ -28,6 +28,11 @@ Detailed event, availability, booking, storage, and UI rules live in
|
|
|
28
28
|
Google Calendar connection, and sharing. Do not bypass app access checks.
|
|
29
29
|
- The `get-settings` and `update-settings` actions expose the General week-start
|
|
30
30
|
setting as `weekStart`: `sunday` or `monday`.
|
|
31
|
+
- `update-settings` also saves owner-private Jev invitation prompts in
|
|
32
|
+
`eventRules.accept`, `eventRules.decline`, and `eventRules.hide`. Automatic
|
|
33
|
+
evaluation runs for invitations in each connected account's primary Google
|
|
34
|
+
calendar through the registered recurring sweep handler; `get-event-rules-status`
|
|
35
|
+
reports whether this deployment has a durable sweep driver.
|
|
31
36
|
- Use `connect-google-calendar` when the user asks to connect or reconnect
|
|
32
37
|
Google Calendar. Return its link to the user; do not `fetch`
|
|
33
38
|
`/_agent-native/google/auth-url` from the agent backend because that route
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable user-facing changes to Agent-Native Calendar are documented here. Open it any
|
|
4
4
|
time from the command menu (Cmd+K → "What's new") or from Settings.
|
|
5
5
|
|
|
6
|
+
## 2026-09-25
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- Add Jev invitation rules for auto-accept, auto-decline, and auto-hide with automation status.
|
|
11
|
+
|
|
6
12
|
## 2026-09-24
|
|
7
13
|
|
|
8
14
|
### Fixed
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import {
|
|
3
|
+
getRequestUserEmail,
|
|
4
|
+
hasRecurringSweepHandler,
|
|
5
|
+
scheduledTriggerAvailability,
|
|
6
|
+
} from "@agent-native/core/server";
|
|
7
|
+
import { getUserSetting } from "@agent-native/core/settings";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
export default defineAction({
|
|
11
|
+
description:
|
|
12
|
+
"Check whether automatic calendar invitation rules can run on this deployment.",
|
|
13
|
+
schema: z.object({}),
|
|
14
|
+
http: { method: "GET" },
|
|
15
|
+
run: async () => {
|
|
16
|
+
const owner = getRequestUserEmail();
|
|
17
|
+
if (!owner) throw new Error("no authenticated user");
|
|
18
|
+
const availability = scheduledTriggerAvailability();
|
|
19
|
+
const registered = hasRecurringSweepHandler("calendar-event-rules");
|
|
20
|
+
const configured = registered && availability.available;
|
|
21
|
+
const unavailableReason = availability.available
|
|
22
|
+
? null
|
|
23
|
+
: availability.reason;
|
|
24
|
+
const runtime = (await getUserSetting(
|
|
25
|
+
owner,
|
|
26
|
+
"calendar-event-rules-runtime",
|
|
27
|
+
)) as {
|
|
28
|
+
lastError?: string;
|
|
29
|
+
lastConflictCount?: number;
|
|
30
|
+
accountRefreshErrors?: Array<{ email: string; error: string }>;
|
|
31
|
+
} | null;
|
|
32
|
+
return {
|
|
33
|
+
enabled: configured,
|
|
34
|
+
reason: configured ? null : unavailableReason,
|
|
35
|
+
registered,
|
|
36
|
+
intervalMinutes: configured ? 5 : null,
|
|
37
|
+
message: configured
|
|
38
|
+
? null
|
|
39
|
+
: !registered
|
|
40
|
+
? "calendar-rule-handler-not-registered"
|
|
41
|
+
: (unavailableReason ?? "calendar-rule-handler-not-scheduled"),
|
|
42
|
+
lastError: runtime?.lastError ?? null,
|
|
43
|
+
accountRefreshErrors: runtime?.accountRefreshErrors ?? [],
|
|
44
|
+
conflictsSkipped: (runtime?.lastConflictCount ?? 0) > 0,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -38,6 +38,7 @@ const DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
|
38
38
|
// a serverless cold start just resets it, which is fine since the feed is
|
|
39
39
|
// re-fetched on the next call.
|
|
40
40
|
const ICAL_CACHE_TTL_MS = 5 * 60_000;
|
|
41
|
+
const ICAL_CACHE_MAX_ENTRIES = 200;
|
|
41
42
|
const icalCache = new Map<
|
|
42
43
|
string,
|
|
43
44
|
{ events: CalendarEvent[]; fetchedAt: number }
|
|
@@ -48,11 +49,20 @@ async function fetchICalEventsCached(
|
|
|
48
49
|
from: string,
|
|
49
50
|
to: string,
|
|
50
51
|
): Promise<CalendarEvent[]> {
|
|
51
|
-
const cacheKey =
|
|
52
|
+
const cacheKey = JSON.stringify([
|
|
53
|
+
cal.id,
|
|
54
|
+
cal.name,
|
|
55
|
+
cal.url,
|
|
56
|
+
cal.color,
|
|
57
|
+
from,
|
|
58
|
+
to,
|
|
59
|
+
]);
|
|
60
|
+
const now = Date.now();
|
|
52
61
|
const cached = icalCache.get(cacheKey);
|
|
53
|
-
if (cached &&
|
|
62
|
+
if (cached && now - cached.fetchedAt < ICAL_CACHE_TTL_MS) {
|
|
54
63
|
return cached.events;
|
|
55
64
|
}
|
|
65
|
+
if (cached) icalCache.delete(cacheKey);
|
|
56
66
|
const events = await fetchICalEvents(
|
|
57
67
|
cal.id,
|
|
58
68
|
cal.name,
|
|
@@ -62,7 +72,17 @@ async function fetchICalEventsCached(
|
|
|
62
72
|
to,
|
|
63
73
|
{ throwOnError: true },
|
|
64
74
|
);
|
|
65
|
-
|
|
75
|
+
const fetchedAt = Date.now();
|
|
76
|
+
for (const [key, entry] of icalCache) {
|
|
77
|
+
if (fetchedAt - entry.fetchedAt >= ICAL_CACHE_TTL_MS) {
|
|
78
|
+
icalCache.delete(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (icalCache.size >= ICAL_CACHE_MAX_ENTRIES) {
|
|
82
|
+
const oldestKey = icalCache.keys().next().value;
|
|
83
|
+
if (oldestKey !== undefined) icalCache.delete(oldestKey);
|
|
84
|
+
}
|
|
85
|
+
icalCache.set(cacheKey, { events, fetchedAt });
|
|
66
86
|
return events;
|
|
67
87
|
}
|
|
68
88
|
|
|
@@ -869,7 +889,7 @@ export default defineAction({
|
|
|
869
889
|
run: async (args, ctx) => {
|
|
870
890
|
const inventory =
|
|
871
891
|
args.format === "inventory" || (ctx?.caller === "mcp" && !args.format);
|
|
872
|
-
const owner =
|
|
892
|
+
const owner = getRequestUserEmail();
|
|
873
893
|
if (inventory && !owner) throw new Error("no authenticated user");
|
|
874
894
|
const calendarTimezone = inventory
|
|
875
895
|
? await getCalendarTimezone(owner!)
|
|
@@ -918,6 +938,32 @@ export default defineAction({
|
|
|
918
938
|
timezone: calendarTimezone,
|
|
919
939
|
},
|
|
920
940
|
);
|
|
941
|
+
if (owner) {
|
|
942
|
+
const settings = (await getUserSetting(owner, "calendar-settings")) as {
|
|
943
|
+
hiddenEventKeys?: string[];
|
|
944
|
+
} | null;
|
|
945
|
+
const hidden = new Set(settings?.hiddenEventKeys ?? []);
|
|
946
|
+
if (hidden.size) {
|
|
947
|
+
const legacyAccount =
|
|
948
|
+
result.requestedAccounts === null &&
|
|
949
|
+
result.resolvedAccounts.length === 1
|
|
950
|
+
? result.resolvedAccounts[0]!.trim().toLowerCase()
|
|
951
|
+
: undefined;
|
|
952
|
+
result.events = result.events.filter((event) => {
|
|
953
|
+
const legacyHidden =
|
|
954
|
+
legacyAccount &&
|
|
955
|
+
event.source === "google" &&
|
|
956
|
+
event.accountEmail?.trim().toLowerCase() === legacyAccount &&
|
|
957
|
+
!event.calendarSourceKey &&
|
|
958
|
+
(event.calendarId == null || event.calendarId === "primary") &&
|
|
959
|
+
hidden.has(event.id);
|
|
960
|
+
const scopedHidden = hidden.has(
|
|
961
|
+
`${event.source}:${event.accountEmail?.trim().toLowerCase()}:${event.calendarId ?? "primary"}:${event.googleEventId ?? event.id}`,
|
|
962
|
+
);
|
|
963
|
+
return !legacyHidden && !scopedHidden;
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
}
|
|
921
967
|
|
|
922
968
|
if (inventory) {
|
|
923
969
|
const query =
|