@agent-native/core 0.161.7 → 0.161.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/content/server/plugins/agent-chat.ts +2 -0
  3. package/corpus/templates/content/server/plugins/feature-flags.ts +5 -0
  4. package/corpus/templates/content/shared/feature-flags.ts +15 -0
  5. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +180 -37
  6. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +18 -3
  7. package/corpus/templates/design/app/components/layout/Layout.tsx +4 -1
  8. package/corpus/templates/design/app/hooks/use-navigation-state.ts +13 -2
  9. package/corpus/templates/design/app/i18n-data.ts +11 -0
  10. package/corpus/templates/design/app/lib/agent-chat.ts +30 -0
  11. package/corpus/templates/design/app/lib/builder-host-chat.ts +34 -0
  12. package/corpus/templates/design/app/lib/builder-host-origin.ts +31 -0
  13. package/corpus/templates/design/app/lib/embed-chrome.ts +70 -0
  14. package/corpus/templates/design/app/lib/shell-design.ts +113 -0
  15. package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +89 -0
  16. package/corpus/templates/design/app/pages/design-editor/nudge-intent.ts +85 -12
  17. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +43 -19
  18. package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +9 -2
  19. package/corpus/templates/design/app/pages/design-editor/tool-state.ts +13 -0
  20. package/corpus/templates/design/app/root.tsx +23 -1
  21. package/corpus/templates/design/server/lib/fusion-screens.ts +17 -1
  22. package/corpus/templates/design/server/plugins/builder-host-embed-headers.ts +37 -0
  23. package/corpus/templates/design/server/routes/[...page].get.ts +1 -0
  24. package/corpus/templates/design/shared/builder-preview-url.ts +113 -0
  25. package/corpus/templates/design/shared/full-app.ts +19 -0
  26. package/corpus/templates/design/shared/shell-screens.ts +139 -0
  27. package/corpus/templates/design/shared/source-mode.ts +10 -0
  28. package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +9 -0
  29. package/corpus/templates/slides/actions/patch-deck.ts +8 -0
  30. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +188 -66
  31. package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +102 -22
  32. package/corpus/templates/slides/app/components/presentation/PresenterView.tsx +84 -2
  33. package/corpus/templates/slides/app/context/DeckContext.tsx +94 -3
  34. package/corpus/templates/slides/app/i18n/en-US.ts +5 -0
  35. package/corpus/templates/slides/app/pages/DeckEditor.tsx +122 -8
  36. package/corpus/templates/videos/package.json +9 -0
  37. package/dist/a2a/correlation.d.ts +6 -6
  38. package/dist/a2a/correlation.js +8 -6
  39. package/dist/a2a/types.d.ts +7 -5
  40. package/dist/client/RuntimeConfigNotice.js +3 -0
  41. package/dist/client/api-surface.d.ts +19 -0
  42. package/dist/client/api-surface.js +32 -0
  43. package/dist/client/application-state.js +4 -0
  44. package/dist/client/builder-frame.d.ts +6 -0
  45. package/dist/client/builder-frame.js +1 -1
  46. package/dist/client/client-status-requests.js +5 -0
  47. package/dist/client/host/index.d.ts +1 -0
  48. package/dist/client/host/index.js +1 -0
  49. package/dist/client/use-action.d.ts +1 -1
  50. package/dist/client/use-action.js +17 -0
  51. package/dist/client/use-session.js +5 -0
  52. package/dist/collab/struct-routes.d.ts +1 -1
  53. package/dist/observability/routes.d.ts +5 -5
  54. package/dist/progress/routes.d.ts +1 -1
  55. package/dist/provider-api/actions/provider-api.d.ts +6 -6
  56. package/dist/scripts/call-agent.js +6 -5
  57. package/dist/secrets/routes.d.ts +9 -9
  58. package/dist/server/agent-chat/action-filters-a2a.d.ts +6 -1
  59. package/dist/server/agent-chat/action-filters-a2a.js +29 -2
  60. package/dist/server/agent-chat/plugin-options.d.ts +6 -0
  61. package/dist/server/agent-chat-plugin.d.ts +2 -1
  62. package/dist/server/agent-chat-plugin.js +20 -4
  63. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  64. package/package.json +1 -1
  65. /package/corpus/templates/design/app/routes/{visual-edit.$id.tsx → visual-edit_.$id.tsx} +0 -0
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
- ok?: undefined;
46
44
  summary: import("./types.js").TraceSummary;
