@agent-native/core 0.202.0 → 0.202.1-nightly-20261007011022

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 (75) hide show
  1. package/dist/agent/actions/list-model-providers.d.ts +2 -0
  2. package/dist/agent/actions/list-model-providers.js +32 -5
  3. package/dist/agent/actions/manage-provider-models.d.ts +1 -0
  4. package/dist/agent/engine/builder-engine.d.ts +1 -1
  5. package/dist/agent/engine/builtin.js +1 -1
  6. package/dist/agent/engine/index.d.ts +1 -1
  7. package/dist/agent/engine/index.js +1 -1
  8. package/dist/agent/engine/registry.d.ts +2 -0
  9. package/dist/agent/engine/registry.js +63 -47
  10. package/dist/agent/model-config.d.ts +6 -6
  11. package/dist/agent/model-config.js +7 -11
  12. package/dist/agent/model-version.d.ts +3 -0
  13. package/dist/agent/model-version.js +67 -0
  14. package/dist/agent/provider-model-selection.d.ts +6 -1
  15. package/dist/agent/provider-model-selection.js +131 -13
  16. package/dist/automation/index.d.ts +1 -1
  17. package/dist/cli/create.d.ts +2 -1
  18. package/dist/cli/create.js +17 -4
  19. package/dist/cli/template-sync.js +2 -1
  20. package/dist/cli/workspacify.d.ts +1 -0
  21. package/dist/cli/workspacify.js +4 -0
  22. package/dist/client/app-config.d.ts +1 -0
  23. package/dist/client/app-config.js +19 -0
  24. package/dist/client/chat/agentkit-protocol.js +122 -16
  25. package/dist/client/chat/runtime.js +943 -50
  26. package/dist/client/chat-model-groups.d.ts +1 -0
  27. package/dist/client/chat-model-groups.js +1 -0
  28. package/dist/client/use-chat-models.js +47 -6
  29. package/dist/deploy/build.js +23 -9
  30. package/dist/email-catalog/redact-body.js +1 -1
  31. package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
  32. package/dist/jobs/background-automation-runner.d.ts +3 -1
  33. package/dist/jobs/background-automation-runner.js +15 -8
  34. package/dist/jobs/scheduler.js +1 -1
  35. package/dist/mcp/build-server.d.ts +0 -1
  36. package/dist/mcp/build-server.js +10 -59
  37. package/dist/observability/routes.d.ts +6 -6
  38. package/dist/onboarding/app-profile-data.d.ts +10 -0
  39. package/dist/onboarding/app-profile-data.js +423 -0
  40. package/dist/onboarding/app-profile.d.ts +1 -7
  41. package/dist/onboarding/app-profile.js +5 -422
  42. package/dist/onboarding/index.d.ts +1 -0
  43. package/dist/onboarding/index.js +1 -0
  44. package/dist/org/handlers.d.ts +1 -1
  45. package/dist/org/index.d.ts +1 -1
  46. package/dist/progress/routes.d.ts +1 -1
  47. package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
  48. package/dist/provider-api/actions/provider-api.d.ts +10 -10
  49. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  50. package/dist/scripts/agent-engines/manage-agent-engine.js +1 -1
  51. package/dist/scripts/agent-engines/set-agent-engine.js +1 -1
  52. package/dist/secrets/routes.d.ts +11 -11
  53. package/dist/server/action-routes.js +1 -0
  54. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  55. package/dist/server/app-origin-config.d.ts +2 -0
  56. package/dist/server/app-origin-config.js +4 -0
  57. package/dist/server/auth.js +43 -1
  58. package/dist/server/better-auth-instance.js +7 -12
  59. package/dist/server/email-auth-links.d.ts +11 -0
  60. package/dist/server/email-auth-links.js +126 -0
  61. package/dist/server/fusion-app.js +11 -1
  62. package/dist/shared/agent-chat-context.d.ts +3 -3
  63. package/dist/shared/agent-chat-context.js +2 -2
  64. package/dist/shared/auth-copy.d.ts +3 -0
  65. package/dist/shared/auth-copy.js +33 -0
  66. package/dist/shared/design-system-agent-context.d.ts +5 -0
  67. package/dist/shared/design-system-agent-context.js +37 -8
  68. package/dist/shared/index.d.ts +1 -1
  69. package/dist/triggers/actions/manage-automation.d.ts +7 -7
  70. package/dist/triggers/condition-evaluator.d.ts +21 -5
  71. package/dist/triggers/condition-evaluator.js +113 -59
  72. package/dist/triggers/dispatcher.js +39 -21
  73. package/dist/vite/client.js +10 -0
  74. package/docs/content/durable-resume.mdx +9 -3
  75. package/package.json +5 -3
