@agent-native/core 0.228.2 → 0.229.0-nightly-20261113212325

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.
@@ -13,6 +13,6 @@ export declare function getBuilderSignupAssignment(): Promise<BuilderSignupAssig
13
13
  export declare function acceptBuilderSignupAssignment(assignmentId: string, attemptId: string, method: "password" | "magic-link" | "google", email?: string): Promise<void>;
14
14
  export declare function getBuilderSignupActivationStatus(): Promise<"eligible" | "disabled">;
15
15
  /** Starts only a consented, server-verified assignment; otherwise does nothing. */
16
- export declare function startBuilderSignupActivation(): Promise<"eligible" | "disabled">;
16
+ export declare function startBuilderSignupActivation(): Promise<"eligible" | "connected" | "disabled">;
17
17
  export declare function activateBuilderSignupAssignment(): Promise<"connected" | "fallback" | "disabled">;
18
18
  export declare function hasPendingBuilderSignupAssignment(): boolean;
@@ -63,7 +63,10 @@ export async function getBuilderSignupActivationStatus() {
63
63
  }
64
64
  /** Starts only a consented, server-verified assignment; otherwise does nothing. */
65
65
  export async function startBuilderSignupActivation() {
66
- return activationEligibility(await request({ operation: "start" }), "start");
66
+ const result = await request({ operation: "start" });
67
+ if (result.status === "connected")
68
+ return "connected";
69
+ return activationEligibility(result, "start");
67
70
  }
