@agent-native/core 0.207.0-nightly-20261011153008 → 0.207.0

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.
Files changed (57) hide show
  1. package/dist/agent/production-agent.js +23 -6
  2. package/dist/agent/thread-data-builder.js +7 -4
  3. package/dist/automation/index.d.ts +1 -1
  4. package/dist/client/analytics/index.d.ts +1 -1
  5. package/dist/client/analytics.d.ts +12 -3
  6. package/dist/client/analytics.js +51 -17
  7. package/dist/client/onboarding/use-onboarding.d.ts +1 -0
  8. package/dist/client/onboarding/use-onboarding.js +19 -6
  9. package/dist/collab/routes.d.ts +1 -1
  10. package/dist/eval/agent-runner.js +18 -8
  11. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  12. package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
  13. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  14. package/dist/notifications/routes.d.ts +1 -1
  15. package/dist/observability/routes.d.ts +7 -7
  16. package/dist/onboarding/plugin.js +15 -45
  17. package/dist/resources/handlers.d.ts +1 -1
  18. package/dist/resources/store.js +25 -30
  19. package/dist/secrets/routes.d.ts +5 -5
  20. package/dist/server/agent-discovery.js +47 -53
  21. package/dist/server/agent-engine-default-model-route.d.ts +2 -2
  22. package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
  23. package/dist/server/builtin-agents.d.ts +2 -0
  24. package/dist/server/builtin-agents.js +50 -3
  25. package/dist/server/core-routes-plugin.d.ts +1 -1
  26. package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
  27. package/dist/templates/chat/CHANGELOG.md +6 -0
  28. package/dist/templates/chat/app/components/home/HomePage.tsx +1 -1
  29. package/dist/templates/chat/app/i18n/ar-SA.ts +1 -1
  30. package/dist/templates/chat/app/i18n/de-DE.ts +1 -1
  31. package/dist/templates/chat/app/i18n/en-US.ts +1 -1
  32. package/dist/templates/chat/app/i18n/es-ES.ts +1 -1
  33. package/dist/templates/chat/app/i18n/fr-FR.ts +1 -1
  34. package/dist/templates/chat/app/i18n/hi-IN.ts +1 -1
  35. package/dist/templates/chat/app/i18n/ja-JP.ts +1 -1
  36. package/dist/templates/chat/app/i18n/ko-KR.ts +1 -1
  37. package/dist/templates/chat/app/i18n/pt-BR.ts +1 -1
  38. package/dist/templates/chat/app/i18n/zh-CN.ts +1 -1
  39. package/dist/templates/chat/app/i18n/zh-TW.ts +1 -1
  40. package/dist/triggers/actions/manage-automation.d.ts +7 -7
  41. package/docs/content/environment-variables.mdx +38 -13
  42. package/docs/content/getting-started.mdx +6 -28
  43. package/docs/content/multi-app-workspace.mdx +7 -3
  44. package/package.json +4 -4
  45. package/src/templates/chat/CHANGELOG.md +6 -0
  46. package/src/templates/chat/app/components/home/HomePage.tsx +1 -1
  47. package/src/templates/chat/app/i18n/ar-SA.ts +1 -1
  48. package/src/templates/chat/app/i18n/de-DE.ts +1 -1
  49. package/src/templates/chat/app/i18n/en-US.ts +1 -1
  50. package/src/templates/chat/app/i18n/es-ES.ts +1 -1
  51. package/src/templates/chat/app/i18n/fr-FR.ts +1 -1
  52. package/src/templates/chat/app/i18n/hi-IN.ts +1 -1
  53. package/src/templates/chat/app/i18n/ja-JP.ts +1 -1
  54. package/src/templates/chat/app/i18n/ko-KR.ts +1 -1
  55. package/src/templates/chat/app/i18n/pt-BR.ts +1 -1
  56. package/src/templates/chat/app/i18n/zh-CN.ts +1 -1
  57. package/src/templates/chat/app/i18n/zh-TW.ts +1 -1
