@agent-native/core 0.178.0 → 0.178.1-nightly-20260909201829
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/dist/client/analytics.js +10 -0
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/vite/client.js +25 -7
- package/dist/vite/sentry-source-maps.d.ts +12 -0
- package/dist/vite/sentry-source-maps.js +105 -0
- package/package.json +2 -1
package/dist/client/analytics.js
CHANGED
|
@@ -7,6 +7,7 @@ import { toPostHogExceptionProperties } from "../tracking/posthog-exception.js";
|
|
|
7
7
|
import { getAnalyticsClientPlatform } from "./analytics-platform.js";
|
|
8
8
|
import { getOrCreateAnalyticsAnonymousId, getOrCreateAnalyticsSessionId, } from "./analytics-session.js";
|
|
9
9
|
import { injectedAgentNativeConfig } from "./app-config.js";
|
|
10
|
+
import { clientBuildId } from "./build-compatibility.js";
|
|
10
11
|
export { clearAnalyticsSessionId, setAnalyticsSessionId, } from "./analytics-session.js";
|
|
11
12
|
import { fetchAgentEngineStatus, fetchAuthSessionStatus, } from "./client-status-requests.js";
|
|
12
13
|
import { installErrorCapture, } from "./error-capture.js";
|
|
@@ -721,6 +722,14 @@ function resolveClientDeploymentEnvironment() {
|
|
|
721
722
|
env.MODE ||
|
|
722
723
|
"production");
|
|
723
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* Must match `resolveSentryClientRelease()` in `vite/sentry-source-maps.ts`
|
|
727
|
+
* exactly — that's the release name uploaded source maps are attached to, so
|
|
728
|
+
* a mismatch here means captured events never resolve against them.
|
|
729
|
+
*/
|
|
730
|
+
function resolveClientRelease() {
|
|
731
|
+
return `agent-native-client@${clientBuildId() || "development"}`;
|
|
732
|
+
}
|
|
724
733
|
function captureWithSentry(module, error, context) {
|
|
725
734
|
return module.withScope((scope) => {
|
|
726
735
|
if (context.tags) {
|
|
@@ -764,6 +773,7 @@ function ensureSentry(loadWithoutDsn = false) {
|
|
|
764
773
|
module.init({
|
|
765
774
|
dsn,
|
|
766
775
|
environment: resolveClientDeploymentEnvironment(),
|
|
776
|
+
release: resolveClientRelease(),
|
|
767
777
|
beforeSend(event) {
|
|
768
778
|
if (isSyntheticBrowserTraffic())
|
|
769
779
|
return null;
|
|
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
62
62
|
error: string;
|
|
63
63
|
states?: undefined;
|
|
64
64
|
} | {
|
|
65
|
-
error?: undefined;
|
|
66
65
|
states: {
|
|
67
66
|
clientId: number;
|
|
68
67
|
state: string;
|
|
69
68
|
}[];
|
|
69
|
+
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
-
error?: undefined;
|
|
81
80
|
users: {
|
|
82
81
|
clientId: number;
|
|
83
82
|
lastSeen: number;
|
|
84
83
|
}[];
|
|
84
|
+
error?: undefined;
|
|
85
85
|
}>>;
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
error: string;
|
|
30
29
|
ok?: undefined;
|
|
30
|
+
error: string;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
17
17
|
id?: undefined;
|
|
18
18
|
provider?: undefined;
|
|
19
19
|
} | {
|
|
20
|
+
error?: undefined;
|
|
20
21
|
configured?: undefined;
|
|
21
22
|
connectPath?: undefined;
|
|
22
23
|
url: string;
|
|
23
24
|
id: string;
|
|
24
25
|
provider: string;
|
|
25
|
-
error?: undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export default _default;
|
|
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
+
error?: undefined;
|
|
45
|
+
ok?: undefined;
|
|
44
46
|
summary: import("./types.js").TraceSummary;
|
|
45
47
|
spans: import("./types.js").TraceSpan[];
|
|
46
48
|
id?: undefined;
|
|
49
|
+
} | {
|
|
47
50
|
error?: undefined;
|
|
48
51
|
ok?: undefined;
|
|
49
|
-
} | {
|
|
50
52
|
summary?: undefined;
|
|
51
53
|
spans?: undefined;
|
|
52
54
|
id: string;
|
|
53
|
-
error?: undefined;
|
|
54
|
-
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
|
+
ok?: undefined;
|
|
56
57
|
summary?: undefined;
|
|
57
58
|
spans?: undefined;
|
|
58
59
|
error: any;
|
|
59
60
|
id?: undefined;
|
|
60
|
-
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
+
error?: undefined;
|
|
62
63
|
summary?: undefined;
|
|
63
64
|
spans?: undefined;
|
|
64
65
|
ok: boolean;
|
|
65
66
|
id?: undefined;
|
|
66
|
-
error?: undefined;
|
|
67
67
|
}>>;
|
package/dist/vite/client.js
CHANGED
|
@@ -22,6 +22,7 @@ import { actionTypesPlugin } from "./action-types-plugin.js";
|
|
|
22
22
|
import { createAgentNativeConfigContext, loadAgentNativeConfigFile, loadWorkspaceAgentNativeConfigFile, readAgentNativeJsonConfig, } from "./agent-native-config-loader.js";
|
|
23
23
|
import { agentsBundlePlugin } from "./agents-bundle-plugin.js";
|
|
24
24
|
import { resolveAgentNativePackageVersions } from "./package-versions.js";
|
|
25
|
+
import { createSentrySourceMapUploadPlugin, isSentrySourceMapUploadEnabled, } from "./sentry-source-maps.js";
|
|
25
26
|
const require = createRequire(import.meta.url);
|
|
26
27
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
27
28
|
let nitroFsWatchGuardInstalled = false;
|
|
@@ -2867,11 +2868,28 @@ function authClientAssetPlugin() {
|
|
|
2867
2868
|
},
|
|
2868
2869
|
};
|
|
2869
2870
|
}
|
|
2871
|
+
// `.env`/`.env.production` values aren't in `process.env` unless the shell
|
|
2872
|
+
// exported them — Vite loads them separately via `loadEnv`. Env-gated
|
|
2873
|
+
// checks that only read `process.env` silently miss file-only config, so
|
|
2874
|
+
// this is the one merge both the plugin list and the build config use.
|
|
2875
|
+
function resolveAgentNativeRuntimeEnv(cwd, mode) {
|
|
2876
|
+
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
2877
|
+
return {
|
|
2878
|
+
...(workspaceRoot && workspaceRoot !== cwd
|
|
2879
|
+
? loadEnv(mode, workspaceRoot, "")
|
|
2880
|
+
: {}),
|
|
2881
|
+
...loadEnv(mode, cwd, ""),
|
|
2882
|
+
...process.env,
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2870
2885
|
function createAgentNativePlugins(options, { command, includeReactTransform, useServeOnlyNitroPlugin = false, userPlugins = [], }) {
|
|
2871
2886
|
const { appBasePath } = getConfiguredAppBasePath();
|
|
2872
2887
|
const nitroPlugin = createNitroDevPlugin(options, appBasePath);
|
|
2873
2888
|
const includeNitro = !isBuildCommand(command);
|
|
2874
2889
|
const presetMarkerPlugin = nitroPresetMarkerPlugin(options);
|
|
2890
|
+
// Vite's real `mode` isn't resolved yet at this eager, pre-config-hook
|
|
2891
|
+
// point — same fallback createAgentNativeConfig uses as its own default.
|
|
2892
|
+
const runtimeEnv = resolveAgentNativeRuntimeEnv(process.cwd(), process.env.NODE_ENV === "production" ? "production" : "development");
|
|
2875
2893
|
return [
|
|
2876
2894
|
presetMarkerPlugin,
|
|
2877
2895
|
// Stub packages from `options.ssrStubs` in the SSR bundle so they
|
|
@@ -2907,6 +2925,8 @@ function createAgentNativePlugins(options, { command, includeReactTransform, use
|
|
|
2907
2925
|
includeReactTransform ? createReactTransformPlugin() : null,
|
|
2908
2926
|
createDesignSystemThemePlugin(options.designSystemTheme),
|
|
2909
2927
|
createTailwindPlugin(options),
|
|
2928
|
+
// No-ops unless a Sentry auth token/org/project is configured.
|
|
2929
|
+
...createSentrySourceMapUploadPlugin(runtimeEnv),
|
|
2910
2930
|
].filter(Boolean);
|
|
2911
2931
|
}
|
|
2912
2932
|
function resolveAgentNativeTemplate(cwd) {
|
|
@@ -2967,13 +2987,7 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
2967
2987
|
// (Vite's loadEnv merges in precedence order — app dir is loaded after).
|
|
2968
2988
|
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
2969
2989
|
const envDir = workspaceRoot && workspaceRoot !== cwd ? workspaceRoot : cwd;
|
|
2970
|
-
const runtimeEnv =
|
|
2971
|
-
...(workspaceRoot && workspaceRoot !== cwd
|
|
2972
|
-
? loadEnv(mode, workspaceRoot, "")
|
|
2973
|
-
: {}),
|
|
2974
|
-
...loadEnv(mode, cwd, ""),
|
|
2975
|
-
...process.env,
|
|
2976
|
-
};
|
|
2990
|
+
const runtimeEnv = resolveAgentNativeRuntimeEnv(cwd, mode);
|
|
2977
2991
|
const appConfig = resolveAgentNativeConfig(mergeAgentNativeConfigs(mergeAgentNativeConfigs(mergeAgentNativeConfigs(workspaceConfig
|
|
2978
2992
|
? resolveAgentNativeConfig(workspaceConfig, configContext)
|
|
2979
2993
|
: {}, readAgentNativeJsonConfig(cwd)), projectConfigInput
|
|
@@ -3161,6 +3175,10 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
3161
3175
|
// the standard property survives the production pipeline.
|
|
3162
3176
|
cssMinify: userConfig.build?.cssMinify ?? "esbuild",
|
|
3163
3177
|
cssTarget: userConfig.build?.cssTarget ?? ["es2020", "safari18"],
|
|
3178
|
+
// "hidden" writes .map files for upload without a public
|
|
3179
|
+
// sourceMappingURL comment, so production never serves them directly.
|
|
3180
|
+
sourcemap: userConfig.build?.sourcemap ??
|
|
3181
|
+
(isSentrySourceMapUploadEnabled(runtimeEnv) ? "hidden" : false),
|
|
3164
3182
|
},
|
|
3165
3183
|
// Bundle all non-Node.js deps into the production SSR server build.
|
|
3166
3184
|
// Edge runtimes (CF Workers, Deno) don't have node_modules at runtime.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export declare function resolveSentryClientRelease(env: Record<string, string | undefined>): string;
|
|
3
|
+
export interface SentrySourceMapUploadConfig {
|
|
4
|
+
authToken: string;
|
|
5
|
+
org: string;
|
|
6
|
+
project: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
release: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolveSentrySourceMapUploadConfig(env?: Record<string, string | undefined>): SentrySourceMapUploadConfig | null;
|
|
11
|
+
export declare function isSentrySourceMapUploadEnabled(env?: Record<string, string | undefined>): boolean;
|
|
12
|
+
export declare function createSentrySourceMapUploadPlugin(env?: Record<string, string | undefined>): Plugin[];
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The release name here MUST match what `client/analytics.ts` sends as
|
|
3
|
+
* `event.release` at runtime, or uploaded source maps never resolve against
|
|
4
|
+
* captured events. Both derive it from the same `resolveAgentNativeBuildId()`
|
|
5
|
+
* identifier so they can't drift apart independently.
|
|
6
|
+
*/
|
|
7
|
+
import { readdir, rm } from "node:fs/promises";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
|
10
|
+
import { resolveAgentNativeBuildId } from "../shared/build-id.js";
|
|
11
|
+
function firstNonEmpty(...values) {
|
|
12
|
+
for (const value of values) {
|
|
13
|
+
const trimmed = value?.trim();
|
|
14
|
+
if (trimmed)
|
|
15
|
+
return trimmed;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
export function resolveSentryClientRelease(env) {
|
|
20
|
+
return `agent-native-client@${resolveAgentNativeBuildId(env, "development")}`;
|
|
21
|
+
}
|
|
22
|
+
// A token alone can't safely guess org/project, and a half-configured plugin
|
|
23
|
+
// would fail every build rather than cleanly no-op.
|
|
24
|
+
export function resolveSentrySourceMapUploadConfig(env = process.env) {
|
|
25
|
+
const authToken = firstNonEmpty(env.SENTRY_AUTH_TOKEN);
|
|
26
|
+
if (!authToken)
|
|
27
|
+
return null;
|
|
28
|
+
const org = firstNonEmpty(env.SENTRY_ORG, env.SENTRY_ORG_SLUG);
|
|
29
|
+
// SENTRY_PROJECT_ID is the numeric DSN project id used elsewhere in this
|
|
30
|
+
// repo (sentry-config.ts) — not a valid value for the plugin's `project`
|
|
31
|
+
// option, which wants the project slug. Passing the numeric id would
|
|
32
|
+
// silently target the wrong project instead of cleanly no-oping.
|
|
33
|
+
const project = firstNonEmpty(env.SENTRY_PROJECT, env.SENTRY_CLIENT_PROJECT);
|
|
34
|
+
if (!org || !project)
|
|
35
|
+
return null;
|
|
36
|
+
return {
|
|
37
|
+
authToken,
|
|
38
|
+
org,
|
|
39
|
+
project,
|
|
40
|
+
url: firstNonEmpty(env.SENTRY_URL),
|
|
41
|
+
release: resolveSentryClientRelease(env),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function isSentrySourceMapUploadEnabled(env = process.env) {
|
|
45
|
+
return resolveSentrySourceMapUploadConfig(env) !== null;
|
|
46
|
+
}
|
|
47
|
+
async function removeSourceMaps(directory) {
|
|
48
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
49
|
+
await Promise.all(entries.map(async (entry) => {
|
|
50
|
+
const filePath = path.join(directory, entry.name);
|
|
51
|
+
if (entry.isDirectory()) {
|
|
52
|
+
await removeSourceMaps(filePath);
|
|
53
|
+
}
|
|
54
|
+
else if (entry.name.endsWith(".map")) {
|
|
55
|
+
await rm(filePath, { force: true });
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
function createUploadedSourceMapCleanupPlugin() {
|
|
60
|
+
return {
|
|
61
|
+
name: "agent-native:delete-uploaded-sentry-source-maps",
|
|
62
|
+
enforce: "post",
|
|
63
|
+
writeBundle: {
|
|
64
|
+
order: "post",
|
|
65
|
+
sequential: true,
|
|
66
|
+
async handler(outputOptions) {
|
|
67
|
+
if (outputOptions.dir) {
|
|
68
|
+
await removeSourceMaps(outputOptions.dir);
|
|
69
|
+
}
|
|
70
|
+
else if (outputOptions.file) {
|
|
71
|
+
await rm(`${outputOptions.file}.map`, { force: true });
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// Safe to always include in the plugins array regardless of `vite build` vs
|
|
78
|
+
// `vite dev` — `@sentry/vite-plugin`'s hooks only act during a real Rollup
|
|
79
|
+
// build.
|
|
80
|
+
export function createSentrySourceMapUploadPlugin(env = process.env) {
|
|
81
|
+
const config = resolveSentrySourceMapUploadConfig(env);
|
|
82
|
+
if (!config)
|
|
83
|
+
return [];
|
|
84
|
+
const uploadPlugins = sentryVitePlugin({
|
|
85
|
+
org: config.org,
|
|
86
|
+
project: config.project,
|
|
87
|
+
authToken: config.authToken,
|
|
88
|
+
url: config.url,
|
|
89
|
+
telemetry: false,
|
|
90
|
+
release: {
|
|
91
|
+
// inject: false — client/analytics.ts already sets `release` itself;
|
|
92
|
+
// letting the plugin also inject its own git-SHA-based release would
|
|
93
|
+
// create a second, divergent source of truth for the same field.
|
|
94
|
+
name: config.release,
|
|
95
|
+
inject: false,
|
|
96
|
+
},
|
|
97
|
+
// Sentry's built-in filesToDeleteAfterUpload runs in a finally block, even
|
|
98
|
+
// after a failed upload. Throw here so the build cannot publish an artifact
|
|
99
|
+
// whose maps were neither uploaded nor intentionally retained.
|
|
100
|
+
errorHandler: (error) => {
|
|
101
|
+
throw error;
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
return [...uploadPlugins, createUploadedSourceMapCleanupPlugin()];
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.178.
|
|
3
|
+
"version": "0.178.1-nightly-20260909201829",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -399,6 +399,7 @@
|
|
|
399
399
|
"@rrweb/record": "2.1.0",
|
|
400
400
|
"@sentry/browser": "10.60.0",
|
|
401
401
|
"@sentry/node": "10.60.0",
|
|
402
|
+
"@sentry/vite-plugin": "5.4.0",
|
|
402
403
|
"@shadcn/react": "^0.2.0",
|
|
403
404
|
"@standard-schema/spec": "^1.1.0",
|
|
404
405
|
"@tanstack/react-table": "^8.21.3",
|