68
71
  export async function activateBuilderSignupAssignment() {
69
72
  const deadline = Date.now() + 30000;
@@ -1,17 +1,17 @@
1
1
  {
2
- "@agent-native/agentkit": "0.228.2",
2
+ "@agent-native/agentkit": "0.229.0-nightly-20261113212325",
3
3
  "@agent-native/code-agents-ui": "0.1.75",
4
- "@agent-native/core": "0.228.2",
5
- "@agent-native/core-corpus": "0.228.2",
4
+ "@agent-native/core": "0.229.0-nightly-20261113212325",
5
+ "@agent-native/core-corpus": "0.229.0-nightly-20261113212325",
6
6
  "@agent-native/creative-context": "0.8.72",
7
- "@agent-native/dispatch": "0.42.7",
7
+ "@agent-native/dispatch": "0.42.8-nightly-20261113212325",
8
8
  "@agent-native/embedding": "0.2.0",
9
9
  "@agent-native/migrate": "0.0.7",
10
10
  "@agent-native/otel": "0.1.39",
11
11
  "@agent-native/pinpoint": "0.1.115",
12
12
  "@agent-native/recap-cli": "0.5.103",
13
- "@agent-native/scheduling": "0.2.59",
13
+ "@agent-native/scheduling": "0.2.60-nightly-20261113212325",
14
14
  "@agent-native/shared-app-config": "0.1.2",
15
- "@agent-native/skills": "0.4.7",
16
- "@agent-native/toolkit": "0.228.2"
15
+ "@agent-native/skills": "0.4.8-nightly-20261113212325",
16
+ "@agent-native/toolkit": "0.229.0-nightly-20261113212325"
17
17
  }
@@ -85,6 +85,7 @@ export declare function resolveIdentityColumns(rows: readonly Record<string, unk
85
85
  */
86
86
  export declare function sessionUserColumn(sessionColumns: ReadonlySet<string>): "user_id" | "userId" | null;
87
87
  export declare function assertIdentityColumnRows(rows: readonly Record<string, unknown>[]): IdentityColumn[];
88
+ export declare const IDENTITY_SCHEMA_COLUMNS_QUERY: import("../db/sql.js").SqlFragment;
88
89
  export declare function assertIdentityColumnsRegistered(db: IdentityRekeyDb): Promise<IdentityColumn[]>;
89
90
  export interface IdentityRekeyResult {
90
91
  counts: Record<string, number>;
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { jwtVerify } from "jose";
3
3
  import { AGENT_AUDIT_LOG_CREATE_SQL } from "../audit/store.js";
4
+ import { sql } from "../db/sql.js";
4
5
  import { decryptSecretValue, encryptSecretValue, isEncryptedSecretValue, } from "../secrets/crypto.js";
5
6
  import { createTtlCache } from "../shared/ttl-cache.js";
6
7
  import { IDENTITY_RETIRED_EMAILS_CREATE_SQL, identityCredentialLockKey, } from "./retired-emails.js";
@@ -397,10 +398,13 @@ export function sessionUserColumn(sessionColumns) {
397
398
  export function assertIdentityColumnRows(rows) {
398
399
  return resolveIdentityColumns(rows);
399
400
  }
401
+ export const IDENTITY_SCHEMA_COLUMNS_QUERY = sql `
402
+ SELECT table_name, column_name FROM information_schema.columns
403
+ WHERE table_schema = 'public'
404
+ ORDER BY table_name, column_name
405
+ `;
400
406
  export async function assertIdentityColumnsRegistered(db) {
401
- const rows = await db.unsafe(`SELECT table_name, column_name FROM information_schema.columns
402
- WHERE table_schema = 'public'
403
- ORDER BY table_name, column_name`);
407
+ const rows = await db.unsafe(IDENTITY_SCHEMA_COLUMNS_QUERY.sql);
404
408
  return resolveIdentityColumns(rows);
405
409
  }
406
410
  const quote = (value) => {
@@ -222,7 +222,7 @@ async function handleMcpRequestInternal(event, config, routePath, approvalRoute,
222
222
  const ownerEmailHeader = getRequestHeader(event, "x-agent-native-owner-email");
223
223
  const requestMeta = deriveRequestMeta(event);
224
224
  const requestOrigin = getRequestHeader(event, "origin");
225
- const directLocalRequest = isDirectLoopbackRequest(event) &&
225
+ const directLocalRequest = isDirectLoopbackRequest(event, { behindDevProxy: true }) &&
226
226
  (requestOrigin === undefined || requestOrigin === requestMeta.origin);
227
227
  const localOwnerHint = directLocalRequest ? ownerEmailHeader : undefined;
228
228
  const hasLocalOwnerHint = Boolean(localOwnerHint?.trim());
@@ -1,3 +1,4 @@
1
+ import type { DbExec } from "../db/client.js";
1
2
  export type { OrgRole, OrgContext, OrgSummary, OrgInvitationSummary, OrgPendingRemoval, OrgInfo, OrgMember, OrgPendingInvitation, RequiredAuthProvider, WorkspaceAppDefaultVisibility, } from "./types.js";
2
3
  export { SIGN_IN_METHOD_ENV_VARS, type OrgSignInMethods, type SocialSignInMethod, } from "./sign-in-methods.js";
3
4
  export { canInviteOrgMembers, canManageOrg, canManageOrgA2ASecret, canManageOrgDomain, orgRoleAtLeast, orgRoleRank, } from "./permissions.js";
@@ -23,6 +24,8 @@ export { offboardMember } from "../identity/offboard.js";
23
24
  export type { OffboardMemberOptions, OffboardMemberResult, } from "../identity/offboard.js";
24
25
  export { registerIdentityColumns } from "../identity/rekey.js";
25
26
  export type { AppIdentityColumn, IdentityEmailChange, IdentityOffboard, IdentityOrgScope, } from "../identity/rekey.js";
27
+ /** Validate a migrated app database after its identity policies are registered. */
28
+ export declare function assertIdentityColumnsRegistered(db: DbExec): Promise<void>;
26
29
  export { checkWorkspaceAppAccess, claimWorkspaceAppForOrganization, isStandaloneDispatchRuntime, isWorkspaceAppAccessAllowed, isWorkspaceAppAccessUnavailable, type WorkspaceAppAccessCheck, type WorkspaceAppAccessOutcome, type WorkspaceAppAccessUnavailable, } from "./workspace-app-access.js";
27
30
  export { defineAppRoles, getRegisteredAppRoles, listRegisteredAppRoles, listAppMemberRoles, resolveAppRole, setAppMemberRole, setAppMemberRoles, applyInvitationAppRoles, getAppPermissionOverrides, setAppPermissionRoles, resolveAppAuthorizationContext, } from "./app-roles.js";
28
31
  export type { AppRoles, AppRolesDescriptor, AppRoleCaller, AppPermissionPolicy, AppRoleLookup, AppMemberRoleRow, AppAuthorizationContext, } from "./app-roles.js";
package/dist/org/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { assertIdentityColumnRows, IDENTITY_SCHEMA_COLUMNS_QUERY, } from "../identity/rekey.js";
1
2
  function lazyFunction(load, name) {
2
3
  return ((...args) => load().then((module) => {
3
4
  const implementation = module[name];
@@ -33,6 +34,12 @@ export { invalidateMemberOrgCaches } from "./request-org-cache.js";
33
34
  export { isMissingOrganizationTableError } from "./membership.js";
34
35
  export { offboardMember } from "../identity/offboard.js";
35
36
  export { registerIdentityColumns } from "../identity/rekey.js";
37
+ /** Validate a migrated app database after its identity policies are registered. */
38
+ export async function assertIdentityColumnsRegistered(db) {
39
+ // raw-sql-ok: this imported fragment contains only the fixed schema query shared with rekey.
40
+ const { rows } = await db.execute(IDENTITY_SCHEMA_COLUMNS_QUERY);
41
+ assertIdentityColumnRows(rows);
42
+ }
36
43
  export { checkWorkspaceAppAccess, claimWorkspaceAppForOrganization, isStandaloneDispatchRuntime, isWorkspaceAppAccessAllowed, isWorkspaceAppAccessUnavailable, } from "./workspace-app-access.js";
37
44
  export { defineAppRoles, getRegisteredAppRoles, listRegisteredAppRoles, listAppMemberRoles, resolveAppRole, setAppMemberRole, setAppMemberRoles, applyInvitationAppRoles, getAppPermissionOverrides, setAppPermissionRoles, resolveAppAuthorizationContext, } from "./app-roles.js";
38
45
  export { ORG_MIGRATIONS } from "./migrations.js";
@@ -31,14 +31,16 @@ export declare function emitSignupEventForCreatedUser(user: {
31
31
  id?: string;
32
32
  email?: string;
33
33
  name?: string | null;
34
+ emailVerified?: boolean;
34
35
  }, context?: BetterAuthUserCreateContext | null): Promise<void>;
35
36
  export declare function hasGoogleAuthIdentity(email: string): Promise<boolean | undefined>;
36
- export declare function trackSignupEvent({ authProvider, origin, signupMethod, authUserId, email, name, attribution, anonymousId, sessionId, }: {
37
+ export declare function trackSignupEvent({ authProvider, origin, signupMethod, authUserId, email, emailVerified, name, attribution, anonymousId, sessionId, }: {
37
38
  authProvider: string;
38
39
  origin: SignupOrigin;
39
40
  signupMethod?: "google" | "magic_link" | "password";
40
41
  authUserId?: string;
41
42
  email: string;
43
+ emailVerified?: boolean;
42
44
  name?: string | null;
43
45
  /**
44
46
  * First-touch referral attribution derived from the visitor's `an_ft`
@@ -234,6 +234,7 @@ export async function emitSignupEventForCreatedUser(user, context) {
234
234
  signupMethod: signupMethodFromRequestUrl(context?.request?.url),
235
235
  authUserId: user.id,
236
236
  email,
237
+ emailVerified: user.emailVerified,
237
238
  name: user.name,
238
239
  attribution: eventAttribution,
239
240
  anonymousId: eventAnonymousId,
@@ -250,7 +251,7 @@ export async function hasGoogleAuthIdentity(email) {
250
251
  return (existing?.accounts.some((account) => account.providerId === "google") ??
251
252
  false);
252
253
  }
253
- export async function trackSignupEvent({ authProvider, origin, signupMethod, authUserId, email, name, attribution, anonymousId, sessionId, }) {
254
+ export async function trackSignupEvent({ authProvider, origin, signupMethod, authUserId, email, emailVerified, name, attribution, anonymousId, sessionId, }) {
254
255
  identify(email, {
255
256
  email,
256
257
  name: name ?? undefined,
@@ -264,6 +265,7 @@ export async function trackSignupEvent({ authProvider, origin, signupMethod, aut
264
265
  }
265
266
  }
266
267
  }
268
+ delete cleanAttribution.email_verified;
267
269
  track("signup", {
268
270
  ...resolveSignupTrackingProperties(),
269
271
  auth_provider: authProvider,
@@ -271,6 +273,9 @@ export async function trackSignupEvent({ authProvider, origin, signupMethod, aut
271
273
  ...(signupMethod ? { signup_method: signupMethod } : {}),
272
274
  ...(authUserId ? { auth_user_id: authUserId } : {}),
273
275
  ...cleanAttribution,
276
+ ...(typeof emailVerified === "boolean"
277
+ ? { email_verified: emailVerified }
278
+ : {}),
274
279
  }, {
275
280
  userId: email,
276
281
  authUserId,
@@ -1770,10 +1775,12 @@ async function createBetterAuthInstance(config) {
1770
1775
  const token = new URL(request.url).searchParams.get("token");
1771
1776
  if (!token)
1772
1777
  return;
1773
- const db = getDbExec();
1774
1778
  const emailChange = await verifiedEmailChangeFromToken(token, secret, user.email);
1775
- if (!emailChange)
1779
+ if (!emailChange) {
1780
+ track("email_verified", { ...resolveSignupTrackingProperties(), email_verified: true }, { userId: user.email, authUserId: user.id });
1776
1781
  return;
1782
+ }
1783
+ const db = getDbExec();
1777
1784
  try {
1778
1785
  await executeIdentityRekey(identityRekeyDbFromExec(db), emailChange.oldEmail, emailChange.newEmail, {
1779
1786
  accountAlreadyUpdated: true,
@@ -11,6 +11,14 @@ import { readBodyWithSizeLimit } from "./h3-helpers.js";
11
11
  export const BUILDER_SIGNUP_EXPERIMENT = "design_builder_signup_v1";
12
12
  export const BUILDER_SIGNUP_POLICY = "builder-signup-2026-11-06";
13
13
  export const BUILDER_SIGNUP_COOKIE = "an_builder_signup";
14
+ // The first page can probe readiness while the auth callback is provisioning.
15
+ const SIGNUP_READINESS_REFRESH_WINDOW_MS = 60_000;
16
+ function justConnected(record) {
17
+ if (record.status !== "connected" || typeof record.completedAt !== "number")
18
+ return false;
19
+ const elapsed = Date.now() - record.completedAt;
20
+ return elapsed >= 0 && elapsed < SIGNUP_READINESS_REFRESH_WINDOW_MS;
21
+ }
14
22
  const TTL = 7 * 24 * 60 * 60;
15
23
  const existingSignupStatusSchema = z.enum([
16
24
  "control",
@@ -422,6 +430,8 @@ export function createBuilderSignupExperiment(dependencies) {
422
430
  return ((await reconcile(event, session, `${experimentId()}:${session.userId}`, existing, assignment ?? null)) ?? { status: "pending" });
423
431
  }
424
432
  deleteCookie(event, "an_builder_signup_pending", { path: "/" });
433
+ if (body.data.operation === "start" && justConnected(existing))
434
+ return { status: "connected" };
425
435
  return { status: "disabled", code: "already_completed" };
426
436
  }
427
437
  return { status: "eligible" };
@@ -528,7 +538,9 @@ export function createBuilderSignupExperiment(dependencies) {
528
538
  deleteCookie(event, "an_builder_signup_pending", { path: "/" });
529
539
  return { status: "disabled", code: "control" };
530
540
  }
531
- if (status !== "started" && body.data.operation === "start") {
541
+ if (status !== "started" &&
542
+ body.data.operation === "start" &&
543
+ !justConnected(existing)) {
532
544
  deleteCookie(event, "an_builder_signup_pending", { path: "/" });
533
545
  return { status: "disabled", code: "already_completed" };
534
546
  }
@@ -624,6 +624,7 @@ export async function createOAuthSession(event, email, opts) {
624
624
  signupMethod: "google",
625
625
  authUserId,
626
626
  email,
627
+ emailVerified: true,
627
628
  name: opts.trackSignup.name,
628
629
  attribution,
629
630
  anonymousId,
@@ -1,4 +1,6 @@
1
1
  import type { H3Event } from "h3";
2
2
  export declare function isLoopbackAddress(ip: string | undefined): boolean;
3
3
  export declare function isLoopbackRequest(event: H3Event): boolean;
4
- export declare function isDirectLoopbackRequest(event: H3Event): boolean;
4
+ export declare function isDirectLoopbackRequest(event: H3Event, options?: {
5
+ behindDevProxy?: boolean;
6
+ }): boolean;
@@ -16,7 +16,7 @@ export function isLoopbackRequest(event) {
16
16
  }
17
17
  return isLoopbackAddress(ip);
18
18
  }
19
- export function isDirectLoopbackRequest(event) {
19
+ export function isDirectLoopbackRequest(event, options = {}) {
20
20
  const request = event.node?.req;
21
21
  const headers = request?.headers;
22
22
  const host = headers?.host;
@@ -41,8 +41,12 @@ export function isDirectLoopbackRequest(event) {
41
41
  if (!URL.canParse(originValue))
42
42
  return false;
43
43
  const origin = new URL(originValue);
44
+ // `agent-native dev` serves the app from a worker behind the Vite proxy, so
45
+ // Host carries the proxy's port and the worker's socket never matches it.
46
+ const hostPortIsListenPort = Number(origin.port) === socket.localPort ||
47
+ (options.behindDevProxy === true && process.env.NODE_ENV === "development");
44
48
  return (origin.hostname === "127.0.0.1" &&
45
- Number(origin.port) === socket.localPort &&
49
+ hostPortIsListenPort &&
46
50
  origin.port !== "0" &&
47
51
  origin.pathname === "/" &&
48
52
  origin.search === "" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.228.2",
3
+ "version": "0.229.0-nightly-20261113212325",
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": {
@@ -771,8 +771,8 @@
771
771
  "yaml": "^2.9.0",
772
772
  "yjs": "^13.6.33",
773
773
  "zod": "^4.3.6",
774
- "@agent-native/agentkit": "^0.228.2",
775
- "@agent-native/recap-cli": "^0.5.103"
774
+ "@agent-native/recap-cli": "^0.5.103",
775
+ "@agent-native/agentkit": "^0.229.0-nightly-20261113212325"
776
776
  },
777
777
  "devDependencies": {
778
778
  "@ai-sdk/anthropic": "^3.0.71",
@@ -845,7 +845,7 @@
845
845
  "xlsx": "^0.18.5"
846
846
  },
847
847
  "peerDependencies": {
848
- "@agent-native/core-corpus": ">=0.196.0",
848
+ "@agent-native/core-corpus": "0.229.0-nightly-20261113212325",
849
849
  "@ai-sdk/anthropic": ">=3",
850
850
  "@ai-sdk/cohere": ">=3",
851
851
  "@ai-sdk/google": ">=3",