@agent-native/core 0.0.0-beta-20260820023157 → 0.0.0-beta-20260820052446

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.
@@ -1,6 +1,5 @@
1
1
  import type { AgentNativeDeploymentEnvironment, AgentNativeConfig } from "../config.js";
2
- export declare const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
- export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
2
+ export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
4
3
  export declare function isBuilderIoEmployee(email: string | null | undefined): boolean;
5
4
  export declare function resolveEnvironmentChannel(config: AgentNativeConfig, hostname: string | undefined): Extract<AgentNativeDeploymentEnvironment, "beta" | "production"> | null;
6
5
  export declare function isBetaOptOutActive(value: string | number | null | undefined, now?: number): boolean;
@@ -2,12 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "@agent-native/toolkit/ui/button";
3
3
  import { Popover, PopoverContent, PopoverTrigger, } from "@agent-native/toolkit/ui/popover";
4
4
  import { useEffect, useMemo, useRef } from "react";
5
- import { BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
5
+ import { BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
6
6
  import { trackEvent } from "./analytics.js";
7
7
  import { injectedAgentNativeConfig } from "./app-config.js";
8
8
  import { useSession } from "./use-session.js";
9
- export const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
10
- export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
9
+ export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
11
10
  export function isBuilderIoEmployee(email) {
12
11
  return email?.trim().toLowerCase().endsWith("@builder.io") ?? false;
13
12
  }
@@ -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;
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- error: string;
17
16
  ok?: undefined;
17
+ error: string;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -224,6 +224,13 @@ export declare function emitSingleTemplateNetlifyBackgroundFunction(projectCwd:
224
224
  */
225
225
  export declare function assertEmittedBackgroundFunctionOnDisk(destDir: string, functionName: string): void;
226
226
  export declare function emitSingleTemplateNetlifyIntegrationRecoveryFunction(projectCwd: string): void;
227
+ /**
228
+ * A host-side prebuilt Netlify output can accidentally carry the native
229
+ * better-sqlite3 binary from the developer's machine. Netlify functions run
230
+ * on Linux, so fail before publication unless every copied binary is an ELF
231
+ * object produced by the Linux build.
232
+ */
233
+ export declare function findNonLinuxBetterSqlite3Binaries(serverDir: string): string[];
227
234
  /**
228
235
  * Nitro receives the React Router SSR build as prebuilt chunks, so its normal
229
236
  * dependency resolver cannot reliably fold the preserved bare `yjs` imports
@@ -2996,6 +2996,51 @@ function walkServerJavaScriptFiles(dir, onFile) {
2996
2996
  onFile(entryPath);
2997
2997
  }
2998
2998
  }
2999
+ /**
3000
+ * A host-side prebuilt Netlify output can accidentally carry the native
3001
+ * better-sqlite3 binary from the developer's machine. Netlify functions run
3002
+ * on Linux, so fail before publication unless every copied binary is an ELF
3003
+ * object produced by the Linux build.
3004
+ */
3005
+ export function findNonLinuxBetterSqlite3Binaries(serverDir) {
3006
+ const failures = [];
3007
+ const walk = (dir) => {
3008
+ if (!fs.existsSync(dir))
3009
+ return;
3010
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
3011
+ const entryPath = path.join(dir, entry.name);
3012
+ if (entry.isDirectory()) {
3013
+ walk(entryPath);
3014
+ continue;
3015
+ }
3016
+ if (entry.name !== "better_sqlite3.node")
3017
+ continue;
3018
+ const normalizedPath = entryPath.split(path.sep).join("/");
3019
+ if (!normalizedPath.includes("/node_modules/better-sqlite3/build/Release/better_sqlite3.node")) {
3020
+ continue;
3021
+ }
3022
+ const header = fs.readFileSync(entryPath).subarray(0, 20);
3023
+ const isLittleEndian = header[5] === 1;
3024
+ const machine = header.length >= 20 && header[5] === 1
3025
+ ? header.readUInt16LE(18)
3026
+ : header.length >= 20 && header[5] === 2
3027
+ ? header.readUInt16BE(18)
3028
+ : null;
3029
+ if (header.length < 20 ||
3030
+ header[0] !== 0x7f ||
3031
+ header[1] !== 0x45 ||
3032
+ header[2] !== 0x4c ||
3033
+ header[3] !== 0x46 ||
3034
+ header[4] !== 2 ||
3035
+ !isLittleEndian ||
3036
+ machine !== 62) {
3037
+ failures.push(entryPath);
3038
+ }
3039
+ }
3040
+ };
3041
+ walk(serverDir);
3042
+ return failures;
3043
+ }
2999
3044
  /**
3000
3045
  * Nitro receives the React Router SSR build as prebuilt chunks, so its normal
3001
3046
  * dependency resolver cannot reliably fold the preserved bare `yjs` imports
@@ -3242,6 +3287,12 @@ export function assertSingleTemplateNetlifyBuildOutput(projectCwd) {
3242
3287
  if (privateYjsImports.length > 0) {
3243
3288
  failures.push(`Netlify server bundle imports Nitro's internal tree-shaken _libs/yjs.mjs: ${privateYjsImports.join(", ")}`);
3244
3289
  }
3290
+ const nonLinuxBetterSqlite3Binaries = findNonLinuxBetterSqlite3Binaries(serverDir);
3291
+ if (nonLinuxBetterSqlite3Binaries.length > 0) {
3292
+ failures.push(`Netlify server bundle contains non-Linux better-sqlite3 native binaries: ${nonLinuxBetterSqlite3Binaries
3293
+ .map((filePath) => path.relative(projectCwd, filePath))
3294
+ .join(", ")}; build in Netlify's Linux environment instead of uploading a host-native prebuilt output`);
3295
+ }
3245
3296
  // React Router's filesystem route discovery can accidentally treat a
3246
3297
  // co-located *.test.ts route as production code. That bundles Vitest into
3247
3298
  // SSR and only fails when the first request executes the test helpers.
@@ -13,13 +13,13 @@
13
13
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
14
14
  count: number;
15
15
  updated?: undefined;
16
- ok?: undefined;
17
16
  error?: undefined;
17
+ ok?: undefined;
18
18
  } | {
19
19
  count?: undefined;
20
20
  updated: number;
21
- ok?: undefined;
22
21
  error?: undefined;
22
+ ok?: undefined;
23
23
  } | {
24
24
  count?: undefined;
25
25
  updated?: undefined;
@@ -28,6 +28,6 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
28
28
  } | {
29
29
  count?: undefined;
30
30
  updated?: undefined;
31
- ok: boolean;
32
31
  error?: undefined;
32
+ ok: boolean;
33
33
  }>>;
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- ok?: undefined;
45
44
  error?: undefined;
45
+ ok?: undefined;
46
46
  summary: import("./types.js").TraceSummary;
47
47
  spans: import("./types.js").TraceSpan[];
48
48
  id?: undefined;
49
49
  } | {
50
- ok?: undefined;
51
50
  error?: undefined;
51
+ ok?: undefined;
52
52
  summary?: undefined;
53
53
  spans?: undefined;
54
54
  id: string;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- ok: boolean;
19
18
  error?: undefined;
19
+ ok: boolean;
20
20
  }>>;
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
51
51
  error: string;
52
52
  ok?: undefined;
53
53
  } | {
54
- ok: boolean;
55
54
  error?: undefined;
55
+ ok: boolean;
56
56
  }>;
57
57
  /** POST /_agent-native/resources/upload — upload a file as a resource */
58
58
  export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
73
73
  runId: string | null;
74
74
  expiresAt: number | null;
75
75
  metadata: string | null;
76
+ error?: undefined;
76
77
  url: string;
77
78
  provider: string;
78
79
  storageSetupRequired?: undefined;
79
- error?: undefined;
80
80
  } | {
81
81
  error: string;
82
82
  storageSetupRequired: boolean;
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- status?: undefined;
38
37
  ok?: undefined;
38
+ status?: undefined;
39
39
  } | {
40
+ error?: undefined;
40
41
  ok: boolean;
41
42
  status: string;
42
- error?: undefined;
43
43
  } | {
44
+ ok?: undefined;
44
45
  error: string;
45
46
  removed?: undefined;
46
- ok?: undefined;
47
47
  } | {
48
+ error?: undefined;
48
49
  ok: boolean;
49
50
  removed: boolean;
50
- error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
+ ok?: undefined;
57
58
  error: string;
58
59
  note?: undefined;
59
- ok?: undefined;
60
60
  } | {
61
+ error?: undefined;
61
62
  ok: boolean;
62
63
  note?: undefined;
63
- error?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  ok: boolean;
66
67
  note: string;
67
- error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
+ error?: undefined;
98
99
  ok: boolean;
99
100
  key: string;
100
- error?: undefined;
101
101
  } | {
102
+ error?: undefined;
102
103
  ok: boolean;
103
104
  removed: boolean;
104
- error?: undefined;
105
105
  }>>;
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
27
27
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
28
28
  error: any;
29
29
  } | {
30
+ error?: undefined;
30
31
  ok: boolean;
31
32
  key: string;
32
33
  baseUrlKey?: string;
33
34
  scope: AgentEngineApiKeyScope;
34
- error?: undefined;
35
35
  }>>;
