diff --git a/packages/agent-bundle/tests/route-register-typegen.test.ts b/packages/agent-bundle/tests/route-register-typegen.test.ts index 339cca46f..50469e5b5 100644 --- a/packages/agent-bundle/tests/route-register-typegen.test.ts +++ b/packages/agent-bundle/tests/route-register-typegen.test.ts @@ -172,8 +172,8 @@ it('types every route-aware public surface from the generated route registration "export type FindResult = Assert, { hits: number }>>;", "export type Unregistered = Assert, 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, 'canonical' | 'native'>>;", + '// injects, including the optional preflight `data` (#661) — and no result, since event modules export no resultSchema.', + "export type EventInput = Assert, 'canonical' | 'native' | 'preflight'>>;", "export type EventCanonical = Assert['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['canonical']['payload'], AgentEventPayload<'tool/after'>>>;", diff --git a/website/docs/en/guide/development/testing.mdx b/website/docs/en/guide/development/testing.mdx index 850f16a9b..6e06c3a66 100644 --- a/website/docs/en/guide/development/testing.mdx +++ b/website/docs/en/guide/development/testing.mdx @@ -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 diff --git a/website/docs/zh/guide/development/testing.mdx b/website/docs/zh/guide/development/testing.mdx index b98fd5fea..f03ba6892 100644 --- a/website/docs/zh/guide/development/testing.mdx +++ b/website/docs/zh/guide/development/testing.mdx @@ -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`;标注为