Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): describe the agent's invocable tools to channel routes (#4077)

Rui6c2e94194638
diff --git a/.changeset/route-args-describe.md b/.changeset/route-args-describe.md
new file mode 100644
index 000000000..f3f969e92
--- /dev/null
+++ b/.changeset/route-args-describe.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Channel route handlers now receive `describe()`, which returns the agent's name, description, and the compiled tools a caller can run outside a turn, with their JSON schemas, without the inspection detail of `GET /eve/v1/info`.
diff --git a/docs/channels/custom.mdx b/docs/channels/custom.mdx
index 38fecf1fb..655811019 100644
--- a/docs/channels/custom.mdx
+++ b/docs/channels/custom.mdx
@@ -67,6 +67,7 @@ Each route receives these operation surfaces:
- `attachSession(sessionId)` creates an I/O-free handle pinned to one durable session ID.
- `to(channel, target).send(message, options)` hands work to another authored channel.
- `params`, `waitUntil`, and `requestIp` provide request metadata and lifetime control.
+- `describe()` returns the agent's name, description, and the compiled tools a caller can run outside a turn, with their JSON schemas, sorted by name. It carries no paths, config, or other inspection detail, so a channel can publish it to its callers. Tools that need a turn (framework tools, workflow and provider tools, tools without `execute`) and tools added by dynamic resolvers or subagents are left out.
Event handlers receive `(eventData, channel, ctx)`. `ctx.session.id` identifies
the exact session, while `channel.continuation` exposes the current address and
diff --git a/packages/eve/extension-contracts/compatibility/channel/v45.ts b/packages/eve/extension-contracts/compatibility/channel/v45.ts
new file mode 100644
index 000000000..7edf7fe0d
--- /dev/null
+++ b/packages/eve/extension-contracts/compatibility/channel/v45.ts
@@ -0,0 +1,11 @@
+import { defineChannel, GET } from "#public/channels/index.js";
+
+// Epoch 45 route handlers had no `describe` arg; epoch 46 adds it.
+export default defineChannel({
+ routes: [
+ GET("/status/:sessionId", async (_request, { attachSession, params, requestIp }) => {
+ await attachSession(params.sessionId!).cancel();
+ return Response.json({ requestIp });
+ }),
+ ],
+});
diff --git a/packages/eve/extension-contracts/reports/channel/v46.json b/packages/eve/extension-contracts/reports/channel/v46.json
new file mode 100644
index 000000000..3aaaafd73
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/channel/v46.json
@@ -0,0 +1,21 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "channel",
+ "epoch": 46,
+ "sha256": "88aba4042a81fef33a617ac3ce43f718701f914536189fff68326c959fabcfd2",
+ "exports": [
+ "DELETE",
+ "GET",
+ "HEAD",
+ "OPTIONS",
+ "PATCH",
+ "POST",
+ "PUT",
+ "WS",
+ "createWebSocketUpgradeServer",
+ "defineChannel",
+ "disableRoute",
+ "isChannel",
+ "isDisabledRouteSentinel"
+ ]
+}
diff --git a/packages/eve/src/channel/agent-description.ts b/packages/eve/src/channel/agent-description.ts
new file mode 100644
index 000000000..639eb70cc
--- /dev/null
+++ b/packages/eve/src/channel/agent-description.ts
@@ -0,0 +1,70 @@
+import type { CompiledAgentManifest, CompiledToolDefinition } from "#compiler/manifest.js";
+import { isInvocableCompiledTool } from "#channel/tool-eligibility.js";
+import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
+import { loadCompiledManifest } from "#runtime/loaders/manifest.js";
+import type { JsonObject } from "#shared/json.js";
+
+/** One compiled tool a caller can invoke outside a turn. */
+export interface AgentToolDescription {
+ readonly name: string;
+ readonly description: string;
+ readonly inputSchema: JsonObject;
+ readonly outputSchema?: JsonObject;
+ /** The tool declares an approval policy. */
+ readonly approval: boolean;
+}
+
+/**
+ * The caller-facing view of an agent: its name, description, and the compiled
+ * tools `invokeTool` can run, sorted by name. Unlike `GET /eve/v1/info`, it
+ * carries no paths, config, diagnostics, or other inspection detail, so
+ * channels can publish it as is. Tools added by dynamic resolvers and
+ * subagents are not listed.
+ */
+export interface AgentDescription {
+ readonly name: string;
+ readonly description?: string;
+ readonly tools: readonly AgentToolDescription[];
+}
+
+/**
+ * The `describe` route handler arg for one compiled agent. The artifacts
+ * source resolves on first use, so routes that never call it pay nothing.
+ */
+export function createAgentDescriptionRouteArgs(
+ resolveCompiledArtifactsSource: () => RuntimeCompiledArtifactsSource,
+): { describe(): Promise<AgentDescription> } {
+ return {
+ async describe() {
+ const compiledArtifactsSource = resolveCompiledArtifactsSource();
+ return describeCompiledAgent(await loadCompiledManifest({ compiledArtifactsSource }));
+ },
+ };
+}
+
+/** Projects the root node of a compiled manifest onto {@link AgentDescription}. */
+export function describeCompiledAgent(manifest: CompiledAgentManifest): AgentDescription {
+ const tools = manifest.tools
+ .filter((tool) => isInvocableCompiledTool(manifest, tool))
+ .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0))
+ .map(describeTool);
+ const description: { -readonly [K in keyof AgentDescription]: AgentDescription[K] } = {
+ name: manifest.config.name,
+ tools,
+ };
+ if (manifest.config.description !== undefined) {
+ description.description = manifest.config.description;
+ }
+ return description;
+}
+
+function describeTool(tool: CompiledToolDefinition): AgentToolDescription {
+ const description: { -readonly [K in keyof AgentToolDescription]: AgentToolDescription[K] } = {
+ name: tool.name,
+ description: tool.description,
+ inputSchema: tool.inputSchema ?? {},
+ approval: tool.requiresApproval,
+ };
+ if (tool.outputSchema !== undefined) description.outputSchema = tool.outputSchema;
+ return description;
+}
diff --git a/packages/eve/src/channel/routes.ts b/packages/eve/src/channel/routes.ts
index a9acb9af0..6fc4f631e 100644
--- a/packages/eve/src/channel/routes.ts
+++ b/packages/eve/src/channel/routes.ts
@@ -6,6 +6,7 @@ import type { InputResponse } from "#shared/input.js";
import type { Session } from "#channel/session.js";
import type { JsonObject } from "#shared/json.js";
import type { ChannelMethod } from "#public/definitions/channel.js";
+import type { AgentDescription } from "#channel/agent-description.js";
type WebSocketHeaders = Headers | readonly (readonly [string, string])[] | Record<string, string>;
@@ -32,6 +33,12 @@ export interface RouteHandlerArgs<TState = undefined> {
waitUntil: (task: Promise<unknown>) => void;
/** Best-effort client IP reported by the host, or `null` when unavailable. */
requestIp: string | null;
+ /**
+ * Describes the agent for callers: its name, description, and the compiled
+ * tools that can run outside a turn, sorted by name. Carries none of the
+ * inspection detail of `GET /eve/v1/info`.
+ */
+ describe(): Promise<AgentDescription>;
}
export interface SendPayload {
diff --git a/packages/eve/src/channel/tool-eligibility.ts b/packages/eve/src/channel/tool-eligibility.ts
new file mode 100644
index 000000000..061a042a0
--- /dev/null
+++ b/packages/eve/src/channel/tool-eligibility.ts
@@ -0,0 +1,57 @@
+import type { CompiledToolDefinition } from "#compiler/manifest.js";
+import type { AgentSourceOwner } from "#compiler/source-graph.js";
+
+/** The part of a compiled manifest that records who contributed each source. */
+export interface CompiledToolBindings {
+ readonly bindings: Readonly<Record<string, { readonly owner: AgentSourceOwner }>>;
+}
+
+/**
+ * The one rule for whether a compiled tool can run outside a turn. `describe()`
+ * lists only tools for which it holds, and `invokeTool` refuses the rest.
+ *
+ * A tool is invocable when all three hold:
+ *
+ * 1. `hasExecute`: the tool has an `execute` function.
+ * 2. No `behavior.handling`. Handled tools (`dispatch`, `workflow-tool`,
+ * `provider-tool`, and any handling kind added later) are run by the
+ * harness or a provider, not by calling `execute`.
+ * 3. The owner of its source binding is not `"framework"`. This is a
+ * conservative phase-1 policy, stricter than the mechanical predicate in
+ * the research plan (`hasExecute` minus handled tools and framework
+ * actions). It is not a claim that every framework tool needs a turn: some,
+ * such as `load_skill` and `agent`, depend on the turn's harness or
+ * session, while others, such as `web_fetch`, could run without one. They
+ * are all withheld so that phase 1 publishes only tools the application or
+ * an extension authored; exposing individual framework tools is a later,
+ * explicit decision. An application or extension tool that overrides a
+ * framework tool name is owned by the application or extension and stays
+ * invocable.
+ *
+ * There is no background-tool marker in the compiled registry. A background
+ * tool is excluded only when one of these rules already covers it.
+ *
+ * Throws when the tool has no source binding, which a valid manifest never
+ * produces.
+ */
+export function isInvocableCompiledTool(
+ manifest: CompiledToolBindings,
+ tool: Pick<CompiledToolDefinition, "behavior" | "hasExecute" | "name" | "sourceId">,
+): boolean {
+ const owner = compiledToolOwner(manifest, tool);
+ return tool.hasExecute && tool.behavior?.handling === undefined && owner.kind !== "framework";
+}
+
+/** Owner of the source binding that contributed a compiled tool. */
+export function compiledToolOwner(
+ manifest: CompiledToolBindings,
+ tool: Pick<CompiledToolDefinition, "name" | "sourceId">,
+): AgentSourceOwner {
+ const binding = Object.hasOwn(manifest.bindings, tool.sourceId)
+ ? manifest.bindings[tool.sourceId]
+ : undefined;
+ if (binding === undefined) {
+ throw new Error(`Compiled tool "${tool.name}" has no source binding.`);
+ }
+ return binding.owner;
+}
diff --git a/packages/eve/src/client/subagent-stream.integration.test.ts b/packages/eve/src/client/subagent-stream.integration.test.ts
index 5fd35a98b..08c83ba35 100644
--- a/packages/eve/src/client/subagent-stream.integration.test.ts
+++ b/packages/eve/src/client/subagent-stream.integration.test.ts
@@ -19,6 +19,7 @@ import {
import { EVE_SUBAGENT_STREAM_ROUTE_PATTERN } from "#protocol/routes.js";
import { none } from "#public/channels/auth.js";
import { eveChannel } from "#public/channels/eve.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const PARENT_ORIGIN = "https://parent.test";
const REMOTE_URL = "https://remote.test/base";
@@ -157,6 +158,7 @@ function createParentRoute(
const segments = new URL(request.url).pathname.split("/");
const args = attachRemoteAgentStreamHeadersResolver(
{
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession: vi.fn().mockReturnValue(parent),
params: {
diff --git a/packages/eve/src/compiler/extension-compatibility.ts b/packages/eve/src/compiler/extension-compatibility.ts
index 77c274f10..7d3f1b649 100644
--- a/packages/eve/src/compiler/extension-compatibility.ts
+++ b/packages/eve/src/compiler/extension-compatibility.ts
@@ -114,10 +114,10 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
},
},
channel: {
- current: 45,
+ current: 46,
supported: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45,
+ 43, 44, 45, 46,
],
dropped: {
12: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
diff --git a/packages/eve/src/execution/session/entry-authorization.integration.test.ts b/packages/eve/src/execution/session/entry-authorization.integration.test.ts
index 997fbbc8c..3a1156115 100644
--- a/packages/eve/src/execution/session/entry-authorization.integration.test.ts
+++ b/packages/eve/src/execution/session/entry-authorization.integration.test.ts
@@ -34,6 +34,7 @@ import {
expectHookClaims,
expectSingleTurn,
} from "#internal/testing/entry-test-helpers.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
afterEach(() => {
vi.unstubAllGlobals();
@@ -115,6 +116,7 @@ describe("workflowEntry integration", () => {
method: "POST",
}),
{
+ ...mockAgentRouteArgs(),
...operations,
attachSession: vi.fn() as never,
params: {},
diff --git a/packages/eve/src/execution/turn-cancellation.integration.test.ts b/packages/eve/src/execution/turn-cancellation.integration.test.ts
index 24758626a..6c139a7bc 100644
--- a/packages/eve/src/execution/turn-cancellation.integration.test.ts
+++ b/packages/eve/src/execution/turn-cancellation.integration.test.ts
@@ -28,6 +28,7 @@ import type { ToolContext } from "#tools/definition.js";
import type { ResolvedToolDefinition } from "#runtime/types.js";
import { toInputSchema } from "#tools/schema.js";
import { captureConsoleOutput } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
/**
* Turn cancellation settles as `turn.cancelled` → `session.waiting` with
@@ -296,6 +297,7 @@ function createCancelRouteCaller(): (
},
);
const args = {
+ ...mockAgentRouteArgs(),
...mockChannelContext(() => {
throw new Error("cancel route must not send through a channel address");
}),
diff --git a/packages/eve/src/internal/nitro/routes/channel-dispatch.ts b/packages/eve/src/internal/nitro/routes/channel-dispatch.ts
index f5b64b871..d7d44c44a 100644
--- a/packages/eve/src/internal/nitro/routes/channel-dispatch.ts
+++ b/packages/eve/src/internal/nitro/routes/channel-dispatch.ts
@@ -8,6 +8,7 @@ import type { RouteContext } from "#public/definitions/channel.js";
import { getChannelInstrumentationKind } from "#channel/compiled-channel.js";
import { createCrossChannelToFn, toCrossChannelTargets } from "#channel/cross-channel-receive.js";
import type { RouteHandlerArgs, WebSocketRouteHooks } from "#channel/routes.js";
+import { createAgentDescriptionRouteArgs } from "#channel/agent-description.js";
import { createChannelOperations } from "#channel/channel-operations.js";
import { createChannelDeliveryMetadata } from "#channel/delivery-metadata.js";
import { createAttachSessionFn } from "#channel/session.js";
@@ -21,7 +22,10 @@ import {
attachRemoteAgentStreamHeadersResolver,
attachRouteSessionCreator,
} from "#internal/nitro/routes/channel-route-context.js";
-import type { NitroArtifactsConfig } from "#internal/nitro/routes/runtime-artifacts.js";
+import {
+ type NitroArtifactsConfig,
+ resolveNitroCompiledArtifactsSource,
+} from "#internal/nitro/routes/runtime-artifacts.js";
import { traceChannelRequest } from "#internal/nitro/routes/channel-request-instrumentation.js";
import { resolveNitroChannelRuntimeBundle } from "#internal/nitro/routes/runtime-stack.js";
import { readVercelProjectLink } from "#internal/vercel/project-link.js";
@@ -272,6 +276,7 @@ async function buildRouteArgs(
{
attachSession,
...channelOperations,
+ ...createAgentDescriptionRouteArgs(() => resolveNitroCompiledArtifactsSource(config)),
params,
requestIp,
to,
diff --git a/packages/eve/src/internal/testing/channel-conformance/harness.ts b/packages/eve/src/internal/testing/channel-conformance/harness.ts
index 23412d83b..1e2f88138 100644
--- a/packages/eve/src/internal/testing/channel-conformance/harness.ts
+++ b/packages/eve/src/internal/testing/channel-conformance/harness.ts
@@ -375,6 +375,7 @@ async function converse(
};
},
attachSession,
+ describe: unsupported("describe"),
params,
requestIp: null,
to: unsupported("to"),
diff --git a/packages/eve/src/internal/testing/mocks/mock-route-args.ts b/packages/eve/src/internal/testing/mocks/mock-route-args.ts
new file mode 100644
index 000000000..3498acddd
--- /dev/null
+++ b/packages/eve/src/internal/testing/mocks/mock-route-args.ts
@@ -0,0 +1,10 @@
+import type { RouteHandlerArgs } from "#channel/routes.js";
+
+/** The agent route args, for tests whose routes never call them. */
+export function mockAgentRouteArgs(): Pick<RouteHandlerArgs, "describe"> {
+ return {
+ describe: async () => {
+ throw new Error("describe() is unavailable in this test.");
+ },
+ };
+}
diff --git a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
index 5c604fe97..294f872c2 100644
--- a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
+++ b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
@@ -30,6 +30,7 @@ import type {
WebhookOptions,
} from "#compiled/chat/index.js";
import { Message, parseMarkdown } from "#compiled/chat/index.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
it("shares Chat SDK type identity with external adapters and handlers", () => {
expectTypeOf<Message>().toEqualTypeOf<ExternalMessage>();
@@ -117,6 +118,7 @@ async function firePost(
method: "POST",
}),
{
+ ...mockAgentRouteArgs(),
from(continuationToken) {
return {
...channelContext.from(continuationToken),
@@ -218,6 +220,7 @@ describe("chatSdkChannel", () => {
const response = await get.handler(
new Request("https://example.com/eve/v1/test?crc_token=abc123", { method: "GET" }),
{
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession: vi.fn() as any,
params: {},
diff --git a/packages/eve/src/public/channels/discord/discordChannel.test.ts b/packages/eve/src/public/channels/discord/discordChannel.test.ts
index 7ac485658..4aab923b6 100644
--- a/packages/eve/src/public/channels/discord/discordChannel.test.ts
+++ b/packages/eve/src/public/channels/discord/discordChannel.test.ts
@@ -16,6 +16,7 @@ import {
} from "#public/channels/discord/hitl.js";
import { defaultDiscordAuth, discordChannel } from "#public/channels/discord/index.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
function asCompiled<T = unknown>(channel: unknown): CompiledChannel<T> {
if (!isCompiledChannel(channel)) {
@@ -144,6 +145,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(request, {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
to: vi.fn() as any,
diff --git a/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts b/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
index 1344c6e12..989a024a7 100644
--- a/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
+++ b/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
@@ -31,6 +31,7 @@ import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
import { eveChannel, type EveChannelInput } from "#public/channels/eve.js";
import { attachRouteSessionCreator } from "#internal/nitro/routes/channel-route-context.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const ROUTER_CALLER: SessionAuthContext = {
attributes: {},
@@ -93,6 +94,7 @@ function createEveCreateHandler(input: EveChannelInput) {
async fetch(req: Request) {
const args = attachRouteSessionCreator<RouteHandlerArgs>(
{
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession: vi.fn() as any,
to: vi.fn() as never,
diff --git a/packages/eve/src/public/channels/eve-session-routes.test.ts b/packages/eve/src/public/channels/eve-session-routes.test.ts
index 3dbd21601..a5567a4f8 100644
--- a/packages/eve/src/public/channels/eve-session-routes.test.ts
+++ b/packages/eve/src/public/channels/eve-session-routes.test.ts
@@ -9,6 +9,7 @@ import { writeForwardedParentSessionBaggage } from "#protocol/baggage.js";
import { none } from "#public/channels/auth.js";
import { eveChannel, type TrustedForwarders } from "#public/channels/eve.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
function route(
method: "GET" | "POST",
@@ -39,6 +40,7 @@ function createFixedSession(overrides: Partial<Session> = {}): Session {
function createArgs(session = createFixedSession()): RouteHandlerArgs {
return {
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession: () => session,
to: vi.fn() as never,
diff --git a/packages/eve/src/public/channels/eve-subagent-stream.test.ts b/packages/eve/src/public/channels/eve-subagent-stream.test.ts
index 05265e917..558f52840 100644
--- a/packages/eve/src/public/channels/eve-subagent-stream.test.ts
+++ b/packages/eve/src/public/channels/eve-subagent-stream.test.ts
@@ -12,6 +12,7 @@ import { createAgentStartedEvent, type MessageStreamEvent } from "#protocol/mess
import { EVE_SUBAGENT_STREAM_ROUTE_PATTERN } from "#protocol/routes.js";
import { none, type AuthFn } from "#public/channels/auth.js";
import { eveChannel } from "#public/channels/eve.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const coordinates = {
callId: "call-1",
@@ -250,6 +251,7 @@ function createHarness(input: {
function createRouteArgs(attachSession: RouteHandlerArgs["attachSession"]): RouteHandlerArgs {
return {
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession,
to: vi.fn() as never,
diff --git a/packages/eve/src/public/channels/eve.test.ts b/packages/eve/src/public/channels/eve.test.ts
index 4f413545a..ed7696603 100644
--- a/packages/eve/src/public/channels/eve.test.ts
+++ b/packages/eve/src/public/channels/eve.test.ts
@@ -30,6 +30,7 @@ import {
import { createMessageCompletedEvent } from "#protocol/message.js";
import { writeForwardedParentSessionBaggage } from "#protocol/baggage.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
/**
* Unit coverage for the inbound HTTP route's message-body parser and
@@ -93,6 +94,7 @@ function createMockSession(overrides: Partial<Session> = {}): Session {
function createRouteArgs(): RouteHandlerArgs {
return {
+ ...mockAgentRouteArgs(),
...mockChannelContext(vi.fn()),
attachSession: () => createMockSession(),
to: vi.fn() as never,
diff --git a/packages/eve/src/public/channels/github/githubChannel.test.ts b/packages/eve/src/public/channels/github/githubChannel.test.ts
index b5a5c848a..5c36d8a8c 100644
--- a/packages/eve/src/public/channels/github/githubChannel.test.ts
+++ b/packages/eve/src/public/channels/github/githubChannel.test.ts
@@ -14,6 +14,7 @@ import { githubChannel } from "#public/channels/github/githubChannel.js";
import { type GitHubChannelState } from "#public/channels/github/state.js";
import { signGitHubWebhookBody } from "#public/channels/github/verify.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const SECRET = "github-secret";
@@ -169,6 +170,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(request, {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
params: {},
diff --git a/packages/eve/src/public/channels/index.ts b/packages/eve/src/public/channels/index.ts
index 4ec1a58be..5bedf3a48 100644
--- a/packages/eve/src/public/channels/index.ts
+++ b/packages/eve/src/public/channels/index.ts
@@ -42,6 +42,8 @@ export {
type TurnPolicy,
type RouteDefinition,
type RouteHandlerArgs,
+ type AgentDescription,
+ type AgentToolDescription,
type HttpRouteDefinition,
type WebSocketMessage,
type WebSocketPeer,
diff --git a/packages/eve/src/public/channels/linear/linearChannel.test.ts b/packages/eve/src/public/channels/linear/linearChannel.test.ts
index 3d1d6f2c1..c6478c803 100644
--- a/packages/eve/src/public/channels/linear/linearChannel.test.ts
+++ b/packages/eve/src/public/channels/linear/linearChannel.test.ts
@@ -13,6 +13,7 @@ import { linearChannel, type LinearChannelState } from "#public/channels/linear/
import { signLinearWebhookBody } from "#public/channels/linear/verify.js";
import type { InputRequest } from "#shared/input.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const SECRET = "linear-secret";
@@ -130,6 +131,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(request, {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
params: {},
diff --git a/packages/eve/src/public/channels/mcp.test.ts b/packages/eve/src/public/channels/mcp.test.ts
index 31fb24fed..cafbe489f 100644
--- a/packages/eve/src/public/channels/mcp.test.ts
+++ b/packages/eve/src/public/channels/mcp.test.ts
@@ -10,6 +10,7 @@ import {
import { MCP_PROTOCOL_VERSION } from "#internal/mcp/streamable-http-server.js";
import { ForbiddenError, none, oauthResource, withAuthChallenges } from "#public/channels/auth.js";
import { mcpChannel } from "#public/channels/mcp.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const MCP_LEGACY_PROTOCOL_VERSION = "2025-11-25";
@@ -487,6 +488,7 @@ function routeArgs(createSession: () => Promise<never> = vi.fn()): RouteHandlerA
throw new Error("Route operation is unavailable in this test.");
};
const args: RouteHandlerArgs = {
+ ...mockAgentRouteArgs(),
attachSession: unavailable,
from: unavailable,
params: {},
diff --git a/packages/eve/src/public/channels/slack/slackChannel.test.ts b/packages/eve/src/public/channels/slack/slackChannel.test.ts
index 67594b201..e4106fe5e 100644
--- a/packages/eve/src/public/channels/slack/slackChannel.test.ts
+++ b/packages/eve/src/public/channels/slack/slackChannel.test.ts
@@ -54,6 +54,7 @@ import {
} from "#public/channels/slack/slackChannel.js";
import type { SessionContext } from "#public/definitions/callback-context.js";
import { type InputResponse, parseInputResponses } from "#shared/input.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
function slackRespondTypeChecks(
interaction: SlackInteractionContext,
@@ -479,6 +480,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(request, {
+ ...mockAgentRouteArgs(),
from,
resolveSession: (address) =>
(overrides.resolveSession?.(address) ?? Promise.resolve({ id: "s1" })) as never,
@@ -5792,6 +5794,7 @@ describe("slackChannel().receive", () => {
if (!post) throw new Error("expected POST route");
const waitUntil = vi.fn();
await post.handler(req, {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(inboundSend),
waitUntil,
diff --git a/packages/eve/src/public/channels/teams/teamsChannel.test.ts b/packages/eve/src/public/channels/teams/teamsChannel.test.ts
index 8c67844b4..21ad2e7e2 100644
--- a/packages/eve/src/public/channels/teams/teamsChannel.test.ts
+++ b/packages/eve/src/public/channels/teams/teamsChannel.test.ts
@@ -12,6 +12,7 @@ import {
} from "#internal/testing/mocks/mock-channel-operations.js";
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
import { teamsChannel, type TeamsChannelState } from "#public/channels/teams/index.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
function adapter(channel: unknown) {
return asCompiled<TeamsChannelState>(channel).adapter;
@@ -88,6 +89,7 @@ async function firePost(
method: "POST",
}),
{
+ ...mockAgentRouteArgs(),
from(continuationToken) {
return baseFrom(continuationToken);
},
diff --git a/packages/eve/src/public/channels/telegram/telegramChannel.test.ts b/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
index 4421ce60b..1d1e3e177 100644
--- a/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
+++ b/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
@@ -15,6 +15,7 @@ import {
} from "#public/channels/telegram/index.js";
import { isTelegramBotMentioned } from "#public/channels/telegram/defaults.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const SECRET = "telegram-secret";
@@ -94,6 +95,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(signedRequest(JSON.stringify(body)), {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
resolveSession: options.resolveSession ?? (async () => undefined),
@@ -364,6 +366,7 @@ describe("telegramChannel() inbound route", () => {
method: "POST",
}),
{
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
to: vi.fn() as any,
diff --git a/packages/eve/src/public/channels/twilio/twilioChannel.test.ts b/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
index d3e6b68c3..9611447c7 100644
--- a/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
+++ b/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
@@ -12,6 +12,7 @@ import type { TwilioTextMessage } from "#public/channels/twilio/inbound.js";
import { twilioChannel, type TwilioContext } from "#public/channels/twilio/twilioChannel.js";
import { signTwilioRequest } from "#public/channels/twilio/verify.js";
import { captureLogRecords } from "#internal/testing/log-records.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
const AUTH_TOKEN = "test-auth-token";
@@ -111,6 +112,7 @@ async function firePost(
const waitUntil = vi.fn();
const response = await post.handler(signedFormRequest(path, params), {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
to: vi.fn() as any,
@@ -147,6 +149,7 @@ async function fireGet(
const waitUntil = vi.fn();
const response = await get.handler(signedGetRequest(path, params), {
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
to: vi.fn() as any,
@@ -380,6 +383,7 @@ describe("twilioChannel() inbound text pipeline", () => {
method: "POST",
}),
{
+ ...mockAgentRouteArgs(),
attachSession: vi.fn() as any,
...mockChannelContext(send),
to: vi.fn() as any,
diff --git a/packages/eve/src/public/definitions/channel.ts b/packages/eve/src/public/definitions/channel.ts
index ec10254a3..e3ba5e31d 100644
--- a/packages/eve/src/public/definitions/channel.ts
+++ b/packages/eve/src/public/definitions/channel.ts
@@ -57,6 +57,7 @@ export type {
ChannelSource,
};
export type { ChannelCors, ChannelCorsOptions } from "#channel/cors.js";
+export type { AgentDescription, AgentToolDescription } from "#channel/agent-description.js";
export { DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, WS } from "#channel/routes.js";
export type {
AttachSessionFn,
diff --git a/packages/eve/test/scenarios/cross-channel-receive.scenario.test.ts b/packages/eve/test/scenarios/cross-channel-receive.scenario.test.ts
index 8cf28e9c6..4adfe2b32 100644
--- a/packages/eve/test/scenarios/cross-channel-receive.scenario.test.ts
+++ b/packages/eve/test/scenarios/cross-channel-receive.scenario.test.ts
@@ -17,6 +17,7 @@ import {
} from "../../src/runtime/sessions/runtime-session.js";
import { useTemporaryAppRoots } from "../../src/internal/testing/use-temporary-app-roots.js";
import { mockChannelContext } from "../../src/internal/testing/mocks/mock-channel-operations.js";
+import { mockAgentRouteArgs } from "#internal/testing/mocks/mock-route-args.js";
/**
* Locks the cross-channel `ctx.to(channel, target).send(...)` path end-to-end:
@@ -172,6 +173,7 @@ describe("cross-channel receive end-to-end", () => {
}),
}),
{
+ ...mockAgentRouteArgs(),
...mockChannelContext(() => {
throw new Error("webhook should not send directly");
}),