36
36
  export {};
@@ -11,7 +11,7 @@ import { getLocaleInitScript } from "../localization/server.js";
11
11
  import { DEFAULT_LOCALE, LOCALE_METADATA, LOCALE_STORAGE_KEY, SUPPORTED_LOCALES, localeDisplayName, } from "../localization/shared.js";
12
12
  import { NATIVE_AUTH_COPY } from "../shared/auth-copy.js";
13
13
  import { docsUrl } from "../shared/docs-url.js";
14
- import { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, ENVIRONMENT_BETA_HOSTS, } from "../shared/environment-lanes.js";
14
+ import { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, ENVIRONMENT_BETA_HOSTS, } from "../shared/environment-lanes.js";
15
15
  import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, } from "../shared/password-policy.js";
16
16
  import { signInJourneyInlineScript } from "../shared/sign-in-journey.js";
17
17
  import { AGENT_NATIVE_SOCIAL_IMAGE_ALT, AGENT_NATIVE_SOCIAL_IMAGE_HEIGHT, AGENT_NATIVE_SOCIAL_IMAGE_PATH, AGENT_NATIVE_SOCIAL_IMAGE_TYPE, AGENT_NATIVE_SOCIAL_IMAGE_WIDTH, withAgentNativeSocialImageCacheBuster, } from "../shared/social-meta.js";
