Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/schema-driven-route-inputs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"agent-bundle": minor
---

Project conventional route `inputSchema` exports into a deterministic,
deep-frozen JSON Schema subset without executing route modules (#105 stage 2).
Supported zod object, scalar, enum, array, optional, default, description, and
validation-only chains now travel through `CompiledRouteGraph` and the route
manifest as an optional `inputSchema` field. Rich schemas remain valid and
simply omit the projection; CLI routes retain their existing `AB4814`
diagnostics and argv behavior.

The Workbench Routes page renders generated scalar, enum, boolean, and
repeatable-array editors with defaults, descriptions, required markers, and
client-side validation. Unprojectable schemas receive an explicit raw-JSON
fallback. Valid tool input can be handed to the existing MCP playground as a
prefilled server, tool, and arguments selection without auto-execution, while
valid CLI input produces a copyable argv invocation.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import React from 'react';
import type { ToolRouteProps } from 'agent-bundle';
import { z } from 'zod';

import { CuratorResult, type CuratorReceipt } from '../../../result.js';
import { defaultDiscoveryOperations, discoveryOperations } from '../../../operations/discovery.js';

const operation = discoveryOperations(defaultDiscoveryOperations).inventory;

export const config = {"annotations":{"readOnlyHint":false},"description":"Inventory source audio with retained per-file probe evidence."};
export const inputSchema = operation.inputSchema;
export const inputSchema = z.object({
source: z.string().min(1).max(4096).describe('Source audio path to inventory.'),
report: z.string().min(1).max(4096).optional().describe('Optional report destination.'),
strict: z.boolean().optional().describe('Fail when any source cannot be probed.'),
}).strict();
export const resultSchema = operation.resultSchema;

export default async function Route({ input, signal }: ToolRouteProps<typeof inputSchema>) {
Expand Down
11 changes: 11 additions & 0 deletions packages/agent-bundle/src/contracts/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ export type {
RouteManifestServer,
RouteManifestServerMode,
} from '../dev/routes/route-manifest.ts';
export type {
RouteInputArrayItemSchema,
RouteInputArraySchema,
RouteInputBooleanSchema,
RouteInputNumberSchema,
RouteInputPropertySchema,
RouteInputScalarSchema,
RouteInputSchema,
RouteInputSchemaLiteral,
RouteInputStringSchema,
} from '../routes/types.ts';
4 changes: 4 additions & 0 deletions packages/agent-bundle/src/dev/routes/route-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
CompiledRouteKind,
CompiledServerMode,
CompiledServerSurface,
RouteInputSchema,
} from '../../routes/types.ts';

/** Mirrors {@link CompiledRouteKind}: the catalog groups by the compiler's own kinds. */
Expand Down Expand Up @@ -51,6 +52,8 @@ export interface RouteManifestRoute {
/** Canonical event identity; `event-route` routes only. */
readonly event?: string;
readonly id: string;
/** Bounded JSON Schema projection; absent when the route schema is richer than the static grammar. */
readonly inputSchema?: RouteInputSchema;
readonly kind: RouteManifestKind;
readonly provenance: RouteManifestProvenance;
/** The owning MCP server id (`mcp:<name>`); MCP route kinds only. */
Expand Down Expand Up @@ -175,6 +178,7 @@ const manifestRoute = (route: CompiledAgentRoute): RouteManifestRoute => {
...(summary === undefined ? {} : { description: summary }),
...(route.event === undefined ? {} : { event: route.event }),
id: route.id,
...(route.inputSchema === undefined ? {} : { inputSchema: route.inputSchema }),
kind: route.kind,
provenance: { kind: route.provenance.kind },
...(route.serverId === undefined ? {} : { serverId: route.serverId }),
Expand Down
Loading
Loading