@agent-native/core-corpus 0.207.1 → 0.207.2-nightly-20261012212922

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/README.md CHANGED
@@ -32,4 +32,4 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core-corpus/corpu
32
32
 
33
33
  ## Generated Counts
34
34
 
35
- - template files: 12051
35
+ - template files: 12099
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","analytics-alert-jobs","analytics-rollup-backfill-jobs","auth","collab","config","core-routes","creative-context","dashboard-report-jobs","db","feature-flags","labs","onboarding","otel","session-replay-retention-jobs","transactional-emails","uptime-monitor-jobs"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","creative-context","db","labs","onboarding","otel"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","brain-jobs","core-routes","db","otel"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","core-routes","db","event-rules","oauth-refresh","otel","transactional-emails"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","otel"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","calendar-jobs","config","core-routes","db","feature-flags","labs","onboarding","onboarding-calendar","otel","transactional-email-catalog"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","collab","core-routes","creative-context","db","feature-flags","labs","onboarding","otel","suggested-edits","transactional-emails"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","core-routes","db","otel"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","assets-mcp","auth","builder-host-embed-headers","collab","config","core-routes","creative-context","db","e2e-attachment-storage","feature-flags","journey-canvas-stage-cleanup","labs","local-import-asset-upload","otel","review"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","core-routes","db","feature-flags","identity-sso","integrations","org-apps-directory","otel","setup-dispatch"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","core-routes","db","otel","transactional-emails"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["agent-chat","auth","core-routes","db","integrations","mail-jobs","oauth-refresh","otel"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["00-mcp","agent-chat","auth","collab","core-routes","db","labs","otel","plan-assets","transactional-emails"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ // AUTO-GENERATED by @agent-native/core deploy build
2
+ import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
3
+
4
+ const pluginStems = ["_dev-upload-stub","agent-chat","auth","collab","config","core-routes","creative-context","db","feature-flags","labs","otel","transactional-emails"];
5
+
6
+ export default function markBuildDiscoveredPlugins(nitroApp) {
7
+ for (const stem of pluginStems) {
8
+ markDefaultPluginProvided(nitroApp, stem);
9
+ }
10
+ }
@@ -267,6 +267,14 @@ export function isBrowserSessionPath(pathname: string) {
267
267
  return pathname === basePath || pathname.startsWith(`${basePath}/`);
268
268
  }
269
269
 
