@agent-native/core 0.125.0 → 0.127.1
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +79 -0
- package/corpus/core/docs/content/external-agents-catalog.mdx +14 -11
- package/corpus/core/docs/content/mcp-protocol.mdx +9 -4
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/index.ts +2 -0
- package/corpus/core/src/agent/production-agent.ts +6 -1
- package/corpus/core/src/agent/run-manager.ts +37 -0
- package/corpus/core/src/agent/run-store.ts +18 -0
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +75 -43
- package/corpus/core/src/client/agent-chat.ts +19 -1
- package/corpus/core/src/client/chat/tool-call-display.tsx +25 -0
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +23 -0
- package/corpus/core/src/client/settings/AgentsSection.tsx +565 -71
- package/corpus/core/src/client/settings/SecretsSection.tsx +71 -36
- package/corpus/core/src/client/use-chat-models.ts +54 -37
- package/corpus/core/src/localization/default-messages.ts +11 -0
- package/corpus/core/src/mcp/ask-app-task-handle.ts +183 -0
- package/corpus/core/src/mcp/builtin-tools.ts +146 -34
- package/corpus/core/src/server/agent-capabilities.ts +8 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +17 -0
- package/corpus/core/src/server/agent-discovery.ts +1 -1
- package/corpus/core/src/server/agent-peer-probe.ts +133 -0
- package/corpus/core/src/server/core-routes-plugin.ts +67 -0
- package/corpus/core/src/server/email-template.ts +13 -0
- package/corpus/core/src/server/email.ts +40 -4
- package/corpus/core/src/shared/mcp-embed-headers.ts +4 -0
- package/corpus/core/src/sharing/actions/share-resource.ts +55 -5
- package/corpus/core/src/sharing/registry.ts +41 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +159 -119
- package/corpus/templates/assets/actions/edit-image.ts +31 -18
- package/corpus/templates/assets/actions/refine-image.ts +43 -29
- package/corpus/templates/assets/actions/restyle-image.ts +30 -19
- package/corpus/templates/assets/actions/variant-slots.ts +26 -0
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +85 -17
- package/corpus/templates/clips/changelog/2026-07-27-share-notification-emails-now-include-a-clickable-recording-.md +6 -0
- package/corpus/templates/clips/server/db/index.ts +28 -6
- package/corpus/templates/clips/server/lib/share-email-hero.ts +105 -0
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +100 -12
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +17 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +169 -22
- package/corpus/templates/design/app/hooks/use-question-flow.ts +21 -1
- package/corpus/templates/design/changelog/2026-07-28-the-model-you-pick-when-starting-a-new-design-is-now-used-fo.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-28-pending-apps-are-hidden-by-default-and-app-ownership-details.md +6 -0
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +5 -1
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +5 -0
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +31 -8
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +15 -0
- package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +78 -8
- package/corpus/templates/slides/app/components/presentation/PresenterView.tsx +179 -0
- package/corpus/templates/slides/app/components/presentation/present-channel.ts +15 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +10 -1
- package/corpus/templates/slides/app/lib/export-google-slides-client.ts +67 -0
- package/corpus/templates/slides/app/lib/export-pptx-client.ts +16 -3
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +11 -0
- package/corpus/templates/slides/app/pages/Presentation.tsx +11 -3
- package/corpus/templates/slides/changelog/2026-07-28-export-to-google-slides-now-creates-the-deck-directly-in-you.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-28-opening-a-presentation-link-directly-no-longer-bounces-back-.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-28-presenter-view-open-a-second-window-while-presenting-to-see-.md +6 -0
- package/corpus/templates/slides/server/routes/api/exports/google-slides.post.ts +90 -0
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +143 -111
- package/corpus/toolkit/src/composer/runtime-adapters.tsx +2 -0
- package/dist/a2a/index.d.ts +2 -0
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js +1 -0
- package/dist/a2a/index.js.map +1 -1
- package/dist/agent/production-agent.d.ts +2 -2
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +6 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +11 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +34 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +8 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +16 -0
- package/dist/agent/run-store.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +60 -31
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts +6 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +13 -1
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +14 -0
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +6 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +16 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/settings/AgentsSection.d.ts.map +1 -1
- package/dist/client/settings/AgentsSection.js +250 -30
- package/dist/client/settings/AgentsSection.js.map +1 -1
- package/dist/client/settings/SecretsSection.d.ts.map +1 -1
- package/dist/client/settings/SecretsSection.js +16 -2
- package/dist/client/settings/SecretsSection.js.map +1 -1
- package/dist/client/use-chat-models.d.ts.map +1 -1
- package/dist/client/use-chat-models.js +46 -27
- package/dist/client/use-chat-models.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/localization/default-messages.d.ts +9 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +9 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/ask-app-task-handle.d.ts +25 -0
- package/dist/mcp/ask-app-task-handle.d.ts.map +1 -0
- package/dist/mcp/ask-app-task-handle.js +136 -0
- package/dist/mcp/ask-app-task-handle.js.map +1 -0
- package/dist/mcp/builtin-tools.d.ts +3 -3
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +115 -38
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +6 -6
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-capabilities.d.ts +7 -1
- package/dist/server/agent-capabilities.d.ts.map +1 -1
- package/dist/server/agent-capabilities.js +1 -0
- package/dist/server/agent-capabilities.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +7 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +16 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +1 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +1 -1
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-peer-probe.d.ts +37 -0
- package/dist/server/agent-peer-probe.d.ts.map +1 -0
- package/dist/server/agent-peer-probe.js +90 -0
- package/dist/server/agent-peer-probe.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +53 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/email-template.d.ts +6 -0
- package/dist/server/email-template.d.ts.map +1 -1
- package/dist/server/email-template.js +6 -0
- package/dist/server/email-template.js.map +1 -1
- package/dist/server/email.d.ts +7 -0
- package/dist/server/email.d.ts.map +1 -1
- package/dist/server/email.js +31 -6
- package/dist/server/email.js.map +1 -1
- package/dist/shared/mcp-embed-headers.d.ts +1 -0
- package/dist/shared/mcp-embed-headers.d.ts.map +1 -1
- package/dist/shared/mcp-embed-headers.js +4 -0
- package/dist/shared/mcp-embed-headers.js.map +1 -1
- package/dist/sharing/actions/share-resource.d.ts.map +1 -1
- package/dist/sharing/actions/share-resource.js +49 -5
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/sharing/registry.d.ts +40 -1
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +159 -119
- package/docs/content/external-agents-catalog.mdx +14 -11
- package/docs/content/mcp-protocol.mdx +9 -4
- package/package.json +2 -2
- package/src/a2a/index.ts +2 -0
- package/src/agent/production-agent.ts +6 -1
- package/src/agent/run-manager.ts +37 -0
- package/src/agent/run-store.ts +18 -0
- package/src/client/MultiTabAssistantChat.tsx +75 -43
- package/src/client/agent-chat.ts +19 -1
- package/src/client/chat/tool-call-display.tsx +25 -0
- package/src/client/resources/mcp-integration-catalog.ts +23 -0
- package/src/client/settings/AgentsSection.tsx +565 -71
- package/src/client/settings/SecretsSection.tsx +71 -36
- package/src/client/use-chat-models.ts +54 -37
- package/src/localization/default-messages.ts +11 -0
- package/src/mcp/ask-app-task-handle.ts +183 -0
- package/src/mcp/builtin-tools.ts +146 -34
- package/src/server/agent-capabilities.ts +8 -1
- package/src/server/agent-chat-plugin.ts +17 -0
- package/src/server/agent-discovery.ts +1 -1
- package/src/server/agent-peer-probe.ts +133 -0
- package/src/server/core-routes-plugin.ts +67 -0
- package/src/server/email-template.ts +13 -0
- package/src/server/email.ts +40 -4
- package/src/shared/mcp-embed-headers.ts +4 -0
- package/src/sharing/actions/share-resource.ts +55 -5
- package/src/sharing/registry.ts +41 -1
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +159 -119
|
@@ -36,6 +36,12 @@ export interface RenderEmailArgs {
|
|
|
36
36
|
paragraphs: string[];
|
|
37
37
|
/** Primary call-to-action rendered as a real button. */
|
|
38
38
|
cta?: EmailCta;
|
|
39
|
+
/**
|
|
40
|
+
* Optional trusted HTML injected above the CTA — e.g. a template-owned video
|
|
41
|
+
* thumbnail with a play badge. Injected verbatim, so only pass markup built
|
|
42
|
+
* by app/template code (never raw user input), and escape any dynamic values.
|
|
43
|
+
*/
|
|
44
|
+
heroHtml?: string;
|
|
39
45
|
/** Small muted text under the CTA (e.g. expiry note). */
|
|
40
46
|
footer?: string;
|
|
41
47
|
/** Optional app name shown beside the framework logo. */
|
|
@@ -108,6 +114,12 @@ export function renderEmail(args: RenderEmailArgs): RenderedEmail {
|
|
|
108
114
|
const ctaFg = brand ? "#ffffff" : "#0a0a0c";
|
|
109
115
|
const linkColor = brand ?? "#a1a1aa";
|
|
110
116
|
|
|
117
|
+
// Trusted markup supplied by the caller (template code, not user input),
|
|
118
|
+
// injected as-is so a template can own app-specific previews (e.g. a video
|
|
119
|
+
// thumbnail with a play badge). Callers are responsible for escaping any
|
|
120
|
+
// dynamic values they interpolate.
|
|
121
|
+
const heroHtml = args.heroHtml ?? "";
|
|
122
|
+
|
|
111
123
|
const paragraphsHtml = args.paragraphs
|
|
112
124
|
.map(
|
|
113
125
|
(p) =>
|
|
@@ -174,6 +186,7 @@ export function renderEmail(args: RenderEmailArgs): RenderedEmail {
|
|
|
174
186
|
${escapeHtml(args.heading)}
|
|
175
187
|
</h1>
|
|
176
188
|
${paragraphsHtml}
|
|
189
|
+
${heroHtml}
|
|
177
190
|
${ctaHtml}
|
|
178
191
|
${footerHtml}
|
|
179
192
|
</td>
|
package/src/server/email.ts
CHANGED
|
@@ -30,6 +30,13 @@ export interface SendEmailArgs {
|
|
|
30
30
|
html: string;
|
|
31
31
|
text?: string;
|
|
32
32
|
from?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Display-name-only override. Keeps the configured (domain-verified) sending
|
|
35
|
+
* address and just changes the name shown to the recipient, e.g.
|
|
36
|
+
* "Alice via Clips". Ignored when `from` is set. Prefer this over `from` for
|
|
37
|
+
* per-user senders: putting a user's own address in `From` breaks SPF/DKIM.
|
|
38
|
+
*/
|
|
39
|
+
fromName?: string;
|
|
33
40
|
cc?: string | string[];
|
|
34
41
|
replyTo?: string;
|
|
35
42
|
inReplyTo?: string;
|
|
@@ -110,9 +117,14 @@ export async function getEmailProvider(): Promise<EmailProvider> {
|
|
|
110
117
|
function getFromAddress(
|
|
111
118
|
config: EmailTransportConfig,
|
|
112
119
|
override?: string,
|
|
120
|
+
fromName?: string,
|
|
113
121
|
): string {
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (override) return override;
|
|
123
|
+
const base = config.from ?? defaultFromAddress(config);
|
|
124
|
+
return fromName ? withDisplayName(base, fromName) : base;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function defaultFromAddress(config: EmailTransportConfig): string {
|
|
116
128
|
// Resend lets unverified accounts send from its sandbox domain; SendGrid
|
|
117
129
|
// does not, so falling back there would cause silent 403s at runtime.
|
|
118
130
|
if (config.provider === "sendgrid") {
|
|
@@ -123,6 +135,21 @@ function getFromAddress(
|
|
|
123
135
|
return "Agent Native <onboarding@resend.dev>";
|
|
124
136
|
}
|
|
125
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Swap the display name while keeping the verified address. The name is
|
|
140
|
+
* sanitized and quoted because it lands in a header: CR/LF would allow header
|
|
141
|
+
* injection, and quotes/angle brackets would break address parsing.
|
|
142
|
+
*/
|
|
143
|
+
function withDisplayName(from: string, name: string): string {
|
|
144
|
+
const safe = name
|
|
145
|
+
.replace(/[\r\n"<>\\]/g, " ")
|
|
146
|
+
.replace(/\s+/g, " ")
|
|
147
|
+
.trim();
|
|
148
|
+
if (!safe) return from;
|
|
149
|
+
const address = from.match(/<([^>]+)>/)?.[1]?.trim() ?? from.trim();
|
|
150
|
+
return `"${safe}" <${address}>`;
|
|
151
|
+
}
|
|
152
|
+
|
|
126
153
|
async function sendEmailWithSignal(
|
|
127
154
|
args: SendEmailArgs,
|
|
128
155
|
signal?: AbortSignal,
|
|
@@ -130,7 +157,7 @@ async function sendEmailWithSignal(
|
|
|
130
157
|
const config = await resolveEmailTransport();
|
|
131
158
|
signal?.throwIfAborted();
|
|
132
159
|
const provider = config.provider;
|
|
133
|
-
const from = getFromAddress(config, args.from);
|
|
160
|
+
const from = getFromAddress(config, args.from, args.fromName);
|
|
134
161
|
const attachments = resolveAttachments(args);
|
|
135
162
|
|
|
136
163
|
if (provider === "resend") {
|
|
@@ -270,10 +297,19 @@ export async function sendEmail(args: SendEmailArgs): Promise<void> {
|
|
|
270
297
|
|
|
271
298
|
function parseSendGridFrom(from: string): { email: string; name?: string } {
|
|
272
299
|
const m = from.match(/^\s*(.*?)\s*<(.+)>\s*$/);
|
|
273
|
-
if (m && m[2]) return { name: m[1]
|
|
300
|
+
if (m && m[2]) return { name: unquoteDisplayName(m[1]), email: m[2] };
|
|
274
301
|
return { email: from.trim() };
|
|
275
302
|
}
|
|
276
303
|
|
|
304
|
+
function unquoteDisplayName(name: string): string | undefined {
|
|
305
|
+
const trimmed = name.trim();
|
|
306
|
+
const unquoted =
|
|
307
|
+
trimmed.startsWith('"') && trimmed.endsWith('"')
|
|
308
|
+
? trimmed.slice(1, -1).replace(/\\(.)/g, "$1")
|
|
309
|
+
: trimmed;
|
|
310
|
+
return unquoted || undefined;
|
|
311
|
+
}
|
|
312
|
+
|
|
277
313
|
function stripHtml(html: string): string {
|
|
278
314
|
return html
|
|
279
315
|
.replace(/<br\s*\/?>/gi, "\n")
|
|
@@ -134,9 +134,13 @@ export function shouldAllowMcpEmbedCredentials(
|
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// These paths are served straight off the CDN, so the security-headers h3
|
|
138
|
+
// middleware never runs for them — anything it sets that must also hold for
|
|
139
|
+
// static assets has to be repeated here.
|
|
137
140
|
export const MCP_EMBED_STATIC_ASSET_HEADERS = {
|
|
138
141
|
"Access-Control-Allow-Origin": "*",
|
|
139
142
|
"Cross-Origin-Resource-Policy": "cross-origin",
|
|
143
|
+
"X-Content-Type-Options": "nosniff",
|
|
140
144
|
} as const;
|
|
141
145
|
|
|
142
146
|
const STATIC_ASSET_PATTERNS = [
|
|
@@ -8,6 +8,7 @@ import { renderEmail, emailStrong } from "../../server/email-template.js";
|
|
|
8
8
|
import { sendEmail, isEmailConfigured } from "../../server/email.js";
|
|
9
9
|
import { invalidateCollabAccessCache } from "../../server/poll.js";
|
|
10
10
|
import { getRequestUserEmail } from "../../server/request-context.js";
|
|
11
|
+
import { getUserProfile } from "../../user-profile/store.js";
|
|
11
12
|
import { assertAccess, ForbiddenError } from "../access.js";
|
|
12
13
|
import { requireShareableResource } from "../registry.js";
|
|
13
14
|
import {
|
|
@@ -298,10 +299,9 @@ export default defineAction({
|
|
|
298
299
|
const appName =
|
|
299
300
|
process.env.APP_NAME || process.env.VITE_APP_NAME || "Agent Native";
|
|
300
301
|
let brandLogoUrl: string | undefined;
|
|
301
|
-
if (reg.
|
|
302
|
+
if (reg.getLogoUrl) {
|
|
302
303
|
try {
|
|
303
|
-
brandLogoUrl =
|
|
304
|
-
(await reg.getShareEmailLogoUrl(resource)) ?? undefined;
|
|
304
|
+
brandLogoUrl = (await reg.getLogoUrl(resource)) ?? undefined;
|
|
305
305
|
} catch (err) {
|
|
306
306
|
console.error(
|
|
307
307
|
"[share-resource] brand logo resolver failed; using default logo:",
|
|
@@ -309,9 +309,51 @@ export default defineAction({
|
|
|
309
309
|
);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
+
let brandName = appName;
|
|
313
|
+
if (reg.getBrandName) {
|
|
314
|
+
try {
|
|
315
|
+
brandName = (await reg.getBrandName(resource))?.trim() || appName;
|
|
316
|
+
} catch (err) {
|
|
317
|
+
console.error(
|
|
318
|
+
"[share-resource] brand name resolver failed; using app name:",
|
|
319
|
+
err,
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
let fromName: string | undefined;
|
|
324
|
+
let replyTo: string | undefined;
|
|
325
|
+
if (reg.getSender) {
|
|
326
|
+
try {
|
|
327
|
+
const sender = await reg.getSender(resource, {
|
|
328
|
+
sender: await getUserProfile(actor),
|
|
329
|
+
});
|
|
330
|
+
fromName = sender?.fromName?.trim() || undefined;
|
|
331
|
+
replyTo = sender?.replyTo?.trim() || undefined;
|
|
332
|
+
} catch (err) {
|
|
333
|
+
console.error(
|
|
334
|
+
"[share-resource] sender resolver failed; using default sender:",
|
|
335
|
+
err,
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
let heroHtml: string | undefined;
|
|
340
|
+
if (reg.getHeroHtml) {
|
|
341
|
+
try {
|
|
342
|
+
heroHtml =
|
|
343
|
+
(await reg.getHeroHtml(resource, {
|
|
344
|
+
href: notificationUrl,
|
|
345
|
+
alt: resourceTitle,
|
|
346
|
+
})) ?? undefined;
|
|
347
|
+
} catch (err) {
|
|
348
|
+
console.error(
|
|
349
|
+
"[share-resource] hero html resolver failed; omitting preview:",
|
|
350
|
+
err,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
312
354
|
const subject = `${actor} shared "${resourceTitle}" with you on ${appName}`;
|
|
313
355
|
const { html, text } = renderEmail({
|
|
314
|
-
brandName
|
|
356
|
+
brandName,
|
|
315
357
|
brandLogoUrl,
|
|
316
358
|
preheader: subject,
|
|
317
359
|
heading: "You've been given access",
|
|
@@ -319,10 +361,18 @@ export default defineAction({
|
|
|
319
361
|
`${emailStrong(actor)} has shared the ${reg.displayName} ${emailStrong(resourceTitle)} with you as a ${emailStrong(args.role)}.`,
|
|
320
362
|
`Use the button below to open it. If prompted, sign in with ${emailStrong(principalId)}.`,
|
|
321
363
|
],
|
|
364
|
+
heroHtml,
|
|
322
365
|
cta: { label: `Open ${reg.displayName}`, url: notificationUrl },
|
|
323
366
|
footer: `You received this because ${actor} granted you ${args.role} access.`,
|
|
324
367
|
});
|
|
325
|
-
await sendEmail({
|
|
368
|
+
await sendEmail({
|
|
369
|
+
to: principalId,
|
|
370
|
+
subject,
|
|
371
|
+
html,
|
|
372
|
+
text,
|
|
373
|
+
fromName,
|
|
374
|
+
replyTo,
|
|
375
|
+
});
|
|
326
376
|
} catch (err) {
|
|
327
377
|
console.error(
|
|
328
378
|
"[share-resource] failed to send share notification:",
|
package/src/sharing/registry.ts
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
* });
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
import type { UserProfile } from "../user-profile/shared.js";
|
|
21
|
+
|
|
20
22
|
export interface ShareableResourceRegistration {
|
|
21
23
|
/** Stable identifier used across actions, UI, and analytics. e.g. "document". */
|
|
22
24
|
type: string;
|
|
@@ -42,8 +44,46 @@ export interface ShareableResourceRegistration {
|
|
|
42
44
|
* (e.g. the sharing org's own logo), or undefined to fall back. Receives the
|
|
43
45
|
* resource row being shared so the template can scope the logo to its org.
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
getLogoUrl?: (
|
|
48
|
+
resource: any,
|
|
49
|
+
) => string | undefined | Promise<string | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional resolver for the brand name shown beside the logo in the
|
|
52
|
+
* share-notification email header. Return a display name (e.g. the sharing
|
|
53
|
+
* org's name) to override the app name, or undefined to keep the default.
|
|
54
|
+
* Receives the resource row being shared.
|
|
55
|
+
*/
|
|
56
|
+
getBrandName?: (
|
|
57
|
+
resource: any,
|
|
58
|
+
) => string | undefined | Promise<string | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Optional resolver for who the share-notification email appears to come
|
|
61
|
+
* from. `fromName` changes only the display name and keeps the configured,
|
|
62
|
+
* domain-verified sending address (e.g. "Alice via Clips"); `replyTo` routes
|
|
63
|
+
* replies to the sharer. `ctx.sender` is the account doing the sharing, so the
|
|
64
|
+
* template decides how to present them (name, email, avatar).
|
|
65
|
+
*
|
|
66
|
+
* Do not put a user's address in the sending address itself — SPF/DKIM sign
|
|
67
|
+
* the app's domain, so recipients would bounce or spam-filter it.
|
|
68
|
+
*/
|
|
69
|
+
getSender?: (
|
|
70
|
+
resource: any,
|
|
71
|
+
ctx: { sender: UserProfile },
|
|
72
|
+
) =>
|
|
73
|
+
| { fromName?: string; replyTo?: string }
|
|
74
|
+
| undefined
|
|
75
|
+
| Promise<{ fromName?: string; replyTo?: string } | undefined>;
|
|
76
|
+
/**
|
|
77
|
+
* Optional resolver for a preview block shown above the CTA in the
|
|
78
|
+
* share-notification email — e.g. a recording thumbnail with a play badge.
|
|
79
|
+
* Return trusted HTML (built by template code, dynamic values escaped) that
|
|
80
|
+
* is injected verbatim, or undefined to omit it. `ctx.href` is the resolved
|
|
81
|
+
* link to the resource; `ctx.alt` is its title. The template owns the entire
|
|
82
|
+
* preview markup so the generic share action stays app-agnostic.
|
|
83
|
+
*/
|
|
84
|
+
getHeroHtml?: (
|
|
46
85
|
resource: any,
|
|
86
|
+
ctx: { href: string; alt?: string },
|
|
47
87
|
) => string | undefined | Promise<string | undefined>;
|
|
48
88
|
/**
|
|
49
89
|
* Drizzle DB accessor from the template's server/db/index.ts. Required —
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: a2a-protocol
|
|
3
3
|
description: >-
|
|
4
|
-
How
|
|
5
|
-
Use when
|
|
6
|
-
|
|
4
|
+
How agent-native apps discover, authenticate with, and call each other over
|
|
5
|
+
A2A. Use when connecting one app to another, debugging a remote agent that
|
|
6
|
+
won't authenticate, exposing skills to peers, or calling agents from scripts.
|
|
7
7
|
scope: dev
|
|
8
8
|
metadata:
|
|
9
9
|
internal: true
|
|
@@ -13,110 +13,155 @@ metadata:
|
|
|
13
13
|
|
|
14
14
|
## Rule
|
|
15
15
|
|
|
16
|
-
Agents
|
|
16
|
+
Agents call other agents over A2A, a JSON-RPC protocol for discovery and
|
|
17
|
+
delegation. Use it when work belongs to a different agent entirely — not the
|
|
18
|
+
local agent chat.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Connecting app A to app B is two independent things, and both must be true:
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
1. **B is registered on A** as a `remote-agents/<id>.json` resource.
|
|
23
|
+
2. **A and B share a secret**, so A's signed JWT verifies on B.
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
Neither is a code change, and neither is symmetric. Registering B on A does not
|
|
26
|
+
let B call A.
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
## A2A is already mounted
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import { mountA2A } from "@agent-native/core/a2a";
|
|
29
|
-
|
|
30
|
-
export default defineNitroPlugin((nitro) => {
|
|
31
|
-
const app = nitro.h3App;
|
|
32
|
-
|
|
33
|
-
mountA2A(app, {
|
|
34
|
-
name: "Analytics Agent",
|
|
35
|
-
description: "Queries analytics data across providers",
|
|
36
|
-
version: "1.0.0",
|
|
37
|
-
skills: [
|
|
38
|
-
{
|
|
39
|
-
id: "query-data",
|
|
40
|
-
name: "Query Data",
|
|
41
|
-
description: "Run analytics queries across connected data sources",
|
|
42
|
-
tags: ["analytics", "data"],
|
|
43
|
-
examples: ["What were last week's signups?", "Show conversion rates"],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
apiKeyEnv: "A2A_API_KEY", // env var holding the bearer token
|
|
47
|
-
streaming: true, // enable message/stream method
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
This mounts the agent-native A2A endpoints:
|
|
53
|
-
|
|
54
|
-
- `GET /.well-known/agent-card.json` — public agent discovery (no auth required)
|
|
55
|
-
- `POST /_agent-native/a2a` — primary JSON-RPC endpoint (bearer token auth required)
|
|
30
|
+
`createAgentChatPlugin` calls `mountA2A` for every app, so a generated app
|
|
31
|
+
already serves:
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`/_agent-native/a2a` endpoint.
|
|
33
|
+
- `GET /.well-known/agent-card.json` — public discovery, never authenticated
|
|
34
|
+
- `POST /_agent-native/a2a` — JSON-RPC, authenticated
|
|
60
35
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
interface A2AConfig {
|
|
65
|
-
name: string; // agent display name
|
|
66
|
-
description: string; // what this agent does
|
|
67
|
-
version?: string; // semver version (default: "1.0.0")
|
|
68
|
-
skills: AgentSkill[]; // capabilities this agent exposes
|
|
69
|
-
handler?: A2AHandler; // custom message handler
|
|
70
|
-
apiKeyEnv?: string; // env var name for bearer token auth
|
|
71
|
-
streaming?: boolean; // enable streaming responses
|
|
72
|
-
}
|
|
36
|
+
Do not add a `mountA2A` server plugin to enable A2A; it is on. Hand-mounting is
|
|
37
|
+
only for a bespoke card or a custom handler (see **Custom mount** below).
|
|
73
38
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
name: string; // human-readable name
|
|
77
|
-
description: string; // what this skill does
|
|
78
|
-
tags?: string[]; // categorization tags
|
|
79
|
-
examples?: string[]; // example prompts
|
|
80
|
-
}
|
|
81
|
-
```
|
|
39
|
+
The client falls back to `POST /a2a` for external peers that only expose that
|
|
40
|
+
path. New agent-native apps should call `/_agent-native/a2a`.
|
|
82
41
|
|
|
83
|
-
##
|
|
42
|
+
## Registering a remote agent
|
|
84
43
|
|
|
85
|
-
|
|
44
|
+
A remote agent is **a row in the resources table, not a file on disk**. Path
|
|
45
|
+
`remote-agents/<id>.json`, owner `SHARED_OWNER`, content:
|
|
86
46
|
|
|
87
47
|
```json
|
|
88
48
|
{
|
|
89
|
-
"
|
|
49
|
+
"id": "analytics",
|
|
50
|
+
"name": "Analytics",
|
|
90
51
|
"description": "Queries analytics data across providers",
|
|
91
52
|
"url": "https://analytics.example.com",
|
|
92
|
-
"
|
|
93
|
-
"protocolVersion": "0.3",
|
|
94
|
-
"capabilities": { "streaming": true },
|
|
95
|
-
"skills": [
|
|
96
|
-
{
|
|
97
|
-
"id": "query-data",
|
|
98
|
-
"name": "Query Data",
|
|
99
|
-
"description": "Run analytics queries across connected data sources"
|
|
100
|
-
}
|
|
101
|
-
]
|
|
53
|
+
"color": "#6B7280"
|
|
102
54
|
}
|
|
103
55
|
```
|
|
104
56
|
|
|
105
|
-
|
|
57
|
+
`url` is the only required field. `parseRemoteAgentManifest` accepts **only**
|
|
58
|
+
these five keys — there is no `apiKey`, `env`, `skills`, or `token` field, and
|
|
59
|
+
anything else is silently dropped.
|
|
60
|
+
|
|
61
|
+
Four ways to create it, all writing the same row:
|
|
62
|
+
|
|
63
|
+
| Surface | Where |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| Settings → Manage agent → Connected Agents (A2A) | any app with the settings panel |
|
|
66
|
+
| Agent page → Connections | apps mounting `AgentTabsPage` |
|
|
67
|
+
| Dispatch → Agents → Add external agent | workspace dispatch |
|
|
68
|
+
| The agent itself | `resources` tool, `action: "write"`, `--scope shared` |
|
|
69
|
+
|
|
70
|
+
The last one matters for template apps with no Code tab: "connect me to
|
|
71
|
+
https://analytics.example.com" is a complete instruction. `remote-agents/` is
|
|
72
|
+
whitelisted as a durable control path, so the write is workspace-scoped, and it
|
|
73
|
+
takes effect on the next `discoverAgents()` call with no restart.
|
|
74
|
+
|
|
75
|
+
First-party templates are seeded automatically and overlaid on top of manifests,
|
|
76
|
+
so `Mail`, `Calendar`, and friends appear without registration. In dev they
|
|
77
|
+
resolve to `http://localhost:<devPort>`; a manifest pointing at localhost is
|
|
78
|
+
ignored in production.
|
|
79
|
+
|
|
80
|
+
`call-agent` also accepts a raw URL, which skips registration entirely — useful
|
|
81
|
+
for one-off calls, useless for @-mentions.
|
|
82
|
+
|
|
83
|
+
### Checking a peer
|
|
84
|
+
|
|
85
|
+
`GET /_agent-native/agents/probe?url=<base>` reads the peer's card and makes one
|
|
86
|
+
authenticated no-op call, returning `reachable` and `authorized` as independent
|
|
87
|
+
fields. Omit `url` to probe every registered peer. Reachable-but-unauthorized is
|
|
88
|
+
the failure worth looking for: local dev runs the receiver unauthenticated, so a
|
|
89
|
+
mismatched secret only surfaces after deploy. The Connected Agents settings
|
|
90
|
+
section calls this on add and on open.
|
|
91
|
+
|
|
92
|
+
## Authentication
|
|
93
|
+
|
|
94
|
+
A2A authenticates with a **short-lived JWT the caller signs**, not a stored
|
|
95
|
+
bearer key. `Authorization: Bearer <jwt>`; claims carry the caller's email and
|
|
96
|
+
org domain; HS256; 15-minute default TTL. There is no per-peer API key
|
|
97
|
+
anywhere in the system, which is why the manifest has no field for one.
|
|
98
|
+
|
|
99
|
+
Two secrets can sign it:
|
|
100
|
+
|
|
101
|
+
| Secret | Scope | How it is set |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `A2A_SECRET` | whole deployment | env var, **never auto-generated** |
|
|
104
|
+
| org `a2a_secret` | one organization | auto-generated on org creation; Team page UI |
|
|
105
|
+
|
|
106
|
+
The org secret is the managed path: **Team page → A2A secret** (owner only)
|
|
107
|
+
reveals, copies, regenerates, and pushes it to every discovered peer. Rotation
|
|
108
|
+
is tolerated — the caller tries both secrets in order and sticks to whichever
|
|
109
|
+
worked.
|
|
110
|
+
|
|
111
|
+
`A2A_SECRET` is the deploy-level path. `workspace-deploy` refuses a production
|
|
112
|
+
workspace deploy without it and prints the generator command. Peers that must
|
|
113
|
+
trust each other need the *same* value on both sides.
|
|
114
|
+
|
|
115
|
+
With no secret configured at all:
|
|
116
|
+
|
|
117
|
+
| Runtime | Result |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| local dev | open, one-time console warning |
|
|
120
|
+
| production | `503` — "A2A authentication not configured" |
|
|
121
|
+
| production, secret set, bad/absent token | `401` |
|
|
122
|
+
|
|
123
|
+
"Production" is detected broadly (NODE_ENV, Netlify, Lambda, Vercel, Render,
|
|
124
|
+
Fly, Cloud Run, …) and unrecognized deployed hosts fail closed unless the
|
|
125
|
+
request is genuine loopback or `A2A_ALLOW_UNSIGNED_INTERNAL=1`.
|
|
126
|
+
|
|
127
|
+
`A2AConfig.apiKeyEnv` still exists for static bearer auth against non-agent-native
|
|
128
|
+
peers, but the framework's own mount never sets it. Do not reach for it when
|
|
129
|
+
debugging a connection between two agent-native apps — the answer there is
|
|
130
|
+
always the shared secret.
|
|
131
|
+
|
|
132
|
+
Never hardcode either secret in source, docs, prompts, app state, action
|
|
133
|
+
descriptions, client bundles, or examples. Read them from runtime config; never
|
|
134
|
+
log or return them.
|
|
135
|
+
|
|
136
|
+
## Advertising what this agent can do
|
|
137
|
+
|
|
138
|
+
Card `skills` are derived from actions marked `publicAgent`. An app that marks
|
|
139
|
+
none publishes `"skills": []` and peers cannot see what it offers, even though
|
|
140
|
+
delegation still works. Mark the actions a peer should be able to see and
|
|
141
|
+
invoke directly; leave the rest internal.
|
|
142
|
+
|
|
143
|
+
## Calling another agent
|
|
106
144
|
|
|
107
145
|
### Simple: `callAgent()` (text in, text out)
|
|
108
146
|
|
|
109
147
|
```ts
|
|
110
|
-
import { callAgent } from "@agent-native/core/a2a";
|
|
148
|
+
import { callAgent, resolveA2ACallerAuth } from "@agent-native/core/a2a";
|
|
111
149
|
|
|
150
|
+
const auth = await resolveA2ACallerAuth();
|
|
112
151
|
const answer = await callAgent(
|
|
113
152
|
"https://analytics.example.com",
|
|
114
153
|
"What were last week's signups?",
|
|
115
|
-
|
|
154
|
+
auth,
|
|
116
155
|
);
|
|
117
156
|
// answer is a plain string
|
|
118
157
|
```
|
|
119
158
|
|
|
159
|
+
`callAgent` signs nothing on its own — with no `userEmail`/`orgSecret` in opts
|
|
160
|
+
it calls **unauthenticated**, which silently works in local dev and 401s in
|
|
161
|
+
production. `resolveA2ACallerAuth()` pulls the authenticated email, org domain,
|
|
162
|
+
and org secret out of request context; pass them explicitly only from CLI or
|
|
163
|
+
cron, where there is no request.
|
|
164
|
+
|
|
120
165
|
### Fast bounded read: `invokeAgentAction()`
|
|
121
166
|
|
|
122
167
|
When the caller knows the exact receiver-owned read action and arguments, skip
|
|
@@ -168,12 +213,13 @@ action arguments or results.
|
|
|
168
213
|
### Advanced: `A2AClient` (full control)
|
|
169
214
|
|
|
170
215
|
```ts
|
|
171
|
-
import { A2AClient } from "@agent-native/core/a2a";
|
|
216
|
+
import { A2AClient, resolveA2ACallerAuth } from "@agent-native/core/a2a";
|
|
172
217
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
218
|
+
// The second argument is the bearer token itself, not a signing secret.
|
|
219
|
+
const { apiKey, apiKeyFallbacks } = await resolveA2ACallerAuth();
|
|
220
|
+
const client = new A2AClient("https://analytics.example.com", apiKey, {
|
|
221
|
+
fallbackApiKeys: apiKeyFallbacks,
|
|
222
|
+
});
|
|
177
223
|
|
|
178
224
|
// Discover agent capabilities
|
|
179
225
|
const card = await client.getAgentCard();
|
|
@@ -264,19 +310,6 @@ submitted → working → completed
|
|
|
264
310
|
- **canceled** — task was canceled via `tasks/cancel`
|
|
265
311
|
- **input-required** — agent needs more information from the caller
|
|
266
312
|
|
|
267
|
-
## Security
|
|
268
|
-
|
|
269
|
-
A2A uses bearer token auth. The server reads the token from the environment variable specified by `apiKeyEnv`:
|
|
270
|
-
|
|
271
|
-
- Set `A2A_API_KEY=<A2A_API_KEY_VALUE>` in the server's deployment environment
|
|
272
|
-
- Callers pass it as `Authorization: Bearer <A2A_API_KEY_VALUE>`
|
|
273
|
-
- The agent card endpoint (`/.well-known/agent-card.json`) is public — no auth needed for discovery
|
|
274
|
-
|
|
275
|
-
Never hardcode the bearer token in source, docs, prompts, app state, action
|
|
276
|
-
descriptions, client bundles, or examples. A2A tokens are deploy-level secrets
|
|
277
|
-
unless a specific app designs a scoped credential flow; read them from secure
|
|
278
|
-
runtime configuration and never log or return them.
|
|
279
|
-
|
|
280
313
|
## Message Parts
|
|
281
314
|
|
|
282
315
|
Messages contain typed parts:
|
|
@@ -287,34 +320,38 @@ Messages contain typed parts:
|
|
|
287
320
|
| `file` | `{ type: "file", file: { ... } }` | Files (bytes or URI) |
|
|
288
321
|
| `data` | `{ type: "data", data: { ... } }` | Structured JSON data |
|
|
289
322
|
|
|
290
|
-
##
|
|
323
|
+
## Custom mount
|
|
291
324
|
|
|
292
|
-
|
|
325
|
+
Only when the default card is wrong for the app — a curated skill list, a
|
|
326
|
+
non-agent handler, or static bearer auth against an external peer:
|
|
293
327
|
|
|
294
328
|
```ts
|
|
295
|
-
//
|
|
296
|
-
import {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
mode: "compose",
|
|
329
|
+
// server/plugins/a2a.ts
|
|
330
|
+
import { mountA2A } from "@agent-native/core/a2a";
|
|
331
|
+
|
|
332
|
+
export default defineNitroPlugin((nitro) => {
|
|
333
|
+
mountA2A(nitro, {
|
|
334
|
+
appId: "analytics",
|
|
335
|
+
name: "Analytics Agent",
|
|
336
|
+
description: "Queries analytics data across providers",
|
|
337
|
+
skills: [
|
|
338
|
+
{
|
|
339
|
+
id: "query-data",
|
|
340
|
+
name: "Query Data",
|
|
341
|
+
description: "Run analytics queries across connected data sources",
|
|
342
|
+
tags: ["analytics", "data"],
|
|
343
|
+
examples: ["What were last week's signups?", "Show conversion rates"],
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
streaming: true,
|
|
314
347
|
});
|
|
315
|
-
}
|
|
348
|
+
});
|
|
316
349
|
```
|
|
317
350
|
|
|
351
|
+
Config also carries `handler`, `publicSkillsOnly`, `durableBackgroundRuns`,
|
|
352
|
+
`executeReadOnlyAction`, `executeApproval`, and `apiKeyEnv`. See `A2AConfig` in
|
|
353
|
+
`@agent-native/core/a2a` for the full shape.
|
|
354
|
+
|
|
318
355
|
## All Types
|
|
319
356
|
|
|
320
357
|
All types are exported from `@agent-native/core/a2a`:
|
|
@@ -345,5 +382,8 @@ import type {
|
|
|
345
382
|
## Related Skills
|
|
346
383
|
|
|
347
384
|
- **delegate-to-agent** — For work the local agent handles. Use A2A when the work goes to a different agent.
|
|
348
|
-
- **
|
|
349
|
-
- **
|
|
385
|
+
- **authentication** — Org creation, membership, and where the org secret lives.
|
|
386
|
+
- **actions** — A2A calls typically happen inside actions; `publicAgent` marks what peers can see.
|
|
387
|
+
- **storing-data** — Results from A2A calls are stored in SQL like any other data.
|
|
388
|
+
</content>
|
|
389
|
+
</invoke>
|