Export generated session event types#1316
Conversation
Re-export generated session event types from the Node package root so consumers can import dedicated *Event and *Data types such as ToolExecutionStartData without deep-importing dist internals. Add a focused TypeScript regression test and wire it into typecheck so missing root exports fail in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@SteveSandersonMS, I assume this was intended to be done and was just missed, or did we actively not want these exported? |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR fixes a Node SDK packaging gap by making the auto-generated session event *Event / *Data TypeScript types importable from the package root (@github/copilot-sdk), avoiding deep imports into dist/generated/....
Changes:
- Re-export generated session-event types from
nodejs/src/index.tsvia a type-only star export. - Add a focused regression test file that type-checks representative generated exports (incl.
ToolExecutionStartData). - Wire the regression type-check into
npm run typecheckusing a dedicatedtsconfig.test.json.
Show a summary per file
| File | Description |
|---|---|
| nodejs/tsconfig.test.json | Adds a TS project config to type-check the regression import surface without emitting output. |
| nodejs/test/session-event-types.test.ts | Adds regression coverage ensuring generated session event types are importable from the entry point. |
| nodejs/src/index.ts | Re-exports generated session-event types from the package root (type-only). |
| nodejs/package.json | Extends typecheck to include the new regression type-check project. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR is scoped entirely to the Node.js/TypeScript SDK and fixes a TypeScript-specific module packaging issue: generated session event payload types (e.g., No cross-SDK consistency concerns: This is a TypeScript package entry point mechanic (module re-exports via
The fix correctly preserves the existing hand-authored public API surface for the three names that overlap between generated and manually-authored types (
|
Generated by Copilot.
This fixes a Node package root export gap: generated session event payload types such as
ToolExecutionStartDataexisted innodejs/src/generated/session-events.ts, but consumers could not import them from@github/copilot-sdkwithout deep-importingdist/generated/...internals.The package root now re-exports the generated session event type surface with a type-only export. Existing hand-authored public aliases that share names with generated types (
SessionEvent,PermissionRequest, andAssistantMessageEvent) continue to be explicitly re-exported, so they preserve the existing public API while exposing the dedicated generated*Eventand*Datanames.The regression coverage adds a focused TypeScript import test for representative generated event/data types, including the reported
ToolExecutionStartData, and wires that test intonpm run typecheckso missing root exports fail in CI instead of being stripped by the test runner transform.Fixes #1156
Validation:
npm run typechecknpm run lintnpm run buildnpm test(non-e2e suite, 125 tests)