@agent-native/core 0.69.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +48 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/changelog/parse.ts +245 -0
- package/corpus/core/src/cli/changelog.ts +199 -0
- package/corpus/core/src/cli/index.ts +19 -0
- package/corpus/core/src/cli/recap.ts +24 -1
- package/corpus/core/src/cli/skills.ts +72 -45
- package/corpus/core/src/client/CommandMenu.tsx +183 -75
- package/corpus/core/src/client/agent-chat-adapter.ts +44 -7
- package/corpus/core/src/client/analytics.ts +181 -0
- package/corpus/core/src/client/changelog/Changelog.tsx +321 -0
- package/corpus/core/src/client/index.ts +11 -0
- package/corpus/core/src/client/mcp-apps/McpAppRenderer.tsx +54 -0
- package/corpus/core/src/client/settings/useBuilderStatus.ts +82 -20
- package/corpus/core/src/mcp/build-server.ts +1 -1
- package/corpus/core/src/mcp/embed-app.ts +112 -6
- package/corpus/core/src/server/attribution.ts +211 -0
- package/corpus/core/src/server/auth.ts +6 -0
- package/corpus/core/src/server/better-auth-instance.ts +49 -5
- package/corpus/core/src/server/builder-browser.ts +27 -1
- package/corpus/core/src/server/core-routes-plugin.ts +58 -0
- package/corpus/core/src/server/google-oauth.ts +19 -6
- package/corpus/core/src/shared/mcp-embed-headers.ts +1 -1
- package/corpus/core/src/styles/agent-conversation.css +21 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +111 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +46 -14
- package/corpus/templates/analytics/CHANGELOG.md +10 -0
- package/corpus/templates/analytics/actions/install-dashboard-template.ts +2 -2
- package/corpus/templates/analytics/actions/open-traffic-dashboard.ts +1 -1
- package/corpus/templates/analytics/actions/update-dashboard.ts +5 -3
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +180 -144
- package/corpus/templates/analytics/app/components/layout/Header.tsx +2 -2
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +7 -5
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +221 -213
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +6 -3
- package/corpus/templates/analytics/app/lib/demo-dashboard-path.ts +1 -1
- package/corpus/templates/analytics/app/lib/last-opened.ts +2 -1
- package/corpus/templates/analytics/app/pages/Settings.tsx +4 -0
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +3 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +2 -2
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +101 -99
- package/corpus/templates/analytics/app/pages/overview/OverviewPage.tsx +1 -1
- package/corpus/templates/analytics/app/routes/adhoc.$id.tsx +18 -5
- package/corpus/templates/analytics/app/routes/catalog.tsx +1 -1
- package/corpus/templates/analytics/app/routes/dashboards.$id.tsx +9 -0
- package/corpus/templates/analytics/app/routes/traffic.tsx +1 -1
- package/corpus/templates/analytics/changelog/2026-06-23-the-dashboards-and-analyses-sidebar-settings-buttons-now-sta.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +145 -0
- package/corpus/templates/analytics/server/db/index.ts +1 -1
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +9 -2
- package/corpus/templates/analytics/server/lib/demo-dashboards.ts +1 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +2 -2
- package/corpus/templates/analytics/server/plugins/core-routes.ts +6 -6
- package/corpus/templates/assets/CHANGELOG.md +10 -0
- package/corpus/templates/assets/app/root.tsx +7 -1
- package/corpus/templates/assets/app/routes/settings.tsx +6 -0
- package/corpus/templates/brain/CHANGELOG.md +10 -0
- package/corpus/templates/brain/app/root.tsx +7 -1
- package/corpus/templates/brain/app/routes/settings.tsx +8 -1
- package/corpus/templates/calendar/CHANGELOG.md +10 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +4 -0
- package/corpus/templates/calendar/app/root.tsx +7 -1
- package/corpus/templates/chat/CHANGELOG.md +10 -0
- package/corpus/templates/chat/app/root.tsx +7 -1
- package/corpus/templates/clips/CHANGELOG.md +10 -0
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +33 -7
- package/corpus/templates/clips/app/components/player/sign-in-prompt-dialog.tsx +8 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +150 -20
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +7 -11
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +31 -0
- package/corpus/templates/clips/app/components/sharing/slack-share-hint.tsx +71 -0
- package/corpus/templates/clips/app/root.tsx +7 -1
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +15 -1
- package/corpus/templates/clips/app/routes/record.tsx +78 -5
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +86 -5
- package/corpus/templates/clips/changelog/2026-06-23-clips-shared-in-slack-no-longer-show-a-could-not-start-playb.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-23-made-the-play-button-on-shared-and-embedded-clips-scale-with.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-23-public-clip-share-links-now-show-whether-they-ll-play-inline.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-23-screen-camera-recordings-now-keep-the-presenter-s-face-in-th.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +20 -0
- package/corpus/templates/clips/desktop/src/main.tsx +3 -0
- package/corpus/templates/clips/desktop/src/overlays/region-record-border.tsx +76 -0
- package/corpus/templates/clips/desktop/src/styles.css +49 -0
- package/corpus/templates/clips/desktop/src-tauri/capabilities/default.json +2 -1
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +67 -1
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +2 -0
- package/corpus/templates/clips/desktop/src-tauri/src/util.rs +4 -1
- package/corpus/templates/clips/server/routes/api/video/[recordingId].get.ts +51 -1
- package/corpus/templates/clips/shared/share-attribution.ts +79 -0
- package/corpus/templates/content/CHANGELOG.md +10 -0
- package/corpus/templates/content/app/root.tsx +7 -1
- package/corpus/templates/design/CHANGELOG.md +10 -0
- package/corpus/templates/design/actions/generate-design.ts +4 -0
- package/corpus/templates/design/app/root.tsx +7 -1
- package/corpus/templates/design/app/routes/settings.tsx +10 -2
- package/corpus/templates/dispatch/CHANGELOG.md +10 -0
- package/corpus/templates/dispatch/app/root.tsx +7 -1
- package/corpus/templates/forms/CHANGELOG.md +10 -0
- package/corpus/templates/forms/app/root.tsx +7 -1
- package/corpus/templates/macros/CHANGELOG.md +10 -0
- package/corpus/templates/macros/app/root.tsx +7 -1
- package/corpus/templates/mail/CHANGELOG.md +10 -0
- package/corpus/templates/mail/app/components/layout/CommandPalette.tsx +3 -0
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +27 -0
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +31 -17
- package/corpus/templates/plan/.agents/skills/visual-plan/references/wireframe.md +7 -4
- package/corpus/templates/plan/.agents/skills/visual-recap/SKILL.md +34 -24
- package/corpus/templates/plan/.agents/skills/visual-recap/references/wireframe.md +7 -4
- package/corpus/templates/plan/AGENTS.md +4 -0
- package/corpus/templates/plan/CHANGELOG.md +10 -0
- package/corpus/templates/plan/actions/view-screen.ts +5 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +98 -1
- package/corpus/templates/plan/app/pages/PlansPage.tsx +107 -7
- package/corpus/templates/plan/app/root.tsx +7 -1
- package/corpus/templates/plan/shared/share-attribution.ts +72 -0
- package/corpus/templates/slides/CHANGELOG.md +10 -0
- package/corpus/templates/slides/app/root.tsx +7 -1
- package/corpus/templates/videos/CHANGELOG.md +4 -151
- package/corpus/templates/videos/app/root.tsx +7 -1
- package/dist/changelog/parse.d.ts +70 -0
- package/dist/changelog/parse.d.ts.map +1 -0
- package/dist/changelog/parse.js +200 -0
- package/dist/changelog/parse.js.map +1 -0
- package/dist/cli/changelog.d.ts +4 -0
- package/dist/cli/changelog.d.ts.map +1 -0
- package/dist/cli/changelog.js +166 -0
- package/dist/cli/changelog.js.map +1 -0
- package/dist/cli/index.js +18 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +22 -1
- package/dist/cli/recap.js.map +1 -1
- package/dist/cli/skills.d.ts +3 -3
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +72 -45
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/CommandMenu.d.ts +17 -1
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +49 -13
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +43 -6
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/analytics.d.ts +18 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +177 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/changelog/Changelog.d.ts +47 -0
- package/dist/client/changelog/Changelog.d.ts.map +1 -0
- package/dist/client/changelog/Changelog.js +138 -0
- package/dist/client/changelog/Changelog.js.map +1 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/mcp-apps/McpAppRenderer.d.ts +1 -0
- package/dist/client/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/client/mcp-apps/McpAppRenderer.js +42 -1
- package/dist/client/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +2 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +58 -10
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/mcp/build-server.js +1 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/embed-app.d.ts.map +1 -1
- package/dist/mcp/embed-app.js +112 -6
- package/dist/mcp/embed-app.js.map +1 -1
- package/dist/server/attribution.d.ts +83 -0
- package/dist/server/attribution.d.ts.map +1 -0
- package/dist/server/attribution.js +178 -0
- package/dist/server/attribution.js.map +1 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +7 -0
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +9 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +32 -2
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts +4 -0
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +20 -1
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +25 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +38 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +16 -2
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/shared/mcp-embed-headers.js +1 -1
- package/dist/shared/mcp-embed-headers.js.map +1 -1
- package/dist/styles/agent-conversation.css +21 -0
- package/dist/templates/workspace-core/.agents/skills/changelog/SKILL.md +111 -0
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +46 -14
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +111 -0
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +46 -14
- /package/corpus/templates/analytics/app/routes/{dashboards.tsx → dashboards._index.tsx} +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import type { H3Event } from "h3";
|
|
3
3
|
import { getHeader } from "h3";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getAuthSecret,
|
|
6
|
+
resolveSignupTrackingIdentity,
|
|
7
|
+
} from "./better-auth-instance.js";
|
|
5
8
|
import { getAppBasePath, getOrigin } from "./google-oauth.js";
|
|
6
9
|
|
|
7
10
|
const DEFAULT_BUILDER_APP_HOST = "https://builder.io";
|
|
@@ -43,6 +46,8 @@ export const BUILDER_SIGNUP_SOURCE_PARAM = "signupSource";
|
|
|
43
46
|
export const BUILDER_AGENT_NATIVE_FLOW_PARAM = "agentNativeFlow";
|
|
44
47
|
export const BUILDER_AGENT_NATIVE_CONNECT_SOURCE_PARAM =
|
|
45
48
|
"agentNativeConnectSource";
|
|
49
|
+
export const BUILDER_AGENT_NATIVE_APP_PARAM = "agentNativeApp";
|
|
50
|
+
export const BUILDER_AGENT_NATIVE_TEMPLATE_PARAM = "agentNativeTemplate";
|
|
46
51
|
|
|
47
52
|
const BUILDER_STATE_TTL_MS = 10 * 60 * 1000;
|
|
48
53
|
const BUILDER_SIGNUP_SOURCE = "agent-native";
|
|
@@ -51,6 +56,8 @@ export interface BuilderConnectTrackingParams {
|
|
|
51
56
|
signupSource?: string;
|
|
52
57
|
agentNativeFlow?: string;
|
|
53
58
|
agentNativeConnectSource?: string;
|
|
59
|
+
agentNativeApp?: string;
|
|
60
|
+
agentNativeTemplate?: string;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
function cleanTrackingParam(value: unknown): string | undefined {
|
|
@@ -72,6 +79,12 @@ export function getBuilderConnectTrackingParams(
|
|
|
72
79
|
agentNativeConnectSource: cleanTrackingParam(
|
|
73
80
|
params.get(BUILDER_AGENT_NATIVE_CONNECT_SOURCE_PARAM),
|
|
74
81
|
),
|
|
82
|
+
agentNativeApp: cleanTrackingParam(
|
|
83
|
+
params.get(BUILDER_AGENT_NATIVE_APP_PARAM),
|
|
84
|
+
),
|
|
85
|
+
agentNativeTemplate: cleanTrackingParam(
|
|
86
|
+
params.get(BUILDER_AGENT_NATIVE_TEMPLATE_PARAM),
|
|
87
|
+
),
|
|
75
88
|
};
|
|
76
89
|
}
|
|
77
90
|
|
|
@@ -86,6 +99,12 @@ export function builderConnectTrackingProperties(
|
|
|
86
99
|
if (tracking.agentNativeConnectSource) {
|
|
87
100
|
properties.agent_native_connect_source = tracking.agentNativeConnectSource;
|
|
88
101
|
}
|
|
102
|
+
if (tracking.agentNativeApp) {
|
|
103
|
+
properties.agent_native_app = tracking.agentNativeApp;
|
|
104
|
+
}
|
|
105
|
+
if (tracking.agentNativeTemplate) {
|
|
106
|
+
properties.agent_native_template = tracking.agentNativeTemplate;
|
|
107
|
+
}
|
|
89
108
|
return properties;
|
|
90
109
|
}
|
|
91
110
|
|
|
@@ -101,6 +120,10 @@ function applyBuilderConnectTrackingParams(
|
|
|
101
120
|
if (flow) params.set(BUILDER_AGENT_NATIVE_FLOW_PARAM, flow);
|
|
102
121
|
const source = cleanTrackingParam(tracking.agentNativeConnectSource);
|
|
103
122
|
if (source) params.set(BUILDER_AGENT_NATIVE_CONNECT_SOURCE_PARAM, source);
|
|
123
|
+
const app = cleanTrackingParam(tracking.agentNativeApp);
|
|
124
|
+
if (app) params.set(BUILDER_AGENT_NATIVE_APP_PARAM, app);
|
|
125
|
+
const template = cleanTrackingParam(tracking.agentNativeTemplate);
|
|
126
|
+
if (template) params.set(BUILDER_AGENT_NATIVE_TEMPLATE_PARAM, template);
|
|
104
127
|
}
|
|
105
128
|
|
|
106
129
|
export interface BuilderBrowserStatus {
|
|
@@ -524,8 +547,11 @@ export function buildBuilderCliAuthUrl(
|
|
|
524
547
|
) {
|
|
525
548
|
callbackUrl.searchParams.set(BUILDER_OPENER_PARAM, requestedPreviewOrigin);
|
|
526
549
|
}
|
|
550
|
+
const identity = resolveSignupTrackingIdentity();
|
|
527
551
|
const tracking = {
|
|
528
552
|
signupSource: BUILDER_SIGNUP_SOURCE,
|
|
553
|
+
agentNativeApp: identity.app,
|
|
554
|
+
agentNativeTemplate: identity.template,
|
|
529
555
|
...options.tracking,
|
|
530
556
|
};
|
|
531
557
|
applyBuilderConnectTrackingParams(callbackUrl.searchParams, tracking);
|
|
@@ -145,6 +145,7 @@ import { isEnvVarWriteAllowed } from "./env-var-writes.js";
|
|
|
145
145
|
import { llmConnectionTrackingProperties } from "../shared/llm-connection.js";
|
|
146
146
|
import { mountBrowserSessionRoutes } from "../browser-sessions/routes.js";
|
|
147
147
|
import { mountDbAdminRoutes } from "../db-admin/routes.js";
|
|
148
|
+
import { getDbExec } from "../db/client.js";
|
|
148
149
|
import {
|
|
149
150
|
DEFAULT_SSR_CACHE_HEADERS,
|
|
150
151
|
EMPTY_SPECULATION_RULES,
|
|
@@ -158,6 +159,40 @@ import {
|
|
|
158
159
|
export const FRAMEWORK_ROUTE_PREFIX = "/_agent-native";
|
|
159
160
|
export const FRAMEWORK_EVENTS_ROUTE = `${FRAMEWORK_ROUTE_PREFIX}/events`;
|
|
160
161
|
export const LEGACY_FRAMEWORK_EVENTS_ROUTE = `${FRAMEWORK_ROUTE_PREFIX}/poll-events`;
|
|
162
|
+
|
|
163
|
+
/** Result of the `/_agent-native/health` liveness + DB-warmup probe. */
|
|
164
|
+
export interface DbHealthProbeResult {
|
|
165
|
+
/** The serverless function is live and served the request. */
|
|
166
|
+
ok: true;
|
|
167
|
+
/** A trivial `SELECT 1` reached the database (false = no DB or unreachable). */
|
|
168
|
+
db: boolean;
|
|
169
|
+
/** Round-trip time of the probe in milliseconds. */
|
|
170
|
+
ms: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Run a trivial `SELECT 1` to confirm the database is reachable and, as a side
|
|
175
|
+
* effect, keep a scale-to-zero serverless database (e.g. Neon) warm. Touching
|
|
176
|
+
* the DB on a schedule prevents the multi-second cold-start that otherwise
|
|
177
|
+
* stalls the next real user request.
|
|
178
|
+
*
|
|
179
|
+
* Always resolves: an app with no database (or a momentarily unreachable one)
|
|
180
|
+
* is still live, so the probe reports `db: false` rather than throwing. The
|
|
181
|
+
* `exec` parameter is injectable purely for tests.
|
|
182
|
+
*/
|
|
183
|
+
export async function runDbHealthProbe(
|
|
184
|
+
exec: () => { execute: (sql: string) => Promise<unknown> } = getDbExec,
|
|
185
|
+
): Promise<DbHealthProbeResult> {
|
|
186
|
+
const startedAt = Date.now();
|
|
187
|
+
let db = false;
|
|
188
|
+
try {
|
|
189
|
+
await exec().execute("SELECT 1");
|
|
190
|
+
db = true;
|
|
191
|
+
} catch {
|
|
192
|
+
// Live even when the DB is unreachable or the app has no database.
|
|
193
|
+
}
|
|
194
|
+
return { ok: true, db, ms: Date.now() - startedAt };
|
|
195
|
+
}
|
|
161
196
|
const DEFAULT_BUILDER_WAITLIST_FORM_ID = "DYTHuM0jlV";
|
|
162
197
|
const DEFAULT_BUILDER_WAITLIST_FORMS_ORIGIN = "https://forms.agent-native.com";
|
|
163
198
|
const BUILDER_WAITLIST_FORM_SOURCE = "connect_builder_card";
|
|
@@ -550,6 +585,8 @@ export interface CoreRoutesPluginOptions {
|
|
|
550
585
|
disableSSE?: boolean;
|
|
551
586
|
/** Disable the /_agent-native/ping health check. */
|
|
552
587
|
disablePing?: boolean;
|
|
588
|
+
/** Disable the /_agent-native/health DB liveness + warmup probe. */
|
|
589
|
+
disableHealth?: boolean;
|
|
553
590
|
/** Disable the /_agent-native/application-state routes. */
|
|
554
591
|
disableAppState?: boolean;
|
|
555
592
|
/** Disable the /_agent-native/open deep-link route. */
|
|
@@ -594,6 +631,7 @@ export interface CoreRoutesPluginOptions {
|
|
|
594
631
|
* GET /_agent-native/poll — polling endpoint for change detection
|
|
595
632
|
* GET /_agent-native/events (or custom) — SSE endpoint for real-time sync
|
|
596
633
|
* GET /_agent-native/ping — health check
|
|
634
|
+
* GET /_agent-native/health — DB liveness probe + scale-to-zero warmup
|
|
597
635
|
* GET /_agent-native/env-status — env key configuration status (when envKeys provided)
|
|
598
636
|
* POST /_agent-native/env-vars — save env vars to .env (when envKeys provided)
|
|
599
637
|
* GET /_agent-native/application-state/:key — read application state
|
|
@@ -925,6 +963,20 @@ export function createCoreRoutesPlugin(
|
|
|
925
963
|
);
|
|
926
964
|
}
|
|
927
965
|
|
|
966
|
+
// Health + DB warmup — liveness probe that touches the database so
|
|
967
|
+
// uptime monitors and the keep-warm cron prevent a scale-to-zero
|
|
968
|
+
// serverless DB (e.g. Neon) from cold-starting on the next real
|
|
969
|
+
// request. Public, side-effect free, and never cached.
|
|
970
|
+
if (!options.disableHealth) {
|
|
971
|
+
getH3App(nitroApp).use(
|
|
972
|
+
`${P}/health`,
|
|
973
|
+
defineEventHandler(async (event) => {
|
|
974
|
+
setResponseHeader(event, "cache-control", "no-store");
|
|
975
|
+
return runDbHealthProbe();
|
|
976
|
+
}),
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
|
|
928
980
|
getH3App(nitroApp).use(
|
|
929
981
|
`${P}/speculation-rules.json`,
|
|
930
982
|
defineEventHandler((event) => {
|
|
@@ -1691,6 +1743,12 @@ export function createCoreRoutesPlugin(
|
|
|
1691
1743
|
agentNativeConnectSource:
|
|
1692
1744
|
connectTracking.agentNativeConnectSource ??
|
|
1693
1745
|
pending.tracking.agentNativeConnectSource,
|
|
1746
|
+
agentNativeApp:
|
|
1747
|
+
connectTracking.agentNativeApp ??
|
|
1748
|
+
pending.tracking.agentNativeApp,
|
|
1749
|
+
agentNativeTemplate:
|
|
1750
|
+
connectTracking.agentNativeTemplate ??
|
|
1751
|
+
pending.tracking.agentNativeTemplate,
|
|
1694
1752
|
};
|
|
1695
1753
|
}
|
|
1696
1754
|
if (
|
|
@@ -841,14 +841,27 @@ export function oauthCallbackResponse(
|
|
|
841
841
|
// same-origin; Builder desktop workspace returns may point back to the
|
|
842
842
|
// local loopback gateway and carry the short-lived `_session` bridge so
|
|
843
843
|
// the local app can promote the newly created hosted OAuth session.
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
"Location",
|
|
848
|
-
appendSessionToOAuthReturnUrl(opts.returnUrl, opts.sessionToken),
|
|
844
|
+
const location = appendSessionToOAuthReturnUrl(
|
|
845
|
+
opts.returnUrl,
|
|
846
|
+
opts.sessionToken,
|
|
849
847
|
);
|
|
848
|
+
setResponseStatus(event, 302);
|
|
849
|
+
setResponseHeader(event, "Location", location);
|
|
850
850
|
setResponseHeader(event, "Referrer-Policy", "no-referrer");
|
|
851
|
-
return
|
|
851
|
+
// Return a real 302 so the browser lands on the clean return URL instead of
|
|
852
|
+
// lingering on the provider callback URL with its `code`/`state` query
|
|
853
|
+
// params. But h3 hands a non-2xx web `Response` straight back WITHOUT merging
|
|
854
|
+
// the `Set-Cookie` staged earlier in the callback (the framework session
|
|
855
|
+
// cookie), so mirror those staged cookies onto the redirect Response —
|
|
856
|
+
// otherwise the sign-in succeeds but the browser arrives back logged out.
|
|
857
|
+
const headers = new Headers({
|
|
858
|
+
Location: location,
|
|
859
|
+
"Referrer-Policy": "no-referrer",
|
|
860
|
+
});
|
|
861
|
+
for (const cookie of event.res?.headers?.getSetCookie?.() ?? []) {
|
|
862
|
+
headers.append("set-cookie", cookie);
|
|
863
|
+
}
|
|
864
|
+
return new Response(null, { status: 302, headers });
|
|
852
865
|
}
|
|
853
866
|
|
|
854
867
|
/** HTML error page for OAuth failures. The message is HTML-escaped — most
|
|
@@ -4,7 +4,7 @@ export const EMBED_TRANSPLANT_HEADER = "x-agent-native-embed-transplant";
|
|
|
4
4
|
|
|
5
5
|
const CLAUDE_MCP_CONTENT_HOST_RE = /^[a-f0-9]{32}\.claudemcpcontent\.com$/i;
|
|
6
6
|
const CHATGPT_MCP_SANDBOX_HOST_RE =
|
|
7
|
-
/^[^.]+\.web-sandbox\.oaiusercontent\.com$/i;
|
|
7
|
+
/^(?:[^.]+\.)?web-sandbox\.oaiusercontent\.com$/i;
|
|
8
8
|
|
|
9
9
|
export function isLocalMcpEmbedOrigin(
|
|
10
10
|
origin: string | null | undefined,
|
|
@@ -325,6 +325,27 @@
|
|
|
325
325
|
font-size: 12px;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
.agent-mcp-app__error {
|
|
329
|
+
flex-direction: column;
|
|
330
|
+
text-align: center;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.agent-mcp-app__open {
|
|
334
|
+
min-height: 28px;
|
|
335
|
+
border: 1px solid hsl(var(--destructive) / 0.35);
|
|
336
|
+
border-radius: calc(var(--radius) - 2px);
|
|
337
|
+
background: hsl(var(--background));
|
|
338
|
+
color: hsl(var(--foreground));
|
|
339
|
+
cursor: pointer;
|
|
340
|
+
font: inherit;
|
|
341
|
+
font-weight: 600;
|
|
342
|
+
padding: 0 10px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.agent-mcp-app__open:hover {
|
|
346
|
+
background: hsl(var(--muted));
|
|
347
|
+
}
|
|
348
|
+
|
|
328
349
|
.agent-mcp-app__error,
|
|
329
350
|
.agent-mcp-app--error {
|
|
330
351
|
color: hsl(var(--destructive));
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: changelog
|
|
3
|
+
description: >-
|
|
4
|
+
How to keep each app's user-facing changelog. Use when you ship a change a
|
|
5
|
+
user would notice (a new feature, a visible improvement, a bug fix), when
|
|
6
|
+
wiring the in-app "What's new" surface into a template, or when releasing
|
|
7
|
+
pending changelog entries.
|
|
8
|
+
scope: dev
|
|
9
|
+
metadata:
|
|
10
|
+
internal: true
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Changelog — user-facing "What's new"
|
|
14
|
+
|
|
15
|
+
Every template app keeps a `CHANGELOG.md` of **user-facing** changes that
|
|
16
|
+
renders in-app via the command menu (Cmd+K → "What's new") and on the settings
|
|
17
|
+
page. The flow mirrors changesets so it survives many agents working in
|
|
18
|
+
parallel: each change drops a small **pending entry file**, and a later
|
|
19
|
+
**release** rolls all pending files into a dated `CHANGELOG.md` section.
|
|
20
|
+
|
|
21
|
+
## When to add an entry
|
|
22
|
+
|
|
23
|
+
Add an entry whenever you ship something a user of that app would notice:
|
|
24
|
+
|
|
25
|
+
- a new capability or surface,
|
|
26
|
+
- a visible improvement (speed, layout, copy, defaults),
|
|
27
|
+
- a bug fix that affects behavior they'd see.
|
|
28
|
+
|
|
29
|
+
Do **not** add entries for refactors, internal tooling, tests, dependency
|
|
30
|
+
bumps, or anything invisible to the end user. The changelog is product notes,
|
|
31
|
+
not a commit log — write it the way you'd describe the change to a customer.
|
|
32
|
+
|
|
33
|
+
## How to add an entry
|
|
34
|
+
|
|
35
|
+
From the app directory (the template you changed):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
agent-native changelog add "Recordings can be trimmed before sharing" --type added
|
|
39
|
+
agent-native changelog add "Faster transcript search" --type improved
|
|
40
|
+
agent-native changelog add "Fixed a crash when opening an empty folder" --type fixed
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--type` is one of `added`, `improved`, `fixed`, `changed`, `removed`,
|
|
44
|
+
`security` (aliases like `feature`, `bugfix`, `enhancement` are accepted). This
|
|
45
|
+
writes `changelog/<date>-<slug>.md` — one file per change, so parallel work
|
|
46
|
+
never conflicts. You can also hand-write that file; the frontmatter is just:
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+
---
|
|
50
|
+
type: added
|
|
51
|
+
date: 2026-06-23
|
|
52
|
+
---
|
|
53
|
+
Recordings can be trimmed before sharing.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Writing good entries
|
|
57
|
+
|
|
58
|
+
- One user-facing sentence, present tense, no internal jargon or file names.
|
|
59
|
+
- Lead with the benefit ("Recordings can be trimmed…"), not the mechanism.
|
|
60
|
+
- Markdown is allowed (bold, links) but keep it short — it renders as a bullet.
|
|
61
|
+
|
|
62
|
+
## Releasing
|
|
63
|
+
|
|
64
|
+
`release` stamps every pending entry into `CHANGELOG.md` under a dated
|
|
65
|
+
`## <date>` section (grouped by type) and deletes the pending files:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
agent-native changelog release # uses today's date
|
|
69
|
+
agent-native changelog list # preview pending + released
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Releasing is usually done at deploy/merge time. The in-app surface reads
|
|
73
|
+
`CHANGELOG.md`, so only released entries are visible to users — pending entries
|
|
74
|
+
stay invisible until rolled up.
|
|
75
|
+
|
|
76
|
+
## Wiring the in-app surface (once per template)
|
|
77
|
+
|
|
78
|
+
Templates already get the rendering for free from `@agent-native/core`. To
|
|
79
|
+
expose it in an app:
|
|
80
|
+
|
|
81
|
+
1. **Command menu** — pass the app's own changelog to `CommandMenu`:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import changelog from "../CHANGELOG.md?raw";
|
|
85
|
+
// ...
|
|
86
|
+
<CommandMenu open={cmdkOpen} onOpenChange={setCmdkOpen} changelog={changelog}>
|
|
87
|
+
{/* existing groups */}
|
|
88
|
+
</CommandMenu>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This adds a "What's new" entry with an unseen-release dot and an in-app
|
|
92
|
+
dialog — no other wiring needed.
|
|
93
|
+
|
|
94
|
+
2. **Settings** (optional) — drop the card on the settings page:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { ChangelogSettingsCard } from "@agent-native/core/client";
|
|
98
|
+
import changelog from "../CHANGELOG.md?raw";
|
|
99
|
+
// ...
|
|
100
|
+
<ChangelogSettingsCard markdown={changelog} />
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`CHANGELOG.md?raw` is inlined by Vite at build time, so this works on every
|
|
104
|
+
host with no server route or runtime file access.
|
|
105
|
+
|
|
106
|
+
## Checklist
|
|
107
|
+
|
|
108
|
+
- [ ] Shipped a user-visible change? Run `agent-native changelog add "…"`.
|
|
109
|
+
- [ ] New template UI? Pass `changelog` to its `CommandMenu` and seed a
|
|
110
|
+
`CHANGELOG.md`.
|
|
111
|
+
- [ ] Releasing/deploying? `agent-native changelog release` rolls pending → dated.
|
|
@@ -31,7 +31,11 @@ Fire an analytics event.
|
|
|
31
31
|
```ts
|
|
32
32
|
import { track } from "@agent-native/core/tracking";
|
|
33
33
|
|
|
34
|
-
track(
|
|
34
|
+
track(
|
|
35
|
+
"meal.logged",
|
|
36
|
+
{ mealName: "Salad", calories: 350 },
|
|
37
|
+
{ userId: "user@example.com" },
|
|
38
|
+
);
|
|
35
39
|
```
|
|
36
40
|
|
|
37
41
|
### `identify(userId, traits?)`
|
|
@@ -73,13 +77,13 @@ Flush all providers (call before process exit).
|
|
|
73
77
|
|
|
74
78
|
Set the env var and the provider auto-registers at startup. No SDK dependencies -- all providers use raw HTTP.
|
|
75
79
|
|
|
76
|
-
| Provider
|
|
77
|
-
|
|
|
78
|
-
| PostHog
|
|
79
|
-
| Mixpanel
|
|
80
|
-
| Amplitude
|
|
80
|
+
| Provider | Env vars |
|
|
81
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
82
|
+
| PostHog | `POSTHOG_API_KEY` (required), `POSTHOG_HOST` (optional, defaults to `https://us.i.posthog.com`) |
|
|
83
|
+
| Mixpanel | `MIXPANEL_TOKEN` |
|
|
84
|
+
| Amplitude | `AMPLITUDE_API_KEY` |
|
|
81
85
|
| Agent Native Analytics | `AGENT_NATIVE_ANALYTICS_PUBLIC_KEY` (server), `AGENT_NATIVE_ANALYTICS_ENDPOINT` (optional, defaults to `https://analytics.agent-native.com/track`) |
|
|
82
|
-
| Webhook
|
|
86
|
+
| Webhook | `TRACKING_WEBHOOK_URL` (required), `TRACKING_WEBHOOK_AUTH` (optional, sent as `Authorization` header) |
|
|
83
87
|
|
|
84
88
|
Multiple providers can be active simultaneously. All receive every event.
|
|
85
89
|
|
|
@@ -106,10 +110,35 @@ Every browser-side `trackEvent()` POST to the Agent Native Analytics `/track` en
|
|
|
106
110
|
|
|
107
111
|
These fields land in the `analytics_events.anonymous_id`, `analytics_events.session_id`, and `analytics_events.user_id` columns in the analytics template. Storage access is wrapped in try/catch — private-browsing / blocked-storage clients silently degrade to NULL rather than crashing the page.
|
|
108
112
|
|
|
113
|
+
### Referral / viral attribution (first-touch)
|
|
114
|
+
|
|
115
|
+
`configureTracking()` also captures an anonymous visitor's **first-touch** referral context once, on first page load, and persists it across the signup boundary so the server-side `signup` event records where the user came from. This powers virality metrics for every template (Clips share links, Plans public pages, etc.).
|
|
116
|
+
|
|
117
|
+
**Share-link params** (set by whatever generates the link; read client-side only):
|
|
118
|
+
|
|
119
|
+
- `ref` — referral source bucket, e.g. `clip_share`, `plan_share`
|
|
120
|
+
- `via` — the referrer's stable user id (the clip/plan owner)
|
|
121
|
+
- `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`
|
|
122
|
+
|
|
123
|
+
**Client persistence** (first-write-wins — an existing value is never overwritten):
|
|
124
|
+
|
|
125
|
+
- `localStorage` key `an_attribution` and first-party cookie `an_ft` (`path=/; max-age=2592000; SameSite=Lax`, not HttpOnly — non-sensitive, written by client JS).
|
|
126
|
+
- Both store the same URL-encoded compact JSON (empty fields omitted, each value capped at 120 chars): `{ ref, via, utm_source, utm_medium, utm_campaign, utm_content, utm_term, landing_path, landing_referrer, landed_at }`. `landing_referrer` is the **host only** of `document.referrer` (scrubbed; same-origin referrers are dropped).
|
|
127
|
+
- `getFirstTouchAttribution()` (from `@agent-native/core/client`) returns the parsed object or `null`.
|
|
128
|
+
|
|
129
|
+
**Signup event enrichment** (server-side, from the `an_ft` cookie on the signup/OAuth-callback request, derived in `packages/core/src/server/attribution.ts`):
|
|
130
|
+
|
|
131
|
+
- `referral_source` — `ref` if present, else derived: `/share/…` → `clip_share`; a plan public path (`/p/`, `/plan/`, `/share-plan/`) → `plan_share`; a non-empty external referring host → `external`; otherwise `direct`.
|
|
132
|
+
- `referrer_user` (= `via`), `referral_medium` (= `utm_medium`), `referral_campaign` (= `utm_campaign`)
|
|
133
|
+
- `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` (raw passthrough)
|
|
134
|
+
- `first_touch_path` (= `landing_path`), `landing_referrer`
|
|
135
|
+
|
|
136
|
+
Attribution parsing is fully defensive and never blocks signup — a missing/malformed cookie falls back to `referral_source: "direct"`.
|
|
137
|
+
|
|
109
138
|
Other framework-level baseline events:
|
|
110
139
|
|
|
111
140
|
- `session status` from `useSession()`, with `signed_in`
|
|
112
|
-
- `signup` from Better Auth user creation, with `auth_provider` and `
|
|
141
|
+
- `signup` from Better Auth user creation, with `auth_provider`, `auth_user_id`, and first-touch referral attribution (`referral_source`, `referrer_user`, `referral_medium`, `referral_campaign`, `utm_*`, `first_touch_path`, `landing_referrer` — see "Referral / viral attribution" above)
|
|
113
142
|
- `builder connect clicked` and `builder connect popup blocked` from browser Connect Builder CTAs
|
|
114
143
|
- `builder connect started`, `builder connect succeeded`, `builder connect failed`, `builder disconnect succeeded`, and `builder disconnect failed` from the Builder connection routes, with LLM connection context when resolvable
|
|
115
144
|
|
|
@@ -121,7 +150,10 @@ For new lifecycle events, call `track()` server-side when the server is the sour
|
|
|
121
150
|
interface TrackingProvider {
|
|
122
151
|
name: string;
|
|
123
152
|
track(event: TrackingEvent): void | Promise<void>;
|
|
124
|
-
identify?(
|
|
153
|
+
identify?(
|
|
154
|
+
userId: string,
|
|
155
|
+
traits?: Record<string, unknown>,
|
|
156
|
+
): void | Promise<void>;
|
|
125
157
|
flush?(): void | Promise<void>;
|
|
126
158
|
}
|
|
127
159
|
|
|
@@ -142,11 +174,11 @@ interface TrackingEvent {
|
|
|
142
174
|
|
|
143
175
|
## Key Files
|
|
144
176
|
|
|
145
|
-
| File
|
|
146
|
-
|
|
|
147
|
-
| `packages/core/src/tracking/registry.ts`
|
|
148
|
-
| `packages/core/src/tracking/providers.ts`
|
|
149
|
-
| `packages/core/src/tracking/types.ts`
|
|
177
|
+
| File | Purpose |
|
|
178
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
179
|
+
| `packages/core/src/tracking/registry.ts` | `track()`, `identify()`, `registerTrackingProvider()`, `flushTracking()` |
|
|
180
|
+
| `packages/core/src/tracking/providers.ts` | Built-in providers (PostHog, Mixpanel, Amplitude, Agent Native Analytics, Webhook) and `registerBuiltinProviders()` |
|
|
181
|
+
| `packages/core/src/tracking/types.ts` | `TrackingEvent` and `TrackingProvider` interfaces |
|
|
150
182
|
|
|
151
183
|
## Related Skills
|
|
152
184
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable user-facing changes to Agent-Native Analytics are documented here. Open it any
|
|
4
|
+
time from the command menu (Cmd+K → "What's new") or from Settings.
|
|
5
|
+
|
|
6
|
+
## 2026-06-23
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- See what's new right inside Agent-Native Analytics — a changelog now lives in the command menu (Cmd+K) and in Settings.
|
|
@@ -100,7 +100,7 @@ export default defineAction({
|
|
|
100
100
|
dashboardId: existingInstall.id,
|
|
101
101
|
name: existingInstall.name,
|
|
102
102
|
alreadyInstalled: true,
|
|
103
|
-
urlPath: `/
|
|
103
|
+
urlPath: `/dashboards/${existingInstall.id}`,
|
|
104
104
|
deepLink: buildDeepLink({
|
|
105
105
|
app: "analytics",
|
|
106
106
|
view: "adhoc",
|
|
@@ -144,7 +144,7 @@ export default defineAction({
|
|
|
144
144
|
name: dashboard.title,
|
|
145
145
|
alreadyInstalled: false,
|
|
146
146
|
overwritten: !!existing,
|
|
147
|
-
urlPath: `/
|
|
147
|
+
urlPath: `/dashboards/${dashboardId}`,
|
|
148
148
|
deepLink: buildDeepLink({
|
|
149
149
|
app: "analytics",
|
|
150
150
|
view: "adhoc",
|
|
@@ -2,7 +2,7 @@ import { defineAction, embedApp } from "@agent-native/core";
|
|
|
2
2
|
import { buildDeepLink } from "@agent-native/core/server";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
|
-
const TRAFFIC_DASHBOARD_PATH = "/
|
|
5
|
+
const TRAFFIC_DASHBOARD_PATH = "/dashboards/agent-native-templates-first-party";
|
|
6
6
|
const TRAFFIC_DASHBOARD_ID = "agent-native-templates-first-party";
|
|
7
7
|
|
|
8
8
|
function trafficDashboardDeepLink(): string {
|
|
@@ -410,7 +410,9 @@ export default defineAction({
|
|
|
410
410
|
"Edit a SQL dashboard config (scope-aware). Prefer this over raw db-patch on the settings table — " +
|
|
411
411
|
"it resolves org vs. user scope correctly so the edit lands on the row the UI actually renders. " +
|
|
412
412
|
"Use `ops` for structural changes (reorder/insert/remove panels, update field values via JSON Pointer paths). " +
|
|
413
|
-
"Use `config` to replace the entire dashboard config.
|
|
413
|
+
"Use `config` to replace the entire dashboard config. " +
|
|
414
|
+
"For a large dashboard, build it up incrementally: save a small dashboard first, then add panels one at a time with `ops` rather than authoring the whole `config` in one call — a very large single `config` payload can get cut off mid-stream and stall the turn. " +
|
|
415
|
+
"The UI auto-refreshes after this action — do NOT call `refresh-screen`.",
|
|
414
416
|
schema: z.object({
|
|
415
417
|
dashboardId: z
|
|
416
418
|
.string()
|
|
@@ -488,7 +490,7 @@ export default defineAction({
|
|
|
488
490
|
? args.config.name
|
|
489
491
|
: args.dashboardId,
|
|
490
492
|
config: args.config,
|
|
491
|
-
urlPath: `/
|
|
493
|
+
urlPath: `/dashboards/${args.dashboardId}`,
|
|
492
494
|
deepLink: buildDeepLink({
|
|
493
495
|
app: "analytics",
|
|
494
496
|
view: "adhoc",
|
|
@@ -531,7 +533,7 @@ export default defineAction({
|
|
|
531
533
|
dashboardId: args.dashboardId,
|
|
532
534
|
name: typeof root.name === "string" ? root.name : args.dashboardId,
|
|
533
535
|
config: root,
|
|
534
|
-
urlPath: `/
|
|
536
|
+
urlPath: `/dashboards/${args.dashboardId}`,
|
|
535
537
|
deepLink: buildDeepLink({
|
|
536
538
|
app: "analytics",
|
|
537
539
|
view: "adhoc",
|