@@ -8846,6 +8846,16 @@ export function createProductionAgentHandler(options) {
8846
8846
  const isReaperSuccessor = isBackgroundWorker &&
8847
8847
  typeof mutableBody[AGENT_CHAT_RECOVERY_OF_RUN_FIELD] === "string" &&
8848
8848
  Boolean(mutableBody[AGENT_CHAT_RECOVERY_OF_RUN_FIELD]);
8849
+ const isClientTurnContinuation = !isBackgroundWorker &&
8850
+ internalContinuation === true &&
8851
+ !continueOf &&
8852
+ !requestedApprovedToolCalls?.length &&
8853
+ typeof message === "string" &&
8854
+ message.startsWith(AGENT_INTERNAL_CONTINUE_PROMPT) &&
8855
+ typeof threadId === "string" &&
8856
+ threadId.trim().length > 0 &&
8857
+ typeof requestTurnId === "string" &&
8858
+ requestTurnId.trim().length > 0;
8849
8859
  const runId = backgroundRunMarker?.runId ?? generateRunId();
8850
8860
  const effectiveThreadId = threadId ?? runId;
8851
8861
  const effectiveTurnId = typeof backgroundRunMarker?.turnId === "string" &&
@@ -9008,7 +9018,10 @@ export function createProductionAgentHandler(options) {
9008
9018
  // A server successor and a continuation, automatic or chosen, resume the
9009
9019
  // same turn the same way: the thread's tool calls and results, plus the turn's
9010
9020
  // journal of finished steps, so nothing already done is sent again.
9011
- if ((isChainedBackgroundContinuation || isReaperSuccessor || continueOf) &&
9021
+ if ((isChainedBackgroundContinuation ||
9022
+ isReaperSuccessor ||
9023
+ continueOf ||
9024
+ isClientTurnContinuation) &&
9012
9025
  effectiveThreadId) {
9013
9026
  try {
9014
9027
  const { getThread } = await import("../chat-threads/store.js");
@@ -9022,12 +9035,14 @@ export function createProductionAgentHandler(options) {
9022
9035
  // A continuation always follows a stopped run, so a thread without
9023
9036
  // that turn's prompt means its history was lost, not that there was
9024
9037
  // none. A successor stays best-effort and resumes from what is there.
9025
- if (continueOf && !foundTurnPrompt) {
9038
+ if ((continueOf || isClientTurnContinuation) && !foundTurnPrompt) {
9026
9039
  throw new Error(`thread ${effectiveThreadId} has no turn prompt`);
9027
9040
  }
9028
9041
  // Resuming takes the thread's newest prompt, so a newer one, even one
9029
9042
  // whose run never started, would run under this turn's journal.
9030
- const promptTurnId = continueOf && threadData ? latestPromptTurnId(threadData) : undefined;
9043
+ const promptTurnId = (continueOf || isClientTurnContinuation) && threadData
9044
+ ? latestPromptTurnId(threadData)
9045
+ : undefined;
9031
9046
  if (promptTurnId && promptTurnId !== effectiveTurnId) {
9032
9047
  if (await updateRunStatusIfRunning(runId, "errored")) {
9033
9048
  await setRunTerminalReason(runId, CONTINUE_UNAVAILABLE_CODE);
@@ -9044,9 +9059,11 @@ export function createProductionAgentHandler(options) {
9044
9059
  ? backgroundRunMarker.continuationReason
9045
9060
  : isReaperSuccessor
9046
9061
  ? "network_interrupted"
9047
- : "run_timeout";
9062
+ : isClientTurnContinuation
9063
+ ? "stream_ended"
9064
+ : "run_timeout";
9048
9065
  const journalRead = await loadPriorTurnToolCallJournal(effectiveThreadId, effectiveTurnId);
9049
- if ((continueOf || isReaperSuccessor) &&
9066
+ if ((continueOf || isReaperSuccessor || isClientTurnContinuation) &&
9050
9067
  journalRead.status === "unreadable") {
9051
9068
  throw new Error(journalRead.error);
9052
9069
  }
@@ -9073,7 +9090,7 @@ export function createProductionAgentHandler(options) {
9073
9090
  }
9074
9091
  }
9075
9092
  catch (error) {
9076
- if (continueOf || isReaperSuccessor) {
9093
+ if (continueOf || isReaperSuccessor || isClientTurnContinuation) {
9077
9094
  // The browser's history lacks the stopped run's tool results, so
9078
9095
  // continuing from it could repeat a step that already finished.
9079
9096
  console.warn(`[agent-chat] auto-continue history unreadable for thread ${effectiveThreadId}:`, error);
@@ -1587,7 +1587,8 @@ export function foldThreadRunSuggestions(repo, run) {
1587
1587
  oldRun.lastSequence >= 0
1588
1588
  ? oldRun.lastSequence
1589
1589
  : 0;
1590
- const lastSequence = run.events.reduce((maximum, { seq }) => Number.isSafeInteger(seq) && seq >= 0 ? Math.max(maximum, seq) : maximum, previousSequence);
1590
+ // Runtime event sequence numbers and AgentKit protocol cursors are separate.
1591
+ const lastSequence = previousSequence;
1591
1592
  const snapshot = {
1592
1593
  ...oldRun,
1593
1594
  id: run.runId,
@@ -2287,9 +2288,11 @@ function mergeAgentKitHistory(existing, incoming, promptRunIds, onAnnotationConf
2287
2288
  if (Array.isArray(merged.suggestions)) {
2288
2289
  merged.suggestions = merged.suggestions.filter((suggestion) => suggestion?.runId === latest?.id);
2289
2290
  }
2290
- if (Array.isArray(merged.activeRunIds)) {
2291
- merged.activeRunIds = merged.activeRunIds.filter((id) => !["completed", "failed", "cancelled"].includes(runs.get(id)?.status ?? ""));
2292
- }
2291
+ const activeRunIds = new Set([
2292
+ ...(Array.isArray(previous.activeRunIds) ? previous.activeRunIds : []),
2293
+ ...(Array.isArray(next.activeRunIds) ? next.activeRunIds : []),
2294
+ ]);
2295
+ merged.activeRunIds = [...activeRunIds].filter((id) => !["completed", "failed", "cancelled"].includes(runs.get(id)?.status ?? ""));
2293
2296
  }
2294
2297
  const existingMessageRunIds = snapshotMessageRunIds(previous);
2295
2298
  const incomingMessageRunIds = snapshotMessageRunIds(next);
@@ -139,8 +139,8 @@ export declare function createAutomationCallbackHandler(runtime: AutomationRunti
139
139
  duplicate?: undefined;
140
140
  eventId?: undefined;
141
141
  } | {
142
+ error?: undefined;
142
143
  accepted: boolean;
143
144
  duplicate: boolean;
144
145
  eventId: string;
145
- error?: undefined;
146
146
  }>;
@@ -1,2 +1,2 @@
1
- export { AGENT_NATIVE_EXCEPTION_EVENT_NAME, addErrorBreadcrumb, captureAttribution, captureClientException, captureError, captureException, captureMessage, clearAnalyticsSessionId, configureTracking, getAnalyticsAnonymousId, getAnalyticsSessionId, getFirstTouchAttribution, getLastTouchAttribution, getSessionReplayContext, getSessionReplayUrl, isErrorCaptureInstalled, maybeStartSessionReplay, setAnalyticsSessionId, setSentryUser, setTrackingContentCaptureEnabled, setTrackingIdentity, startSessionReplay, stopSessionReplay, trackAgentChatLifecycle, trackAnonymousEvent, trackEvent, trackLifecycleEvent, trackSessionStatus, type AgentChatLifecycleEvent, type CaptureExceptionContext, type CapturedExceptionEvent, type ClientCaptureContext, type ConfigureTrackingOptions, type ErrorCaptureConfigOptions, type ExceptionBreadcrumb, type ExceptionLevel, type FirstTouchAttribution, type LastTouchAttribution, type SessionReplayContext, type SessionReplayLinkOptions, type SessionReplayOptions, type SessionReplayStartResult, type SessionReplayUrlMatcher, type TrackingIdentityUser, } from "../analytics.js";
1
+ export { AGENT_NATIVE_EXCEPTION_EVENT_NAME, addErrorBreadcrumb, captureAttribution, captureClientException, captureError, captureException, captureMessage, clearAnalyticsSessionId, configureTracking, getAnalyticsAnonymousId, getAnalyticsSessionId, getFirstTouchAttribution, getLastTouchAttribution, getSessionReplayContext, getSessionReplayUrl, isErrorCaptureInstalled, maybeStartSessionReplay, setAnalyticsSessionId, setSentryUser, setTrackingContentCaptureEnabled, setTrackingIdentity, startSessionReplay, stopSessionReplay, trackAgentChatLifecycle, trackAnonymousEvent, trackEvent, trackLifecycleEvent, trackSessionStatus, type AgentChatLifecycleEvent, type CaptureAttributionOptions, type CaptureExceptionContext, type CapturedExceptionEvent, type ClientCaptureContext, type ConfigureTrackingOptions, type ErrorCaptureConfigOptions, type ExceptionBreadcrumb, type ExceptionLevel, type FirstTouchAttribution, type LastTouchAttribution, type SessionReplayContext, type SessionReplayLinkOptions, type SessionReplayOptions, type SessionReplayStartResult, type SessionReplayUrlMatcher, type TrackingIdentityUser, } from "../analytics.js";
2
2
  export { track } from "../track.js";
@@ -113,12 +113,21 @@ export declare function getAnalyticsAnonymousId(): string | undefined;
113
113
  export declare function getAnalyticsSessionId(): string | undefined;
114
114
  export declare function getFirstTouchAttribution(): FirstTouchAttribution | null;
115
115
  export declare function getLastTouchAttribution(): LastTouchAttribution | null;
116
+ export interface CaptureAttributionOptions {
117
+ /**
118
+ * The app path this visit entered, when the page isn't it. The sign-in page
119
+ * stands in front of the path the visitor asked for, and `landing_path`
120
+ * must name that path, not the sign-in page.
121
+ */
122
+ landingPath?: string;
123
+ }
116
124
  /**
117
125
  * Store the visitor's first and last touch now instead of in
118
- * `configureTracking()`, for a page that reads them before tracking starts.
119
- * It runs once per page load, so tracking's own capture is then a no-op.
126
+ * `configureTracking()`, for a page that reads them before tracking starts,
127
+ * or that never starts tracking, like the sign-in page. It runs once per page
128
+ * load, so tracking's own capture is then a no-op.
120
129
  */
121
- export declare function captureAttribution(): void;
130
+ export declare function captureAttribution(options?: CaptureAttributionOptions): void;
122
131
  export declare function setSentryUser(user: TrackingIdentityUser | null, orgId?: string | null): void;
123
132
  export declare function setTrackingIdentity(user: TrackingIdentityUser | null, orgId?: string | null): void;
124
133
  export interface ClientCaptureContext {
@@ -1,7 +1,7 @@
1
1
  import { recordTrackingEvent } from "../observability/tracing.js";
2
2
  import { AGENT_NATIVE_LIFECYCLE_EVENTS, AGENT_SIGNALS_PAGEVIEW_PROPERTY, AGENT_SIGNALS_VERSION, canonicalTrackingEvent, legacyLifecycleEvent, normalizeTrackingDimension, PAGE_LOAD_PAGEVIEW_PROPERTY, isWaitedActionResponse, SLOW_ACTION_RESPONSE_MS, TRACKING_EVENT_ALIAS_ID_PROPERTY, withCanonicalTrackingProperties, } from "../shared/analytics-events.js";
3
3
  import { ANALYTICS_CLIENT_PLATFORM_PROPERTY, } from "../shared/analytics-platform.js";
4
- import { hasAttributionSource } from "../shared/attribution-source.js";
4
+ import { hasAttributionSource, } from "../shared/attribution-source.js";
5
5
  import { resolveLaneEndpoint } from "../shared/environment-lanes.js";
6
6
  import { classifyErrorNoise, } from "../shared/error-noise.js";
7
7
  import { llmConnectionTrackingProperties, } from "../shared/llm-connection.js";
@@ -444,7 +444,7 @@ function scrubReferrerHost(referrer) {
444
444
  return "";
445
445
  }
446
446
  }
447
- function buildFirstTouchAttribution() {
447
+ function buildFirstTouchAttribution(landingPathname) {
448
448
  const attribution = {};
449
449
  let params = null;
450
450
  try {
@@ -460,7 +460,7 @@ function buildFirstTouchAttribution() {
460
460
  attribution[field] = value;
461
461
  }
462
462
  }
463
- const landingPath = truncateFirstTouchField(window.location.pathname);
463
+ const landingPath = truncateFirstTouchField(landingPathname);
464
464
  if (landingPath)
465
465
  attribution.landing_path = landingPath;
466
466
  const landingReferrer = typeof document !== "undefined" ? scrubReferrerHost(document.referrer) : "";
@@ -574,14 +574,14 @@ function backfillAttributionCookie(storageKey, spec) {
574
574
  * from replaces it. Without that, an untagged first visit would hide every
575
575
  * tagged visit after it.
576
576
  */
577
- function captureFirstTouchAttribution() {
577
+ function captureFirstTouchAttribution(options = {}) {
578
578
  if (_firstTouchCaptured)
579
579
  return;
580
580
  _firstTouchCaptured = true;
581
581
  if (typeof window === "undefined")
582
582
  return;
583
583
  try {
584
- const current = buildFirstTouchAttribution();
584
+ const current = buildFirstTouchAttribution(options.landingPath ?? window.location.pathname);
585
585
  const existing = getFirstTouchAttribution();
586
586
  if (existing &&
587
587
  (hasAttributionSource(existing) || !hasAttributionSource(current))) {
@@ -650,38 +650,72 @@ function readForwardedLastTouch() {
650
650
  }
651
651
  return hasAttributionSource(forwarded) ? forwarded : null;
652
652
  }
653
- function readStoredAttribution(storageKey) {
654
- if (typeof window === "undefined")
653
+ function parseAttribution(raw) {
654
+ if (!raw)
655
655
  return null;
656
656
  try {
657
- const raw = safeStorageGet(storageKey);
658
- if (!raw)
659
- return null;
660
657
  const parsed = JSON.parse(raw);
661
658
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
662
659
  return null;
663
660
  }
664
- return parsed;
661
+ // Every field is a string; a corrupted non-string one would make source
662
+ // detection throw, so it is dropped like any unreadable value.
663
+ const touch = {};
664
+ for (const [field, value] of Object.entries(parsed)) {
665
+ if (typeof value === "string")
666
+ touch[field] = value;
667
+ }
668
+ return touch;
669
+ }
670
+ catch {
671
+ // coercion-ok: an unparseable value holds no touch; the caller tries the
672
+ // next source.
673
+ return null;
674
+ }
675
+ }
676
+ function readAttributionCookieValue(cookieName) {
677
+ const cookie = readAttributionCookie(cookieName);
678
+ if (!cookie)
679
+ return null;
680
+ try {
681
+ return parseAttribution(decodeURIComponent(cookie));
665
682
  }
666
683
  catch {
684
+ // coercion-ok: a malformed cookie encoding holds no touch.
667
685
  return null;
668
686
  }
669
687
  }
688
+ /**
689
+ * The stored touch, unless only its cookie says where the visitor came from:
690
+ * storage can be blocked, cleared, or hold an unreadable or empty value. The
691
+ * cookie is what signup reads, so a source that survives only there still
692
+ * counts, and capture must not overwrite it as if this were a first visit.
693
+ */
694
+ function readStoredAttribution(storageKey, cookieName) {
695
+ if (typeof window === "undefined")
696
+ return null;
697
+ const stored = parseAttribution(safeStorageGet(storageKey));
698
+ if (hasAttributionSource(stored))
699
+ return stored;
700
+ const cookie = readAttributionCookieValue(cookieName);
701
+ return hasAttributionSource(cookie) ? cookie : (stored ?? cookie);
702
+ }
670
703
  export function getFirstTouchAttribution() {
671
- return readStoredAttribution(FIRST_TOUCH_STORAGE_KEY);
704
+ return readStoredAttribution(FIRST_TOUCH_STORAGE_KEY, FIRST_TOUCH_COOKIE_NAME);
672
705
  }
673
706
  export function getLastTouchAttribution() {
674
- return readStoredAttribution(LAST_TOUCH_STORAGE_KEY);
707
+ return readStoredAttribution(LAST_TOUCH_STORAGE_KEY, LAST_TOUCH_COOKIE_NAME);
675
708
  }
676
709
  /**
677
710
  * Store the visitor's first and last touch now instead of in
678
- * `configureTracking()`, for a page that reads them before tracking starts.
679
- * It runs once per page load, so tracking's own capture is then a no-op.
711
+ * `configureTracking()`, for a page that reads them before tracking starts,
712
+ * or that never starts tracking, like the sign-in page. It runs once per page
713
+ * load, so tracking's own capture is then a no-op.
680
714
  */
681
- export function captureAttribution() {
715
+ export function captureAttribution(options = {}) {
682
716
  if (isSyntheticBrowserTraffic())
683
717
  return;
684
- captureFirstTouchAttribution();
718
+ captureFirstTouchAttribution(options);
685
719
  }
686
720
  function isLocalAnalyticsHostname(hostname) {
687
721
  const h = (hostname || "").toLowerCase();
@@ -18,6 +18,7 @@ export interface UseOnboardingResult {
18
18
  profile: OnboardingAppProfile | null;
19
19
  loading: boolean;
20
20
  error: string | null;
21
+ summaryKnown: boolean;
21
22
  currentStepId: string | null;
22
23
  completeCount: number;
23
24
  totalCount: number;
@@ -583,6 +583,7 @@ export function useOnboarding(options = {}) {
583
583
  const [profile, setProfile] = useState(null);
584
584
  const [loading, setLoading] = useState(true);
585
585
  const [error, setError] = useState(null);
586
+ const [summaryKnown, setSummaryKnown] = useState(false);
586
587
  const [dismissed, setDismissed] = useState(false);
587
588
  const [firstRun, setFirstRun] = useState(preview || initialFirstRun);
588
589
  const [completeFirstRunError, setCompleteFirstRunError] = useState(null);
@@ -606,10 +607,8 @@ export function useOnboarding(options = {}) {
606
607
  : initialFirstRun
607
608
  ? Promise.resolve(true)
608
609
  : fetchFirstRunOnboardingStatus();
609
- const [summary, firstRunRes] = await Promise.all([
610
- readOnboardingSummary(summaryUrl, reuseSharedRead !== true),
611
- firstRunPromise,
612
- ]);
610
+ const firstRunResultPromise = firstRunPromise.then((value) => ({ status: "fulfilled", value }), (reason) => ({ status: "rejected", reason }));
611
+ const summary = await readOnboardingSummary(summaryUrl, reuseSharedRead !== true);
613
612
  if (!mountedRef.current ||
614
613
  fetchGeneration !== fetchGenerationRef.current) {
615
614
  return;
@@ -630,13 +629,23 @@ export function useOnboarding(options = {}) {
630
629
  stepsRef.current = summary.steps;
631
630
  setSteps(summary.steps);
632
631
  setProfile(summary.profile);
632
+ setDismissed(!!summary.dismissed);
633
+ setSummaryKnown(true);
634
+ setError(null);
635
+ const firstRunResult = await firstRunResultPromise;
636
+ if (!mountedRef.current ||
637
+ fetchGeneration !== fetchGenerationRef.current) {
638
+ return;
639
+ }
640
+ if (firstRunResult.status === "rejected") {
641
+ throw firstRunResult.reason;
642
+ }
633
643
  if (preview) {
634
644
  setFirstRun(true);
635
645
  }
636
646
  else if (!initialFirstRun) {
637
- setFirstRun(firstRunRes === true);
647
+ setFirstRun(firstRunResult.value === true);
638
648
  }
639
- setDismissed(!!summary.dismissed);
640
649
  setError(null);
641
650
  }
642
651
  catch (e) {
@@ -710,6 +719,9 @@ export function useOnboarding(options = {}) {
710
719
  flow: "checklist",
711
720
  step_id: id,
712
721
  });
722
+ const updatedSteps = stepsRef.current.map((step) => step.id === id ? { ...step, complete: true } : step);
723
+ stepsRef.current = updatedSteps;
724
+ setSteps(updatedSteps);
713
725
  await fetchAll();
714
726
  }, [fetchAll]);
715
727
  const dismiss = useCallback(async () => {
@@ -802,6 +814,7 @@ export function useOnboarding(options = {}) {
802
814
  profile,
803
815
  loading,
804
816
  error,
817
+ summaryKnown,
805
818
  currentStepId,
806
819
  completeCount,
807
820
  totalCount,
@@ -13,8 +13,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
13
13
  };
14
14
  }>>;
15
15
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -41,11 +41,24 @@ export async function createAgentRunner(config) {
41
41
  Object.values(actions).some((action) => action.readOnly !== true))) {
42
42
  throw new Error("Production chat evals require the real final response guard and a read-only adapter action registry.");
43
43
  }
44
- const engine = config.engine ?? (await resolveEngine({ engineOption: undefined }));
45
- const modelCandidate = config.model ??
46
- (await getStoredModelForEngine(engine)) ??
47
- engine.defaultModel;
48
- const model = normalizeModelForEngine(engine, modelCandidate);
44
+ const resolveRuntimeModel = async () => {
45
+ const engine = config.engine ??
46
+ (await resolveEngine({ appId: productionContext?.appId }));
47
+ const modelCandidate = config.model ??
48
+ (await getStoredModelForEngine(engine, {
49
+ appId: productionContext?.appId,
50
+ })) ??
51
+ engine.defaultModel;
52
+ return { engine, model: normalizeModelForEngine(engine, modelCandidate) };
53
+ };
54
+ const runtimeModel = productionContext
55
+ ? await runWithRequestContext({
56
+ userEmail: productionContext.ownerEmail,
57
+ orgId: productionContext.orgId ?? undefined,
58
+ isSyntheticTraffic: true,
59
+ }, resolveRuntimeModel)
60
+ : await resolveRuntimeModel();
61
+ const { engine, model } = runtimeModel;
49
62
  const timeoutMs = config.timeoutMs ?? DEFAULT_AGENT_TIMEOUT_MS;
50
63
  const initialToolNames = productionContext?.initialToolNames
51
64
  ? new Set(productionContext.initialToolNames)
@@ -359,9 +372,6 @@ function validateProductionPathRun(result, context, actionAllowlist) {
359
372
  !["ok", "empty", "timed_out", "failed"].includes(receipt.prefetchStatus)) {
360
373
  return "Production chat eval adapter returned an incomplete setup receipt.";
361
374
  }
362
- if (receipt.prefetchStatus !== "ok" && receipt.prefetchStatus !== "empty") {
363
- return `Production chat eval adapter reported unsuccessful prefetch status "${receipt.prefetchStatus}".`;
364
- }
365
375
  if (receipt.ownerEmail.trim().toLowerCase() !==
366
376
  context.ownerEmail.trim().toLowerCase() ||
367
377
  receipt.orgId !== context.orgId) {
@@ -42,8 +42,8 @@ declare const _default: import("../../action.js").ActionDefinition<{
42
42
  url: string;
43
43
  id: string;
44
44
  provider: string;
45
- configured?: undefined;
46
45
  error?: undefined;
46
+ configured?: undefined;
47
47
  } | {
48
48
  url?: undefined;
49
49
  id?: undefined;
@@ -11,9 +11,9 @@ declare const _default: import("../../action.js").ActionDefinition<{
11
11
  enabled?: undefined;
12
12
  nextRun?: undefined;
13
13
  } | {
14
+ deleted?: undefined;
14
15
  name: string;
15
16
  enabled: boolean;
16
17
  nextRun: string;
17
- deleted?: undefined;
18
18
  }>;
19
19
  export default _default;
@@ -140,13 +140,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
140
140
  clientHint?: undefined;
141
141
  timestamp?: undefined;
142
142
  chapterId?: undefined;
143
+ count?: undefined;
143
144
  startAt?: undefined;
144
145
  endAt?: undefined;
145
146
  reason?: undefined;
146
147
  includeMicrophone?: undefined;
147
148
  includeSystemAudio?: undefined;
148
149
  requestId?: undefined;
149
- count?: undefined;
150
150
  };
151
151
  required?: undefined;
152
152
  };
@@ -171,13 +171,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
171
171
  clientHint?: undefined;
172
172
  timestamp?: undefined;
173
173
  chapterId?: undefined;
174
+ count?: undefined;
174
175
  startAt?: undefined;
175
176
  endAt?: undefined;
176
177
  reason?: undefined;
177
178
  includeMicrophone?: undefined;
178
179
  includeSystemAudio?: undefined;
179
180
  requestId?: undefined;
180
- count?: undefined;
181
181
  };
182
182
  required?: undefined;
183
183
  };
@@ -196,13 +196,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
196
196
  clientHint?: undefined;
197
197
  timestamp?: undefined;
198
198
  chapterId?: undefined;
199
+ count?: undefined;
199
200
  startAt?: undefined;
200
201
  endAt?: undefined;
201
202
  reason?: undefined;
202
203
  includeMicrophone?: undefined;
203
204
  includeSystemAudio?: undefined;
204
205
  requestId?: undefined;
205
- count?: undefined;
206
206
  };
207
207
  required?: undefined;
208
208
  };
@@ -231,13 +231,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
231
231
  };
232
232
  timestamp?: undefined;
233
233
  chapterId?: undefined;
234
+ count?: undefined;
234
235
  startAt?: undefined;
235
236
  endAt?: undefined;
236
237
  reason?: undefined;
237
238
  includeMicrophone?: undefined;
238
239
  includeSystemAudio?: undefined;
239
240
  requestId?: undefined;
240
- count?: undefined;
241
241
  };
242
242
  };
243
243
  } | {
@@ -260,12 +260,12 @@ export declare function screenMemoryMcpToolDefinitions(): ({
260
260
  description: string;
261
261
  };
262
262
  chapterId?: undefined;
263
+ count?: undefined;
263
264
  startAt?: undefined;
264
265
  endAt?: undefined;
265
266
  includeMicrophone?: undefined;
266
267
  includeSystemAudio?: undefined;
267
268
  requestId?: undefined;
268
- count?: undefined;
269
269
  };
270
270
  };
271
271
  } | {
@@ -317,6 +317,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
317
317
  clientHint?: undefined;
318
318
  timestamp?: undefined;
319
319
  chapterId?: undefined;
320
+ count?: undefined;
320
321
  startAt: {
321
322
  type: string;
322
323
  description: string;
@@ -336,7 +337,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
336
337
  type: string;
337
338
  };
338
339
  requestId?: undefined;
339
- count?: undefined;
340
340
  };
341
341
  };
342
342
  } | {
@@ -352,6 +352,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
352
352
  clientHint?: undefined;
353
353
  timestamp?: undefined;
354
354
  chapterId?: undefined;
355
+ count?: undefined;
355
356
  startAt?: undefined;
356
357
  endAt?: undefined;
357
358
  reason?: undefined;
@@ -360,7 +361,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
360
361
  requestId: {
361
362
  type: string;
362
363
  };
363
- count?: undefined;
364
364
  };
365
365
  };
366
366
  })[];
@@ -16,6 +16,6 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  } | {
17
17
  count?: undefined;
18
18
  updated?: undefined;
19
- error?: undefined;
20
19
  ok: boolean;
20
+ error?: undefined;
21
21
  }>>;
@@ -27,43 +27,43 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
27
27
  thumbsUpRate: number;
28
28
  avgEvalScore: number;
29
29
  } | {
30
+ ok?: undefined;
30
31
  error: string;
31
32
  message: string;
32
33
  summary?: undefined;
33
34
  spans?: undefined;
34
- ok?: undefined;
35
35
  } | {
36
+ error?: undefined;
37
+ ok?: undefined;
36
38
  message?: undefined;
37
39
  summary: import("./types.js").TraceSummary;
38
40
  spans: import("./types.js").TraceSpan[];
41
+ } | {
39
42
  error?: undefined;
40
43
  ok?: undefined;
41
- } | {
42
44
  message?: undefined;
43
45
  summary?: undefined;
44
46
  spans?: undefined;
45
47
  traceMissing: true;
46
48
  id: string;
49
+ } | {
47
50
  error?: undefined;
48
51
  ok?: undefined;
49
- } | {
50
52
  message?: undefined;
51
53
  summary?: undefined;
52
54
  spans?: undefined;
53
55
  traceMissing?: undefined;
54
56
  id: string;
55
- error?: undefined;
56
- ok?: undefined;
57
57
  } | {
58
+ ok?: undefined;
58
59
  message?: undefined;
59
60
  summary?: undefined;
60
61
  spans?: undefined;
61
62
  error: any;
62
- ok?: undefined;
63
63
  } | {
64
+ error?: undefined;
64
65
  message?: undefined;
65
66
  summary?: undefined;
66
67
  spans?: undefined;
67
- error?: undefined;
68
68
  ok: boolean;
69
69
  }>>;