@agent-native/core 0.120.0 → 0.120.1

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.
Files changed (55) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +7 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/client/MultiTabAssistantChat.tsx +45 -0
  5. package/corpus/core/src/client/use-chat-models.ts +45 -0
  6. package/corpus/core/src/server/analytics.ts +15 -0
  7. package/corpus/core/src/server/auth.ts +17 -13
  8. package/corpus/core/src/server/better-auth-instance.ts +13 -1
  9. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +1 -1
  10. package/corpus/templates/assets/changelog/2026-07-23-new-chat-aligns-with-sidebar-controls.md +6 -0
  11. package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +9 -3
  12. package/corpus/templates/forms/AGENTS.md +11 -1
  13. package/corpus/templates/forms/README.md +24 -1
  14. package/corpus/templates/forms/actions/update-form.ts +12 -5
  15. package/corpus/templates/forms/app/components/builder/FieldPropertiesPanel.tsx +199 -1
  16. package/corpus/templates/forms/app/i18n/en-US.ts +13 -1
  17. package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +35 -4
  18. package/corpus/templates/forms/app/pages/FormFillPage.tsx +7 -16
  19. package/corpus/templates/forms/changelog/2026-07-23-forms-can-branch-into-follow-up-questions-and-route-response.md +6 -0
  20. package/corpus/templates/forms/server/handlers/submissions.ts +22 -31
  21. package/corpus/templates/forms/server/lib/integrations.ts +11 -2
  22. package/corpus/templates/forms/server/lib/public-form-ssr.ts +26 -5
  23. package/corpus/templates/forms/server/lib/validate-fields.ts +48 -11
  24. package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
  25. package/corpus/templates/forms/shared/conditional.ts +67 -0
  26. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  27. package/dist/client/MultiTabAssistantChat.js +35 -0
  28. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  29. package/dist/client/use-chat-models.d.ts +1 -0
  30. package/dist/client/use-chat-models.d.ts.map +1 -1
  31. package/dist/client/use-chat-models.js +33 -0
  32. package/dist/client/use-chat-models.js.map +1 -1
  33. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  34. package/dist/observability/routes.d.ts +2 -2
  35. package/dist/progress/routes.d.ts +1 -1
  36. package/dist/provider-api/actions/custom-provider-registration.d.ts +6 -6
  37. package/dist/provider-api/actions/provider-api.d.ts +9 -9
  38. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  39. package/dist/server/analytics.d.ts +8 -0
  40. package/dist/server/analytics.d.ts.map +1 -1
  41. package/dist/server/analytics.js +16 -0
  42. package/dist/server/analytics.js.map +1 -1
  43. package/dist/server/auth.d.ts.map +1 -1
  44. package/dist/server/auth.js +5 -4
  45. package/dist/server/auth.js.map +1 -1
  46. package/dist/server/better-auth-instance.d.ts +8 -0
  47. package/dist/server/better-auth-instance.d.ts.map +1 -1
  48. package/dist/server/better-auth-instance.js +10 -1
  49. package/dist/server/better-auth-instance.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/client/MultiTabAssistantChat.tsx +45 -0
  52. package/src/client/use-chat-models.ts +45 -0
  53. package/src/server/analytics.ts +15 -0
  54. package/src/server/auth.ts +17 -13
  55. package/src/server/better-auth-instance.ts +13 -1
@@ -98,6 +98,7 @@ import {
98
98
  type WorkspaceAppAudience,
99
99
  } from "../shared/workspace-app-audience.js";
100
100
  import { isValidWorkspaceAppIdFormat } from "../shared/workspace-app-id.js";
101
+ import { injectAnalyticsIntoHtml } from "./analytics.js";
101
102
  import { signupAttributionFromCookieHeader } from "./attribution.js";
102
103
  import { getBetterAuth, getBetterAuthSync } from "./better-auth-instance.js";
103
104
  import type { BetterAuthConfig } from "./better-auth-instance.js";
@@ -1646,20 +1647,23 @@ function injectLoginSocialImageMeta(loginHtml: string, event: H3Event): string {
1646
1647
  }
1647
1648
 
1648
1649
  function loginHtmlResponse(loginHtml: string, event: H3Event): Response {
1649
- return new Response(injectLoginSocialImageMeta(loginHtml, event), {
1650
- status: 200,
1651
- headers: {
1652
- "Content-Type": "text/html; charset=utf-8",
1653
- // The sign-in document is part of the public server shell. Keep it on the
1654
- // same long-fresh/long-SWR CDN policy as React Router SSR so hosted
1655
- // template roots do not invoke origin just to render anonymous login UI.
1656
- // The login HTML is env-INDEPENDENT (a Google-only app always renders a
1657
- // working button), so a cached copy is never "wrong" never downgrade
1658
- // this to private/no-store.
1659
- ...DEFAULT_SSR_CACHE_HEADERS,
1660
- "X-Robots-Tag": "noindex, nofollow",
1650
+ return new Response(
1651
+ injectAnalyticsIntoHtml(injectLoginSocialImageMeta(loginHtml, event)),
1652
+ {
1653
+ status: 200,
1654
+ headers: {
1655
+ "Content-Type": "text/html; charset=utf-8",
1656
+ // The sign-in document is part of the public server shell. Keep it on the
1657
+ // same long-fresh/long-SWR CDN policy as React Router SSR so hosted
1658
+ // template roots do not invoke origin just to render anonymous login UI.
1659
+ // The login markup is env-INDEPENDENT (a Google-only app always renders
1660
+ // a working button); the analytics script is public build configuration,
1661
+ // not user/session state. Never downgrade this to private/no-store.
1662
+ ...DEFAULT_SSR_CACHE_HEADERS,
1663
+ "X-Robots-Tag": "noindex, nofollow",
1664
+ },
1661
1665
  },
1662
- });
1666
+ );
1663
1667
  }
1664
1668
 
1665
1669
  function isHtmlDocumentRequest(event: H3Event, pathname: string): boolean {
@@ -1109,6 +1109,18 @@ async function createBetterAuthInstance(
1109
1109
  return auth as unknown as BetterAuthInstance;
1110
1110
  }
1111
1111
 
1112
+ /**
1113
+ * Configure the local auth connection with the same write contention settings
1114
+ * as the shared app connection. Better Auth uses its own SQLite handle, so the
1115
+ * app connection's busy timeout does not protect first-run account creation.
1116
+ */
1117
+ export function configureLocalSqlite(sqlite: {
1118
+ pragma(statement: string): unknown;
1119
+ }): void {
1120
+ sqlite.pragma("busy_timeout = 10000");
1121
+ sqlite.pragma("journal_mode = WAL");
1122
+ }
1123
+
1112
1124
  async function buildDatabaseConfig(
1113
1125
  dialect: string,
1114
1126
  ): Promise<BetterAuthOptions["database"]> {
@@ -1182,7 +1194,7 @@ async function buildDatabaseConfig(
1182
1194
  const { default: Database } = await import("better-sqlite3");
1183
1195
  const filePath = url.replace(/^file:/, "");
1184
1196
  const sqlite = new Database(filePath);
1185
- sqlite.pragma("journal_mode = WAL");
1197
+ configureLocalSqlite(sqlite);
1186
1198
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
1187
1199
  const db = drizzle(sqlite, { schema: sqliteAuthSchema });
1188
1200
  const { drizzleAdapter } = await import("better-auth/adapters/drizzle");