@@ -644,6 +644,7 @@ function mountActionRoutesInternal(nitroApp, actions, options) {
644
644
  appId: options?.appId,
645
645
  caller,
646
646
  requestHeaders: event.headers,
647
+ ...(event.req?.signal ? { signal: event.req.signal } : {}),
647
648
  actionName: name,
648
649
  ...(resolvedCaller?.delegationJti
649
650
  ? {
@@ -65,6 +65,7 @@ export declare function createAgentEngineApiKeyHandler(): import("h3").EventHand
65
65
  error: any;
66
66
  code: any;
67
67
  } | {
68
+ error?: undefined;
68
69
  errorCode?: undefined;
69
70
  code?: undefined;
70
71
  ok: boolean;
@@ -72,6 +73,5 @@ export declare function createAgentEngineApiKeyHandler(): import("h3").EventHand
72
73
  baseUrlKey?: string;
73
74
  scope: AgentEngineApiKeyScope;
74
75
  defaultModel?: import("./agent-engine-default-model-route.js").SavedKeyDefaultModelOutcome;
75
- error?: undefined;
76
76
  }>>;
77
77
  export {};
@@ -1,4 +1,6 @@
1
1
  export declare function resolvePublicAppOriginConfig(): {
2
+ appId?: string;
3
+ workspaceAppId?: string;
2
4
  appHomePath: string;
3
5
  appUrl?: string;
4
6
  workspaceGatewayUrl?: string;
@@ -40,6 +40,10 @@ export function resolvePublicAppOriginConfig() {
40
40
  typeof config.workspace.appsJson === "string";
41
41
  const workspaceAppMountPaths = workspaceAppMountPathsFromJson(config.workspace.appsJson);
42
42
  const resolved = {
43
+ ...(config.app.id ? { appId: config.app.id } : {}),
44
+ ...(config.app.workspaceId
45
+ ? { workspaceAppId: config.app.workspaceId }
46
+ : {}),
43
47
  appHomePath: resolveAppHomePath(config.app, config.workspace),
44
48
  ...(config.app.url ? { appUrl: config.app.url } : {}),
45
49
  ...(config.workspace.gatewayUrl
@@ -10,6 +10,7 @@ import { isGoogleProfileImageUrl } from "../shared/google-profile-image.js";
10
10
  import { EMBED_TRANSPLANT_HEADER, isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
11
11
  import { readDevActionDiscoveryFile } from "./dev-action-discovery.js";
12
12
  import { devLoopbackAuthHint } from "./dev-origin-hint.js";
13
+ import { EMAIL_AUTH_LINK_LANDING_PATH, emailAuthLinkFields, emailAuthLinkLandingPage, emailAuthVerificationPath, emailAuthVerificationUrl, } from "./email-auth-links.js";
13
14
  import { isEmbedCapabilityScope, revokeEmbedSessionsForOwners, requestHasEmbedAuthMarker, resolveEmbedSessionCookieOwners, resolveEmbedSessionFromRequest, verifyEmbedSessionToken, } from "./embed-session.js";
14
15
  import { getPublicFrameworkPathname } from "./framework-request-context.js";
15
16
  import { canonicalFrameworkPathname, getFrameworkRoutePrefix, publicFrameworkPath, } from "./framework-route-prefix.js";
@@ -48,7 +49,7 @@ import { MCP_DIRECTORY_ROUTE_PREFIX, MCP_LEGACY_ROUTE_PREFIX, MCP_PUBLIC_ROUTE_P
48
49
  import { authProviderRequiredMessage, getRequiredAuthProviderForEmail, isGoogleSignInRequiredForEmail, } from "../org/auth-policy.js";
49
50
  import { readBody } from "../server/h3-helpers.js";
50
51
  import { putSetting } from "../settings/store.js";
51
- import { AUTH_SIGNUP_INVITE_ONLY_CODE } from "../shared/auth-copy.js";
52
+ import { AUTH_SIGNUP_INVITE_ONLY_CODE, resolveNativeAuthCopy, } from "../shared/auth-copy.js";
52
53
  import { DISABLED_SSR_CACHE_HEADERS, resolveSsrCacheHeaders, SSR_QUERY_CACHE_KEY_HEADER, } from "../shared/cache-control.js";
53
54
  import { extractOAuthStateAppId, extractOAuthStateProvider, } from "../shared/oauth-state.js";
54
55
  import { PASSWORD_MIN_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MAX_LENGTH_MESSAGE, PASSWORD_MIN_LENGTH_MESSAGE, } from "../shared/password-policy.js";
@@ -4161,6 +4162,47 @@ async function mountBetterAuthRoutes(app, options) {
4161
4162
  });
4162
4163
  return { token: entry.token, email: entry.email };
4163
4164
  }));
4165
+ app.use(EMAIL_AUTH_LINK_LANDING_PATH, defineEventHandler(async (event) => {
4166
+ const setupRequiredHtml = getDeploySettingsRequiredPage(event, getRequestPathAndSearch(event).rawPath);
4167
+ if (setupRequiredHtml)
4168
+ return setupRequiredResponse(setupRequiredHtml);
4169
+ const method = getMethod(event);
4170
+ if (method !== "GET" && method !== "POST") {
4171
+ setResponseStatus(event, 405);
4172
+ return { error: "Method not allowed" };
4173
+ }
4174
+ const values = method === "POST"
4175
+ ? await readBody(event)
4176
+ : getQuery(event);
4177
+ const verificationPath = emailAuthVerificationPath(values.kind);
4178
+ const fields = emailAuthLinkFields(values);
4179
+ const verificationURL = verificationPath
4180
+ ? emailAuthVerificationUrl(getAppUrl(event, verificationPath), values)
4181
+ : undefined;
4182
+ if (!verificationURL || !fields) {
4183
+ setResponseStatus(event, 400);
4184
+ return { error: "Invalid or expired email link." };
4185
+ }
4186
+ if (method === "POST") {
4187
+ return new Response(null, {
4188
+ status: 303,
4189
+ headers: {
4190
+ "cache-control": "no-store",
4191
+ location: verificationURL.toString(),
4192
+ "referrer-policy": "no-referrer",
4193
+ },
4194
+ });
4195
+ }
4196
+ const { locale, dir } = resolveLocaleFromRequest({
4197
+ acceptLanguage: getHeader(event, "accept-language"),
4198
+ });
4199
+ const copy = resolveNativeAuthCopy(locale);
4200
+ return emailAuthLinkLandingPage(getAppUrl(event, EMAIL_AUTH_LINK_LANDING_PATH), fields, {
4201
+ title: copy.emailLinkContinueTitle,
4202
+ message: copy.emailLinkContinueMessage,
4203
+ action: copy.emailLinkContinueAction,
4204
+ }, locale, dir);
4205
+ }));
4164
4206
  app.use(DESKTOP_MAGIC_LINK_LANDING_PATH, defineEventHandler(async (event) => {
4165
4207
  // Mounted before Better Auth starts, so it outlives an init failure; its
4166
4208
  // form could never sign anyone in on a deploy missing a setting.
@@ -40,6 +40,7 @@ import { signupAttributionContextFromCookieHeader, signupAttributionContextFromH
40
40
  import { resolveAuthCookieNamespace } from "./cookie-namespace.js";
41
41
  import { getMissingAuthSecretKey, MissingAuthSecretError, } from "./deploy-settings.js";
42
42
  import { getWorkspaceA2ADerivedSecret } from "./derived-secret.js";
43
+ import { emailAuthLinkLandingUrl } from "./email-auth-links.js";
43
44
  import { getDeploymentEmailReadiness, sendEmail, } from "./email.js";
44
45
  import { canonicalFrameworkPathname, publicFrameworkPath, } from "./framework-route-prefix.js";
45
46
  import { recordActiveGoogleSignInCredentials, resolveGoogleSignInCredentials, } from "./google-oauth-credentials.js";
@@ -1508,7 +1509,7 @@ async function createBetterAuthInstance(config) {
1508
1509
  urlQueryKeys,
1509
1510
  });
1510
1511
  }
1511
- const deliveredMagicLinkUrl = desktopMagicLinkLandingUrl(url) ?? url;
1512
+ const deliveredMagicLinkUrl = desktopMagicLinkLandingUrl(url) ?? emailAuthLinkLandingUrl(url) ?? url;
1512
1513
  const { subject, html, text, appSender } = await renderTransactionalEmail(CORE_MAGIC_LINK_EMAIL_ID, {
1513
1514
  email,
1514
1515
  magicLinkUrl: deliveredMagicLinkUrl,
@@ -1566,18 +1567,13 @@ async function createBetterAuthInstance(config) {
1566
1567
  sendOnSignUp: requireEmailVerification,
1567
1568
  autoSignInAfterVerification: true,
1568
1569
  sendVerificationEmail: async ({ user, url, token }) => {
1569
- const verifyBasePath = (process.env.VITE_APP_BASE_PATH ||
1570
- process.env.APP_BASE_PATH ||
1571
- "").replace(/\/$/, "");
1572
- const verifyUrl = verifyBasePath
1573
- ? url.replace(/(\/\/[^/]+)(\/)/, `$1${verifyBasePath}$2`)
1574
- : url;
1570
+ const deliveredVerifyUrl = emailAuthLinkLandingUrl(url) ?? url;
1575
1571
  const emailChange = await verifiedEmailChangeFromToken(token, secret, user.email);
1576
1572
  if (emailChange)
1577
1573
  await preflightEmailIdentityRekey(emailChange.oldEmail, emailChange.newEmail);
1578
1574
  const renderedEmail = await renderTransactionalEmail(emailChange
1579
1575
  ? CORE_CHANGE_EMAIL_VERIFICATION_EMAIL_ID
1580
- : CORE_VERIFY_SIGNUP_EMAIL_ID, { email: user.email, verifyUrl });
1576
+ : CORE_VERIFY_SIGNUP_EMAIL_ID, { email: user.email, verifyUrl: deliveredVerifyUrl });
1581
1577
  await sendEmail({
1582
1578
  to: user.email,
1583
1579
  ...renderedEmail,
@@ -1616,10 +1612,7 @@ async function createBetterAuthInstance(config) {
1616
1612
  updateEmailWithoutVerification: false,
1617
1613
  sendChangeEmailConfirmation: async ({ user, newEmail, url }) => {
1618
1614
  await preflightEmailIdentityRekey(user.email, newEmail);
1619
- const confirmationBasePath = getConfiguredAppBasePath();
1620
- const confirmationUrl = confirmationBasePath
1621
- ? url.replace(/(\/\/[^/]+)(\/)/, `$1${confirmationBasePath}$2`)
1622
- : url;
1615
+ const confirmationUrl = emailAuthLinkLandingUrl(url) ?? url;
1623
1616
  const renderedEmail = await renderTransactionalEmail(CORE_CHANGE_EMAIL_CONFIRMATION_EMAIL_ID, { email: user.email, newEmail, confirmationUrl });
1624
1617
  await sendEmail({
1625
1618
  to: user.email,
@@ -1795,6 +1788,8 @@ async function createBetterAuthInstance(config) {
1795
1788
  },
1796
1789
  advanced: {
1797
1790
  cookiePrefix: cookieNamespace.betterAuthCookiePrefix,
1791
+ // Keep callback URL validation active in test runs as well as production.
1792
+ disableOriginCheck: false,
1798
1793
  ...(appUrl.startsWith("https://") || isBuilderPreviewHttpsEnvironment()
1799
1794
  ? {
1800
1795
  defaultCookieAttributes: {
@@ -0,0 +1,11 @@
1
+ export declare const EMAIL_AUTH_LINK_LANDING_PATH = "/_agent-native/auth/email-link/landing";
2
+ export type EmailAuthLinkKind = "magic-link" | "verify-email";
3
+ export declare function emailAuthVerificationPath(kind: unknown): string | undefined;
4
+ export declare function emailAuthLinkLandingUrl(value: string): string | undefined;
5
+ export declare function emailAuthLinkFields(values: Record<string, unknown>): Record<string, string> | undefined;
6
+ export declare function emailAuthVerificationUrl(baseUrl: string, values: Record<string, unknown>): URL | undefined;
7
+ export declare function emailAuthLinkLandingPage(actionUrl: string, fields: Record<string, string>, copy: {
8
+ title: string;
9
+ message: string;
10
+ action: string;
11
+ }, locale: string, direction: "ltr" | "rtl"): Response;
@@ -0,0 +1,126 @@
1
+ import { canonicalFrameworkPathname, publicFrameworkPath, } from "./framework-route-prefix.js";
2
+ export const EMAIL_AUTH_LINK_LANDING_PATH = "/_agent-native/auth/email-link/landing";
3
+ const BETTER_AUTH_MAGIC_LINK_VERIFY_PATH = "/_agent-native/auth/ba/magic-link/verify";
4
+ const BETTER_AUTH_VERIFY_EMAIL_PATH = "/_agent-native/auth/ba/verify-email";
5
+ const DESKTOP_MAGIC_LINK_CALLBACK_PATH = "/_agent-native/auth/magic-link/desktop-callback";
6
+ const EMAIL_AUTH_LINK_CALLBACK_KEYS = [
7
+ "callbackURL",
8
+ "newUserCallbackURL",
9
+ "errorCallbackURL",
10
+ ];
11
+ export function emailAuthVerificationPath(kind) {
12
+ if (kind === "magic-link")
13
+ return BETTER_AUTH_MAGIC_LINK_VERIFY_PATH;
14
+ if (kind === "verify-email")
15
+ return BETTER_AUTH_VERIFY_EMAIL_PATH;
16
+ return undefined;
17
+ }
18
+ export function emailAuthLinkLandingUrl(value) {
19
+ try {
20
+ const url = new URL(value);
21
+ const pathname = canonicalFrameworkPathname(url.pathname);
22
+ const kind = pathname.endsWith(BETTER_AUTH_MAGIC_LINK_VERIFY_PATH)
23
+ ? "magic-link"
24
+ : pathname.endsWith(BETTER_AUTH_VERIFY_EMAIL_PATH)
25
+ ? "verify-email"
26
+ : undefined;
27
+ const marker = kind === "magic-link"
28
+ ? BETTER_AUTH_MAGIC_LINK_VERIFY_PATH
29
+ : kind === "verify-email"
30
+ ? BETTER_AUTH_VERIFY_EMAIL_PATH
31
+ : undefined;
32
+ if (!kind || !marker || !url.searchParams.get("token"))
33
+ return undefined;
34
+ if (kind === "magic-link") {
35
+ const callbackURL = url.searchParams.get("callbackURL");
36
+ if (callbackURL) {
37
+ const callback = new URL(callbackURL, url.origin);
38
+ if (callback.origin === url.origin &&
39
+ canonicalFrameworkPathname(callback.pathname).endsWith(DESKTOP_MAGIC_LINK_CALLBACK_PATH)) {
40
+ return undefined;
41
+ }
42
+ }
43
+ }
44
+ const markerIndex = pathname.lastIndexOf(marker);
45
+ if (markerIndex < 0 || markerIndex + marker.length !== pathname.length) {
46
+ return undefined;
47
+ }
48
+ url.pathname = publicFrameworkPath(`${pathname.slice(0, markerIndex)}${EMAIL_AUTH_LINK_LANDING_PATH}`);
49
+ url.searchParams.set("kind", kind);
50
+ return url.toString();
51
+ }
52
+ catch {
53
+ // coercion-ok: malformed provider URLs are returned unchanged by the caller.
54
+ return undefined;
55
+ }
56
+ }
57
+ export function emailAuthLinkFields(values) {
58
+ const kind = values.kind;
59
+ if (kind !== "magic-link" && kind !== "verify-email")
60
+ return undefined;
61
+ const token = typeof values.token === "string" ? values.token.trim() : "";
62
+ if (!token)
63
+ return undefined;
64
+ const fields = { kind, token };
65
+ for (const key of EMAIL_AUTH_LINK_CALLBACK_KEYS) {
66
+ const value = values[key];
67
+ if (value === undefined || value === null || value === "")
68
+ continue;
69
+ if (typeof value !== "string")
70
+ return undefined;
71
+ fields[key] = value;
72
+ }
73
+ return fields;
74
+ }
75
+ export function emailAuthVerificationUrl(baseUrl, values) {
76
+ const fields = emailAuthLinkFields(values);
77
+ if (!fields)
78
+ return undefined;
79
+ try {
80
+ const verificationURL = new URL(baseUrl);
81
+ for (const key of EMAIL_AUTH_LINK_CALLBACK_KEYS) {
82
+ const callback = fields[key];
83
+ if (!callback)
84
+ continue;
85
+ verificationURL.searchParams.set(key, callback);
86
+ }
87
+ verificationURL.searchParams.set("token", fields.token);
88
+ return verificationURL;
89
+ }
90
+ catch {
91
+ // coercion-ok: malformed verification URLs are rejected by the landing route.
92
+ return undefined;
93
+ }
94
+ }
95
+ function escapeHtml(value) {
96
+ return value.replace(/[&<>"']/g, (char) => {
97
+ switch (char) {
98
+ case "&":
99
+ return "&amp;";
100
+ case "<":
101
+ return "&lt;";
102
+ case ">":
103
+ return "&gt;";
104
+ case '"':
105
+ return "&quot;";
106
+ default:
107
+ return "&#39;";
108
+ }
109
+ });
110
+ }
111
+ export function emailAuthLinkLandingPage(actionUrl, fields, copy, locale, direction) {
112
+ const hiddenInputs = Object.entries(fields)
113
+ .map(([name, value]) => `<input type="hidden" name="${escapeHtml(name)}" value="${escapeHtml(value)}">`)
114
+ .join("");
115
+ const html = `<!DOCTYPE html><html lang="${escapeHtml(locale)}" dir="${direction}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(copy.title)}</title></head><body><main><h1>${escapeHtml(copy.title)}</h1><p>${escapeHtml(copy.message)}</p><form method="post" action="${escapeHtml(actionUrl)}" autocomplete="off">${hiddenInputs}<button type="submit">${escapeHtml(copy.action)}</button></form></main></body></html>`;
116
+ return new Response(html, {
117
+ status: 200,
118
+ headers: {
119
+ "cache-control": "no-store",
120
+ "content-security-policy": "default-src 'none'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'",
121
+ "content-type": "text/html; charset=utf-8",
122
+ "referrer-policy": "no-referrer",
123
+ "x-robots-tag": "noindex",
124
+ },
125
+ });
126
+ }
@@ -113,7 +113,17 @@ export async function getBuilderCreditUsage() {
113
113
  }
114
114
  if (!response.ok)
115
115
  return builderCreditUsageUnavailable(response.status);
116
- return builderCreditUsageSchema.parse(await response.json());
116
+ let payload;
117
+ try {
118
+ payload = await response.json();
119
+ }
120
+ catch {
121
+ return builderCreditUsageUnavailable(response.status);
122
+ }
123
+ const parsed = builderCreditUsageSchema.safeParse(payload);
124
+ if (!parsed.success)
125
+ return builderCreditUsageUnavailable(response.status);
126
+ return parsed.data;
117
127
  }
118
128
  export async function getBuilderReferralInfo() {
119
129
  const authorization = await resolveBuilderRequestAuthorization({
@@ -1,4 +1,4 @@
1
- import { splitAgentKitMessageContext } from "@agent-native/agentkit";
2
- export { appendAgentChatContextToMessage } from "@agent-native/agentkit";
3
- export type { AgentKitMessageParts as AgentChatMessageParts } from "@agent-native/agentkit";
1
+ import { splitAgentKitMessageContext } from "@agent-native/agentkit/chat-context";
2
+ export { appendAgentChatContextToMessage } from "@agent-native/agentkit/chat-context";
3
+ export type { AgentKitMessageParts as AgentChatMessageParts } from "@agent-native/agentkit/chat-context";
4
4
  export declare const splitAgentChatContextFromMessage: typeof splitAgentKitMessageContext;
@@ -1,3 +1,3 @@
1
- import { splitAgentKitMessageContext } from "@agent-native/agentkit";
2
- export { appendAgentChatContextToMessage } from "@agent-native/agentkit";
1
+ import { splitAgentKitMessageContext } from "@agent-native/agentkit/chat-context";
2
+ export { appendAgentChatContextToMessage } from "@agent-native/agentkit/chat-context";
3
3
  export const splitAgentChatContextFromMessage = splitAgentKitMessageContext;
@@ -9,6 +9,9 @@ export interface NativeAuthCopy {
9
9
  welcomeTitle: string;
10
10
  welcomeToApp: string;
11
11
  welcomeSubtitle: string;
12
+ emailLinkContinueTitle: string;
13
+ emailLinkContinueMessage: string;
14
+ emailLinkContinueAction: string;
12
15
  email: string;
13
16
  emailPlaceholder: string;
14
17
  legalPrefix: string;
@@ -21,6 +21,9 @@ export const NATIVE_AUTH_COPY = {
21
21
  welcomeTitle: "Welcome",
22
22
  welcomeToApp: "Welcome to {appName}",
23
23
  welcomeSubtitle: "Sign in or create your account",
24
+ emailLinkContinueTitle: "Continue with your email link",
25
+ emailLinkContinueMessage: "Select Continue to complete this email step.",
26
+ emailLinkContinueAction: "Continue",
24
27
  email: "Email",
25
28
  emailPlaceholder: "you@example.com",
26
29
  legalPrefix: "By signing up, you accept our",
@@ -60,6 +63,9 @@ export const NATIVE_AUTH_COPY = {
60
63
  welcomeTitle: "欢迎",
61
64
  welcomeToApp: "欢迎使用 {appName}",
62
65
  welcomeSubtitle: "继续以登录或创建账户",
66
+ emailLinkContinueTitle: "继续使用此电子邮件链接",
67
+ emailLinkContinueMessage: "选择“继续”以完成此电子邮件步骤。",
68
+ emailLinkContinueAction: "继续",
63
69
  email: "电子邮箱",
64
70
  emailPlaceholder: "you@example.com",
65
71
  legalPrefix: "注册即表示你接受我们的",
@@ -99,6 +105,9 @@ export const NATIVE_AUTH_COPY = {
99
105
  welcomeTitle: "歡迎",
100
106
  welcomeToApp: "歡迎使用 {appName}",
101
107
  welcomeSubtitle: "繼續以登入或建立帳戶",
108
+ emailLinkContinueTitle: "繼續使用此電子郵件連結",
109
+ emailLinkContinueMessage: "選擇「繼續」以完成此電子郵件步驟。",
110
+ emailLinkContinueAction: "繼續",
102
111
  email: "電子郵件",
103
112
  emailPlaceholder: "you@example.com",
104
113
  legalPrefix: "註冊即表示你接受我們的",
@@ -138,6 +147,9 @@ export const NATIVE_AUTH_COPY = {
138
147
  welcomeTitle: "Bienvenido",
139
148
  welcomeToApp: "Bienvenido a {appName}",
140
149
  welcomeSubtitle: "Continúa para iniciar sesión o crear tu cuenta",
150
+ emailLinkContinueTitle: "Continúa con el enlace de tu correo",
151
+ emailLinkContinueMessage: "Selecciona Continuar para completar este paso.",
152
+ emailLinkContinueAction: "Continuar",
141
153
  email: "Email",
142
154
  emailPlaceholder: "you@example.com",
143
155
  legalPrefix: "Al registrarte, aceptas nuestros",
@@ -177,6 +189,9 @@ export const NATIVE_AUTH_COPY = {
177
189
  welcomeTitle: "Bienvenue",
178
190
  welcomeToApp: "Bienvenue sur {appName}",
179
191
  welcomeSubtitle: "Continuez pour vous connecter ou créer votre compte",
192
+ emailLinkContinueTitle: "Continuer avec le lien reçu par e-mail",
193
+ emailLinkContinueMessage: "Sélectionnez Continuer pour terminer cette étape.",
194
+ emailLinkContinueAction: "Continuer",
180
195
  email: "E-mail",
181
196
  emailPlaceholder: "you@example.com",
182
197
  legalPrefix: "En vous inscrivant, vous acceptez nos",
@@ -216,6 +231,9 @@ export const NATIVE_AUTH_COPY = {
216
231
  welcomeTitle: "Willkommen",
217
232
  welcomeToApp: "Willkommen bei {appName}",
218
233
  welcomeSubtitle: "Fahre fort, um dich anzumelden oder ein Konto zu erstellen",
234
+ emailLinkContinueTitle: "Mit deinem E-Mail-Link fortfahren",
235
+ emailLinkContinueMessage: "Wähle Weiter, um diesen Schritt abzuschließen.",
236
+ emailLinkContinueAction: "Weiter",
219
237
  email: "E-Mail",
220
238
  emailPlaceholder: "you@example.com",
221
239
  legalPrefix: "Mit der Registrierung akzeptierst du unsere",
@@ -255,6 +273,9 @@ export const NATIVE_AUTH_COPY = {
255
273
  welcomeTitle: "ようこそ",
256
274
  welcomeToApp: "{appName}へようこそ",
257
275
  welcomeSubtitle: "続けてサインインするか、アカウントを作成します",
276
+ emailLinkContinueTitle: "メールリンクで続行",
277
+ emailLinkContinueMessage: "「続行」を選択してこの手順を完了してください。",
278
+ emailLinkContinueAction: "続行",
258
279
  email: "メール",
259
280
  emailPlaceholder: "you@example.com",
260
281
  legalPrefix: "登録すると、以下に同意したものとみなされます:",
@@ -294,6 +315,9 @@ export const NATIVE_AUTH_COPY = {
294
315
  welcomeTitle: "환영합니다",
295
316
  welcomeToApp: "{appName}에 오신 것을 환영합니다",
296
317
  welcomeSubtitle: "계속해서 로그인하거나 계정을 만드세요",
318
+ emailLinkContinueTitle: "이메일 링크로 계속하기",
319
+ emailLinkContinueMessage: "계속을 선택해 이 단계를 완료하세요.",
320
+ emailLinkContinueAction: "계속",
297
321
  email: "이메일",
298
322
  emailPlaceholder: "you@example.com",
299
323
  legalPrefix: "가입하면 다음에 동의하게 됩니다:",
@@ -333,6 +357,9 @@ export const NATIVE_AUTH_COPY = {
333
357
  welcomeTitle: "Bem-vindo",
334
358
  welcomeToApp: "Bem-vindo ao {appName}",
335
359
  welcomeSubtitle: "Continue para entrar ou criar sua conta",
360
+ emailLinkContinueTitle: "Continuar com o link do e-mail",
361
+ emailLinkContinueMessage: "Selecione Continuar para concluir esta etapa.",
362
+ emailLinkContinueAction: "Continuar",
336
363
  email: "Email",
337
364
  emailPlaceholder: "you@example.com",
338
365
  legalPrefix: "Ao se cadastrar, você aceita nossos",
@@ -372,6 +399,9 @@ export const NATIVE_AUTH_COPY = {
372
399
  welcomeTitle: "स्वागत है",
373
400
  welcomeToApp: "{appName} में आपका स्वागत है",
374
401
  welcomeSubtitle: "साइन इन करने या अपना खाता बनाने के लिए जारी रखें",
402
+ emailLinkContinueTitle: "ईमेल लिंक के साथ जारी रखें",
403
+ emailLinkContinueMessage: "यह चरण पूरा करने के लिए जारी रखें चुनें।",
404
+ emailLinkContinueAction: "जारी रखें",
375
405
  email: "ईमेल",
376
406
  emailPlaceholder: "you@example.com",
377
407
  legalPrefix: "साइन अप करके, आप हमारी",
@@ -411,6 +441,9 @@ export const NATIVE_AUTH_COPY = {
411
441
  welcomeTitle: "مرحبًا",
412
442
  welcomeToApp: "مرحبًا بك في {appName}",
413
443
  welcomeSubtitle: "تابع لتسجيل الدخول أو إنشاء حسابك",
444
+ emailLinkContinueTitle: "المتابعة باستخدام رابط البريد الإلكتروني",
445
+ emailLinkContinueMessage: "اختر متابعة لإكمال هذه الخطوة.",
446
+ emailLinkContinueAction: "متابعة",
414
447
  email: "البريد الإلكتروني",
415
448
  emailPlaceholder: "you@example.com",
416
449
  legalPrefix: "بالتسجيل، فإنك توافق على",
@@ -1,5 +1,7 @@
1
+ export type AgentDesignSystemPurpose = "selected" | "reference";
1
2
  export interface AgentDesignSystemContextAvailable {
2
3
  status: "available";
4
+ purpose?: AgentDesignSystemPurpose;
3
5
  scope: "summary" | "full";
4
6
  id: string;
5
7
  title: string;
@@ -8,6 +10,7 @@ export interface AgentDesignSystemContextAvailable {
8
10
  }
9
11
  export interface AgentDesignSystemContextUnavailable {
10
12
  status: "unavailable";
13
+ purpose?: AgentDesignSystemPurpose;
11
14
  id: string;
12
15
  message: string;
13
16
  }
@@ -16,9 +19,11 @@ export interface AgentDesignSystemReader {
16
19
  run(args: {
17
20
  id: string;
18
21
  compact?: "true" | "false";
22
+ purpose?: AgentDesignSystemPurpose;
19
23
  }): unknown;
20
24
  }
21
25
  export declare function loadAgentDesignSystemContext(designSystemId: string | null | undefined, getDesignSystem: AgentDesignSystemReader, opts?: {
22
26
  full?: boolean;
27
+ purpose?: AgentDesignSystemPurpose;
23
28
  }): Promise<AgentDesignSystemContext | null>;
24
29
  export declare function formatAgentDesignSystemContext(context: AgentDesignSystemContext | null): string[];
@@ -1,5 +1,12 @@
1
1
  const UNAVAILABLE_MESSAGE = "The linked design system could not be read. Retry get-design-system before authoring; do not invent a replacement style.";
2
2
  const NOT_ACCESSIBLE_MESSAGE = "The linked design system no longer exists or is not shared with you. Do not retry get-design-system; ask the user which system to use or unlink it. Do not invent a replacement style.";
3
+ const REFERENCE_NOT_ACCESSIBLE_MESSAGE = "The linked design system no longer exists or is not shared with you. Do not retry it. The reference deck is still readable, so use its measured visual language as a fallback; if its samples are insufficient, ask the user which system to use or unlink it. Do not invent replacement tokens.";
4
+ function unavailableMessage(id, purpose) {
5
+ if (purpose === "reference") {
6
+ return `The linked design system ${JSON.stringify(id)} could not be read. Use the accessible reference samples' measured visual language as fallback; if those samples are insufficient, ask the user which system to use. Do not invent replacement tokens.`;
7
+ }
8
+ return UNAVAILABLE_MESSAGE;
9
+ }
3
10
  function isRecord(value) {
4
11
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5
12
  }
@@ -8,19 +15,27 @@ export async function loadAgentDesignSystemContext(designSystemId, getDesignSyst
8
15
  if (!id)
9
16
  return null;
10
17
  const full = Boolean(opts?.full);
18
+ const purpose = opts?.purpose ?? "selected";
11
19
  try {
12
- const value = await getDesignSystem.run({
20
+ const args = {
13
21
  id,
14
22
  compact: full ? "false" : "true",
15
- });
23
+ };
24
+ const value = await getDesignSystem.run(purpose === "reference" ? { ...args, purpose } : args);
16
25
  if (!isRecord(value) ||
17
26
  typeof value.title !== "string" ||
18
27
  typeof value.agentContext !== "string" ||
19
28
  !value.agentContext.trim()) {
20
- return { status: "unavailable", id, message: UNAVAILABLE_MESSAGE };
29
+ return {
30
+ status: "unavailable",
31
+ purpose,
32
+ id,
33
+ message: unavailableMessage(id, purpose),
34
+ };
21
35
  }
22
36
  return {
23
37
  status: "available",
38
+ purpose,
24
39
  scope: full ? "full" : "summary",
25
40
  id,
26
41
  title: value.title,
@@ -28,7 +43,9 @@ export async function loadAgentDesignSystemContext(designSystemId, getDesignSyst
28
43
  ...(full
29
44
  ? {}
30
45
  : {
31
- next: `Call get-design-system { id: "${id}" } once before the first slide or screen you author for the full tokens, assets, docs, and custom instructions; reuse it for every later write.`,
46
+ next: purpose === "reference"
47
+ ? `Call get-design-system { id: ${JSON.stringify(id)}, purpose: "reference" } once before the first slide or screen you author for the full tokens, assets, docs, and custom instructions; keep its guidance advisory to a separately selected target system.`
48
+ : `Call get-design-system { id: "${id}" } once before the first slide or screen you author for the full tokens, assets, docs, and custom instructions; reuse it for every later write.`,
32
49
  }),
33
50
  };
34
51
  }
@@ -36,28 +53,40 @@ export async function loadAgentDesignSystemContext(designSystemId, getDesignSyst
36
53
  const notFound = error?.statusCode === 404;
37
54
  return {
38
55
  status: "unavailable",
56
+ purpose,
39
57
  id,
40
- message: notFound ? NOT_ACCESSIBLE_MESSAGE : UNAVAILABLE_MESSAGE,
58
+ message: notFound
59
+ ? purpose === "reference"
60
+ ? REFERENCE_NOT_ACCESSIBLE_MESSAGE
61
+ : NOT_ACCESSIBLE_MESSAGE
62
+ : unavailableMessage(id, purpose),
41
63
  };
42
64
  }
43
65
  }
44
66
  export function formatAgentDesignSystemContext(context) {
45
67
  if (!context)
46
68
  return [];
69
+ const purpose = context.purpose ?? "selected";
47
70
  if (context.status === "unavailable") {
48
71
  return [
49
- "### Linked design system",
72
+ purpose === "reference"
73
+ ? "### Linked design system (reference default)"
74
+ : "### Linked design system",
50
75
  `designSystemId: ${context.id}`,
51
76
  "status: unavailable",
52
77
  context.message,
53
78
  ];
54
79
  }
55
80
  return [
56
- "### Linked design system (authoritative)",
81
+ purpose === "reference"
82
+ ? "### Linked design system (reference default)"
83
+ : "### Linked design system (authoritative)",
57
84
  `designSystemId: ${context.id}`,
58
85
  `designSystemTitle: ${context.title}`,
59
86
  `scope: ${context.scope}`,
60
- "Use this design system's tokens, assets, and instructions before authoring or restyling visual content.",
87
+ purpose === "reference"
88
+ ? "Use this design system's tokens, assets, and instructions only when no separate system is selected for the new deck; a selected target system takes precedence."
89
+ : "Use this design system's tokens, assets, and instructions before authoring or restyling visual content.",
61
90
  context.agentContext,
62
91
  ...(context.next ? [context.next] : []),
63
92
  ];
@@ -12,7 +12,7 @@ export { MAX_USER_REGEX_INPUT_LENGTH, MAX_USER_REGEX_LENGTH, analyzeRegexSource,
12
12
  export { isHumanReadableDocumentTitle, normalizeDocumentTitle, } from "./document-title.js";
13
13
  export { DEFAULT_REASONING_EFFORT, REASONING_EFFORTS, getReasoningEffortOptionsForModel, isReasoningEffort, reasoningEffortLabel, resolveReasoningEffortSelection, type ReasoningEffort, } from "./reasoning-effort.js";
14
14
  export { injectDocumentMarkup } from "./html-document.js";
15
- export { formatAgentDesignSystemContext, loadAgentDesignSystemContext, type AgentDesignSystemContext, type AgentDesignSystemContextAvailable, type AgentDesignSystemContextUnavailable, } from "./design-system-agent-context.js";
15
+ export { formatAgentDesignSystemContext, loadAgentDesignSystemContext, type AgentDesignSystemContext, type AgentDesignSystemContextAvailable, type AgentDesignSystemContextUnavailable, type AgentDesignSystemPurpose, } from "./design-system-agent-context.js";
16
16
  export { formatHtmlStyleSummary, summarizeHtmlStyles, type HtmlStyleFragment, type HtmlStyleSummary, type HtmlStyleValue, } from "./html-style-summary.js";
17
17
  export { withBuilderUtmTrackingParams } from "./builder-link-tracking.js";
18
18
  export { BETA_FORCE_QUERY_PARAM, BETA_FORCE_SESSION_STORAGE_KEY, BETA_LANE_REDIRECT_QUERY_PARAM, BETA_LANE_RETURN_STORAGE_KEY, BETA_LANE_RETURNED_STORAGE_KEY, BETA_REDIRECT_DURATION_MS, BETA_REDIRECT_STORAGE_KEY, BETA_REDIRECT_SIGN_OUT_STORAGE_KEY, BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildAutomaticBetaRedirectUrl, ENVIRONMENT_BETA_HOSTS, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "./environment-lanes.js";
@@ -13,6 +13,8 @@ declare const _default: import("../../action.js").ActionDefinition<{
13
13
  executionEngine?: string;
14
14
  executionCwd?: string;
15
15
  }, {
16
+ deleted?: undefined;
17
+ enabled?: undefined;
16
18
  created: boolean;
17
19
  name: string;
18
20
  scope: "organization" | "personal";
@@ -23,33 +25,31 @@ declare const _default: import("../../action.js").ActionDefinition<{
23
25
  reasoningEffort: "auto" | "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh";
24
26
  webhookPath: string;
25
27
  nextRun: string;
26
- deleted?: undefined;
27
- enabled?: undefined;
28
28
  executionHostId?: undefined;
29
29
  executionEngine?: undefined;
30
30
  executionCwd?: undefined;
31
31
  } | {
32
- created?: undefined;
33
32
  scope?: undefined;
33
+ enabled?: undefined;
34
+ nextRun?: undefined;
35
+ created?: undefined;
34
36
  triggerType?: undefined;
35
37
  event?: undefined;
36
38
  deleted: boolean;
37
39
  name: string;
38
- enabled?: undefined;
39
40
  schedule?: undefined;
40
41
  timezone?: undefined;
41
42
  reasoningEffort?: undefined;
42
43
  executionHostId?: undefined;
43
44
  executionEngine?: undefined;
44
45
  executionCwd?: undefined;
45
- nextRun?: undefined;
46
46
  webhookPath?: undefined;
47
47
  } | {
48
- created?: undefined;
49
48
  scope?: undefined;
49
+ deleted?: undefined;
50
+ created?: undefined;
50
51
  triggerType?: undefined;
51
52
  event?: undefined;
52
- deleted?: undefined;
53
53
  name: string;
54
54
  enabled: boolean;
55
55
  schedule: string;