@agent-native/core 0.168.13 → 0.169.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 (96) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/actions/bigquery-table-info.ts +3 -2
  3. package/corpus/templates/analytics/actions/search-bigquery-schema.ts +130 -4
  4. package/corpus/templates/analytics/agent-native.config.ts +1 -0
  5. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +36 -23
  6. package/corpus/templates/analytics/app/lib/dashboard-visibility.ts +41 -0
  7. package/corpus/templates/analytics/app/pages/DashboardOverview.tsx +34 -9
  8. package/corpus/templates/analytics/changelog/2026-08-21-dashboard-filters-keep-other-users-dashboards-out-of-mine.md +6 -0
  9. package/corpus/templates/analytics/server/lib/real-data-actions.ts +14 -3
  10. package/corpus/templates/analytics/server/plugins/agent-chat.ts +33 -3
  11. package/corpus/templates/brain/server/lib/brain.ts +27 -2
  12. package/corpus/templates/clips/actions/stop-meeting-recording.ts +87 -6
  13. package/corpus/templates/clips/app/components/library/search-bar.tsx +1 -1
  14. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +3 -4
  15. package/corpus/templates/design/app/components/design/EditPanel.tsx +15 -47
  16. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +3 -3
  17. package/corpus/templates/design/app/components/design/keyboard-shortcuts.ts +0 -7
  18. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +2 -4
  19. package/corpus/templates/design/app/i18n-data.ts +10 -10
  20. package/corpus/templates/design/app/pages/DesignEditor.tsx +22 -22
  21. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +39 -8
  22. package/corpus/templates/design/app/pages/DesignSystems.tsx +1 -1
  23. package/corpus/templates/design/app/pages/Index.tsx +1 -1
  24. package/corpus/templates/design/app/pages/design-editor/preview-navigation.ts +25 -0
  25. package/corpus/templates/mail/app/hooks/use-emails.ts +13 -3
  26. package/dist/agent/engine/credential-errors.d.ts +1 -1
  27. package/dist/agent/engine/credential-errors.js +2 -2
  28. package/dist/agent/engine/first-event-timeout.d.ts +8 -0
  29. package/dist/agent/engine/first-event-timeout.js +8 -0
  30. package/dist/agent/production-agent.d.ts +0 -30
  31. package/dist/agent/production-agent.js +17 -38
  32. package/dist/agent/run-loop-with-resume.d.ts +38 -25
  33. package/dist/agent/run-loop-with-resume.js +140 -55
  34. package/dist/agent/run-manager.d.ts +83 -68
  35. package/dist/agent/run-manager.js +280 -94
  36. package/dist/agent/run-store.d.ts +31 -0
  37. package/dist/agent/run-store.js +42 -12
  38. package/dist/app-config/agent.d.ts +2 -0
  39. package/dist/app-config/agent.js +33 -0
  40. package/dist/app-config/run-lifecycle-invariants.d.ts +248 -0
  41. package/dist/app-config/run-lifecycle-invariants.js +342 -0
  42. package/dist/app-config/schema.d.ts +2 -0
  43. package/dist/app-config/store.js +9 -1
  44. package/dist/client/AssistantChat.js +47 -15
  45. package/dist/client/ConnectBuilderCard.d.ts +3 -1
  46. package/dist/client/ConnectBuilderCard.js +6 -3
  47. package/dist/client/agent-chat-adapter.d.ts +0 -2
  48. package/dist/client/agent-chat-adapter.js +7 -23
  49. package/dist/client/chat/message-components.d.ts +7 -0
  50. package/dist/client/chat/message-components.js +1 -1
  51. package/dist/client/chat/run-recovery.js +5 -2
  52. package/dist/client/chat/tool-call-display.js +9 -3
  53. package/dist/client/error-format.js +12 -0
  54. package/dist/client/navigation/index.d.ts +1 -0
  55. package/dist/client/navigation/index.js +1 -0
  56. package/dist/client/route-state.js +6 -0
  57. package/dist/client/workspace-app-navigation.d.ts +10 -0
  58. package/dist/client/workspace-app-navigation.js +38 -0
  59. package/dist/collab/struct-routes.d.ts +1 -1
  60. package/dist/deploy/build.d.ts +13 -0
  61. package/dist/deploy/build.js +51 -0
  62. package/dist/jobs/background-automation-runner.d.ts +25 -0
  63. package/dist/jobs/background-automation-runner.js +104 -21
  64. package/dist/jobs/run-history.d.ts +7 -1
  65. package/dist/jobs/run-history.js +57 -14
  66. package/dist/localization/core-messages/ar-SA.js +1 -1
  67. package/dist/localization/core-messages/de-DE.js +1 -1
  68. package/dist/localization/core-messages/en-US.d.ts +1 -1
  69. package/dist/localization/core-messages/en-US.js +1 -1
  70. package/dist/localization/core-messages/es-ES.js +1 -1
  71. package/dist/localization/core-messages/fr-FR.js +1 -1
  72. package/dist/localization/core-messages/hi-IN.js +1 -1
  73. package/dist/localization/core-messages/ja-JP.js +1 -1
  74. package/dist/localization/core-messages/ko-KR.js +1 -1
  75. package/dist/localization/core-messages/pt-BR.js +1 -1
  76. package/dist/localization/core-messages/zh-CN.js +1 -1
  77. package/dist/localization/core-messages/zh-TW.js +1 -1
  78. package/dist/localization/core-messages.d.ts +1 -1
  79. package/dist/notifications/routes.d.ts +1 -1
  80. package/dist/observability/routes.d.ts +3 -3
  81. package/dist/observability/traces.d.ts +13 -0
  82. package/dist/observability/traces.js +369 -317
  83. package/dist/progress/routes.d.ts +1 -1
  84. package/dist/provider-api/actions/custom-provider-registration.d.ts +12 -12
  85. package/dist/provider-api/actions/provider-api.d.ts +13 -13
  86. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  87. package/dist/resources/handlers.d.ts +1 -1
  88. package/dist/scripts/db/check-scoping.js +9 -6
  89. package/dist/secrets/routes.d.ts +6 -6
  90. package/dist/server/agent-chat-plugin.js +2 -4
  91. package/dist/server/builder-browser.d.ts +4 -0
  92. package/dist/server/builder-browser.js +23 -1
  93. package/dist/server/core-routes-plugin.js +13 -1
  94. package/dist/server/transcribe-voice.d.ts +1 -1
  95. package/package.json +3 -3
  96. /package/corpus/templates/dispatch/app/routes/{apps.$appId.tsx → apps.$appId.$.tsx} +0 -0
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;
@@ -75,9 +75,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
75
75
  user: "user";
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
- deleted?: undefined;
79
- found?: undefined;
80
78
  id?: undefined;
