Skip to content

Fix typescript samples in documentation#610

Open
horihiro wants to merge 6 commits intogithub:mainfrom
horihiro:fix/ts-samples
Open

Fix typescript samples in documentation#610
horihiro wants to merge 6 commits intogithub:mainfrom
horihiro:fix/ts-samples

Conversation

@horihiro
Copy link

@horihiro horihiro commented Feb 28, 2026

  1. Add onPermissionRequest to parameters of createSession and resumeSession
    As of 0.1.29, onPermissionRequest is required in SessionConfig, so createSession and resumeSession throw an exception when the parameter is null or undefined.

  2. Update Node.js version
    When createSession is executed, GitHub Copilot CLI (or SDK? not sure.) seems to try to load node:sqlite and use sqlite.constants.
    They are available in 22.13.0+ / 23.5.0+ / 24+

@horihiro horihiro changed the title Fix typescript samples in guides Fix typescript samples in documentation Feb 28, 2026
@horihiro horihiro marked this pull request as ready for review February 28, 2026 05:14
@horihiro horihiro requested a review from a team as a code owner February 28, 2026 05:14
Copilot AI review requested due to automatic review settings February 28, 2026 05:14
Copy link
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 TypeScript documentation samples across the Node.js SDK to work correctly with version 0.1.29+ of the library, where onPermissionRequest became a required parameter in SessionConfig and ResumeSessionConfig. It also updates the Node.js version requirement in the getting-started guide to reflect the minimum needed for node:sqlite support.

Changes:

  • Add onPermissionRequest: async () => ({ kind: "approved" }) to all TypeScript createSession() and resumeSession() call sites across docs and examples
  • Update Node.js version requirement in docs/getting-started.md from 18+ to 22.13.0+ / 23.5.0+ / 24+
  • Update function signatures createSession(config?: SessionConfig)createSession(config: SessionConfig) and resumeSession(sessionId, config?)resumeSession(sessionId, config) to reflect that config is now required

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
nodejs/examples/basic-example.ts Adds onPermissionRequest to the example createSession call
nodejs/README.md Updates function signatures, adds onPermissionRequest to all code samples and config docs
docs/getting-started.md Updates Node.js version requirement; adds onPermissionRequest to TypeScript samples
docs/mcp/overview.md Adds onPermissionRequest to TypeScript createSession calls
docs/hooks/user-prompt-submitted.md Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace
docs/hooks/session-lifecycle.md Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace
docs/hooks/pre-tool-use.md Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace
docs/hooks/post-tool-use.md Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace
docs/hooks/overview.md Adds onPermissionRequest to TypeScript samples
docs/hooks/error-handling.md Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace
docs/guides/skills.md Adds onPermissionRequest to the createSession call with disabledSkills
docs/guides/setup/scaling.md Adds onPermissionRequest to createSession and resumeSession calls
docs/guides/setup/local-cli.md Adds onPermissionRequest to both createSession and resumeSession calls
docs/guides/setup/github-oauth.md Adds onPermissionRequest to the session creation example
docs/guides/setup/byok.md Adds onPermissionRequest to all createSession and resumeSession samples
docs/guides/setup/bundled-cli.md Adds onPermissionRequest to createSession and resumeSession samples
docs/guides/setup/backend-services.md Adds onPermissionRequest to all session creation/resumption calls
docs/guides/setup/azure-managed-identity.md Adds onPermissionRequest to the TypeScript createSession example
docs/guides/session-persistence.md Adds onPermissionRequest to createSession and resumeSession samples; removes trailing whitespace
docs/debugging.md Adds onPermissionRequest to the createSession snippet; removes trailing whitespace
docs/compatibility.md Adds onPermissionRequest to the context compaction example
docs/auth/byok.md Adds onPermissionRequest to BYOK session examples

patniko
patniko previously approved these changes Feb 28, 2026
Copy link
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

Copilot reviewed 22 out of 22 changed files in this pull request and generated no new comments.

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.

3 participants