@agent-native/core 0.161.7 → 0.161.8
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/templates/content/server/plugins/agent-chat.ts +2 -0
- package/corpus/templates/content/server/plugins/feature-flags.ts +5 -0
- package/corpus/templates/content/shared/feature-flags.ts +15 -0
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +9 -0
- package/corpus/templates/slides/actions/patch-deck.ts +8 -0
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +188 -66
- package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +102 -22
- package/corpus/templates/slides/app/components/presentation/PresenterView.tsx +84 -2
- package/corpus/templates/slides/app/context/DeckContext.tsx +94 -3
- package/corpus/templates/slides/app/i18n/en-US.ts +5 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +122 -8
- package/corpus/templates/videos/package.json +9 -0
- package/dist/a2a/correlation.d.ts +6 -6
- package/dist/a2a/correlation.js +8 -6
- package/dist/a2a/types.d.ts +7 -5
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/provider-api/actions/custom-provider-registration.d.ts +13 -13
- package/dist/provider-api/actions/provider-api.d.ts +11 -11
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/call-agent.js +6 -5
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/action-filters-a2a.d.ts +6 -1
- package/dist/server/agent-chat/action-filters-a2a.js +29 -2
- package/dist/server/agent-chat/plugin-options.d.ts +6 -0
- package/dist/server/agent-chat-plugin.d.ts +2 -1
- package/dist/server/agent-chat-plugin.js +20 -4
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -311,9 +311,11 @@ 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;
|
|
316
315
|
provider?: undefined;
|
|
316
|
+
deleted?: undefined;
|
|
317
|
+
found?: undefined;
|
|
318
|
+
message?: undefined;
|
|
317
319
|
providers: {
|
|
318
320
|
id: string;
|
|
319
321
|
label: string;
|
|
@@ -324,46 +326,44 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
324
326
|
updatedAt: number;
|
|
325
327
|
}[];
|
|
326
328
|
count: number;
|
|
327
|
-
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
|
-
deleted?: undefined;
|
|
343
342
|
provider?: undefined;
|
|
343
|
+
deleted?: 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
|
+
found?: undefined;
|
|
354
|
+
message?: undefined;
|
|
353
355
|
providers?: undefined;
|
|
354
356
|
count?: undefined;
|
|
355
|
-
found?: undefined;
|
|
356
357
|
deleted: boolean;
|
|
357
358
|
id: string;
|
|
358
359
|
registered?: undefined;
|
|
359
360
|
label?: undefined;
|
|
360
|
-
message?: undefined;
|
|
361
361
|
} | {
|
|
362
|
-
deleted?: undefined;
|
|
363
362
|
provider?: undefined;
|
|
363
|
+
deleted?: undefined;
|
|
364
|
+
found?: undefined;
|
|
364
365
|
providers?: undefined;
|
|
365
366
|
count?: undefined;
|
|
366
|
-
found?: undefined;
|
|
367
367
|
registered: boolean;
|
|
368
368
|
id: string;
|
|
369
369
|
label: string;
|
|
@@ -73,7 +73,6 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
|
|
|
73
73
|
offset?: unknown;
|
|
74
74
|
limit?: unknown;
|
|
75
75
|
}, {
|
|
76
|
-
deleted?: undefined;
|
|
77
76
|
jobs: {
|
|
78
77
|
id: string;
|
|
79
78
|
name: string;
|
|
@@ -84,6 +83,7 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
|
|
|
84
83
|
updatedAt: string;
|
|
85
84
|
}[];
|
|
86
85
|
total: number;
|
|
86
|
+
deleted?: undefined;
|
|
87
87
|
jobId?: undefined;
|
|
88
88
|
} | {
|
|
89
89
|
jobs?: undefined;
|
|
@@ -91,9 +91,9 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
|
|
|
91
91
|
deleted: boolean;
|
|
92
92
|
jobId: string;
|
|
93
93
|
} | {
|
|
94
|
-
deleted?: undefined;
|
|
95
94
|
jobs?: undefined;
|
|
96
95
|
total?: undefined;
|
|
96
|
+
deleted?: undefined;
|
|
97
97
|
jobId?: undefined;
|
|
98
98
|
hits: Record<string, unknown>[];
|
|
99
99
|
offset: number;
|
|
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
48
48
|
}>;
|
|
49
49
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
50
50
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
51
|
-
ok?: undefined;
|
|
52
51
|
error: string;
|
|
52
|
+
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
54
|
error?: undefined;
|
|
55
55
|
ok: boolean;
|
|
@@ -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();
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -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:
|
|
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 =
|
|
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 {};
|
|
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
26
26
|
expiresAt?: undefined;
|
|
27
27
|
ttlSeconds?: undefined;
|
|
28
28
|
} | {
|
|
29
|
-
error?: undefined;
|
|
30
29
|
token: string;
|
|
31
30
|
expiresAt: string;
|
|
32
31
|
ttlSeconds: number;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.161.
|
|
3
|
+
"version": "0.161.8",
|
|
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": {
|