feat: add type-safe preferences system with AsyncContext#5
Merged
Conversation
- Add preferences.builder.ts with fluent API for configuration - Add preferences.schema.ts with Zod validation - Add async-context.ts with AsyncLocalStorage-based context - Integrate AsyncContext into base-workflow.ts automatically - Rename config.workflow.ts to preferences.workflow.ts - Add whitebook.ts for reading docs as AI prompts - Add preferences-api.md documentation - Add comprehensive test suites (89 tests total) Key features: - Type-safe builder: definePreferences((ctx, p) => ...) - SDK types from @anthropic-ai/claude-agent-sdk and @openai/codex-sdk - Profile-based configuration with builtin claude-code and codex - AsyncContext for non-invasive preference access across call chain - Workflow handlers automatically run within PreferencesContext
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
Add a comprehensive type-safe preferences configuration system with AsyncContext integration.
Key Features
1. Preferences Builder API
2. AsyncContext Integration
PreferencesContextAsyncLocalStoragefor async context propagation3. SDK Type Integration
@anthropic-ai/claude-agent-sdkand@openai/codex-sdk4. Whitebook as Prompt Source
loadWhitebookAsPrompt()utilityFiles Changed
common/preferences.builder.tscommon/preferences.schema.tscommon/async-context.tscommon/whitebook.tsworkflows/shared/base-workflow.tsmeta/subflows/preferences.workflow.tsdocs/white-book/06-configuration/preferences-api.mdTests