79
+ provider?: undefined;
80
+ deleted?: undefined;
81
81
  providers: {
82
82
  id: string;
83
83
  label: string;
@@ -88,46 +88,46 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
88
88
  updatedAt: number;
89
89
  }[];
90
90
  count: number;
91
- provider?: undefined;
91
+ found?: undefined;
92
92
  registered?: undefined;
93
93
  label?: undefined;
94
94
  message?: undefined;
95
95
  } | {
96
- deleted?: undefined;
97
96
  id?: undefined;
98
- providers?: undefined;
99
97
  count?: undefined;
98
+ deleted?: undefined;
99
+ providers?: undefined;
100
100
  found: boolean;
101
101
  provider: import("../custom-registry.js").CustomProviderConfig;
102
102
  registered?: undefined;
103
103
  label?: undefined;
104
104
  message?: undefined;
105
105
  } | {
106
- deleted?: undefined;
107
- providers?: undefined;
108
106
  count?: undefined;
109
107
  provider?: undefined;
108
+ deleted?: undefined;
109
+ providers?: undefined;
110
110
  found: boolean;
111
111
  id: string;
112
112
  registered?: undefined;
113
113
  label?: undefined;
114
114
  message?: undefined;
115
115
  } | {
116
- found?: undefined;
117
- providers?: undefined;
118
116
  count?: undefined;
119
117
  provider?: undefined;
118
+ providers?: undefined;
119
+ found?: undefined;
120
120
  deleted: boolean;
121
121
  id: string;
122
122
  registered?: undefined;
123
123
  label?: undefined;
124
124
  message?: undefined;
125
125
  } | {
126
- deleted?: undefined;
127
- found?: undefined;
128
- providers?: undefined;
129
126
  count?: undefined;
130
127
  provider?: undefined;
128
+ deleted?: undefined;
129
+ providers?: undefined;
130
+ found?: undefined;
131
131
  registered: boolean;
132
132
  id: string;
133
133
  label: string;
@@ -311,10 +311,10 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
311
311
  notes?: string | undefined;
312
312
  scope?: "org" | "user" | undefined;
313
313
  }, {
314
- id?: undefined;
315
- deleted?: undefined;
316
- found?: undefined;
317
314
  message?: undefined;
315
+ deleted?: undefined;
316
+ id?: undefined;
317
+ provider?: undefined;
318
318
  providers: {
319
319
  id: string;
320
320
  label: string;
@@ -325,45 +325,45 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
325
325
  updatedAt: number;
326
326
  }[];
327
327
  count: number;
328
- provider?: undefined;
328
+ found?: undefined;
329
329
  registered?: undefined;
330
330
  label?: undefined;
331
331
  } | {
332
- id?: undefined;
333
- deleted?: undefined;
334
332
  message?: undefined;
335
- providers?: undefined;
333
+ deleted?: undefined;
336
334
  count?: undefined;
335
+ id?: undefined;
336
+ providers?: undefined;
337
337
  found: boolean;
338
338
  provider: import("../custom-registry.js").CustomProviderConfig;
339
339
  registered?: undefined;
340
340
  label?: undefined;
341
341
  } | {
342
- deleted?: undefined;
343
342
  message?: undefined;
344
- providers?: undefined;
343
+ deleted?: undefined;
345
344
  count?: undefined;
346
345
  provider?: undefined;
346
+ providers?: undefined;
347
347
  found: boolean;
348
348
  id: string;
349
349
  registered?: undefined;
350
350
  label?: undefined;
351
351
  } | {
352
- found?: undefined;
353
352
  message?: undefined;
354
- providers?: undefined;
355
353
  count?: undefined;
356
354
  provider?: undefined;
355
+ providers?: undefined;
356
+ found?: undefined;
357
357
  deleted: boolean;
358
358
  id: string;
359
359
  registered?: undefined;
360
360
  label?: undefined;
361
361
  } | {
362
362
  deleted?: undefined;
363
- found?: undefined;
364
- providers?: undefined;
365
363
  count?: undefined;
366
364
  provider?: undefined;
365
+ providers?: undefined;
366
+ found?: undefined;
367
367
  registered: boolean;
368
368
  id: string;
369
369
  label: string;
@@ -73,7 +73,6 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
73
73
  offset?: unknown;
74
74
  limit?: unknown;
75
75
  }, {
76
- deleted?: undefined;
77
76
  jobs: {
78
77
  id: string;
79
78
  name: string;
@@ -84,6 +83,7 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
84
83
  updatedAt: string;
85
84
  }[];
86
85
  total: number;
86
+ deleted?: undefined;
87
87
  jobId?: undefined;
88
88
  } | {
89
89
  jobs?: undefined;
@@ -91,9 +91,9 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
91
91
  deleted: boolean;
92
92
  jobId: string;
93
93
  } | {
94
- deleted?: undefined;
95
94
  jobs?: undefined;
96
95
  total?: undefined;
96
+ deleted?: undefined;
97
97
  jobId?: undefined;
98
98
  hits: Record<string, unknown>[];
99
99
  offset: number;
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
48
48
  }>;
