Skip to content

Export generated session event types#1316

Open
stephentoub wants to merge 2 commits into
mainfrom
stephentoub/fix-issue-1156
Open

Export generated session event types#1316
stephentoub wants to merge 2 commits into
mainfrom
stephentoub/fix-issue-1156

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Generated by Copilot.

This fixes a Node package root export gap: generated session event payload types such as ToolExecutionStartData existed in nodejs/src/generated/session-events.ts, but consumers could not import them from @github/copilot-sdk without deep-importing dist/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, and AssistantMessageEvent) continue to be explicitly re-exported, so they preserve the existing public API while exposing the dedicated generated *Event and *Data names.

The regression coverage adds a focused TypeScript import test for representative generated event/data types, including the reported ToolExecutionStartData, and wires that test into npm run typecheck so missing root exports fail in CI instead of being stripped by the test runner transform.

Fixes #1156

Validation:

  • npm run typecheck
  • npm run lint
  • npm run build
  • npm test (non-e2e suite, 125 tests)

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>
Copilot AI review requested due to automatic review settings May 17, 2026 02:13
@stephentoub stephentoub requested a review from a team as a code owner May 17, 2026 02:13
@stephentoub
Copy link
Copy Markdown
Collaborator Author

@SteveSandersonMS, I assume this was intended to be done and was just missed, or did we actively not want these exported?

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts via 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 typecheck using a dedicated tsconfig.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

Comment thread nodejs/test/session-event-types.test.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

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., ToolExecutionStartData) were not re-exported from the package root, requiring consumers to use internal deep imports (dist/generated/...).

No cross-SDK consistency concerns: This is a TypeScript package entry point mechanic (module re-exports via export type *). The equivalent concern does not apply to other SDKs:

  • Python: All public types in python/copilot/ are importable from the package root directly.
  • Go: All exported types are accessible from their package paths without a separate re-export step.
  • .NET: All public types in the namespace are directly accessible without equivalent packaging issues.

The fix correctly preserves the existing hand-authored public API surface for the three names that overlap between generated and manually-authored types (SessionEvent, PermissionRequest, AssistantMessageEvent).

Generated by SDK Consistency Review Agent for issue #1316 · ● 104.7K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot import dedicated session event data types in v0.3.0

3 participants