@agent-native/core 0.161.14 → 0.161.17

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 (41) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/chat/vitest.config.ts +12 -7
  3. package/corpus/templates/clips/app/hooks/use-recording-leave-guard.ts +70 -0
  4. package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
  5. package/corpus/templates/clips/app/routes/record.tsx +42 -0
  6. package/corpus/templates/clips/changelog/2026-08-18-clips-now-recovers-interrupted-uploads-and-reliably-restarts.md +6 -0
  7. package/corpus/templates/clips/changelog/2026-08-18-meeting-notifications-no-longer-show-decorative-left-side-lines.md +6 -0
  8. package/corpus/templates/clips/desktop/src/lib/updater.ts +21 -1
  9. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +0 -4
  10. package/corpus/templates/clips/desktop/src/styles.css +0 -18
  11. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +3 -1
  12. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +6 -3
  13. package/corpus/templates/clips/desktop/src-tauri/src/util.rs +98 -0
  14. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +54 -20
  15. package/corpus/templates/design/app/global.css +6 -0
  16. package/corpus/templates/design/app/root.tsx +1 -1
  17. package/corpus/templates/design/changelog/2026-08-18-design-chat-context-stays-out-of-the-composer.md +6 -0
  18. package/corpus/templates/design/server/plugins/agent-chat.ts +2 -0
  19. package/corpus/templates/slides/app/root.tsx +21 -0
  20. package/corpus/templates/slides/server/handlers/decks.ts +7 -3
  21. package/corpus/templates/slides/server/handlers/request-auth-context.ts +58 -1
  22. package/corpus/templates/slides/server/handlers/share.ts +7 -2
  23. package/corpus/templates/slides/server/handlers/uploads.ts +7 -2
  24. package/dist/action.d.ts +1 -0
  25. package/dist/action.js +1 -1
  26. package/dist/agent/engine/translate-anthropic.js +19 -1
  27. package/dist/agent/engine/types.d.ts +7 -0
  28. package/dist/agent/production-agent.js +60 -5
  29. package/dist/agent/thread-data-builder.d.ts +16 -4
  30. package/dist/agent/thread-data-builder.js +159 -5
  31. package/dist/client/agent-chat-adapter.js +13 -1
  32. package/dist/collab/awareness.d.ts +2 -2
  33. package/dist/collab/routes.d.ts +1 -1
  34. package/dist/observability/routes.d.ts +3 -3
  35. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  36. package/dist/server/agent-teams.js +3 -1
  37. package/dist/server/cors-origins.js +24 -1
  38. package/dist/templates/chat/vitest.config.ts +12 -7
  39. package/dist/transcription/builder-transcription.js +12 -1
  40. package/package.json +1 -1
  41. package/src/templates/chat/vitest.config.ts +12 -7
