@agent-native/core 0.114.3 → 0.114.5
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 +1 -1
- package/corpus/core/CHANGELOG.md +14 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/artifact-response.ts +42 -16
- package/corpus/core/src/a2a/client.ts +4 -0
- package/corpus/core/src/a2a/handlers.ts +133 -2
- package/corpus/core/src/a2a/index.ts +1 -0
- package/corpus/core/src/a2a/types.ts +14 -0
- package/corpus/core/src/integrations/index.ts +6 -0
- package/corpus/core/src/integrations/pending-tasks-store.ts +89 -0
- package/corpus/core/src/integrations/webhook-handler.ts +17 -7
- package/corpus/core/src/scripts/call-agent.ts +54 -10
- package/corpus/core/src/server/agent-discovery.ts +22 -0
- package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +11 -1
- package/corpus/templates/clips/AGENTS.md +14 -4
- package/corpus/templates/clips/actions/update-meeting.ts +13 -3
- package/corpus/templates/clips/actions/view-screen.ts +1 -0
- package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +2 -1
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +96 -4
- package/corpus/templates/clips/app/i18n/en-US.ts +11 -0
- package/corpus/templates/clips/app/lib/public-meeting.ts +85 -0
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +11 -1
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +6 -7
- package/corpus/templates/clips/app/routes/share.meeting.$meetingId.tsx +241 -135
- package/corpus/templates/clips/changelog/2026-07-20-meeting-share-links-can-include-the-full-transcript-with-an-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-recording-retries-the-default-mac-microphone-when-a-saved-in.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-shared-clips-now-tell-agents-to-wait-while-uploads-and-trans.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/meeting-join-url.ts +1 -33
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +65 -2
- package/corpus/templates/clips/server/db/schema.ts +3 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +31 -21
- package/corpus/templates/clips/server/plugins/auth.ts +1 -0
- package/corpus/templates/clips/server/plugins/db.ts +6 -0
- package/corpus/templates/clips/server/routes/api/agent-transcript.json.get.ts +13 -3
- package/corpus/templates/clips/server/routes/api/public-meeting.get.ts +152 -0
- package/corpus/templates/clips/shared/agent-context.ts +60 -0
- package/corpus/templates/clips/shared/meeting-join-url.ts +36 -0
- package/corpus/templates/content/.agents/skills/content/SKILL.md +19 -5
- package/corpus/templates/content/changelog/2026-07-17-slack-created-database-entries-now-record-slack-as-their-sub.md +6 -0
- package/dist/a2a/artifact-response.d.ts +5 -0
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +20 -5
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/a2a/client.d.ts +3 -1
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +2 -0
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +100 -8
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/types.d.ts +12 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +9 -0
- package/dist/integrations/pending-tasks-store.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-store.js +60 -0
- package/dist/integrations/pending-tasks-store.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +13 -7
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +39 -10
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-discovery.d.ts +2 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +19 -0
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +2 -2
- package/src/a2a/artifact-response.ts +42 -16
- package/src/a2a/client.ts +4 -0
- package/src/a2a/handlers.ts +133 -2
- package/src/a2a/index.ts +1 -0
- package/src/a2a/types.ts +14 -0
- package/src/integrations/index.ts +6 -0
- package/src/integrations/pending-tasks-store.ts +89 -0
- package/src/integrations/webhook-handler.ts +17 -7
- package/src/scripts/call-agent.ts +54 -10
- package/src/server/agent-discovery.ts +22 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-discovery.js","sourceRoot":"","sources":["../../src/server/agent-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EACnC,sCAAsC,GAEvC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAiC5E;;;;GAIG;AACH,MAAM,cAAc,GAAiB,SAAS,CAAC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;SACT,CAAC;IAC9B,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,KAAK,EAA4B,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpD,EAAE,EAAE,GAAG,CAAC,EAAE;IACV,IAAI,EAAE,GAAG,CAAC,IAAI;IACd,WAAW,EAAE,GAAG,CAAC,WAAW;IAC5B,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,cAAc;IAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;CACjB,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { TEMPLATES } from \"../cli/templates-meta.js\";\nimport {\n DEFAULT_WORKSPACE_APP_AUDIENCE,\n normalizeWorkspaceAppAudience,\n normalizeWorkspaceAppPathList,\n workspaceAppAudienceFromPackageJson,\n workspaceAppRouteAccessFromPackageJson,\n type WorkspaceAppAudience,\n} from \"../shared/workspace-app-audience.js\";\nimport { getRequestOrgId, getRequestUserEmail } from \"./request-context.js\";\n\nexport interface DiscoveredAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n}\n\nexport interface WorkspaceAppMetadataOverride {\n name?: string;\n description?: string;\n generated?: boolean;\n sourcePrompt?: string;\n updatedAt?: string;\n updatedBy?: string;\n}\n\nexport interface WorkspaceAppMetadataSettings {\n apps: Record<string, WorkspaceAppMetadataOverride>;\n}\n\ninterface AgentEntry {\n id: string;\n name: string;\n description: string;\n url: string;\n devUrl?: string;\n devPort: number;\n color: string;\n}\n\n/**\n * Built-in agent registry. Derive this from the published CLI metadata so\n * connected-agent discovery stays aligned with first-party template metadata\n * without depending on @agent-native/shared-app-config at runtime.\n */\nconst BUILTIN_AGENTS: AgentEntry[] = TEMPLATES.filter(\n (template) =>\n (!template.hidden || template.defaultAgent) && !!template.prodUrl,\n).map((template) => ({\n id: template.name,\n name: template.label,\n description: template.description ?? template.hint,\n url: template.prodUrl!,\n devUrl: `http://localhost:${template.devPort}`,\n devPort: template.devPort,\n color: template.color,\n}));\n\nconst HIDDEN_FIRST_PARTY_AGENT_IDS = new Set([\n ...TEMPLATES.filter(\n (template) => template.hidden && !template.defaultAgent && template.prodUrl,\n ).map((template) => template.name),\n // Stale resources for removed first-party apps should not reappear as\n // custom remote agents just because the template metadata entry is gone.\n \"calls\",\n \"code\",\n \"issues\",\n \"meeting-notes\",\n \"migration\",\n \"recruiting\",\n \"scheduling\",\n \"voice\",\n \"workbench\",\n]);\n\nfunction normalizeAgentId(id: string): string {\n const normalized = id.trim().toLowerCase();\n if (\n normalized === \"image\" ||\n normalized === \"images\" ||\n normalized === \"asset\"\n ) {\n return \"assets\";\n }\n return normalized;\n}\n\nconst WORKSPACE_APPS_ENV_KEY = \"AGENT_NATIVE_WORKSPACE_APPS_JSON\";\nconst WORKSPACE_APPS_MANIFEST_FILE = \"workspace-apps.json\";\nexport const WORKSPACE_APP_METADATA_SETTINGS_KEY = \"workspace-app-metadata\";\n\nexport interface WorkspaceAppManifestEntry {\n id: string;\n name: string;\n description: string;\n path: string;\n url?: string | null;\n isDispatch?: boolean;\n audience?: WorkspaceAppAudience;\n publicPaths?: string[];\n protectedPaths?: string[];\n}\n\nexport function workspaceAppMetadataSettingsKey(input?: {\n orgId?: string | null;\n userEmail?: string | null;\n}): string | null {\n const orgId = input?.orgId ?? getRequestOrgId() ?? null;\n if (orgId) return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:org:${orgId}`;\n\n const userEmail = input?.userEmail ?? getRequestUserEmail() ?? null;\n if (userEmail)\n return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:user:${userEmail}`;\n\n return null;\n}\n\nfunction cleanOptionalText(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nexport function parseWorkspaceAppMetadataSettings(\n raw: unknown,\n): WorkspaceAppMetadataSettings {\n const record =\n raw && typeof raw === \"object\" && !Array.isArray(raw)\n ? (raw as Record<string, unknown>)\n : {};\n const rawApps =\n record.apps &&\n typeof record.apps === \"object\" &&\n !Array.isArray(record.apps)\n ? (record.apps as Record<string, unknown>)\n : {};\n const apps: Record<string, WorkspaceAppMetadataOverride> = {};\n\n for (const [id, value] of Object.entries(rawApps)) {\n if (!id.trim() || !value || typeof value !== \"object\") continue;\n const item = value as Record<string, unknown>;\n const override: WorkspaceAppMetadataOverride = {};\n const name = cleanOptionalText(item.name);\n const description = cleanOptionalText(item.description);\n const sourcePrompt = cleanOptionalText(item.sourcePrompt);\n const updatedAt = cleanOptionalText(item.updatedAt);\n const updatedBy = cleanOptionalText(item.updatedBy);\n\n if (name) override.name = name;\n if (description) override.description = description;\n if (item.generated === true) override.generated = true;\n if (sourcePrompt) override.sourcePrompt = sourcePrompt;\n if (updatedAt) override.updatedAt = updatedAt;\n if (updatedBy) override.updatedBy = updatedBy;\n\n if (Object.keys(override).length > 0) apps[id.trim()] = override;\n }\n\n return { apps };\n}\n\nexport async function readWorkspaceAppMetadataSettings(): Promise<WorkspaceAppMetadataSettings> {\n const key = workspaceAppMetadataSettingsKey();\n if (!key) return { apps: {} };\n\n try {\n const { getSetting } = await import(\"../settings/index.js\");\n return parseWorkspaceAppMetadataSettings(await getSetting(key));\n } catch {\n return { apps: {} };\n }\n}\n\nexport async function writeWorkspaceAppMetadataOverride(input: {\n appId: string;\n name?: string | null;\n description?: string | null;\n generated?: boolean;\n sourcePrompt?: string | null;\n updatedBy?: string | null;\n}): Promise<WorkspaceAppMetadataSettings> {\n const key = workspaceAppMetadataSettingsKey();\n if (!key) throw new Error(\"no authenticated user\");\n\n const appId = input.appId.trim();\n if (!appId) throw new Error(\"appId is required\");\n\n const { getSetting, putSetting } = await import(\"../settings/index.js\");\n const current = parseWorkspaceAppMetadataSettings(await getSetting(key));\n const existing = current.apps[appId] ?? {};\n const next: WorkspaceAppMetadataOverride = {\n ...existing,\n updatedAt: new Date().toISOString(),\n };\n\n const name = cleanOptionalText(input.name);\n const description = cleanOptionalText(input.description);\n const sourcePrompt = cleanOptionalText(input.sourcePrompt);\n const updatedBy = cleanOptionalText(input.updatedBy);\n\n if (name) next.name = name;\n else delete next.name;\n if (description) next.description = description;\n else delete next.description;\n if (input.generated === true) next.generated = true;\n else if (input.generated === false) delete next.generated;\n if (sourcePrompt) next.sourcePrompt = sourcePrompt;\n if (updatedBy) next.updatedBy = updatedBy;\n\n current.apps[appId] = next;\n await putSetting(key, current as unknown as Record<string, unknown>);\n return current;\n}\n\nexport function applyWorkspaceAppMetadataOverride<\n T extends {\n id: string;\n name: string;\n description?: string | null;\n },\n>(app: T, settings: WorkspaceAppMetadataSettings): T {\n const override = settings.apps[app.id];\n if (!override) return app;\n\n const name = cleanOptionalText(override.name);\n const description = cleanOptionalText(override.description);\n const generated = override.generated === true;\n const shouldApplyName = !!name && !generated;\n const shouldApplyDescription =\n !!description && (!generated || !cleanOptionalText(app.description));\n if (!shouldApplyName && !shouldApplyDescription) return app;\n\n return {\n ...app,\n ...(shouldApplyName ? { name } : {}),\n ...(shouldApplyDescription ? { description } : {}),\n };\n}\n\n/**\n * Resolve the workspace app manifest from the same fallback chain that\n * `discoverWorkspaceAgents` uses: `AGENT_NATIVE_WORKSPACE_APPS_JSON` env →\n * `.agent-native/workspace-apps.json` (or sibling) on disk → live filesystem\n * scan of `apps/<id>/package.json` under the workspace root.\n *\n * Callers (e.g. the dispatch `/dispatch/<appId>` catch-all loader) need this\n * to behave the same in production deploys (which write the manifest file)\n * and during local dev (where new apps appear under `apps/` without an env\n * restart). Reading only the env var would silently downgrade the behavior\n * in both cases.\n */\nexport function loadWorkspaceAppsManifest():\n | WorkspaceAppManifestEntry[]\n | null {\n return (\n readWorkspaceAppsFromEnv() ??\n readWorkspaceAppsFromManifestFile() ??\n readWorkspaceAppsFromFilesystem()\n );\n}\n\nexport function shouldIncludeRemoteAgentManifest(\n manifest: { id?: string | null },\n selfAppId?: string,\n): boolean {\n const id = manifest.id?.trim();\n if (!id) return false;\n const normalizedId = normalizeAgentId(id);\n const normalizedSelfAppId = selfAppId ? normalizeAgentId(selfAppId) : \"\";\n if (normalizedSelfAppId && normalizedId === normalizedSelfAppId) {\n return false;\n }\n return !HIDDEN_FIRST_PARTY_AGENT_IDS.has(normalizedId);\n}\n\n/**\n * Get built-in agents (static, no DB). Used as fallback and for seeding.\n */\nexport function getBuiltinAgents(selfAppId?: string): DiscoveredAgent[] {\n const normalizedSelfAppId = selfAppId ? normalizeAgentId(selfAppId) : \"\";\n return BUILTIN_AGENTS.filter(\n (app) => app.id !== normalizedSelfAppId && app.url,\n ).map((app) => ({\n id: app.id,\n name: app.name,\n description: app.description,\n url: resolveAgentUrl(app),\n color: app.color,\n }));\n}\n\n/**\n * Discover all agents: built-in + custom agents stored as resources.\n * Custom agents override built-in agents with the same ID.\n */\nexport async function discoverAgents(\n selfAppId?: string,\n): Promise<DiscoveredAgent[]> {\n const builtins = getBuiltinAgents(selfAppId);\n const agentsById = new Map<string, DiscoveredAgent>();\n\n // Start with built-ins\n for (const agent of builtins) {\n agentsById.set(agent.id, agent);\n }\n\n // Overlay custom agents from resources\n try {\n const { resourceList, resourceGet, SHARED_OWNER } =\n await import(\"../resources/store.js\");\n\n const { parseRemoteAgentManifest, REMOTE_AGENT_RESOURCE_PREFIXES } =\n await import(\"../resources/metadata.js\");\n\n const resources: Array<{ id: string; path: string }> = [];\n for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {\n resources.push(...(await resourceList(SHARED_OWNER, prefix)));\n }\n\n for (const r of resources) {\n if (!r.path.endsWith(\".json\")) continue;\n try {\n const full = await resourceGet(r.id);\n if (!full) continue;\n const manifest = parseRemoteAgentManifest(full.content, r.path);\n if (!manifest || !shouldIncludeRemoteAgentManifest(manifest, selfAppId))\n continue;\n const manifestId = normalizeAgentId(manifest.id);\n\n // If the resource override carries a localhost URL but we're running\n // in production (e.g. a stale dev-time seed got promoted to the prod\n // DB), fall back to the matching built-in's prod URL instead of\n // letting the override win — otherwise outbound `call-agent` fetches\n // from a serverless function would target localhost and fail with\n // \"fetch failed\" instantly. The override still wins for non-localhost\n // URLs (the supported case for self-hosted custom agents).\n let url = manifest.url;\n const isProduction =\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"production\";\n if (\n isProduction &&\n typeof url === \"string\" &&\n /^https?:\\/\\/(localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0)(:|\\/|$)/.test(url)\n ) {\n const builtin = agentsById.get(manifestId);\n if (builtin?.url) url = builtin.url;\n }\n\n const builtin = agentsById.get(manifestId);\n const isLegacyAssetsManifest =\n manifest.id.trim().toLowerCase() !== manifestId;\n if (isLegacyAssetsManifest && builtin?.url) {\n try {\n if (new URL(url).hostname === \"images.agent-native.com\") {\n url = builtin.url;\n }\n } catch {\n url = builtin.url;\n }\n }\n\n agentsById.set(manifestId, {\n id: manifestId,\n name:\n isLegacyAssetsManifest && builtin?.name\n ? builtin.name\n : manifest.name,\n description: manifest.description || \"\",\n url,\n color: manifest.color || builtin?.color || \"#6B7280\",\n });\n } catch {\n // Skip unreadable resources\n }\n }\n } catch {\n // Resources not available — use built-ins only\n }\n\n // Overlay sibling workspace apps last so same-origin workspaces prefer the\n // app mounted in this workspace over the public template with the same id.\n for (const agent of await discoverWorkspaceAgents(selfAppId)) {\n agentsById.set(agent.id, agent);\n }\n\n return Array.from(agentsById.values());\n}\n\n/**\n * Look up a single agent by ID or name (case-insensitive).\n */\nexport async function findAgent(\n idOrName: string,\n selfAppId?: string,\n): Promise<DiscoveredAgent | undefined> {\n const lower = normalizeAgentId(idOrName);\n const agents = await discoverAgents(selfAppId);\n return agents.find((a) => a.id === lower || a.name.toLowerCase() === lower);\n}\n\nfunction hostnameFromUrlLike(value: string | undefined): string | null {\n if (!value) return null;\n try {\n return new URL(value).hostname.toLowerCase();\n } catch {\n try {\n return new URL(`http://${value}`).hostname.toLowerCase();\n } catch {\n return null;\n }\n }\n}\n\nfunction isLoopbackUrl(value: string | undefined): boolean {\n const hostname = hostnameFromUrlLike(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"0.0.0.0\" ||\n hostname === \"::1\"\n );\n}\n\nfunction hasPublicRuntimeUrl(): boolean {\n // Intentionally omit generic `URL` / `DEPLOY_URL` here. Platforms that set\n // those also expose a stronger hosted signal (for example `NETLIFY`), while\n // local shells and unrelated tools can use generic URL vars for other work.\n const keys = [\n \"WORKSPACE_GATEWAY_URL\",\n \"VITE_WORKSPACE_GATEWAY_URL\",\n \"APP_URL\",\n \"WORKSPACE_OAUTH_ORIGIN\",\n \"VITE_WORKSPACE_OAUTH_ORIGIN\",\n \"BETTER_AUTH_URL\",\n \"VITE_BETTER_AUTH_URL\",\n \"VERCEL_URL\",\n \"VERCEL_PROJECT_PRODUCTION_URL\",\n ];\n\n return keys.some((key) => {\n const value = process.env[key];\n return !!value && !isLoopbackUrl(value);\n });\n}\n\nfunction isHostedRuntime(): boolean {\n return (\n process.env.NODE_ENV === \"production\" ||\n !!process.env.NETLIFY ||\n !!process.env.AWS_LAMBDA_FUNCTION_NAME ||\n !!process.env.VERCEL ||\n \"__cf_env\" in globalThis ||\n hasPublicRuntimeUrl()\n );\n}\n\nfunction shouldUseLocalAgentUrls(): boolean {\n return !isHostedRuntime();\n}\n\nfunction resolveAgentUrl(app: AgentEntry): string {\n if (shouldUseLocalAgentUrls()) {\n return app.devUrl || `http://localhost:${app.devPort}`;\n }\n return app.url;\n}\n\nfunction readJson(file: string): any {\n try {\n return JSON.parse(fs.readFileSync(file, \"utf8\"));\n } catch {\n return null;\n }\n}\n\nfunction findWorkspaceRoot(startDir = process.cwd()): string | null {\n let dir = path.resolve(startDir);\n for (let i = 0; i < 20; i++) {\n const pkg = readJson(path.join(dir, \"package.json\"));\n if (typeof pkg?.[\"agent-native\"]?.workspaceCore === \"string\") {\n return dir;\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nfunction titleCase(value: string): string {\n return value\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nfunction parseWorkspaceAppsManifest(\n parsed: any,\n): WorkspaceAppManifestEntry[] | null {\n const rawApps = Array.isArray(parsed?.apps)\n ? parsed.apps\n : Array.isArray(parsed)\n ? parsed\n : null;\n if (!rawApps) return null;\n\n const apps = (rawApps as unknown[])\n .map((entry): WorkspaceAppManifestEntry | null => {\n if (!entry || typeof entry !== \"object\") return null;\n const e = entry as Record<string, unknown>;\n const id = typeof e.id === \"string\" ? e.id.trim() : \"\";\n const pathValue = typeof e.path === \"string\" ? e.path.trim() : \"\";\n if (!id || !pathValue.startsWith(\"/\")) return null;\n return {\n id,\n name:\n typeof e.name === \"string\" && e.name.trim()\n ? e.name.trim()\n : titleCase(id),\n description: typeof e.description === \"string\" ? e.description : \"\",\n path: pathValue,\n url: typeof e.url === \"string\" && e.url.trim() ? e.url.trim() : null,\n isDispatch:\n typeof e.isDispatch === \"boolean\" ? e.isDispatch : id === \"dispatch\",\n audience:\n e.audience === undefined\n ? DEFAULT_WORKSPACE_APP_AUDIENCE\n : normalizeWorkspaceAppAudience(e.audience),\n publicPaths: normalizeWorkspaceAppPathList(e.publicPaths),\n protectedPaths: normalizeWorkspaceAppPathList(e.protectedPaths),\n };\n })\n .filter((app): app is WorkspaceAppManifestEntry => app !== null)\n .sort((a, b) => {\n if (a.id === \"dispatch\") return -1;\n if (b.id === \"dispatch\") return 1;\n return a.name.localeCompare(b.name);\n });\n\n return apps.length ? apps : null;\n}\n\nfunction readWorkspaceAppsFromEnv(): WorkspaceAppManifestEntry[] | null {\n const raw = process.env[WORKSPACE_APPS_ENV_KEY];\n if (!raw) return null;\n try {\n return parseWorkspaceAppsManifest(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\nfunction workspaceAppsManifestCandidates(): string[] {\n const candidates: string[] = [];\n try {\n candidates.push(\n path.join(process.cwd(), \".agent-native\", WORKSPACE_APPS_MANIFEST_FILE),\n path.join(process.cwd(), WORKSPACE_APPS_MANIFEST_FILE),\n );\n } catch {\n // Some edge runtimes do not expose process.cwd().\n }\n try {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n candidates.push(\n path.join(moduleDir, \".agent-native\", WORKSPACE_APPS_MANIFEST_FILE),\n path.join(moduleDir, WORKSPACE_APPS_MANIFEST_FILE),\n );\n } catch {\n // Some edge runtimes expose non-file module URLs. The env manifest still\n // works there, so skip file-relative candidates.\n }\n return candidates;\n}\n\nfunction readWorkspaceAppsFromManifestFile():\n | WorkspaceAppManifestEntry[]\n | null {\n for (const file of workspaceAppsManifestCandidates()) {\n if (!fs.existsSync(file)) continue;\n const apps = parseWorkspaceAppsManifest(readJson(file));\n if (apps) return apps;\n }\n return null;\n}\n\nfunction readWorkspaceAppsFromFilesystem(): WorkspaceAppManifestEntry[] | null {\n const workspaceRoot = findWorkspaceRoot();\n if (!workspaceRoot) return null;\n const appsDir = path.join(workspaceRoot, \"apps\");\n if (!fs.existsSync(appsDir)) return null;\n\n const apps = fs\n .readdirSync(appsDir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry): WorkspaceAppManifestEntry | null => {\n const appDir = path.join(appsDir, entry.name);\n const pkg = readJson(path.join(appDir, \"package.json\"));\n if (!pkg) return null;\n const routeAccess = workspaceAppRouteAccessFromPackageJson(pkg);\n return {\n id: entry.name,\n name: pkg.displayName || titleCase(entry.name),\n description: pkg.description || \"\",\n path: `/${entry.name}`,\n isDispatch: entry.name === \"dispatch\",\n audience:\n workspaceAppAudienceFromPackageJson(pkg) ??\n DEFAULT_WORKSPACE_APP_AUDIENCE,\n publicPaths: routeAccess.publicPaths ?? [],\n protectedPaths: routeAccess.protectedPaths ?? [],\n } satisfies WorkspaceAppManifestEntry;\n })\n .filter((app): app is WorkspaceAppManifestEntry => !!app)\n .sort((a, b) => {\n if (a.id === \"dispatch\") return -1;\n if (b.id === \"dispatch\") return 1;\n return a.name.localeCompare(b.name);\n });\n\n return apps.length ? apps : null;\n}\n\nfunction workspaceBaseUrl(): string | null {\n return (\n process.env.WORKSPACE_GATEWAY_URL ||\n process.env.APP_URL ||\n process.env.URL ||\n process.env.DEPLOY_URL ||\n process.env.BETTER_AUTH_URL ||\n null\n );\n}\n\nfunction workspaceAppUrl(\n app: WorkspaceAppManifestEntry,\n hostedLoopbackFallbackUrl?: string,\n): string | null {\n if (app.url) {\n if (!isHostedRuntime() || !isLoopbackUrl(app.url)) return app.url;\n if (hostedLoopbackFallbackUrl) return hostedLoopbackFallbackUrl;\n }\n const base = workspaceBaseUrl();\n if (!base) return null;\n try {\n return new URL(app.path, `${base.replace(/\\/$/, \"\")}/`).toString();\n } catch {\n return null;\n }\n}\n\nasync function discoverWorkspaceAgents(\n selfAppId?: string,\n): Promise<DiscoveredAgent[]> {\n const workspaceApps = loadWorkspaceAppsManifest();\n if (!workspaceApps) return [];\n\n const metadataSettings = await readWorkspaceAppMetadataSettings();\n\n return workspaceApps\n .filter((app) => app.id !== selfAppId)\n .map((app) => {\n const withOverride = applyWorkspaceAppMetadataOverride(\n app,\n metadataSettings,\n );\n const builtin = BUILTIN_AGENTS.find(\n (agent) => agent.id === withOverride.id,\n );\n const url = workspaceAppUrl(withOverride, builtin?.url);\n if (!url) return null;\n return {\n id: withOverride.id,\n name: withOverride.name,\n description:\n withOverride.description ||\n builtin?.description ||\n `Workspace app mounted at ${withOverride.path}`,\n url,\n color: builtin?.color || \"#6B7280\",\n } satisfies DiscoveredAgent;\n })\n .filter((agent): agent is DiscoveredAgent => !!agent);\n}\n\n/**\n * Like `getBuiltinAgents`, but always returns the production URL — never the\n * env-resolved devUrl. Used by the resource seeder so that a one-time seed\n * (`ON CONFLICT DO NOTHING`) can't permanently bake a localhost URL into the\n * DB, which would override the built-in's prod URL for every later\n * production deploy.\n */\nexport const BUILTIN_AGENTS_FOR_SEEDING: DiscoveredAgent[] =\n BUILTIN_AGENTS.filter((app) => app.url).map((app) => ({\n id: app.id,\n name: app.name,\n description: app.description,\n url: app.url, // ALWAYS prod\n color: app.color,\n }));\n"]}
|
|
1
|
+
{"version":3,"file":"agent-discovery.js","sourceRoot":"","sources":["../../src/server/agent-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EACnC,sCAAsC,GAEvC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAiC5E;;;;GAIG;AACH,MAAM,cAAc,GAAiB,SAAS,CAAC,MAAM,CACnD,CAAC,QAAQ,EAAE,EAAE,CACX,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CACpE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACnB,EAAE,EAAE,QAAQ,CAAC,IAAI;IACjB,IAAI,EAAE,QAAQ,CAAC,KAAK;IACpB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,IAAI;IAClD,GAAG,EAAE,QAAQ,CAAC,OAAQ;IACtB,MAAM,EAAE,oBAAoB,QAAQ,CAAC,OAAO,EAAE;IAC9C,OAAO,EAAE,QAAQ,CAAC,OAAO;IACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;CACtB,C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O,EAAE,GAAG,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EACT,GAAG,CAAC,WAAW;YACf,OAAO,EAAE,WAAW;YACpB,4BAA4B,GAAG,CAAC,IAAI,EAAE;QACxC,GAAG;QACH,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,SAAS;KACnC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpD,EAAE,EAAE,GAAG,CAAC,EAAE;IACV,IAAI,EAAE,GAAG,CAAC,IAAI;IACd,WAAW,EAAE,GAAG,CAAC,WAAW;IAC5B,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,cAAc;IAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;CACjB,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { TEMPLATES } from \"../cli/templates-meta.js\";\nimport {\n DEFAULT_WORKSPACE_APP_AUDIENCE,\n normalizeWorkspaceAppAudience,\n normalizeWorkspaceAppPathList,\n workspaceAppAudienceFromPackageJson,\n workspaceAppRouteAccessFromPackageJson,\n type WorkspaceAppAudience,\n} from \"../shared/workspace-app-audience.js\";\nimport { getRequestOrgId, getRequestUserEmail } from \"./request-context.js\";\n\nexport interface DiscoveredAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n}\n\nexport interface WorkspaceAppMetadataOverride {\n name?: string;\n description?: string;\n generated?: boolean;\n sourcePrompt?: string;\n updatedAt?: string;\n updatedBy?: string;\n}\n\nexport interface WorkspaceAppMetadataSettings {\n apps: Record<string, WorkspaceAppMetadataOverride>;\n}\n\ninterface AgentEntry {\n id: string;\n name: string;\n description: string;\n url: string;\n devUrl?: string;\n devPort: number;\n color: string;\n}\n\n/**\n * Built-in agent registry. Derive this from the published CLI metadata so\n * connected-agent discovery stays aligned with first-party template metadata\n * without depending on @agent-native/shared-app-config at runtime.\n */\nconst BUILTIN_AGENTS: AgentEntry[] = TEMPLATES.filter(\n (template) =>\n (!template.hidden || template.defaultAgent) && !!template.prodUrl,\n).map((template) => ({\n id: template.name,\n name: template.label,\n description: template.description ?? template.hint,\n url: template.prodUrl!,\n devUrl: `http://localhost:${template.devPort}`,\n devPort: template.devPort,\n color: template.color,\n}));\n\nconst HIDDEN_FIRST_PARTY_AGENT_IDS = new Set([\n ...TEMPLATES.filter(\n (template) => template.hidden && !template.defaultAgent && template.prodUrl,\n ).map((template) => template.name),\n // Stale resources for removed first-party apps should not reappear as\n // custom remote agents just because the template metadata entry is gone.\n \"calls\",\n \"code\",\n \"issues\",\n \"meeting-notes\",\n \"migration\",\n \"recruiting\",\n \"scheduling\",\n \"voice\",\n \"workbench\",\n]);\n\nfunction normalizeAgentId(id: string): string {\n const normalized = id.trim().toLowerCase();\n if (\n normalized === \"image\" ||\n normalized === \"images\" ||\n normalized === \"asset\"\n ) {\n return \"assets\";\n }\n return normalized;\n}\n\nconst WORKSPACE_APPS_ENV_KEY = \"AGENT_NATIVE_WORKSPACE_APPS_JSON\";\nconst WORKSPACE_APPS_MANIFEST_FILE = \"workspace-apps.json\";\nexport const WORKSPACE_APP_METADATA_SETTINGS_KEY = \"workspace-app-metadata\";\n\nexport interface WorkspaceAppManifestEntry {\n id: string;\n name: string;\n description: string;\n path: string;\n url?: string | null;\n isDispatch?: boolean;\n audience?: WorkspaceAppAudience;\n publicPaths?: string[];\n protectedPaths?: string[];\n}\n\nexport function workspaceAppMetadataSettingsKey(input?: {\n orgId?: string | null;\n userEmail?: string | null;\n}): string | null {\n const orgId = input?.orgId ?? getRequestOrgId() ?? null;\n if (orgId) return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:org:${orgId}`;\n\n const userEmail = input?.userEmail ?? getRequestUserEmail() ?? null;\n if (userEmail)\n return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:user:${userEmail}`;\n\n return null;\n}\n\nfunction cleanOptionalText(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nexport function parseWorkspaceAppMetadataSettings(\n raw: unknown,\n): WorkspaceAppMetadataSettings {\n const record =\n raw && typeof raw === \"object\" && !Array.isArray(raw)\n ? (raw as Record<string, unknown>)\n : {};\n const rawApps =\n record.apps &&\n typeof record.apps === \"object\" &&\n !Array.isArray(record.apps)\n ? (record.apps as Record<string, unknown>)\n : {};\n const apps: Record<string, WorkspaceAppMetadataOverride> = {};\n\n for (const [id, value] of Object.entries(rawApps)) {\n if (!id.trim() || !value || typeof value !== \"object\") continue;\n const item = value as Record<string, unknown>;\n const override: WorkspaceAppMetadataOverride = {};\n const name = cleanOptionalText(item.name);\n const description = cleanOptionalText(item.description);\n const sourcePrompt = cleanOptionalText(item.sourcePrompt);\n const updatedAt = cleanOptionalText(item.updatedAt);\n const updatedBy = cleanOptionalText(item.updatedBy);\n\n if (name) override.name = name;\n if (description) override.description = description;\n if (item.generated === true) override.generated = true;\n if (sourcePrompt) override.sourcePrompt = sourcePrompt;\n if (updatedAt) override.updatedAt = updatedAt;\n if (updatedBy) override.updatedBy = updatedBy;\n\n if (Object.keys(override).length > 0) apps[id.trim()] = override;\n }\n\n return { apps };\n}\n\nexport async function readWorkspaceAppMetadataSettings(): Promise<WorkspaceAppMetadataSettings> {\n const key = workspaceAppMetadataSettingsKey();\n if (!key) return { apps: {} };\n\n try {\n const { getSetting } = await import(\"../settings/index.js\");\n return parseWorkspaceAppMetadataSettings(await getSetting(key));\n } catch {\n return { apps: {} };\n }\n}\n\nexport async function writeWorkspaceAppMetadataOverride(input: {\n appId: string;\n name?: string | null;\n description?: string | null;\n generated?: boolean;\n sourcePrompt?: string | null;\n updatedBy?: string | null;\n}): Promise<WorkspaceAppMetadataSettings> {\n const key = workspaceAppMetadataSettingsKey();\n if (!key) throw new Error(\"no authenticated user\");\n\n const appId = input.appId.trim();\n if (!appId) throw new Error(\"appId is required\");\n\n const { getSetting, putSetting } = await import(\"../settings/index.js\");\n const current = parseWorkspaceAppMetadataSettings(await getSetting(key));\n const existing = current.apps[appId] ?? {};\n const next: WorkspaceAppMetadataOverride = {\n ...existing,\n updatedAt: new Date().toISOString(),\n };\n\n const name = cleanOptionalText(input.name);\n const description = cleanOptionalText(input.description);\n const sourcePrompt = cleanOptionalText(input.sourcePrompt);\n const updatedBy = cleanOptionalText(input.updatedBy);\n\n if (name) next.name = name;\n else delete next.name;\n if (description) next.description = description;\n else delete next.description;\n if (input.generated === true) next.generated = true;\n else if (input.generated === false) delete next.generated;\n if (sourcePrompt) next.sourcePrompt = sourcePrompt;\n if (updatedBy) next.updatedBy = updatedBy;\n\n current.apps[appId] = next;\n await putSetting(key, current as unknown as Record<string, unknown>);\n return current;\n}\n\nexport function applyWorkspaceAppMetadataOverride<\n T extends {\n id: string;\n name: string;\n description?: string | null;\n },\n>(app: T, settings: WorkspaceAppMetadataSettings): T {\n const override = settings.apps[app.id];\n if (!override) return app;\n\n const name = cleanOptionalText(override.name);\n const description = cleanOptionalText(override.description);\n const generated = override.generated === true;\n const shouldApplyName = !!name && !generated;\n const shouldApplyDescription =\n !!description && (!generated || !cleanOptionalText(app.description));\n if (!shouldApplyName && !shouldApplyDescription) return app;\n\n return {\n ...app,\n ...(shouldApplyName ? { name } : {}),\n ...(shouldApplyDescription ? { description } : {}),\n };\n}\n\n/**\n * Resolve the workspace app manifest from the same fallback chain that\n * `discoverWorkspaceAgents` uses: `AGENT_NATIVE_WORKSPACE_APPS_JSON` env →\n * `.agent-native/workspace-apps.json` (or sibling) on disk → live filesystem\n * scan of `apps/<id>/package.json` under the workspace root.\n *\n * Callers (e.g. the dispatch `/dispatch/<appId>` catch-all loader) need this\n * to behave the same in production deploys (which write the manifest file)\n * and during local dev (where new apps appear under `apps/` without an env\n * restart). Reading only the env var would silently downgrade the behavior\n * in both cases.\n */\nexport function loadWorkspaceAppsManifest():\n | WorkspaceAppManifestEntry[]\n | null {\n return (\n readWorkspaceAppsFromEnv() ??\n readWorkspaceAppsFromManifestFile() ??\n readWorkspaceAppsFromFilesystem()\n );\n}\n\nexport function shouldIncludeRemoteAgentManifest(\n manifest: { id?: string | null },\n selfAppId?: string,\n): boolean {\n const id = manifest.id?.trim();\n if (!id) return false;\n const normalizedId = normalizeAgentId(id);\n const normalizedSelfAppId = selfAppId ? normalizeAgentId(selfAppId) : \"\";\n if (normalizedSelfAppId && normalizedId === normalizedSelfAppId) {\n return false;\n }\n return !HIDDEN_FIRST_PARTY_AGENT_IDS.has(normalizedId);\n}\n\n/**\n * Get built-in agents (static, no DB). Used as fallback and for seeding.\n */\nexport function getBuiltinAgents(selfAppId?: string): DiscoveredAgent[] {\n const normalizedSelfAppId = selfAppId ? normalizeAgentId(selfAppId) : \"\";\n return BUILTIN_AGENTS.filter(\n (app) => app.id !== normalizedSelfAppId && app.url,\n ).map((app) => ({\n id: app.id,\n name: app.name,\n description: app.description,\n url: resolveAgentUrl(app),\n color: app.color,\n }));\n}\n\n/**\n * Discover all agents: built-in + custom agents stored as resources.\n * Custom agents override built-in agents with the same ID.\n */\nexport async function discoverAgents(\n selfAppId?: string,\n): Promise<DiscoveredAgent[]> {\n const builtins = getBuiltinAgents(selfAppId);\n const agentsById = new Map<string, DiscoveredAgent>();\n\n // Start with built-ins\n for (const agent of builtins) {\n agentsById.set(agent.id, agent);\n }\n\n // Overlay custom agents from resources\n try {\n const { resourceList, resourceGet, SHARED_OWNER } =\n await import(\"../resources/store.js\");\n\n const { parseRemoteAgentManifest, REMOTE_AGENT_RESOURCE_PREFIXES } =\n await import(\"../resources/metadata.js\");\n\n const resources: Array<{ id: string; path: string }> = [];\n for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {\n resources.push(...(await resourceList(SHARED_OWNER, prefix)));\n }\n\n for (const r of resources) {\n if (!r.path.endsWith(\".json\")) continue;\n try {\n const full = await resourceGet(r.id);\n if (!full) continue;\n const manifest = parseRemoteAgentManifest(full.content, r.path);\n if (!manifest || !shouldIncludeRemoteAgentManifest(manifest, selfAppId))\n continue;\n const manifestId = normalizeAgentId(manifest.id);\n\n // If the resource override carries a localhost URL but we're running\n // in production (e.g. a stale dev-time seed got promoted to the prod\n // DB), fall back to the matching built-in's prod URL instead of\n // letting the override win — otherwise outbound `call-agent` fetches\n // from a serverless function would target localhost and fail with\n // \"fetch failed\" instantly. The override still wins for non-localhost\n // URLs (the supported case for self-hosted custom agents).\n let url = manifest.url;\n const isProduction =\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"production\";\n if (\n isProduction &&\n typeof url === \"string\" &&\n /^https?:\\/\\/(localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0)(:|\\/|$)/.test(url)\n ) {\n const builtin = agentsById.get(manifestId);\n if (builtin?.url) url = builtin.url;\n }\n\n const builtin = agentsById.get(manifestId);\n const isLegacyAssetsManifest =\n manifest.id.trim().toLowerCase() !== manifestId;\n if (isLegacyAssetsManifest && builtin?.url) {\n try {\n if (new URL(url).hostname === \"images.agent-native.com\") {\n url = builtin.url;\n }\n } catch {\n url = builtin.url;\n }\n }\n\n agentsById.set(manifestId, {\n id: manifestId,\n name:\n isLegacyAssetsManifest && builtin?.name\n ? builtin.name\n : manifest.name,\n description: manifest.description || \"\",\n url,\n color: manifest.color || builtin?.color || \"#6B7280\",\n });\n } catch {\n // Skip unreadable resources\n }\n }\n } catch {\n // Resources not available — use built-ins only\n }\n\n // Overlay sibling workspace apps last so same-origin workspaces prefer the\n // app mounted in this workspace over the public template with the same id.\n for (const agent of await discoverWorkspaceAgents(selfAppId)) {\n agentsById.set(agent.id, agent);\n }\n\n return Array.from(agentsById.values());\n}\n\n/**\n * Look up a single agent by ID or name (case-insensitive).\n */\nexport async function findAgent(\n idOrName: string,\n selfAppId?: string,\n): Promise<DiscoveredAgent | undefined> {\n const lower = normalizeAgentId(idOrName);\n const agents = await discoverAgents(selfAppId);\n return agents.find((a) => a.id === lower || a.name.toLowerCase() === lower);\n}\n\nfunction hostnameFromUrlLike(value: string | undefined): string | null {\n if (!value) return null;\n try {\n return new URL(value).hostname.toLowerCase();\n } catch {\n try {\n return new URL(`http://${value}`).hostname.toLowerCase();\n } catch {\n return null;\n }\n }\n}\n\nfunction isLoopbackUrl(value: string | undefined): boolean {\n const hostname = hostnameFromUrlLike(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"0.0.0.0\" ||\n hostname === \"::1\"\n );\n}\n\nfunction hasPublicRuntimeUrl(): boolean {\n // Intentionally omit generic `URL` / `DEPLOY_URL` here. Platforms that set\n // those also expose a stronger hosted signal (for example `NETLIFY`), while\n // local shells and unrelated tools can use generic URL vars for other work.\n const keys = [\n \"WORKSPACE_GATEWAY_URL\",\n \"VITE_WORKSPACE_GATEWAY_URL\",\n \"APP_URL\",\n \"WORKSPACE_OAUTH_ORIGIN\",\n \"VITE_WORKSPACE_OAUTH_ORIGIN\",\n \"BETTER_AUTH_URL\",\n \"VITE_BETTER_AUTH_URL\",\n \"VERCEL_URL\",\n \"VERCEL_PROJECT_PRODUCTION_URL\",\n ];\n\n return keys.some((key) => {\n const value = process.env[key];\n return !!value && !isLoopbackUrl(value);\n });\n}\n\nfunction isHostedRuntime(): boolean {\n return (\n process.env.NODE_ENV === \"production\" ||\n !!process.env.NETLIFY ||\n !!process.env.AWS_LAMBDA_FUNCTION_NAME ||\n !!process.env.VERCEL ||\n \"__cf_env\" in globalThis ||\n hasPublicRuntimeUrl()\n );\n}\n\nfunction shouldUseLocalAgentUrls(): boolean {\n return !isHostedRuntime();\n}\n\nfunction resolveAgentUrl(app: AgentEntry): string {\n if (shouldUseLocalAgentUrls()) {\n return app.devUrl || `http://localhost:${app.devPort}`;\n }\n return app.url;\n}\n\nfunction readJson(file: string): any {\n try {\n return JSON.parse(fs.readFileSync(file, \"utf8\"));\n } catch {\n return null;\n }\n}\n\nfunction findWorkspaceRoot(startDir = process.cwd()): string | null {\n let dir = path.resolve(startDir);\n for (let i = 0; i < 20; i++) {\n const pkg = readJson(path.join(dir, \"package.json\"));\n if (typeof pkg?.[\"agent-native\"]?.workspaceCore === \"string\") {\n return dir;\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nfunction titleCase(value: string): string {\n return value\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nfunction parseWorkspaceAppsManifest(\n parsed: any,\n): WorkspaceAppManifestEntry[] | null {\n const rawApps = Array.isArray(parsed?.apps)\n ? parsed.apps\n : Array.isArray(parsed)\n ? parsed\n : null;\n if (!rawApps) return null;\n\n const apps = (rawApps as unknown[])\n .map((entry): WorkspaceAppManifestEntry | null => {\n if (!entry || typeof entry !== \"object\") return null;\n const e = entry as Record<string, unknown>;\n const id = typeof e.id === \"string\" ? e.id.trim() : \"\";\n const pathValue = typeof e.path === \"string\" ? e.path.trim() : \"\";\n if (!id || !pathValue.startsWith(\"/\")) return null;\n return {\n id,\n name:\n typeof e.name === \"string\" && e.name.trim()\n ? e.name.trim()\n : titleCase(id),\n description: typeof e.description === \"string\" ? e.description : \"\",\n path: pathValue,\n url: typeof e.url === \"string\" && e.url.trim() ? e.url.trim() : null,\n isDispatch:\n typeof e.isDispatch === \"boolean\" ? e.isDispatch : id === \"dispatch\",\n audience:\n e.audience === undefined\n ? DEFAULT_WORKSPACE_APP_AUDIENCE\n : normalizeWorkspaceAppAudience(e.audience),\n publicPaths: normalizeWorkspaceAppPathList(e.publicPaths),\n protectedPaths: normalizeWorkspaceAppPathList(e.protectedPaths),\n };\n })\n .filter((app): app is WorkspaceAppManifestEntry => app !== null)\n .sort((a, b) => {\n if (a.id === \"dispatch\") return -1;\n if (b.id === \"dispatch\") return 1;\n return a.name.localeCompare(b.name);\n });\n\n return apps.length ? apps : null;\n}\n\nfunction readWorkspaceAppsFromEnv(): WorkspaceAppManifestEntry[] | null {\n const raw = process.env[WORKSPACE_APPS_ENV_KEY];\n if (!raw) return null;\n try {\n return parseWorkspaceAppsManifest(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\nfunction workspaceAppsManifestCandidates(): string[] {\n const candidates: string[] = [];\n try {\n candidates.push(\n path.join(process.cwd(), \".agent-native\", WORKSPACE_APPS_MANIFEST_FILE),\n path.join(process.cwd(), WORKSPACE_APPS_MANIFEST_FILE),\n );\n } catch {\n // Some edge runtimes do not expose process.cwd().\n }\n try {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n candidates.push(\n path.join(moduleDir, \".agent-native\", WORKSPACE_APPS_MANIFEST_FILE),\n path.join(moduleDir, WORKSPACE_APPS_MANIFEST_FILE),\n );\n } catch {\n // Some edge runtimes expose non-file module URLs. The env manifest still\n // works there, so skip file-relative candidates.\n }\n return candidates;\n}\n\nfunction readWorkspaceAppsFromManifestFile():\n | WorkspaceAppManifestEntry[]\n | null {\n for (const file of workspaceAppsManifestCandidates()) {\n if (!fs.existsSync(file)) continue;\n const apps = parseWorkspaceAppsManifest(readJson(file));\n if (apps) return apps;\n }\n return null;\n}\n\nfunction readWorkspaceAppsFromFilesystem(): WorkspaceAppManifestEntry[] | null {\n const workspaceRoot = findWorkspaceRoot();\n if (!workspaceRoot) return null;\n const appsDir = path.join(workspaceRoot, \"apps\");\n if (!fs.existsSync(appsDir)) return null;\n\n const apps = fs\n .readdirSync(appsDir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry): WorkspaceAppManifestEntry | null => {\n const appDir = path.join(appsDir, entry.name);\n const pkg = readJson(path.join(appDir, \"package.json\"));\n if (!pkg) return null;\n const routeAccess = workspaceAppRouteAccessFromPackageJson(pkg);\n return {\n id: entry.name,\n name: pkg.displayName || titleCase(entry.name),\n description: pkg.description || \"\",\n path: `/${entry.name}`,\n isDispatch: entry.name === \"dispatch\",\n audience:\n workspaceAppAudienceFromPackageJson(pkg) ??\n DEFAULT_WORKSPACE_APP_AUDIENCE,\n publicPaths: routeAccess.publicPaths ?? [],\n protectedPaths: routeAccess.protectedPaths ?? [],\n } satisfies WorkspaceAppManifestEntry;\n })\n .filter((app): app is WorkspaceAppManifestEntry => !!app)\n .sort((a, b) => {\n if (a.id === \"dispatch\") return -1;\n if (b.id === \"dispatch\") return 1;\n return a.name.localeCompare(b.name);\n });\n\n return apps.length ? apps : null;\n}\n\nfunction workspaceBaseUrl(): string | null {\n return (\n process.env.WORKSPACE_GATEWAY_URL ||\n process.env.APP_URL ||\n process.env.URL ||\n process.env.DEPLOY_URL ||\n process.env.BETTER_AUTH_URL ||\n null\n );\n}\n\nfunction workspaceAppUrl(\n app: WorkspaceAppManifestEntry,\n hostedLoopbackFallbackUrl?: string,\n): string | null {\n if (app.url) {\n if (!isHostedRuntime() || !isLoopbackUrl(app.url)) return app.url;\n if (hostedLoopbackFallbackUrl) return hostedLoopbackFallbackUrl;\n }\n const base = workspaceBaseUrl();\n if (!base) return null;\n try {\n return new URL(app.path, `${base.replace(/\\/$/, \"\")}/`).toString();\n } catch {\n return null;\n }\n}\n\nasync function discoverWorkspaceAgents(\n selfAppId?: string,\n): Promise<DiscoveredAgent[]> {\n const workspaceApps = loadWorkspaceAppsManifest();\n if (!workspaceApps) return [];\n\n const metadataSettings = await readWorkspaceAppMetadataSettings();\n\n return workspaceApps\n .filter((app) => app.id !== selfAppId)\n .map((app) => {\n const withOverride = applyWorkspaceAppMetadataOverride(\n app,\n metadataSettings,\n );\n const builtin = BUILTIN_AGENTS.find(\n (agent) => agent.id === withOverride.id,\n );\n const url = workspaceAppUrl(withOverride, builtin?.url);\n if (!url) return null;\n return {\n id: withOverride.id,\n name: withOverride.name,\n description:\n withOverride.description ||\n builtin?.description ||\n `Workspace app mounted at ${withOverride.path}`,\n url,\n color: builtin?.color || \"#6B7280\",\n } satisfies DiscoveredAgent;\n })\n .filter((agent): agent is DiscoveredAgent => !!agent);\n}\n\n/** Resolve only the Dispatch app designated by the receiver's own manifest. */\nexport function findWorkspaceDispatchAgent(): DiscoveredAgent | undefined {\n const app = loadWorkspaceAppsManifest()?.find(\n (candidate) => candidate.isDispatch === true,\n );\n if (!app) return undefined;\n\n const builtin = BUILTIN_AGENTS.find((agent) => agent.id === \"dispatch\");\n const url = workspaceAppUrl(app, builtin?.url);\n if (!url) return undefined;\n return {\n id: app.id,\n name: app.name,\n description:\n app.description ||\n builtin?.description ||\n `Workspace app mounted at ${app.path}`,\n url,\n color: builtin?.color || \"#6B7280\",\n };\n}\n\n/**\n * Like `getBuiltinAgents`, but always returns the production URL — never the\n * env-resolved devUrl. Used by the resource seeder so that a one-time seed\n * (`ON CONFLICT DO NOTHING`) can't permanently bake a localhost URL into the\n * DB, which would override the built-in's prod URL for every later\n * production deploy.\n */\nexport const BUILTIN_AGENTS_FOR_SEEDING: DiscoveredAgent[] =\n BUILTIN_AGENTS.filter((app) => app.url).map((app) => ({\n id: app.id,\n name: app.name,\n description: app.description,\n url: app.url, // ALWAYS prod\n color: app.color,\n }));\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.114.
|
|
3
|
+
"version": "0.114.5",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
"y-protocols": "^1.0.7",
|
|
381
381
|
"yjs": "^13.6.31",
|
|
382
382
|
"zod": "^4.3.6",
|
|
383
|
-
"@agent-native/recap-cli": "0.4.
|
|
383
|
+
"@agent-native/recap-cli": "0.4.5",
|
|
384
384
|
"@agent-native/toolkit": "^0.8.0"
|
|
385
385
|
},
|
|
386
386
|
"devDependencies": {
|
|
@@ -14,6 +14,11 @@ export interface A2AArtifactResponseOptions {
|
|
|
14
14
|
persistedArtifactSecret?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export interface GuardedA2AArtifactResponse {
|
|
18
|
+
text: string;
|
|
19
|
+
rejectedUnverifiedArtifactReferences: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
export interface A2AArtifactIdentityOptions {
|
|
18
23
|
persistedArtifactSecrets?: readonly string[];
|
|
19
24
|
}
|
|
@@ -1395,11 +1400,11 @@ function formatUnverifiedArtifactMessage(
|
|
|
1395
1400
|
: message;
|
|
1396
1401
|
}
|
|
1397
1402
|
|
|
1398
|
-
export function
|
|
1403
|
+
export function guardA2AArtifactResponse(
|
|
1399
1404
|
responseText: string,
|
|
1400
1405
|
toolResults: A2AToolResultSummary[],
|
|
1401
1406
|
options: A2AArtifactResponseOptions = {},
|
|
1402
|
-
):
|
|
1407
|
+
): GuardedA2AArtifactResponse {
|
|
1403
1408
|
const baseUrl = normalizeBaseUrl(options.baseUrl);
|
|
1404
1409
|
const includeReferencedArtifacts =
|
|
1405
1410
|
options.includeReferencedArtifacts ?? false;
|
|
@@ -1440,7 +1445,10 @@ export function appendA2AArtifactLinks(
|
|
|
1440
1445
|
) ||
|
|
1441
1446
|
/\b(?:done|created|ready|here(?:'s| is)|complete|finished)\b/i.test(text))
|
|
1442
1447
|
) {
|
|
1443
|
-
return
|
|
1448
|
+
return {
|
|
1449
|
+
text: finalize(formatIncompleteDesignMessage(incompleteShells)),
|
|
1450
|
+
rejectedUnverifiedArtifactReferences: false,
|
|
1451
|
+
};
|
|
1444
1452
|
}
|
|
1445
1453
|
|
|
1446
1454
|
const unverifiedRefs = findUnverifiedArtifactReferences(
|
|
@@ -1454,18 +1462,21 @@ export function appendA2AArtifactLinks(
|
|
|
1454
1462
|
generatedDesigns,
|
|
1455
1463
|
);
|
|
1456
1464
|
if (unverifiedRefs.length > 0) {
|
|
1457
|
-
return
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1465
|
+
return {
|
|
1466
|
+
text: finalize(
|
|
1467
|
+
formatUnverifiedArtifactMessage(
|
|
1468
|
+
unverifiedRefs,
|
|
1469
|
+
documents,
|
|
1470
|
+
decks,
|
|
1471
|
+
dashboards,
|
|
1472
|
+
analyses,
|
|
1473
|
+
images,
|
|
1474
|
+
generatedDesigns,
|
|
1475
|
+
baseUrl,
|
|
1476
|
+
),
|
|
1467
1477
|
),
|
|
1468
|
-
|
|
1478
|
+
rejectedUnverifiedArtifactReferences: true,
|
|
1479
|
+
};
|
|
1469
1480
|
}
|
|
1470
1481
|
|
|
1471
1482
|
const missingLines: string[] = [];
|
|
@@ -1541,10 +1552,25 @@ export function appendA2AArtifactLinks(
|
|
|
1541
1552
|
}
|
|
1542
1553
|
|
|
1543
1554
|
if (missingLines.length === 0) {
|
|
1544
|
-
return
|
|
1555
|
+
return {
|
|
1556
|
+
text: finalize(text),
|
|
1557
|
+
rejectedUnverifiedArtifactReferences: false,
|
|
1558
|
+
};
|
|
1545
1559
|
}
|
|
1560
|
+
|
|
1546
1561
|
const artifactBlock = `Artifacts:\n${missingLines.join("\n")}`;
|
|
1547
|
-
return
|
|
1562
|
+
return {
|
|
1563
|
+
text: finalize(text ? `${text}\n\n${artifactBlock}` : artifactBlock),
|
|
1564
|
+
rejectedUnverifiedArtifactReferences: false,
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
export function appendA2AArtifactLinks(
|
|
1569
|
+
responseText: string,
|
|
1570
|
+
toolResults: A2AToolResultSummary[],
|
|
1571
|
+
options: A2AArtifactResponseOptions = {},
|
|
1572
|
+
): string {
|
|
1573
|
+
return guardA2AArtifactResponse(responseText, toolResults, options).text;
|
|
1548
1574
|
}
|
|
1549
1575
|
|
|
1550
1576
|
export function buildA2ARecoverableArtifactMessage(
|
package/src/a2a/client.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { sanitizeA2ACorrelationMetadata } from "./correlation.js";
|
|
|
5
5
|
import type {
|
|
6
6
|
A2AApprovedAction,
|
|
7
7
|
A2ACorrelationMetadata,
|
|
8
|
+
A2ASourceContextReference,
|
|
8
9
|
A2AReadOnlyActionResult,
|
|
9
10
|
AgentCard,
|
|
10
11
|
JsonRpcRequest,
|
|
@@ -632,6 +633,8 @@ export async function callAgent(
|
|
|
632
633
|
requestOrigin?: string;
|
|
633
634
|
/** Exact downstream actions explicitly authorized in the caller's chat. */
|
|
634
635
|
approvedActions?: A2AApprovedAction[];
|
|
636
|
+
/** Opaque provenance reference resolved by the receiver through Dispatch. */
|
|
637
|
+
sourceContext?: A2ASourceContextReference;
|
|
635
638
|
/** Bounded telemetry-only lineage forwarded to the receiving app. */
|
|
636
639
|
correlation?: A2ACorrelationMetadata;
|
|
637
640
|
/** Stable caller-generated key for one message submission. */
|
|
@@ -673,6 +676,7 @@ export async function callAgent(
|
|
|
673
676
|
if (opts?.userEmail) metadata.userEmail = opts.userEmail;
|
|
674
677
|
if (opts?.orgDomain) metadata.orgDomain = opts.orgDomain;
|
|
675
678
|
if (opts?.requestOrigin) metadata.requestOrigin = opts.requestOrigin;
|
|
679
|
+
if (opts?.sourceContext) metadata.sourceContext = opts.sourceContext;
|
|
676
680
|
Object.assign(metadata, sanitizeA2ACorrelationMetadata(opts?.correlation));
|
|
677
681
|
|
|
678
682
|
// Default to async + poll. The receiving A2A server's `_process-task` route
|
package/src/a2a/handlers.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
resolveAgentChatProcessRunDispatchPath,
|
|
11
11
|
} from "../agent/durable-background.js";
|
|
12
12
|
import { trackingIdentityProperties } from "../observability/tracking-identity.js";
|
|
13
|
+
import { getA2ASecretByDomain } from "../org/context.js";
|
|
14
|
+
import { findWorkspaceDispatchAgent } from "../server/agent-discovery.js";
|
|
13
15
|
import { withConfiguredAppBasePath } from "../server/app-base-path.js";
|
|
14
16
|
import { getOrigin, isConfiguredAppOrigin } from "../server/google-oauth.js";
|
|
15
17
|
import { fireInternalDispatch } from "../server/self-dispatch.js";
|
|
@@ -19,6 +21,7 @@ import {
|
|
|
19
21
|
hasConfiguredA2ASecret,
|
|
20
22
|
isA2AProductionRuntime,
|
|
21
23
|
} from "./auth-policy.js";
|
|
24
|
+
import { callAction } from "./client.js";
|
|
22
25
|
import { sanitizeA2ACorrelationMetadata } from "./correlation.js";
|
|
23
26
|
import {
|
|
24
27
|
createTask,
|
|
@@ -39,6 +42,8 @@ import {
|
|
|
39
42
|
} from "./task-store.js";
|
|
40
43
|
import type {
|
|
41
44
|
A2AApprovedAction,
|
|
45
|
+
A2ASourceContext,
|
|
46
|
+
A2ASourceContextReference,
|
|
42
47
|
A2AConfig,
|
|
43
48
|
A2AHandler,
|
|
44
49
|
A2AHandlerContext,
|
|
@@ -84,6 +89,107 @@ function trustedApprovedActions(
|
|
|
84
89
|
return approved.length > 0 ? approved : undefined;
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
function sourceContextReference(
|
|
93
|
+
value: unknown,
|
|
94
|
+
): A2ASourceContextReference | undefined {
|
|
95
|
+
if (!value || typeof value !== "object") {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const candidate = value as Record<string, unknown>;
|
|
99
|
+
if (
|
|
100
|
+
candidate.platform !== "slack" ||
|
|
101
|
+
typeof candidate.integrationTaskId !== "string"
|
|
102
|
+
) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const integrationTaskId = candidate.integrationTaskId;
|
|
106
|
+
if (
|
|
107
|
+
!integrationTaskId ||
|
|
108
|
+
integrationTaskId !== integrationTaskId.trim() ||
|
|
109
|
+
integrationTaskId.length > 200
|
|
110
|
+
) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
return { platform: "slack", integrationTaskId };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function resolvedSlackSourceContext(
|
|
117
|
+
value: unknown,
|
|
118
|
+
): A2ASourceContext | undefined {
|
|
119
|
+
if (!value || typeof value !== "object") return undefined;
|
|
120
|
+
const candidate = value as Record<string, unknown>;
|
|
121
|
+
if (
|
|
122
|
+
candidate.platform !== "slack" ||
|
|
123
|
+
typeof candidate.sourceUrl !== "string"
|
|
124
|
+
) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const sourceUrl = candidate.sourceUrl;
|
|
128
|
+
if (!sourceUrl || sourceUrl !== sourceUrl.trim()) return undefined;
|
|
129
|
+
try {
|
|
130
|
+
const parsed = new URL(sourceUrl);
|
|
131
|
+
const isSlackHost =
|
|
132
|
+
parsed.hostname === "slack.com" || parsed.hostname.endsWith(".slack.com");
|
|
133
|
+
if (
|
|
134
|
+
parsed.protocol !== "https:" ||
|
|
135
|
+
!isSlackHost ||
|
|
136
|
+
parsed.username ||
|
|
137
|
+
parsed.password ||
|
|
138
|
+
parsed.port
|
|
139
|
+
) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return { platform: "slack", sourceUrl };
|
|
143
|
+
} catch {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function trustedSourceContext(
|
|
149
|
+
value: unknown,
|
|
150
|
+
event: any | undefined,
|
|
151
|
+
): Promise<A2ASourceContext | undefined> {
|
|
152
|
+
const verifiedEmail = event?.context?.__a2aVerifiedEmail as
|
|
153
|
+
| string
|
|
154
|
+
| undefined;
|
|
155
|
+
const reference = sourceContextReference(value);
|
|
156
|
+
if (
|
|
157
|
+
!verifiedEmail ||
|
|
158
|
+
event?.context?.__a2aAudienceVerified !== true ||
|
|
159
|
+
!reference
|
|
160
|
+
) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const dispatch = findWorkspaceDispatchAgent();
|
|
165
|
+
if (!dispatch) return undefined;
|
|
166
|
+
const orgDomain = event?.context?.__a2aOrgDomain as string | undefined;
|
|
167
|
+
let orgSecret: string | undefined;
|
|
168
|
+
if (orgDomain) {
|
|
169
|
+
try {
|
|
170
|
+
orgSecret = (await getA2ASecretByDomain(orgDomain)) ?? undefined;
|
|
171
|
+
} catch {}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
const result = await callAction(
|
|
176
|
+
dispatch.url,
|
|
177
|
+
"resolve-integration-source-context",
|
|
178
|
+
{ integrationTaskId: reference.integrationTaskId },
|
|
179
|
+
{
|
|
180
|
+
userEmail: verifiedEmail,
|
|
181
|
+
orgDomain,
|
|
182
|
+
orgSecret,
|
|
183
|
+
requestTimeoutMs: 5_000,
|
|
184
|
+
},
|
|
185
|
+
);
|
|
186
|
+
if (result.status !== "completed") return undefined;
|
|
187
|
+
return resolvedSlackSourceContext(JSON.parse(result.output));
|
|
188
|
+
} catch {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
87
193
|
/**
|
|
88
194
|
* Request origin is routing/link context, not an identity signal. Accept only
|
|
89
195
|
* an absolute HTTP(S) origin from caller metadata so queued runs can preserve
|
|
@@ -142,6 +248,7 @@ function trustedA2AMetadata(
|
|
|
142
248
|
): Record<string, unknown> | undefined {
|
|
143
249
|
if (!metadata) return undefined;
|
|
144
250
|
const trusted = { ...metadata };
|
|
251
|
+
delete trusted.sourceContext;
|
|
145
252
|
const requestOrigin = requestOriginForContext(metadata, event);
|
|
146
253
|
if (requestOrigin) trusted.requestOrigin = requestOrigin;
|
|
147
254
|
else delete trusted.requestOrigin;
|
|
@@ -290,6 +397,9 @@ export async function processA2ATaskFromQueue(
|
|
|
290
397
|
const approvedActions = Array.isArray(processorMeta.approvedActions)
|
|
291
398
|
? (processorMeta.approvedActions as A2AApprovedAction[])
|
|
292
399
|
: undefined;
|
|
400
|
+
const sourceContext = processorMeta.sourceContext as
|
|
401
|
+
| A2ASourceContext
|
|
402
|
+
| undefined;
|
|
293
403
|
|
|
294
404
|
const resolvedOrgId = await resolveVerifiedA2AOrgId(
|
|
295
405
|
verifiedEmail,
|
|
@@ -322,6 +432,7 @@ export async function processA2ATaskFromQueue(
|
|
|
322
432
|
callerMetadata,
|
|
323
433
|
event,
|
|
324
434
|
approvedActions,
|
|
435
|
+
sourceContext,
|
|
325
436
|
),
|
|
326
437
|
);
|
|
327
438
|
} catch (err: any) {
|
|
@@ -345,7 +456,7 @@ export async function processA2ATaskFromQueue(
|
|
|
345
456
|
*/
|
|
346
457
|
const defaultHandler: A2AHandler = async (
|
|
347
458
|
message: Message,
|
|
348
|
-
|
|
459
|
+
context: A2AHandlerContext,
|
|
349
460
|
): Promise<A2AHandlerResult> => {
|
|
350
461
|
// Extract text from message parts
|
|
351
462
|
const text = message.parts
|
|
@@ -376,7 +487,12 @@ const defaultHandler: A2AHandler = async (
|
|
|
376
487
|
? `[Cross-app A2A request — the caller is on a different host (${appBaseUrl} is yours, theirs is different). Include the concrete result (URL, ID, value) explicitly in your reply text; the caller can't see your local UI state. Any URL MUST be fully-qualified, never a relative path.]\n\n${text}`
|
|
377
488
|
: text;
|
|
378
489
|
|
|
379
|
-
const
|
|
490
|
+
const sourceContext = context.sourceContext
|
|
491
|
+
? `Authenticated A2A source context: ${JSON.stringify(context.sourceContext)}. Treat this structured value as authoritative provenance. Preserve its sourceUrl exactly when recording source or submission fields.`
|
|
492
|
+
: undefined;
|
|
493
|
+
const result = sourceContext
|
|
494
|
+
? await agentChat.call(augmentedText, { context: sourceContext })
|
|
495
|
+
: await agentChat.call(augmentedText);
|
|
380
496
|
|
|
381
497
|
const artifacts: Artifact[] = [];
|
|
382
498
|
if (result.filesChanged.length > 0) {
|
|
@@ -428,6 +544,7 @@ function makeHandlerContext(
|
|
|
428
544
|
metadata?: Record<string, unknown>,
|
|
429
545
|
event?: any,
|
|
430
546
|
approvedActions?: A2AApprovedAction[],
|
|
547
|
+
sourceContext?: A2ASourceContext,
|
|
431
548
|
): {
|
|
432
549
|
context: A2AHandlerContext;
|
|
433
550
|
artifacts: Artifact[];
|
|
@@ -439,6 +556,7 @@ function makeHandlerContext(
|
|
|
439
556
|
metadata,
|
|
440
557
|
event,
|
|
441
558
|
approvedActions,
|
|
559
|
+
sourceContext,
|
|
442
560
|
writeArtifact(name, content, mimeType) {
|
|
443
561
|
const artifact: Artifact = {
|
|
444
562
|
name,
|
|
@@ -535,6 +653,7 @@ async function runHandlerAndPersist(
|
|
|
535
653
|
metadata: Record<string, unknown> | undefined,
|
|
536
654
|
event?: any,
|
|
537
655
|
approvedActions?: A2AApprovedAction[],
|
|
656
|
+
sourceContext?: A2ASourceContext,
|
|
538
657
|
): Promise<void> {
|
|
539
658
|
const { context, artifacts } = makeHandlerContext(
|
|
540
659
|
taskId,
|
|
@@ -542,6 +661,7 @@ async function runHandlerAndPersist(
|
|
|
542
661
|
metadata,
|
|
543
662
|
event,
|
|
544
663
|
approvedActions,
|
|
664
|
+
sourceContext,
|
|
545
665
|
);
|
|
546
666
|
try {
|
|
547
667
|
const result = getHandler(config)(message, context);
|
|
@@ -625,6 +745,10 @@ async function handleSend(
|
|
|
625
745
|
const contextId = params.contextId as string | undefined;
|
|
626
746
|
const metadata = params.metadata as Record<string, unknown> | undefined;
|
|
627
747
|
const approvedActions = trustedApprovedActions(params.approvedActions, event);
|
|
748
|
+
const sourceContext = await trustedSourceContext(
|
|
749
|
+
metadata?.sourceContext,
|
|
750
|
+
event,
|
|
751
|
+
);
|
|
628
752
|
|
|
629
753
|
// The JWT-verified caller email (set by mountA2A in server.ts) is the
|
|
630
754
|
// single source of truth for task ownership — bound at creation, checked
|
|
@@ -714,6 +838,7 @@ async function handleSend(
|
|
|
714
838
|
contextId: contextId ?? null,
|
|
715
839
|
callerMetadata: safeMetadata ?? null,
|
|
716
840
|
approvedActions: approvedActions ?? null,
|
|
841
|
+
sourceContext: sourceContext ?? null,
|
|
717
842
|
},
|
|
718
843
|
};
|
|
719
844
|
const { task, reused } = await createOrReuseTask(
|
|
@@ -774,6 +899,7 @@ async function handleSend(
|
|
|
774
899
|
trustedA2AMetadata(metadata, event),
|
|
775
900
|
event,
|
|
776
901
|
approvedActions,
|
|
902
|
+
sourceContext,
|
|
777
903
|
);
|
|
778
904
|
|
|
779
905
|
try {
|
|
@@ -855,6 +981,10 @@ async function handleStream(
|
|
|
855
981
|
const contextId = params.contextId as string | undefined;
|
|
856
982
|
const metadata = params.metadata as Record<string, unknown> | undefined;
|
|
857
983
|
const approvedActions = trustedApprovedActions(params.approvedActions, event);
|
|
984
|
+
const sourceContext = await trustedSourceContext(
|
|
985
|
+
metadata?.sourceContext,
|
|
986
|
+
event,
|
|
987
|
+
);
|
|
858
988
|
const { ownerEmail: ownerEmailForTask, ownerScope: ownerScopeForTask } =
|
|
859
989
|
verifiedTaskOwner(event);
|
|
860
990
|
|
|
@@ -875,6 +1005,7 @@ async function handleStream(
|
|
|
875
1005
|
trustedA2AMetadata(metadata, event),
|
|
876
1006
|
event,
|
|
877
1007
|
approvedActions,
|
|
1008
|
+
sourceContext,
|
|
878
1009
|
);
|
|
879
1010
|
|
|
880
1011
|
try {
|
package/src/a2a/index.ts
CHANGED
package/src/a2a/types.ts
CHANGED
|
@@ -132,6 +132,18 @@ export interface A2AApprovedAction {
|
|
|
132
132
|
input: unknown;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/** Structured provenance accepted only from an authenticated A2A caller. */
|
|
136
|
+
export interface A2ASourceContext {
|
|
137
|
+
platform: "slack";
|
|
138
|
+
sourceUrl: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Opaque reference that a receiver must resolve through its trusted Dispatch app. */
|
|
142
|
+
export interface A2ASourceContextReference {
|
|
143
|
+
platform: "slack";
|
|
144
|
+
integrationTaskId: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
135
147
|
/**
|
|
136
148
|
* Telemetry-only cross-app correlation. Receivers must never use these
|
|
137
149
|
* caller-supplied values for identity, ownership, org scoping, access, or
|
|
@@ -156,6 +168,8 @@ export interface A2AHandlerContext {
|
|
|
156
168
|
event?: unknown;
|
|
157
169
|
/** Exact one-time action grants from a JWT-authenticated caller. */
|
|
158
170
|
approvedActions?: A2AApprovedAction[];
|
|
171
|
+
/** Receiver-validated provenance from a JWT-authenticated caller. */
|
|
172
|
+
sourceContext?: A2ASourceContext;
|
|
159
173
|
writeArtifact: (name: string, content: string, mimeType?: string) => string;
|
|
160
174
|
}
|
|
161
175
|
|
|
@@ -195,6 +195,12 @@ export type {
|
|
|
195
195
|
IntegrationScopePolicy,
|
|
196
196
|
} from "./scope-store.js";
|
|
197
197
|
|
|
198
|
+
export {
|
|
199
|
+
resolveIntegrationSourceContext,
|
|
200
|
+
sourceContextFromPendingTask,
|
|
201
|
+
type ResolvedIntegrationSourceContext,
|
|
202
|
+
} from "./pending-tasks-store.js";
|
|
203
|
+
|
|
198
204
|
export {
|
|
199
205
|
getIntegrationBudgetSnapshot,
|
|
200
206
|
getIntegrationUsageBudget,
|