49
49
  /** DELETE /_agent-native/resources/:id — delete a resource */
50
50
  export declare function handleDeleteResource(event: any): Promise<{
51
- ok?: undefined;
52
51
  error: string;
52
+ ok?: undefined;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -12,9 +12,15 @@
12
12
  * pnpm action db-check-scoping [--db path] [--require-org] [--format json]
13
13
  */
14
14
  import path from "path";
15
- import { createClient } from "@libsql/client";
16
- import { getDatabaseUrl, getDatabaseAuthToken } from "../../db/client.js";
15
+ import { getDatabaseUrl } from "../../db/client.js";
17
16
  import { parseArgs } from "../utils.js";
17
+ // The `@libsql/client` node entry pulls the `libsql` native addon into whatever
18
+ // graph imports it, and this maintenance script was its only importer in the
19
+ // server bundle — which is how a 9.3MB Linux SQLite driver reached the docs
20
+ // function, a deployment that runs Postgres. `createSqliteScriptClient` reaches
21
+ // the same two backends through dynamic imports instead, so nothing static
22
+ // depends on the native package.
23
+ import { createSqliteScriptClient } from "./sqlite-client.js";
18
24
  function isPostgresUrl(url) {
19
25
  return url.startsWith("postgres://") || url.startsWith("postgresql://");
20
26
  }
@@ -125,10 +131,7 @@ Options:
125
131
  }