@@ -12,6 +12,26 @@ export function isTrustedNativeAppOrigin(origin) {
12
12
  export function isLocalhostOrigin(origin) {
13
13
  return LOCALHOST_ORIGIN_RE.test(origin);
14
14
  }
15
+ /**
16
+ * Normalize an allowlist entry or an incoming `Origin` header for exact-match
17
+ * comparison. This does not widen what is admitted — it is still an exact
18
+ * scheme+host+port match — it only tolerates formatting slop that carries no
19
+ * security meaning:
20
+ * - scheme/host casing (RFC 6454 origins are case-insensitive; an operator
21
+ * pasting a domain from a UI that preserves entered case can end up with
22
+ * e.g. "HTTPS://App.Example.com")
23
+ * - a trailing slash (browsers never send one in `Origin`, but it's an easy
24
+ * copy/paste mistake when configuring the allowlist)
25
+ * - a bare domain with no scheme (`CORS_ALLOWED_ORIGINS` is operationally a
26
+ * "domain allowlist" — operators reasonably enter "app.example.com"
27
+ * instead of "https://app.example.com", which then never matches a real
28
+ * Origin header and silently locks out that legitimate origin)
29
+ */
30
+ function normalizeCorsOrigin(value) {
31
+ const trimmed = value.trim().replace(/\/+$/, "");
32
+ const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed);
33
+ return (hasScheme ? trimmed : `https://${trimmed}`).toLowerCase();
34
+ }
15
35
  export function getAllowedCorsOrigin(origin, options = {}) {
16
36
  if (!origin)
17
37
  return null;
@@ -22,7 +42,10 @@ export function getAllowedCorsOrigin(origin, options = {}) {
22
42
  return origin;
23
43
  const allowedOrigins = options.allowedOrigins ?? readCorsAllowedOrigins();
24
44
  if (allowedOrigins.length > 0) {
25
- return allowedOrigins.includes(origin) ? origin : null;
45
+ const normalizedOrigin = normalizeCorsOrigin(origin);
46
+ return allowedOrigins.some((allowed) => normalizeCorsOrigin(allowed) === normalizedOrigin)
47
+ ? origin
48
+ : null;
26
49
  }
27
50
  if (options.allowAnyOriginWhenNoAllowlist)
28
51
  return origin;
@@ -1,9 +1,14 @@
1
- import baseConfig from "@agent-native/core/vitest-config";
2
- import { mergeConfig } from "vitest/config";
1
+ import path from "node:path";
3
2
 
4
- import viteConfig from "./vite.config";
3
+ import { defineConfig } from "vitest/config";
5
4
 
6
- // Kept separate from vite.config.ts so the production config never imports
7
- // vitest: `agent-native build` loads vite.config.ts in installs where vitest
8
- // is absent.
9
- export default mergeConfig(viteConfig, baseConfig);
5
+ // Keep tests independent from vite.config.ts: the production config starts
6
+ // Nitro/Vite watchers and evaluates browser-targeted CommonJS SSR modules.
7
+ export default defineConfig({
8
+ resolve: {
9
+ alias: {
10
+ "@": path.resolve(__dirname, "./app"),
11
+ "@shared": path.resolve(__dirname, "./shared"),
12
+ },
13
+ },
14
+ });
@@ -1,4 +1,4 @@
1
- import { resolveBuilderGatewayAuth, getBuilderProxyOrigin, } from "../server/credential-provider.js";
1
+ import { resolveBuilderGatewayAuth, getBuilderProxyOrigin, recordBuilderGatewayAuthFailure, } from "../server/credential-provider.js";
2
2
  function describeError(err) {
3
3
  if (!(err instanceof Error))
4
4
  return String(err);
@@ -64,6 +64,17 @@ export async function transcribeWithBuilder(opts) {
64
64
  }
65
65
  if (!res.ok) {
66
66
  const text = await res.text().catch(() => "");
67
+ // The chat path records this so a rejected credential is not retried for
68
+ // BUILDER_AUTH_FAILURE_TTL_MS; transcription never did, so one bad
69
+ // credential re-sent the same doomed request on every attempt -- prod
70
+ // logged 24 identical `Missing Authentication header` 401s in a day off a
71
+ // single unusable credential, with nothing to stop the next one.
72
+ if (res.status === 401 || res.status === 403) {
73
+ await recordBuilderGatewayAuthFailure({
74
+ status: res.status,
75
+ message: text,
76
+ });
77
+ }
67
78
  throw new Error(`Builder transcription failed (${res.status} ${res.statusText}): ${text}`);
68
79
  }
69
80
  return (await res.json());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.161.14",
3
+ "version": "0.161.17",
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": {
@@ -1,9 +1,14 @@
1
- import baseConfig from "@agent-native/core/vitest-config";
2
- import { mergeConfig } from "vitest/config";
1
+ import path from "node:path";
3
2
 
4
- import viteConfig from "./vite.config";
3
+ import { defineConfig } from "vitest/config";
5
4
 
6
- // Kept separate from vite.config.ts so the production config never imports
7
- // vitest: `agent-native build` loads vite.config.ts in installs where vitest
8
- // is absent.
9
- export default mergeConfig(viteConfig, baseConfig);
5
+ // Keep tests independent from vite.config.ts: the production config starts
6
+ // Nitro/Vite watchers and evaluates browser-targeted CommonJS SSR modules.
7
+ export default defineConfig({
8
+ resolve: {
9
+ alias: {
10
+ "@": path.resolve(__dirname, "./app"),
11
+ "@shared": path.resolve(__dirname, "./shared"),
12
+ },
13
+ },
14
+ });