@agent-native/core 0.0.0-beta-20260819183007 → 0.0.0-beta-20260819184657
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.
- package/corpus/templates/clips/app/components/player/video-player.tsx +12 -0
- package/corpus/templates/clips/app/routes/_app.dictate.tsx +18 -4
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +114 -20
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +83 -78
- package/corpus/templates/mail/actions/view-screen.ts +1 -1
- package/corpus/templates/mail/server/handlers/google-auth.ts +20 -22
- package/corpus/templates/mail/server/lib/gmail-query.ts +5 -2
- package/dist/client/EnvironmentBadge.d.ts +7 -13
- package/dist/client/EnvironmentBadge.js +43 -92
- package/dist/client/app-providers.js +4 -4
- package/dist/observability/routes.d.ts +2 -2
- package/dist/progress/routes.d.ts +1 -1
- package/dist/server/auth-marketing.js +3 -1
- package/dist/server/onboarding-html.js +121 -1
- package/dist/server/poll.d.ts +2 -0
- package/dist/server/poll.js +19 -1
- package/dist/shared/environment-lanes.d.ts +28 -0
- package/dist/shared/environment-lanes.js +61 -0
- package/package.json +1 -1
|
@@ -168,6 +168,7 @@ export interface VideoPlayerHandle {
|
|
|
168
168
|
play: () => Promise<void> | void;
|
|
169
169
|
pause: () => void;
|
|
170
170
|
seek: (ms: number) => void;
|
|
171
|
+
getCurrentOriginalMs: () => number;
|
|
171
172
|
setSpeed: (rate: number) => void;
|
|
172
173
|
toggleMute: () => void;
|
|
173
174
|
toggleCaptions: () => void;
|
|
@@ -1159,6 +1160,17 @@ export const VideoPlayer = forwardRef<VideoPlayerHandle, VideoPlayerProps>(
|
|
|
1159
1160
|
play: requestPlay,
|
|
1160
1161
|
pause: pauseVideo,
|
|
1161
1162
|
seek: seekToVisibleMs,
|
|
1163
|
+
getCurrentOriginalMs: () => {
|
|
1164
|
+
const v = videoRef.current;
|
|
1165
|
+
const liveOriginalMs =
|
|
1166
|
+
v &&
|
|
1167
|
+
Number.isFinite(v.currentTime) &&
|
|
1168
|
+
v.currentTime >= 0 &&
|
|
1169
|
+
v.currentTime < 1e7
|
|
1170
|
+
? Math.floor(v.currentTime * 1000)
|
|
1171
|
+
: currentMsRef.current;
|
|
1172
|
+
return liveOriginalMs;
|
|
1173
|
+
},
|
|
1162
1174
|
setSpeed: applySpeed,
|
|
1163
1175
|
toggleMute: () => {
|
|
1164
1176
|
if (videoRef.current) {
|
|
@@ -159,6 +159,10 @@ function dayBucket(iso: string): string {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
export function dictationsRefetchInterval(isActive: boolean): number | false {
|
|
163
|
+
return isActive ? 2_000 : false;
|
|
164
|
+
}
|
|
165
|
+
|
|
162
166
|
function sourceMeta(
|
|
163
167
|
source: string | undefined,
|
|
164
168
|
t: ReturnType<typeof useT>,
|
|
@@ -694,10 +698,6 @@ function DownloadDesktopAppCard() {
|
|
|
694
698
|
|
|
695
699
|
export default function DictateRoute() {
|
|
696
700
|
const t = useT();
|
|
697
|
-
const { data, isLoading, isError } = useActionQuery<
|
|
698
|
-
{ dictations: Dictation[] } | Dictation[] | undefined
|
|
699
|
-
>("list-dictations", {}, { retry: false });
|
|
700
|
-
|
|
701
701
|
const { isDesktopApp } = useDesktopPromo();
|
|
702
702
|
const [filter, setFilter] = useState<SourceFilter>("all");
|
|
703
703
|
const [listening, setListening] = useState(false);
|
|
@@ -706,6 +706,20 @@ export default function DictateRoute() {
|
|
|
706
706
|
const [speechSupported, setSpeechSupported] = useState(false);
|
|
707
707
|
const qc = useQueryClient();
|
|
708
708
|
const createDictation = useActionMutation("create-dictation");
|
|
709
|
+
const { data, isLoading, isError } = useActionQuery<
|
|
710
|
+
{ dictations: Dictation[] } | Dictation[] | undefined
|
|
711
|
+
>(
|
|
712
|
+
"list-dictations",
|
|
713
|
+
{},
|
|
714
|
+
{
|
|
715
|
+
retry: false,
|
|
716
|
+
// Action-backed mutations invalidate this query when a desktop-created
|
|
717
|
+
// dictation lands. Poll only while browser work is active or saving,
|
|
718
|
+
// rather than running a permanent interval over idle history.
|
|
719
|
+
refetchInterval: () =>
|
|
720
|
+
dictationsRefetchInterval(listening || createDictation.isPending),
|
|
721
|
+
},
|
|
722
|
+
);
|
|
709
723
|
|
|
710
724
|
const recognitionRef = useRef<SpeechRecognitionLike | null>(null);
|
|
711
725
|
const transcriptRef = useRef("");
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
IconSparkles,
|
|
46
46
|
IconExternalLink,
|
|
47
47
|
} from "@tabler/icons-react";
|
|
48
|
-
import { useQuery } from "@tanstack/react-query";
|
|
48
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
49
49
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
50
50
|
import { createPortal } from "react-dom";
|
|
51
51
|
import {
|
|
@@ -110,6 +110,64 @@ const PROCESSING_STUCK_TIMEOUT_MS = 12 * 60 * 1000;
|
|
|
110
110
|
const READY_MEDIA_SETTLE_POLL_MS = 20 * 1000;
|
|
111
111
|
const READY_MEDIA_SETTLE_POLL_INTERVAL_MS = 1000;
|
|
112
112
|
|
|
113
|
+
type RecordingReaction = {
|
|
114
|
+
id: string;
|
|
115
|
+
emoji: string;
|
|
116
|
+
videoTimestampMs: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
type PendingRecordingReaction = RecordingReaction & {
|
|
120
|
+
recordingId: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export function mergeRecordingReactions(
|
|
124
|
+
serverReactions: RecordingReaction[] | undefined,
|
|
125
|
+
pendingReactions: PendingRecordingReaction[],
|
|
126
|
+
recordingId: string | undefined,
|
|
127
|
+
) {
|
|
128
|
+
const seen = new Set<string>();
|
|
129
|
+
const merged: RecordingReaction[] = [];
|
|
130
|
+
const visiblePendingReactions = recordingId
|
|
131
|
+
? pendingReactions.filter(
|
|
132
|
+
(reaction) => reaction.recordingId === recordingId,
|
|
133
|
+
)
|
|
134
|
+
: [];
|
|
135
|
+
|
|
136
|
+
for (const reaction of [
|
|
137
|
+
...(serverReactions ?? []),
|
|
138
|
+
...visiblePendingReactions,
|
|
139
|
+
]) {
|
|
140
|
+
const key = `${reaction.id}:${reaction.emoji}:${reaction.videoTimestampMs}`;
|
|
141
|
+
if (seen.has(key)) continue;
|
|
142
|
+
seen.add(key);
|
|
143
|
+
merged.push(reaction);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return merged;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function removePendingReaction(
|
|
150
|
+
pendingReactions: PendingRecordingReaction[],
|
|
151
|
+
pendingId: string,
|
|
152
|
+
) {
|
|
153
|
+
return pendingReactions.filter((reaction) => reaction.id !== pendingId);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function handleReactionWrite(
|
|
157
|
+
response: { ok: boolean; status: number },
|
|
158
|
+
refresh: () => Promise<unknown>,
|
|
159
|
+
) {
|
|
160
|
+
if (!response.ok) throw new Error(`react failed: ${response.status}`);
|
|
161
|
+
// The write is authoritative. A transient read failure must not tell the
|
|
162
|
+
// player that the reaction failed.
|
|
163
|
+
void Promise.resolve()
|
|
164
|
+
.then(refresh)
|
|
165
|
+
.catch((refreshError) => {
|
|
166
|
+
console.warn("[clips] reaction refresh failed", refreshError);
|
|
167
|
+
});
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
113
171
|
export function meta() {
|
|
114
172
|
return [{ title: enMessages.recordingRoute.pageTitle }];
|
|
115
173
|
}
|
|
@@ -263,16 +321,7 @@ export default function RecordingPage() {
|
|
|
263
321
|
// live time bridge, so we fall back to the last position the player reported
|
|
264
322
|
// via onTimeUpdate (seek/initial start).
|
|
265
323
|
const resolvePlaybackMs = useCallback(() => {
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
typeof liveCt === "number" &&
|
|
269
|
-
Number.isFinite(liveCt) &&
|
|
270
|
-
liveCt >= 0 &&
|
|
271
|
-
liveCt < 1e7
|
|
272
|
-
) {
|
|
273
|
-
return Math.floor(liveCt * 1000);
|
|
274
|
-
}
|
|
275
|
-
return currentMs;
|
|
324
|
+
return playerRef.current?.getCurrentOriginalMs() ?? currentMs;
|
|
276
325
|
}, [currentMs]);
|
|
277
326
|
// The compact layout stacks the panel below the video, so switching tabs
|
|
278
327
|
// alone leaves the user looking at the player. Desktop always renders the
|
|
@@ -310,9 +359,13 @@ export default function RecordingPage() {
|
|
|
310
359
|
recordingId ? { type: "recording" as const, id: recordingId } : null,
|
|
311
360
|
[recordingId],
|
|
312
361
|
);
|
|
362
|
+
const queryClient = useQueryClient();
|
|
313
363
|
const lastPlayerStateWriteRef = useRef(0);
|
|
314
364
|
const readyMediaPollRef = useRef<{ key: string; until: number } | null>(null);
|
|
315
365
|
const [metadataRefreshUntil, setMetadataRefreshUntil] = useState(0);
|
|
366
|
+
const [pendingReactions, setPendingReactions] = useState<
|
|
367
|
+
PendingRecordingReaction[]
|
|
368
|
+
>([]);
|
|
316
369
|
|
|
317
370
|
const playerDataQ = useActionQuery<any>(
|
|
318
371
|
"get-recording-player-data",
|
|
@@ -414,7 +467,15 @@ export default function RecordingPage() {
|
|
|
414
467
|
| "viewer"
|
|
415
468
|
| undefined;
|
|
416
469
|
const comments = playerDataQ.data?.comments ?? [];
|
|
417
|
-
const reactions =
|
|
470
|
+
const reactions = useMemo(
|
|
471
|
+
() =>
|
|
472
|
+
mergeRecordingReactions(
|
|
473
|
+
playerDataQ.data?.reactions,
|
|
474
|
+
pendingReactions,
|
|
475
|
+
recordingId,
|
|
476
|
+
),
|
|
477
|
+
[pendingReactions, playerDataQ.data?.reactions, recordingId],
|
|
478
|
+
);
|
|
418
479
|
const chapters = playerDataQ.data?.chapters ?? [];
|
|
419
480
|
const transcriptSegments = playerDataQ.data?.transcript?.segments ?? [];
|
|
420
481
|
const transcriptFullText = playerDataQ.data?.transcript?.fullText ?? null;
|
|
@@ -1643,11 +1704,10 @@ export default function RecordingPage() {
|
|
|
1643
1704
|
},
|
|
1644
1705
|
)
|
|
1645
1706
|
.then((res) => {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1707
|
+
return handleReactionWrite(res, () =>
|
|
1708
|
+
playerDataQ.refetch(),
|
|
1709
|
+
);
|
|
1649
1710
|
})
|
|
1650
|
-
.then(() => true)
|
|
1651
1711
|
.catch((err) => {
|
|
1652
1712
|
console.warn("[clips] react failed", err);
|
|
1653
1713
|
return false;
|
|
@@ -1743,6 +1803,18 @@ export default function RecordingPage() {
|
|
|
1743
1803
|
onReact={(emoji) => {
|
|
1744
1804
|
tracking.reportReaction(emoji);
|
|
1745
1805
|
const liveMs = resolvePlaybackMs();
|
|
1806
|
+
const pendingReaction: PendingRecordingReaction = {
|
|
1807
|
+
id: `pending-${Date.now()}-${Math.random()
|
|
1808
|
+
.toString(36)
|
|
1809
|
+
.slice(2)}`,
|
|
1810
|
+
emoji,
|
|
1811
|
+
videoTimestampMs: liveMs,
|
|
1812
|
+
recordingId: recording.id,
|
|
1813
|
+
};
|
|
1814
|
+
setPendingReactions((current) => [
|
|
1815
|
+
...current,
|
|
1816
|
+
pendingReaction,
|
|
1817
|
+
]);
|
|
1746
1818
|
return fetch(
|
|
1747
1819
|
agentNativePath(
|
|
1748
1820
|
"/_agent-native/actions/react-to-recording",
|
|
@@ -1758,12 +1830,34 @@ export default function RecordingPage() {
|
|
|
1758
1830
|
},
|
|
1759
1831
|
)
|
|
1760
1832
|
.then((res) => {
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1833
|
+
const writeSucceeded = handleReactionWrite(
|
|
1834
|
+
res,
|
|
1835
|
+
() =>
|
|
1836
|
+
Promise.all([
|
|
1837
|
+
queryClient.invalidateQueries({
|
|
1838
|
+
queryKey: [
|
|
1839
|
+
"action",
|
|
1840
|
+
"get-recording-player-data",
|
|
1841
|
+
],
|
|
1842
|
+
}),
|
|
1843
|
+
playerDataQ.refetch(),
|
|
1844
|
+
]),
|
|
1845
|
+
);
|
|
1846
|
+
setPendingReactions((current) =>
|
|
1847
|
+
removePendingReaction(
|
|
1848
|
+
current,
|
|
1849
|
+
pendingReaction.id,
|
|
1850
|
+
),
|
|
1851
|
+
);
|
|
1852
|
+
return writeSucceeded;
|
|
1764
1853
|
})
|
|
1765
|
-
.then(() => true)
|
|
1766
1854
|
.catch((err) => {
|
|
1855
|
+
setPendingReactions((current) =>
|
|
1856
|
+
removePendingReaction(
|
|
1857
|
+
current,
|
|
1858
|
+
pendingReaction.id,
|
|
1859
|
+
),
|
|
1860
|
+
);
|
|
1767
1861
|
console.warn("[clips] react failed", err);
|
|
1768
1862
|
return false;
|
|
1769
1863
|
});
|
|
@@ -679,6 +679,7 @@ export default function ShareRoute() {
|
|
|
679
679
|
// an anonymous viewer sees the same controls but triggers the sign-in
|
|
680
680
|
// prompt instead (see `requireSignIn` below).
|
|
681
681
|
const viewerCanComment = Boolean(session) && viewerRole != null;
|
|
682
|
+
const viewerCanUseFullscreenInteractions = !session || viewerCanComment;
|
|
682
683
|
const viewerIsOwner = Boolean(dataQ.data?.data?.viewer?.isOwner);
|
|
683
684
|
const canReshareLink =
|
|
684
685
|
(viewerRole === "viewer" || viewerRole === "commenter") &&
|
|
@@ -1252,66 +1253,85 @@ export default function ShareRoute() {
|
|
|
1252
1253
|
cta={firstCta}
|
|
1253
1254
|
onCtaClick={() => tracking.reportCtaClick()}
|
|
1254
1255
|
onTimeUpdate={(ms) => setCurrentMs(ms)}
|
|
1255
|
-
onCommentClick={
|
|
1256
|
+
onCommentClick={
|
|
1257
|
+
viewerCanUseFullscreenInteractions
|
|
1258
|
+
? () => setPanel("comments")
|
|
1259
|
+
: undefined
|
|
1260
|
+
}
|
|
1256
1261
|
onFullscreenChange={setIsPlayerFullscreen}
|
|
1257
|
-
enableComments={
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1262
|
+
enableComments={
|
|
1263
|
+
recording.enableComments && viewerCanUseFullscreenInteractions
|
|
1264
|
+
}
|
|
1265
|
+
onAddComment={
|
|
1266
|
+
viewerCanUseFullscreenInteractions
|
|
1267
|
+
? () => {
|
|
1268
|
+
if (!session) {
|
|
1269
|
+
requireSignIn("comment");
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
const liveCt = isLoomEmbedBacked
|
|
1273
|
+
? null
|
|
1274
|
+
: playerRef.current?.video?.currentTime;
|
|
1275
|
+
const liveMs =
|
|
1276
|
+
typeof liveCt === "number" &&
|
|
1277
|
+
Number.isFinite(liveCt) &&
|
|
1278
|
+
liveCt >= 0 &&
|
|
1279
|
+
liveCt < 1e7
|
|
1280
|
+
? Math.floor(liveCt * 1000)
|
|
1281
|
+
: currentMs;
|
|
1282
|
+
setCommentAtMs(liveMs);
|
|
1283
|
+
setCommentOpen(true);
|
|
1284
|
+
}
|
|
1285
|
+
: undefined
|
|
1286
|
+
}
|
|
1287
|
+
enableReactions={
|
|
1288
|
+
recording.enableReactions && viewerCanUseFullscreenInteractions
|
|
1289
|
+
}
|
|
1290
|
+
onReact={
|
|
1291
|
+
viewerCanUseFullscreenInteractions
|
|
1292
|
+
? (emoji) => {
|
|
1293
|
+
if (!session) {
|
|
1294
|
+
requireSignIn("react");
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
tracking.reportReaction(emoji);
|
|
1298
|
+
const liveCt = isLoomEmbedBacked
|
|
1299
|
+
? null
|
|
1300
|
+
: playerRef.current?.video?.currentTime;
|
|
1301
|
+
const liveMs =
|
|
1302
|
+
typeof liveCt === "number" &&
|
|
1303
|
+
Number.isFinite(liveCt) &&
|
|
1304
|
+
liveCt >= 0 &&
|
|
1305
|
+
liveCt < 1e7
|
|
1306
|
+
? Math.floor(liveCt * 1000)
|
|
1307
|
+
: currentMs;
|
|
1308
|
+
return fetch(
|
|
1309
|
+
agentNativePath(
|
|
1310
|
+
"/_agent-native/actions/react-to-recording",
|
|
1311
|
+
),
|
|
1312
|
+
{
|
|
1313
|
+
method: "POST",
|
|
1314
|
+
headers: { "Content-Type": "application/json" },
|
|
1315
|
+
body: JSON.stringify({
|
|
1316
|
+
recordingId: recording.id,
|
|
1317
|
+
emoji,
|
|
1318
|
+
videoTimestampMs: liveMs,
|
|
1319
|
+
}),
|
|
1320
|
+
},
|
|
1321
|
+
)
|
|
1322
|
+
.then((res) => {
|
|
1323
|
+
if (!res.ok)
|
|
1324
|
+
throw new Error(`react failed: ${res.status}`);
|
|
1325
|
+
return dataQ.refetch();
|
|
1326
|
+
})
|
|
1327
|
+
.then(() => true)
|
|
1328
|
+
.catch((err) => {
|
|
1329
|
+
console.warn("[clips] react failed", err);
|
|
1330
|
+
return false;
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
: undefined
|
|
1334
|
+
}
|
|
1315
1335
|
className="h-full w-full rounded-none sm:rounded-xl"
|
|
1316
1336
|
/>
|
|
1317
1337
|
{commentOpen && viewerCanComment
|
|
@@ -1354,23 +1374,15 @@ export default function ShareRoute() {
|
|
|
1354
1374
|
{recording.enableComments ? (
|
|
1355
1375
|
<TimestampedCommentButton
|
|
1356
1376
|
enableComments={recording.enableComments}
|
|
1357
|
-
canComment
|
|
1377
|
+
canComment={!session || viewerCanComment}
|
|
1358
1378
|
className="shrink-0"
|
|
1359
1379
|
onOpen={() => {
|
|
1360
1380
|
if (!session) {
|
|
1361
1381
|
requireSignIn("comment");
|
|
1362
1382
|
return;
|
|
1363
1383
|
}
|
|
1364
|
-
const liveCt = isLoomEmbedBacked
|
|
1365
|
-
? null
|
|
1366
|
-
: playerRef.current?.video?.currentTime;
|
|
1367
1384
|
const liveMs =
|
|
1368
|
-
|
|
1369
|
-
Number.isFinite(liveCt) &&
|
|
1370
|
-
liveCt >= 0 &&
|
|
1371
|
-
liveCt < 1e7
|
|
1372
|
-
? Math.floor(liveCt * 1000)
|
|
1373
|
-
: currentMs;
|
|
1385
|
+
playerRef.current?.getCurrentOriginalMs() ?? currentMs;
|
|
1374
1386
|
setCommentAtMs(liveMs);
|
|
1375
1387
|
setCommentOpen(true);
|
|
1376
1388
|
}}
|
|
@@ -1379,22 +1391,15 @@ export default function ShareRoute() {
|
|
|
1379
1391
|
{recording.enableReactions ? (
|
|
1380
1392
|
<ReactionsTray
|
|
1381
1393
|
reactions={reactions}
|
|
1394
|
+
disabled={Boolean(session) && !viewerCanComment}
|
|
1382
1395
|
onReact={(emoji) => {
|
|
1383
1396
|
if (!session) {
|
|
1384
1397
|
requireSignIn("react");
|
|
1385
1398
|
return false;
|
|
1386
1399
|
}
|
|
1387
1400
|
tracking.reportReaction(emoji);
|
|
1388
|
-
const liveCt = isLoomEmbedBacked
|
|
1389
|
-
? null
|
|
1390
|
-
: playerRef.current?.video?.currentTime;
|
|
1391
1401
|
const liveMs =
|
|
1392
|
-
|
|
1393
|
-
Number.isFinite(liveCt) &&
|
|
1394
|
-
liveCt >= 0 &&
|
|
1395
|
-
liveCt < 1e7
|
|
1396
|
-
? Math.floor(liveCt * 1000)
|
|
1397
|
-
: currentMs;
|
|
1402
|
+
playerRef.current?.getCurrentOriginalMs() ?? currentMs;
|
|
1398
1403
|
return fetch(
|
|
1399
1404
|
agentNativePath(
|
|
1400
1405
|
"/_agent-native/actions/react-to-recording",
|
|
@@ -70,7 +70,7 @@ async function fetchEmailList(
|
|
|
70
70
|
|
|
71
71
|
const gmailQuery = buildGmailEmailSearchQuery({ view, q: search });
|
|
72
72
|
const effectiveQuery =
|
|
73
|
-
view === "all" && !search ? "" : gmailQuery || "in:inbox
|
|
73
|
+
view === "all" && !search ? "" : gmailQuery || "in:inbox";
|
|
74
74
|
const { messages } = await listGmailMessages(
|
|
75
75
|
effectiveQuery,
|
|
76
76
|
50,
|
|
@@ -69,17 +69,25 @@ function googleOAuthErrorPayload(
|
|
|
69
69
|
error?.name === "OAuthAccountOwnedByOtherUserError"
|
|
70
70
|
) {
|
|
71
71
|
const account = error.accountId || "This Google account";
|
|
72
|
+
const message = `${account} is connected to another login. Sign out, then sign in with ${account}.`;
|
|
72
73
|
return {
|
|
73
|
-
message
|
|
74
|
+
message,
|
|
74
75
|
code: "account_owner_mismatch",
|
|
75
76
|
accountId: error.accountId,
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
const msg = error?.message || "Unknown error";
|
|
81
|
+
const statusCode = Number(error?.statusCode || error?.status || 0);
|
|
80
82
|
const isPermission =
|
|
83
|
+
error?.oauthErrorCode === "access_denied" ||
|
|
84
|
+
error?.oauthErrorCode === "forbidden" ||
|
|
85
|
+
error?.oauthErrorCode === "insufficient_scope" ||
|
|
81
86
|
msg.includes("Insufficient Permission") ||
|
|
82
|
-
msg.includes("insufficient_scope")
|
|
87
|
+
msg.includes("insufficient_scope") ||
|
|
88
|
+
/insufficient authentication scopes/i.test(msg) ||
|
|
89
|
+
(statusCode === 403 &&
|
|
90
|
+
/\b(?:scope|permission|forbidden|access denied)\b/i.test(msg));
|
|
83
91
|
return {
|
|
84
92
|
message: isPermission
|
|
85
93
|
? "This account wasn't granted the required permissions. Make sure you check all the permission boxes on the consent screen. If the app is in testing mode, add this email as a test user in Google Cloud Console."
|
|
@@ -212,16 +220,11 @@ export const handleGoogleCallback = defineEventHandler(
|
|
|
212
220
|
if (googleError) {
|
|
213
221
|
const errorDesc =
|
|
214
222
|
(query.error_description as string | undefined) || googleError;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
: `Connection failed: ${errorDesc}`;
|
|
221
|
-
return googleOAuthErrorResponse(event, new Error(userMessage), {
|
|
222
|
-
desktop,
|
|
223
|
-
flowId,
|
|
224
|
-
});
|
|
223
|
+
return googleOAuthErrorResponse(
|
|
224
|
+
event,
|
|
225
|
+
Object.assign(new Error(errorDesc), { oauthErrorCode: googleError }),
|
|
226
|
+
{ desktop, flowId },
|
|
227
|
+
);
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
const code = query.code as string;
|
|
@@ -442,16 +445,11 @@ export const handleGoogleAddAccountCallback = defineEventHandler(
|
|
|
442
445
|
if (googleError) {
|
|
443
446
|
const errorDesc =
|
|
444
447
|
(query.error_description as string | undefined) || googleError;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
: `Connection failed: ${errorDesc}`;
|
|
451
|
-
return googleOAuthErrorResponse(event, new Error(userMessage), {
|
|
452
|
-
desktop,
|
|
453
|
-
flowId,
|
|
454
|
-
});
|
|
448
|
+
return googleOAuthErrorResponse(
|
|
449
|
+
event,
|
|
450
|
+
Object.assign(new Error(errorDesc), { oauthErrorCode: googleError }),
|
|
451
|
+
{ desktop, flowId },
|
|
452
|
+
);
|
|
455
453
|
}
|
|
456
454
|
|
|
457
455
|
const { redirectUri, owner: stateOwner } = state;
|
|
@@ -6,8 +6,11 @@ import { isSelfAddressedThread } from "@shared/self-notes.js";
|
|
|
6
6
|
import type { EmailMessage } from "@shared/types.js";
|
|
7
7
|
|
|
8
8
|
export const VIEW_QUERIES: Record<string, string> = {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Keep sent replies in a matching Gmail thread. The local thread filter
|
|
10
|
+
// below excludes sent-only threads while preserving received inbox threads
|
|
11
|
+
// whose latest message was sent by the user.
|
|
12
|
+
inbox: "in:inbox",
|
|
13
|
+
unread: "is:unread in:inbox",
|
|
11
14
|
starred: "is:starred",
|
|
12
15
|
sent: "in:sent",
|
|
13
16
|
drafts: "in:drafts",
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import type { AgentNativeDeploymentEnvironment, AgentNativeConfig } from "../config.js";
|
|
2
|
-
export declare const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
|
|
3
2
|
export declare const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
|
|
4
|
-
export
|
|
5
|
-
export interface EnvironmentBadgeTargets {
|
|
6
|
-
betaHost: string;
|
|
7
|
-
productionHost: string;
|
|
8
|
-
}
|
|
3
|
+
export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
|
|
9
4
|
export declare function isBuilderIoEmployee(email: string | null | undefined): boolean;
|
|
10
|
-
export declare function resolveEnvironmentTargets(hostname: string | undefined): EnvironmentBadgeTargets | null;
|
|
11
5
|
export declare function resolveEnvironmentChannel(config: AgentNativeConfig, hostname: string | undefined): Extract<AgentNativeDeploymentEnvironment, "beta" | "production"> | null;
|
|
12
|
-
export declare function buildEnvironmentUrl(sourceHref: string, targetHost: string): string | null;
|
|
13
6
|
export declare function isBetaOptOutActive(value: string | number | null | undefined, now?: number): boolean;
|
|
14
|
-
export declare function buildEnvironmentOptOutUrl(sourceHref: string, targetHost: string, now?: number): string | null;
|
|
15
7
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
8
|
+
* First-party hosted lane switcher. Beta is intentionally visible before
|
|
9
|
+
* authentication so a visitor can always leave beta from the sign-in page.
|
|
10
|
+
* Production remains an internal auto-redirect lane for authenticated staff.
|
|
19
11
|
*/
|
|
20
|
-
export declare function EnvironmentBadge(
|
|
12
|
+
export declare function EnvironmentBadge({ showProduction, }?: {
|
|
13
|
+
showProduction?: boolean;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
@@ -2,47 +2,15 @@ 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
6
|
import { trackEvent } from "./analytics.js";
|
|
6
7
|
import { injectedAgentNativeConfig } from "./app-config.js";
|
|
7
8
|
import { useSession } from "./use-session.js";
|
|
8
|
-
export const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
|
|
9
9
|
export const BETA_OPT_OUT_STORAGE_KEY = "agent-native:beta-opt-out-until";
|
|
10
|
-
export
|
|
11
|
-
const ENVIRONMENT_BETA_HOSTS = {
|
|
12
|
-
"agent-workspace.builder.io": "beta.agent-workspace.builder.io",
|
|
13
|
-
"analytics.agent-native.com": "beta.analytics.agent-native.com",
|
|
14
|
-
"assets.agent-native.com": "beta.assets.agent-native.com",
|
|
15
|
-
"brain.agent-native.com": "beta.brain.agent-native.com",
|
|
16
|
-
"calendar.agent-native.com": "beta.calendar.agent-native.com",
|
|
17
|
-
"chat.agent-native.com": "beta.chat.agent-native.com",
|
|
18
|
-
"clips.agent-native.com": "beta.clips.agent-native.com",
|
|
19
|
-
"content.agent-native.com": "beta.content.agent-native.com",
|
|
20
|
-
"crm.agent-native.com": "beta.crm.agent-native.com",
|
|
21
|
-
"design.agent-native.com": "beta.design.agent-native.com",
|
|
22
|
-
"dispatch.agent-native.com": "beta.dispatch.agent-native.com",
|
|
23
|
-
"factory.agent-native.com": "beta.factory.agent-native.com",
|
|
24
|
-
"forms.agent-native.com": "beta.forms.agent-native.com",
|
|
25
|
-
"macros.agent-native.com": "beta.macros.agent-native.com",
|
|
26
|
-
"mail.agent-native.com": "beta.mail.agent-native.com",
|
|
27
|
-
"plan.agent-native.com": "beta.plan.agent-native.com",
|
|
28
|
-
"slides.agent-native.com": "beta.slides.agent-native.com",
|
|
29
|
-
};
|
|
10
|
+
export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, } from "../shared/environment-lanes.js";
|
|
30
11
|
export function isBuilderIoEmployee(email) {
|
|
31
12
|
return email?.trim().toLowerCase().endsWith("@builder.io") ?? false;
|
|
32
13
|
}
|
|
33
|
-
export function resolveEnvironmentTargets(hostname) {
|
|
34
|
-
const normalized = hostname?.trim().toLowerCase().replace(/\.$/, "");
|
|
35
|
-
if (!normalized)
|
|
36
|
-
return null;
|
|
37
|
-
const productionHost = normalized.replace(/^beta\./, "");
|
|
38
|
-
const betaHost = ENVIRONMENT_BETA_HOSTS[productionHost];
|
|
39
|
-
if (!betaHost)
|
|
40
|
-
return null;
|
|
41
|
-
return {
|
|
42
|
-
betaHost,
|
|
43
|
-
productionHost,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
14
|
export function resolveEnvironmentChannel(config, hostname) {
|
|
47
15
|
const configured = config.deployment?.environment;
|
|
48
16
|
if (configured === "beta" || configured === "production") {
|
|
@@ -55,37 +23,10 @@ export function resolveEnvironmentChannel(config, hostname) {
|
|
|
55
23
|
? "beta"
|
|
56
24
|
: "production";
|
|
57
25
|
}
|
|
58
|
-
export function buildEnvironmentUrl(sourceHref, targetHost) {
|
|
59
|
-
try {
|
|
60
|
-
const target = new URL(sourceHref);
|
|
61
|
-
target.protocol = "https:";
|
|
62
|
-
target.hostname = targetHost;
|
|
63
|
-
target.port = "";
|
|
64
|
-
return target.toString();
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
// coercion-ok: Invalid navigation input is an explicit absent target.
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
26
|
export function isBetaOptOutActive(value, now = Date.now()) {
|
|
72
27
|
const expiry = typeof value === "number" ? value : Number(value);
|
|
73
28
|
return Number.isFinite(expiry) && expiry > now;
|
|
74
29
|
}
|
|
75
|
-
export function buildEnvironmentOptOutUrl(sourceHref, targetHost, now = Date.now()) {
|
|
76
|
-
const targetHref = buildEnvironmentUrl(sourceHref, targetHost);
|
|
77
|
-
if (!targetHref)
|
|
78
|
-
return null;
|
|
79
|
-
try {
|
|
80
|
-
const target = new URL(targetHref);
|
|
81
|
-
target.searchParams.set(BETA_OPT_OUT_QUERY_PARAM, String(now + BETA_OPT_OUT_DURATION_MS));
|
|
82
|
-
return target.toString();
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// coercion-ok: buildEnvironmentUrl already validated the URL.
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
30
|
function readBetaOptOutUntil(now = Date.now()) {
|
|
90
31
|
if (typeof window === "undefined")
|
|
91
32
|
return null;
|
|
@@ -133,29 +74,29 @@ function consumeBetaOptOutQueryParam(sourceHref, now = Date.now()) {
|
|
|
133
74
|
function EnvironmentLink({ label, href }) {
|
|
134
75
|
return (_jsx(Button, { asChild: true, className: "w-full justify-center", size: "sm", variant: "outline", children: _jsx("a", { href: href, children: label }) }));
|
|
135
76
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
77
|
+
function EnvironmentBadgeContent({ environment, targets, }) {
|
|
78
|
+
if (typeof window === "undefined")
|
|
79
|
+
return null;
|
|
80
|
+
const currentHref = window.location.href;
|
|
81
|
+
const betaHref = buildEnvironmentUrl(currentHref, targets.betaHost);
|
|
82
|
+
const productionHref = buildEnvironmentOptOutUrl(currentHref, targets.productionHost);
|
|
83
|
+
if (environment === "beta" ? !productionHref : !betaHref)
|
|
84
|
+
return null;
|
|
85
|
+
const label = environment === "beta" ? "beta" : "prod";
|
|
86
|
+
const title = environment === "beta"
|
|
87
|
+
? "You're on Agent Native Beta"
|
|
88
|
+
: "You're on Agent Native Production";
|
|
89
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { "aria-label": `Open ${title.toLowerCase()} switcher`, className: "fixed bottom-3 right-3 z-[100] h-6 min-w-0 rounded-xl border-border/80 bg-background/95 px-2 text-[11px] font-semibold uppercase tracking-[0.5px] shadow-sm backdrop-blur-sm", size: "sm", variant: environment === "beta" ? "default" : "outline", children: label }) }), _jsxs(PopoverContent, { align: "center", className: "w-[280px] p-5", side: "top", sideOffset: 8, children: [_jsx("div", { className: "mb-1 text-sm font-semibold leading-5", children: title }), _jsx("div", { className: "mb-4 text-sm text-muted-foreground", children: "Choose where you want to continue." }), _jsx("div", { className: "grid gap-2", children: environment === "beta" ? (_jsx(EnvironmentLink, { href: productionHref, label: "Switch to production" })) : (_jsx(EnvironmentLink, { href: betaHref, label: "Go to beta" })) })] })] }));
|
|
90
|
+
}
|
|
91
|
+
function ProductionEnvironmentBadge({ targets, }) {
|
|
142
92
|
const { session, status } = useSession();
|
|
143
|
-
const config = useMemo(injectedAgentNativeConfig, []);
|
|
144
|
-
const didAutoRedirect = useRef(false);
|
|
145
|
-
const hostname = typeof window === "undefined" ? undefined : window.location.hostname;
|
|
146
|
-
const environment = resolveEnvironmentChannel(config, hostname);
|
|
147
|
-
const targets = resolveEnvironmentTargets(hostname);
|
|
148
93
|
const isEligible = typeof window !== "undefined" &&
|
|
149
94
|
window.parent === window &&
|
|
150
95
|
status === "authenticated" &&
|
|
151
|
-
isBuilderIoEmployee(session?.email)
|
|
152
|
-
|
|
153
|
-
!!targets;
|
|
96
|
+
isBuilderIoEmployee(session?.email);
|
|
97
|
+
const didAutoRedirect = useRef(false);
|
|
154
98
|
useEffect(() => {
|
|
155
|
-
if (!isEligible ||
|
|
156
|
-
environment !== "production" ||
|
|
157
|
-
!targets ||
|
|
158
|
-
didAutoRedirect.current) {
|
|
99
|
+
if (!isEligible || didAutoRedirect.current) {
|
|
159
100
|
return;
|
|
160
101
|
}
|
|
161
102
|
if (readBetaOptOutUntil() !== null)
|
|
@@ -172,21 +113,31 @@ export function EnvironmentBadge() {
|
|
|
172
113
|
trigger: "automatic_redirect",
|
|
173
114
|
});
|
|
174
115
|
window.location.replace(betaHref);
|
|
175
|
-
}, [
|
|
176
|
-
if (!isEligible
|
|
116
|
+
}, [isEligible, session?.email, status, targets.betaHost]);
|
|
117
|
+
if (!isEligible)
|
|
118
|
+
return null;
|
|
119
|
+
return _jsx(EnvironmentBadgeContent, { environment: "production", targets: targets });
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* First-party hosted lane switcher. Beta is intentionally visible before
|
|
123
|
+
* authentication so a visitor can always leave beta from the sign-in page.
|
|
124
|
+
* Production remains an internal auto-redirect lane for authenticated staff.
|
|
125
|
+
*/
|
|
126
|
+
export function EnvironmentBadge({ showProduction = true, } = {}) {
|
|
127
|
+
const config = useMemo(injectedAgentNativeConfig, []);
|
|
128
|
+
const hostname = typeof window === "undefined" ? undefined : window.location.hostname;
|
|
129
|
+
const environment = resolveEnvironmentChannel(config, hostname);
|
|
130
|
+
const targets = resolveEnvironmentTargets(hostname);
|
|
131
|
+
if (typeof window === "undefined" ||
|
|
132
|
+
window.parent !== window ||
|
|
177
133
|
!environment ||
|
|
178
|
-
!targets
|
|
179
|
-
typeof window === "undefined") {
|
|
134
|
+
!targets) {
|
|
180
135
|
return null;
|
|
181
136
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (!
|
|
137
|
+
if (environment === "beta") {
|
|
138
|
+
return _jsx(EnvironmentBadgeContent, { environment: "beta", targets: targets });
|
|
139
|
+
}
|
|
140
|
+
if (!showProduction)
|
|
186
141
|
return null;
|
|
187
|
-
|
|
188
|
-
const title = environment === "beta"
|
|
189
|
-
? "You're on Agent Native Beta"
|
|
190
|
-
: "You're on Agent Native Production";
|
|
191
|
-
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { "aria-label": `Open ${title.toLowerCase()} switcher`, className: "fixed bottom-3 right-3 z-[100] h-6 min-w-0 rounded-xl border-border/80 bg-background/95 px-2 text-[11px] font-semibold uppercase tracking-[0.5px] shadow-sm backdrop-blur-sm", size: "sm", variant: environment === "beta" ? "default" : "outline", children: label }) }), _jsxs(PopoverContent, { align: "center", className: "w-[280px] p-5", side: "top", sideOffset: 8, children: [_jsx("div", { className: "mb-1 text-sm font-semibold leading-5", children: title }), _jsx("div", { className: "mb-4 text-sm text-muted-foreground", children: "Choose where you want to continue." }), _jsx("div", { className: "grid gap-2", children: environment === "beta" ? (_jsx(EnvironmentLink, { href: productionHref, label: "Switch to production" })) : (_jsx(EnvironmentLink, { href: betaHref, label: "Go to beta" })) })] })] }));
|
|
142
|
+
return _jsx(ProductionEnvironmentBadge, { targets: targets });
|
|
192
143
|
}
|
|
@@ -143,14 +143,14 @@ function DocumentTitleGuard({ fallbackTitle }) {
|
|
|
143
143
|
}, [fallbackTitle]);
|
|
144
144
|
return null;
|
|
145
145
|
}
|
|
146
|
-
function ProvidersInner({ queryClient, defaultTheme = "system", themeAttribute = "class", tooltipDelayDuration, toaster = DEFAULT_TOASTER, disableThemeTransitions = true, i18n, documentTitleFallback, children, }) {
|
|
146
|
+
function ProvidersInner({ queryClient, defaultTheme = "system", themeAttribute = "class", tooltipDelayDuration, toaster = DEFAULT_TOASTER, disableThemeTransitions = true, i18n, documentTitleFallback, showProductionEnvironmentBadge, children, }) {
|
|
147
147
|
const localizedChildren = i18n === false ? (children) : (_jsx(AgentNativeI18nProvider, { ...(i18n ?? {}), children: children }));
|
|
148
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(ThemeProvider, { attribute: themeAttribute, defaultTheme: defaultTheme, enableSystem: true, disableTransitionOnChange: disableThemeTransitions, children: [_jsx(EmbeddedThemeSync, {}), _jsxs(TooltipProvider, { delayDuration: tooltipDelayDuration, children: [localizedChildren, _jsx(DocumentTitleGuard, { fallbackTitle: documentTitleFallback }), _jsx(RuntimeConfigNotice, {}), _jsx(RoutedAppEnhancements, {}), toaster] })] }) }));
|
|
148
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(ThemeProvider, { attribute: themeAttribute, defaultTheme: defaultTheme, enableSystem: true, disableTransitionOnChange: disableThemeTransitions, children: [_jsx(EmbeddedThemeSync, {}), _jsxs(TooltipProvider, { delayDuration: tooltipDelayDuration, children: [localizedChildren, _jsx(DocumentTitleGuard, { fallbackTitle: documentTitleFallback }), _jsx(RuntimeConfigNotice, {}), _jsx(RoutedAppEnhancements, {}), _jsx(EnvironmentBadge, { showProduction: showProductionEnvironmentBadge }), toaster] })] }) }));
|
|
149
149
|
}
|
|
150
150
|
export function AppProviders({ queryClient, isPublicPath = false, clientOnlyFallback, sessionBypass = false, defaultTheme, themeAttribute, tooltipDelayDuration, toaster, disableThemeTransitions, i18n, documentTitleFallback, children, }) {
|
|
151
151
|
const fallback = clientOnlyFallback ?? _jsx(DefaultSpinner, {});
|
|
152
152
|
if (isPublicPath) {
|
|
153
|
-
return (_jsx(ProvidersInner, { queryClient: queryClient, defaultTheme: defaultTheme, themeAttribute: themeAttribute, tooltipDelayDuration: tooltipDelayDuration, toaster: toaster, disableThemeTransitions: disableThemeTransitions, i18n: i18n, documentTitleFallback: documentTitleFallback, children: children }));
|
|
153
|
+
return (_jsx(ProvidersInner, { queryClient: queryClient, defaultTheme: defaultTheme, themeAttribute: themeAttribute, tooltipDelayDuration: tooltipDelayDuration, toaster: toaster, disableThemeTransitions: disableThemeTransitions, i18n: i18n, documentTitleFallback: documentTitleFallback, showProductionEnvironmentBadge: false, children: children }));
|
|
154
154
|
}
|
|
155
|
-
return (_jsx(ClientOnly, { fallback: fallback, children: _jsx(ProvidersInner, { queryClient: queryClient, defaultTheme: defaultTheme, themeAttribute: themeAttribute, tooltipDelayDuration: tooltipDelayDuration, toaster: toaster, disableThemeTransitions: disableThemeTransitions, i18n: i18n, documentTitleFallback: documentTitleFallback, children: _jsx(RequireSession, { bypass: sessionBypass, fallback: fallback, children: sessionBypass ? (children) : (
|
|
155
|
+
return (_jsx(ClientOnly, { fallback: fallback, children: _jsx(ProvidersInner, { queryClient: queryClient, defaultTheme: defaultTheme, themeAttribute: themeAttribute, tooltipDelayDuration: tooltipDelayDuration, toaster: toaster, disableThemeTransitions: disableThemeTransitions, i18n: i18n, documentTitleFallback: documentTitleFallback, showProductionEnvironmentBadge: !sessionBypass, children: _jsx(RequireSession, { bypass: sessionBypass, fallback: fallback, children: sessionBypass ? (children) : (_jsx(FirstRunOnboardingStartupGate, { children: children })) }) }) }));
|
|
156
156
|
}
|
|
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
ok?: undefined;
|
|
45
|
+
error?: undefined;
|
|
46
46
|
summary: import("./types.js").TraceSummary;
|
|
47
47
|
spans: import("./types.js").TraceSpan[];
|
|
48
48
|
id?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
ok?: undefined;
|
|
51
|
+
error?: undefined;
|
|
52
52
|
summary?: undefined;
|
|
53
53
|
spans?: undefined;
|
|
54
54
|
id: string;
|
|
@@ -203,7 +203,9 @@ function slugFromHost(value) {
|
|
|
203
203
|
if (!host)
|
|
204
204
|
return undefined;
|
|
205
205
|
if (host.endsWith(".agent-native.com")) {
|
|
206
|
-
|
|
206
|
+
const hostSlug = host.slice(0, -".agent-native.com".length);
|
|
207
|
+
return (normalizeSlug(hostSlug) ??
|
|
208
|
+
normalizeSlug(hostSlug.replace(/^beta[.-]/, "")));
|
|
207
209
|
}
|
|
208
210
|
return undefined;
|
|
209
211
|
}
|
|
@@ -11,6 +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
15
|
import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, } from "../shared/password-policy.js";
|
|
15
16
|
import { signInJourneyInlineScript } from "../shared/sign-in-journey.js";
|
|
16
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";
|
|
@@ -1026,6 +1027,15 @@ export function getOnboardingHtml(opts = {}) {
|
|
|
1026
1027
|
<div class="locale-menu" id="auth-locale-menu" role="menu" aria-labelledby="auth-locale-trigger" hidden>
|
|
1027
1028
|
${localeMenuItemsHtml}
|
|
1028
1029
|
</div>
|
|
1030
|
+
</div>`;
|
|
1031
|
+
const environmentBadgeHtml = `
|
|
1032
|
+
<div class="environment-switcher" id="environment-switcher" hidden>
|
|
1033
|
+
<button type="button" class="environment-badge" id="environment-badge" aria-expanded="false" aria-controls="environment-popover">beta</button>
|
|
1034
|
+
<div class="environment-popover" id="environment-popover" role="dialog" aria-labelledby="environment-popover-title" hidden>
|
|
1035
|
+
<div class="environment-popover-title" id="environment-popover-title">You're on Agent Native Beta</div>
|
|
1036
|
+
<div class="environment-popover-copy">Choose where you want to continue.</div>
|
|
1037
|
+
<a class="environment-production-link" id="environment-production-link" href="">Switch to production</a>
|
|
1038
|
+
</div>
|
|
1029
1039
|
</div>`;
|
|
1030
1040
|
const hostedSignupLegalNotice = opts.signupLegalNotice === undefined &&
|
|
1031
1041
|
isAgentNativeHostedHost(opts.requestHost)
|
|
@@ -1412,8 +1422,53 @@ ${marketing.description ? ` <p class="app-desc" data-marketing-field="descr
|
|
|
1412
1422
|
}
|
|
1413
1423
|
}
|
|
1414
1424
|
if (!reducedMotion) startAnimation();
|
|
1415
|
-
|
|
1425
|
+
})();`
|
|
1416
1426
|
: "";
|
|
1427
|
+
const environmentBadgeScript = `
|
|
1428
|
+
(function __anInitEnvironmentBadge() {
|
|
1429
|
+
var switcher = document.getElementById('environment-switcher');
|
|
1430
|
+
var button = document.getElementById('environment-badge');
|
|
1431
|
+
var popover = document.getElementById('environment-popover');
|
|
1432
|
+
var productionLink = document.getElementById('environment-production-link');
|
|
1433
|
+
if (!switcher || !button || !popover || !productionLink) return;
|
|
1434
|
+
if (window.parent !== window) return;
|
|
1435
|
+
|
|
1436
|
+
var betaHosts = ${JSON.stringify(ENVIRONMENT_BETA_HOSTS)};
|
|
1437
|
+
var hostname = (window.location.hostname || '').toLowerCase().replace(/\\.$/, '');
|
|
1438
|
+
var productionHost = hostname.indexOf('beta.') === 0 ? hostname.slice(5) : '';
|
|
1439
|
+
if (!productionHost || betaHosts[productionHost] !== hostname) return;
|
|
1440
|
+
|
|
1441
|
+
try {
|
|
1442
|
+
var productionUrl = new URL(window.location.href);
|
|
1443
|
+
productionUrl.protocol = 'https:';
|
|
1444
|
+
productionUrl.hostname = productionHost;
|
|
1445
|
+
productionUrl.port = '';
|
|
1446
|
+
productionUrl.searchParams.set(
|
|
1447
|
+
${JSON.stringify(BETA_OPT_OUT_QUERY_PARAM)},
|
|
1448
|
+
String(Date.now() + ${BETA_OPT_OUT_DURATION_MS}),
|
|
1449
|
+
);
|
|
1450
|
+
productionLink.href = productionUrl.toString();
|
|
1451
|
+
} catch (error) {
|
|
1452
|
+
void error;
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
function setOpen(open) {
|
|
1457
|
+
popover.hidden = !open;
|
|
1458
|
+
button.setAttribute('aria-expanded', String(open));
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
switcher.hidden = false;
|
|
1462
|
+
button.addEventListener('click', function() {
|
|
1463
|
+
setOpen(popover.hidden);
|
|
1464
|
+
});
|
|
1465
|
+
document.addEventListener('click', function(event) {
|
|
1466
|
+
if (!switcher.contains(event.target)) setOpen(false);
|
|
1467
|
+
});
|
|
1468
|
+
document.addEventListener('keydown', function(event) {
|
|
1469
|
+
if (event.key === 'Escape') setOpen(false);
|
|
1470
|
+
});
|
|
1471
|
+
})();`;
|
|
1417
1472
|
return `<!DOCTYPE html>
|
|
1418
1473
|
<html lang="${DEFAULT_LOCALE}" dir="ltr">
|
|
1419
1474
|
<head>
|
|
@@ -1553,6 +1608,69 @@ ${hasMarketing
|
|
|
1553
1608
|
.locale-menu-item[aria-checked="true"] .locale-menu-check {
|
|
1554
1609
|
opacity: 1;
|
|
1555
1610
|
}
|
|
1611
|
+
/* guard:allow-raw-color - standalone auth HTML has no app theme token layer */
|
|
1612
|
+
.environment-switcher {
|
|
1613
|
+
position: fixed;
|
|
1614
|
+
right: max(0.75rem, env(safe-area-inset-right));
|
|
1615
|
+
bottom: max(0.75rem, env(safe-area-inset-bottom));
|
|
1616
|
+
z-index: 100;
|
|
1617
|
+
}
|
|
1618
|
+
.environment-switcher[hidden],
|
|
1619
|
+
.environment-popover[hidden] { display: none; }
|
|
1620
|
+
.environment-badge {
|
|
1621
|
+
display: inline-flex;
|
|
1622
|
+
align-items: center;
|
|
1623
|
+
justify-content: center;
|
|
1624
|
+
height: 1.5rem;
|
|
1625
|
+
min-width: 0;
|
|
1626
|
+
padding: 0 0.5rem;
|
|
1627
|
+
background: #3a3a3a;
|
|
1628
|
+
color: #fff;
|
|
1629
|
+
border: 1px solid rgba(255,255,255,0.16);
|
|
1630
|
+
border-radius: 0.75rem;
|
|
1631
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.25);
|
|
1632
|
+
font: inherit;
|
|
1633
|
+
font-size: 0.6875rem;
|
|
1634
|
+
font-weight: 600;
|
|
1635
|
+
letter-spacing: 0.03125rem;
|
|
1636
|
+
line-height: 1;
|
|
1637
|
+
text-transform: uppercase;
|
|
1638
|
+
cursor: pointer;
|
|
1639
|
+
}
|
|
1640
|
+
.environment-badge:hover,
|
|
1641
|
+
.environment-badge[aria-expanded="true"] { background: #4a4a4a; }
|
|
1642
|
+
.environment-badge:focus-visible,
|
|
1643
|
+
.environment-production-link:focus-visible {
|
|
1644
|
+
outline: 2px solid #33c4ff;
|
|
1645
|
+
outline-offset: 2px;
|
|
1646
|
+
}
|
|
1647
|
+
.environment-popover {
|
|
1648
|
+
position: absolute;
|
|
1649
|
+
right: 0;
|
|
1650
|
+
bottom: calc(100% + 0.5rem);
|
|
1651
|
+
width: min(17.5rem, calc(100vw - 1.5rem));
|
|
1652
|
+
padding: 1.25rem;
|
|
1653
|
+
background: #141414;
|
|
1654
|
+
color: #fff;
|
|
1655
|
+
border: 1px solid rgba(255,255,255,0.12);
|
|
1656
|
+
border-radius: 0.75rem;
|
|
1657
|
+
box-shadow: 0 18px 50px rgba(0,0,0,0.42);
|
|
1658
|
+
}
|
|
1659
|
+
.environment-popover-title { margin-bottom: 0.25rem; font-size: 0.875rem; font-weight: 600; line-height: 1.25rem; }
|
|
1660
|
+
.environment-popover-copy { margin-bottom: 1rem; color: #888; font-size: 0.875rem; line-height: 1.25rem; }
|
|
1661
|
+
.environment-production-link {
|
|
1662
|
+
display: flex;
|
|
1663
|
+
align-items: center;
|
|
1664
|
+
justify-content: center;
|
|
1665
|
+
min-height: 2rem;
|
|
1666
|
+
padding: 0.375rem 0.75rem;
|
|
1667
|
+
color: #e5e5e5;
|
|
1668
|
+
border: 1px solid rgba(255,255,255,0.16);
|
|
1669
|
+
border-radius: 0.375rem;
|
|
1670
|
+
font-size: 0.8125rem;
|
|
1671
|
+
text-decoration: none;
|
|
1672
|
+
}
|
|
1673
|
+
.environment-production-link:hover { background: #242424; }
|
|
1556
1674
|
.card {
|
|
1557
1675
|
width: 100%;
|
|
1558
1676
|
max-width: 400px;
|
|
@@ -1972,6 +2090,7 @@ ${embeddedAuthCss}
|
|
|
1972
2090
|
</head>
|
|
1973
2091
|
<body${simplifiedAuth ? ' class="simplified-auth"' : hasMarketing ? ' class="has-marketing"' : ""}>
|
|
1974
2092
|
${localePickerHtml}
|
|
2093
|
+
${environmentBadgeHtml}
|
|
1975
2094
|
${marketingPanelHtml}
|
|
1976
2095
|
<div class="card">
|
|
1977
2096
|
<h1 id="heading"${i18nAttr(googleOnly ? "signInTitle" : "welcomeTitle")}>${esc(t(googleOnly ? "signInTitle" : "welcomeTitle"))}</h1>
|
|
@@ -2065,6 +2184,7 @@ ${signupLocalModeNoteHtml}
|
|
|
2065
2184
|
<span${i18nAttr("localNotePrefix")}>${esc(t("localNotePrefix"))}</span> (<strong>${getConnectionLabel()}</strong>)<span${i18nAttr("localNoteSuffix")}>${esc(t("localNoteSuffix"))}</span>
|
|
2066
2185
|
</p>${marketingCloseHtml}
|
|
2067
2186
|
<script>
|
|
2187
|
+
${environmentBadgeScript}
|
|
2068
2188
|
function __anBasePath() {
|
|
2069
2189
|
var configured = ${JSON.stringify(appBasePath)};
|
|
2070
2190
|
if (configured) return configured;
|
package/dist/server/poll.d.ts
CHANGED
|
@@ -158,6 +158,7 @@ export declare class AppSyncState {
|
|
|
158
158
|
private lastDurablePrune;
|
|
159
159
|
private durablePruneFailures;
|
|
160
160
|
private durableWriteFailures;
|
|
161
|
+
private allocatorReseedFailures;
|
|
161
162
|
/**
|
|
162
163
|
* Whether we've seeded `version` from the DB. In serverless (Netlify,
|
|
163
164
|
* Vercel, etc.) each invocation starts fresh — without seeding, `version`
|
|
@@ -252,6 +253,7 @@ export declare class AppSyncState {
|
|
|
252
253
|
*/
|
|
253
254
|
private pruneDurableEvents;
|
|
254
255
|
private reportDurableWriteFailure;
|
|
256
|
+
private reportAllocatorReseedFailure;
|
|
255
257
|
persistSyncEvent(event: ChangeEvent, dedupeKey?: string, presetId?: string): Promise<void>;
|
|
256
258
|
/**
|
|
257
259
|
* Persist with a DB-allocated version (see ALLOCATING_INSERT_SQL). Returns
|
package/dist/server/poll.js
CHANGED
|
@@ -302,6 +302,7 @@ export class AppSyncState {
|
|
|
302
302
|
lastDurablePrune = Date.now();
|
|
303
303
|
durablePruneFailures = 0;
|
|
304
304
|
durableWriteFailures = 0;
|
|
305
|
+
allocatorReseedFailures = 0;
|
|
305
306
|
/**
|
|
306
307
|
* Whether we've seeded `version` from the DB. In serverless (Netlify,
|
|
307
308
|
* Vercel, etc.) each invocation starts fresh — without seeding, `version`
|
|
@@ -566,6 +567,12 @@ export class AppSyncState {
|
|
|
566
567
|
console.warn(`[agent-native] sync_events write failed for ${event.source}/${event.type}${event.key ? `/${event.key}` : ""}; durable replay is unavailable until the database recovers:`, error instanceof Error ? error.message : String(error));
|
|
567
568
|
}
|
|
568
569
|
}
|
|
570
|
+
reportAllocatorReseedFailure(error) {
|
|
571
|
+
this.allocatorReseedFailures++;
|
|
572
|
+
if (this.allocatorReseedFailures === 1) {
|
|
573
|
+
console.warn("[agent-native] sync version allocator reseed failed; retrying allocation:", error instanceof Error ? error.message : String(error));
|
|
574
|
+
}
|
|
575
|
+
}
|
|
569
576
|
async persistSyncEvent(event, dedupeKey, presetId) {
|
|
570
577
|
if (!(await this.ensureSyncEventsTable()))
|
|
571
578
|
return;
|
|
@@ -628,9 +635,20 @@ export class AppSyncState {
|
|
|
628
635
|
let result = await client.execute({ sql: ALLOCATING_INSERT_SQL, args });
|
|
629
636
|
if (result.rows.length === 0) {
|
|
630
637
|
// Allocator row missing (e.g. wiped after ensure): reseed, retry once.
|
|
631
|
-
|
|
638
|
+
try {
|
|
639
|
+
await client.execute(SEED_SYNC_VERSION_SQL);
|
|
640
|
+
this.allocatorReseedFailures = 0;
|
|
641
|
+
}
|
|
642
|
+
catch (error) {
|
|
643
|
+
// Keep the retry/fallback behavior, but do not hide the reason the
|
|
644
|
+
// allocator was unavailable. A missing warning here makes a broken
|
|
645
|
+
// allocator look like a normal retry until version ordering drifts.
|
|
646
|
+
this.reportAllocatorReseedFailure(error);
|
|
647
|
+
}
|
|
632
648
|
result = await client.execute({ sql: ALLOCATING_INSERT_SQL, args });
|
|
633
649
|
}
|
|
650
|
+
if (result.rows.length > 0)
|
|
651
|
+
this.allocatorReseedFailures = 0;
|
|
634
652
|
const version = timestampValue(result.rows[0]?.version);
|
|
635
653
|
await this.pruneDurableEvents(client);
|
|
636
654
|
return version > 0 ? version : null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
|
|
2
|
+
export declare const BETA_OPT_OUT_DURATION_MS: number;
|
|
3
|
+
export declare const ENVIRONMENT_BETA_HOSTS: {
|
|
4
|
+
readonly "agent-workspace.builder.io": "beta.agent-workspace.builder.io";
|
|
5
|
+
readonly "analytics.agent-native.com": "beta.analytics.agent-native.com";
|
|
6
|
+
readonly "assets.agent-native.com": "beta.assets.agent-native.com";
|
|
7
|
+
readonly "brain.agent-native.com": "beta.brain.agent-native.com";
|
|
8
|
+
readonly "calendar.agent-native.com": "beta.calendar.agent-native.com";
|
|
9
|
+
readonly "chat.agent-native.com": "beta.chat.agent-native.com";
|
|
10
|
+
readonly "clips.agent-native.com": "beta.clips.agent-native.com";
|
|
11
|
+
readonly "content.agent-native.com": "beta.content.agent-native.com";
|
|
12
|
+
readonly "crm.agent-native.com": "beta.crm.agent-native.com";
|
|
13
|
+
readonly "design.agent-native.com": "beta.design.agent-native.com";
|
|
14
|
+
readonly "dispatch.agent-native.com": "beta.dispatch.agent-native.com";
|
|
15
|
+
readonly "factory.agent-native.com": "beta.factory.agent-native.com";
|
|
16
|
+
readonly "forms.agent-native.com": "beta.forms.agent-native.com";
|
|
17
|
+
readonly "macros.agent-native.com": "beta.macros.agent-native.com";
|
|
18
|
+
readonly "mail.agent-native.com": "beta.mail.agent-native.com";
|
|
19
|
+
readonly "plan.agent-native.com": "beta.plan.agent-native.com";
|
|
20
|
+
readonly "slides.agent-native.com": "beta.slides.agent-native.com";
|
|
21
|
+
};
|
|
22
|
+
export interface EnvironmentBadgeTargets {
|
|
23
|
+
betaHost: string;
|
|
24
|
+
productionHost: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function resolveEnvironmentTargets(hostname: string | undefined): EnvironmentBadgeTargets | null;
|
|
27
|
+
export declare function buildEnvironmentUrl(sourceHref: string, targetHost: string): string | null;
|
|
28
|
+
export declare function buildEnvironmentOptOutUrl(sourceHref: string, targetHost: string, now?: number): string | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const BETA_OPT_OUT_QUERY_PARAM = "agentNativeBetaOptOut";
|
|
2
|
+
export const BETA_OPT_OUT_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
3
|
+
export const ENVIRONMENT_BETA_HOSTS = {
|
|
4
|
+
"agent-workspace.builder.io": "beta.agent-workspace.builder.io",
|
|
5
|
+
"analytics.agent-native.com": "beta.analytics.agent-native.com",
|
|
6
|
+
"assets.agent-native.com": "beta.assets.agent-native.com",
|
|
7
|
+
"brain.agent-native.com": "beta.brain.agent-native.com",
|
|
8
|
+
"calendar.agent-native.com": "beta.calendar.agent-native.com",
|
|
9
|
+
"chat.agent-native.com": "beta.chat.agent-native.com",
|
|
10
|
+
"clips.agent-native.com": "beta.clips.agent-native.com",
|
|
11
|
+
"content.agent-native.com": "beta.content.agent-native.com",
|
|
12
|
+
"crm.agent-native.com": "beta.crm.agent-native.com",
|
|
13
|
+
"design.agent-native.com": "beta.design.agent-native.com",
|
|
14
|
+
"dispatch.agent-native.com": "beta.dispatch.agent-native.com",
|
|
15
|
+
"factory.agent-native.com": "beta.factory.agent-native.com",
|
|
16
|
+
"forms.agent-native.com": "beta.forms.agent-native.com",
|
|
17
|
+
"macros.agent-native.com": "beta.macros.agent-native.com",
|
|
18
|
+
"mail.agent-native.com": "beta.mail.agent-native.com",
|
|
19
|
+
"plan.agent-native.com": "beta.plan.agent-native.com",
|
|
20
|
+
"slides.agent-native.com": "beta.slides.agent-native.com",
|
|
21
|
+
};
|
|
22
|
+
export function resolveEnvironmentTargets(hostname) {
|
|
23
|
+
const normalized = hostname?.trim().toLowerCase().replace(/\.$/, "");
|
|
24
|
+
if (!normalized)
|
|
25
|
+
return null;
|
|
26
|
+
const productionHost = normalized.replace(/^beta\./, "");
|
|
27
|
+
const betaHost = ENVIRONMENT_BETA_HOSTS[productionHost];
|
|
28
|
+
if (!betaHost)
|
|
29
|
+
return null;
|
|
30
|
+
return {
|
|
31
|
+
betaHost,
|
|
32
|
+
productionHost,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function buildEnvironmentUrl(sourceHref, targetHost) {
|
|
36
|
+
try {
|
|
37
|
+
const target = new URL(sourceHref);
|
|
38
|
+
target.protocol = "https:";
|
|
39
|
+
target.hostname = targetHost;
|
|
40
|
+
target.port = "";
|
|
41
|
+
return target.toString();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// coercion-ok: Invalid navigation input is an explicit absent target.
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function buildEnvironmentOptOutUrl(sourceHref, targetHost, now = Date.now()) {
|
|
49
|
+
const targetHref = buildEnvironmentUrl(sourceHref, targetHost);
|
|
50
|
+
if (!targetHref)
|
|
51
|
+
return null;
|
|
52
|
+
try {
|
|
53
|
+
const target = new URL(targetHref);
|
|
54
|
+
target.searchParams.set(BETA_OPT_OUT_QUERY_PARAM, String(now + BETA_OPT_OUT_DURATION_MS));
|
|
55
|
+
return target.toString();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// coercion-ok: buildEnvironmentUrl already validated the URL.
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20260819184657",
|
|
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": {
|