126
132
  }
127
133
  else {
128
- const client = createClient({
129
- url,
130
- authToken: getDatabaseAuthToken(),
131
- });
134
+ const client = await createSqliteScriptClient(url);
132
135
  try {
133
136
  allColumns = await discoverColumnsSqlite(client);
134
137
  }
@@ -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
  }>>;
@@ -14,6 +14,7 @@ import { SYSTEM_PROMPT_CACHE_SPLIT } from "../agent/engine/prompt-cache.js";
14
14
  import { PROVIDER_TO_ENV } from "../agent/engine/provider-env-vars.js";
15
15
  import { hostedHarnessSystemPrompt } from "../agent/harness/hosted.js";
16
16
  import { createProductionAgentHandler, actionsToEngineTools, executeAgentToolCall, filterActionsByAllowedNames, normalizeAgentActionSurfaceResolution, readPersistedActionSurface, toolCallCacheKey, getActiveRunForThreadAsync, abortRunDurably, abortTurnDurably, subscribeToRun, } from "../agent/production-agent.js";
17
+ import { clientAbortReason } from "../agent/run-loop-with-resume.js";
17
18
  import { callerHasRunAccess, callerHasThreadAccess, } from "../agent/run-ownership.js";
18
19
  import { markTurnAborted, readBackgroundRunClaim } from "../agent/run-store.js";
19
20
  import { buildCurrentTimeUserContext, buildRuntimeContextPrompt, } from "../agent/runtime-context.js";
@@ -4142,10 +4143,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4142
4143
  let reason = "user";
4143
4144
  try {
4144
4145
  const body = await readBody(event);
4145
- if (typeof body?.reason === "string" &&
4146
- /^[a-z0-9_-]{1,64}$/i.test(body.reason)) {
4147
- reason = body.reason;
4148
- }
4146
+ reason = clientAbortReason(body?.reason);
4149
4147
  }
4150
4148
  catch {
4151
4149
  // Empty/invalid body — keep the default user abort reason.
@@ -339,11 +339,15 @@ export declare function createBuilderBrowserCallbackErrorPage(message: string, o
339
339
  }): string;
340
340
  export interface RunBuilderAgentArgs {
341
341
  prompt: string;
342
+ context?: string;
342
343
  projectId?: string;
343
344
  branchName?: string;
344
345
  userEmail?: string;
345
346
  userId?: string;
346
347
  }
