@agent-native/core 0.7.19 → 0.7.20
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/README.md +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +45 -2
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/loop-settings.d.ts +37 -0
- package/dist/agent/loop-settings.d.ts.map +1 -0
- package/dist/agent/loop-settings.js +127 -0
- package/dist/agent/loop-settings.js.map +1 -0
- package/dist/agent/production-agent.d.ts +8 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +268 -29
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +76 -3
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +1 -1
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +65 -2
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +3 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +52 -10
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/tool-search.d.ts +37 -0
- package/dist/agent/tool-search.d.ts.map +1 -0
- package/dist/agent/tool-search.js +201 -0
- package/dist/agent/tool-search.js.map +1 -0
- package/dist/agent/types.d.ts +8 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +44 -9
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/workspacify.d.ts +2 -0
- package/dist/cli/workspacify.d.ts.map +1 -1
- package/dist/cli/workspacify.js +34 -1
- package/dist/cli/workspacify.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +277 -18
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ConnectBuilderCard.d.ts.map +1 -1
- package/dist/client/ConnectBuilderCard.js +1 -1
- package/dist/client/ConnectBuilderCard.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +14 -6
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/NewWorkspaceAppFlow.d.ts +14 -0
- package/dist/client/NewWorkspaceAppFlow.d.ts.map +1 -0
- package/dist/client/NewWorkspaceAppFlow.js +200 -0
- package/dist/client/NewWorkspaceAppFlow.js.map +1 -0
- package/dist/client/PoweredByBadge.d.ts +10 -1
- package/dist/client/PoweredByBadge.d.ts.map +1 -1
- package/dist/client/PoweredByBadge.js +120 -8
- package/dist/client/PoweredByBadge.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +3 -5
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +26 -19
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +15 -3
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/analytics.d.ts +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +141 -1
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/builder-frame.d.ts +10 -0
- package/dist/client/builder-frame.d.ts.map +1 -0
- package/dist/client/builder-frame.js +94 -0
- package/dist/client/builder-frame.js.map +1 -0
- package/dist/client/composer/MentionPopover.d.ts.map +1 -1
- package/dist/client/composer/MentionPopover.js +5 -1
- package/dist/client/composer/MentionPopover.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +11 -6
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/error-format.d.ts +20 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +53 -5
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.js +88 -6
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +145 -9
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +13 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +50 -9
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +3 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +88 -7
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/tools/ToolsListPage.d.ts.map +1 -1
- package/dist/client/tools/ToolsListPage.js +16 -1
- package/dist/client/tools/ToolsListPage.js.map +1 -1
- package/dist/client/tools/ToolsSidebarSection.d.ts.map +1 -1
- package/dist/client/tools/ToolsSidebarSection.js +63 -8
- package/dist/client/tools/ToolsSidebarSection.js.map +1 -1
- package/dist/client/tools/tool-order.d.ts +7 -0
- package/dist/client/tools/tool-order.d.ts.map +1 -0
- package/dist/client/tools/tool-order.js +47 -0
- package/dist/client/tools/tool-order.js.map +1 -0
- package/dist/client/transcription/BuilderTranscriptionCta.d.ts.map +1 -1
- package/dist/client/transcription/BuilderTranscriptionCta.js +71 -6
- package/dist/client/transcription/BuilderTranscriptionCta.js.map +1 -1
- package/dist/client/use-send-to-agent-chat.d.ts.map +1 -1
- package/dist/client/use-send-to-agent-chat.js +11 -3
- package/dist/client/use-send-to-agent-chat.js.map +1 -1
- package/dist/client/useProductionAgent.d.ts.map +1 -1
- package/dist/client/useProductionAgent.js +1 -1
- package/dist/client/useProductionAgent.js.map +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +5 -1
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts +1 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +4 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/oauth-tokens/index.d.ts +1 -1
- package/dist/oauth-tokens/index.d.ts.map +1 -1
- package/dist/oauth-tokens/index.js +1 -1
- package/dist/oauth-tokens/index.js.map +1 -1
- package/dist/oauth-tokens/store.d.ts.map +1 -1
- package/dist/oauth-tokens/store.js +6 -0
- package/dist/oauth-tokens/store.js.map +1 -1
- package/dist/observability/store.d.ts.map +1 -1
- package/dist/observability/store.js +19 -19
- package/dist/observability/store.js.map +1 -1
- package/dist/onboarding/default-steps.d.ts.map +1 -1
- package/dist/onboarding/default-steps.js +95 -61
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/onboarding/plugin.d.ts.map +1 -1
- package/dist/onboarding/plugin.js +17 -8
- package/dist/onboarding/plugin.js.map +1 -1
- package/dist/org/migrations.js +2 -2
- package/dist/org/migrations.js.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +2 -3
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/scripts/db/exec.d.ts +2 -1
- package/dist/scripts/db/exec.d.ts.map +1 -1
- package/dist/scripts/db/exec.js +264 -61
- package/dist/scripts/db/exec.js.map +1 -1
- package/dist/scripts/db/schema.d.ts.map +1 -1
- package/dist/scripts/db/schema.js +16 -4
- package/dist/scripts/db/schema.js.map +1 -1
- package/dist/scripts/dev/index.d.ts.map +1 -1
- package/dist/scripts/dev/index.js +36 -11
- package/dist/scripts/dev/index.js.map +1 -1
- package/dist/scripts/manage-agent-loop-settings.d.ts +7 -0
- package/dist/scripts/manage-agent-loop-settings.d.ts.map +1 -0
- package/dist/scripts/manage-agent-loop-settings.js +63 -0
- package/dist/scripts/manage-agent-loop-settings.js.map +1 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +11 -0
- package/dist/scripts/runner.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +60 -18
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/app-url.d.ts +5 -4
- package/dist/server/app-url.d.ts.map +1 -1
- package/dist/server/app-url.js +8 -4
- package/dist/server/app-url.js.map +1 -1
- package/dist/server/auth.d.ts +8 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +82 -29
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +16 -5
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts +12 -0
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +36 -4
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +350 -53
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +21 -3
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +51 -21
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/google-oauth.d.ts +3 -0
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +27 -3
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/schema-prompt.d.ts.map +1 -1
- package/dist/server/schema-prompt.js +2 -1
- package/dist/server/schema-prompt.js.map +1 -1
- package/dist/server/security-headers.d.ts +3 -0
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +7 -1
- package/dist/server/security-headers.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +24 -4
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/templates/default/_gitignore +5 -1
- package/dist/templates/default/app/root.tsx +1 -0
- package/dist/templates/default/public/favicon.svg +3 -3
- package/dist/templates/default/public/icon-180.svg +3 -3
- package/dist/templates/default/public/icon-192.svg +3 -3
- package/dist/templates/default/public/icon-512.svg +3 -3
- package/dist/templates/workspace-core/AGENTS.md +23 -7
- package/dist/templates/workspace-core/package.json +2 -1
- package/dist/templates/workspace-core/src/credentials.ts +22 -11
- package/dist/templates/workspace-root/.env.example +7 -0
- package/dist/templates/workspace-root/README.md +6 -3
- package/dist/templates/workspace-root/_gitignore +3 -0
- package/dist/templates/workspace-root/package.json +3 -1
- package/dist/templates/workspace-root/scripts/workspace-dev.ts +410 -0
- package/dist/tools/actions.d.ts.map +1 -1
- package/dist/tools/actions.js +2 -0
- package/dist/tools/actions.js.map +1 -1
- package/dist/tools/html-shell.d.ts.map +1 -1
- package/dist/tools/html-shell.js +13 -1
- package/dist/tools/html-shell.js.map +1 -1
- package/dist/tools/store.d.ts.map +1 -1
- package/dist/tools/store.js +10 -10
- package/dist/tools/store.js.map +1 -1
- package/dist/tracking/providers.d.ts +1 -0
- package/dist/tracking/providers.d.ts.map +1 -1
- package/dist/tracking/providers.js +72 -0
- package/dist/tracking/providers.js.map +1 -1
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +106 -9
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +67 -2
- package/dist/vite/client.js.map +1 -1
- package/docs/content/authentication.md +17 -13
- package/docs/content/deployment.md +11 -11
- package/docs/content/mcp-clients.md +2 -2
- package/docs/content/onboarding.md +32 -30
- package/docs/content/security.md +1 -1
- package/docs/content/tools.md +4 -0
- package/package.json +2 -2
- package/src/templates/default/_gitignore +5 -1
- package/src/templates/default/app/root.tsx +1 -0
- package/src/templates/default/public/favicon.svg +3 -3
- package/src/templates/default/public/icon-180.svg +3 -3
- package/src/templates/default/public/icon-192.svg +3 -3
- package/src/templates/default/public/icon-512.svg +3 -3
- package/src/templates/workspace-core/AGENTS.md +23 -7
- package/src/templates/workspace-core/package.json +2 -1
- package/src/templates/workspace-core/src/credentials.ts +22 -11
- package/src/templates/workspace-root/.env.example +7 -0
- package/src/templates/workspace-root/README.md +6 -3
- package/src/templates/workspace-root/_gitignore +3 -0
- package/src/templates/workspace-root/package.json +3 -1
- package/src/templates/workspace-root/scripts/workspace-dev.ts +410 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { IconArrowUpRight, IconCheck, IconCode, IconKey, IconLoader2, IconPlus, } from "@tabler/icons-react";
|
|
4
|
+
import { agentNativePath, appBasePath } from "./api-path.js";
|
|
5
|
+
import { sendToAgentChat } from "./agent-chat.js";
|
|
6
|
+
import { isInBuilderFrame } from "./builder-frame.js";
|
|
7
|
+
import { useDevMode } from "./use-dev-mode.js";
|
|
8
|
+
const TEMPLATE_OPTIONS = [
|
|
9
|
+
{ value: "starter", label: "Starter" },
|
|
10
|
+
{ value: "analytics", label: "Analytics" },
|
|
11
|
+
{ value: "calendar", label: "Calendar" },
|
|
12
|
+
{ value: "content", label: "Content" },
|
|
13
|
+
{ value: "design", label: "Design" },
|
|
14
|
+
{ value: "dispatch", label: "Dispatch" },
|
|
15
|
+
{ value: "forms", label: "Forms" },
|
|
16
|
+
{ value: "mail", label: "Mail" },
|
|
17
|
+
{ value: "slides", label: "Slides" },
|
|
18
|
+
{ value: "videos", label: "Videos" },
|
|
19
|
+
{ value: "clips", label: "Clips" },
|
|
20
|
+
];
|
|
21
|
+
function slugify(value) {
|
|
22
|
+
return value
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
25
|
+
.replace(/^-+|-+$/g, "")
|
|
26
|
+
.replace(/^[^a-z]+/, "")
|
|
27
|
+
.slice(0, 48);
|
|
28
|
+
}
|
|
29
|
+
function titleFromPrompt(prompt) {
|
|
30
|
+
const cleaned = prompt
|
|
31
|
+
.replace(/\b(build|create|make|an?|the|app|tool|dashboard)\b/gi, " ")
|
|
32
|
+
.replace(/\s+/g, " ")
|
|
33
|
+
.trim();
|
|
34
|
+
return slugify(cleaned || "new-app") || "new-app";
|
|
35
|
+
}
|
|
36
|
+
function actionUrl(basePath, action) {
|
|
37
|
+
const path = `/_agent-native/actions/${action}`;
|
|
38
|
+
if (basePath === null)
|
|
39
|
+
return agentNativePath(path);
|
|
40
|
+
const normalized = basePath.replace(/\/+$/, "");
|
|
41
|
+
return `${normalized}${path}`;
|
|
42
|
+
}
|
|
43
|
+
function defaultDispatchBasePath(sourceApp) {
|
|
44
|
+
if (sourceApp === "dispatch")
|
|
45
|
+
return null;
|
|
46
|
+
const base = appBasePath();
|
|
47
|
+
if (base === "/dispatch")
|
|
48
|
+
return null;
|
|
49
|
+
return "/dispatch";
|
|
50
|
+
}
|
|
51
|
+
async function fetchJson(url, init) {
|
|
52
|
+
const res = await fetch(url, init);
|
|
53
|
+
const data = await res.json().catch(() => null);
|
|
54
|
+
if (!res.ok) {
|
|
55
|
+
throw new Error(data?.error || data?.message || `Request failed ${res.status}`);
|
|
56
|
+
}
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
export function NewWorkspaceAppFlow({ sourceApp = "starter", className = "", dispatchBasePath, }) {
|
|
60
|
+
const [prompt, setPrompt] = useState("");
|
|
61
|
+
const [appName, setAppName] = useState("");
|
|
62
|
+
const [template, setTemplate] = useState("starter");
|
|
63
|
+
const [selectedSecretIds, setSelectedSecretIds] = useState([]);
|
|
64
|
+
const [secrets, setSecrets] = useState([]);
|
|
65
|
+
const [secretsError, setSecretsError] = useState(null);
|
|
66
|
+
const [statusMessage, setStatusMessage] = useState(null);
|
|
67
|
+
const [branchUrl, setBranchUrl] = useState(null);
|
|
68
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
69
|
+
const { isDevMode } = useDevMode();
|
|
70
|
+
const effectiveDispatchBasePath = dispatchBasePath === undefined
|
|
71
|
+
? defaultDispatchBasePath(sourceApp)
|
|
72
|
+
: dispatchBasePath;
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
let cancelled = false;
|
|
75
|
+
const url = actionUrl(effectiveDispatchBasePath, "list-vault-secret-options");
|
|
76
|
+
fetchJson(url)
|
|
77
|
+
.then((data) => {
|
|
78
|
+
if (cancelled)
|
|
79
|
+
return;
|
|
80
|
+
setSecrets(Array.isArray(data) ? data : []);
|
|
81
|
+
setSecretsError(null);
|
|
82
|
+
})
|
|
83
|
+
.catch((err) => {
|
|
84
|
+
if (cancelled)
|
|
85
|
+
return;
|
|
86
|
+
setSecrets([]);
|
|
87
|
+
setSecretsError(err?.message || "Could not load Dispatch keys");
|
|
88
|
+
});
|
|
89
|
+
return () => {
|
|
90
|
+
cancelled = true;
|
|
91
|
+
};
|
|
92
|
+
}, [effectiveDispatchBasePath]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (appName || !prompt.trim())
|
|
95
|
+
return;
|
|
96
|
+
setAppName(titleFromPrompt(prompt));
|
|
97
|
+
}, [prompt, appName]);
|
|
98
|
+
const selectedSecrets = useMemo(() => secrets.filter((secret) => selectedSecretIds.includes(secret.id)), [secrets, selectedSecretIds]);
|
|
99
|
+
const canSubmit = prompt.trim().length > 0 && slugify(appName).length > 0;
|
|
100
|
+
function buildMessage() {
|
|
101
|
+
const safeAppName = slugify(appName) || titleFromPrompt(prompt);
|
|
102
|
+
const keyList = selectedSecrets.map((s) => s.credentialKey).join(", ");
|
|
103
|
+
return [
|
|
104
|
+
`Create a new agent-native app in this workspace.`,
|
|
105
|
+
``,
|
|
106
|
+
`App name: ${safeAppName}`,
|
|
107
|
+
`Template to start from: ${template}`,
|
|
108
|
+
`User prompt: ${prompt.trim()}`,
|
|
109
|
+
keyList
|
|
110
|
+
? `Dispatch vault keys selected for this app: ${keyList}`
|
|
111
|
+
: `Dispatch vault keys selected for this app: none`,
|
|
112
|
+
``,
|
|
113
|
+
`Use the workspace app layout: create it under apps/${safeAppName}, mount it at /${safeAppName}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,
|
|
114
|
+
keyList
|
|
115
|
+
? `Grant the selected Dispatch vault keys to appId "${safeAppName}" and sync them once the app server is available.`
|
|
116
|
+
: `Do not grant any Dispatch vault keys unless the user asks later.`,
|
|
117
|
+
`When it is ready, start or update the dev server and navigate the user to /${safeAppName}.`,
|
|
118
|
+
].join("\n");
|
|
119
|
+
}
|
|
120
|
+
async function grantSelectedSecrets(safeAppName) {
|
|
121
|
+
if (selectedSecretIds.length === 0)
|
|
122
|
+
return;
|
|
123
|
+
try {
|
|
124
|
+
await fetchJson(actionUrl(effectiveDispatchBasePath, "grant-vault-secrets-to-app"), {
|
|
125
|
+
method: "POST",
|
|
126
|
+
headers: { "Content-Type": "application/json" },
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
appId: safeAppName,
|
|
129
|
+
secretIds: selectedSecretIds,
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
setStatusMessage(`The app request was prepared, but Dispatch grants could not be saved yet: ${err?.message || "unknown error"}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function submit() {
|
|
138
|
+
if (!canSubmit || isSubmitting)
|
|
139
|
+
return;
|
|
140
|
+
const safeAppName = slugify(appName) || titleFromPrompt(prompt);
|
|
141
|
+
const message = buildMessage();
|
|
142
|
+
setIsSubmitting(true);
|
|
143
|
+
setStatusMessage(null);
|
|
144
|
+
setBranchUrl(null);
|
|
145
|
+
try {
|
|
146
|
+
await grantSelectedSecrets(safeAppName);
|
|
147
|
+
if (isInBuilderFrame()) {
|
|
148
|
+
sendToAgentChat({ message, submit: true, type: "code" });
|
|
149
|
+
setStatusMessage("Sent to Builder chat.");
|
|
150
|
+
}
|
|
151
|
+
else if (isDevMode) {
|
|
152
|
+
sendToAgentChat({ message, submit: true, type: "code", newTab: true });
|
|
153
|
+
setStatusMessage("Sent to the local agent.");
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
const result = await fetchJson(actionUrl(effectiveDispatchBasePath, "start-workspace-app-creation"), {
|
|
157
|
+
method: "POST",
|
|
158
|
+
headers: { "Content-Type": "application/json" },
|
|
159
|
+
body: JSON.stringify({
|
|
160
|
+
prompt: prompt.trim(),
|
|
161
|
+
appId: safeAppName,
|
|
162
|
+
template,
|
|
163
|
+
secretIds: selectedSecretIds,
|
|
164
|
+
preparedPrompt: message,
|
|
165
|
+
}),
|
|
166
|
+
});
|
|
167
|
+
if (result?.mode === "builder") {
|
|
168
|
+
setBranchUrl(result?.url || null);
|
|
169
|
+
setStatusMessage("Builder branch created.");
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
setStatusMessage(result?.message ||
|
|
173
|
+
"Builder app creation is coming soon here. Open this workspace in Builder to create an app from this prompt.");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
setStatusMessage(err?.message || "Could not start the new app flow.");
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
setIsSubmitting(false);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function toggleSecret(id) {
|
|
185
|
+
setSelectedSecretIds((current) => current.includes(id)
|
|
186
|
+
? current.filter((existing) => existing !== id)
|
|
187
|
+
: [...current, id]);
|
|
188
|
+
}
|
|
189
|
+
return (_jsx("section", { className: `mx-auto flex w-full max-w-5xl flex-col gap-5 px-4 py-6 ${className}`, children: _jsxs("div", { className: "grid gap-5 lg:grid-cols-[minmax(0,1fr)_320px]", children: [_jsxs("div", { className: "rounded-lg border border-border bg-card", children: [_jsx("div", { className: "border-b border-border px-4 py-3", children: _jsxs("div", { className: "flex items-center gap-2 text-sm font-medium", children: [_jsx(IconPlus, { className: "h-4 w-4" }), "New app"] }) }), _jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("label", { className: "block space-y-2", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Prompt" }), _jsx("textarea", { value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Describe the app your teammate should be able to use...", rows: 6, className: "min-h-36 w-full resize-none rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring" })] }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("label", { className: "block space-y-2", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "App path" }), _jsx("input", { value: appName, onChange: (e) => setAppName(slugify(e.target.value)), placeholder: "customer-health", className: "h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring" })] }), _jsxs("label", { className: "block space-y-2", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Starter template" }), _jsx("select", { value: template, onChange: (e) => setTemplate(e.target.value), className: "h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring", children: TEMPLATE_OPTIONS.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value))) })] })] }), _jsxs("button", { type: "button", onClick: submit, disabled: !canSubmit || isSubmitting, className: "inline-flex h-10 items-center gap-2 rounded-md bg-foreground px-4 text-sm font-medium text-background disabled:cursor-not-allowed disabled:opacity-40", children: [isSubmitting ? (_jsx(IconLoader2, { className: "h-4 w-4 animate-spin" })) : (_jsx(IconCode, { className: "h-4 w-4" })), "Create app"] }), statusMessage ? (_jsxs("div", { className: "rounded-md border border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground", children: [statusMessage, branchUrl ? (_jsxs("a", { href: branchUrl, target: "_blank", rel: "noreferrer", className: "ml-2 inline-flex items-center gap-1 font-medium text-foreground underline", children: ["Open branch ", _jsx(IconArrowUpRight, { className: "h-3 w-3" })] })) : null] })) : null] })] }), _jsxs("aside", { className: "rounded-lg border border-border bg-card", children: [_jsx("div", { className: "border-b border-border px-4 py-3", children: _jsxs("div", { className: "flex items-center gap-2 text-sm font-medium", children: [_jsx(IconKey, { className: "h-4 w-4" }), "Dispatch keys"] }) }), _jsx("div", { className: "max-h-[440px] space-y-2 overflow-y-auto p-3", children: secretsError ? (_jsx("p", { className: "rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground", children: secretsError })) : secrets.length === 0 ? (_jsx("p", { className: "rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground", children: "No Dispatch vault keys found yet." })) : (secrets.map((secret) => {
|
|
190
|
+
const selected = selectedSecretIds.includes(secret.id);
|
|
191
|
+
return (_jsxs("button", { type: "button", onClick: () => toggleSecret(secret.id), className: `flex w-full items-start gap-3 rounded-md border px-3 py-2 text-left text-sm transition ${selected
|
|
192
|
+
? "border-foreground bg-foreground text-background"
|
|
193
|
+
: "border-border hover:bg-accent"}`, children: [_jsx("span", { className: `mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${selected
|
|
194
|
+
? "border-background"
|
|
195
|
+
: "border-muted-foreground/40"}`, children: selected ? _jsx(IconCheck, { className: "h-3 w-3" }) : null }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate font-medium", children: secret.credentialKey }), _jsx("span", { className: `block truncate text-xs ${selected
|
|
196
|
+
? "text-background/70"
|
|
197
|
+
: "text-muted-foreground"}`, children: secret.provider || secret.name })] })] }, secret.id));
|
|
198
|
+
})) })] })] }) }));
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=NewWorkspaceAppFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewWorkspaceAppFlow.js","sourceRoot":"","sources":["../../src/client/NewWorkspaceAppFlow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO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C;4BACJ,CAAC,CAAC,CACH,GACG,IACA,IACJ,GACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport {\n IconArrowUpRight,\n IconCheck,\n IconCode,\n IconKey,\n IconLoader2,\n IconPlus,\n} from \"@tabler/icons-react\";\nimport { agentNativePath, appBasePath } from \"./api-path.js\";\nimport { sendToAgentChat } from \"./agent-chat.js\";\nimport { isInBuilderFrame } from \"./builder-frame.js\";\nimport { useDevMode } from \"./use-dev-mode.js\";\n\nexport interface VaultSecretOption {\n id: string;\n name: string;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\nexport interface NewWorkspaceAppFlowProps {\n sourceApp?: string;\n className?: string;\n dispatchBasePath?: string | null;\n}\n\nconst TEMPLATE_OPTIONS = [\n { value: \"starter\", label: \"Starter\" },\n { value: \"analytics\", label: \"Analytics\" },\n { value: \"calendar\", label: \"Calendar\" },\n { value: \"content\", label: \"Content\" },\n { value: \"design\", label: \"Design\" },\n { value: \"dispatch\", label: \"Dispatch\" },\n { value: \"forms\", label: \"Forms\" },\n { value: \"mail\", label: \"Mail\" },\n { value: \"slides\", label: \"Slides\" },\n { value: \"videos\", label: \"Videos\" },\n { value: \"clips\", label: \"Clips\" },\n] as const;\n\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .replace(/^[^a-z]+/, \"\")\n .slice(0, 48);\n}\n\nfunction titleFromPrompt(prompt: string): string {\n const cleaned = prompt\n .replace(/\\b(build|create|make|an?|the|app|tool|dashboard)\\b/gi, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n return slugify(cleaned || \"new-app\") || \"new-app\";\n}\n\nfunction actionUrl(basePath: string | null, action: string): string {\n const path = `/_agent-native/actions/${action}`;\n if (basePath === null) return agentNativePath(path);\n const normalized = basePath.replace(/\\/+$/, \"\");\n return `${normalized}${path}`;\n}\n\nfunction defaultDispatchBasePath(sourceApp?: string): string | null {\n if (sourceApp === \"dispatch\") return null;\n const base = appBasePath();\n if (base === \"/dispatch\") return null;\n return \"/dispatch\";\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<any> {\n const res = await fetch(url, init);\n const data = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(\n data?.error || data?.message || `Request failed ${res.status}`,\n );\n }\n return data;\n}\n\nexport function NewWorkspaceAppFlow({\n sourceApp = \"starter\",\n className = \"\",\n dispatchBasePath,\n}: NewWorkspaceAppFlowProps) {\n const [prompt, setPrompt] = useState(\"\");\n const [appName, setAppName] = useState(\"\");\n const [template, setTemplate] =\n useState<(typeof TEMPLATE_OPTIONS)[number][\"value\"]>(\"starter\");\n const [selectedSecretIds, setSelectedSecretIds] = useState<string[]>([]);\n const [secrets, setSecrets] = useState<VaultSecretOption[]>([]);\n const [secretsError, setSecretsError] = useState<string | null>(null);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const [branchUrl, setBranchUrl] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { isDevMode } = useDevMode();\n\n const effectiveDispatchBasePath =\n dispatchBasePath === undefined\n ? defaultDispatchBasePath(sourceApp)\n : dispatchBasePath;\n\n useEffect(() => {\n let cancelled = false;\n const url = actionUrl(\n effectiveDispatchBasePath,\n \"list-vault-secret-options\",\n );\n fetchJson(url)\n .then((data) => {\n if (cancelled) return;\n setSecrets(Array.isArray(data) ? data : []);\n setSecretsError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setSecrets([]);\n setSecretsError(err?.message || \"Could not load Dispatch keys\");\n });\n return () => {\n cancelled = true;\n };\n }, [effectiveDispatchBasePath]);\n\n useEffect(() => {\n if (appName || !prompt.trim()) return;\n setAppName(titleFromPrompt(prompt));\n }, [prompt, appName]);\n\n const selectedSecrets = useMemo(\n () => secrets.filter((secret) => selectedSecretIds.includes(secret.id)),\n [secrets, selectedSecretIds],\n );\n\n const canSubmit = prompt.trim().length > 0 && slugify(appName).length > 0;\n\n function buildMessage(): string {\n const safeAppName = slugify(appName) || titleFromPrompt(prompt);\n const keyList = selectedSecrets.map((s) => s.credentialKey).join(\", \");\n return [\n `Create a new agent-native app in this workspace.`,\n ``,\n `App name: ${safeAppName}`,\n `Template to start from: ${template}`,\n `User prompt: ${prompt.trim()}`,\n keyList\n ? `Dispatch vault keys selected for this app: ${keyList}`\n : `Dispatch vault keys selected for this app: none`,\n ``,\n `Use the workspace app layout: create it under apps/${safeAppName}, mount it at /${safeAppName}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,\n keyList\n ? `Grant the selected Dispatch vault keys to appId \"${safeAppName}\" and sync them once the app server is available.`\n : `Do not grant any Dispatch vault keys unless the user asks later.`,\n `When it is ready, start or update the dev server and navigate the user to /${safeAppName}.`,\n ].join(\"\\n\");\n }\n\n async function grantSelectedSecrets(safeAppName: string) {\n if (selectedSecretIds.length === 0) return;\n try {\n await fetchJson(\n actionUrl(effectiveDispatchBasePath, \"grant-vault-secrets-to-app\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n appId: safeAppName,\n secretIds: selectedSecretIds,\n }),\n },\n );\n } catch (err: any) {\n setStatusMessage(\n `The app request was prepared, but Dispatch grants could not be saved yet: ${err?.message || \"unknown error\"}`,\n );\n }\n }\n\n async function submit() {\n if (!canSubmit || isSubmitting) return;\n const safeAppName = slugify(appName) || titleFromPrompt(prompt);\n const message = buildMessage();\n setIsSubmitting(true);\n setStatusMessage(null);\n setBranchUrl(null);\n\n try {\n await grantSelectedSecrets(safeAppName);\n\n if (isInBuilderFrame()) {\n sendToAgentChat({ message, submit: true, type: \"code\" });\n setStatusMessage(\"Sent to Builder chat.\");\n } else if (isDevMode) {\n sendToAgentChat({ message, submit: true, type: \"code\", newTab: true });\n setStatusMessage(\"Sent to the local agent.\");\n } else {\n const result = await fetchJson(\n actionUrl(effectiveDispatchBasePath, \"start-workspace-app-creation\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n prompt: prompt.trim(),\n appId: safeAppName,\n template,\n secretIds: selectedSecretIds,\n preparedPrompt: message,\n }),\n },\n );\n if (result?.mode === \"builder\") {\n setBranchUrl(result?.url || null);\n setStatusMessage(\"Builder branch created.\");\n } else {\n setStatusMessage(\n result?.message ||\n \"Builder app creation is coming soon here. Open this workspace in Builder to create an app from this prompt.\",\n );\n }\n }\n } catch (err: any) {\n setStatusMessage(err?.message || \"Could not start the new app flow.\");\n } finally {\n setIsSubmitting(false);\n }\n }\n\n function toggleSecret(id: string) {\n setSelectedSecretIds((current) =>\n current.includes(id)\n ? current.filter((existing) => existing !== id)\n : [...current, id],\n );\n }\n\n return (\n <section\n className={`mx-auto flex w-full max-w-5xl flex-col gap-5 px-4 py-6 ${className}`}\n >\n <div className=\"grid gap-5 lg:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"rounded-lg border border-border bg-card\">\n <div className=\"border-b border-border px-4 py-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium\">\n <IconPlus className=\"h-4 w-4\" />\n New app\n </div>\n </div>\n <div className=\"space-y-4 p-4\">\n <label className=\"block space-y-2\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n Prompt\n </span>\n <textarea\n value={prompt}\n onChange={(e) => setPrompt(e.target.value)}\n placeholder=\"Describe the app your teammate should be able to use...\"\n rows={6}\n className=\"min-h-36 w-full resize-none rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring\"\n />\n </label>\n\n <div className=\"grid gap-3 sm:grid-cols-2\">\n <label className=\"block space-y-2\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n App path\n </span>\n <input\n value={appName}\n onChange={(e) => setAppName(slugify(e.target.value))}\n placeholder=\"customer-health\"\n className=\"h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring\"\n />\n </label>\n <label className=\"block space-y-2\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n Starter template\n </span>\n <select\n value={template}\n onChange={(e) =>\n setTemplate(e.target.value as typeof template)\n }\n className=\"h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring\"\n >\n {TEMPLATE_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </label>\n </div>\n\n <button\n type=\"button\"\n onClick={submit}\n disabled={!canSubmit || isSubmitting}\n className=\"inline-flex h-10 items-center gap-2 rounded-md bg-foreground px-4 text-sm font-medium text-background disabled:cursor-not-allowed disabled:opacity-40\"\n >\n {isSubmitting ? (\n <IconLoader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <IconCode className=\"h-4 w-4\" />\n )}\n Create app\n </button>\n\n {statusMessage ? (\n <div className=\"rounded-md border border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground\">\n {statusMessage}\n {branchUrl ? (\n <a\n href={branchUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"ml-2 inline-flex items-center gap-1 font-medium text-foreground underline\"\n >\n Open branch <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n\n <aside className=\"rounded-lg border border-border bg-card\">\n <div className=\"border-b border-border px-4 py-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium\">\n <IconKey className=\"h-4 w-4\" />\n Dispatch keys\n </div>\n </div>\n <div className=\"max-h-[440px] space-y-2 overflow-y-auto p-3\">\n {secretsError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {secretsError}\n </p>\n ) : secrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch vault keys found yet.\n </p>\n ) : (\n secrets.map((secret) => {\n const selected = selectedSecretIds.includes(secret.id);\n return (\n <button\n key={secret.id}\n type=\"button\"\n onClick={() => toggleSecret(secret.id)}\n className={`flex w-full items-start gap-3 rounded-md border px-3 py-2 text-left text-sm transition ${\n selected\n ? \"border-foreground bg-foreground text-background\"\n : \"border-border hover:bg-accent\"\n }`}\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-background\"\n : \"border-muted-foreground/40\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span\n className={`block truncate text-xs ${\n selected\n ? \"text-background/70\"\n : \"text-muted-foreground\"\n }`}\n >\n {secret.provider || secret.name}\n </span>\n </span>\n </button>\n );\n })\n )}\n </div>\n </aside>\n </div>\n </section>\n );\n}\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export interface PoweredByBadgeProps {
|
|
2
2
|
position?: "bottom-right" | "bottom-left";
|
|
3
3
|
}
|
|
4
|
+
export interface OpenSourceBadgeProps {
|
|
5
|
+
position?: "bottom-left" | "bottom-right";
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
|
-
* Small branding badge: "Built with Agent Native"
|
|
8
|
+
* Small branding badge: "Built with [Agent Native logo]"
|
|
6
9
|
*
|
|
7
10
|
* - Fixed position in the corner
|
|
8
11
|
* - Subtle, semi-transparent
|
|
@@ -11,4 +14,10 @@ export interface PoweredByBadgeProps {
|
|
|
11
14
|
* - Can be hidden via HIDE_BRANDING=true env var (for white-label)
|
|
12
15
|
*/
|
|
13
16
|
export declare function PoweredByBadge({ position, }: PoweredByBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Small GitHub badge: "Open source"
|
|
19
|
+
*
|
|
20
|
+
* Intended to pair with PoweredByBadge on public pages.
|
|
21
|
+
*/
|
|
22
|
+
export declare function OpenSourceBadge({ position, }: OpenSourceBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
14
23
|
//# sourceMappingURL=PoweredByBadge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoweredByBadge.d.ts","sourceRoot":"","sources":["../../src/client/PoweredByBadge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PoweredByBadge.d.ts","sourceRoot":"","sources":["../../src/client/PoweredByBadge.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;CAC3C;AA+BD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,GAC1B,EAAE,mBAAmB,2CAwGrB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAwB,GACzB,EAAE,oBAAoB,2CAoEtB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { IconBrandGithub } from "@tabler/icons-react";
|
|
3
|
+
import { appPath } from "./api-path.js";
|
|
3
4
|
const containerStyle = (position) => ({
|
|
4
5
|
position: "fixed",
|
|
5
6
|
bottom: 16,
|
|
@@ -14,18 +15,18 @@ const containerStyle = (position) => ({
|
|
|
14
15
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
15
16
|
fontWeight: 500,
|
|
16
17
|
lineHeight: 1,
|
|
17
|
-
color: "rgba(
|
|
18
|
+
color: "rgba(95, 95, 95, 0.95)",
|
|
18
19
|
background: "rgba(0, 0, 0, 0.05)",
|
|
19
20
|
backdropFilter: "blur(8px)",
|
|
20
21
|
WebkitBackdropFilter: "blur(8px)",
|
|
21
22
|
border: "1px solid rgba(0, 0, 0, 0.06)",
|
|
22
23
|
textDecoration: "none",
|
|
23
24
|
transition: "opacity 0.2s, color 0.2s",
|
|
24
|
-
opacity: 0.
|
|
25
|
+
opacity: 0.82,
|
|
25
26
|
});
|
|
26
27
|
const darkQuery = "(prefers-color-scheme: dark)";
|
|
27
28
|
/**
|
|
28
|
-
* Small branding badge: "Built with Agent Native"
|
|
29
|
+
* Small branding badge: "Built with [Agent Native logo]"
|
|
29
30
|
*
|
|
30
31
|
* - Fixed position in the corner
|
|
31
32
|
* - Subtle, semi-transparent
|
|
@@ -39,23 +40,134 @@ export function PoweredByBadge({ position = "bottom-right", }) {
|
|
|
39
40
|
?.VITE_HIDE_BRANDING === "true";
|
|
40
41
|
if (hidden)
|
|
41
42
|
return null;
|
|
43
|
+
const logoOnLight = appPath("/agent-native-logo-light.svg");
|
|
44
|
+
const logoOnDark = appPath("/agent-native-logo-dark.svg");
|
|
42
45
|
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
|
46
|
+
.an-powered-logo {
|
|
47
|
+
display: block;
|
|
48
|
+
height: 14px;
|
|
49
|
+
width: auto;
|
|
50
|
+
flex: none;
|
|
51
|
+
}
|
|
52
|
+
.an-powered-logo-dark {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
@media (max-width: 640px) {
|
|
56
|
+
.an-powered-badge {
|
|
57
|
+
position: static !important;
|
|
58
|
+
margin: 0.75rem auto 0 !important;
|
|
59
|
+
width: max-content;
|
|
60
|
+
max-width: calc(100vw - 2rem);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.dark .an-powered-badge {
|
|
64
|
+
background: rgba(255, 255, 255, 0.06) !important;
|
|
65
|
+
border-color: rgba(255, 255, 255, 0.08) !important;
|
|
66
|
+
color: rgba(215, 215, 215, 0.94) !important;
|
|
67
|
+
}
|
|
68
|
+
.dark .an-powered-logo-light {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
.dark .an-powered-logo-dark {
|
|
72
|
+
display: block;
|
|
73
|
+
}
|
|
43
74
|
@media ${darkQuery} {
|
|
44
75
|
.an-powered-badge {
|
|
45
76
|
background: rgba(255, 255, 255, 0.06) !important;
|
|
46
77
|
border-color: rgba(255, 255, 255, 0.08) !important;
|
|
47
|
-
color: rgba(
|
|
78
|
+
color: rgba(215, 215, 215, 0.94) !important;
|
|
79
|
+
}
|
|
80
|
+
.an-powered-logo-light {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
.an-powered-logo-dark {
|
|
84
|
+
display: block;
|
|
48
85
|
}
|
|
49
86
|
}
|
|
87
|
+
.light .an-powered-badge {
|
|
88
|
+
background: rgba(0, 0, 0, 0.05) !important;
|
|
89
|
+
border-color: rgba(0, 0, 0, 0.06) !important;
|
|
90
|
+
color: rgba(95, 95, 95, 0.95) !important;
|
|
91
|
+
}
|
|
92
|
+
.light .an-powered-logo-light {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
.light .an-powered-logo-dark {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
50
98
|
.an-powered-badge:hover {
|
|
51
99
|
opacity: 1 !important;
|
|
52
|
-
color: rgba(
|
|
100
|
+
color: rgba(70, 70, 70, 1) !important;
|
|
53
101
|
}
|
|
54
102
|
@media ${darkQuery} {
|
|
55
103
|
.an-powered-badge:hover {
|
|
56
|
-
color: rgba(
|
|
104
|
+
color: rgba(238, 238, 238, 1) !important;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.dark .an-powered-badge:hover {
|
|
108
|
+
color: rgba(238, 238, 238, 1) !important;
|
|
109
|
+
}
|
|
110
|
+
.light .an-powered-badge:hover {
|
|
111
|
+
color: rgba(70, 70, 70, 1) !important;
|
|
112
|
+
}
|
|
113
|
+
` }), _jsxs("a", { href: "https://agent-native.com", target: "_blank", rel: "noopener noreferrer", className: "an-powered-badge", style: containerStyle(position), "aria-label": "Built with Agent Native", children: [_jsx("span", { children: "Built with" }), _jsx("img", { src: logoOnLight, alt: "Agent Native", className: "an-powered-logo an-powered-logo-light" }), _jsx("img", { src: logoOnDark, alt: "Agent Native", className: "an-powered-logo an-powered-logo-dark" })] })] }));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Small GitHub badge: "Open source"
|
|
117
|
+
*
|
|
118
|
+
* Intended to pair with PoweredByBadge on public pages.
|
|
119
|
+
*/
|
|
120
|
+
export function OpenSourceBadge({ position = "bottom-left", }) {
|
|
121
|
+
const hidden = import.meta.env
|
|
122
|
+
?.VITE_HIDE_BRANDING === "true";
|
|
123
|
+
if (hidden)
|
|
124
|
+
return null;
|
|
125
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
|
126
|
+
.an-open-source-badge svg {
|
|
127
|
+
width: 15px;
|
|
128
|
+
height: 15px;
|
|
129
|
+
flex: none;
|
|
130
|
+
}
|
|
131
|
+
.an-open-source-badge {
|
|
132
|
+
background: transparent !important;
|
|
133
|
+
border-color: transparent !important;
|
|
134
|
+
backdrop-filter: none !important;
|
|
135
|
+
-webkit-backdrop-filter: none !important;
|
|
136
|
+
}
|
|
137
|
+
@media (max-width: 640px) {
|
|
138
|
+
.an-open-source-badge {
|
|
139
|
+
position: static !important;
|
|
140
|
+
margin: 1rem auto 0 !important;
|
|
141
|
+
width: max-content;
|
|
142
|
+
max-width: calc(100vw - 2rem);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
.dark .an-open-source-badge {
|
|
146
|
+
color: rgba(215, 215, 215, 0.94) !important;
|
|
147
|
+
}
|
|
148
|
+
@media ${darkQuery} {
|
|
149
|
+
.an-open-source-badge {
|
|
150
|
+
color: rgba(215, 215, 215, 0.94) !important;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
.light .an-open-source-badge {
|
|
154
|
+
color: rgba(95, 95, 95, 0.95) !important;
|
|
155
|
+
}
|
|
156
|
+
.an-open-source-badge:hover {
|
|
157
|
+
opacity: 1 !important;
|
|
158
|
+
color: rgba(70, 70, 70, 1) !important;
|
|
159
|
+
}
|
|
160
|
+
@media ${darkQuery} {
|
|
161
|
+
.an-open-source-badge:hover {
|
|
162
|
+
color: rgba(238, 238, 238, 1) !important;
|
|
57
163
|
}
|
|
58
164
|
}
|
|
59
|
-
|
|
165
|
+
.dark .an-open-source-badge:hover {
|
|
166
|
+
color: rgba(238, 238, 238, 1) !important;
|
|
167
|
+
}
|
|
168
|
+
.light .an-open-source-badge:hover {
|
|
169
|
+
color: rgba(70, 70, 70, 1) !important;
|
|
170
|
+
}
|
|
171
|
+
` }), _jsxs("a", { href: "https://github.com/BuilderIO/agent-native", target: "_blank", rel: "noopener noreferrer", className: "an-open-source-badge", style: containerStyle(position), children: [_jsx(IconBrandGithub, { "aria-hidden": "true", stroke: 1.8 }), _jsx("span", { children: "Open source" })] })] }));
|
|
60
172
|
}
|
|
61
173
|
//# sourceMappingURL=PoweredByBadge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoweredByBadge.js","sourceRoot":"","sources":["../../src/client/PoweredByBadge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PoweredByBadge.js","sourceRoot":"","sources":["../../src/client/PoweredByBadge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAUxC,MAAM,cAAc,GAAG,CACrB,QAAwC,EACzB,EAAE,CAAC,CAAC;IACnB,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,EAAE;IACV,GAAG,CAAC,QAAQ,KAAK,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC/D,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,EAAE;IACZ,UAAU,EACR,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U,eAAe,CAAC,EAC9B,QAAQ,GAAG,aAAa,GACH;IACrB,MAAM,MAAM,GACT,MAAM,CAAC,IAAI,CAAC,GAA0C;QACrD,EAAE,kBAAkB,KAAK,MAAM,CAAC;IAEpC,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IAExB,OAAO,CACL,8BACE,0BAAQ;;;;;;;;;;;;;;;;;;;;;;;iBAuBG,SAAS;;;;;;;;;;;;iBAYT,SAAS;;;;;;;;;;;OAWnB,GAAS,EACV,aACE,IAAI,EAAC,2CAA2C,EAChD,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,aAE/B,KAAC,eAAe,mBAAa,MAAM,EAAC,MAAM,EAAE,GAAG,GAAI,EACnD,yCAAwB,IACtB,IACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import type { CSSProperties } from \"react\";\nimport { IconBrandGithub } from \"@tabler/icons-react\";\nimport { appPath } from \"./api-path.js\";\n\nexport interface PoweredByBadgeProps {\n position?: \"bottom-right\" | \"bottom-left\";\n}\n\nexport interface OpenSourceBadgeProps {\n position?: \"bottom-left\" | \"bottom-right\";\n}\n\nconst containerStyle = (\n position: \"bottom-right\" | \"bottom-left\",\n): CSSProperties => ({\n position: \"fixed\",\n bottom: 16,\n ...(position === \"bottom-right\" ? { right: 16 } : { left: 16 }),\n zIndex: 50,\n display: \"flex\",\n alignItems: \"center\",\n gap: 6,\n padding: \"6px 12px\",\n borderRadius: 8,\n fontSize: 12,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n fontWeight: 500,\n lineHeight: 1,\n color: \"rgba(95, 95, 95, 0.95)\",\n background: \"rgba(0, 0, 0, 0.05)\",\n backdropFilter: \"blur(8px)\",\n WebkitBackdropFilter: \"blur(8px)\",\n border: \"1px solid rgba(0, 0, 0, 0.06)\",\n textDecoration: \"none\",\n transition: \"opacity 0.2s, color 0.2s\",\n opacity: 0.82,\n});\n\nconst darkQuery = \"(prefers-color-scheme: dark)\";\n\n/**\n * Small branding badge: \"Built with [Agent Native logo]\"\n *\n * - Fixed position in the corner\n * - Subtle, semi-transparent\n * - Links to https://agent-native.com\n * - Respects prefers-color-scheme\n * - Can be hidden via HIDE_BRANDING=true env var (for white-label)\n */\nexport function PoweredByBadge({\n position = \"bottom-right\",\n}: PoweredByBadgeProps) {\n // Allow hiding via env var\n const hidden =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_HIDE_BRANDING === \"true\";\n\n if (hidden) return null;\n\n const logoOnLight = appPath(\"/agent-native-logo-light.svg\");\n const logoOnDark = appPath(\"/agent-native-logo-dark.svg\");\n\n return (\n <>\n <style>{`\n .an-powered-logo {\n display: block;\n height: 14px;\n width: auto;\n flex: none;\n }\n .an-powered-logo-dark {\n display: none;\n }\n @media (max-width: 640px) {\n .an-powered-badge {\n position: static !important;\n margin: 0.75rem auto 0 !important;\n width: max-content;\n max-width: calc(100vw - 2rem);\n }\n }\n .dark .an-powered-badge {\n background: rgba(255, 255, 255, 0.06) !important;\n border-color: rgba(255, 255, 255, 0.08) !important;\n color: rgba(215, 215, 215, 0.94) !important;\n }\n .dark .an-powered-logo-light {\n display: none;\n }\n .dark .an-powered-logo-dark {\n display: block;\n }\n @media ${darkQuery} {\n .an-powered-badge {\n background: rgba(255, 255, 255, 0.06) !important;\n border-color: rgba(255, 255, 255, 0.08) !important;\n color: rgba(215, 215, 215, 0.94) !important;\n }\n .an-powered-logo-light {\n display: none;\n }\n .an-powered-logo-dark {\n display: block;\n }\n }\n .light .an-powered-badge {\n background: rgba(0, 0, 0, 0.05) !important;\n border-color: rgba(0, 0, 0, 0.06) !important;\n color: rgba(95, 95, 95, 0.95) !important;\n }\n .light .an-powered-logo-light {\n display: block;\n }\n .light .an-powered-logo-dark {\n display: none;\n }\n .an-powered-badge:hover {\n opacity: 1 !important;\n color: rgba(70, 70, 70, 1) !important;\n }\n @media ${darkQuery} {\n .an-powered-badge:hover {\n color: rgba(238, 238, 238, 1) !important;\n }\n }\n .dark .an-powered-badge:hover {\n color: rgba(238, 238, 238, 1) !important;\n }\n .light .an-powered-badge:hover {\n color: rgba(70, 70, 70, 1) !important;\n }\n `}</style>\n <a\n href=\"https://agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"an-powered-badge\"\n style={containerStyle(position)}\n aria-label=\"Built with Agent Native\"\n >\n <span>Built with</span>\n <img\n src={logoOnLight}\n alt=\"Agent Native\"\n className=\"an-powered-logo an-powered-logo-light\"\n />\n <img\n src={logoOnDark}\n alt=\"Agent Native\"\n className=\"an-powered-logo an-powered-logo-dark\"\n />\n </a>\n </>\n );\n}\n\n/**\n * Small GitHub badge: \"Open source\"\n *\n * Intended to pair with PoweredByBadge on public pages.\n */\nexport function OpenSourceBadge({\n position = \"bottom-left\",\n}: OpenSourceBadgeProps) {\n const hidden =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_HIDE_BRANDING === \"true\";\n\n if (hidden) return null;\n\n return (\n <>\n <style>{`\n .an-open-source-badge svg {\n width: 15px;\n height: 15px;\n flex: none;\n }\n .an-open-source-badge {\n background: transparent !important;\n border-color: transparent !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n @media (max-width: 640px) {\n .an-open-source-badge {\n position: static !important;\n margin: 1rem auto 0 !important;\n width: max-content;\n max-width: calc(100vw - 2rem);\n }\n }\n .dark .an-open-source-badge {\n color: rgba(215, 215, 215, 0.94) !important;\n }\n @media ${darkQuery} {\n .an-open-source-badge {\n color: rgba(215, 215, 215, 0.94) !important;\n }\n }\n .light .an-open-source-badge {\n color: rgba(95, 95, 95, 0.95) !important;\n }\n .an-open-source-badge:hover {\n opacity: 1 !important;\n color: rgba(70, 70, 70, 1) !important;\n }\n @media ${darkQuery} {\n .an-open-source-badge:hover {\n color: rgba(238, 238, 238, 1) !important;\n }\n }\n .dark .an-open-source-badge:hover {\n color: rgba(238, 238, 238, 1) !important;\n }\n .light .an-open-source-badge:hover {\n color: rgba(70, 70, 70, 1) !important;\n }\n `}</style>\n <a\n href=\"https://github.com/BuilderIO/agent-native\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"an-open-source-badge\"\n style={containerStyle(position)}\n >\n <IconBrandGithub aria-hidden=\"true\" stroke={1.8} />\n <span>Open source</span>\n </a>\n </>\n );\n}\n"]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { ChatModelAdapter } from "@assistant-ui/react";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* LLM still sees the planning constraint on every plan-mode turn.
|
|
3
|
+
* The composer's exec mode is sent as explicit request metadata. The server
|
|
4
|
+
* owns the plan-mode prompt and read-only tool filtering so the chat history
|
|
5
|
+
* stays clean and Plan mode is enforced outside the model's goodwill.
|
|
7
6
|
*/
|
|
8
|
-
export declare const PLAN_MODE_INSTRUCTION: string;
|
|
9
7
|
/**
|
|
10
8
|
* Creates a ChatModelAdapter that connects to the agent-native
|
|
11
9
|
* `/_agent-native/agent-chat` SSE endpoint. Supports reconnection via run-manager.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAUhF;;;;GAIG;AACH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC5C,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;CACzD,GAAG,gBAAgB,CAqWnB"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { setActiveRun, updateActiveRunSeq, clearActiveRun, } from "./active-run-state.js";
|
|
2
2
|
import { readSSEStream } from "./sse-event-processor.js";
|
|
3
3
|
import { agentNativePath } from "./api-path.js";
|
|
4
|
+
import { normalizeChatError } from "./error-format.js";
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* LLM still sees the planning constraint on every plan-mode turn.
|
|
6
|
+
* The composer's exec mode is sent as explicit request metadata. The server
|
|
7
|
+
* owns the plan-mode prompt and read-only tool filtering so the chat history
|
|
8
|
+
* stays clean and Plan mode is enforced outside the model's goodwill.
|
|
9
9
|
*/
|
|
10
|
-
export const PLAN_MODE_INSTRUCTION = `PLAN MODE ACTIVE: Before making any changes, you MUST:\n` +
|
|
11
|
-
`1. Explore the codebase to understand what's needed\n` +
|
|
12
|
-
`2. Write a plan to \`.builder/plans/YYYY-MM-DD-<topic>.md\`\n` +
|
|
13
|
-
`3. Present your approach clearly and wait for the user's explicit approval\n` +
|
|
14
|
-
`Do NOT edit any files, run any scripts, or make any changes until the user says to proceed.`;
|
|
15
10
|
/**
|
|
16
11
|
* Creates a ChatModelAdapter that connects to the agent-native
|
|
17
12
|
* `/_agent-native/agent-chat` SSE endpoint. Supports reconnection via run-manager.
|
|
@@ -37,13 +32,11 @@ export function createAgentChatAdapter(options) {
|
|
|
37
32
|
.filter((p) => p.type === "text")
|
|
38
33
|
.map((p) => p.text)
|
|
39
34
|
.join("\n") ?? "";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
? `${PLAN_MODE_INSTRUCTION}\n\n${rawMessageText}`
|
|
46
|
-
: rawMessageText;
|
|
35
|
+
const requestMode = execModeRef?.current === "plan"
|
|
36
|
+
? "plan"
|
|
37
|
+
: execModeRef?.current === "build"
|
|
38
|
+
? "act"
|
|
39
|
+
: undefined;
|
|
47
40
|
// Extract attachments (images as base64, text as content).
|
|
48
41
|
// assistant-ui puts user attachments on msg.attachments (not on content);
|
|
49
42
|
// each attachment carries its own content parts from the adapter.
|
|
@@ -119,9 +112,10 @@ export function createAgentChatAdapter(options) {
|
|
|
119
112
|
method: "POST",
|
|
120
113
|
headers,
|
|
121
114
|
body: JSON.stringify({
|
|
122
|
-
message:
|
|
115
|
+
message: rawMessageText.replace(/@\[([^\]|]+)\|[^\]]+\]/g, "@$1"),
|
|
123
116
|
history,
|
|
124
117
|
...(threadId ? { threadId } : {}),
|
|
118
|
+
...(requestMode ? { mode: requestMode } : {}),
|
|
125
119
|
...(modelRef?.current ? { model: modelRef.current } : {}),
|
|
126
120
|
...(engineRef?.current ? { engine: engineRef.current } : {}),
|
|
127
121
|
...(attachments.length > 0 ? { attachments } : {}),
|
|
@@ -277,11 +271,24 @@ export function createAgentChatAdapter(options) {
|
|
|
277
271
|
return;
|
|
278
272
|
}
|
|
279
273
|
// Reconnect failed or not possible — show error with details
|
|
274
|
+
const normalized = normalizeChatError(errMsg);
|
|
275
|
+
const runError = {
|
|
276
|
+
message: normalized.message,
|
|
277
|
+
...(normalized.details ? { details: normalized.details } : {}),
|
|
278
|
+
errorCode: "connection_error",
|
|
279
|
+
recoverable: true,
|
|
280
|
+
...(runId ? { runId } : {}),
|
|
281
|
+
};
|
|
282
|
+
if (typeof window !== "undefined") {
|
|
283
|
+
window.dispatchEvent(new CustomEvent("agent-chat:run-error", {
|
|
284
|
+
detail: { ...runError, tabId },
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
280
287
|
content.push({
|
|
281
288
|
type: "text",
|
|
282
289
|
text: errMsg.startsWith("Server error:")
|
|
283
290
|
? errMsg
|
|
284
|
-
: `Something went wrong: ${
|
|
291
|
+
: `Something went wrong: ${normalized.message}`,
|
|
285
292
|
});
|
|
286
293
|
yield {
|
|
287
294
|
content: [...content],
|
|
@@ -289,7 +296,7 @@ export function createAgentChatAdapter(options) {
|
|
|
289
296
|
type: "incomplete",
|
|
290
297
|
reason: "error",
|
|
291
298
|
},
|
|
292
|
-
|
|
299
|
+
metadata: { custom: { ...(runId ? { runId } : {}), runError } },
|
|
293
300
|
};
|
|
294
301
|
}
|
|
295
302
|
finally {
|