refactor: replace singleton with createAssemblyKit() and add workspaceId support - #17
Merged
Merged
Conversation
…orkspaceId support Remove the AsyncLocalStorage-based `AssemblyKit.new()` singleton in favor of a plain `createAssemblyKit()` factory function. Users now manage their own instances (e.g. via React `cache()` or a Map). Also adds `workspaceId` as an alternative to `token` — when only workspaceId is provided, the SDK sets ASSEMBLY_ENV=local at runtime and builds the compound key as `workspaceId/apiKey`. If both are provided, token takes precedence. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the contributor-focused CLAUDE.md to .claude/CLAUDE.md (still read by Claude Code for repo development) and create a new consumer-focused CLAUDE.md at the root that ships with the npm package. This gives AI assistants working in consumer projects instant context about the SDK's API surface, resource namespaces, error handling, and entry points without scanning dist files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AssemblyKit.new()static singleton (AsyncLocalStorage-based) in favor of a plaincreateAssemblyKit()factory function — users manage their own instances (e.g. via Reactcache()or aMap)workspaceIdoption as an alternative totoken— at least one must be provided. When onlyworkspaceIdis given, the SDK setsASSEMBLY_ENV=localat runtime and builds the compound key asworkspaceId/apiKey. If both are provided,tokentakes precedencecache()recommended, plainMapas fallback)Test plan
vp check --fixpasses (lint, format, types)createAssemblyKit({ apiKey, workspaceId })works against a real workspacecreateAssemblyKit({ apiKey, token })still works as beforecreateAssemblyKit({ apiKey, token, workspaceId })ignores workspaceId🤖 Generated with Claude Code