@agent-native/core 0.225.2-nightly-20261106152255 → 0.226.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.
- package/dist/agent/actions/get-agentkit-capabilities.d.ts +12 -1
- package/dist/agent/actions/get-agentkit-capabilities.js +13 -5
- package/dist/agent/production-agent.js +14 -4
- package/dist/agentkit/capabilities.d.ts +4 -2
- package/dist/agentkit/capabilities.js +71 -18
- package/dist/app-config/experience-profiles.d.ts +4 -0
- package/dist/app-config/experience-profiles.js +7 -0
- package/dist/app-config/onboarding.d.ts +2 -0
- package/dist/app-config/onboarding.js +5 -0
- package/dist/app-config/schema.d.ts +5 -0
- package/dist/app-config/schema.js +2 -0
- package/dist/application-state/handlers.d.ts +2 -2
- package/dist/client/agent-chat.d.ts +3 -1
- package/dist/client/agent-chat.js +8 -0
- package/dist/client/agentkit-chat/transport.d.ts +2 -1
- package/dist/client/agentkit-chat/transport.js +2 -1
- package/dist/client/auth/builder-signup.d.ts +14 -0
- package/dist/client/auth/builder-signup.js +75 -0
- package/dist/client/chat/agentkit-agent-native.d.ts +4 -0
- package/dist/client/chat/agentkit-agent-native.js +25 -0
- package/dist/client/chat/composer-draft.d.ts +1 -7
- package/dist/client/chat/composer-draft.js +5 -1
- package/dist/client/chat/native-uploads.d.ts +11 -0
- package/dist/client/chat/native-uploads.js +97 -0
- package/dist/client/experience-profiles.d.ts +182 -0
- package/dist/client/experience-profiles.js +19 -0
- package/dist/client/uploads/index.d.ts +1 -1
- package/dist/client/uploads/index.js +1 -1
- package/dist/client/use-action.js +3 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/experience-profiles/index.d.ts +13 -0
- package/dist/experience-profiles/index.js +10 -0
- package/dist/experience-profiles/server.d.ts +38 -0
- package/dist/experience-profiles/server.js +76 -0
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/framework-package-versions.json +11 -11
- package/dist/localization/workspace-integration-messages.d.ts +11 -0
- package/dist/localization/workspace-integration-messages.js +132 -0
- package/dist/mcp/screen-memory-stdio.d.ts +3 -3
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
- package/dist/provider-api/actions/provider-api.d.ts +3 -3
- package/dist/provider-api/actions/provider-api.js +2 -0
- package/dist/provider-api/index.d.ts +7 -1
- package/dist/provider-api/index.js +42 -2
- package/dist/scripts/resources/read.d.ts +6 -1
- package/dist/scripts/resources/read.js +85 -8
- package/dist/secrets/routes.d.ts +2 -2
- package/dist/server/agent-chat/script-entries.js +27 -6
- package/dist/server/agent-chat-plugin.js +102 -33
- package/dist/server/agent-engine-api-key-route.d.ts +4 -4
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/auth.js +25 -1
- package/dist/server/better-auth-instance.d.ts +1 -0
- package/dist/server/builder-browser.d.ts +2 -0
- package/dist/server/builder-browser.js +8 -4
- package/dist/server/builder-signup-experiment.d.ts +67 -0
- package/dist/server/builder-signup-experiment.js +345 -0
- package/dist/server/core-routes-plugin.d.ts +2 -0
- package/dist/server/core-routes-plugin.js +77 -25
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/google-oauth.d.ts +2 -0
- package/dist/server/google-oauth.js +5 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/agent-chat-references.d.ts +2 -0
- package/dist/shared/agent-chat-references.js +8 -0
- package/dist/shared/auth-copy.d.ts +1 -0
- package/dist/shared/auth-copy.js +11 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/templates/builder-code-starter/server/lib/composer-reference-messages.ts.patch +44 -0
- package/dist/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +10 -1
- package/dist/templates/chat/app/components/ChatComposerContext.tsx +31 -0
- package/dist/templates/chat/app/components/chat/ChatRouteContent.tsx +3 -0
- package/dist/templates/chat/app/components/home/HomePage.tsx +4 -2
- package/dist/templates/chat/app/components/layout/AgentInspector.tsx +2 -0
- package/dist/templates/chat/app/i18n/ar-SA.ts +7 -0
- package/dist/templates/chat/app/i18n/de-DE.ts +8 -0
- package/dist/templates/chat/app/i18n/en-US.ts +8 -0
- package/dist/templates/chat/app/i18n/es-ES.ts +8 -0
- package/dist/templates/chat/app/i18n/fr-FR.ts +8 -0
- package/dist/templates/chat/app/i18n/hi-IN.ts +7 -0
- package/dist/templates/chat/app/i18n/ja-JP.ts +8 -0
- package/dist/templates/chat/app/i18n/ko-KR.ts +8 -0
- package/dist/templates/chat/app/i18n/pt-BR.ts +8 -0
- package/dist/templates/chat/app/i18n/zh-CN.ts +7 -0
- package/dist/templates/chat/app/i18n/zh-TW.ts +7 -0
- package/dist/templates/chat/server/lib/composer-reference-messages.ts +34 -0
- package/dist/templates/chat/server/lib/composer-references.ts +60 -0
- package/dist/templates/chat/server/plugins/agent-chat.ts +13 -0
- package/docs/content/components.mdx +7 -2
- package/package.json +9 -4
- package/src/templates/builder-code-starter/server/lib/composer-reference-messages.ts.patch +44 -0
- package/src/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +10 -1
- package/src/templates/chat/app/components/ChatComposerContext.tsx +31 -0
- package/src/templates/chat/app/components/chat/ChatRouteContent.tsx +3 -0
- package/src/templates/chat/app/components/home/HomePage.tsx +4 -2
- package/src/templates/chat/app/components/layout/AgentInspector.tsx +2 -0
- package/src/templates/chat/app/i18n/ar-SA.ts +7 -0
- package/src/templates/chat/app/i18n/de-DE.ts +8 -0
- package/src/templates/chat/app/i18n/en-US.ts +8 -0
- package/src/templates/chat/app/i18n/es-ES.ts +8 -0
- package/src/templates/chat/app/i18n/fr-FR.ts +8 -0
- package/src/templates/chat/app/i18n/hi-IN.ts +7 -0
- package/src/templates/chat/app/i18n/ja-JP.ts +8 -0
- package/src/templates/chat/app/i18n/ko-KR.ts +8 -0
- package/src/templates/chat/app/i18n/pt-BR.ts +8 -0
- package/src/templates/chat/app/i18n/zh-CN.ts +7 -0
- package/src/templates/chat/app/i18n/zh-TW.ts +7 -0
- package/src/templates/chat/server/lib/composer-reference-messages.ts +34 -0
- package/src/templates/chat/server/lib/composer-references.ts +60 -0
- package/src/templates/chat/server/plugins/agent-chat.ts +13 -0
package/dist/shared/auth-copy.js
CHANGED
|
@@ -26,6 +26,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
26
26
|
emailLinkContinueAction: "Continue",
|
|
27
27
|
email: "Email",
|
|
28
28
|
emailPlaceholder: "you@example.com",
|
|
29
|
+
builderSignupDisclosure: "Your Design signup also creates a Builder.io account. By continuing, you agree to Builder’s",
|
|
29
30
|
legalPrefix: "By signing up, you accept our",
|
|
30
31
|
legalTerms: "Terms",
|
|
31
32
|
legalConnector: "and",
|
|
@@ -68,6 +69,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
68
69
|
emailLinkContinueAction: "继续",
|
|
69
70
|
email: "电子邮箱",
|
|
70
71
|
emailPlaceholder: "you@example.com",
|
|
72
|
+
builderSignupDisclosure: "注册 Design 也会创建 Builder.io 帐户。继续即表示你同意 Builder 的",
|
|
71
73
|
legalPrefix: "注册即表示你接受我们的",
|
|
72
74
|
legalTerms: "条款",
|
|
73
75
|
legalConnector: "和",
|
|
@@ -110,6 +112,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
110
112
|
emailLinkContinueAction: "繼續",
|
|
111
113
|
email: "電子郵件",
|
|
112
114
|
emailPlaceholder: "you@example.com",
|
|
115
|
+
builderSignupDisclosure: "註冊 Design 也會建立 Builder.io 帳戶。繼續即表示你同意 Builder 的",
|
|
113
116
|
legalPrefix: "註冊即表示你接受我們的",
|
|
114
117
|
legalTerms: "條款",
|
|
115
118
|
legalConnector: "和",
|
|
@@ -152,6 +155,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
152
155
|
emailLinkContinueAction: "Continuar",
|
|
153
156
|
email: "Email",
|
|
154
157
|
emailPlaceholder: "you@example.com",
|
|
158
|
+
builderSignupDisclosure: "Al registrarte en Design también se crea una cuenta de Builder.io. Al continuar, aceptas los",
|
|
155
159
|
legalPrefix: "Al registrarte, aceptas nuestros",
|
|
156
160
|
legalTerms: "Términos",
|
|
157
161
|
legalConnector: "y",
|
|
@@ -194,6 +198,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
194
198
|
emailLinkContinueAction: "Continuer",
|
|
195
199
|
email: "E-mail",
|
|
196
200
|
emailPlaceholder: "you@example.com",
|
|
201
|
+
builderSignupDisclosure: "Votre inscription à Design crée aussi un compte Builder.io. En continuant, vous acceptez les",
|
|
197
202
|
legalPrefix: "En vous inscrivant, vous acceptez nos",
|
|
198
203
|
legalTerms: "Conditions",
|
|
199
204
|
legalConnector: "et",
|
|
@@ -236,6 +241,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
236
241
|
emailLinkContinueAction: "Weiter",
|
|
237
242
|
email: "E-Mail",
|
|
238
243
|
emailPlaceholder: "you@example.com",
|
|
244
|
+
builderSignupDisclosure: "Mit deiner Design-Registrierung wird auch ein Builder.io-Konto erstellt. Wenn du fortfährst, akzeptierst du Builders",
|
|
239
245
|
legalPrefix: "Mit der Registrierung akzeptierst du unsere",
|
|
240
246
|
legalTerms: "Bedingungen",
|
|
241
247
|
legalConnector: "und",
|
|
@@ -278,6 +284,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
278
284
|
emailLinkContinueAction: "続行",
|
|
279
285
|
email: "メール",
|
|
280
286
|
emailPlaceholder: "you@example.com",
|
|
287
|
+
builderSignupDisclosure: "Design に登録すると Builder.io アカウントも作成されます。続行すると Builder の以下に同意します:",
|
|
281
288
|
legalPrefix: "登録すると、以下に同意したものとみなされます:",
|
|
282
289
|
legalTerms: "利用規約",
|
|
283
290
|
legalConnector: "および",
|
|
@@ -320,6 +327,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
320
327
|
emailLinkContinueAction: "계속",
|
|
321
328
|
email: "이메일",
|
|
322
329
|
emailPlaceholder: "you@example.com",
|
|
330
|
+
builderSignupDisclosure: "Design에 가입하면 Builder.io 계정도 생성됩니다. 계속하면 Builder의 다음에 동의합니다:",
|
|
323
331
|
legalPrefix: "가입하면 다음에 동의하게 됩니다:",
|
|
324
332
|
legalTerms: "약관",
|
|
325
333
|
legalConnector: "및",
|
|
@@ -362,6 +370,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
362
370
|
emailLinkContinueAction: "Continuar",
|
|
363
371
|
email: "Email",
|
|
364
372
|
emailPlaceholder: "you@example.com",
|
|
373
|
+
builderSignupDisclosure: "Seu cadastro no Design também cria uma conta Builder.io. Ao continuar, você aceita os",
|
|
365
374
|
legalPrefix: "Ao se cadastrar, você aceita nossos",
|
|
366
375
|
legalTerms: "Termos",
|
|
367
376
|
legalConnector: "e",
|
|
@@ -404,6 +413,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
404
413
|
emailLinkContinueAction: "जारी रखें",
|
|
405
414
|
email: "ईमेल",
|
|
406
415
|
emailPlaceholder: "you@example.com",
|
|
416
|
+
builderSignupDisclosure: "Design पर साइन अप करने से Builder.io खाता भी बनता है। जारी रखकर, आप Builder की",
|
|
407
417
|
legalPrefix: "साइन अप करके, आप हमारी",
|
|
408
418
|
legalTerms: "शर्तें",
|
|
409
419
|
legalConnector: "और",
|
|
@@ -446,6 +456,7 @@ export const NATIVE_AUTH_COPY = {
|
|
|
446
456
|
emailLinkContinueAction: "متابعة",
|
|
447
457
|
email: "البريد الإلكتروني",
|
|
448
458
|
emailPlaceholder: "you@example.com",
|
|
459
|
+
builderSignupDisclosure: "يؤدي التسجيل في Design أيضًا إلى إنشاء حساب Builder.io. بالمتابعة، توافق على",
|
|
449
460
|
legalPrefix: "بالتسجيل، فإنك توافق على",
|
|
450
461
|
legalTerms: "الشروط",
|
|
451
462
|
legalConnector: "و",
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { parseAgentChatReferences } from "./agent-chat-references.js";
|
|
1
2
|
export { agentChat, type AgentChatMessage, type AgentChatCallOptions, type AgentChatResponse, } from "./agent-chat.js";
|
|
2
3
|
export { appendAgentChatContextToMessage, splitAgentChatContextFromMessage, stripAgentChatContextFromMessage, type AgentChatMessageParts, } from "./agent-chat-context.js";
|
|
3
4
|
export { AGENT_SELECTION_CONTEXT_KEY_PREFIX, AGENT_SELECTION_STATE_KEY, agentSelectionContextKey, formatAgentSelectionPreamble, isAgentSelectionContextKey, parseAgentSelectionContextKey, type AgentSelectionReference, type AgentSelectionState, type AgentSelectionStateItem, } from "./agent-selection.js";
|
package/dist/shared/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { parseAgentChatReferences } from "./agent-chat-references.js";
|
|
1
2
|
export { agentChat, } from "./agent-chat.js";
|
|
2
3
|
export { appendAgentChatContextToMessage, splitAgentChatContextFromMessage, stripAgentChatContextFromMessage, } from "./agent-chat-context.js";
|
|
3
4
|
export { AGENT_SELECTION_CONTEXT_KEY_PREFIX, AGENT_SELECTION_STATE_KEY, agentSelectionContextKey, formatAgentSelectionPreamble, isAgentSelectionContextKey, parseAgentSelectionContextKey, } from "./agent-selection.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- a/server/lib/composer-reference-messages.ts
|
|
2
|
+
+++ b/server/lib/composer-reference-messages.ts
|
|
3
|
+
@@ -1,5 +1 @@
|
|
4
|
+
-import {
|
|
5
|
+
- DEFAULT_LOCALE,
|
|
6
|
+
- LOCALIZATION_SETTING_KEY,
|
|
7
|
+
- normalizeLocalizationPreference,
|
|
8
|
+
-} from "@agent-native/core/localization";
|
|
9
|
+
+import { workspaceIntegrationMessagesForUser } from "@agent-native/core/localization/workspace-integration-messages";
|
|
10
|
+
@@ -7 +2,0 @@
|
|
11
|
+
-import { getUserSetting } from "@agent-native/core/settings";
|
|
12
|
+
@@ -9,14 +3,0 @@
|
|
13
|
+
-const catalogs = {
|
|
14
|
+
- "en-US": () => import("../../app/i18n/en-US.js"),
|
|
15
|
+
- "ar-SA": () => import("../../app/i18n/ar-SA.js"),
|
|
16
|
+
- "de-DE": () => import("../../app/i18n/de-DE.js"),
|
|
17
|
+
- "es-ES": () => import("../../app/i18n/es-ES.js"),
|
|
18
|
+
- "fr-FR": () => import("../../app/i18n/fr-FR.js"),
|
|
19
|
+
- "hi-IN": () => import("../../app/i18n/hi-IN.js"),
|
|
20
|
+
- "ja-JP": () => import("../../app/i18n/ja-JP.js"),
|
|
21
|
+
- "ko-KR": () => import("../../app/i18n/ko-KR.js"),
|
|
22
|
+
- "pt-BR": () => import("../../app/i18n/pt-BR.js"),
|
|
23
|
+
- "zh-CN": () => import("../../app/i18n/zh-CN.js"),
|
|
24
|
+
- "zh-TW": () => import("../../app/i18n/zh-TW.js"),
|
|
25
|
+
-};
|
|
26
|
+
-
|
|
27
|
+
@@ -24,3 +5,2 @@
|
|
28
|
+
- const email = getRequestUserEmail();
|
|
29
|
+
- const preference = normalizeLocalizationPreference(
|
|
30
|
+
- email ? await getUserSetting(email, LOCALIZATION_SETTING_KEY) : undefined,
|
|
31
|
+
+ const messages = await workspaceIntegrationMessagesForUser(
|
|
32
|
+
+ getRequestUserEmail() ?? "",
|
|
33
|
+
@@ -28,6 +8,5 @@
|
|
34
|
+
- const locale = preference.locale;
|
|
35
|
+
- const load =
|
|
36
|
+
- locale && locale in catalogs
|
|
37
|
+
- ? catalogs[locale as keyof typeof catalogs]
|
|
38
|
+
- : catalogs[DEFAULT_LOCALE];
|
|
39
|
+
- return (await load()).default.composerSources;
|
|
40
|
+
+ return {
|
|
41
|
+
+ authentication: messages.composerReferenceAuthentication,
|
|
42
|
+
+ invalid: messages.composerReferenceInvalid,
|
|
43
|
+
+ unavailable: messages.composerReferenceUnavailable,
|
|
44
|
+
+ };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
===================================================================
|
|
2
2
|
--- a/server/plugins/agent-chat.ts
|
|
3
3
|
+++ b/server/plugins/agent-chat.ts
|
|
4
|
-
@@ -4,
|
|
4
|
+
@@ -4,21 +4,14 @@
|
|
5
5
|
loadActionsFromStaticRegistry,
|
|
6
6
|
} from "@agent-native/core/server";
|
|
7
7
|
|
|
8
8
|
import actionsRegistry from "../../.generated/actions-registry.js";
|
|
9
9
|
+import { appOperationFinalResponseGuard } from "../agent/app-operation-guard.js";
|
|
10
|
+
import {
|
|
11
|
+
searchConversationReferences,
|
|
12
|
+
validateConversationReferences,
|
|
13
|
+
} from "../lib/composer-references.js";
|
|
10
14
|
|
|
11
15
|
-const INITIAL_TOOL_NAMES = [
|
|
12
16
|
- "view-screen",
|
|
@@ -18,6 +22,11 @@
|
|
|
18
22
|
-
|
|
19
23
|
export default createAgentChatPlugin({
|
|
20
24
|
appId: "chat",
|
|
25
|
+
mentionProviders: {
|
|
26
|
+
chats: {
|
|
27
|
+
@@ -30,12 +23,15 @@
|
|
28
|
+
await validateConversationReferences(references);
|
|
29
|
+
},
|
|
21
30
|
actions: loadActionsFromStaticRegistry(actionsRegistry),
|
|
22
31
|
mcp: { connectorCatalog: [], appApprovalPage: true },
|
|
23
32
|
- initialToolNames: INITIAL_TOOL_NAMES,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
2
|
+
import type { AssistantChatComposerContextProviderProps } from "@agent-native/toolkit/app/chat/chat";
|
|
3
|
+
import type { ComposerContextMenuItem } from "@agent-native/toolkit/composer";
|
|
4
|
+
import { IconMessages } from "@tabler/icons-react";
|
|
5
|
+
|
|
6
|
+
export function useChatComposerMenuItems(): ComposerContextMenuItem[] {
|
|
7
|
+
const t = useT();
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
id: "reference-chat",
|
|
11
|
+
label: t("composerSources.reference"),
|
|
12
|
+
icon: <IconMessages />,
|
|
13
|
+
section: "context",
|
|
14
|
+
order: 20,
|
|
15
|
+
referenceType: "chat",
|
|
16
|
+
referencePicker: { source: "chats", referenceType: "chat" },
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function ChatComposerContextProvider({
|
|
22
|
+
children,
|
|
23
|
+
}: AssistantChatComposerContextProviderProps) {
|
|
24
|
+
return children({
|
|
25
|
+
menuItems: useChatComposerMenuItems(),
|
|
26
|
+
contextItems: [],
|
|
27
|
+
onRemoveContextItem: () => {},
|
|
28
|
+
prepareSubmission: async (snapshot) => snapshot,
|
|
29
|
+
submissionAccepted: () => {},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
import { useLocation, useNavigate, useParams } from "react-router";
|
|
82
82
|
import { toast } from "sonner";
|
|
83
83
|
|
|
84
|
+
import { useChatComposerMenuItems } from "@/components/ChatComposerContext";
|
|
84
85
|
import { Button } from "@/components/ui/button";
|
|
85
86
|
import {
|
|
86
87
|
Tooltip,
|
|
@@ -1390,6 +1391,7 @@ function ChatCanvas({
|
|
|
1390
1391
|
),
|
|
1391
1392
|
[setWorkspaceOpen, t, workspaceOpen],
|
|
1392
1393
|
);
|
|
1394
|
+
const contextMenuItems = useChatComposerMenuItems();
|
|
1393
1395
|
const chatTitle = thread.thread?.title?.trim() || APP_TITLE;
|
|
1394
1396
|
|
|
1395
1397
|
return (
|
|
@@ -1406,6 +1408,7 @@ function ChatCanvas({
|
|
|
1406
1408
|
expectExistingThread={!isDraftThread}
|
|
1407
1409
|
onStartNewChat={() => void navigate(NEW_CHAT_PATH)}
|
|
1408
1410
|
composerProps={{
|
|
1411
|
+
contextMenuItems,
|
|
1409
1412
|
requireAgentEngine: true,
|
|
1410
1413
|
contextUsageSlot: <ChatContextRing threadId={threadId} />,
|
|
1411
1414
|
...(initialText === undefined ? {} : { initialText }),
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import { useState, type ReactNode } from "react";
|
|
21
21
|
import { useNavigate } from "react-router";
|
|
22
22
|
|
|
23
|
+
import { useChatComposerMenuItems } from "@/components/ChatComposerContext";
|
|
23
24
|
import { Button } from "@/components/ui/button";
|
|
24
25
|
import {
|
|
25
26
|
Item,
|
|
@@ -120,14 +121,15 @@ function HomeAgentComposerInput({
|
|
|
120
121
|
}) {
|
|
121
122
|
const t = useT();
|
|
122
123
|
const control = useAgentKitControl(threadId);
|
|
124
|
+
const contextMenuItems = useChatComposerMenuItems();
|
|
123
125
|
|
|
124
126
|
return (
|
|
125
127
|
<AgentKitComposer
|
|
126
128
|
threadId={threadId}
|
|
127
129
|
requireAgentEngine
|
|
128
130
|
placeholder={t("chat.composerPlaceholder")}
|
|
129
|
-
plusMenuMode="
|
|
130
|
-
|
|
131
|
+
plusMenuMode="full"
|
|
132
|
+
contextMenuItems={contextMenuItems}
|
|
131
133
|
voiceEnabled
|
|
132
134
|
onVoiceChatStart={onVoiceChatStart}
|
|
133
135
|
onSubmit={async (text, files, references, options) => {
|
|
@@ -5,6 +5,7 @@ import { AgentSidebar } from "@agent-native/toolkit/app/chat";
|
|
|
5
5
|
import { type ReactNode } from "react";
|
|
6
6
|
import { useNavigate } from "react-router";
|
|
7
7
|
|
|
8
|
+
import { ChatComposerContextProvider } from "@/components/ChatComposerContext";
|
|
8
9
|
import { chatThreadPath } from "@/lib/chat-paths";
|
|
9
10
|
import { TAB_ID } from "@/lib/tab-id";
|
|
10
11
|
|
|
@@ -30,6 +31,7 @@ export function AgentInspector({
|
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
33
|
<AgentSidebar
|
|
34
|
+
composerContextProvider={ChatComposerContextProvider}
|
|
33
35
|
position="right"
|
|
34
36
|
chatViewTransition
|
|
35
37
|
chatViewTransitionHandoff={chatHomeHandoffPending}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "الإشارة إلى محادثة…",
|
|
4
|
+
group: "المحادثات",
|
|
5
|
+
authentication: "سجّل الدخول لإضافة مرجع.",
|
|
6
|
+
invalid: "اختر مرجعًا صالحًا قبل الإرسال.",
|
|
7
|
+
unavailable: "لم يعد المرجع المحدد متاحًا. أزله أو اختره مرة أخرى.",
|
|
8
|
+
},
|
|
2
9
|
composer: {
|
|
3
10
|
removeAttachment: "إزالة {{name}}",
|
|
4
11
|
removeReference: "إزالة مرجع {{name}}",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "Unterhaltung referenzieren…",
|
|
4
|
+
group: "Unterhaltungen",
|
|
5
|
+
authentication: "Melde dich an, um eine Referenz hinzuzufügen.",
|
|
6
|
+
invalid: "Wähle vor dem Senden eine gültige Referenz.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"Eine ausgewählte Referenz ist nicht mehr verfügbar. Entferne sie oder wähle sie erneut.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "{{name}} entfernen",
|
|
4
12
|
removeReference: "Referenz {{name}} entfernen",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "Reference a conversation…",
|
|
4
|
+
group: "Conversations",
|
|
5
|
+
authentication: "Sign in to add a reference.",
|
|
6
|
+
invalid: "Choose a valid reference before sending.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"A selected reference is no longer available. Remove it or choose it again.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "Remove {{name}}",
|
|
4
12
|
removeReference: "Remove {{name}} reference",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "Referenciar una conversación…",
|
|
4
|
+
group: "Conversaciones",
|
|
5
|
+
authentication: "Inicia sesión para añadir una referencia.",
|
|
6
|
+
invalid: "Elige una referencia válida antes de enviar.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"Una referencia seleccionada ya no está disponible. Elimínala o selecciónala de nuevo.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "Quitar {{name}}",
|
|
4
12
|
removeReference: "Eliminar la referencia {{name}}",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "Référencer une conversation…",
|
|
4
|
+
group: "Conversations",
|
|
5
|
+
authentication: "Connectez-vous pour ajouter une référence.",
|
|
6
|
+
invalid: "Choisissez une référence valide avant l’envoi.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"Une référence sélectionnée n’est plus disponible. Supprimez-la ou sélectionnez-la à nouveau.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "Supprimer {{name}}",
|
|
4
12
|
removeReference: "Supprimer la référence {{name}}",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "बातचीत का संदर्भ दें…",
|
|
4
|
+
group: "बातचीत",
|
|
5
|
+
authentication: "संदर्भ जोड़ने के लिए साइन इन करें।",
|
|
6
|
+
invalid: "भेजने से पहले एक मान्य संदर्भ चुनें।",
|
|
7
|
+
unavailable: "चुना गया संदर्भ अब उपलब्ध नहीं है। उसे हटाएँ या फिर से चुनें।",
|
|
8
|
+
},
|
|
2
9
|
composer: {
|
|
3
10
|
removeAttachment: "{{name}} हटाएँ",
|
|
4
11
|
removeReference: "{{name}} संदर्भ हटाएँ",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "会話を参照…",
|
|
4
|
+
group: "会話",
|
|
5
|
+
authentication: "参照を追加するにはログインしてください。",
|
|
6
|
+
invalid: "送信する前に有効な参照を選択してください。",
|
|
7
|
+
unavailable:
|
|
8
|
+
"選択した参照は利用できなくなりました。削除するか、もう一度選択してください。",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "{{name}} を削除",
|
|
4
12
|
removeReference: "{{name}} の参照を削除",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "대화 참조…",
|
|
4
|
+
group: "대화",
|
|
5
|
+
authentication: "참조를 추가하려면 로그인하세요.",
|
|
6
|
+
invalid: "전송하기 전에 유효한 참조를 선택하세요.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"선택한 참조를 더 이상 사용할 수 없습니다. 제거하거나 다시 선택하세요.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "{{name}} 제거",
|
|
4
12
|
removeReference: "{{name}} 참조 제거",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "Referenciar uma conversa…",
|
|
4
|
+
group: "Conversas",
|
|
5
|
+
authentication: "Entre para adicionar uma referência.",
|
|
6
|
+
invalid: "Escolha uma referência válida antes de enviar.",
|
|
7
|
+
unavailable:
|
|
8
|
+
"Uma referência selecionada não está mais disponível. Remova-a ou selecione-a novamente.",
|
|
9
|
+
},
|
|
2
10
|
composer: {
|
|
3
11
|
removeAttachment: "Remover {{name}}",
|
|
4
12
|
removeReference: "Remover referência {{name}}",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "引用对话…",
|
|
4
|
+
group: "对话",
|
|
5
|
+
authentication: "登录以添加引用。",
|
|
6
|
+
invalid: "发送前请选择有效的引用。",
|
|
7
|
+
unavailable: "所选引用已不可用。请移除或重新选择。",
|
|
8
|
+
},
|
|
2
9
|
composer: {
|
|
3
10
|
removeAttachment: "移除 {{name}}",
|
|
4
11
|
removeReference: "移除 {{name}} 引用",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const messages = {
|
|
2
|
+
composerSources: {
|
|
3
|
+
reference: "引用對話…",
|
|
4
|
+
group: "對話",
|
|
5
|
+
authentication: "登入以新增引用。",
|
|
6
|
+
invalid: "傳送前請選擇有效的引用。",
|
|
7
|
+
unavailable: "所選引用已無法使用。請移除或重新選擇。",
|
|
8
|
+
},
|
|
2
9
|
composer: {
|
|
3
10
|
removeAttachment: "移除 {{name}}",
|
|
4
11
|
removeReference: "移除 {{name}} 參照",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_LOCALE,
|
|
3
|
+
LOCALIZATION_SETTING_KEY,
|
|
4
|
+
normalizeLocalizationPreference,
|
|
5
|
+
} from "@agent-native/core/localization";
|
|
6
|
+
import { getRequestUserEmail } from "@agent-native/core/server/request-context";
|
|
7
|
+
import { getUserSetting } from "@agent-native/core/settings";
|
|
8
|
+
|
|
9
|
+
const catalogs = {
|
|
10
|
+
"en-US": () => import("../../app/i18n/en-US.js"),
|
|
11
|
+
"ar-SA": () => import("../../app/i18n/ar-SA.js"),
|
|
12
|
+
"de-DE": () => import("../../app/i18n/de-DE.js"),
|
|
13
|
+
"es-ES": () => import("../../app/i18n/es-ES.js"),
|
|
14
|
+
"fr-FR": () => import("../../app/i18n/fr-FR.js"),
|
|
15
|
+
"hi-IN": () => import("../../app/i18n/hi-IN.js"),
|
|
16
|
+
"ja-JP": () => import("../../app/i18n/ja-JP.js"),
|
|
17
|
+
"ko-KR": () => import("../../app/i18n/ko-KR.js"),
|
|
18
|
+
"pt-BR": () => import("../../app/i18n/pt-BR.js"),
|
|
19
|
+
"zh-CN": () => import("../../app/i18n/zh-CN.js"),
|
|
20
|
+
"zh-TW": () => import("../../app/i18n/zh-TW.js"),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export async function composerReferenceMessages() {
|
|
24
|
+
const email = getRequestUserEmail();
|
|
25
|
+
const preference = normalizeLocalizationPreference(
|
|
26
|
+
email ? await getUserSetting(email, LOCALIZATION_SETTING_KEY) : undefined,
|
|
27
|
+
);
|
|
28
|
+
const locale = preference.locale;
|
|
29
|
+
const load =
|
|
30
|
+
locale && locale in catalogs
|
|
31
|
+
? catalogs[locale as keyof typeof catalogs]
|
|
32
|
+
: catalogs[DEFAULT_LOCALE];
|
|
33
|
+
return (await load()).default.composerSources;
|
|
34
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getOrgContext } from "@agent-native/core/org";
|
|
2
|
+
import {
|
|
3
|
+
listThreads,
|
|
4
|
+
searchThreads,
|
|
5
|
+
type AgentChatReference,
|
|
6
|
+
} from "@agent-native/core/server";
|
|
7
|
+
import { assertAccess, ForbiddenError } from "@agent-native/core/sharing";
|
|
8
|
+
import { createError, type H3Event } from "h3";
|
|
9
|
+
|
|
10
|
+
import { composerReferenceMessages } from "./composer-reference-messages.js";
|
|
11
|
+
|
|
12
|
+
export async function searchConversationReferences(
|
|
13
|
+
query: string,
|
|
14
|
+
event?: H3Event,
|
|
15
|
+
) {
|
|
16
|
+
if (!event)
|
|
17
|
+
throw createError({
|
|
18
|
+
statusCode: 401,
|
|
19
|
+
statusMessage: (await composerReferenceMessages()).authentication,
|
|
20
|
+
});
|
|
21
|
+
const { email, orgId } = await getOrgContext(event);
|
|
22
|
+
const options = { orgId, includeExternal: false, sourceAppId: "chat" };
|
|
23
|
+
const search = query.trim().slice(0, 200);
|
|
24
|
+
const rows = search
|
|
25
|
+
? await searchThreads(email, search, 20, options)
|
|
26
|
+
: await listThreads(email, { ...options, limit: 20 });
|
|
27
|
+
return rows.map((row) => ({
|
|
28
|
+
id: `chat:${row.id}`,
|
|
29
|
+
label: row.title || row.id,
|
|
30
|
+
description: row.preview.slice(0, 500),
|
|
31
|
+
refType: "chat",
|
|
32
|
+
refId: row.id,
|
|
33
|
+
refPath: `/chat/${encodeURIComponent(row.id)}`,
|
|
34
|
+
icon: "message",
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function validateConversationReferences(
|
|
39
|
+
references: readonly AgentChatReference[],
|
|
40
|
+
) {
|
|
41
|
+
for (const reference of references) {
|
|
42
|
+
if (reference.type !== "mention" || reference.refType !== "chat") continue;
|
|
43
|
+
if (!reference.refId)
|
|
44
|
+
throw createError({
|
|
45
|
+
statusCode: 400,
|
|
46
|
+
statusMessage: (await composerReferenceMessages()).invalid,
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
await assertAccess("chat_thread", reference.refId, "viewer", undefined, {
|
|
50
|
+
skipResourceBody: true,
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (error instanceof ForbiddenError)
|
|
54
|
+
throw new ForbiddenError(
|
|
55
|
+
(await composerReferenceMessages()).unavailable,
|
|
56
|
+
);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
} from "@agent-native/core/server";
|
|
6
6
|
|
|
7
7
|
import actionsRegistry from "../../.generated/actions-registry.js";
|
|
8
|
+
import {
|
|
9
|
+
searchConversationReferences,
|
|
10
|
+
validateConversationReferences,
|
|
11
|
+
} from "../lib/composer-references.js";
|
|
8
12
|
|
|
9
13
|
const INITIAL_TOOL_NAMES = [
|
|
10
14
|
"view-screen",
|
|
@@ -16,6 +20,15 @@ const INITIAL_TOOL_NAMES = [
|
|
|
16
20
|
|
|
17
21
|
export default createAgentChatPlugin({
|
|
18
22
|
appId: "chat",
|
|
23
|
+
mentionProviders: {
|
|
24
|
+
chats: {
|
|
25
|
+
label: "composerSources.group",
|
|
26
|
+
search: searchConversationReferences,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
prepareRequest: async ({ references }) => {
|
|
30
|
+
await validateConversationReferences(references);
|
|
31
|
+
},
|
|
19
32
|
actions: loadActionsFromStaticRegistry(actionsRegistry),
|
|
20
33
|
mcp: { connectorCatalog: [], appApprovalPage: true },
|
|
21
34
|
initialToolNames: INITIAL_TOOL_NAMES,
|
|
@@ -326,7 +326,11 @@ A host can stage already-authorized context and receive the frozen snapshot on s
|
|
|
326
326
|
/>
|
|
327
327
|
```
|
|
328
328
|
|
|
329
|
-
Context sources register
|
|
329
|
+
Context sources register direct, named actions on `ComposerContextMenuItem`. The shared menu labels Add context, Integrations, and Commands as separate accessible groups. Sources open a picker dialog after one menu choice. Workspace integrations appear in their own group. Commands contains rare task modes. Root rows stay stable while source data loads inside dialogs. Native menu arrows, typeahead, and Escape remain available. Dialogs manage search, grouped results, loading, empty and error states, retry, and focus restoration.
|
|
330
|
+
|
|
331
|
+
Contributions use `section: "context" | "integrations" | "commands"` and ascending `order`, with label and id breaking ties. `renderLink(children)` preserves native link navigation. Apps with a scoped mention provider can register `referencePicker: { source, referenceType }`. Selection inserts a normal composer reference. `referenceType` excludes app-owned resource types from the shared Search workspace… dialog, avoiding duplicate choices. Workspace registrations come through `resources.useWorkspaceMenu({ enabled, onSelectIntegration })`. Its `scopeKey` resets and aborts workspace pickers when identity changes. Provider failures remain errors, not empty results.
|
|
332
|
+
|
|
333
|
+
A source such as Figma stays visible while access is checked. Its dialog shows loading or an error with retry, a real connection link when disconnected, or the authorized URL picker when connected. Create Skill selects the skill mode directly. Upload skill file opens a review and save dialog after the native file chooser.
|
|
330
334
|
|
|
331
335
|
The picker configuration accepts:
|
|
332
336
|
|
|
@@ -349,6 +353,7 @@ const contextMenuItems: ComposerContextMenuItem[] = [
|
|
|
349
353
|
label: labels.references,
|
|
350
354
|
picker: {
|
|
351
355
|
searchPlaceholder: labels.searchReferences,
|
|
356
|
+
presentation: { type: "dialog", mode: "single" },
|
|
352
357
|
items: authorizedReferences,
|
|
353
358
|
selectedIds,
|
|
354
359
|
onSelect: stageReference,
|
|
@@ -422,7 +427,7 @@ Picker entries do not also define `render` or entry-level `onSelect`. Categories
|
|
|
422
427
|
|
|
423
428
|
Optional `footerAction` stays below the results even during loading, errors, or an empty list. It accepts a localized `label`, optional `icon` and `disabled`, and either `onSelect()` or `renderLink(children)`. Use a callback for a modal or another stateful workflow: `false` keeps the menu open, `true` or `void` closes it, and rejection displays an error with retry. For pure navigation, return a real React Router `Link` or native anchor from `renderLink`; the shared menu supplies the row through `asChild`, preserving its `href` and browser navigation semantics. Wire existing authorized workflows, not placeholder actions.
|
|
424
429
|
|
|
425
|
-
Passing `addAttachment` to `ComposerContextMenu` adds
|
|
430
|
+
Passing `addAttachment` to `ComposerContextMenu` adds Files and images to Add context and preserves the host's file callback.
|
|
426
431
|
|
|
427
432
|
`PromptComposer` and `AgentKitComposer` accept `attachmentAdapter`, using the public `AttachmentAdapter` type from `@assistant-ui/react`. Supply the host's file-acceptance, size-validation, and staging policy through this adapter; omit it to retain the default adapters. The shared composer still owns the upload control, file picker, context picker, and attachment chips. Do not replace those controls to customize file staging.
|
|
428
433
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.226.0",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -172,6 +172,7 @@
|
|
|
172
172
|
"./client/agent-chat": "./dist/client/agent-chat/index.js",
|
|
173
173
|
"./client/agent-engine-readiness": "./dist/client/agent-engine-readiness.js",
|
|
174
174
|
"./client/agent-sidebar-state": "./dist/client/agent-sidebar-state.js",
|
|
175
|
+
"./client/auth/builder-signup": "./dist/client/auth/builder-signup.js",
|
|
175
176
|
"./client/auth/auth-page-helpers": "./dist/client/auth/auth-page-helpers.js",
|
|
176
177
|
"./client/assistant-chat-history-version": "./dist/client/chat/assistant-chat-history-version.js",
|
|
177
178
|
"./client/agentkit-chat/integrity": "./dist/client/agentkit-chat/integrity.js",
|
|
@@ -264,6 +265,9 @@
|
|
|
264
265
|
"default": "./dist/guards/index.js"
|
|
265
266
|
},
|
|
266
267
|
"./application-state": "./dist/application-state/index.js",
|
|
268
|
+
"./client/experience-profiles": "./dist/client/experience-profiles.js",
|
|
269
|
+
"./experience-profiles": "./dist/experience-profiles/index.js",
|
|
270
|
+
"./experience-profiles/server": "./dist/experience-profiles/server.js",
|
|
267
271
|
"./settings": "./dist/settings/index.js",
|
|
268
272
|
"./user-profile": "./dist/user-profile/index.js",
|
|
269
273
|
"./user-profile/server": "./dist/user-profile/store.js",
|
|
@@ -621,6 +625,7 @@
|
|
|
621
625
|
"./integrations/channel-settings": "./dist/integrations/channel-settings.js",
|
|
622
626
|
"./jobs/actions/get-scheduled-trigger-status": "./dist/jobs/actions/get-scheduled-trigger-status.js",
|
|
623
627
|
"./labs/core-labs": "./dist/labs/core-labs.js",
|
|
628
|
+
"./localization/workspace-integration-messages": "./dist/localization/workspace-integration-messages.js",
|
|
624
629
|
"./localization/mcp-settings-messages": "./dist/localization/mcp-settings-messages.js",
|
|
625
630
|
"./localization/shared": "./dist/localization/shared.js",
|
|
626
631
|
"./navigation/settings-redirects": "./dist/navigation/settings-redirects.js",
|
|
@@ -760,8 +765,8 @@
|
|
|
760
765
|
"yaml": "^2.9.0",
|
|
761
766
|
"yjs": "^13.6.33",
|
|
762
767
|
"zod": "^4.3.6",
|
|
763
|
-
"@agent-native/agentkit": "^0.
|
|
764
|
-
"@agent-native/recap-cli": "^0.5.
|
|
768
|
+
"@agent-native/agentkit": "^0.226.0",
|
|
769
|
+
"@agent-native/recap-cli": "^0.5.99"
|
|
765
770
|
},
|
|
766
771
|
"devDependencies": {
|
|
767
772
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -833,7 +838,7 @@
|
|
|
833
838
|
"xlsx": "^0.18.5"
|
|
834
839
|
},
|
|
835
840
|
"peerDependencies": {
|
|
836
|
-
"@agent-native/core-corpus": "0.
|
|
841
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
837
842
|
"@ai-sdk/anthropic": ">=3",
|
|
838
843
|
"@ai-sdk/cohere": ">=3",
|
|
839
844
|
"@ai-sdk/google": ">=3",
|