270
+ function isBrowserSessionClaimRequest(method: string, pathname: string) {
271
+ const matchesPath =
272
+ typeof browserSessionClaimRequestRule.path === "string"
273
+ ? browserSessionClaimRequestRule.path === pathname
274
+ : browserSessionClaimRequestRule.path.test(pathname);
275
+ return matchesPath && browserSessionClaimRequestRule.method === method;
276
+ }
277
+
270
278
  type SaveReloadRequestAbortRule = {
271
279
  path: string | RegExp;
272
280
  method?: string;
@@ -277,6 +285,7 @@ const navigationAbortErrors = ["NS_BINDING_ABORTED", "net::ERR_ABORTED"];
277
285
  // Browser-session requests abort after at least ten seconds; leave timer slack.
278
286
  const reloadNavigationAbortMaxRequestAgeMs = 9_000;
279
287
  const reloadNavigationConsoleGraceMs = 1_000;
288
+ const reloadNavigationSuccessfulClaimGraceMs = 250;
280
289
 
281
290
  const browserSessionRegistrationRequestRule: SaveReloadRequestAbortRule = {
282
291
  path: "/_agent-native/browser-sessions",
@@ -310,10 +319,16 @@ export function isExpectedSaveReloadWatchedRequestAbort(
310
319
  method?: string,
311
320
  requestWasPendingAtReloadNavigation = false,
312
321
  requestAgeMs = Number.POSITIVE_INFINITY,
322
+ requestStartedDuringNavigation = false,
323
+ competingClaimStartedAfterNavigation = false,
324
+ requestSameOrigin = false,
313
325
  ) {
314
326
  return (
315
327
  activePhase === "save/reload" &&
328
+ requestSameOrigin &&
316
329
  requestWasPendingAtReloadNavigation &&
330
+ !requestStartedDuringNavigation &&
331
+ !competingClaimStartedAfterNavigation &&
317
332
  requestAgeMs >= 0 &&
318
333
  requestAgeMs < reloadNavigationAbortMaxRequestAgeMs &&
319
334
  saveReloadRequestAbortRules.some((rule) => {
@@ -336,8 +351,14 @@ type WatchedRequestNavigationCandidate = {
336
351
  method: string;
337
352
  ageMs: number;
338
353
  settledAgeMs?: number;
354
+ responseStatus?: number;
355
+ sameOrigin?: boolean;
339
356
  requestWasPendingAtNavigation?: boolean;
340
357
  requestFinishedSuccessfully?: boolean;
358
+ completedSuccessfullyBeforeNavigation?: boolean;
359
+ completedBeforeNavigationAgeMs?: number;
360
+ requestStartedDuringNavigation?: boolean;
361
+ requestStartedAfterNavigation?: boolean;
341
362
  competingRequestStartedAfterNavigation?: boolean;
342
363
  competingClaimStartedAfterNavigation?: boolean;
343
364
  competingRegistrationStartedAfterNavigation?: boolean;
@@ -347,12 +368,22 @@ function isExpectedWatchedRequestNavigationAbort(
347
368
  candidate: WatchedRequestNavigationCandidate,
348
369
  rules: readonly SaveReloadRequestAbortRule[],
349
370
  allowFinishedRequestGrace = false,
371
+ rejectCompetingClaim = false,
350
372
  ) {
351
373
  return (
352
374
  candidate.requestWasPendingAtNavigation === true &&
375
+ candidate.requestStartedDuringNavigation !== true &&
376
+ candidate.requestStartedAfterNavigation !== true &&
353
377
  candidate.competingRequestStartedAfterNavigation !== true &&
378
+ candidate.sameOrigin === true &&
379
+ (!rejectCompetingClaim ||
380
+ candidate.competingClaimStartedAfterNavigation !== true) &&
354
381
  (candidate.requestFinishedSuccessfully !== true ||
355
382
  (allowFinishedRequestGrace &&
383
+ candidate.sameOrigin === true &&
384
+ candidate.responseStatus !== undefined &&
385
+ candidate.responseStatus >= 200 &&
386
+ candidate.responseStatus < 300 &&
356
387
  candidate.settledAgeMs !== undefined &&
357
388
  candidate.settledAgeMs >= 0 &&
358
389
  candidate.settledAgeMs < reloadNavigationConsoleGraceMs)) &&
@@ -397,6 +428,7 @@ export function isExpectedWatchedRequestCorsError(
397
428
  candidate,
398
429
  rules,
399
430
  activePhase === "save/reload",
431
+ activePhase === "save/reload",
400
432
  ),
401
433
  ).length === 1
402
434
  );
@@ -405,14 +437,52 @@ export function isExpectedWatchedRequestCorsError(
405
437
  function hasExactlyOneExpectedBrowserSessionAbort(
406
438
  candidates: WatchedRequestNavigationCandidate[],
407
439
  rules: readonly SaveReloadRequestAbortRule[],
440
+ allowFinishedRequestGrace = false,
441
+ rejectCompetingClaim = false,
408
442
  ) {
409
443
  return (
410
444
  candidates.filter((candidate) =>
411
- isExpectedWatchedRequestNavigationAbort(candidate, rules),
445
+ isExpectedWatchedRequestNavigationAbort(
446
+ candidate,
447
+ rules,
448
+ allowFinishedRequestGrace,
449
+ rejectCompetingClaim,
450
+ ),
412
451
  ).length === 1
413
452
  );
414
453
  }
415
454
 
455
+ function isExpectedCompletedClaimBeforeReload(
456
+ candidate: WatchedRequestNavigationCandidate,
457
+ ) {
458
+ const matchesPath =
459
+ typeof browserSessionClaimRequestRule.path === "string"
460
+ ? browserSessionClaimRequestRule.path === candidate.pathname
461
+ : browserSessionClaimRequestRule.path.test(candidate.pathname);
462
+ return (
463
+ candidate.completedSuccessfullyBeforeNavigation === true &&
464
+ candidate.requestWasPendingAtNavigation === false &&
465
+ candidate.requestStartedDuringNavigation !== true &&
466
+ candidate.requestStartedAfterNavigation !== true &&
467
+ candidate.competingClaimStartedAfterNavigation !== true &&
468
+ candidate.method === browserSessionClaimRequestRule.method &&
469
+ matchesPath &&
470
+ candidate.sameOrigin === true &&
471
+ candidate.ageMs >= 0 &&
472
+ candidate.ageMs < reloadNavigationAbortMaxRequestAgeMs &&
473
+ candidate.responseStatus !== undefined &&
474
+ candidate.responseStatus >= 200 &&
475
+ candidate.responseStatus < 300 &&
476
+ candidate.completedBeforeNavigationAgeMs !== undefined &&
477
+ candidate.completedBeforeNavigationAgeMs >= 0 &&
478
+ candidate.completedBeforeNavigationAgeMs <
479
+ reloadNavigationSuccessfulClaimGraceMs &&
480
+ candidate.settledAgeMs !== undefined &&
481
+ candidate.settledAgeMs >= 0 &&
482
+ candidate.settledAgeMs < reloadNavigationConsoleGraceMs
483
+ );
484
+ }
485
+
416
486
  export function isExpectedSaveReloadBrowserSessionConsoleError(
417
487
  message: string,
418
488
  activePhase: string,
@@ -426,10 +496,25 @@ export function isExpectedSaveReloadBrowserSessionConsoleError(
426
496
  "[Agent-Native browser session] heartbeat failed: TypeError: Load failed"
427
497
  ? [browserSessionRegistrationRequestRule]
428
498
  : null;
499
+ const isPollFailure =
500
+ message ===
501
+ "[Agent-Native browser session] poll failed: TypeError: Load failed";
502
+ const completedClaimCount = candidates.filter(
503
+ isExpectedCompletedClaimBeforeReload,
504
+ ).length;
505
+ const claimCandidateCount = candidates.filter((candidate) =>
506
+ isBrowserSessionClaimRequest(candidate.method, candidate.pathname),
507
+ ).length;
429
508
  return (
430
509
  activePhase === "save/reload" &&
431
510
  rules !== null &&
432
- hasExactlyOneExpectedBrowserSessionAbort(candidates, rules)
511
+ (hasExactlyOneExpectedBrowserSessionAbort(
512
+ candidates,
513
+ rules,
514
+ isPollFailure,
515
+ isPollFailure,
516
+ ) ||
517
+ (isPollFailure && completedClaimCount === 1 && claimCandidateCount === 1))
433
518
  );
434
519
  }
435
520
 
@@ -533,9 +618,14 @@ export function isExpectedSaveReloadWatchedRequestCorsConsoleError(
533
618
  method: string;
534
619
  ageMs: number;
535
620
  settledAgeMs?: number;
621
+ responseStatus?: number;
622
+ sameOrigin?: boolean;
536
623
  requestWasPendingAtReloadNavigation?: boolean;
624
+ requestStartedDuringNavigation?: boolean;
625
+ requestStartedAfterNavigation?: boolean;
537
626
  requestFinishedSuccessfully?: boolean;
538
627
  competingRequestStartedAfterNavigation?: boolean;
628
+ competingClaimStartedAfterNavigation?: boolean;
539
629
  }>,
540
630
  ) {
541
631
  if (activePhase !== "save/reload") return false;
@@ -1143,24 +1233,57 @@ export async function runAuthoringFuzz(
1143
1233
  }
1144
1234
  const editor: Locator = page.locator(editorSelector);
1145
1235
  const slideContent: Locator = page.locator(slideContentSelector);
1236
+ const authoringPageOrigin = new URL(page.url()).origin;
1146
1237
  const pageErrors: string[] = [];
1147
1238
  const pendingRequests = new Map<
1148
1239
  any,
1149
1240
  { method: string; path: string; startedAt: number }
1150
1241
  >();
1151
1242
  const watchedRequests = new Map(options.initialPendingWatchedRequests);
1152
- const reloadNavigationRequests = new Map<
1243
+ const inFlightBrowserSessionClaims = new Map<
1153
1244
  any,
1154
- {
1155
- startedAt: number;
1156
- settledAt: number | null;
1157
- finishedSuccessfully: boolean;
1158
- }
1245
+ { startedAt: number; responseStatus: number | null }
1159
1246
  >();
1247
+ const recentlyCompletedBrowserSessionClaims = new Map<
1248
+ any,
1249
+ { startedAt: number; settledAt: number; responseStatus: number }
1250
+ >();
1251
+ type ReloadNavigationRequest = {
1252
+ startedAt: number;
1253
+ settledAt: number | null;
1254
+ finishedSuccessfully: boolean;
1255
+ responseStatus: number | null;
1256
+ requestWasPendingAtNavigation: boolean;
1257
+ completedSuccessfullyBeforeNavigation: boolean;
1258
+ completedBeforeNavigationAgeMs: number | null;
1259
+ requestStartedDuringNavigation: boolean;
1260
+ requestStartedAfterNavigation: boolean;
1261
+ };
1262
+ const reloadNavigationRequests = new Map<any, ReloadNavigationRequest>();
1160
1263
  let reloadNavigationStartedAt: number | null = null;
1161
- // Diagnostic only: reloadNavigationStartedAt resets after each reload, but a
1162
- // late failure can still be logged after that. This keeps the latest start.
1264
+ // Keep the latest start after openSlide returns to correlate late poll errors.
1163
1265
  let lastReloadStartedAt: number | null = null;
1266
+ const hasCompetingClaimStartedAfterNavigation = (request: any) => {
1267
+ const url = new URL(request.url());
1268
+ if (!isBrowserSessionClaimRequest(request.method(), url.pathname))
1269
+ return false;
1270
+ return [...reloadNavigationRequests.entries()].some(
1271
+ ([otherRequest, otherCandidate]) => {
1272
+ if (
1273
+ otherRequest === request ||
1274
+ (!otherCandidate.requestStartedDuringNavigation &&
1275
+ !otherCandidate.requestStartedAfterNavigation)
1276
+ ) {
1277
+ return false;
1278
+ }
1279
+ const otherUrl = new URL(otherRequest.url());
1280
+ return (
1281
+ otherRequest.method() === request.method() &&
1282
+ otherUrl.pathname === url.pathname
1283
+ );
1284
+ },
1285
+ );
1286
+ };
1164
1287
  const pendingSaveConflicts: Promise<void>[] = [];
1165
1288
  const pendingConsoleInspections = new Set<Promise<void>>();
1166
1289
  const conflictResponsePaths: string[] = [];
@@ -1169,6 +1292,24 @@ export async function runAuthoringFuzz(
1169
1292
  let conflictResourceErrors = 0;
1170
1293
  let activeIndex = -1;
1171
1294
  let activePhase = "setup";
1295
+ for (const [request, startedAt] of watchedRequests.entries()) {
1296
+ if (
1297
+ !isBrowserSessionClaimRequest(
1298
+ request.method(),
1299
+ new URL(request.url()).pathname,
1300
+ )
1301
+ ) {
1302
+ continue;
1303
+ }
1304
+ const claim = { startedAt, responseStatus: null };
1305
+ inFlightBrowserSessionClaims.set(request, claim);
1306
+ void request
1307
+ .response()
1308
+ .then((response: any) => {
1309
+ if (response) claim.responseStatus = response.status();
1310
+ })
1311
+ .catch(() => undefined);
1312
+ }
1172
1313
  const onConsole = (message: any) => {
1173
1314
  if (
1174
1315
  traceEnabled &&
@@ -1193,18 +1334,43 @@ export async function runAuthoringFuzz(
1193
1334
  const now = Date.now();
1194
1335
  const reloadNavigationCandidates = [
1195
1336
  ...reloadNavigationRequests.entries(),
1196
- ].map(([request, { startedAt, settledAt, finishedSuccessfully }]) => {
1197
- const url = request.url();
1198
- return {
1199
- url,
1200
- pathname: new URL(url).pathname,
1201
- method: request.method(),
1202
- ageMs: now - startedAt,
1203
- ...(settledAt === null ? {} : { settledAgeMs: now - settledAt }),
1204
- requestFinishedSuccessfully: finishedSuccessfully,
1205
- requestWasPendingAtNavigation: true,
1206
- };
1207
- });
1337
+ ].map(
1338
+ ([
1339
+ request,
1340
+ {
1341
+ startedAt,
1342
+ settledAt,
1343
+ finishedSuccessfully,
1344
+ responseStatus,
1345
+ requestWasPendingAtNavigation,
1346
+ completedSuccessfullyBeforeNavigation,
1347
+ completedBeforeNavigationAgeMs,
1348
+ requestStartedDuringNavigation,
1349
+ requestStartedAfterNavigation,
1350
+ },
1351
+ ]) => {
1352
+ const url = request.url();
1353
+ return {
1354
+ url,
1355
+ pathname: new URL(url).pathname,
1356
+ method: request.method(),
1357
+ ageMs: now - startedAt,
1358
+ sameOrigin: new URL(url).origin === authoringPageOrigin,
1359
+ ...(settledAt === null ? {} : { settledAgeMs: now - settledAt }),
1360
+ ...(responseStatus === null ? {} : { responseStatus }),
1361
+ requestFinishedSuccessfully: finishedSuccessfully,
1362
+ requestWasPendingAtNavigation,
1363
+ completedSuccessfullyBeforeNavigation,
1364
+ ...(completedBeforeNavigationAgeMs === null
1365
+ ? {}
1366
+ : { completedBeforeNavigationAgeMs }),
1367
+ requestStartedDuringNavigation,
1368
+ requestStartedAfterNavigation,
1369
+ competingClaimStartedAfterNavigation:
1370
+ hasCompetingClaimStartedAfterNavigation(request),
1371
+ };
1372
+ },
1373
+ );
1208
1374
  // Captured now, not when the log runs: Firefox normalization finishes
1209
1375
  // asynchronously, after reload state may have been reset. Offsets use the
1210
1376
  // latest reload start, which is never reset (negative = started before it).
@@ -1270,12 +1436,17 @@ export async function runAuthoringFuzz(
1270
1436
  };
1271
1437
  const onRequestFailed = (request: any) => {
1272
1438
  const requestStartedAt = watchedRequests.get(request);
1439
+ const navigationCandidate = reloadNavigationRequests.get(request);
1273
1440
  const requestPendingAtReloadNavigation =
1274
- reloadNavigationRequests.has(request);
1441
+ navigationCandidate?.requestWasPendingAtNavigation === true;
1442
+ const competingClaimStartedAfterNavigation =
1443
+ hasCompetingClaimStartedAfterNavigation(request);
1275
1444
  pendingRequests.delete(request);
1276
1445
  watchedRequests.delete(request);
1446
+ inFlightBrowserSessionClaims.delete(request);
1277
1447
  const url = request.url();
1278
- const pathname = new URL(url).pathname;
1448
+ const requestUrl = new URL(url);
1449
+ const pathname = requestUrl.pathname;
1279
1450
  const errorText = request.failure()?.errorText ?? "unknown";
1280
1451
  if (traceEnabled || isBrowserSessionPath(pathname)) {
1281
1452
  console.log(
@@ -1292,9 +1463,12 @@ export async function runAuthoringFuzz(
1292
1463
  requestStartedAt === undefined
1293
1464
  ? Number.POSITIVE_INFINITY
1294
1465
  : Date.now() - requestStartedAt,
1466
+ navigationCandidate?.requestStartedDuringNavigation === true,
1467
+ competingClaimStartedAfterNavigation,
1468
+ requestUrl.origin === authoringPageOrigin,
1295
1469
  )
1296
1470
  ) {
1297
- const candidate = reloadNavigationRequests.get(request);
1471
+ const candidate = navigationCandidate;
1298
1472
  if (candidate) {
1299
1473
  candidate.settledAt = Date.now();
1300
1474
  candidate.finishedSuccessfully = false;
@@ -1317,6 +1491,12 @@ export async function runAuthoringFuzz(
1317
1491
  const onRequest = (request: any) => {
1318
1492
  const requestUrl = new URL(request.url());
1319
1493
  const startedAt = Date.now();
1494
+ if (isBrowserSessionClaimRequest(request.method(), requestUrl.pathname)) {
1495
+ inFlightBrowserSessionClaims.set(request, {
1496
+ startedAt,
1497
+ responseStatus: null,
1498
+ });
1499
+ }
1320
1500
  if (
1321
1501
  [
1322
1502
  "/_agent-native/actions/get-lab-states",
@@ -1326,18 +1506,31 @@ export async function runAuthoringFuzz(
1326
1506
  ) {
1327
1507
  watchedRequests.set(request, startedAt);
1328
1508
  }
1329
- if (
1509
+ const requestStartedDuringNavigation =
1330
1510
  activePhase === "save/reload" &&
1331
1511
  reloadNavigationStartedAt !== null &&
1332
1512
  startedAt >= reloadNavigationStartedAt &&
1333
1513
  startedAt - reloadNavigationStartedAt <
1334
1514
  reloadNavigationAbortMaxRequestAgeMs &&
1335
- isBrowserSessionPath(requestUrl.pathname)
1336
- ) {
1515
+ isBrowserSessionPath(requestUrl.pathname);
1516
+ const requestStartedAfterNavigation =
1517
+ activePhase === "save/reload" &&
1518
+ reloadNavigationStartedAt === null &&
1519
+ lastReloadStartedAt !== null &&
1520
+ startedAt >= lastReloadStartedAt &&
1521
+ startedAt - lastReloadStartedAt < reloadNavigationConsoleGraceMs &&
1522
+ isBrowserSessionPath(requestUrl.pathname);
1523
+ if (requestStartedDuringNavigation || requestStartedAfterNavigation) {
1337
1524
  reloadNavigationRequests.set(request, {
1338
1525
  startedAt,
1339
1526
  settledAt: null,
1340
1527
  finishedSuccessfully: false,
1528
+ responseStatus: null,
1529
+ requestWasPendingAtNavigation: false,
1530
+ completedSuccessfullyBeforeNavigation: false,
1531
+ completedBeforeNavigationAgeMs: null,
1532
+ requestStartedDuringNavigation,
1533
+ requestStartedAfterNavigation,
1341
1534
  });
1342
1535
  }
1343
1536
  if (!traceEnabled) return;
@@ -1360,14 +1553,50 @@ export async function runAuthoringFuzz(
1360
1553
  const onRequestSettled = (request: any) => {
1361
1554
  pendingRequests.delete(request);
1362
1555
  watchedRequests.delete(request);
1556
+ const settledAt = Date.now();
1557
+ const claim = inFlightBrowserSessionClaims.get(request);
1558
+ if (claim) {
1559
+ if (
1560
+ claim.responseStatus !== null &&
1561
+ claim.responseStatus >= 200 &&
1562
+ claim.responseStatus < 300
1563
+ ) {
1564
+ for (const [
1565
+ completedRequest,
1566
+ completedClaim,
1567
+ ] of recentlyCompletedBrowserSessionClaims.entries()) {
1568
+ if (
1569
+ settledAt - completedClaim.settledAt >=
1570
+ reloadNavigationSuccessfulClaimGraceMs
1571
+ ) {
1572
+ recentlyCompletedBrowserSessionClaims.delete(completedRequest);
1573
+ }
1574
+ }
1575
+ recentlyCompletedBrowserSessionClaims.set(request, {
1576
+ startedAt: claim.startedAt,
1577
+ settledAt,
1578
+ responseStatus: claim.responseStatus,
1579
+ });
1580
+ }
1581
+ inFlightBrowserSessionClaims.delete(request);
1582
+ }
1363
1583
  const candidate = reloadNavigationRequests.get(request);
1364
1584
  // WebKit can deliver the fetch error after Playwright's requestfinished event.
1365
1585
  if (candidate) {
1366
- candidate.settledAt = Date.now();
1586
+ candidate.settledAt = settledAt;
1367
1587
  candidate.finishedSuccessfully = true;
1588
+ candidate.responseStatus =
1589
+ claim?.responseStatus ?? candidate.responseStatus;
1368
1590
  }
1369
1591
  };
1370
1592
  const onResponse = (response: any) => {
1593
+ const request = response.request();
1594
+ const claim = inFlightBrowserSessionClaims.get(request);
1595
+ if (claim) claim.responseStatus = response.status();
1596
+ const navigationCandidate = reloadNavigationRequests.get(request);
1597
+ if (navigationCandidate) {
1598
+ navigationCandidate.responseStatus = response.status();
1599
+ }
1371
1600
  if (traceEnabled) {
1372
1601
  const responseUrl = new URL(response.url());
1373
1602
  if (
@@ -5105,6 +5334,13 @@ export async function runAuthoringFuzz(
5105
5334
  startedAt,
5106
5335
  settledAt: null,
5107
5336
  finishedSuccessfully: false,
5337
+ responseStatus:
5338
+ inFlightBrowserSessionClaims.get(request)?.responseStatus ?? null,
5339
+ requestWasPendingAtNavigation: true,
5340
+ completedSuccessfullyBeforeNavigation: false,
5341
+ completedBeforeNavigationAgeMs: null,
5342
+ requestStartedDuringNavigation: false,
5343
+ requestStartedAfterNavigation: false,
5108
5344
  });
5109
5345
  if (traceEnabled) {
5110
5346
  console.log(
@@ -5112,6 +5348,29 @@ export async function runAuthoringFuzz(
5112
5348
  );
5113
5349
  }
5114
5350
  }
5351
+ for (const [request, claim] of recentlyCompletedBrowserSessionClaims) {
5352
+ const completedBeforeNavigationAgeMs =
5353
+ reloadNavigationStartedAt - claim.settledAt;
5354
+ if (
5355
+ completedBeforeNavigationAgeMs < 0 ||
5356
+ completedBeforeNavigationAgeMs >=
5357
+ reloadNavigationSuccessfulClaimGraceMs
5358
+ ) {
5359
+ continue;
5360
+ }
5361
+ reloadNavigationRequests.set(request, {
5362
+ startedAt: claim.startedAt,
5363
+ settledAt: claim.settledAt,
5364
+ finishedSuccessfully: true,
5365
+ responseStatus: claim.responseStatus,
5366
+ requestWasPendingAtNavigation: false,
5367
+ completedSuccessfullyBeforeNavigation: true,
5368
+ completedBeforeNavigationAgeMs,
5369
+ requestStartedDuringNavigation: false,
5370
+ requestStartedAfterNavigation: false,
5371
+ });
5372
+ }
5373
+ recentlyCompletedBrowserSessionClaims.clear();
5115
5374
  });
5116
5375
  reloadNavigationStartedAt = null;
5117
5376
  assertAuthoringPersistence(persistence);
@@ -5657,6 +5657,7 @@ async function runAuthoringFuzzQa(
5657
5657
  pathname: string;
5658
5658
  method: string;
5659
5659
  startedAt: number;
5660
+ sameOrigin: boolean;
5660
5661
  requestWasPendingAtNavigation: true;
5661
5662
  }> = [];
5662
5663
  let recoveryPage: Page | null = stableCleanupPage;
@@ -5912,22 +5913,24 @@ async function runAuthoringFuzzQa(
5912
5913
  }
5913
5914
  try {
5914
5915
  const cleanupPage = await getCleanupPage();
5916
+ const cleanupUrl = new URL(cleanupPage.url());
5915
5917
  cleanupNavigationCandidates = [
5916
5918
  ...cleanupRequestStartTimes.entries(),
5917
5919
  ]
5918
5920
  .filter(([, request]) => request.page === cleanupPage)
5919
5921
  .map(([request, { startedAt }]) => {
5920
5922
  const url = request.url();
5923
+ const requestUrl = new URL(url);
5921
5924
  return {
5922
5925
  request,
5923
5926
  url,
5924
- pathname: new URL(url).pathname,
5927
+ pathname: requestUrl.pathname,
5925
5928
  method: request.method(),
5926
5929
  startedAt,
5930
+ sameOrigin: requestUrl.origin === cleanupUrl.origin,
5927
5931
  requestWasPendingAtNavigation: true as const,
5928
5932
  };
5929
5933
  });
5930
- const cleanupUrl = new URL(cleanupPage.url());
5931
5934
  const homeUrl = new URL(`${base}/home`);
5932
5935
  if (
5933
5936
  cleanupUrl.origin !== homeUrl.origin ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core-corpus",
3
- "version": "0.207.1",
3
+ "version": "0.207.2-nightly-20261012212922",
4
4
  "description": "Opt-in source corpus for Agent-Native Core source-search.",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {