@agent-native/core 0.161.12 → 0.161.16

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 (47) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/actions/clear-selected-dashboard-object.ts +71 -0
  3. package/corpus/templates/analytics/actions/view-screen.ts +68 -4
  4. package/corpus/templates/analytics/app/hooks/use-dashboard-chat-context.ts +41 -66
  5. package/corpus/templates/analytics/app/lib/selected-object.ts +53 -0
  6. package/corpus/templates/analytics/app/pages/Ask.tsx +21 -0
  7. package/corpus/templates/analytics/changelog/2026-08-18-ask-no-stale-dashboard-context.md +6 -0
  8. package/corpus/templates/calendar/app/root.tsx +12 -4
  9. package/corpus/templates/calendar/changelog/2026-08-18-calendar-stays-responsive-in-the-desktop-app-without-focus-t.md +6 -0
  10. package/corpus/templates/clips/app/components/library/recording-card.tsx +19 -3
  11. package/corpus/templates/clips/app/hooks/use-recording-leave-guard.ts +70 -0
  12. package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
  13. package/corpus/templates/clips/app/routes/record.tsx +42 -0
  14. package/corpus/templates/clips/changelog/2026-08-18-deleting-a-recording-no-longer-freezes-clips.md +6 -0
  15. package/corpus/templates/clips/desktop/src/app.tsx +9 -10
  16. package/corpus/templates/clips/desktop/src/lib/recorder.ts +4 -3
  17. package/corpus/templates/clips/desktop/src/lib/recording-start-guard.ts +26 -0
  18. package/corpus/templates/dispatch/app/chat-first-pages.ts +40 -40
  19. package/corpus/templates/dispatch/app/i18n-data.ts +5 -5
  20. package/corpus/templates/factory/AGENTS.md +30 -29
  21. package/corpus/templates/slides/app/root.tsx +21 -0
  22. package/corpus/templates/slides/server/handlers/decks.ts +7 -3
  23. package/corpus/templates/slides/server/handlers/request-auth-context.ts +58 -1
  24. package/corpus/templates/slides/server/handlers/share.ts +7 -2
  25. package/corpus/templates/slides/server/handlers/uploads.ts +7 -2
  26. package/dist/action.js +49 -0
  27. package/dist/agent/engine/translate-anthropic.js +19 -1
  28. package/dist/agent/engine/types.d.ts +7 -0
  29. package/dist/agent/production-agent.js +32 -0
  30. package/dist/agent/thread-data-builder.d.ts +16 -4
  31. package/dist/agent/thread-data-builder.js +159 -5
  32. package/dist/client/AssistantChat.js +1 -0
  33. package/dist/client/agent-chat-adapter.js +13 -1
  34. package/dist/client/chat-first/app-open-actions.js +1 -1
  35. package/dist/client/chat-first/copy.js +2 -2
  36. package/dist/client/mcp-apps/McpAppRenderer.js +7 -2
  37. package/dist/collab/struct-routes.d.ts +1 -1
  38. package/dist/mcp/embed-app.js +71 -2
  39. package/dist/notifications/routes.d.ts +1 -1
  40. package/dist/observability/routes.d.ts +2 -2
  41. package/dist/secrets/routes.d.ts +6 -6
  42. package/dist/server/agent-teams.js +3 -1
  43. package/dist/server/cors-origins.js +24 -1
  44. package/dist/server/realtime-token.d.ts +1 -1
  45. package/dist/styles/agent-conversation.css +25 -4
  46. package/dist/transcription/builder-transcription.js +12 -1
  47. package/package.json +1 -1
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
44
  ok?: undefined;
45
+ error?: undefined;
46
46
  summary: import("./types.js").TraceSummary;
47
47
  spans: import("./types.js").TraceSpan[];
48
48
  id?: undefined;
49
49
  } | {
50
- error?: undefined;
51
50
  ok?: undefined;
51
+ error?: undefined;
52
52
  summary?: undefined;
53
53
  spans?: undefined;
54
54
  id: string;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: undefined;
47
47
  } | {
48
- error?: undefined;
49
48
  ok: boolean;
50
49
  removed: boolean;
50
+ error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: undefined;
60
60
  } | {
61
- error?: undefined;
62
61
  ok: boolean;
63
62
  note?: undefined;
64
- } | {
65
63
  error?: undefined;
64
+ } | {
66
65
  ok: boolean;
67
66
  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;
99
98
  ok: boolean;
100
99
  key: string;
101
- } | {
102
100
  error?: undefined;
101
+ } | {
103
102
  ok: boolean;
104
103
  removed: boolean;
104
+ error?: undefined;
105
105
  }>>;
@@ -1236,7 +1236,9 @@ export async function processAgentTeamRun(opts) {
1236
1236
  catch {
1237
1237
  priorThreadData = undefined;
1238
1238
  }
1239
- messages = threadDataToEngineMessages(priorThreadData);
1239
+ messages = threadDataToEngineMessages(priorThreadData, {
1240
+ includeToolCalls: true,
1241
+ });
1240
1242
  if (messages.length === 0) {
1241
1243
  messages = [
1242
1244
  {
@@ -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;
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -331,6 +331,27 @@
331
331
  font-size: 12px;
332
332
  }
333
333
 
334
+ .agent-mcp-app__error {
335
+ pointer-events: none;
336
+ background: transparent;
337
+ }
338
+
339
+ .agent-mcp-app__error-box {
340
+ display: flex;
341
+ max-width: min(100%, 540px);
342
+ flex-direction: column;
343
+ align-items: center;
344
+ gap: 8px;
345
+ padding: 12px 14px;
346
+ border: 1px solid hsl(var(--destructive) / 0.35);
347
+ border-radius: calc(var(--radius) - 2px);
348
+ background: hsl(var(--background) / 0.96);
349
+ box-shadow: 0 8px 24px hsl(var(--foreground) / 0.12);
350
+ color: hsl(var(--destructive));
351
+ text-align: center;
352
+ pointer-events: auto;
353
+ }
354
+
334
355
  .agent-mcp-app__error {
335
356
  flex-direction: column;
336
357
  text-align: center;
@@ -338,10 +359,10 @@
338
359
 
339
360
  .agent-mcp-app__open {
340
361
  min-height: 28px;
341
- border: 1px solid hsl(var(--destructive) / 0.35);
362
+ border: 1px solid hsl(var(--foreground));
342
363
  border-radius: calc(var(--radius) - 2px);
343
- background: hsl(var(--background));
344
- color: hsl(var(--foreground));
364
+ background: hsl(var(--foreground));
365
+ color: hsl(var(--background));
345
366
  cursor: pointer;
346
367
  font: inherit;
347
368
  font-weight: 600;
@@ -349,7 +370,7 @@
349
370
  }
350
371
 
351
372
  .agent-mcp-app__open:hover {
352
- background: hsl(var(--muted));
373
+ opacity: 0.86;
353
374
  }
354
375
 
355
376
  .agent-mcp-app__error,
@@ -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.12",
3
+ "version": "0.161.16",
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": {