348
+ export declare const BUILDER_AGENT_CONTEXT_MAX_CHARS = 32000;
349
+ export declare function normalizeBuilderAgentContext(value: unknown): string | undefined;
350
+ export declare function buildBuilderAgentUserPrompt(prompt: string, context?: string): string;
347
351
  export interface RunBuilderAgentResult {
348
352
  branchName: string;
349
353
  projectId: string;
@@ -1381,6 +1381,27 @@ export function createBuilderBrowserCallbackErrorPage(message, opts = {}) {
1381
1381
  </body>
1382
1382
  </html>`;
1383
1383
  }
1384
+ export const BUILDER_AGENT_CONTEXT_MAX_CHARS = 32_000;
1385
+ export function normalizeBuilderAgentContext(value) {
1386
+ if (value == null)
1387
+ return undefined;
1388
+ if (typeof value !== "string") {
1389
+ throw new Error("context must be a string");
1390
+ }
1391
+ const context = value.trim();
1392
+ if (!context)
1393
+ return undefined;
1394
+ if (context.length > BUILDER_AGENT_CONTEXT_MAX_CHARS) {
1395
+ throw new Error(`context must be ${BUILDER_AGENT_CONTEXT_MAX_CHARS} characters or fewer`);
1396
+ }
1397
+ return context;
1398
+ }
1399
+ export function buildBuilderAgentUserPrompt(prompt, context) {
1400
+ const normalizedContext = normalizeBuilderAgentContext(context);
1401
+ if (!normalizedContext)
1402
+ return prompt;
1403
+ return `${prompt.trim()}\n\n<context>\n${normalizedContext}\n</context>`;
1404
+ }
1384
1405
  function normalizeBuilderApiString(value, fieldName) {
1385
1406
  if (typeof value !== "string" || !value.trim()) {
1386
1407
  throw new Error(`Builder agent run returned a blank ${fieldName}`);
@@ -1636,11 +1657,12 @@ export async function runBuilderAgent(args) {
1636
1657
  if (!builderUserEmail && !builderUserId) {
1637
1658
  throw new Error("userEmail or userId is required");
1638
1659
  }
1660
+ const userPrompt = buildBuilderAgentUserPrompt(args.prompt, args.context);
1639
1661
  const url = new URL("/agents/run", getBuilderApiHost());
1640
1662
  url.searchParams.set("apiKey", creds.publicKey);
1641
1663
  const postRun = async (actor) => {
1642
1664
  const body = {
1643
- userMessage: { userPrompt: args.prompt },
1665
+ userMessage: { userPrompt },
1644
1666
  projectId,
1645
1667
  };
1646
1668
  if (args.branchName)
@@ -42,7 +42,7 @@ import { readAnalyticsClientPlatformHeader, readBrowserSessionIdHeader, } from "
42
42
  import { getConfiguredAppBasePath, stripAppBasePath } from "./app-base-path.js";
43
43
  import { getAppName } from "./app-name.js";
44
44
  import { getSession } from "./auth.js";
45
- import { BUILDER_CONNECT_PARAM, BUILDER_ENV_KEYS, BUILDER_OPENER_PARAM, BUILDER_RELAY_FLOW_HEADER, BUILDER_RELAY_SIGNATURE_HEADER, BUILDER_RELAY_STATE_PARAM, BUILDER_RELAY_TIMESTAMP_HEADER, appendBuilderConnectToken, builderConnectTrackingProperties, createBuilderConnectState, createBuilderBrowserCallbackErrorPage, createBuilderBrowserCallbackPage, createBuilderRelayRequest, getBuilderConnectTrackingParams, getBuilderBrowserOriginForEvent, getBuilderBrowserStatusForEvent, isBuilderConnectCallbackUrlAllowed, isSignedBuilderConnectState, resolveBuilderBranchProjectId, resolveBuilderConnectCallbackUrl, resolveBuilderPreviewRelayParentOrigin, runBuilderAgent, verifyBuilderRelayRequest, verifyBuilderPreviewRelayStateForCallback, verifyBuilderConnectTokenAndGetOwner, } from "./builder-browser.js";
45
+ import { BUILDER_CONNECT_PARAM, BUILDER_ENV_KEYS, BUILDER_OPENER_PARAM, BUILDER_RELAY_FLOW_HEADER, BUILDER_RELAY_SIGNATURE_HEADER, BUILDER_RELAY_STATE_PARAM, BUILDER_RELAY_TIMESTAMP_HEADER, appendBuilderConnectToken, builderConnectTrackingProperties, createBuilderConnectState, createBuilderBrowserCallbackErrorPage, createBuilderBrowserCallbackPage, createBuilderRelayRequest, getBuilderConnectTrackingParams, getBuilderBrowserOriginForEvent, getBuilderBrowserStatusForEvent, isBuilderConnectCallbackUrlAllowed, isSignedBuilderConnectState, normalizeBuilderAgentContext, resolveBuilderBranchProjectId, resolveBuilderConnectCallbackUrl, resolveBuilderPreviewRelayParentOrigin, runBuilderAgent, verifyBuilderRelayRequest, verifyBuilderPreviewRelayStateForCallback, verifyBuilderConnectTokenAndGetOwner, } from "./builder-browser.js";
46
46
  import { BUILDER_OAUTH_SCOPE, deleteBuilderOAuthSession, finishBuilderOAuthAuthorization, hasBuilderOAuthSession, resolveBuilderOAuthRequestAccess, startBuilderOAuthAuthorization, } from "./builder-oauth.js";
47
47
  import { captureError, registerErrorCaptureProvider } from "./capture-error.js";
48
48
  import { getAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js";
@@ -1930,12 +1930,23 @@ export function createCoreRoutesPlugin(options = {}) {
1930
1930
  setResponseStatus(event, 405);
1931
1931
  return { error: "Method not allowed" };
1932
1932
  }
1933
+ await assertBodySize(event, 64 * 1024);
1933
1934
  const body = await readBody(event).catch(() => ({}));
1934
1935
  const prompt = typeof body?.prompt === "string" ? body.prompt : "";
1935
1936
  if (!prompt.trim()) {
1936
1937
  setResponseStatus(event, 400);
1937
1938
  return { error: "prompt is required" };
1938
1939
  }
1940
+ let context;
1941
+ try {
1942
+ context = normalizeBuilderAgentContext(body?.context);
1943
+ }
1944
+ catch (error) {
1945
+ setResponseStatus(event, 400);
1946
+ return {
1947
+ error: error instanceof Error ? error.message : "Invalid context",
1948
+ };
1949
+ }
1939
1950
  const session = await getSession(event).catch(() => null);
1940
1951
  if (!session?.email) {
1941
1952
  setResponseStatus(event, 401);
@@ -1973,6 +1984,7 @@ export function createCoreRoutesPlugin(options = {}) {
1973
1984
  try {
1974
1985
  const result = await runBuilderAgent({
1975
1986
  prompt,
1987
+ context,
1976
1988
  projectId,
1977
1989
  branchName: typeof body?.branchName === "string"
1978
1990
  ? body.branchName
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- error?: undefined;
24
23
  text: string;
24
+ error?: undefined;
25
25
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.168.13",
3
+ "version": "0.169.1",
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": {
@@ -428,8 +428,8 @@
428
428
  "y-protocols": "^1.0.7",
429
429
  "yjs": "^13.6.32",
430
430
  "zod": "^4.3.6",
431
- "@agent-native/recap-cli": "0.5.7",
432
- "@agent-native/toolkit": "^0.16.9"
431
+ "@agent-native/recap-cli": "0.5.8",
432
+ "@agent-native/toolkit": "^0.16.10"
433
433
  },
434
434
  "devDependencies": {
435
435
  "@ai-sdk/anthropic": "^3.0.71",