@@ -1433,6 +1433,34 @@ ${marketing.description ? ` <p class="app-desc" data-marketing-field="descr
1433
1433
  if (!switcher || !button || !popover || !productionLink) return;
1434
1434
  if (window.parent !== window) return;
1435
1435
 
1436
+ // Persist the beta opt-out before authentication replaces this cached shell.
1437
+ try {
1438
+ var optOutUrl = new URL(window.location.href);
1439
+ var optOutValue = optOutUrl.searchParams.get(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
1440
+ if (optOutValue !== null) {
1441
+ var optOutExpiry = Number(optOutValue);
1442
+ var optOutIsActive = Number.isFinite(optOutExpiry) && optOutExpiry > Date.now();
1443
+ var optOutStorageReady = false;
1444
+ try {
1445
+ if (optOutIsActive) {
1446
+ window.localStorage.setItem(
1447
+ ${JSON.stringify(BETA_OPT_OUT_STORAGE_KEY)},
1448
+ String(optOutExpiry),
1449
+ );
1450
+ }
1451
+ optOutStorageReady = true;
1452
+ } catch (error) {
1453
+ void error;
1454
+ }
1455
+ if (optOutStorageReady) {
1456
+ optOutUrl.searchParams.delete(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
1457
+ window.history.replaceState(null, '', optOutUrl.toString());
1458
+ }
1459
+ }
1460
+ } catch (error) {
1461
+ void error;
1462
+ }
1463
+
1436
1464
  var betaHosts = ${JSON.stringify(ENVIRONMENT_BETA_HOSTS)};
1437
1465
  var hostname = (window.location.hostname || '').toLowerCase().replace(/\\.$/, '');
1438
1466
  var productionHost = hostname.indexOf('beta.') === 0 ? hostname.slice(5) : '';
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  token: string;
30
31
  expiresAt: string;
31
32
  ttlSeconds: number;
32
- error?: undefined;
33
33
  }>>;
@@ -1,5 +1,6 @@
1
1
  export declare const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
2
2
  export declare const BETA_OPT_OUT_DURATION_MS: number;
3
+ export declare const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
4
  export declare const ENVIRONMENT_BETA_HOSTS: {
4
5
  readonly "agent-workspace.builder.io": "beta.agent-workspace.builder.io";
5
6
  readonly "analytics.agent-native.com": "beta.analytics.agent-native.com";
@@ -1,5 +1,6 @@
1
1
  export const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
2
2
  export const BETA_OPT_OUT_DURATION_MS = 24 * 60 * 60 * 1000;
3
+ export const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
4
  export const ENVIRONMENT_BETA_HOSTS = {
4
5
  "agent-workspace.builder.io": "beta.agent-workspace.builder.io",
5
6
  "analytics.agent-native.com": "beta.analytics.agent-native.com",
@@ -93,13 +93,13 @@ configuration portion of `agent-native.json`:
93
93
  | `runtime.auth.enabled` | `boolean` | Declares whether the app expects the framework or a custom authentication layer. |
94
94
  | `runtime.database.required` | `boolean` | Declares whether production needs a persistent remote SQL database. |
95
95
  | `runtime.environment.required` | `string[]` | Declares additional required environment variable names. Names must match `[A-Za-z_][A-Za-z0-9_]*`; values do not belong in the config. |
96
- | `deployment.environment` | `"local"`, `"beta"`, `"production"`, or `"preview"` | Records the release lane that produced the current client bundle. |
96
+ | `deployment.environment` | `"local"`, `"beta"`, `"production"`, or `"preview"` | Records the release lane that produced the current client bundle. |
97
97
  | `diagnostics.failOnBuild` | `boolean` | When `true`, a production Vite build throws on runtime configuration issues. When absent or `false`, it reports them without failing the build. |
98
98
  | `instructions.runtime` | `string` | Optional relative Markdown path for the in-app runtime agent. Defaults to `AGENTS.md`. |
99
99
  | `instructions.development` | `string` | Optional relative Markdown path for development/coding agents. Defaults to `AGENTS.md`. |
100
- | `translations.locales` | `string[]` | Lists the locales the app intentionally ships. `en-US` remains the source locale. |
101
- | `changelog.enabled` | `boolean` | Enables the app changelog workflow and lets agents create user-facing entries. |
102
- | `harness` | `boolean` or `{ runtimes: string[] }` | Enables the hosted tools-only harness, optionally narrowed to `claude-code`, `codex`, `pi`, or `opencode`. See [Harness Agents](/docs/harness-agents). |
100
+ | `translations.locales` | `string[]` | Lists the locales the app intentionally ships. `en-US` remains the source locale. |
101
+ | `changelog.enabled` | `boolean` | Enables the app changelog workflow and lets agents create user-facing entries. |
102
+ | `harness` | `boolean` or `{ runtimes: string[] }` | Enables the hosted tools-only harness, optionally narrowed to `claude-code`, `codex`, `pi`, or `opencode`. See [Harness Agents](/docs/harness-agents). |
103
103
 
104
104
  ## Configuration vs environment variables
105
105
 
@@ -107,11 +107,11 @@ Use the config file or JSON manifest for stable, non-secret application
107
107
  defaults. Use environment variables or the scoped secret store for values that
108
108
  belong to a deployment or a user or organization connection:
109
109
 
110
- | Put it in | Examples | Notes |
111
- | --------- | -------- | ----- |
112
- | `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`. |
113
- | Deployment environment variables | `DATABASE_URL`, `BETTER_AUTH_SECRET`, `APP_URL`, `NITRO_PRESET`, provider keys, host-specific toggles | Set by the deployment platform or local `.env`. Keep secret values out of source control. See [Environment Variables](/docs/environment-variables). |
114
- | `runtime.environment.required` | `"PUBLIC_API_ORIGIN"`, `"STRIPE_PUBLISHABLE_KEY"` | A declaration of names the production readiness check must find. It does not set, expose, or replace the values. |
110
+ | Put it in | Examples | Notes |
111
+ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
112
+ | `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`. |
113
+ | Deployment environment variables | `DATABASE_URL`, `BETTER_AUTH_SECRET`, `APP_URL`, `NITRO_PRESET`, provider keys, host-specific toggles | Set by the deployment platform or local `.env`. Keep secret values out of source control. See [Environment Variables](/docs/environment-variables). |
114
+ | `runtime.environment.required` | `"PUBLIC_API_ORIGIN"`, `"STRIPE_PUBLISHABLE_KEY"` | A declaration of names the production readiness check must find. It does not set, expose, or replace the values. |
115
115
 
116
116
  For example, keep the app's public policy in the config file and inject the
117
117
  actual deployment values separately:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.0.0-beta-20260820023157",
3
+ "version": "0.0.0-beta-20260820052446",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {