* feat: add browser integration testing infrastructure
Add browser-based integration testing capability for Agent functionality.
Changes:
- Add integ-browser project to vitest.config.ts with Playwright/Chromium
- Configure Vite Define Plugin to inject AWS and OpenAI credentials via import.meta.env
- Create tests_integ/agent-browser.test.ts with critical test subset:
- Basic invocation test
- Tool use test
- Media blocks (Document and Image) test
- Implement browser-compatible loadFixture function using fetch API
- Add test:integ:browser script to run browser integration tests
- Update test:integ to run both Node.js and browser integration tests
- Add test:integ:all alias for running all integration tests
Tests skip gracefully when credentials are not available in browser environment.
Resolves: #194
* Additional changes from write operations
* Fix browser tests
* Fix image path
* Address pr comments
---------
Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
Purpose of `npm run test:package` is that it ensures that the package can be imported like any other NPM package
----
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
* Inline the strands-agent into the project
* Include only the tools that we want
* Inline additional fields from the workflow
* Fix additional request fields
* feat: Streamline execution of the agent
* fix: Delete unused tools
* feat: Switch to a flat list of tools
* Extract strands-command to a separate workflow
* Convert strands-agent-runner to a github action instead of worklflow
* Move time-out minutes to workflow not action
* fix: Rename typescript sessions bucket
* fix: Githbub Repo Secret Name
---------
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
* feat: implement AWS Bedrock model provider with comprehensive features
- Add BedrockModelProvider implementing ModelProvider interface
- Support AWS Bedrock Converse API with streaming
- Implement tool use and tool result handling
- Add support for prompt and tool caching
- Map Bedrock stop reasons to SDK stop reasons
- Handle tool use events and convert to SDK format
- Implement error handling for context window overflow and throttling
- Add comprehensive unit tests covering all features
- Add integration tests for real AWS Bedrock interactions
- Export ContextWindowOverflowError and ModelThrottledError
Resolves#4
* refactor: address PR #26 feedback - type system improvements and refactoring
- Remove DEFAULT_BEDROCK_REGION constant and BedrockClientConfig interface
- Use BedrockRuntimeClientConfig directly from AWS SDK
- Update ModelProvider interface removing Partial from updateConfig
- Change formatRequest to return ConverseStreamCommandInput with proper types
- Use InferenceConfiguration, BedrockMessage, and BedrockContentBlock types
- Change additionalRequestFields type from Record<string, unknown> to JSONValue
- Add additionalArgs property for forward compatibility
- Refactor formatContentBlock to use switch case instead of if/else
- Refactor mapBedrockEventToSDKEvents to extract single key and use switch case
- Remove includeToolResultStatus property and related checks
- Use ThrottlingException directly for error detection (moved to first check)
- Change handleError input type from unknown to Error
- Reduce interface property docstrings to one-line descriptions with optional @see links
- Update AGENTS.md with interface documentation guidance
- Use fromNodeProviderChain for AWS credential checking in integration tests
- Install @aws-sdk/credential-providers package
- Fix all unit tests to work with new types and error handling
* refactor(bedrock): address PR feedback on constructor and error handling
- Changed constructor signature to accept options object with modelConfig and clientConfig
- Added test to verify custom user agent extension
- Updated all tests to use new constructor signature
- Removed temperature integration test
- Added maxTokens stop reason verification in integration test
- Added context window overflow integration test
- Removed 'as never' assertions where possible
- Added error throws in default cases of switch statements
- Fixed type casting issues using 'unknown' intermediate type
- Fixed TokenUsage mapping to use correct field names
- Exported BedrockModelProviderOptions type from index
* refactor: add ModelProviderConstructor interface and use SDK types
- Add ModelProviderConstructor interface to define expected constructor signature
- Replace inline type definition with AWS SDK TokenUsage type
- Import and use Usage type for type-safe event creation
- Maintain backward compatibility with existing implementations
Addresses PR #26 feedback items
* refactor(bedrock): address PR feedback round 3
- Remove 'as never' assertions from tool configuration
- Move JSONValue cast before switch statement (do once, not per case)
- Remove redundant validation checks in each switch case
- Raise error if role is missing instead of defaulting
- Add warning for unsupported delta formats
- Inline error handling logic into stream method
- Convert ModelProvider from interface to abstract class
- Update BedrockModelProvider to extend instead of implements
- Add super() call to constructor
- Properly type tools array as Tool[] with explicit assertions
* refactor(bedrock): address PR feedback round 4
- Use non-null assertion for role field access
- Add proper type narrowing for start field
- Convert ModelProvider back to interface (per user request)
- Update BedrockModelProvider to implements instead of extends
- Remove super() call from constructor
- Update example to use implements instead of extends
* Update imports, fix credential issue on tests
* Add vitest projects, and fix integ tests
* test: add comprehensive test coverage for index.ts and bedrock.ts
- Add src/__tests__/index.test.ts with 4 tests covering main entry point exports
- Add 14 new tests to bedrock.test.ts:
- Tool use input delta handling
- Reasoning content delta (with both, only text, only signature)
- Cache usage metrics (cacheReadInputTokens, cacheWriteInputTokens)
- Trace in metadata
- Additional model response fields
- All stop reason types mapping
- Exception handling for error event types
- Update AGENTS.md with current directory structure
- Add instruction to keep AGENTS.md directory structure updated
- Coverage improved: 85% statements, 78.49% branches
- All 37 tests passing
Note: Branch coverage is 1.51% below threshold due to optional field
conditionals and forward compatibility features (default cases). Main
functionality is well-tested at 83.96% line coverage.
* Update test coverage
* refactor(bedrock): simplify constructor signature and remove throttling error
- Flatten constructor parameters (region, modelId, etc. now top-level)
- Remove DEFAULT_BEDROCK_MODEL_ID constant
- Remove ModelThrottledError class and throttling handling
- Validate exact event data in tests
- Add separate tests for each stop reason type
- Fix TypeScript type errors with region and toolChoice
BREAKING CHANGE: Constructor signature changed from nested modelConfig/clientConfig to flattened parameters with region as required top-level parameter
* Address feedback
* Update test coverage
* test: address PR feedback - add collectEvents helper and improve assertions
- Add collectEvents() helper function in unit and integration tests
- Replace all manual event collection loops with collectEvents() calls
- Update all test assertions to validate complete event objects using toEqual/toMatchObject
- Split stop reason test into 7 individual test cases (one per stop reason)
- Add event count assertions in error tests to verify no events yielded before errors
- Fix linting issues in integration tests
Addresses feedback from zastrowm on PR #26
* clean up tests
* Address feedback
---------
Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
* docs: update task-implementer script with PR creation link pattern
- Add instructions for creating PR links when GitHub Actions restrictions prevent automatic PR creation
- Update Commit and Pull Request Phase with fallback pattern
- Update Troubleshooting section with GitHub query parameter URL format
- Include example comment format for PR creation links
This pattern allows agents to provide users with direct links to create PRs manually when automatic creation fails.
* fix: Update in response to feedback
---------
Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
* feat: Install dependencies before agent startup
I've noticed that a bit of the agent's time is spent trying to run commands only to find out that dependencies are missing. This should help to save tokens & time
* fix: Setup node 20 as well
---------
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
* feat: implement base model provider interface and core type system
- Add ModelProvider interface with updateConfig, getConfig, and stream methods
- Define Message and ContentBlock types for conversation handling
- Implement tool types: ToolSpec, ToolUse, ToolResult, ToolChoice
- Create streaming event types following Bedrock ConverseStream spec
- Add ModelConfig interface with common configuration fields
- Include comprehensive TSDoc documentation for all exports
- Add 108 unit tests validating type contracts and interfaces
- Export all types from main index for public API
This foundational type system enables concrete model provider
implementations (Bedrock, OpenAI) and agent functionality in
subsequent tasks.
Resolves: #10
* refactor: address PR feedback - enhance type system with discriminated unions
Major type system improvements based on code review:
**Type Safety Enhancements:**
- Add JSONValue type for JSON-serializable values with recursive definition
- Use JSONSchema7 from @types/json-schema for proper schema validation
- Change ModelProvider config methods to use unknown for better type flexibility
- Convert interfaces to discriminated union types for better type narrowing
**Union Type Refactoring:**
- Convert ContentBlock to union type (text | toolUse | toolResult | reasoningContent)
- Convert ToolResultContent to union type (text | json)
- Convert ContentBlockDelta to union type (text | toolUse | reasoningContent)
- Convert ContentBlockStart to union type (toolUse | empty)
- Rename StreamEvent to ModelProviderStreamEvent with type discriminator field
**Naming & Structure:**
- Rename ReasoningContent to ReasoningTextBlock with required text field
- Rename provider.ts to model.ts for consistency
- Move streaming events from src/streaming/ to src/models/streaming.ts
- Remove outputSchema from ToolSpec (not supported by all providers)
**File Cleanup:**
- Remove all .bak files from repository
- Update all imports to reflect new file locations
- Update tests to handle union types with proper type guards
**Test Updates:**
- Update 113 tests to work with discriminated unions
- Use 'as const' assertions in mock providers for type accuracy
- Add type narrowing checks with 'in' operator for union types
- Remove tests for invalid union combinations
All quality checks passing:
- ✅ 113 tests passing
- ✅ TypeScript strict mode compilation
- ✅ ESLint validation
- ✅ Prettier formatting
* refactor: convert all union types to discriminated unions
- Convert ContentBlock to discriminated union (TextBlock, ToolUseBlock, ToolResultBlock, ReasoningBlock)
- Convert ToolResultContent to discriminated union (ToolResultTextContent, ToolResultJsonContent)
- Convert ContentBlockDelta to discriminated union (TextDelta, ToolUseInputDelta, ReasoningDelta)
- Convert ContentBlockStart to discriminated union (ToolUseStart, GenericBlockStart)
- Create src/types/json.ts for JSONValue and JSONSchema types
- Move StopReason from models/streaming.ts to types/messages.ts
- Update additionalModelResponseFields to use JSONValue instead of unknown
- Remove index.ts.bak file
- Update all tests to use discriminated unions
- All 114 tests passing with TypeScript strict mode
* refactor: remove ModelConfig interface
- Remove src/models/config.ts file
- Remove src/models/__tests__/config.test.ts test file
- Remove ModelConfig export from src/index.ts
- All 103 tests passing
Per feedback: will determine model configuration structure when implementing the first model provider
* refactor: add type discriminator field to streaming event interfaces
- Add type field to MessageStartEvent, ContentBlockStartEvent, ContentBlockDeltaEvent, ContentBlockStopEvent, MessageStopEvent, and MetadataEvent
- Simplify ModelProviderStreamEvent from intersection pattern to simple union type
- Update all streaming tests to include required type field
- All 103 tests passing
This makes the discriminated union cleaner and more intuitive by having the type field directly on each interface rather than using intersection types.
* refactor: convert type discriminators to camelCase and enhance documentation
**Type Discriminator Updates:**
- Convert all StopReason values to camelCase (toolUse, endTurn, maxTokens, etc.)
- Update ContentBlock types to use camelCase ('toolUse', 'toolResult')
- Update ContentBlockDelta types to use camelCase ('toolUseInput')
- Update ContentBlockStart types to use camelCase ('toolUse')
**Documentation Improvements:**
- Remove AWS Bedrock specification reference from streaming.ts comments
- Update all code examples to use camelCase discriminators
- Add comprehensive camelCase naming convention guidelines to AGENTS.md
- Add discriminated union best practices section to AGENTS.md
- Add testing guidelines about preferring implementation tests over interface tests
**Test Updates:**
- Update all test files to use camelCase discriminators
- Update 103 tests across streaming, model, and messages test files
- Fix ContentBlockDelta test to use 'toolUseInput' instead of 'toolUse'
**Task Management:**
- Add note to task-03 about removing interface tests from task-02
**Rationale:**
CamelCase discriminators maintain consistency with TypeScript/JavaScript naming conventions and make the codebase more idiomatic. Discriminated unions with the 'type' field directly on interfaces provide better type safety and IDE support.
All quality checks passing:
- ✅ 103 tests passing
- ✅ TypeScript strict mode compilation
- ✅ ESLint validation
- ✅ Prettier formatting
* refactor: rename events with Model prefix and improve testing strategy
BREAKING CHANGES:
- All streaming event interfaces renamed with Model prefix
- Event type discriminators updated to camelCase interface names
- ContentBlockStart simplified to only ToolUseStart type
Event Interface Renaming:
- MessageStartEvent → ModelMessageStartEvent (type: 'modelMessageStartEvent')
- ContentBlockStartEvent → ModelContentBlockStartEvent (type: 'modelContentBlockStartEvent')
- ContentBlockDeltaEvent → ModelContentBlockDeltaEvent (type: 'modelContentBlockDeltaEvent')
- ContentBlockStopEvent → ModelContentBlockStopEvent (type: 'modelContentBlockStopEvent')
- MessageStopEvent → ModelMessageStopEvent (type: 'modelMessageStopEvent')
- MetadataEvent → ModelMetadataEvent (type: 'modelMetadataEvent')
Type System Improvements:
- Remove GenericBlockStart interface
- ContentBlockStart now only ToolUseStart (not a union)
- StreamOptions reordered: systemPrompt, toolSpecs, toolChoice
- Move ModelProviderStreamEvent to top of streaming.ts file
- Fix duplicate documentation comment in streaming.ts
Testing Strategy Overhaul:
- Create .test-d.ts files for vitest type testing (32 type tests)
- Simplify implementation tests to focus on behavior (37 tests)
- Enable typecheck in vitest.config.ts
- Update AGENTS.md with type testing guidelines
- Remove unnecessary interface validation tests
Documentation:
- Add Vitest Type Testing section to AGENTS.md
- Update all code examples to use new event names
- Document when to use type tests vs implementation tests
All 69 tests passing (37 implementation + 32 type tests)
* refactor: remove interface tests and reorganize type definitions
**Testing Strategy Overhaul:**
- Remove all interface tests from the codebase
- Delete test files: model.test.ts, streaming.test.ts, streaming.test-d.ts, types.test.ts, types.test-d.ts, messages.test.ts, messages.test-d.ts
- Simplify AGENTS.md testing guidelines to 3 bullet points:
- MUST write tests for implementations
- SHOULD NOT write tests for interfaces (enforced by TypeScript)
- SHOULD write Vitest type tests for complex types for backwards compatibility
**Type Organization Improvements:**
- Reorganize types/messages.ts: Message → Role → ContentBlock → individual blocks → StopReason
- Reorganize tools/types.ts: ToolResult → ToolResultStatus → ToolResultContent → individual content types → ToolSpec → ToolUse → ToolChoice
- Reorganize models/streaming.ts: ModelProviderStreamEvent → event interfaces → ContentBlockStart/ToolUseStart → ContentBlockDelta/parts → Usage/Metrics
- Add interface ordering guideline to AGENTS.md
**Type Cleanup:**
- Remove Messages type alias (unnecessary, just use Message[])
- Remove Messages export from index.ts
**Rationale:**
Interface tests only verify TypeScript compilation, not runtime behavior. They duplicate what the compiler already does and add maintenance burden. Implementation tests verify actual functionality and provide real value.
File reorganization makes code more readable by presenting top-level types first, followed by their dependencies.
Test Results:
- ✅ 13 tests passing (only implementation tests)
- ✅ TypeScript strict mode compilation
- ✅ ESLint validation
- ✅ Prettier formatting
* Update src/models/streaming.ts
* refactor: align type discriminators with interface names
**Type Discriminator Updates:**
All type discriminators now follow the pattern: interface name (PascalCase) → type value (camelCase)
**Message Types (src/types/messages.ts):**
- TextBlock: 'text' → 'textBlock'
- ToolUseBlock: 'toolUse' → 'toolUseBlock'
- ToolResultBlock: 'toolResult' → 'toolResultBlock'
- ReasoningBlock: 'reasoning' → 'reasoningBlock'
**Tool Types (src/tools/types.ts):**
- ToolResultTextContent: 'text' → 'toolResultTextContent'
- ToolResultJsonContent: 'json' → 'toolResultJsonContent'
**Streaming Types (src/models/streaming.ts):**
- ToolUseStart: 'toolUse' → 'toolUseStart'
- TextDelta: 'text' → 'textDelta'
- ToolUseInputDelta: 'toolUseInput' → 'toolUseInputDelta'
- ReasoningDelta: 'reasoning' → 'reasoningDelta'
**Documentation Updates:**
- Updated all code examples in comments to use new discriminators
- Added comprehensive Type Discriminator Naming Pattern section to AGENTS.md
- Documented the required pattern: interface name → camelCase type value
- Provided clear examples of correct vs incorrect usage
**Pattern Benefits:**
- Predictable naming: type values can be inferred from interface names
- Consistent pattern across entire codebase
- Better maintainability when renaming interfaces
All quality checks passing:
- ✅ 13 tests passing
- ✅ TypeScript strict mode compilation
- ✅ ESLint validation
- ✅ Prettier formatting
* Address pr feedback
---------
Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
* feat: setup TypeScript SDK project with hello world implementation
- Initialize package.json with @strands-agents/sdk configuration
- Configure TypeScript for Node.js 20+ and browser compatibility
- Set up Vitest testing framework with 100% coverage requirement
- Add ESLint with TypeScript best practices and TSDoc validation
- Configure Prettier formatting (no semicolons, line length 120)
- Implement hello world function with comprehensive TSDoc documentation
- Create complete test suite with 16 passing tests and 100% coverage
- Create AGENTS.md with development environment documentation
- Update CONTRIBUTING.md with testing instructions and TDD guidelines
- Configure ES modules with single entry point architecture
- Enforce strict typing with no 'any' types allowed
All core acceptance criteria from issue #5 have been implemented and validated.
CI/CD workflows will be added in a follow-up commit.
* docs: move completed task to completed directory and add workflow guidance
- Moved task-01-setup-project-structure-and-core-type-system.md to .project/tasks/completed/
- Added Development Workflow section to project-overview.md with task completion process
- Addresses review feedback for proper task management organization
* refactor: address PR feedback and improve development experience
- Remove tests_integ/setup.test.ts (low value, redundant)
- Remove package-lock.json and add to .gitignore (SDK best practice)
- Restructure test files to use nested describe pattern for better organization
- Update coverage threshold from 100% to 80% (more pragmatic)
- Remove TDD enforcement section from CONTRIBUTING.md (flexibility)
- Remove redundant Development Workflow section
- Add Husky pre-commit hooks for automated quality checks
- Consolidate quality check documentation in Contributing section
- Update AGENTS.md to reflect new coverage requirements
- Document pre-commit hooks in setup instructions
All tests passing (13/13), 100% coverage maintained, all quality checks passing.
* docs: add test organization pattern and remove backup file
- Add comprehensive test organization pattern guidance to AGENTS.md
- Document nested describe pattern for class and function tests
- Include key principles for test organization
- Remove .project/project-overview.md.bak backup file
Addresses feedback from PR review comments
* chore: remove package-lock.json from git tracking
- Remove package-lock.json from version control (SDK best practice)
- File already added to .gitignore in previous commit
- Addresses PR feedback about file still being tracked in repository
* feat: implement path aliases, reorganize tests and documentation
Path Aliases:
- Add TypeScript path aliases (@/) for cleaner imports
- Configure tsconfig.json with baseUrl and paths
- Update vitest.config.ts to resolve path aliases
- Update test imports to use @/ instead of relative paths
Test Reorganization:
- Move unit tests from tests/ to src/__tests__/ (co-located with source)
- Integration tests remain in tests_integ/
- Update all test file imports to use path aliases
- Update ESLint, Prettier, and TypeScript configs for new structure
Documentation Reorganization:
- AGENTS.md: Agent-specific development guidance (coding patterns, testing patterns, workflow)
- README.md: Complete project overview with roadmap, usage examples, getting started
- CONTRIBUTING.md: Simplified human contribution guidelines, references AGENTS.md
- Clear separation of concerns between AGENTS.md (agents), README.md (users), CONTRIBUTING.md (human contributors)
All quality checks passing: 13/13 tests, 100% coverage, linting, formatting, type checking.
Addresses PR feedback from zastrowm and Unshure.
* docs: streamline README and add workflow files for review
- Remove TypeScript-First, Advanced Capabilities, and Dual Environment features from README
- Update Quick Start wording to 'will look something like this'
- Remove 'Current Status' note to keep README cleaner
- Remove reference to AGENTS.md and Example Usage section
- Create workflow files in .github_temp for review:
- pr-and-push.yml: Triggers test-lint on PR and push events
- test-lint.yml: Runs tests, linting, formatting, type checking across Node 20/22 and multiple OS
- integration-test.yml: Runs integration tests with AWS credentials and authorization
Addresses feedback from PR review comments
* Move workflow files
* Add permissions to workflows
* remove writing results to pr
* Fix windows workflow test and fix audit issues
* Address pr feedback
---------
Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>