@strands-agents/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +175 -0
- package/README.md +185 -0
- package/dist/__fixtures__/model-test-helpers.d.ts +56 -0
- package/dist/__fixtures__/model-test-helpers.d.ts.map +1 -0
- package/dist/__fixtures__/model-test-helpers.js +85 -0
- package/dist/__fixtures__/model-test-helpers.js.map +1 -0
- package/dist/__fixtures__/tool-helpers.d.ts +15 -0
- package/dist/__fixtures__/tool-helpers.d.ts.map +1 -0
- package/dist/__fixtures__/tool-helpers.js +22 -0
- package/dist/__fixtures__/tool-helpers.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +2 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +20 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +27 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/models/__tests__/bedrock.test.d.ts +2 -0
- package/dist/models/__tests__/bedrock.test.d.ts.map +1 -0
- package/dist/models/__tests__/bedrock.test.js +1161 -0
- package/dist/models/__tests__/bedrock.test.js.map +1 -0
- package/dist/models/__tests__/model.test.d.ts +2 -0
- package/dist/models/__tests__/model.test.d.ts.map +1 -0
- package/dist/models/__tests__/model.test.js +297 -0
- package/dist/models/__tests__/model.test.js.map +1 -0
- package/dist/models/__tests__/openai.test.d.ts +2 -0
- package/dist/models/__tests__/openai.test.d.ts.map +1 -0
- package/dist/models/__tests__/openai.test.js +1016 -0
- package/dist/models/__tests__/openai.test.js.map +1 -0
- package/dist/models/__tests__/test-utils.d.ts +10 -0
- package/dist/models/__tests__/test-utils.d.ts.map +1 -0
- package/dist/models/__tests__/test-utils.js +17 -0
- package/dist/models/__tests__/test-utils.js.map +1 -0
- package/dist/models/bedrock.d.ts +272 -0
- package/dist/models/bedrock.d.ts.map +1 -0
- package/dist/models/bedrock.js +679 -0
- package/dist/models/bedrock.js.map +1 -0
- package/dist/models/model.d.ts +89 -0
- package/dist/models/model.d.ts.map +1 -0
- package/dist/models/model.js +122 -0
- package/dist/models/model.js.map +1 -0
- package/dist/models/openai.d.ts +262 -0
- package/dist/models/openai.d.ts.map +1 -0
- package/dist/models/openai.js +625 -0
- package/dist/models/openai.js.map +1 -0
- package/dist/models/streaming.d.ts +226 -0
- package/dist/models/streaming.d.ts.map +1 -0
- package/dist/models/streaming.js +2 -0
- package/dist/models/streaming.js.map +1 -0
- package/dist/src/__fixtures__/agent-helpers.d.ts +29 -0
- package/dist/src/__fixtures__/agent-helpers.d.ts.map +1 -0
- package/dist/src/__fixtures__/agent-helpers.js +19 -0
- package/dist/src/__fixtures__/agent-helpers.js.map +1 -0
- package/dist/src/__fixtures__/environment.d.ts +12 -0
- package/dist/src/__fixtures__/environment.d.ts.map +1 -0
- package/dist/src/__fixtures__/environment.js +12 -0
- package/dist/src/__fixtures__/environment.js.map +1 -0
- package/dist/src/__fixtures__/mock-hook-provider.d.ts +14 -0
- package/dist/src/__fixtures__/mock-hook-provider.d.ts.map +1 -0
- package/dist/src/__fixtures__/mock-hook-provider.js +33 -0
- package/dist/src/__fixtures__/mock-hook-provider.js.map +1 -0
- package/dist/src/__fixtures__/mock-message-model.d.ts +93 -0
- package/dist/src/__fixtures__/mock-message-model.d.ts.map +1 -0
- package/dist/src/__fixtures__/mock-message-model.js +226 -0
- package/dist/src/__fixtures__/mock-message-model.js.map +1 -0
- package/dist/src/__fixtures__/model-test-helpers.d.ts +56 -0
- package/dist/src/__fixtures__/model-test-helpers.d.ts.map +1 -0
- package/dist/src/__fixtures__/model-test-helpers.js +85 -0
- package/dist/src/__fixtures__/model-test-helpers.js.map +1 -0
- package/dist/src/__fixtures__/tool-helpers.d.ts +37 -0
- package/dist/src/__fixtures__/tool-helpers.d.ts.map +1 -0
- package/dist/src/__fixtures__/tool-helpers.js +78 -0
- package/dist/src/__fixtures__/tool-helpers.js.map +1 -0
- package/dist/src/__tests__/errors.test.d.ts +2 -0
- package/dist/src/__tests__/errors.test.d.ts.map +1 -0
- package/dist/src/__tests__/errors.test.js +64 -0
- package/dist/src/__tests__/errors.test.js.map +1 -0
- package/dist/src/__tests__/index.test.d.ts +2 -0
- package/dist/src/__tests__/index.test.d.ts.map +1 -0
- package/dist/src/__tests__/index.test.js +27 -0
- package/dist/src/__tests__/index.test.js.map +1 -0
- package/dist/src/__tests__/mcp.test.d.ts +2 -0
- package/dist/src/__tests__/mcp.test.d.ts.map +1 -0
- package/dist/src/__tests__/mcp.test.js +166 -0
- package/dist/src/__tests__/mcp.test.js.map +1 -0
- package/dist/src/agent/__tests__/agent.hook.test.d.ts +2 -0
- package/dist/src/agent/__tests__/agent.hook.test.d.ts.map +1 -0
- package/dist/src/agent/__tests__/agent.hook.test.js +250 -0
- package/dist/src/agent/__tests__/agent.hook.test.js.map +1 -0
- package/dist/src/agent/__tests__/agent.test.d.ts +2 -0
- package/dist/src/agent/__tests__/agent.test.d.ts.map +1 -0
- package/dist/src/agent/__tests__/agent.test.js +414 -0
- package/dist/src/agent/__tests__/agent.test.js.map +1 -0
- package/dist/src/agent/__tests__/printer.test.d.ts +2 -0
- package/dist/src/agent/__tests__/printer.test.d.ts.map +1 -0
- package/dist/src/agent/__tests__/printer.test.js +152 -0
- package/dist/src/agent/__tests__/printer.test.js.map +1 -0
- package/dist/src/agent/__tests__/state.test.d.ts +2 -0
- package/dist/src/agent/__tests__/state.test.d.ts.map +1 -0
- package/dist/src/agent/__tests__/state.test.js +231 -0
- package/dist/src/agent/__tests__/state.test.js.map +1 -0
- package/dist/src/agent/agent.d.ts +207 -0
- package/dist/src/agent/agent.d.ts.map +1 -0
- package/dist/src/agent/agent.js +481 -0
- package/dist/src/agent/agent.js.map +1 -0
- package/dist/src/agent/printer.d.ts +73 -0
- package/dist/src/agent/printer.d.ts.map +1 -0
- package/dist/src/agent/printer.js +145 -0
- package/dist/src/agent/printer.js.map +1 -0
- package/dist/src/agent/state.d.ts +102 -0
- package/dist/src/agent/state.d.ts.map +1 -0
- package/dist/src/agent/state.js +73 -0
- package/dist/src/agent/state.js.map +1 -0
- package/dist/src/agent/streaming.d.ts +91 -0
- package/dist/src/agent/streaming.d.ts.map +1 -0
- package/dist/src/agent/streaming.js +2 -0
- package/dist/src/agent/streaming.js.map +1 -0
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts +2 -0
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts.map +1 -0
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.js +10 -0
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.js.map +1 -0
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts +2 -0
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts.map +1 -0
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js +35 -0
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js.map +1 -0
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts +2 -0
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts.map +1 -0
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js +553 -0
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js.map +1 -0
- package/dist/src/conversation-manager/conversation-manager.d.ts +73 -0
- package/dist/src/conversation-manager/conversation-manager.d.ts.map +1 -0
- package/dist/src/conversation-manager/conversation-manager.js +24 -0
- package/dist/src/conversation-manager/conversation-manager.js.map +1 -0
- package/dist/src/conversation-manager/index.d.ts +8 -0
- package/dist/src/conversation-manager/index.d.ts.map +1 -0
- package/dist/src/conversation-manager/index.js +8 -0
- package/dist/src/conversation-manager/index.js.map +1 -0
- package/dist/src/conversation-manager/null-conversation-manager.d.ts +23 -0
- package/dist/src/conversation-manager/null-conversation-manager.d.ts.map +1 -0
- package/dist/src/conversation-manager/null-conversation-manager.js +23 -0
- package/dist/src/conversation-manager/null-conversation-manager.js.map +1 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.d.ts +105 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.d.ts.map +1 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.js +212 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.js.map +1 -0
- package/dist/src/errors.d.ts +83 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +97 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/hooks/__tests__/events.test.d.ts +2 -0
- package/dist/src/hooks/__tests__/events.test.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/events.test.js +347 -0
- package/dist/src/hooks/__tests__/events.test.js.map +1 -0
- package/dist/src/hooks/__tests__/registry.test.d.ts +2 -0
- package/dist/src/hooks/__tests__/registry.test.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/registry.test.js +154 -0
- package/dist/src/hooks/__tests__/registry.test.js.map +1 -0
- package/dist/src/hooks/events.d.ts +199 -0
- package/dist/src/hooks/events.d.ts.map +1 -0
- package/dist/src/hooks/events.js +191 -0
- package/dist/src/hooks/events.js.map +1 -0
- package/dist/src/hooks/index.d.ts +11 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +11 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/registry.d.ts +65 -0
- package/dist/src/hooks/registry.d.ts.map +1 -0
- package/dist/src/hooks/registry.js +65 -0
- package/dist/src/hooks/registry.js.map +1 -0
- package/dist/src/hooks/types.d.ts +49 -0
- package/dist/src/hooks/types.d.ts.map +1 -0
- package/dist/src/hooks/types.js +2 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +29 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp.d.ts +51 -0
- package/dist/src/mcp.d.ts.map +1 -0
- package/dist/src/mcp.js +91 -0
- package/dist/src/mcp.js.map +1 -0
- package/dist/src/models/__tests__/bedrock.test.d.ts +2 -0
- package/dist/src/models/__tests__/bedrock.test.d.ts.map +1 -0
- package/dist/src/models/__tests__/bedrock.test.js +1388 -0
- package/dist/src/models/__tests__/bedrock.test.js.map +1 -0
- package/dist/src/models/__tests__/model.test.d.ts +2 -0
- package/dist/src/models/__tests__/model.test.d.ts.map +1 -0
- package/dist/src/models/__tests__/model.test.js +342 -0
- package/dist/src/models/__tests__/model.test.js.map +1 -0
- package/dist/src/models/__tests__/openai.test.d.ts +2 -0
- package/dist/src/models/__tests__/openai.test.d.ts.map +1 -0
- package/dist/src/models/__tests__/openai.test.js +1189 -0
- package/dist/src/models/__tests__/openai.test.js.map +1 -0
- package/dist/src/models/__tests__/test-utils.d.ts +10 -0
- package/dist/src/models/__tests__/test-utils.d.ts.map +1 -0
- package/dist/src/models/__tests__/test-utils.js +17 -0
- package/dist/src/models/__tests__/test-utils.js.map +1 -0
- package/dist/src/models/bedrock.d.ts +289 -0
- package/dist/src/models/bedrock.d.ts.map +1 -0
- package/dist/src/models/bedrock.js +804 -0
- package/dist/src/models/bedrock.js.map +1 -0
- package/dist/src/models/model.d.ts +99 -0
- package/dist/src/models/model.d.ts.map +1 -0
- package/dist/src/models/model.js +169 -0
- package/dist/src/models/model.js.map +1 -0
- package/dist/src/models/openai.d.ts +262 -0
- package/dist/src/models/openai.d.ts.map +1 -0
- package/dist/src/models/openai.js +752 -0
- package/dist/src/models/openai.js.map +1 -0
- package/dist/src/models/streaming.d.ts +318 -0
- package/dist/src/models/streaming.d.ts.map +1 -0
- package/dist/src/models/streaming.js +122 -0
- package/dist/src/models/streaming.js.map +1 -0
- package/dist/src/registry/registry.d.ts +117 -0
- package/dist/src/registry/registry.d.ts.map +1 -0
- package/dist/src/registry/registry.js +298 -0
- package/dist/src/registry/registry.js.map +1 -0
- package/dist/src/registry/tool-registry.d.ts +34 -0
- package/dist/src/registry/tool-registry.d.ts.map +1 -0
- package/dist/src/registry/tool-registry.js +178 -0
- package/dist/src/registry/tool-registry.js.map +1 -0
- package/dist/src/tools/__tests__/tool.test.d.ts +2 -0
- package/dist/src/tools/__tests__/tool.test.d.ts.map +1 -0
- package/dist/src/tools/__tests__/tool.test.js +877 -0
- package/dist/src/tools/__tests__/tool.test.js.map +1 -0
- package/dist/src/tools/__tests__/zod-tool.test-d.d.ts +2 -0
- package/dist/src/tools/__tests__/zod-tool.test-d.d.ts.map +1 -0
- package/dist/src/tools/__tests__/zod-tool.test-d.js +227 -0
- package/dist/src/tools/__tests__/zod-tool.test-d.js.map +1 -0
- package/dist/src/tools/__tests__/zod-tool.test.d.ts +2 -0
- package/dist/src/tools/__tests__/zod-tool.test.d.ts.map +1 -0
- package/dist/src/tools/__tests__/zod-tool.test.js +372 -0
- package/dist/src/tools/__tests__/zod-tool.test.js.map +1 -0
- package/dist/src/tools/function-tool.d.ts +146 -0
- package/dist/src/tools/function-tool.d.ts.map +1 -0
- package/dist/src/tools/function-tool.js +188 -0
- package/dist/src/tools/function-tool.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +36 -0
- package/dist/src/tools/mcp-tool.d.ts.map +1 -0
- package/dist/src/tools/mcp-tool.js +78 -0
- package/dist/src/tools/mcp-tool.js.map +1 -0
- package/dist/src/tools/tool.d.ts +167 -0
- package/dist/src/tools/tool.d.ts.map +1 -0
- package/dist/src/tools/tool.js +68 -0
- package/dist/src/tools/tool.js.map +1 -0
- package/dist/src/tools/types.d.ts +62 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +2 -0
- package/dist/src/tools/types.js.map +1 -0
- package/dist/src/tools/zod-tool.d.ts +70 -0
- package/dist/src/tools/zod-tool.d.ts.map +1 -0
- package/dist/src/tools/zod-tool.js +149 -0
- package/dist/src/tools/zod-tool.js.map +1 -0
- package/dist/src/types/__tests__/agent.test.d.ts +2 -0
- package/dist/src/types/__tests__/agent.test.d.ts.map +1 -0
- package/dist/src/types/__tests__/agent.test.js +155 -0
- package/dist/src/types/__tests__/agent.test.js.map +1 -0
- package/dist/src/types/__tests__/json.test.d.ts +2 -0
- package/dist/src/types/__tests__/json.test.d.ts.map +1 -0
- package/dist/src/types/__tests__/json.test.js +298 -0
- package/dist/src/types/__tests__/json.test.js.map +1 -0
- package/dist/src/types/__tests__/media.test.d.ts +2 -0
- package/dist/src/types/__tests__/media.test.d.ts.map +1 -0
- package/dist/src/types/__tests__/media.test.js +257 -0
- package/dist/src/types/__tests__/media.test.js.map +1 -0
- package/dist/src/types/__tests__/messages.test.d.ts +2 -0
- package/dist/src/types/__tests__/messages.test.d.ts.map +1 -0
- package/dist/src/types/__tests__/messages.test.js +364 -0
- package/dist/src/types/__tests__/messages.test.js.map +1 -0
- package/dist/src/types/__tests__/validation.test.d.ts +2 -0
- package/dist/src/types/__tests__/validation.test.d.ts.map +1 -0
- package/dist/src/types/__tests__/validation.test.js +30 -0
- package/dist/src/types/__tests__/validation.test.js.map +1 -0
- package/dist/src/types/agent.d.ts +57 -0
- package/dist/src/types/agent.d.ts.map +1 -0
- package/dist/src/types/agent.js +47 -0
- package/dist/src/types/agent.js.map +1 -0
- package/dist/src/types/json.d.ts +55 -0
- package/dist/src/types/json.d.ts.map +1 -0
- package/dist/src/types/json.js +72 -0
- package/dist/src/types/json.js.map +1 -0
- package/dist/src/types/media.d.ts +249 -0
- package/dist/src/types/media.d.ts.map +1 -0
- package/dist/src/types/media.js +173 -0
- package/dist/src/types/media.js.map +1 -0
- package/dist/src/types/messages.d.ts +438 -0
- package/dist/src/types/messages.d.ts.map +1 -0
- package/dist/src/types/messages.js +286 -0
- package/dist/src/types/messages.js.map +1 -0
- package/dist/src/types/validation.d.ts +10 -0
- package/dist/src/types/validation.d.ts.map +1 -0
- package/dist/src/types/validation.js +15 -0
- package/dist/src/types/validation.js.map +1 -0
- package/dist/tools/__tests__/registry.test.d.ts +2 -0
- package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
- package/dist/tools/__tests__/registry.test.js +253 -0
- package/dist/tools/__tests__/registry.test.js.map +1 -0
- package/dist/tools/__tests__/tool.test.d.ts +2 -0
- package/dist/tools/__tests__/tool.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tool.test.js +761 -0
- package/dist/tools/__tests__/tool.test.js.map +1 -0
- package/dist/tools/__tests__/zod-tool.test-d.d.ts +2 -0
- package/dist/tools/__tests__/zod-tool.test-d.d.ts.map +1 -0
- package/dist/tools/__tests__/zod-tool.test-d.js +227 -0
- package/dist/tools/__tests__/zod-tool.test-d.js.map +1 -0
- package/dist/tools/__tests__/zod-tool.test.d.ts +2 -0
- package/dist/tools/__tests__/zod-tool.test.d.ts.map +1 -0
- package/dist/tools/__tests__/zod-tool.test.js +342 -0
- package/dist/tools/__tests__/zod-tool.test.js.map +1 -0
- package/dist/tools/function-tool.d.ts +156 -0
- package/dist/tools/function-tool.d.ts.map +1 -0
- package/dist/tools/function-tool.js +237 -0
- package/dist/tools/function-tool.js.map +1 -0
- package/dist/tools/registry.d.ts +43 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +82 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/tool.d.ts +157 -0
- package/dist/tools/tool.d.ts.map +1 -0
- package/dist/tools/tool.js +2 -0
- package/dist/tools/tool.js.map +1 -0
- package/dist/tools/types.d.ts +119 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/zod-tool.d.ts +70 -0
- package/dist/tools/zod-tool.d.ts.map +1 -0
- package/dist/tools/zod-tool.js +96 -0
- package/dist/tools/zod-tool.js.map +1 -0
- package/dist/types/__tests__/json.test.d.ts +2 -0
- package/dist/types/__tests__/json.test.d.ts.map +1 -0
- package/dist/types/__tests__/json.test.js +129 -0
- package/dist/types/__tests__/json.test.js.map +1 -0
- package/dist/types/__tests__/validation.test.d.ts +2 -0
- package/dist/types/__tests__/validation.test.d.ts.map +1 -0
- package/dist/types/__tests__/validation.test.js +30 -0
- package/dist/types/__tests__/validation.test.js.map +1 -0
- package/dist/types/json.d.ts +45 -0
- package/dist/types/json.d.ts.map +1 -0
- package/dist/types/json.js +17 -0
- package/dist/types/json.js.map +1 -0
- package/dist/types/messages.d.ts +160 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/messages.js +2 -0
- package/dist/types/messages.js.map +1 -0
- package/dist/types/validation.d.ts +10 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +15 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/vended_tools/bash/__tests__/bash.test.d.ts +2 -0
- package/dist/vended_tools/bash/__tests__/bash.test.d.ts.map +1 -0
- package/dist/vended_tools/bash/__tests__/bash.test.js +333 -0
- package/dist/vended_tools/bash/__tests__/bash.test.js.map +1 -0
- package/dist/vended_tools/bash/bash.d.ts +33 -0
- package/dist/vended_tools/bash/bash.d.ts.map +1 -0
- package/dist/vended_tools/bash/bash.js +264 -0
- package/dist/vended_tools/bash/bash.js.map +1 -0
- package/dist/vended_tools/bash/index.d.ts +7 -0
- package/dist/vended_tools/bash/index.d.ts.map +1 -0
- package/dist/vended_tools/bash/index.js +6 -0
- package/dist/vended_tools/bash/index.js.map +1 -0
- package/dist/vended_tools/bash/types.d.ts +65 -0
- package/dist/vended_tools/bash/types.d.ts.map +1 -0
- package/dist/vended_tools/bash/types.js +22 -0
- package/dist/vended_tools/bash/types.js.map +1 -0
- package/dist/vended_tools/file_editor/__tests__/file-editor.test.d.ts +2 -0
- package/dist/vended_tools/file_editor/__tests__/file-editor.test.d.ts.map +1 -0
- package/dist/vended_tools/file_editor/__tests__/file-editor.test.js +359 -0
- package/dist/vended_tools/file_editor/__tests__/file-editor.test.js.map +1 -0
- package/dist/vended_tools/file_editor/file-editor.d.ts +31 -0
- package/dist/vended_tools/file_editor/file-editor.d.ts.map +1 -0
- package/dist/vended_tools/file_editor/file-editor.js +353 -0
- package/dist/vended_tools/file_editor/file-editor.js.map +1 -0
- package/dist/vended_tools/file_editor/index.d.ts +6 -0
- package/dist/vended_tools/file_editor/index.d.ts.map +1 -0
- package/dist/vended_tools/file_editor/index.js +5 -0
- package/dist/vended_tools/file_editor/index.js.map +1 -0
- package/dist/vended_tools/file_editor/types.d.ts +61 -0
- package/dist/vended_tools/file_editor/types.d.ts.map +1 -0
- package/dist/vended_tools/file_editor/types.js +2 -0
- package/dist/vended_tools/file_editor/types.js.map +1 -0
- package/dist/vended_tools/http_request/__tests__/http-request.test.d.ts +2 -0
- package/dist/vended_tools/http_request/__tests__/http-request.test.d.ts.map +1 -0
- package/dist/vended_tools/http_request/__tests__/http-request.test.js +189 -0
- package/dist/vended_tools/http_request/__tests__/http-request.test.js.map +1 -0
- package/dist/vended_tools/http_request/http-request.d.ts +35 -0
- package/dist/vended_tools/http_request/http-request.d.ts.map +1 -0
- package/dist/vended_tools/http_request/http-request.js +95 -0
- package/dist/vended_tools/http_request/http-request.js.map +1 -0
- package/dist/vended_tools/http_request/index.d.ts +6 -0
- package/dist/vended_tools/http_request/index.d.ts.map +1 -0
- package/dist/vended_tools/http_request/index.js +5 -0
- package/dist/vended_tools/http_request/index.js.map +1 -0
- package/dist/vended_tools/http_request/types.d.ts +47 -0
- package/dist/vended_tools/http_request/types.d.ts.map +1 -0
- package/dist/vended_tools/http_request/types.js +2 -0
- package/dist/vended_tools/http_request/types.js.map +1 -0
- package/dist/vended_tools/notebook/__tests__/notebook.test.d.ts +2 -0
- package/dist/vended_tools/notebook/__tests__/notebook.test.d.ts.map +1 -0
- package/dist/vended_tools/notebook/__tests__/notebook.test.js +371 -0
- package/dist/vended_tools/notebook/__tests__/notebook.test.js.map +1 -0
- package/dist/vended_tools/notebook/index.d.ts +6 -0
- package/dist/vended_tools/notebook/index.d.ts.map +1 -0
- package/dist/vended_tools/notebook/index.js +5 -0
- package/dist/vended_tools/notebook/index.js.map +1 -0
- package/dist/vended_tools/notebook/notebook.d.ts +29 -0
- package/dist/vended_tools/notebook/notebook.d.ts.map +1 -0
- package/dist/vended_tools/notebook/notebook.js +215 -0
- package/dist/vended_tools/notebook/notebook.js.map +1 -0
- package/dist/vended_tools/notebook/types.d.ts +79 -0
- package/dist/vended_tools/notebook/types.d.ts.map +1 -0
- package/dist/vended_tools/notebook/types.js +2 -0
- package/dist/vended_tools/notebook/types.js.map +1 -0
- package/package.json +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<div>
|
|
3
|
+
<a href="https://strandsagents.com">
|
|
4
|
+
<img src="https://strandsagents.com/latest/assets/logo-github.svg" alt="Strands Agents" width="55px" height="105px">
|
|
5
|
+
</a>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<h1>
|
|
9
|
+
Strands Agents - TypeScript SDK
|
|
10
|
+
</h1>
|
|
11
|
+
|
|
12
|
+
<h2>
|
|
13
|
+
A model-driven approach to building AI agents in TypeScript/JavaScript.
|
|
14
|
+
</h2>
|
|
15
|
+
|
|
16
|
+
<div align="center">
|
|
17
|
+
<a href="https://github.com/strands-agents/sdk-typescript/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/strands-agents/sdk-typescript"/></a>
|
|
18
|
+
<a href="https://github.com/strands-agents/sdk-typescript/issues"><img alt="GitHub open issues" src="https://img.shields.io/github/issues/strands-agents/sdk-typescript"/></a>
|
|
19
|
+
<a href="https://github.com/strands-agents/sdk-typescript/pulls"><img alt="GitHub open pull requests" src="https://img.shields.io/github/issues-pr/strands-agents/sdk-typescript"/></a>
|
|
20
|
+
<a href="https://github.com/strands-agents/sdk-typescript/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/strands-agents/sdk-typescript"/></a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="NPM Version" src="https://img.shields.io/npm/v/@strands-agents/sdk"/></a>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<p>
|
|
25
|
+
<a href="https://strandsagents.com/">Documentation</a>
|
|
26
|
+
◆ <a href="https://github.com/strands-agents/samples">Samples</a>
|
|
27
|
+
◆ <a href="https://github.com/strands-agents/sdk-python">Python SDK</a>
|
|
28
|
+
◆ <a href="https://github.com/strands-agents/tools">Tools</a>
|
|
29
|
+
◆ <a href="https://github.com/strands-agents/agent-builder">Agent Builder</a>
|
|
30
|
+
◆ <a href="https://github.com/strands-agents/mcp-server">MCP Server</a>
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
Strands Agents is a simple yet powerful SDK that takes a model-driven approach to building and running AI agents. The TypeScript SDK brings key features from the Python Strands framework to Node.js environments, enabling type-safe agent development for everything from simple assistants to complex workflows.
|
|
35
|
+
|
|
36
|
+
## Feature Overview
|
|
37
|
+
|
|
38
|
+
- **Lightweight & Flexible**: Simple agent loop that works seamlessly in Node.js.
|
|
39
|
+
- **Type-Safe Tools**: Define tools easily using Zod schemas for robust input validation.
|
|
40
|
+
- **Model Agnostic**: First-class support for Amazon Bedrock and OpenAI, with more providers coming.
|
|
41
|
+
- **Built-in MCP**: Native support for Model Context Protocol (MCP) clients, enabling access to external tools and servers.
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install Strands Agents
|
|
47
|
+
npm install @strands-agents/sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { Agent } from '@strands-agents/sdk'
|
|
52
|
+
|
|
53
|
+
// Create agent (uses default Amazon Bedrock provider)
|
|
54
|
+
const agent = new Agent()
|
|
55
|
+
|
|
56
|
+
// Invoke
|
|
57
|
+
const result = await agent.invoke('What is the square root of 1764?')
|
|
58
|
+
console.log(result)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Note**: For the default Amazon Bedrock model provider, you'll need AWS credentials configured and model access enabled for Claude 4.5 Sonnet in your region.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
Ensure you have **[Node.js 20+](https://nodejs.org/)** installed, then:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @strands-agents/sdk
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Features at a Glance
|
|
72
|
+
|
|
73
|
+
### Type-Safe Tools
|
|
74
|
+
|
|
75
|
+
Easily build tools using the `tool` helper and `zod` for schema definition. This ensures the LLM provides exactly the data structure your code expects.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { Agent, tool } from '@strands-agents/sdk'
|
|
79
|
+
import { z } from 'zod'
|
|
80
|
+
|
|
81
|
+
const weatherTool = tool({
|
|
82
|
+
name: 'get_weather',
|
|
83
|
+
description: 'Get the current weather for a specific location.',
|
|
84
|
+
inputSchema: z.object({
|
|
85
|
+
location: z.string().describe('The city and state, e.g., San Francisco, CA'),
|
|
86
|
+
}),
|
|
87
|
+
callback: (input) => {
|
|
88
|
+
// input is fully typed based on the Zod schema above
|
|
89
|
+
return `The weather in ${input.location} is 72°F and sunny.`
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const agent = new Agent({
|
|
94
|
+
tools: [weatherTool],
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
await agent.invoke('What is the weather in San Francisco?')
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### MCP Support
|
|
101
|
+
|
|
102
|
+
Seamlessly integrate Model Context Protocol (MCP) servers to give your agents access to external systems and tools. The SDK includes built-in support for MCP clients.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { Agent, McpClient, StdioClientTransport } from '@strands-agents/sdk'
|
|
106
|
+
|
|
107
|
+
// Create a client for a local MCP server
|
|
108
|
+
const chromeDevtools = new McpClient({
|
|
109
|
+
transport: new StdioClientTransport({
|
|
110
|
+
command: 'npx',
|
|
111
|
+
args: ['-y', 'chrome-devtools-mcp'],
|
|
112
|
+
}),
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
const agent = new Agent({
|
|
116
|
+
systemPrompt: 'You are a helpful assistant using MCP tools.',
|
|
117
|
+
tools: [chromeDevtools], // Pass the MCP client directly as a tool source
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
await agent.invoke('Use a random tool from the MCP server.')
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Multiple Model Providers
|
|
124
|
+
|
|
125
|
+
Switch between model providers easily.
|
|
126
|
+
|
|
127
|
+
**Amazon Bedrock (Default)**
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { Agent, BedrockModel } from '@strands-agents/sdk'
|
|
131
|
+
|
|
132
|
+
const model = new BedrockModel({
|
|
133
|
+
region: 'us-east-1',
|
|
134
|
+
modelId: 'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
const agent = new Agent({ model })
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**OpenAI**
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { Agent } from '@strands-agents/sdk'
|
|
144
|
+
import { OpenAIModel } from '@strands-agents/sdk/openai'
|
|
145
|
+
|
|
146
|
+
// Automatically uses process.env.OPENAI_API_KEY and defaults to gpt-4o
|
|
147
|
+
const model = new OpenAIModel()
|
|
148
|
+
|
|
149
|
+
const agent = new Agent({ model })
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Streaming Responses
|
|
153
|
+
|
|
154
|
+
Access the response as it is generated using the `stream` method:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
const agent = new Agent()
|
|
158
|
+
|
|
159
|
+
console.log('Agent response stream:')
|
|
160
|
+
for await (const event of agent.stream('Tell me a story about a brave toaster.')) {
|
|
161
|
+
console.log('[Event]', event.type)
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Documentation
|
|
166
|
+
|
|
167
|
+
For detailed guidance, tutorials, and concept overviews (shared between Python and TypeScript), please visit the [Strands Agents Documentation](https://strandsagents.com/).
|
|
168
|
+
|
|
169
|
+
## Contributing ❤️
|
|
170
|
+
|
|
171
|
+
We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
172
|
+
|
|
173
|
+
- Development setup and environment
|
|
174
|
+
- Testing and code quality standards
|
|
175
|
+
- Pull request process
|
|
176
|
+
- Code of Conduct
|
|
177
|
+
- Security issue reporting
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
|
182
|
+
|
|
183
|
+
## Security
|
|
184
|
+
|
|
185
|
+
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information on reporting security issues.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures and helpers for Model testing.
|
|
3
|
+
* This module provides utilities for testing Model implementations without
|
|
4
|
+
* requiring actual API clients.
|
|
5
|
+
*/
|
|
6
|
+
import { Model } from '../models/model';
|
|
7
|
+
import type { Message } from '../types/messages';
|
|
8
|
+
import type { ModelStreamEvent } from '../models/streaming';
|
|
9
|
+
import type { BaseModelConfig, StreamOptions } from '../models/model';
|
|
10
|
+
/**
|
|
11
|
+
* Test model provider that returns a predefined stream of events.
|
|
12
|
+
* Useful for testing Model.streamAggregated() and other Model functionality
|
|
13
|
+
* without requiring actual API calls.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const provider = new TestModelProvider(async function* () {
|
|
18
|
+
* yield { type: 'modelMessageStartEvent', role: 'assistant' }
|
|
19
|
+
* yield { type: 'modelContentBlockStartEvent', contentBlockIndex: 0 }
|
|
20
|
+
* yield { type: 'modelContentBlockDeltaEvent', delta: { type: 'textDelta', text: 'Hello' }, contentBlockIndex: 0 }
|
|
21
|
+
* yield { type: 'modelContentBlockStopEvent', contentBlockIndex: 0 }
|
|
22
|
+
* yield { type: 'modelMessageStopEvent', stopReason: 'endTurn' }
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* const message = await collectAggregated(provider.streamAggregated(messages))
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class TestModelProvider extends Model<BaseModelConfig> {
|
|
29
|
+
private eventGenerator;
|
|
30
|
+
private config;
|
|
31
|
+
constructor(eventGenerator?: () => AsyncGenerator<ModelStreamEvent>);
|
|
32
|
+
setEventGenerator(eventGenerator: () => AsyncGenerator<ModelStreamEvent>): void;
|
|
33
|
+
updateConfig(modelConfig: BaseModelConfig): void;
|
|
34
|
+
getConfig(): BaseModelConfig;
|
|
35
|
+
stream(_messages: Message[], _options?: StreamOptions): AsyncGenerator<ModelStreamEvent>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to collect events and result from an async generator.
|
|
39
|
+
* Properly handles AsyncGenerator where the final value is returned
|
|
40
|
+
* rather than yielded.
|
|
41
|
+
*
|
|
42
|
+
* @param generator - An async generator that yields items and returns a final result
|
|
43
|
+
* @returns Object with items array (yielded values) and result (return value)
|
|
44
|
+
*/
|
|
45
|
+
export declare function collectGenerator<E, R>(generator: AsyncGenerator<E, R, never>): Promise<{
|
|
46
|
+
items: E[];
|
|
47
|
+
result: R;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to collect all items from an async iterator.
|
|
51
|
+
*
|
|
52
|
+
* @param stream - An async iterable that yields items
|
|
53
|
+
* @returns Array of all yielded items
|
|
54
|
+
*/
|
|
55
|
+
export declare function collectIterator<T>(stream: AsyncIterable<T>): Promise<T[]>;
|
|
56
|
+
//# sourceMappingURL=model-test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-test-helpers.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/model-test-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,eAAe,CAAC;IAC3D,OAAO,CAAC,cAAc,CAAsD;IAC5E,OAAO,CAAC,MAAM,CAA6C;gBAE/C,cAAc,CAAC,EAAE,MAAM,cAAc,CAAC,gBAAgB,CAAC;IAKnE,iBAAiB,CAAC,cAAc,EAAE,MAAM,cAAc,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAI/E,YAAY,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI;IAIhD,SAAS,IAAI,eAAe;IAIrB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC,gBAAgB,CAAC;CAMhG;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EACzC,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,GACrC,OAAO,CAAC;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,CAgBpC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAM/E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures and helpers for Model testing.
|
|
3
|
+
* This module provides utilities for testing Model implementations without
|
|
4
|
+
* requiring actual API clients.
|
|
5
|
+
*/
|
|
6
|
+
import { Model } from '../models/model';
|
|
7
|
+
/**
|
|
8
|
+
* Test model provider that returns a predefined stream of events.
|
|
9
|
+
* Useful for testing Model.streamAggregated() and other Model functionality
|
|
10
|
+
* without requiring actual API calls.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const provider = new TestModelProvider(async function* () {
|
|
15
|
+
* yield { type: 'modelMessageStartEvent', role: 'assistant' }
|
|
16
|
+
* yield { type: 'modelContentBlockStartEvent', contentBlockIndex: 0 }
|
|
17
|
+
* yield { type: 'modelContentBlockDeltaEvent', delta: { type: 'textDelta', text: 'Hello' }, contentBlockIndex: 0 }
|
|
18
|
+
* yield { type: 'modelContentBlockStopEvent', contentBlockIndex: 0 }
|
|
19
|
+
* yield { type: 'modelMessageStopEvent', stopReason: 'endTurn' }
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const message = await collectAggregated(provider.streamAggregated(messages))
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class TestModelProvider extends Model {
|
|
26
|
+
eventGenerator;
|
|
27
|
+
config = { modelId: 'test-model' };
|
|
28
|
+
constructor(eventGenerator) {
|
|
29
|
+
super();
|
|
30
|
+
this.eventGenerator = eventGenerator;
|
|
31
|
+
}
|
|
32
|
+
setEventGenerator(eventGenerator) {
|
|
33
|
+
this.eventGenerator = eventGenerator;
|
|
34
|
+
}
|
|
35
|
+
updateConfig(modelConfig) {
|
|
36
|
+
this.config = { ...this.config, ...modelConfig };
|
|
37
|
+
}
|
|
38
|
+
getConfig() {
|
|
39
|
+
return this.config;
|
|
40
|
+
}
|
|
41
|
+
async *stream(_messages, _options) {
|
|
42
|
+
if (!this.eventGenerator) {
|
|
43
|
+
throw new Error('Event generator not set');
|
|
44
|
+
}
|
|
45
|
+
yield* this.eventGenerator();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to collect events and result from an async generator.
|
|
50
|
+
* Properly handles AsyncGenerator where the final value is returned
|
|
51
|
+
* rather than yielded.
|
|
52
|
+
*
|
|
53
|
+
* @param generator - An async generator that yields items and returns a final result
|
|
54
|
+
* @returns Object with items array (yielded values) and result (return value)
|
|
55
|
+
*/
|
|
56
|
+
export async function collectGenerator(generator) {
|
|
57
|
+
const items = [];
|
|
58
|
+
let done = false;
|
|
59
|
+
let result;
|
|
60
|
+
while (!done) {
|
|
61
|
+
const { value, done: isDone } = await generator.next();
|
|
62
|
+
done = isDone ?? false;
|
|
63
|
+
if (!done) {
|
|
64
|
+
items.push(value);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
result = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { items, result: result };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to collect all items from an async iterator.
|
|
74
|
+
*
|
|
75
|
+
* @param stream - An async iterable that yields items
|
|
76
|
+
* @returns Array of all yielded items
|
|
77
|
+
*/
|
|
78
|
+
export async function collectIterator(stream) {
|
|
79
|
+
const items = [];
|
|
80
|
+
for await (const item of stream) {
|
|
81
|
+
items.push(item);
|
|
82
|
+
}
|
|
83
|
+
return items;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=model-test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-test-helpers.js","sourceRoot":"","sources":["../../src/__fixtures__/model-test-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAKvC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAsB;IACnD,cAAc,CAAsD;IACpE,MAAM,GAAoB,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;IAE3D,YAAY,cAAuD;QACjE,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;IACtC,CAAC;IAED,iBAAiB,CAAC,cAAsD;QACtE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;IACtC,CAAC;IAED,YAAY,CAAC,WAA4B;QACvC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IAClD,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,CAAC,MAAM,CAAC,SAAoB,EAAE,QAAwB;QAC1D,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;QACD,KAAK,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAA;IAC9B,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAsC;IAEtC,MAAM,KAAK,GAAQ,EAAE,CAAA;IACrB,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,IAAI,MAAqB,CAAA;IAEzB,OAAO,CAAC,IAAI,EAAE,CAAC;QACb,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACtD,IAAI,GAAG,MAAM,IAAI,KAAK,CAAA;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,CAAC,KAAU,CAAC,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,KAAU,CAAA;QACrB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAO,EAAE,CAAA;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAI,MAAwB;IAC/D,MAAM,KAAK,GAAQ,EAAE,CAAA;IACrB,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures and helpers for Tool testing.
|
|
3
|
+
* This module provides utilities for testing Tool implementations.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolContext } from '../tools/tool';
|
|
6
|
+
import type { JSONValue } from '../types/json';
|
|
7
|
+
/**
|
|
8
|
+
* Helper to create a mock ToolContext for testing.
|
|
9
|
+
*
|
|
10
|
+
* @param input - The input data for the tool
|
|
11
|
+
* @param invocationState - Optional invocation state
|
|
12
|
+
* @returns Mock ToolContext object
|
|
13
|
+
*/
|
|
14
|
+
export declare function createMockContext(input: JSONValue, invocationState?: Record<string, unknown>): ToolContext;
|
|
15
|
+
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,WAAW,CAS9G"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures and helpers for Tool testing.
|
|
3
|
+
* This module provides utilities for testing Tool implementations.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Helper to create a mock ToolContext for testing.
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input data for the tool
|
|
9
|
+
* @param invocationState - Optional invocation state
|
|
10
|
+
* @returns Mock ToolContext object
|
|
11
|
+
*/
|
|
12
|
+
export function createMockContext(input, invocationState = {}) {
|
|
13
|
+
return {
|
|
14
|
+
toolUse: {
|
|
15
|
+
name: 'testTool',
|
|
16
|
+
toolUseId: 'test-123',
|
|
17
|
+
input: input,
|
|
18
|
+
},
|
|
19
|
+
invocationState,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=tool-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../src/__fixtures__/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgB,EAAE,kBAA2C,EAAE;IAC/F,OAAO;QACL,OAAO,EAAE;YACP,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,UAAU;YACrB,KAAK,EAAE,KAAK;SACb;QACD,eAAe;KAChB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/errors.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ContextWindowOverflowError } from '../errors';
|
|
3
|
+
describe('ContextWindowOverflowError', () => {
|
|
4
|
+
describe('when instantiated with a message', () => {
|
|
5
|
+
it('creates an error with the correct message', () => {
|
|
6
|
+
const message = 'Context window overflow occurred';
|
|
7
|
+
const error = new ContextWindowOverflowError(message);
|
|
8
|
+
expect(error.message).toBe(message);
|
|
9
|
+
});
|
|
10
|
+
it('has the correct error name', () => {
|
|
11
|
+
const error = new ContextWindowOverflowError('test');
|
|
12
|
+
expect(error.name).toBe('ContextWindowOverflowError');
|
|
13
|
+
});
|
|
14
|
+
it('is an instance of Error', () => {
|
|
15
|
+
const error = new ContextWindowOverflowError('test');
|
|
16
|
+
expect(error).toBeInstanceOf(Error);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=errors.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../src/__tests__/errors.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AAEtD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAChD,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,MAAM,OAAO,GAAG,kCAAkC,CAAA;YAClD,MAAM,KAAK,GAAG,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAA;YAErD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,0BAA0B,CAAC,MAAM,CAAC,CAAA;YAEpD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YACjC,MAAM,KAAK,GAAG,IAAI,0BAA0B,CAAC,MAAM,CAAC,CAAA;YAEpD,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import * as SDK from '../index';
|
|
3
|
+
describe('index', () => {
|
|
4
|
+
describe('when importing from main entry point', () => {
|
|
5
|
+
it('exports error classes', () => {
|
|
6
|
+
expect(SDK.ContextWindowOverflowError).toBeDefined();
|
|
7
|
+
});
|
|
8
|
+
it('exports BedrockModel', () => {
|
|
9
|
+
expect(SDK.BedrockModel).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
it('can instantiate BedrockModel', () => {
|
|
12
|
+
const provider = new SDK.BedrockModel({ region: 'us-west-2' });
|
|
13
|
+
expect(provider).toBeInstanceOf(SDK.BedrockModel);
|
|
14
|
+
expect(provider.getConfig()).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
it('exports all required types', () => {
|
|
17
|
+
// This test ensures all type exports compile correctly
|
|
18
|
+
// If any exports are missing, TypeScript will error
|
|
19
|
+
const _typeCheck = {
|
|
20
|
+
contextError: SDK.ContextWindowOverflowError,
|
|
21
|
+
provider: SDK.BedrockModel,
|
|
22
|
+
};
|
|
23
|
+
expect(_typeCheck).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,WAAW,EAAE,CAAA;QACtD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;YAC9B,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAA;QACxC,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;YAC9D,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YACjD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;QAC5C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,uDAAuD;YACvD,oDAAoD;YACpD,MAAM,UAAU,GAKZ;gBACF,YAAY,EAAE,GAAG,CAAC,0BAA0B;gBAC5C,QAAQ,EAAE,GAAG,CAAC,YAAY;aAC3B,CAAA;YACD,MAAM,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the Strands Agents TypeScript SDK.
|
|
3
|
+
*
|
|
4
|
+
* These error classes represent specific error conditions that can occur
|
|
5
|
+
* during agent execution and model provider interactions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when input exceeds the model's context window.
|
|
9
|
+
*
|
|
10
|
+
* This error indicates that the combined length of the input (prompt, messages,
|
|
11
|
+
* system prompt, and tool definitions) exceeds the maximum context window size
|
|
12
|
+
* supported by the model.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ContextWindowOverflowError extends Error {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new ContextWindowOverflowError.
|
|
17
|
+
*
|
|
18
|
+
* @param message - Error message describing the context overflow
|
|
19
|
+
*/
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAI5B"}
|