47
45
  spans: import("./types.js").TraceSpan[];
48
46
  id?: undefined;
49
- } | {
50
47
  error?: undefined;
51
48
  ok?: undefined;
49
+ } | {
52
50
  summary?: undefined;
53
51
  spans?: undefined;
54
52
  id: string;
55
- } | {
53
+ error?: undefined;
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  summary?: undefined;
64
63
  spans?: undefined;
65
64
  id?: undefined;
66
65
  ok: boolean;
66
+ error?: undefined;
67
67
  }>>;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- ok: boolean;
19
18
  error?: undefined;
19
+ ok: boolean;
20
20
  }>>;
@@ -311,9 +311,10 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
311
311
  notes?: string | undefined;
312
312
  scope?: "org" | "user" | undefined;
313
313
  }, {
314
- deleted?: undefined;
315
314
  id?: undefined;
315
+ deleted?: undefined;
316
316
  provider?: undefined;
317
+ message?: undefined;
317
318
  providers: {
318
319
  id: string;
319
320
  label: string;
@@ -327,29 +328,29 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
327
328
  found?: undefined;
328
329
  registered?: undefined;
329
330
  label?: undefined;
330
- message?: undefined;
331
331
  } | {
332
- deleted?: undefined;
333
332
  id?: undefined;
333
+ deleted?: undefined;
334
+ message?: undefined;
334
335
  providers?: undefined;
335
336
  count?: undefined;
336
337
  found: boolean;
337
338
  provider: import("../custom-registry.js").CustomProviderConfig;
338
339
  registered?: undefined;
339
340
  label?: undefined;
340
- message?: undefined;
341
341
  } | {
342
342
  deleted?: undefined;
343
343
  provider?: undefined;
344
+ message?: undefined;
344
345
  providers?: undefined;
345
346
  count?: undefined;
346
347
  found: boolean;
347
348
  id: string;
348
349
  registered?: undefined;
349
350
  label?: undefined;
350
- message?: undefined;
351
351
  } | {
352
352
  provider?: undefined;
353
+ message?: undefined;
353
354
  providers?: undefined;
354
355
  count?: undefined;
355
356
  found?: undefined;
@@ -357,7 +358,6 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
357
358
  id: string;
358
359
  registered?: undefined;
359
360
  label?: undefined;
360
- message?: undefined;
361
361
  } | {
362
362
  deleted?: undefined;
363
363
  provider?: undefined;
@@ -37,7 +37,7 @@ function trackA2AInvocation(args) {
37
37
  // Tracking must never affect delegation.
38
38
  }
39
39
  }
40
- function buildDelegationCorrelation(context, selfAppId, invocationId) {
40
+ function buildDelegationCorrelation(context, selfAppId, invocationId, selectedReceiverApp) {
41
41
  const self = normalizeAppHandle(selfAppId);
42
42
  const inheritedVisited = Array.isArray(context?.visitedApps)
43
43
  ? context.visitedApps.map(normalizeAppHandle).filter(Boolean)
@@ -54,6 +54,7 @@ function buildDelegationCorrelation(context, selfAppId, invocationId) {
54
54
  const callerModel = getRequestRunContext()?.model?.trim();
55
55
  return {
56
56
  ...(selfAppId?.trim() ? { callerApp: selfAppId.trim() } : {}),
57
+ ...(selectedReceiverApp ? { selectedReceiverApp } : {}),
57
58
  ...(callerModel ? { callerModel } : {}),
58
59
  ...(context?.threadId ? { callerThreadId: context.threadId } : {}),
59
60
  ...(context?.runId ? { parentRunId: context.runId } : {}),
@@ -320,14 +321,14 @@ export async function run(args, context, selfAppId) {
320
321
  `The request already visited ${[...visited].join(" -> ")}.`);
321
322
  }
322
323
  }
323
- const correlation = buildDelegationCorrelation(context, selfAppId);
324
- const idempotencyKey = message && !taskId
325
- ? buildMessageIdempotencyKey(context?.turnId, agent.url, message)
326
- : undefined;
327
324
  const targetApp = normalizeAppHandle(agent.id) ||
328
325
  normalizeAppHandle(agent.name) ||
329
326
  normalizeAppHandle(agentIdOrName) ||
330
327
  "unknown";
328
+ const correlation = buildDelegationCorrelation(context, selfAppId, undefined, taskId ? undefined : targetApp);
329
+ const idempotencyKey = message && !taskId
330
+ ? buildMessageIdempotencyKey(context?.turnId, agent.url, message)
331
+ : undefined;
331
332
  if (action) {
332
333
  const agentCallId = randomUUID();
333
334
  const startedAt = Date.now();
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- ok?: undefined;
38
37
  status?: undefined;
38
+ ok?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  removed?: undefined;
46
+ ok?: undefined;
47
47
  } | {
48
- error?: undefined;
49
48
  ok: boolean;
50
49
  removed: boolean;
50
+ error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
- ok?: undefined;
58
57
  error: string;
59
58
  note?: undefined;
59
+ ok?: undefined;
60
60
  } | {
61
- error?: undefined;
62
61
  ok: boolean;
63
62
  note?: undefined;
64
- } | {
65
63
  error?: undefined;
64
+ } | {
66
65
  ok: boolean;
67
66
  note: string;
67
+ error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
- error?: undefined;
99
98
  ok: boolean;
100
99
  key: string;
101
- } | {
102
100
  error?: undefined;
101
+ } | {
103
102
  ok: boolean;
104
103
  removed: boolean;
104
+ error?: undefined;
105
105
  }>>;
@@ -126,10 +126,15 @@ export declare function runMCPAgentLoop(runOptions: Parameters<A2AAgentLoopRunne
126
126
  * complete registry is supplied separately so the run loop can load a matched
127
127
  * schema after a tool-search result.
128
128
  */
129
- export declare function createA2AEngineToolSurface(availableTools: EngineTool[], initialToolNames?: string[]): {
129
+ export declare function createA2AEngineToolSurface(availableTools: EngineTool[], initialToolNames?: string[], options?: {
130
+ receiverOwnsObjective?: boolean;
131
+ localCapabilityNames?: string[];
132
+ }): {
130
133
  tools: EngineTool[];
131
134
  availableTools: EngineTool[];
132
135
  };
136
+ export declare function isSelectedA2AReceiver(selectedReceiverApp: string | undefined, appId: string | undefined): boolean;
137
+ export declare function buildSelectedA2AReceiverContext(appId: string): string;
133
138
  /**
134
139
  * The first-request tool catalog: an explicit `initialToolNames` verbatim, or
135
140
  * the app's OWN actions by default.
@@ -421,12 +421,39 @@ export function runMCPAgentLoop(runOptions, pluginOptions, timeoutOptions, optio
421
421
  * complete registry is supplied separately so the run loop can load a matched
422
422
  * schema after a tool-search result.
423
423
  */
424
- export function createA2AEngineToolSurface(availableTools, initialToolNames) {
424
+ export function createA2AEngineToolSurface(availableTools, initialToolNames, options = {}) {
425
+ const selectedInitialNames = options.receiverOwnsObjective
426
+ ? [
427
+ ...new Set([
428
+ ...(initialToolNames ?? []),
429
+ ...(options.localCapabilityNames ?? []),
430
+ ]),
431
+ ]
432
+ : initialToolNames;
433
+ const initialTools = filterInitialEngineTools(availableTools, selectedInitialNames);
425
434
  return {
426
- tools: filterInitialEngineTools(availableTools, initialToolNames),
435
+ tools: options.receiverOwnsObjective
436
+ ? initialTools.filter((tool) => tool.name !== "describe-workspace-apps" &&
437
+ tool.name !== "call-agent")
438
+ : initialTools,
427
439
  availableTools,
428
440
  };
429
441
  }
442
+ export function isSelectedA2AReceiver(selectedReceiverApp, appId) {
443
+ const normalize = (value) => value
444
+ ?.trim()
445
+ .toLowerCase()
446
+ .replace(/^agent-native-/, "") ?? "";
447
+ const selected = normalize(selectedReceiverApp);
448
+ return selected.length > 0 && selected === normalize(appId);
449
+ }
450
+ export function buildSelectedA2AReceiverContext(appId) {
451
+ return `
452
+ <selected-a2a-receiver>
453
+ selectedApp: ${appId}
454
+ The caller already selected this app to own the current objective. Start with this app's declared local capabilities and use tool-search for another local action when needed. A resource name that resembles a different app is not a routing decision. Delegate again only for a genuinely separate subtask; do not substitute another app for loading this app's own actions.
455
+ </selected-a2a-receiver>`;
456
+ }
430
457
  /**
431
458
  * The first-request tool catalog: an explicit `initialToolNames` verbatim, or
432
459
  * the app's OWN actions by default.
@@ -1,5 +1,6 @@
1
1
  import type { ActionEntry, AgentLoopFinalResponseGuard, ProductionAgentOptions } from "../../agent/production-agent.js";
2
2
  import type { AgentChatAttachment, AgentChatReference, MentionProvider } from "../../agent/types.js";
3
+ import type { FeatureFlagDefinition } from "../../feature-flags/registry.js";
3
4
  import type { FrameworkToolsConfig } from "../../framework-tools.js";
4
5
  import type { ExternalAgentPolicy } from "../../mcp/external-agent-policy.js";
5
6
  import type { DatabaseToolsOption } from "../../scripts/db/tool-mode.js";
@@ -363,6 +364,11 @@ export interface AgentChatPluginOptions {
363
364
  * cycle safety does not depend on removing the tool.
364
365
  */
365
366
  a2aAgentDelegation?: boolean;
367
+ /**
368
+ * Default-off app-owned rollout for binding a delegated objective to this
369
+ * selected receiver before it considers another cross-app delegation.
370
+ */
371
+ a2aReceiverOwnershipFlag?: FeatureFlagDefinition;
366
372
  /**
367
373
  * Resource budget for delegated A2A/MCP agent turns. Defaults are stricter
368
374
  * than interactive chat because every retained tool result is re-sent on
@@ -4,7 +4,7 @@ import type { ResolvedKeyReference } from "../secrets/substitution.js";
4
4
  import { handleSharedThreadRequest, type SharedThreadRouteDependencies } from "./agent-chat/shared-thread.js";
5
5
  export { handleSharedThreadRequest };
6
6
  export type { SharedThreadRouteDependencies };
7
- import { createA2AEngineToolSurface, DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, runA2AAgentLoop, runMCPAgentLoop, assembleA2AFinalResponse, buildPublicAgentA2ASkills } from "./agent-chat/action-filters-a2a.js";
7
+ import { buildSelectedA2AReceiverContext, createA2AEngineToolSurface, DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, isSelectedA2AReceiver, runA2AAgentLoop, runMCPAgentLoop, assembleA2AFinalResponse, buildPublicAgentA2ASkills } from "./agent-chat/action-filters-a2a.js";
8
8
  import { _agentChatPromptSectionsForTests } from "./agent-chat/framework-prompts.js";
9
9
  import { type AgentChatPluginOptions, type NitroPluginDef } from "./agent-chat/plugin-options.js";
10
10
  import { finalizeClaimedAgentChatProcessRunFailure } from "./agent-chat/process-run-failure.js";
@@ -29,6 +29,7 @@ export type { AgentChatPluginOptions };
29
29
  export { runA2AAgentLoop };
30
30
  export { runMCPAgentLoop };
31
31
  export { createA2AEngineToolSurface };
32
+ export { buildSelectedA2AReceiverContext, isSelectedA2AReceiver };
32
33
  export { DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, };
33
34
  export { shouldBlockInProductCodeEditingSurface };
34
35
  export { loadRunCodeToolEntries };
@@ -27,6 +27,7 @@ import { adoptThreadScopeIfUnscoped, createThread, forkThread, getThread, regist
27
27
  import { isCheckpointRestorePath } from "../checkpoints/route-match.js";
28
28
  import { createDbAdminAgentTools } from "../db-admin/agent-tools.js";
29
29
  import { isProductionServerlessFunctionRuntime, isTransientDatabaseError, } from "../db/client.js";
30
+ import { isFeatureFlagEnabled } from "../feature-flags/index.js";
30
31
  import { filterFrameworkToolGroups, resolveFrameworkTools, } from "../framework-tools.js";
31
32
  import { verifyInternalToken, extractBearerToken, } from "../integrations/internal-token.js";
32
33
  import { RECURRING_JOBS_SWEEP_PATH, RECURRING_JOBS_SWEEP_TOKEN_SUBJECT, } from "../jobs/scheduler-dispatch.js";
@@ -111,7 +112,7 @@ import { buildSystemManifestSections, setContextXraySystemSections, } from "../a
111
112
  // the ones that were already part of the public surface) so
112
113
  // `createAgentChatPlugin` below stays a thinner orchestrator.
113
114
  // ---------------------------------------------------------------------------
114
- import { createA2AEngineToolSurface, DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, filterAgentTools, filterPublicAgentActions, filterDirectA2AActions, filterReadOnlyActions, resolveInitialToolNames, runA2AAgentLoop, runMCPAgentLoop, assembleA2AFinalResponse, buildPublicAgentA2ASkills, buildAuthenticatedAgentA2ASkills, resolveArtifactBaseUrl, } from "./agent-chat/action-filters-a2a.js";
115
+ import { buildSelectedA2AReceiverContext, createA2AEngineToolSurface, DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, filterAgentTools, filterPublicAgentActions, filterDirectA2AActions, filterReadOnlyActions, isSelectedA2AReceiver, resolveInitialToolNames, runA2AAgentLoop, runMCPAgentLoop, assembleA2AFinalResponse, buildPublicAgentA2ASkills, buildAuthenticatedAgentA2ASkills, resolveArtifactBaseUrl, } from "./agent-chat/action-filters-a2a.js";
115
116
  import { createBuilderBrowserTool, createTeamTools, } from "./agent-chat/browser-team-tools.js";
116
117
  import { createDataWidgetActionEntries, createFrameworkContextEntry, createRefreshScreenEntry, createUrlTools, } from "./agent-chat/context-tools.js";
117
118
  import { _agentChatPromptSectionsForTests, buildFrameworkPrompts, buildSchemaBlock, collectFiles, corpusToolNamesTaughtByPrompt, generateActionsPrompt, generateCorpusToolsPrompt, } from "./agent-chat/framework-prompts.js";
@@ -141,6 +142,7 @@ export function buildLeanSystemPrompt(input) {
141
142
  export { runA2AAgentLoop };
142
143
  export { runMCPAgentLoop };
143
144
  export { createA2AEngineToolSurface };
145
+ export { buildSelectedA2AReceiverContext, isSelectedA2AReceiver };
144
146
  export { DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, };
145
147
  export { shouldBlockInProductCodeEditingSurface };
146
148
  export { loadRunCodeToolEntries };
@@ -1384,13 +1386,21 @@ export function createAgentChatPlugin(options) {
1384
1386
  ? ""
1385
1387
  : await buildSchemaBlock(owner, databaseToolsMode);
1386
1388
  const extra = await resolveExtraContext(context.event, owner);
1389
+ const correlation = sanitizeA2ACorrelationMetadata(context.metadata);
1390
+ const receiverOwnsObjective = isSelectedA2AReceiver(correlation.selectedReceiverApp, options?.appId) &&
1391
+ !!options?.a2aReceiverOwnershipFlag &&
1392
+ (await isFeatureFlagEnabled(options.a2aReceiverOwnershipFlag, {
1393
+ userEmail,
1394
+ userKey: userEmail,
1395
+ orgId: getRequestOrgId() ?? undefined,
1396
+ }));
1387
1397
  const a2aStoredModel = await getStoredModelForEngine(a2aEngine, {
1388
1398
  appId: options?.appId,
1389
1399
  });
1390
1400
  // Preference only, and last before the default: an app that pinned
1391
1401
  // a model keeps it. Read separately from the correlation sanitizer
1392
1402
  // below so it stays out of every identity/access path.
1393
- const a2aCallerModelHint = sanitizeA2ACorrelationMetadata(context.metadata).callerModel;
1403
+ const a2aCallerModelHint = correlation.callerModel;
1394
1404
  const model = resolveDelegatedRunModel(a2aEngine, {
1395
1405
  explicitModel: options?.model,
1396
1406
  storedModel: a2aStoredModel,
@@ -1429,6 +1439,9 @@ export function createAgentChatPlugin(options) {
1429
1439
  // a day rollover (or the resources/extra content changing) only
1430
1440
  // invalidates the cached prompt prefix as late as possible.
1431
1441
  const runtimeContext = runtimeContextForEvent(context.event);
1442
+ const selectedReceiverContext = receiverOwnsObjective && options?.appId
1443
+ ? buildSelectedA2AReceiverContext(options.appId)
1444
+ : "";
1432
1445
  // Delegated turns use native template actions in every environment,
1433
1446
  // so they must also receive the native-tool prompt. The interactive
1434
1447
  // dev prompt teaches `pnpm action` and would send this receiver back
@@ -1439,6 +1452,7 @@ export function createAgentChatPlugin(options) {
1439
1452
  schemaBlock +
1440
1453
  extra +
1441
1454
  modelOverlay +
1455
+ selectedReceiverContext +
1442
1456
  runtimeContext;
1443
1457
  if (a2aRunContext)
1444
1458
  a2aRunContext.systemPrompt = systemPrompt;
@@ -1502,7 +1516,10 @@ export function createAgentChatPlugin(options) {
1502
1516
  ...(resolvedProdCodeExec !== "off" ? runCodeTool : {}),
1503
1517
  ...prodCodingTools,
1504
1518
  });
1505
- const a2aToolSurface = createA2AEngineToolSurface(actionsToEngineTools(a2aActions), effectiveInitialToolNames);
1519
+ const a2aToolSurface = createA2AEngineToolSurface(actionsToEngineTools(a2aActions), effectiveInitialToolNames, {
1520
+ receiverOwnsObjective,
1521
+ localCapabilityNames: mcpOptions.connectorCatalog,
1522
+ });
1506
1523
  // Precise current time rides the user message (not the cached
1507
1524
  // system-prompt prefix) — same pattern as the interactive handler.
1508
1525
  const a2aMessages = [
@@ -1546,7 +1563,6 @@ export function createAgentChatPlugin(options) {
1546
1563
  recoverableArtifactStatusWriter.enqueue(activityStatusMessage());
1547
1564
  };
1548
1565
  const controller = new AbortController();
1549
- const correlation = sanitizeA2ACorrelationMetadata(context.metadata);
1550
1566
  const telemetryThreadId = sanitizeA2ACorrelationId(context.contextId) ??
1551
1567
  correlation.callerThreadId ??
1552
1568
  context.taskId;
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
27
27
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
28
28
  error: any;
29
29
  } | {
30
- error?: undefined;
31
30
  ok: boolean;
32
31
  key: string;
33
32
  baseUrlKey?: string;
34
33
  scope: AgentEngineApiKeyScope;
34
+ error?: undefined;
35
35
  }>>;
36
36
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.161.7",
3
+ "version": "0.161.9",
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": {