@agent-native/core 0.0.0-beta-20260820052446 → 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);
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- ok?: undefined;
30
29
  error: string;
30
+ ok?: undefined;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -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;
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
- ok?: undefined;
46
44
  summary: import("./types.js").TraceSummary;
47
45
  spans: import("./types.js").TraceSpan[];
48
46
  id?: undefined;
49
- } | {
50
47
  error?: undefined;
51
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
  }>>;
@@ -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
  }>>;
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
51
51
  error: string;
52
52
  ok?: undefined;
53
53
  } | {
54
- error?: undefined;
55
54
  ok: boolean;
55
+ error?: undefined;
56
56
  }>;
57
57
  /** POST /_agent-native/resources/upload — upload a file as a resource */
58
58
  export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
73
73
  runId: string | null;
74
74
  expiresAt: number | null;
75
75
  metadata: string | null;
76
- error?: undefined;
77
76
  url: string;
78
77
  provider: string;
79
78
  storageSetupRequired?: undefined;
79
+ error?: undefined;
80
80
  } | {
81
81
  error: string;
82
82
  storageSetupRequired: boolean;
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- ok?: undefined;
38
37
  status?: undefined;
38
+ ok?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  removed?: undefined;
46
+ ok?: 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
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
- ok?: undefined;
58
57
  error: string;
59
58
  note?: undefined;
59
+ ok?: 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
  }>>;
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
27
27
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
28
28
  error: any;
29
29
  } | {
30
- error?: undefined;
31
30
  ok: boolean;
32
31
  key: string;
33
32
  baseUrlKey?: string;
34
33
  scope: AgentEngineApiKeyScope;
34
+ error?: undefined;
35
35
  }>>;
36
36
  export {};
@@ -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
+ }
@@ -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
  }>>;
@@ -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.0.0-beta-20260820052446",
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": {