@agent-native/core 0.176.5 → 0.176.6-nightly-20260903200904

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.
@@ -24,28 +24,36 @@ const TRACER_NAME = "@agent-native/core/agent-loop";
24
24
  export const SPAN_STATUS_OK = 1;
25
25
  export const SPAN_STATUS_ERROR = 2;
26
26
  /**
27
- * Cached tracer. `undefined` = not yet resolved; `null` = resolved to
28
- * "no tracer available" (api package missing or load failed).
27
+ * Cached OTel runtime. `undefined` = not yet resolved; `null` = resolved to
28
+ * "no runtime available" (api package missing or load failed).
29
29
  */
30
- let cachedTracer;
30
+ let cachedRuntime;
31
31
  /**
32
32
  * Resolve the OpenTelemetry tracer if `@opentelemetry/api` is installed.
33
33
  * Returns `null` (cached) when the package is unavailable so callers can
34
34
  * branch to a no-op cheaply on every subsequent call.
35
35
  */
36
- async function resolveTracer() {
37
- if (cachedTracer !== undefined)
38
- return cachedTracer;
36
+ async function resolveRuntime() {
37
+ if (cachedRuntime !== undefined)
38
+ return cachedRuntime;
39
39
  try {
40
40
  // Optional dependency — guarded import. Absent ⇒ no-op everywhere.
41
41
  const otel = await import("@opentelemetry/api");
42
42
  const tracer = otel?.trace?.getTracer?.(TRACER_NAME);
43
- cachedTracer = tracer ?? null;
43
+ cachedRuntime = tracer
44
+ ? {
45
+ tracer: tracer,
46
+ ...(otel?.context?.active && otel?.context?.with
47
+ ? { context: otel.context }
48
+ : {}),
49
+ ...(otel?.trace?.setSpan ? { trace: otel.trace } : {}),
50
+ }
51
+ : null;
44
52
  }
45
53
  catch {
46
- cachedTracer = null;
54
+ cachedRuntime = null;
47
55
  }
48
- return cachedTracer;
56
+ return cachedRuntime;
49
57
  }
50
58
  /** Drop sentinel/zero token counts so spans aren't cluttered with noise. */
51
59
  function pruneAttributes(attributes) {
@@ -62,19 +70,54 @@ function pruneAttributes(attributes) {
62
70
  * returns `null` and the caller simply skips span bookkeeping — there is no
63
71
  * runtime cost beyond the cached null check.
64
72
  */
65
- export async function startAgentSpan(name, attributes = {}) {
66
- const tracer = await resolveTracer();
67
- if (!tracer)
73
+ export async function startAgentSpan(name, attributes = {}, parentSpan = null) {
74
+ const runtime = await resolveRuntime();
75
+ if (!runtime)
68
76
  return null;
69
77
  try {
70
- return tracer.startSpan(name, {
78
+ let parentContext;
79
+ if (parentSpan && runtime.context && runtime.trace) {
80
+ try {
81
+ parentContext = runtime.trace.setSpan(runtime.context.active(), parentSpan);
82
+ }
83
+ catch {
84
+ // coercion-ok: explicit OTel parent setup must never break the agent loop.
85
+ }
86
+ }
87
+ return runtime.tracer.startSpan(name, {
71
88
  attributes: pruneAttributes(attributes),
72
- });
89
+ }, parentContext);
73
90
  }
74
91
  catch {
75
92
  return null;
76
93
  }
77
94
  }
95
+ /**
96
+ * Run a callback with the supplied span installed as the active OTel span so
97
+ * spans created by the callback become descendants of it. The bridge is
98
+ * deliberately best-effort: telemetry setup must never change agent behavior.
99
+ */
100
+ export function withAgentSpanContext(span, callback) {
101
+ if (!span)
102
+ return callback();
103
+ const runtime = cachedRuntime;
104
+ if (!runtime?.context || !runtime.trace)
105
+ return callback();
106
+ let callbackEntered = false;
107
+ try {
108
+ const context = runtime.trace.setSpan(runtime.context.active(), span);
109
+ return runtime.context.with(context, () => {
110
+ callbackEntered = true;
111
+ return callback();
112
+ });
113
+ }
114
+ catch (error) {
115
+ if (callbackEntered)
116
+ throw error;
117
+ // coercion-ok: optional OTel context setup must never break the agent loop.
118
+ return callback();
119
+ }
120
+ }
78
121
  /**
79
122
  * Finish a span, setting OK/ERROR status and recording the error message when
80
123
  * present. Safe to call with `null` (no-op) and never throws.
@@ -104,7 +147,7 @@ export function endAgentSpan(span, result = {}) {
104
147
  }
105
148
  finally {
106
149
  try {
107
- span.end();
150
+ span.end(result.endTime);
108
151
  }
109
152
  catch {
110
153
  // ignore
@@ -113,7 +156,7 @@ export function endAgentSpan(span, result = {}) {
113
156
  }
114
157
  /** For tests — reset the cached tracer so a fresh provider can be detected. */
115
158
  export function __resetAgentTracerCache() {
116
- cachedTracer = undefined;
159
+ cachedRuntime = undefined;
117
160
  }
118
161
  /**
119
162
  * For tests — inject a tracer directly (e.g. an in-memory test provider's
@@ -121,5 +164,9 @@ export function __resetAgentTracerCache() {
121
164
  * to simulate "no tracer available".
122
165
  */
123
166
  export function __setAgentTracerForTests(tracer) {
124
- cachedTracer = tracer;
167
+ cachedRuntime = tracer ? { tracer } : null;
168
+ }
169
+ /** For tests — inject a runtime with an active-context implementation. */
170
+ export function __setAgentTraceRuntimeForTests(runtime) {
171
+ cachedRuntime = runtime;
125
172
  }
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;
@@ -75,10 +75,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
75
75
  user: "user";
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
- id?: undefined;
79
- provider?: undefined;
80
- deleted?: undefined;
81
78
  message?: undefined;
79
+ deleted?: undefined;
80
+ id?: undefined;
81
+ found?: undefined;
82
82
  providers: {
83
83
  id: string;
84
84
  label: string;
@@ -89,45 +89,45 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
89
89
  updatedAt: number;
90
90
  }[];
91
91
  count: number;
92
- found?: undefined;
92
+ provider?: undefined;
93
93
  registered?: undefined;
94
94
  label?: undefined;
95
95
  } | {
96
- id?: undefined;
97
- deleted?: undefined;
98
96
  message?: undefined;
99
- providers?: undefined;
100
97
  count?: undefined;
98
+ deleted?: undefined;
99
+ id?: undefined;
100
+ providers?: undefined;
101
101
  found: boolean;
102
102
  provider: import("../custom-registry.js").CustomProviderConfig;
103
103
  registered?: undefined;
104
104
  label?: undefined;
105
105
  } | {
106
- provider?: undefined;
107
- deleted?: undefined;
108
106
  message?: undefined;
109
- providers?: undefined;
110
107
  count?: undefined;
108
+ deleted?: undefined;
109
+ providers?: undefined;
110
+ provider?: undefined;
111
111
  found: boolean;
112
112
  id: string;
113
113
  registered?: undefined;
114
114
  label?: undefined;
115
115
  } | {
116
- provider?: undefined;
117
116
  message?: undefined;
118
- providers?: undefined;
119
117
  count?: undefined;
120
118
  found?: undefined;
119
+ providers?: undefined;
120
+ provider?: undefined;
121
121
  deleted: boolean;
122
122
  id: string;
123
123
  registered?: undefined;
124
124
  label?: undefined;
125
125
  } | {
126
- provider?: undefined;
127
- deleted?: undefined;
128
- providers?: undefined;
129
126
  count?: undefined;
127
+ deleted?: undefined;
130
128
  found?: undefined;
129
+ providers?: undefined;
130
+ provider?: undefined;
131
131
  registered: boolean;
132
132
  id: string;
133
133
  label: string;
@@ -311,7 +311,7 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
311
311
  notes?: string | undefined;
312
312
  scope?: "org" | "user" | undefined;
313
313
  }, {
314
- message?: undefined;
314
+ found?: undefined;
315
315
  providers: {
316
316
  id: string;
317
317
  label: string;
@@ -323,46 +323,46 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
323
323
  }[];
324
324
  count: number;
325
325
  provider?: undefined;
326
- found?: undefined;
327
326
  deleted?: undefined;
328
327
  registered?: undefined;
329
328
  id?: undefined;
330
329
  label?: undefined;
331
- } | {
332
330
  message?: undefined;
333
- count?: undefined;
331
+ } | {
334
332
  providers?: undefined;
333
+ count?: undefined;
335
334
  found: boolean;
336
335
  provider: import("../custom-registry.js").CustomProviderConfig;
337
336
  deleted?: undefined;
338
337
  registered?: undefined;
339
338
  id?: undefined;
340
339
  label?: undefined;
341
- } | {
342
340
  message?: undefined;
343
- count?: undefined;
341
+ } | {
344
342
  providers?: undefined;
343
+ count?: undefined;
345
344
  provider?: undefined;
346
345
  found: boolean;
347
346
  id: string;
348
347
  deleted?: undefined;
349
348
  registered?: undefined;
350
349
  label?: undefined;
351
- } | {
352
350
  message?: undefined;
353
- count?: undefined;
351
+ } | {
352
+ found?: undefined;
354
353
  providers?: undefined;
354
+ count?: undefined;
355
355
  provider?: undefined;
356
- found?: undefined;
357
356
  deleted: boolean;
358
357
  id: string;
359
358
  registered?: undefined;
360
359
  label?: undefined;
360
+ message?: undefined;
361
361
  } | {
362
- count?: undefined;
362
+ found?: undefined;
363
363
  providers?: undefined;
364
+ count?: undefined;
364
365
  provider?: undefined;
365
- found?: undefined;
366
366
  deleted?: undefined;
367
367
  registered: boolean;
368
368
  id: string;
@@ -1,4 +1,5 @@
1
1
  import { getAppConfig, resolveAppHomePath } from "../app-config/index.js";
2
+ import { safeJsonForHtml } from "../shared/agent-readable-resource.js";
2
3
  import { normalizeAppBasePath } from "./app-base-path.js";
3
4
  function workspaceAppMountPathsFromJson(value) {
4
5
  if (!value?.trim())
@@ -76,7 +77,7 @@ export function getAppOriginClientConfigScript() {
76
77
  return [
77
78
  "<script data-agent-native-app-origin-config>",
78
79
  "window.__AGENT_NATIVE_CONFIG__=Object.assign({},window.__AGENT_NATIVE_CONFIG__,",
79
- JSON.stringify(config),
80
+ safeJsonForHtml(config),
80
81
  ");",
81
82
  "</script>",
82
83
  ].join("");
@@ -61,6 +61,7 @@ import { normalizeWorkspaceAppAudience, workspaceAppAudienceFromEnv, workspaceAp
61
61
  import { isValidWorkspaceAppIdFormat } from "../shared/workspace-app-id.js";
62
62
  import { injectAnalyticsIntoHtml } from "./analytics.js";
63
63
  import { getConfiguredAppBasePath } from "./app-base-path.js";
64
+ import { getAppOriginClientConfigScript } from "./app-origin-config.js";
64
65
  import { getAppProductionUrl } from "./app-url.js";
65
66
  import { addSignupAttributionHeader, readAnalyticsAnonymousId, readFirstTouchAttribution, signupAttributionContextFromCookieHeader, signupAttributionFromCookieHeader, } from "./attribution.js";
66
67
  import { getAuthLoginMode } from "./auth-login-mode.js";
@@ -421,9 +422,14 @@ export function getConfiguredLoginHtml(event) {
421
422
  return null;
422
423
  const { rawPath } = getRequestPathAndSearch(event);
423
424
  const loginHtml = config.getLoginHtml?.(event, rawPath) ?? config.loginHtml ?? null;
424
- return loginHtml
425
- ? injectLoginSocialImageMeta(injectBetaOptOutPersistence(loginHtml), event)
426
- : null;
425
+ if (!loginHtml)
426
+ return null;
427
+ const appOriginConfigScript = getAppOriginClientConfigScript();
428
+ const html = appOriginConfigScript &&
429
+ !loginHtml.includes("data-agent-native-app-origin-config")
430
+ ? injectHeadScript(loginHtml, appOriginConfigScript)
431
+ : loginHtml;
432
+ return injectLoginSocialImageMeta(injectBetaOptOutPersistence(html, rawPath), event);
427
433
  }
428
434
  /**
429
435
  * True only when the request originates from the local machine — the raw
@@ -1254,6 +1260,17 @@ let _authGuardConfig = null;
1254
1260
  // Scope entries by H3 app so a route registered by one app cannot become public
1255
1261
  // in another app that happens to share the same Node realm.
1256
1262
  const AUTH_PUBLIC_PATHS_REGISTRY_KEY = Symbol.for("@agent-native/core/auth.publicPaths");
1263
+ const SESSION_RESOLUTION_ERROR_CONTEXT_KEY = "__anSessionResolutionError";
1264
+ async function getLegacyCookieSessionSafely(event) {
1265
+ try {
1266
+ return await getLegacyCookieSession(event);
1267
+ }
1268
+ catch (error) {
1269
+ console.error("[auth] legacy cookie session resolution error:", error);
1270
+ event.context[SESSION_RESOLUTION_ERROR_CONTEXT_KEY] = true;
1271
+ return null;
1272
+ }
1273
+ }
1257
1274
  const _registeredAuthExactPublicPaths = new Set();
1258
1275
  function getAuthPublicPathRegistry() {
1259
1276
  const globals = globalThis;
@@ -2293,7 +2310,13 @@ function injectHeadScript(html, script) {
2293
2310
  return `<!doctype html><html><head>${script}</head><body>${html}</body></html>`;
2294
2311
  }
2295
2312
  function loginHtmlResponse(loginHtml, event, options = {}) {
2296
- let html = injectLoginSocialImageMeta(injectBetaOptOutPersistence(loginHtml), options.requestIndependent ? undefined : event);
2313
+ const appOriginConfigScript = getAppOriginClientConfigScript();
2314
+ let html = loginHtml;
2315
+ if (appOriginConfigScript &&
2316
+ !html.includes("data-agent-native-app-origin-config")) {
2317
+ html = injectHeadScript(html, appOriginConfigScript);
2318
+ }
2319
+ html = injectLoginSocialImageMeta(injectBetaOptOutPersistence(html), options.requestIndependent ? undefined : event);
2297
2320
  if (options.includeRootAuthRedirect) {
2298
2321
  html = injectHeadScript(html, getSsrAuthRedirectScript(SESSION_HINT_COOKIE, resolveAppHomePath(getAppConfig().app)));
2299
2322
  }
@@ -3115,7 +3138,7 @@ async function resolveSessionUncached(event) {
3115
3138
  // 2. ACCESS_TOKEN check (programmatic/agent access)
3116
3139
  const accessTokens = getAccessTokens();
3117
3140
  if (accessTokens.length > 0) {
3118
- const cookieSession = await getLegacyCookieSession(event);
3141
+ const cookieSession = await getLegacyCookieSessionSafely(event);
3119
3142
  if (cookieSession)
3120
3143
  return cookieSession;
3121
3144
  }
@@ -3165,9 +3188,10 @@ async function resolveSessionUncached(event) {
3165
3188
  }
3166
3189
  catch (e) {
3167
3190
  console.error("[auth] ba.api.getSession error:", e);
3191
+ event.context[SESSION_RESOLUTION_ERROR_CONTEXT_KEY] = true;
3168
3192
  }
3169
3193
  // 6. Legacy cookie fallback (for sessions created before migration)
3170
- const cookieSession = await getLegacyCookieSession(event);
3194
+ const cookieSession = await getLegacyCookieSessionSafely(event);
3171
3195
  if (cookieSession)
3172
3196
  return cookieSession;
3173
3197
  // 7. Desktop SSO broker fallback.
@@ -4819,6 +4843,11 @@ async function mountBetterAuthRoutes(app, options) {
4819
4843
  return { error: "Method not allowed" };
4820
4844
  }
4821
4845
  const session = await getSession(event);
4846
+ if (!session &&
4847
+ event.context[SESSION_RESOLUTION_ERROR_CONTEXT_KEY] === true) {
4848
+ setResponseStatus(event, 503);
4849
+ return { error: "Session unavailable" };
4850
+ }
4822
4851
  if (session)
4823
4852
  setFrameworkSessionHintCookie(event);
4824
4853
  else
@@ -4993,6 +5022,11 @@ function mountAuthFallbackRoutes(app) {
4993
5022
  return { error: "Method not allowed" };
4994
5023
  }
4995
5024
  const session = await getSession(event);
5025
+ if (!session &&
5026
+ event.context[SESSION_RESOLUTION_ERROR_CONTEXT_KEY] === true) {
5027
+ setResponseStatus(event, 503);
5028
+ return { error: "Session unavailable" };
5029
+ }
4996
5030
  if (session)
4997
5031
  setFrameworkSessionHintCookie(event);
4998
5032
  else
@@ -5115,6 +5149,11 @@ export async function autoMountAuth(app, options = {}) {
5115
5149
  return { error: "Method not allowed" };
5116
5150
  }
5117
5151
  const session = await getSession(event);
5152
+ if (!session &&
5153
+ event.context[SESSION_RESOLUTION_ERROR_CONTEXT_KEY] === true) {
5154
+ setResponseStatus(event, 503);
5155
+ return { error: "Session unavailable" };
5156
+ }
5118
5157
  return session ?? { error: "Not authenticated" };
5119
5158
  }));
5120
5159
  app.use("/_agent-native/auth/login", defineEventHandler(() => ({ ok: true })));
@@ -4,4 +4,4 @@ export declare const BETA_OPT_OUT_PERSISTENCE_MARKER = "Persist the beta opt-out
4
4
  * Keep the production switcher's one-time opt-out behavior at the shared auth
5
5
  * response boundary so those pages cannot drop the handoff before sign-in.
6
6
  */
7
- export declare function injectBetaOptOutPersistence(loginHtml: string): string;
7
+ export declare function injectBetaOptOutPersistence(loginHtml: string, requestPath?: string): string;
@@ -1,5 +1,8 @@
1
1
  import { BETA_FORCE_QUERY_PARAM, BETA_FORCE_SESSION_STORAGE_KEY, BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, BETA_REDIRECT_STORAGE_KEY, ENVIRONMENT_BETA_HOSTS, } from "../shared/environment-lanes.js";
2
2
  import { getSsrBetaRedirectScript, SSR_BETA_REDIRECT_MARKER, } from "../shared/ssr-beta-redirect.js";
3
+ import { getAppBasePathFromViteEnv } from "./app-base-path.js";
4
+ import { resolvePublicAppOriginConfig } from "./app-origin-config.js";
5
+ import { workspaceBasePathFromRequest } from "./onboarding-html.js";
3
6
  export const BETA_OPT_OUT_PERSISTENCE_MARKER = "Persist the beta opt-out before authentication";
4
7
  const ENVIRONMENT_SWITCHER_MARKER = 'data-agent-native-environment-switcher="1"';
5
8
  const ENVIRONMENT_SWITCHER_STYLE_MARKER = 'data-agent-native-environment-switcher-style="1"';
@@ -11,6 +14,16 @@ function insertBeforeClosingTag(html, fragment, closingTag) {
11
14
  return html + fragment;
12
15
  return html.slice(0, closeIndex) + fragment + html.slice(closeIndex);
13
16
  }
17
+ function betaRedirectBasePath(requestPath) {
18
+ const configuredBasePath = getAppBasePathFromViteEnv();
19
+ const requestWorkspaceBasePath = workspaceBasePathFromRequest(requestPath);
20
+ if (!requestWorkspaceBasePath)
21
+ return configuredBasePath;
22
+ const workspaceMounts = resolvePublicAppOriginConfig()?.workspaceAppMountPaths;
23
+ return workspaceMounts?.includes(requestWorkspaceBasePath)
24
+ ? requestWorkspaceBasePath
25
+ : configuredBasePath;
26
+ }
14
27
  const environmentSwitcherMarkup = `<div class="environment-switcher" id="environment-switcher" ${ENVIRONMENT_SWITCHER_MARKER} hidden>
15
28
  <button type="button" class="environment-badge" id="environment-badge" aria-expanded="false" aria-controls="environment-popover">beta</button>
16
29
  <div class="environment-popover" id="environment-popover" role="dialog" aria-labelledby="environment-popover-title" hidden>
@@ -211,10 +224,11 @@ const betaOptOutPersistenceScript = `<script data-agent-native-beta-opt-out>
211
224
  * Keep the production switcher's one-time opt-out behavior at the shared auth
212
225
  * response boundary so those pages cannot drop the handoff before sign-in.
213
226
  */
214
- export function injectBetaOptOutPersistence(loginHtml) {
227
+ export function injectBetaOptOutPersistence(loginHtml, requestPath) {
215
228
  let html = loginHtml;
216
229
  if (!html.includes(SSR_BETA_REDIRECT_MARKER)) {
217
- html = insertBeforeClosingTag(html, getSsrBetaRedirectScript(), "</head>");
230
+ const appBasePath = betaRedirectBasePath(requestPath);
231
+ html = insertBeforeClosingTag(html, getSsrBetaRedirectScript(`${appBasePath}/_agent-native/auth/session`), "</head>");
218
232
  }
219
233
  if (!html.includes(BETA_OPT_OUT_PERSISTENCE_MARKER)) {
220
234
  html = insertBeforeClosingTag(html, betaOptOutPersistenceScript, "</body>");
@@ -113,6 +113,12 @@ export interface DbHealthProbeResult {
113
113
  * matching".
114
114
  */
115
115
  identityMismatch?: boolean;
116
+ /**
117
+ * What this runtime believes its own app is (`app.slug ?? app.id`), or
118
+ * `null` when the bundle cannot derive one. A null here is why a
119
+ * mismatch cannot be claimed, and is itself a finding worth reading.
120
+ */
121
+ runningApp?: string | null;
116
122
  };
117
123
  /**
118
124
  * Hosted-realtime wiring, so a deploy can be verified without signing in.
@@ -402,6 +402,7 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
402
402
  // read must never be reported as "nothing recorded".
403
403
  let identity;
404
404
  let identityMismatch;
405
+ let runningApp;
405
406
  if (db) {
406
407
  identity = await withHealthDeadline(readDatabaseIdentity(dbExec).catch((err) => ({
407
408
  state: "unreadable",
@@ -409,9 +410,15 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
409
410
  })), { state: "timeout" });
410
411
  // Only "recorded" can ever prove a mismatch — the other three states mean
411
412
  // the check couldn't confirm one, not that it confirmed there wasn't.
413
+ // And only a KNOWN running identity can disagree with the recorded one:
414
+ // a hosted bundle that cannot derive its own slug/id must report the gap
415
+ // (`runningApp: null`), not a mismatch that blocks every production
416
+ // cutover — which is exactly what the first crm promotion did.
417
+ runningApp = resolveRunningAppIdentity();
412
418
  identityMismatch =
413
419
  identity.state === "recorded" &&
414
- identity.app !== resolveRunningAppIdentity();
420
+ runningApp !== null &&
421
+ identity.app !== runningApp;
415
422
  }
416
423
  const database = getDatabaseRuntimeFingerprint();
417
424
  // Measured on the connection `SELECT 1` just warmed, so the number reflects
@@ -449,7 +456,7 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
449
456
  appName: database.appName,
450
457
  authTokenConfigured: database.authTokenConfigured,
451
458
  netlifyDatabaseUrlConfigured: database.netlifyDatabaseUrlConfigured,
452
- ...(identity ? { identity, identityMismatch } : {}),
459
+ ...(identity ? { identity, identityMismatch, runningApp } : {}),
453
460
  },
454
461
  ...(schema ? { schema } : {}),
455
462
  ...(pressure ? { pressure } : {}),
@@ -59,8 +59,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
59
59
  expiresAt?: undefined;
60
60
  ttlSeconds?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  token: string;
64
63
  expiresAt: string;
65
64
  ttlSeconds: number;
65
+ error?: undefined;
66
66
  }>>;
@@ -1,11 +1,8 @@
1
1
  export declare const SSR_BETA_REDIRECT_MARKER = "data-agent-native-beta-redirect=\"1\"";
2
2
  /**
3
- * The marker is a cached decision written only after a verified Builder
4
- * employee session, and it is never an authorization check — the session gate
5
- * still governs every byte of access. It is deliberately trusted without
6
- * revalidating, because a session probe here would put a network round trip
7
- * back in front of the redirect this script exists to make instant. Staleness
8
- * is bounded by the marker TTL, the sign-out clear, and the opt-out param.
3
+ * The marker is a performance hint set after the client verifies a Builder
4
+ * employee session. The browser re-checks the current session before using
5
+ * it, so it never becomes an authorization check.
9
6
  */
10
- export declare function getSsrBetaRedirectScriptBody(): string;
11
- export declare function getSsrBetaRedirectScript(): string;
7
+ export declare function getSsrBetaRedirectScriptBody(sessionPath?: string): string;
8
+ export declare function getSsrBetaRedirectScript(sessionPath?: string): string;