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
4 changes: 2 additions & 2 deletions packages/agent-bundle/tests/route-register-typegen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ it('types every route-aware public surface from the generated route registration
"export type FindResult = Assert<Equal<RegisteredRouteResult<'tool:curator/find'>, { hits: number }>>;",
"export type Unregistered = Assert<Equal<RegisteredRouteInput<'tool:curator/missing'>, unknown>>;",
'// An event route registers the harness payload — the component props without the `signal` the harness',
'// injects — and no result, since event modules export no resultSchema.',
"export type EventInput = Assert<Equal<keyof RegisteredRouteInput<'event:tool/after'>, 'canonical' | 'native'>>;",
'// injects, including the optional preflight `data` (#661) — and no result, since event modules export no resultSchema.',
"export type EventInput = Assert<Equal<keyof RegisteredRouteInput<'event:tool/after'>, 'canonical' | 'native' | 'preflight'>>;",
"export type EventCanonical = Assert<Equal<RegisteredRouteInput<'event:tool/after'>['canonical'], AgentEventCanonicalIdentity<'tool/after'>>>;",
'// The route\'s family narrows `canonical.payload`: tool/after fields are present, stop-only fields are not.',
"export type EventPayload = Assert<Equal<RegisteredRouteInput<'event:tool/after'>['canonical']['payload'], AgentEventPayload<'tool/after'>>>;",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/guide/development/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const chapters: number | undefined = result?.chapters; // no cast
```

An event route registers what the harness actually takes and gives back: `input` is the
`{ canonical, native }` payload (the harness supplies `signal` itself), and `result` is
`{ canonical, native, preflight? }` payload (the harness supplies `signal` itself), and `result` is
`undefined`, since event modules export no `resultSchema`. Build that input from a host envelope
with `createEventRouteInput('tool/after', envelope, { host: 'claude' })` rather than by hand: it
validates the envelope per host and event and projects `canonical.payload` through the same table
Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/guide/development/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const { result } = await renderRoute('tool:library/summarize', {
const chapters: number | undefined = result?.chapters; // 无需强制类型转换
```

事件路由注册的是测试工具实际接受与返回的内容:`input` 是 `{ canonical, native }` 载荷(`signal` 由测试
事件路由注册的是测试工具实际接受与返回的内容:`input` 是 `{ canonical, native, preflight? }` 载荷(`signal` 由测试
工具自行提供),而 `result` 为 `undefined`,因为事件模块不导出 `resultSchema`。请用
`createEventRouteInput('tool/after', envelope, { host: 'claude' })` 从宿主信封构造这个输入,而不要手写:它按
宿主与事件校验信封,并通过与制品包装器相同的表投影出 `canonical.payload`;标注为
Expand Down
Loading