@agent-native/core 0.170.0 → 0.171.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/dist/app-config/auth.d.ts +1 -0
- package/dist/app-config/auth.js +7 -0
- package/dist/app-config/schema.d.ts +1 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/better-auth-instance.js +14 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/vite/client.js +9 -2
- package/docs/content/authentication.mdx +40 -21
- package/docs/content/environment-variables.mdx +1 -0
- package/package.json +1 -1
package/dist/app-config/auth.js
CHANGED
|
@@ -4,4 +4,11 @@ export const authConfig = z.object({
|
|
|
4
4
|
env: "AGENT_NATIVE_DISABLE_DESKTOP_SSO_FALLBACK",
|
|
5
5
|
doc: "Disable the loopback Desktop SSO fallback in development so isolated acceptance runs can use their configured local identity. Ignored in production.",
|
|
6
6
|
}),
|
|
7
|
+
// Deliberately optional rather than defaulted: unset means "derive from the
|
|
8
|
+
// deployment", which is not a boolean. A default here would erase the
|
|
9
|
+
// difference between an operator who chose a policy and one who never spoke.
|
|
10
|
+
requireEmailVerification: z.boolean().optional().meta({
|
|
11
|
+
env: "AUTH_REQUIRE_EMAIL_VERIFICATION",
|
|
12
|
+
doc: "Whether password signup must verify the email address before it gets a session. Unset derives it: hosted deployments require it, local development skips it. Setting it false accepts an unverified email as a login credential, including in production.",
|
|
13
|
+
}),
|
|
7
14
|
});
|
|
@@ -38,6 +38,7 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>>;
|
|
39
39
|
auth: z.ZodPrefault<z.ZodObject<{
|
|
40
40
|
disableDesktopSsoFallbackInDevelopment: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
requireEmailVerification: z.ZodOptional<z.ZodBoolean>;
|
|
41
42
|
}, z.core.$strip>>;
|
|
42
43
|
integrations: z.ZodPrefault<z.ZodObject<{
|
|
43
44
|
allowUnverifiedWebhooks: z.ZodDefault<z.ZodBoolean>;
|
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
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
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;
|
|
@@ -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,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
summary: import("./types.js").TraceSummary;
|
|
46
45
|
spans: import("./types.js").TraceSpan[];
|
|
47
46
|
id?: undefined;
|
|
47
|
+
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
summary?: undefined;
|
|
52
51
|
spans?: undefined;
|
|
53
52
|
id: string;
|
|
53
|
+
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
65
|
+
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
|
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
|
|
|
51
51
|
error: string;
|
|
52
52
|
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
|
-
error?: undefined;
|
|
55
54
|
ok: boolean;
|
|
55
|
+
error?: undefined;
|
|
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;
|
|
77
76
|
url: string;
|
|
78
77
|
provider: string;
|
|
79
78
|
storageSetupRequired?: undefined;
|
|
79
|
+
error?: undefined;
|
|
80
80
|
} | {
|
|
81
81
|
error: string;
|
|
82
82
|
storageSetupRequired: boolean;
|
|
@@ -14,6 +14,7 @@ import { jwt } from "better-auth/plugins/jwt";
|
|
|
14
14
|
import { magicLink } from "better-auth/plugins/magic-link";
|
|
15
15
|
import { pgTable, text as pgText, timestamp as pgTimestamp, boolean as pgBoolean, } from "drizzle-orm/pg-core";
|
|
16
16
|
import { sqliteTable, text as sqliteText, integer as sqliteInteger, } from "drizzle-orm/sqlite-core";
|
|
17
|
+
import { getAppConfig } from "../app-config/index.js";
|
|
17
18
|
import { TEMPLATES } from "../cli/templates-meta.js";
|
|
18
19
|
import { getDbExec, isPostgres } from "../db/client.js";
|
|
19
20
|
import { getDialect, getCloudflareD1Binding, getDatabaseUrl, getDatabaseAuthToken, closePgliteClients, getPgliteClient, isPgliteUrl, loadPgliteDrizzle, pgPoolOptions, neonPoolOptions, guardNeonPool, sharedDbPool, onSharedDbPoolsClosed, onSharedDbPoolReplaced, prepareLocalSqliteUrl, sqliteFilenameFromUrl, retrySqliteBusy, } from "../db/client.js";
|
|
@@ -266,6 +267,19 @@ export function isDeployPreview() {
|
|
|
266
267
|
return deployContext === "deploy-preview";
|
|
267
268
|
}
|
|
268
269
|
export function resolveEmailPasswordAuthPolicy(emailConfigured) {
|
|
270
|
+
const declared = getAppConfig().auth.requireEmailVerification;
|
|
271
|
+
if (declared !== undefined) {
|
|
272
|
+
// A declared policy is the whole policy — it outranks both the hosted
|
|
273
|
+
// derivation below and AUTH_SKIP_EMAIL_VERIFICATION. Choosing `false` is
|
|
274
|
+
// choosing to accept an unverified email as a login credential, so the
|
|
275
|
+
// signup lock that exists to prevent exactly that comes off with it.
|
|
276
|
+
return {
|
|
277
|
+
requireEmailVerification: declared && emailConfigured,
|
|
278
|
+
// Verification that no provider can deliver would strand every new
|
|
279
|
+
// account on an unverifiable signup, so refuse the signup instead.
|
|
280
|
+
disableSignUp: declared && !emailConfigured,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
269
283
|
const hosted = process.env.NODE_ENV === "production" || isDeployPreview();
|
|
270
284
|
return {
|
|
271
285
|
requireEmailVerification: emailConfigured && (hosted || !shouldSkipEmailVerification()),
|
package/dist/vite/client.js
CHANGED
|
@@ -2924,6 +2924,13 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
2924
2924
|
const forcePollingWatch = process.env.CHOKIDAR_USEPOLLING === "1";
|
|
2925
2925
|
const pollingWatchInterval = Number(process.env.CHOKIDAR_INTERVAL ?? 1000);
|
|
2926
2926
|
const userWatch = userConfig.server?.watch ?? {};
|
|
2927
|
+
// Vite 8 defines `rollupOptions` on `build`/`optimizeDeps` as a getter alias
|
|
2928
|
+
// of `rolldownOptions`. Spreading the section copies the alias as a plain own
|
|
2929
|
+
// property, so returning our own `rolldownOptions` alongside it makes the two
|
|
2930
|
+
// diverge and Vite warns that this plugin set both — then ignores the
|
|
2931
|
+
// `rollupOptions` half regardless. Drop the alias from what we spread back.
|
|
2932
|
+
const { rollupOptions: _buildRollupOptionsAlias, ...userBuild } = userConfig.build ?? {};
|
|
2933
|
+
const { rollupOptions: _depsRollupOptionsAlias, ...userOptimizeDeps } = userConfig.optimizeDeps ?? {};
|
|
2927
2934
|
return {
|
|
2928
2935
|
logLevel: options.logLevel ??
|
|
2929
2936
|
userConfig.logLevel ??
|
|
@@ -3013,7 +3020,7 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
3013
3020
|
},
|
|
3014
3021
|
},
|
|
3015
3022
|
build: {
|
|
3016
|
-
...
|
|
3023
|
+
...userBuild,
|
|
3017
3024
|
outDir: options.outDir ?? userConfig.build?.outDir ?? "dist/spa",
|
|
3018
3025
|
// Vite 8 defaults CSS minification to Lightning CSS, which collapses a
|
|
3019
3026
|
// `backdrop-filter` + `-webkit-backdrop-filter` pair down to only the
|
|
@@ -3096,7 +3103,7 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
3096
3103
|
],
|
|
3097
3104
|
},
|
|
3098
3105
|
optimizeDeps: {
|
|
3099
|
-
...
|
|
3106
|
+
...userOptimizeDeps,
|
|
3100
3107
|
include: [
|
|
3101
3108
|
...getDefaultOptimizeDeps(cwd),
|
|
3102
3109
|
...(hasDep("@agent-native/pinpoint", cwd)
|
|
@@ -210,6 +210,24 @@ verification and the signup verification email is not sent. It does not change
|
|
|
210
210
|
magic-link delivery. Use it only for QA or preview environments, and name test accounts with a `+qa` address
|
|
211
211
|
(`name+qa@example.com`) so they are easy to identify.
|
|
212
212
|
|
|
213
|
+
## Email Verification Policy {#email-verification-policy}
|
|
214
|
+
|
|
215
|
+
`AUTH_SKIP_EMAIL_VERIFICATION` is a local and QA convenience — a hosted
|
|
216
|
+
deployment ignores it. To state the policy for any environment, production
|
|
217
|
+
included, declare it in config:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
defineAppConfig({ auth: { requireEmailVerification: false } });
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The deployment alias is `AUTH_REQUIRE_EMAIL_VERIFICATION=0`. A declared value
|
|
224
|
+
outranks both `AUTH_SKIP_EMAIL_VERIFICATION` and the per-environment default.
|
|
225
|
+
|
|
226
|
+
`false` accepts an unverified address as a login credential — anyone can claim
|
|
227
|
+
any email — so use it only where signup is already restricted another way.
|
|
228
|
+
`true` on a deployment with no email provider disables password signup instead,
|
|
229
|
+
because the verification could never be delivered.
|
|
230
|
+
|
|
213
231
|
## Social Providers {#social-providers}
|
|
214
232
|
|
|
215
233
|
Set environment variables to enable social login. Better Auth auto-detects them:
|
|
@@ -477,27 +495,28 @@ The default `/_agent-native/google/auth-url` route does this automatically — o
|
|
|
477
495
|
|
|
478
496
|
## Environment Variables {#environment-variables}
|
|
479
497
|
|
|
480
|
-
| Variable | Purpose
|
|
481
|
-
| --------------------------------------- |
|
|
482
|
-
| `BETTER_AUTH_SECRET` | Signing key for Better Auth (auto-generated if not set)
|
|
483
|
-
| `AUTH_SKIP_EMAIL_VERIFICATION` | Set to `1` in QA/preview environments to let password-fallback signups proceed without verification; local dev/test skips by default
|
|
484
|
-
| `
|
|
485
|
-
| `
|
|
486
|
-
| `
|
|
487
|
-
| `
|
|
488
|
-
| `
|
|
489
|
-
| `
|
|
490
|
-
| `
|
|
491
|
-
| `
|
|
492
|
-
| `
|
|
493
|
-
| `
|
|
494
|
-
| `
|
|
495
|
-
| `
|
|
496
|
-
| `
|
|
497
|
-
| `
|
|
498
|
-
| `
|
|
499
|
-
| `
|
|
500
|
-
| `
|
|
498
|
+
| Variable | Purpose |
|
|
499
|
+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
500
|
+
| `BETTER_AUTH_SECRET` | Signing key for Better Auth (auto-generated if not set) |
|
|
501
|
+
| `AUTH_SKIP_EMAIL_VERIFICATION` | Set to `1` in QA/preview environments to let password-fallback signups proceed without verification; local dev/test skips by default |
|
|
502
|
+
| `AUTH_REQUIRE_EMAIL_VERIFICATION` | Set to `0` or `1` to declare the password-signup verification policy for any environment, production included; outranks `AUTH_SKIP_EMAIL_VERIFICATION` |
|
|
503
|
+
| `AUTH_MAGIC_LINK` | Set to `0`, `false`, or `off` to force the email/password fallback even when outbound email is ready |
|
|
504
|
+
| `AUTH_DISABLED` | Set to `true` or `1` to skip login/signup; all requests run as one shared user (local dev/preview only — not for production with real users) |
|
|
505
|
+
| `AGENT_NATIVE_DISABLE_AUTO_DEV_ACCOUNT` | Set to `1` to disable localhost auto-sign-in on a fresh dev database |
|
|
506
|
+
| `AUTH_MODE` | `local` resolves CLI/agent identity only (which dev user `pnpm action` runs as); never a browser login bypass |
|
|
507
|
+
| `COOKIE_DOMAIN` | Opt into shared session cookies across same-database subdomains (see [Cookie Realms](#cookie-realms)) |
|
|
508
|
+
| `AGENT_NATIVE_WORKSPACE` | `1` runs in workspace mode — one shared session realm across workspace apps |
|
|
509
|
+
| `AGENT_NATIVE_SHARE_COOKIE_DOMAIN` | Set with `COOKIE_DOMAIN` to share one auth database across first-party subdomains |
|
|
510
|
+
| `OAUTH_STATE_SECRET` | Dedicated HMAC key for OAuth state envelopes (see [Security — OAuth State Signing](/docs/security#oauth-state)) |
|
|
511
|
+
| `GOOGLE_SIGN_IN_CLIENT_ID` | Preferred low-scope Google OAuth client ID for app login |
|
|
512
|
+
| `GOOGLE_SIGN_IN_CLIENT_SECRET` | Preferred low-scope Google OAuth secret for app login |
|
|
513
|
+
| `GOOGLE_CLIENT_ID` | Legacy Google login fallback, and provider OAuth client ID for Google API integrations |
|
|
514
|
+
| `GOOGLE_CLIENT_SECRET` | Legacy Google login fallback, and provider OAuth secret for Google API integrations |
|
|
515
|
+
| `GITHUB_CLIENT_ID` | Enable GitHub OAuth |
|
|
516
|
+
| `GITHUB_CLIENT_SECRET` | GitHub OAuth secret |
|
|
517
|
+
| `ACCESS_TOKEN` | Static bearer fallback for MCP/connect clients; not browser auth |
|
|
518
|
+
| `ACCESS_TOKENS` | Comma-separated static bearer fallbacks for MCP/connect clients; not browser auth |
|
|
519
|
+
| `A2A_SECRET` | Shared secret for JWT-signed A2A cross-app identity verification and, when present, MCP OAuth access-token signing |
|
|
501
520
|
|
|
502
521
|
## What's next
|
|
503
522
|
|
|
@@ -87,6 +87,7 @@ public app behavior, use the config paths above instead.
|
|
|
87
87
|
| `AUTH_DISABLED` | Disables auth for local or preview-only work. Unset already means false. | `true` or `1`; never use on a public production app. |
|
|
88
88
|
| `AUTH_MAGIC_LINK` | Controls the password-first versus magic-link sign-in path. | `0` keeps password-first sign-in; otherwise a configured email transport can enable magic links. |
|
|
89
89
|
| `AUTH_SKIP_EMAIL_VERIFICATION` | Skips signup email verification for local QA or previews. | `1`; never use it to weaken production auth. |
|
|
90
|
+
| `AUTH_REQUIRE_EMAIL_VERIFICATION` | Declares whether password signup must verify the email address, in any environment. | `0` or `1`; outranks `AUTH_SKIP_EMAIL_VERIFICATION`. `0` accepts an unverified address as a login credential. |
|
|
90
91
|
| `ACCESS_TOKEN` / `ACCESS_TOKENS` | Static bearer fallback for MCP and Connect clients. | One token or a delimited token list; these are not browser auth. |
|
|
91
92
|
| `AGENT_PROD_CODE_EXECUTION` | Production code-execution policy. | `off`, `sandboxed`, or `trusted`. See [Production Code Execution](/docs/actions-agent-tools#production-code-execution). |
|
|
92
93
|
| `AGENT_NATIVE_SSR_CACHE` | Deployment-wide public SSR shell cache policy. | Unset/`on`, `off`, or a duration such as `30s` or `5m`. See [SSR Caching](/docs/ssr-caching). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.171.0",
|
|
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": {
|