@agent-native/core 0.0.0-beta-20260820023157 → 0.0.0-beta-20260820071604

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.
@@ -63,7 +63,8 @@ interface EditorSidebarProps {
63
63
  aspectRatio?: AspectRatio;
64
64
  /** Active deck design system used by slide content tokens. */
65
65
  designSystem?: DesignSystemData;
66
- /** The next slide while the agent is preparing its HTML. */
66
+ /** The next slide while the agent is preparing its HTML. Omitted when the
67
+ * agent is filling a placeholder that already has a row in this rail. */
67
68
  generatingSlide?: { index: number };
68
69
  generatingSlideSelected?: boolean;
69
70
  onSelectGeneratingSlide?: () => void;
@@ -75,8 +76,15 @@ interface EditorSidebarProps {
75
76
  /** Clears `describeSlideId` in the parent when the popover closes. */
76
77
  onCloseDescribe: () => void;
77
78
  /** Reports add-slide generation state up so the toolbar's New Slide button
78
- * can disable itself while a request is in flight. */
79
- onAddSlideGeneratingChange?: (generating: boolean) => void;
79
+ * can disable itself while a request is in flight. `targetSlideId` is the
80
+ * placeholder the agent was asked to fill, so the parent can mark that row
81
+ * as the AI-active one instead of appending a second generating row. */
82
+ onAddSlideGeneratingChange?: (
83
+ generating: boolean,
84
+ targetSlideId: string | null,
85
+ ) => void;
86
+ /** Slide the agent is filling in place, marked as AI-active in the rail. */
87
+ aiGeneratingSlideId?: string | null;
80
88
  /** Resolves once a just-inserted blank slide has actually reached the
81
89
  * server, so the agent's update-slide request can't race the add-slide
82
90
  * persistence. */
@@ -199,6 +207,7 @@ function SortableSlideThumb({
199
207
  onOverflowChange,
200
208
  readOnly = false,
201
209
  aiEditing = false,
210
+ isFillingPlaceholder = false,
202
211
  canDelete = true,
203
212
  hasSlideClipboard = false,
204
213
  onCutSlide,
@@ -219,7 +228,11 @@ function SortableSlideThumb({
219
228
  aspectRatio?: AspectRatio;
220
229
  designSystem?: DesignSystemData;
221
230
  onOverflowChange: (info: SlideOverflowInfo) => void;
231
+ /** A recent edit attributed to the agent — a lingering highlight, not a live signal. */
222
232
  aiEditing?: boolean;
233
+ /** This exact slide is the placeholder the agent is filling right now — the
234
+ * one case where the shimmer belongs even without live presence. */
235
+ isFillingPlaceholder?: boolean;
223
236
  /** False when this is the deck's last remaining slide — Cut/Delete stay enabled elsewhere but must not remove it. */
224
237
  canDelete?: boolean;
225
238
  hasSlideClipboard?: boolean;
@@ -255,7 +268,11 @@ function SortableSlideThumb({
255
268
  const humanPresenceUsers = presenceUsers.filter(
256
269
  (user) => !isAgentPresenceUser(user),
257
270
  );
258
- const showAiMarker = aiEditing || agentPresent;
271
+ const showAiMarker = aiEditing || agentPresent || isFillingPlaceholder;
272
+ // Narrower than the badge above: `aiEditing` also covers a slide's lingering
273
+ // post-edit highlight, which is "recently done," not "in progress." The
274
+ // shimmer should only run while the agent is actually live on this slide.
275
+ const showGeneratingShimmer = agentPresent || isFillingPlaceholder;
259
276
 
260
277
  return (
261
278
  <div ref={setNodeRef} style={style}>
@@ -331,6 +348,12 @@ function SortableSlideThumb({
331
348
  designSystem={designSystem}
332
349
  onOverflowChange={onOverflowChange}
333
350
  />
351
+ {showGeneratingShimmer && (
352
+ <div
353
+ aria-hidden="true"
354
+ className="slide-thumbnail-ai-shimmer pointer-events-none absolute inset-0 z-10"
355
+ />
356
+ )}
334
357
  {slide.skipped && (
335
358
  // guard:allow-raw-color — dims an arbitrary-colored slide render, not app chrome; must stay black regardless of theme
336
359
  <div className="absolute inset-0 z-10 flex items-center justify-center bg-black/40">
@@ -454,6 +477,7 @@ export default function EditorSidebar({
454
477
  describeSlideId,
455
478
  onCloseDescribe,
456
479
  onAddSlideGeneratingChange,
480
+ aiGeneratingSlideId,
457
481
  onAwaitAddSlidePersisted,
458
482
  onRemoveFailedSlide,
459
483
  addSlideAgentSubmit,
@@ -662,6 +686,7 @@ export default function EditorSidebar({
662
686
  aspectRatio={aspectRatio}
663
687
  designSystem={designSystem}
664
688
  aiEditing={aiEditedSlideIds.has(slide.id)}
689
+ isFillingPlaceholder={slide.id === aiGeneratingSlideId}
665
690
  canDelete={slides.length > 1}
666
691
  hasSlideClipboard={hasSlideClipboard}
667
692
  onCutSlide={onCutSlide}
@@ -706,12 +731,12 @@ export default function EditorSidebar({
706
731
  slideCount={slides.length}
707
732
  targetSlideId={describeSlideId}
708
733
  agentSubmit={async (message, context) => {
709
- onAddSlideGeneratingChange?.(true);
734
+ onAddSlideGeneratingChange?.(true, describeSlideId);
710
735
  try {
711
736
  await onAwaitAddSlidePersisted?.();
712
737
  } catch (error) {
713
738
  console.error("Failed to persist new slide:", error);
714
- onAddSlideGeneratingChange?.(false);
739
+ onAddSlideGeneratingChange?.(false, null);
715
740
  // The popover already closed (AddSlidePopover doesn't wait on
716
741
  // this async callback), so the typed prompt is gone either
717
742
  // way. Only remove the placeholder if it's still untouched —
@@ -1167,6 +1167,35 @@ button[title="Open agent sidebar"] {
1167
1167
  }
1168
1168
  }
1169
1169
 
1170
+ /* Sweeps across a slide thumbnail while the agent is generating its content.
1171
+ Sits above the rendered slide so it reads as "in progress" instead of a
1172
+ static placeholder for the length of the generation run. */
1173
+ .slide-thumbnail-ai-shimmer {
1174
+ background: linear-gradient(
1175
+ 100deg,
1176
+ transparent 30%,
1177
+ rgba(255, 255, 255, 0.16) 50%,
1178
+ transparent 70%
1179
+ );
1180
+ background-size: 200% 100%;
1181
+ animation: slide-thumbnail-shimmer 1.6s ease-in-out infinite;
1182
+ }
1183
+
1184
+ @keyframes slide-thumbnail-shimmer {
1185
+ from {
1186
+ background-position: 150% 0;
1187
+ }
1188
+ to {
1189
+ background-position: -50% 0;
1190
+ }
1191
+ }
1192
+
1193
+ @media (prefers-reduced-motion: reduce) {
1194
+ .slide-thumbnail-ai-shimmer {
1195
+ animation: none;
1196
+ }
1197
+ }
1198
+
1170
1199
  .image-overlay-btn {
1171
1200
  display: flex;
1172
1201
  align-items: center;
@@ -26,6 +26,31 @@ export function shouldShowNewDeckGeneratingProgress({
26
26
  return generating && isNewDeckCreation;
27
27
  }
28
28
 
29
+ /** The blank placeholder "New slide" inserted and handed to the agent to fill.
30
+ * While one is live the rail marks that existing row as AI-active; appending
31
+ * the synthetic generating row too would read as a second, duplicate slide.
32
+ * Returns null once the placeholder leaves the deck, or once its content is
33
+ * no longer the blank stand-in: the fill is done, presence/recent-edit
34
+ * tracking picks up that slide's own marker from there, and if the same run
35
+ * goes on to `add-slide` more slides (a multi-slide request), those are
36
+ * genuinely new and should get the trailing generating row again. */
37
+ export function slideBeingFilledInPlace({
38
+ addSlideGenerating,
39
+ addSlideTargetId,
40
+ slides,
41
+ blankContent,
42
+ }: {
43
+ addSlideGenerating: boolean;
44
+ addSlideTargetId: string | null;
45
+ slides: { id: string; content: string }[];
46
+ blankContent: string;
47
+ }): string | null {
48
+ if (!addSlideGenerating || !addSlideTargetId) return null;
49
+ const target = slides.find((slide) => slide.id === addSlideTargetId);
50
+ if (!target || target.content !== blankContent) return null;
51
+ return addSlideTargetId;
52
+ }
53
+
29
54
  export function shouldClearNewDeckGeneratingState({
30
55
  generating,
31
56
  generationStarted,
@@ -65,6 +65,7 @@ import { Button } from "@/components/ui/button";
65
65
  import {
66
66
  clearSlideEditingActive,
67
67
  deckIdFromPathname,
68
+ defaultSlideContent,
68
69
  hasUnsavedDeckChanges,
69
70
  markSlideEditingActive,
70
71
  type Slide,
@@ -100,6 +101,7 @@ import {
100
101
  shouldClearNewDeckGeneratingState,
101
102
  shouldShowNewDeckGeneratingOverlay,
102
103
  shouldShowNewDeckGeneratingProgress,
104
+ slideBeingFilledInPlace,
103
105
  } from "@/lib/generation-state";
104
106
  import { isMissingUploadProviderError } from "@/lib/image-drop-to-agent";
105
107
  import {
@@ -172,6 +174,14 @@ export default function DeckEditor() {
172
174
  const [activeSlideId, setActiveSlideId] = useState<string | null>(null);
173
175
  const [inlineEditActive, setInlineEditActive] = useState(false);
174
176
  const [addSlideGenerating, setAddSlideGenerating] = useState(false);
177
+ // The blank placeholder the agent was asked to fill in place. The rail must
178
+ // light THAT row up as AI-active instead of appending a synthetic generating
179
+ // row, which reads as a second, duplicate slide.
180
+ const [addSlideTargetId, setAddSlideTargetId] = useState<string | null>(null);
181
+ const endAddSlideGeneration = useCallback(() => {
182
+ setAddSlideGenerating(false);
183
+ setAddSlideTargetId(null);
184
+ }, []);
175
185
  const [generatingSlideSelected, setGeneratingSlideSelected] = useState(false);
176
186
  const { hasUnsavedChanges: hasUnsavedSave } = useSaveState();
177
187
  const hasPendingDeckEdits =
@@ -207,17 +217,37 @@ export default function DeckEditor() {
207
217
  // tracking correct across a remount.
208
218
  const { generating: addSlideAgentGenerating, submit: addSlideAgentSubmit } =
209
219
  useAgentGenerating();
220
+ // Neither hook above is actually scoped to THIS run until its own submit()
221
+ // call has fired: before that, `activeTabRef` inside useAgentGenerating is
222
+ // still null, so both hooks report on ANY chat activity system-wide, same
223
+ // as the broad instance. The target is set (and the popover's persistence
224
+ // wait starts) well before that submit call, so an unrelated run finishing
225
+ // during that wait could otherwise satisfy either "seen true" guard below
226
+ // and clear the freshly-set target before this run ever sent a request.
227
+ // Both cleanup effects stay inert until this flips true.
228
+ const addSlideRequestSentRef = useRef(false);
210
229
  const sawAddSlideAgentGeneratingRef = useRef(false);
211
230
  useEffect(() => {
231
+ if (!addSlideRequestSentRef.current) return;
212
232
  if (addSlideAgentGenerating) {
213
233
  sawAddSlideAgentGeneratingRef.current = true;
214
234
  return;
215
235
  }
216
236
  if (addSlideGenerating && sawAddSlideAgentGeneratingRef.current) {
217
237
  sawAddSlideAgentGeneratingRef.current = false;
218
- setAddSlideGenerating(false);
238
+ endAddSlideGeneration();
219
239
  }
220
- }, [addSlideGenerating, addSlideAgentGenerating]);
240
+ }, [addSlideGenerating, addSlideAgentGenerating, endAddSlideGeneration]);
241
+ // Same guard for the broad `generating` signal below, which is never scoped
242
+ // to this run at all (by design — it reflects ANY agent chat activity).
243
+ const sawGeneratingRef = useRef(false);
244
+ const submitAddSlideAgent = useCallback(
245
+ (message: string, context: string) => {
246
+ addSlideRequestSentRef.current = true;
247
+ addSlideAgentSubmit(message, context);
248
+ },
249
+ [addSlideAgentSubmit],
250
+ );
221
251
  // Generation intent can arrive after this route mounts because the user
222
252
  // answers pre-generation questions from the empty editor.
223
253
  const wasNewDeckCreation = useRef(searchParams.get("generating") === "1");
@@ -371,10 +401,18 @@ export default function DeckEditor() {
371
401
  });
372
402
 
373
403
  const showQuestionFlow = Boolean(questionFlowQuestions?.length);
404
+ const fillingPlaceholderSlideId = slideBeingFilledInPlace({
405
+ addSlideGenerating,
406
+ addSlideTargetId,
407
+ slides: deck?.slides ?? [],
408
+ blankContent: defaultSlideContent.blank,
409
+ });
374
410
  const generatingSlideVisible =
375
411
  canEdit &&
376
412
  !showQuestionFlow &&
377
- (isNewDeckGenerating || addSlideGenerating || showNewDeckGeneratingOverlay);
413
+ (isNewDeckGenerating ||
414
+ (addSlideGenerating && !fillingPlaceholderSlideId) ||
415
+ showNewDeckGeneratingOverlay);
378
416
  const showCurrentSlideEditor =
379
417
  !generatingSlideSelected &&
380
418
  !showNewDeckGeneratingOverlay &&
@@ -385,10 +423,20 @@ export default function DeckEditor() {
385
423
  }, [generatingSlideVisible]);
386
424
 
387
425
  // The add-slide request is finished once the agent stops generating, so the
388
- // rail's placeholder must not outlive it.
426
+ // rail's placeholder must not outlive it. Mirrors the "seen true first"
427
+ // guard above so this backstop can't fire while `generating` just hasn't
428
+ // caught up with a run that hasn't started sending yet.
389
429
  useEffect(() => {
390
- if (!generating) setAddSlideGenerating(false);
391
- }, [generating]);
430
+ if (!addSlideRequestSentRef.current) return;
431
+ if (generating) {
432
+ sawGeneratingRef.current = true;
433
+ return;
434
+ }
435
+ if (addSlideGenerating && sawGeneratingRef.current) {
436
+ sawGeneratingRef.current = false;
437
+ endAddSlideGeneration();
438
+ }
439
+ }, [generating, addSlideGenerating, endAddSlideGeneration]);
392
440
 
393
441
  // Below `md` the rail is a drawer behind a full-viewport dimming scrim; at
394
442
  // `md` and up it's docked with no scrim. `sidebarOpen` is seeded from the
@@ -1606,8 +1654,22 @@ export default function DeckEditor() {
1606
1654
  onCloseDescribe={() => setDescribeSlideId(null)}
1607
1655
  onAwaitAddSlidePersisted={() => flushDeckSave(id)}
1608
1656
  onRemoveFailedSlide={(slideId) => deleteSlide(id, slideId)}
1609
- addSlideAgentSubmit={addSlideAgentSubmit}
1610
- onAddSlideGeneratingChange={setAddSlideGenerating}
1657
+ addSlideAgentSubmit={submitAddSlideAgent}
1658
+ onAddSlideGeneratingChange={(isGenerating, targetSlideId) => {
1659
+ if (isGenerating) {
1660
+ // A new run starts clean: neither guard's "seen true"
1661
+ // state may carry over from an unrelated chat run, or
1662
+ // from whatever state the previous add-slide run left
1663
+ // behind, or the auto-clear effects below could fire on
1664
+ // stale state before this run even sends its request.
1665
+ sawGeneratingRef.current = false;
1666
+ sawAddSlideAgentGeneratingRef.current = false;
1667
+ addSlideRequestSentRef.current = false;
1668
+ }
1669
+ setAddSlideGenerating(isGenerating);
1670
+ setAddSlideTargetId(isGenerating ? targetSlideId : null);
1671
+ }}
1672
+ aiGeneratingSlideId={fillingPlaceholderSlideId}
1611
1673
  onSelectSlide={(slideId) => {
1612
1674
  setGeneratingSlideSelected(false);
1613
1675
  setActiveSlideId(slideId);
@@ -1,6 +1,5 @@
1
1
  import type { AgentNativeDeploymentEnvironment, AgentNativeConfig } from "../config.js";
2
- export declare const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
- export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
2
+ export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
4
3
  export declare function isBuilderIoEmployee(email: string | null | undefined): boolean;
5
4
  export declare function resolveEnvironmentChannel(config: AgentNativeConfig, hostname: string | undefined): Extract<AgentNativeDeploymentEnvironment, "beta" | "production"> | null;
6
5
  export declare function isBetaOptOutActive(value: string | number | null | undefined, now?: number): boolean;
@@ -2,12 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "@agent-native/toolkit/ui/button";
3
3
  import { Popover, PopoverContent, PopoverTrigger, } from "@agent-native/toolkit/ui/popover";
4
4
  import { useEffect, useMemo, useRef } from "react";
5
- import { BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
5
+ import { BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
6
6
  import { trackEvent } from "./analytics.js";
7
7
  import { injectedAgentNativeConfig } from "./app-config.js";
8
8
  import { useSession } from "./use-session.js";
9
- export const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
10
- export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
9
+ export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
11
10
  export function isBuilderIoEmployee(email) {
12
11
  return email?.trim().toLowerCase().endsWith("@builder.io") ?? false;
13
12
  }
@@ -224,6 +224,13 @@ export declare function emitSingleTemplateNetlifyBackgroundFunction(projectCwd:
224
224
  */
225
225
  export declare function assertEmittedBackgroundFunctionOnDisk(destDir: string, functionName: string): void;
226
226
  export declare function emitSingleTemplateNetlifyIntegrationRecoveryFunction(projectCwd: string): void;
227
+ /**
228
+ * A host-side prebuilt Netlify output can accidentally carry the native
229
+ * better-sqlite3 binary from the developer's machine. Netlify functions run
230
+ * on Linux, so fail before publication unless every copied binary is an ELF
231
+ * object produced by the Linux build.
232
+ */
233
+ export declare function findNonLinuxBetterSqlite3Binaries(serverDir: string): string[];
227
234
  /**
228
235
  * Nitro receives the React Router SSR build as prebuilt chunks, so its normal
229
236
  * dependency resolver cannot reliably fold the preserved bare `yjs` imports
@@ -2996,6 +2996,51 @@ function walkServerJavaScriptFiles(dir, onFile) {
2996
2996
  onFile(entryPath);
2997
2997
  }
2998
2998
  }
2999
+ /**
3000
+ * A host-side prebuilt Netlify output can accidentally carry the native
3001
+ * better-sqlite3 binary from the developer's machine. Netlify functions run
3002
+ * on Linux, so fail before publication unless every copied binary is an ELF
3003
+ * object produced by the Linux build.
3004
+ */
3005
+ export function findNonLinuxBetterSqlite3Binaries(serverDir) {
3006
+ const failures = [];
3007
+ const walk = (dir) => {
3008
+ if (!fs.existsSync(dir))
3009
+ return;
3010
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
3011
+ const entryPath = path.join(dir, entry.name);
3012
+ if (entry.isDirectory()) {
3013
+ walk(entryPath);
3014
+ continue;
3015
+ }
3016
+ if (entry.name !== "better_sqlite3.node")
3017
+ continue;
3018
+ const normalizedPath = entryPath.split(path.sep).join("/");
3019
+ if (!normalizedPath.includes("/node_modules/better-sqlite3/build/Release/better_sqlite3.node")) {
3020
+ continue;
3021
+ }
3022
+ const header = fs.readFileSync(entryPath).subarray(0, 20);
3023
+ const isLittleEndian = header[5] === 1;
3024
+ const machine = header.length >= 20 && header[5] === 1
3025
+ ? header.readUInt16LE(18)
3026
+ : header.length >= 20 && header[5] === 2
3027
+ ? header.readUInt16BE(18)
3028
+ : null;
3029
+ if (header.length < 20 ||
3030
+ header[0] !== 0x7f ||
3031
+ header[1] !== 0x45 ||
3032
+ header[2] !== 0x4c ||
3033
+ header[3] !== 0x46 ||
3034
+ header[4] !== 2 ||
3035
+ !isLittleEndian ||
3036
+ machine !== 62) {
3037
+ failures.push(entryPath);
3038
+ }
3039
+ }
3040
+ };
3041
+ walk(serverDir);
3042
+ return failures;
3043
+ }
2999
3044
  /**
3000
3045
  * Nitro receives the React Router SSR build as prebuilt chunks, so its normal
3001
3046
  * dependency resolver cannot reliably fold the preserved bare `yjs` imports
@@ -3242,6 +3287,12 @@ export function assertSingleTemplateNetlifyBuildOutput(projectCwd) {
3242
3287
  if (privateYjsImports.length > 0) {
3243
3288
  failures.push(`Netlify server bundle imports Nitro's internal tree-shaken _libs/yjs.mjs: ${privateYjsImports.join(", ")}`);
3244
3289
  }
3290
+ const nonLinuxBetterSqlite3Binaries = findNonLinuxBetterSqlite3Binaries(serverDir);
3291
+ if (nonLinuxBetterSqlite3Binaries.length > 0) {
3292
+ failures.push(`Netlify server bundle contains non-Linux better-sqlite3 native binaries: ${nonLinuxBetterSqlite3Binaries
3293
+ .map((filePath) => path.relative(projectCwd, filePath))
3294
+ .join(", ")}; build in Netlify's Linux environment instead of uploading a host-native prebuilt output`);
3295
+ }
3245
3296
  // React Router's filesystem route discovery can accidentally treat a
3246
3297
  // co-located *.test.ts route as production code. That bundles Vitest into
3247
3298
  // SSR and only fails when the first request executes the test helpers.
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
137
137
  inputSchema: {
138
138
  type: string;
139
139
  properties: {
140
+ count?: undefined;
140
141
  query?: undefined;
141
142
  minutes?: undefined;
142
143
  limit?: undefined;
143
144
  clientHint?: undefined;
144
145
  timestamp?: undefined;
145
146
  chapterId?: undefined;
146
- count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
+ count?: undefined;
162
163
  query: {
163
164
  type: string;
164
165
  description: string;
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
174
175
  clientHint?: undefined;
175
176
  timestamp?: undefined;
176
177
  chapterId?: undefined;
177
- count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
+ count?: undefined;
193
194
  minutes: {
194
195
  type: string;
195
196
  description: string;
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
199
200
  clientHint?: undefined;
200
201
  timestamp?: undefined;
201
202
  chapterId?: undefined;
202
- count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
+ count?: undefined;
219
220
  query: {
220
221
  type: string;
221
222
  description: string;
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
234
235
  };
235
236
  timestamp?: undefined;
236
237
  chapterId?: undefined;
237
- count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
+ count?: undefined;
253
254
  query?: undefined;
254
255
  minutes?: undefined;
255
256
  limit?: undefined;
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
263
264
  description: string;
264
265
  };
265
266
  chapterId?: undefined;
266
- count?: undefined;
267
267
  startAt?: undefined;
268
268
  endAt?: undefined;
269
269
  includeMicrophone?: undefined;
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
314
314
  type: string;
315
315
  required: string[];
316
316
  properties: {
317
+ count?: undefined;
317
318
  query?: undefined;
318
319
  minutes?: undefined;
319
320
  limit?: undefined;
320
321
  clientHint?: undefined;
321
322
  timestamp?: undefined;
322
323
  chapterId?: undefined;
323
- count?: undefined;
324
324
  startAt: {
325
325
  type: string;
326
326
  description: string;
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
349
349
  type: string;
350
350
  required: string[];
351
351
  properties: {
352
+ count?: undefined;
352
353
  query?: undefined;
353
354
  minutes?: undefined;
354
355
  limit?: undefined;
355
356
  clientHint?: undefined;
356
357
  timestamp?: undefined;
357
358
  chapterId?: undefined;
358
- count?: undefined;
359
359
  startAt?: undefined;
360
360
  endAt?: undefined;
361
361
  reason?: undefined;
@@ -13,13 +13,13 @@
13
13
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
14
14
  count: number;
15
15
  updated?: undefined;
16
- ok?: undefined;
17
16
  error?: undefined;
17
+ ok?: undefined;
18
18
  } | {
19
19
  count?: undefined;
20
20
  updated: number;
21
- ok?: undefined;
22
21
  error?: undefined;
22
+ ok?: undefined;
23
23
  } | {
24
24
  count?: undefined;
25
25
  updated?: undefined;
@@ -28,6 +28,6 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
28
28
  } | {
29
29
  count?: undefined;
30
30
  updated?: undefined;
31
- ok: boolean;
32
31
  error?: undefined;
32
+ ok: boolean;
33
33
  }>>;
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- ok?: undefined;
45
- error?: undefined;
46
44
  summary: import("./types.js").TraceSummary;
47
45
  spans: import("./types.js").TraceSpan[];
48
46
  id?: undefined;
49
- } | {
50
- ok?: undefined;
51
47
  error?: undefined;
48
+ ok?: undefined;
49
+ } | {
52
50
  summary?: undefined;
53
51
  spans?: undefined;
54
52
  id: string;
55
- } | {
53
+ error?: undefined;
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  summary?: undefined;
64
63
  spans?: undefined;
65
64
  id?: undefined;
65
+ error?: undefined;
66
66
  ok: boolean;
67
67
  }>>;
@@ -60,6 +60,7 @@ import { getConfiguredAppBasePath } from "./app-base-path.js";
60
60
  import { getAppProductionUrl } from "./app-url.js";
61
61
  import { readAnalyticsAnonymousId, readFirstTouchAttribution, signupAttributionFromCookieHeader, } from "./attribution.js";
62
62
  import { getAuthLoginMode } from "./auth-login-mode.js";
63
+ import { injectBetaOptOutPersistence } from "./beta-opt-out-html.js";
63
64
  import { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, getAuthSecret, getBetterAuth, getBetterAuthSync, isDeployPreview, } from "./better-auth-instance.js";
64
65
  import { BUILDER_CONNECT_PARAM, BUILDER_RELAY_PATH, BUILDER_RELAY_STATE_PARAM, verifyBuilderConnectTokenAndGetOwner, verifyBuilderPreviewRelayStateForCallback, } from "./builder-browser.js";
65
66
  import { resolveAuthCookieNamespace } from "./cookie-namespace.js";
@@ -346,7 +347,9 @@ export function getConfiguredLoginHtml(event) {
346
347
  const queryStart = url.indexOf("?");
347
348
  const rawPath = queryStart >= 0 ? url.slice(0, queryStart) : url;
348
349
  const loginHtml = config.getLoginHtml?.(event, rawPath) ?? config.loginHtml ?? null;
349
- return loginHtml ? injectLoginSocialImageMeta(loginHtml, event) : null;
350
+ return loginHtml
351
+ ? injectLoginSocialImageMeta(injectBetaOptOutPersistence(loginHtml), event)
352
+ : null;
350
353
  }
351
354
  /**
352
355
  * True only when the request originates from the local machine — the raw
@@ -1934,7 +1937,7 @@ function injectLoginSocialImageMeta(loginHtml, event) {
1934
1937
  loginHtml.slice(headCloseIdx));
1935
1938
  }
1936
1939
  function loginHtmlResponse(loginHtml, event) {
1937
- return new Response(injectAnalyticsIntoHtml(injectLoginSocialImageMeta(loginHtml, event)), {
1940
+ return new Response(injectAnalyticsIntoHtml(injectLoginSocialImageMeta(injectBetaOptOutPersistence(loginHtml), event)), {
1938
1941
  status: 200,
1939
1942
  headers: {
1940
1943
  "Content-Type": "text/html; charset=utf-8",
@@ -0,0 +1,7 @@
1
+ export declare const BETA_OPT_OUT_PERSISTENCE_MARKER = "Persist the beta opt-out before authentication";
2
+ /**
3
+ * Custom auth pages do not necessarily use the framework onboarding shell.
4
+ * Keep the production switcher's one-time opt-out behavior at the shared auth
5
+ * response boundary so those pages cannot drop the handoff before sign-in.
6
+ */
7
+ export declare function injectBetaOptOutPersistence(loginHtml: string): string;
@@ -0,0 +1,53 @@
1
+ import { BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, } from "../shared/environment-lanes.js";
2
+ export const BETA_OPT_OUT_PERSISTENCE_MARKER = "Persist the beta opt-out before authentication";
3
+ /**
4
+ * Custom auth pages do not necessarily use the framework onboarding shell.
5
+ * Keep the production switcher's one-time opt-out behavior at the shared auth
6
+ * response boundary so those pages cannot drop the handoff before sign-in.
7
+ */
8
+ export function injectBetaOptOutPersistence(loginHtml) {
9
+ if (loginHtml.includes(BETA_OPT_OUT_PERSISTENCE_MARKER))
10
+ return loginHtml;
11
+ const script = `<script data-agent-native-beta-opt-out>
12
+ // ${BETA_OPT_OUT_PERSISTENCE_MARKER}.
13
+ (function __anPersistBetaOptOut() {
14
+ try {
15
+ var optOutUrl = new URL(window.location.href);
16
+ var optOutValue = optOutUrl.searchParams.get(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
17
+ if (optOutValue === null) return;
18
+ var optOutExpiry = Number(optOutValue);
19
+ var optOutStorageReady = false;
20
+ try {
21
+ if (Number.isFinite(optOutExpiry) && optOutExpiry > Date.now()) {
22
+ window.localStorage.setItem(
23
+ ${JSON.stringify(BETA_OPT_OUT_STORAGE_KEY)},
24
+ String(optOutExpiry),
25
+ );
26
+ }
27
+ optOutStorageReady = true;
28
+ } catch (error) {
29
+ void error;
30
+ }
31
+ if (optOutStorageReady) {
32
+ optOutUrl.searchParams.delete(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
33
+ window.history.replaceState(null, '', optOutUrl.toString());
34
+ }
35
+ } catch (error) {
36
+ void error;
37
+ }
38
+ })();
39
+ </script>`;
40
+ const bodyCloseIndex = loginHtml.indexOf("</body>");
41
+ if (bodyCloseIndex >= 0) {
42
+ return (loginHtml.slice(0, bodyCloseIndex) +
43
+ script +
44
+ loginHtml.slice(bodyCloseIndex));
45
+ }
46
+ const headCloseIndex = loginHtml.indexOf("</head>");
47
+ if (headCloseIndex >= 0) {
48
+ return (loginHtml.slice(0, headCloseIndex) +
49
+ script +
50
+ loginHtml.slice(headCloseIndex));
51
+ }
52
+ return loginHtml + script;
53
+ }
@@ -11,7 +11,7 @@ import { getLocaleInitScript } from "../localization/server.js";
11
11
  import { DEFAULT_LOCALE, LOCALE_METADATA, LOCALE_STORAGE_KEY, SUPPORTED_LOCALES, localeDisplayName, } from "../localization/shared.js";
12
12
  import { NATIVE_AUTH_COPY } from "../shared/auth-copy.js";
13
13
  import { docsUrl } from "../shared/docs-url.js";
14
- import { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, ENVIRONMENT_BETA_HOSTS, } from "../shared/environment-lanes.js";
14
+ import { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, ENVIRONMENT_BETA_HOSTS, } from "../shared/environment-lanes.js";
15
15
  import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, } from "../shared/password-policy.js";
16
16
  import { signInJourneyInlineScript } from "../shared/sign-in-journey.js";
17
17
  import { AGENT_NATIVE_SOCIAL_IMAGE_ALT, AGENT_NATIVE_SOCIAL_IMAGE_HEIGHT, AGENT_NATIVE_SOCIAL_IMAGE_PATH, AGENT_NATIVE_SOCIAL_IMAGE_TYPE, AGENT_NATIVE_SOCIAL_IMAGE_WIDTH, withAgentNativeSocialImageCacheBuster, } from "../shared/social-meta.js";
@@ -1433,6 +1433,34 @@ ${marketing.description ? ` <p class="app-desc" data-marketing-field="descr
1433
1433
  if (!switcher || !button || !popover || !productionLink) return;
1434
1434
  if (window.parent !== window) return;
1435
1435
 
1436
+ // Persist the beta opt-out before authentication replaces this cached shell.
1437
+ try {
1438
+ var optOutUrl = new URL(window.location.href);
1439
+ var optOutValue = optOutUrl.searchParams.get(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
1440
+ if (optOutValue !== null) {
1441
+ var optOutExpiry = Number(optOutValue);
1442
+ var optOutIsActive = Number.isFinite(optOutExpiry) && optOutExpiry > Date.now();
1443
+ var optOutStorageReady = false;
1444
+ try {
1445
+ if (optOutIsActive) {
1446
+ window.localStorage.setItem(
1447
+ ${JSON.stringify(BETA_OPT_OUT_STORAGE_KEY)},
1448
+ String(optOutExpiry),
1449
+ );
1450
+ }
1451
+ optOutStorageReady = true;
1452
+ } catch (error) {
1453
+ void error;
1454
+ }
1455
+ if (optOutStorageReady) {
1456
+ optOutUrl.searchParams.delete(${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)});
1457
+ window.history.replaceState(null, '', optOutUrl.toString());
1458
+ }
1459
+ }
1460
+ } catch (error) {
1461
+ void error;
1462
+ }
1463
+
1436
1464
  var betaHosts = ${JSON.stringify(ENVIRONMENT_BETA_HOSTS)};
1437
1465
  var hostname = (window.location.hostname || '').toLowerCase().replace(/\\.$/, '');
1438
1466
  var productionHost = hostname.indexOf('beta.') === 0 ? hostname.slice(5) : '';
@@ -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
  }>>;
@@ -1,5 +1,6 @@
1
1
  export declare const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
2
2
  export declare const BETA_OPT_OUT_DURATION_MS: number;
3
+ export declare const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
4
  export declare const ENVIRONMENT_BETA_HOSTS: {
4
5
  readonly "agent-workspace.builder.io": "beta.agent-workspace.builder.io";
5
6
  readonly "analytics.agent-native.com": "beta.analytics.agent-native.com";
@@ -1,5 +1,6 @@
1
1
  export const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
2
2
  export const BETA_OPT_OUT_DURATION_MS = 24 * 60 * 60 * 1000;
3
+ export const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
3
4
  export const ENVIRONMENT_BETA_HOSTS = {
4
5
  "agent-workspace.builder.io": "beta.agent-workspace.builder.io",
5
6
  "analytics.agent-native.com": "beta.analytics.agent-native.com",
@@ -93,13 +93,13 @@ configuration portion of `agent-native.json`:
93
93
  | `runtime.auth.enabled` | `boolean` | Declares whether the app expects the framework or a custom authentication layer. |
94
94
  | `runtime.database.required` | `boolean` | Declares whether production needs a persistent remote SQL database. |
95
95
  | `runtime.environment.required` | `string[]` | Declares additional required environment variable names. Names must match `[A-Za-z_][A-Za-z0-9_]*`; values do not belong in the config. |
96
- | `deployment.environment` | `"local"`, `"beta"`, `"production"`, or `"preview"` | Records the release lane that produced the current client bundle. |
96
+ | `deployment.environment` | `"local"`, `"beta"`, `"production"`, or `"preview"` | Records the release lane that produced the current client bundle. |
97
97
  | `diagnostics.failOnBuild` | `boolean` | When `true`, a production Vite build throws on runtime configuration issues. When absent or `false`, it reports them without failing the build. |
98
98
  | `instructions.runtime` | `string` | Optional relative Markdown path for the in-app runtime agent. Defaults to `AGENTS.md`. |
99
99
  | `instructions.development` | `string` | Optional relative Markdown path for development/coding agents. Defaults to `AGENTS.md`. |
100
- | `translations.locales` | `string[]` | Lists the locales the app intentionally ships. `en-US` remains the source locale. |
101
- | `changelog.enabled` | `boolean` | Enables the app changelog workflow and lets agents create user-facing entries. |
102
- | `harness` | `boolean` or `{ runtimes: string[] }` | Enables the hosted tools-only harness, optionally narrowed to `claude-code`, `codex`, `pi`, or `opencode`. See [Harness Agents](/docs/harness-agents). |
100
+ | `translations.locales` | `string[]` | Lists the locales the app intentionally ships. `en-US` remains the source locale. |
101
+ | `changelog.enabled` | `boolean` | Enables the app changelog workflow and lets agents create user-facing entries. |
102
+ | `harness` | `boolean` or `{ runtimes: string[] }` | Enables the hosted tools-only harness, optionally narrowed to `claude-code`, `codex`, `pi`, or `opencode`. See [Harness Agents](/docs/harness-agents). |
103
103
 
104
104
  ## Configuration vs environment variables
105
105
 
@@ -107,11 +107,11 @@ Use the config file or JSON manifest for stable, non-secret application
107
107
  defaults. Use environment variables or the scoped secret store for values that
108
108
  belong to a deployment or a user or organization connection:
109
109
 
110
- | Put it in | Examples | Notes |
111
- | --------- | -------- | ----- |
112
- | `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`. |
113
- | Deployment environment variables | `DATABASE_URL`, `BETTER_AUTH_SECRET`, `APP_URL`, `NITRO_PRESET`, provider keys, host-specific toggles | Set by the deployment platform or local `.env`. Keep secret values out of source control. See [Environment Variables](/docs/environment-variables). |
114
- | `runtime.environment.required` | `"PUBLIC_API_ORIGIN"`, `"STRIPE_PUBLISHABLE_KEY"` | A declaration of names the production readiness check must find. It does not set, expose, or replace the values. |
110
+ | Put it in | Examples | Notes |
111
+ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
112
+ | `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`. |
113
+ | Deployment environment variables | `DATABASE_URL`, `BETTER_AUTH_SECRET`, `APP_URL`, `NITRO_PRESET`, provider keys, host-specific toggles | Set by the deployment platform or local `.env`. Keep secret values out of source control. See [Environment Variables](/docs/environment-variables). |
114
+ | `runtime.environment.required` | `"PUBLIC_API_ORIGIN"`, `"STRIPE_PUBLISHABLE_KEY"` | A declaration of names the production readiness check must find. It does not set, expose, or replace the values. |
115
115
 
116
116
  For example, keep the app's public policy in the config file and inject the
117
117
  actual deployment values separately:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.0.0-beta-20260820023157",
3
+ "version": "0.0.0-beta-20260820071604",
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": {