@strands-agents/sdk 0.3.0 → 0.4.0
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/README.md +43 -0
- package/dist/src/__fixtures__/mock-hook-provider.d.ts +3 -7
- package/dist/src/__fixtures__/mock-hook-provider.d.ts.map +1 -1
- package/dist/src/__fixtures__/mock-hook-provider.js +3 -9
- package/dist/src/__fixtures__/mock-hook-provider.js.map +1 -1
- package/dist/src/__fixtures__/mock-message-model.d.ts +8 -2
- package/dist/src/__fixtures__/mock-message-model.d.ts.map +1 -1
- package/dist/src/__fixtures__/mock-message-model.js +1 -0
- package/dist/src/__fixtures__/mock-message-model.js.map +1 -1
- package/dist/src/__fixtures__/mock-storage-provider.d.ts +37 -0
- package/dist/src/__fixtures__/mock-storage-provider.d.ts.map +1 -0
- package/dist/src/__fixtures__/mock-storage-provider.js +105 -0
- package/dist/src/__fixtures__/mock-storage-provider.js.map +1 -0
- package/dist/src/__fixtures__/slim-types.d.ts +50 -0
- package/dist/src/__fixtures__/slim-types.d.ts.map +1 -0
- package/dist/src/__fixtures__/slim-types.js +6 -0
- package/dist/src/__fixtures__/slim-types.js.map +1 -0
- package/dist/src/__fixtures__/tool-helpers.d.ts +8 -3
- package/dist/src/__fixtures__/tool-helpers.d.ts.map +1 -1
- package/dist/src/__fixtures__/tool-helpers.js +1 -1
- package/dist/src/__fixtures__/tool-helpers.js.map +1 -1
- package/dist/src/agent/__tests__/agent.hook.test.js +18 -18
- package/dist/src/agent/__tests__/agent.hook.test.js.map +1 -1
- package/dist/src/agent/__tests__/agent.test.js +124 -8
- package/dist/src/agent/__tests__/agent.test.js.map +1 -1
- package/dist/src/agent/__tests__/printer.test.js +5 -9
- package/dist/src/agent/__tests__/printer.test.js.map +1 -1
- package/dist/src/agent/__tests__/snapshot.test.d.ts +2 -0
- package/dist/src/agent/__tests__/snapshot.test.d.ts.map +1 -0
- package/dist/src/agent/__tests__/snapshot.test.js +249 -0
- package/dist/src/agent/__tests__/snapshot.test.js.map +1 -0
- package/dist/src/agent/__tests__/state.test.js +19 -0
- package/dist/src/agent/__tests__/state.test.js.map +1 -1
- package/dist/src/agent/agent.d.ts +19 -4
- package/dist/src/agent/agent.d.ts.map +1 -1
- package/dist/src/agent/agent.js +104 -34
- package/dist/src/agent/agent.js.map +1 -1
- package/dist/src/agent/printer.d.ts +4 -0
- package/dist/src/agent/printer.d.ts.map +1 -1
- package/dist/src/agent/printer.js +18 -6
- package/dist/src/agent/printer.js.map +1 -1
- package/dist/src/agent/snapshot.d.ts +132 -0
- package/dist/src/agent/snapshot.d.ts.map +1 -0
- package/dist/src/agent/snapshot.js +151 -0
- package/dist/src/agent/snapshot.js.map +1 -0
- package/dist/src/agent/state.d.ts +14 -1
- package/dist/src/agent/state.d.ts.map +1 -1
- package/dist/src/agent/state.js +21 -0
- package/dist/src/agent/state.js.map +1 -1
- package/dist/src/errors.d.ts +15 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +18 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/hooks/__tests__/events.test.js +102 -21
- package/dist/src/hooks/__tests__/events.test.js.map +1 -1
- package/dist/src/hooks/events.d.ts +156 -22
- package/dist/src/hooks/events.d.ts.map +1 -1
- package/dist/src/hooks/events.js +158 -18
- package/dist/src/hooks/events.js.map +1 -1
- package/dist/src/hooks/index.d.ts +12 -4
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +11 -3
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/registry.d.ts +5 -5
- package/dist/src/hooks/registry.d.ts.map +1 -1
- package/dist/src/hooks/registry.js.map +1 -1
- package/dist/src/hooks/types.d.ts +5 -5
- package/dist/src/hooks/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/__tests__/anthropic.test.js +31 -42
- package/dist/src/models/__tests__/anthropic.test.js.map +1 -1
- package/dist/src/models/__tests__/bedrock.test.js +70 -107
- package/dist/src/models/__tests__/bedrock.test.js.map +1 -1
- package/dist/src/models/__tests__/gemini.test.js +18 -18
- package/dist/src/models/__tests__/gemini.test.js.map +1 -1
- package/dist/src/models/__tests__/model.test.js +14 -13
- package/dist/src/models/__tests__/model.test.js.map +1 -1
- package/dist/src/models/__tests__/openai.test.js +73 -83
- package/dist/src/models/__tests__/openai.test.js.map +1 -1
- package/dist/src/models/streaming.d.ts +8 -0
- package/dist/src/models/streaming.d.ts.map +1 -1
- package/dist/src/models/streaming.js +17 -0
- package/dist/src/models/streaming.js.map +1 -1
- package/dist/src/multiagent/__tests__/nodes.test.d.ts +2 -0
- package/dist/src/multiagent/__tests__/nodes.test.d.ts.map +1 -0
- package/dist/src/multiagent/__tests__/nodes.test.js +98 -0
- package/dist/src/multiagent/__tests__/nodes.test.js.map +1 -0
- package/dist/src/multiagent/events.d.ts +24 -0
- package/dist/src/multiagent/events.d.ts.map +1 -0
- package/dist/src/multiagent/events.js +19 -0
- package/dist/src/multiagent/events.js.map +1 -0
- package/dist/src/multiagent/index.d.ts +11 -0
- package/dist/src/multiagent/index.d.ts.map +1 -0
- package/dist/src/multiagent/index.js +7 -0
- package/dist/src/multiagent/index.js.map +1 -0
- package/dist/src/multiagent/nodes.d.ts +75 -0
- package/dist/src/multiagent/nodes.d.ts.map +1 -0
- package/dist/src/multiagent/nodes.js +101 -0
- package/dist/src/multiagent/nodes.js.map +1 -0
- package/dist/src/multiagent/state.d.ts +55 -0
- package/dist/src/multiagent/state.d.ts.map +1 -0
- package/dist/src/multiagent/state.js +43 -0
- package/dist/src/multiagent/state.js.map +1 -0
- package/dist/src/multiagent/types.d.ts +5 -0
- package/dist/src/multiagent/types.d.ts.map +1 -0
- package/dist/src/multiagent/types.js +2 -0
- package/dist/src/multiagent/types.js.map +1 -0
- package/dist/src/registry/tool-registry.d.ts +2 -1
- package/dist/src/registry/tool-registry.d.ts.map +1 -1
- package/dist/src/registry/tool-registry.js +4 -2
- package/dist/src/registry/tool-registry.js.map +1 -1
- package/dist/src/session/__tests__/file-storage.test.node.d.ts +2 -0
- package/dist/src/session/__tests__/file-storage.test.node.d.ts.map +1 -0
- package/dist/src/session/__tests__/file-storage.test.node.js +218 -0
- package/dist/src/session/__tests__/file-storage.test.node.js.map +1 -0
- package/dist/src/session/__tests__/s3-storage.test.node.d.ts +2 -0
- package/dist/src/session/__tests__/s3-storage.test.node.d.ts.map +1 -0
- package/dist/src/session/__tests__/s3-storage.test.node.js +375 -0
- package/dist/src/session/__tests__/s3-storage.test.node.js.map +1 -0
- package/dist/src/session/__tests__/validation.test.d.ts +2 -0
- package/dist/src/session/__tests__/validation.test.d.ts.map +1 -0
- package/dist/src/session/__tests__/validation.test.js +20 -0
- package/dist/src/session/__tests__/validation.test.js.map +1 -0
- package/dist/src/session/file-storage.d.ts +79 -0
- package/dist/src/session/file-storage.d.ts.map +1 -0
- package/dist/src/session/file-storage.js +144 -0
- package/dist/src/session/file-storage.js.map +1 -0
- package/dist/src/session/index.d.ts +19 -0
- package/dist/src/session/index.d.ts.map +1 -0
- package/dist/src/session/index.js +18 -0
- package/dist/src/session/index.js.map +1 -0
- package/dist/src/session/s3-storage.d.ts +93 -0
- package/dist/src/session/s3-storage.d.ts.map +1 -0
- package/dist/src/session/s3-storage.js +150 -0
- package/dist/src/session/s3-storage.js.map +1 -0
- package/dist/src/session/storage.d.ts +91 -0
- package/dist/src/session/storage.d.ts.map +1 -0
- package/dist/src/session/storage.js +2 -0
- package/dist/src/session/storage.js.map +1 -0
- package/dist/src/session/types.d.ts +49 -0
- package/dist/src/session/types.d.ts.map +1 -0
- package/dist/src/session/types.js +2 -0
- package/dist/src/session/types.js.map +1 -0
- package/dist/src/session/validation.d.ts +10 -0
- package/dist/src/session/validation.d.ts.map +1 -0
- package/dist/src/session/validation.js +16 -0
- package/dist/src/session/validation.js.map +1 -0
- package/dist/src/structured-output/__tests__/context.test.d.ts +2 -0
- package/dist/src/structured-output/__tests__/context.test.d.ts.map +1 -0
- package/dist/src/structured-output/__tests__/context.test.js +201 -0
- package/dist/src/structured-output/__tests__/context.test.js.map +1 -0
- package/dist/src/structured-output/__tests__/exceptions.test.d.ts +2 -0
- package/dist/src/structured-output/__tests__/exceptions.test.d.ts.map +1 -0
- package/dist/src/structured-output/__tests__/exceptions.test.js +103 -0
- package/dist/src/structured-output/__tests__/exceptions.test.js.map +1 -0
- package/dist/src/structured-output/__tests__/tool.test.d.ts +2 -0
- package/dist/src/structured-output/__tests__/tool.test.d.ts.map +1 -0
- package/dist/src/structured-output/__tests__/tool.test.js +256 -0
- package/dist/src/structured-output/__tests__/tool.test.js.map +1 -0
- package/dist/src/structured-output/__tests__/utils.test.d.ts +2 -0
- package/dist/src/structured-output/__tests__/utils.test.d.ts.map +1 -0
- package/dist/src/structured-output/__tests__/utils.test.js +183 -0
- package/dist/src/structured-output/__tests__/utils.test.js.map +1 -0
- package/dist/src/structured-output/context.d.ts +91 -0
- package/dist/src/structured-output/context.d.ts.map +1 -0
- package/dist/src/structured-output/context.js +112 -0
- package/dist/src/structured-output/context.js.map +1 -0
- package/dist/src/structured-output/exceptions.d.ts +18 -0
- package/dist/src/structured-output/exceptions.d.ts.map +1 -0
- package/dist/src/structured-output/exceptions.js +28 -0
- package/dist/src/structured-output/exceptions.js.map +1 -0
- package/dist/src/structured-output/tool.d.ts +33 -0
- package/dist/src/structured-output/tool.d.ts.map +1 -0
- package/dist/src/structured-output/tool.js +73 -0
- package/dist/src/structured-output/tool.js.map +1 -0
- package/dist/src/structured-output/utils.d.ts +23 -0
- package/dist/src/structured-output/utils.d.ts.map +1 -0
- package/dist/src/structured-output/utils.js +104 -0
- package/dist/src/structured-output/utils.js.map +1 -0
- package/dist/src/tools/zod-tool.d.ts.map +1 -1
- package/dist/src/tools/zod-tool.js +2 -5
- package/dist/src/tools/zod-tool.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types/__tests__/media.test.js +216 -1
- package/dist/src/types/__tests__/media.test.js.map +1 -1
- package/dist/src/types/__tests__/messages.test.js +193 -4
- package/dist/src/types/__tests__/messages.test.js.map +1 -1
- package/dist/src/types/agent.d.ts +13 -7
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/agent.js +8 -1
- package/dist/src/types/agent.js.map +1 -1
- package/dist/src/types/json.d.ts +61 -0
- package/dist/src/types/json.d.ts.map +1 -1
- package/dist/src/types/json.js +24 -0
- package/dist/src/types/json.js.map +1 -1
- package/dist/src/types/media.d.ts +84 -4
- package/dist/src/types/media.d.ts.map +1 -1
- package/dist/src/types/media.js +194 -0
- package/dist/src/types/media.js.map +1 -1
- package/dist/src/types/messages.d.ts +148 -9
- package/dist/src/types/messages.d.ts.map +1 -1
- package/dist/src/types/messages.js +234 -7
- package/dist/src/types/messages.js.map +1 -1
- package/dist/src/types/serializable.d.ts +31 -0
- package/dist/src/types/serializable.d.ts.map +1 -0
- package/dist/src/types/serializable.js +19 -0
- package/dist/src/types/serializable.js.map +1 -0
- package/dist/src/utils/zod.d.ts +11 -0
- package/dist/src/utils/zod.d.ts.map +1 -0
- package/dist/src/utils/zod.js +14 -0
- package/dist/src/utils/zod.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialization interfaces for state persistence.
|
|
3
|
+
*
|
|
4
|
+
* This module provides interfaces for objects that can serialize and deserialize
|
|
5
|
+
* their state, enabling persistence and restoration of runtime state.
|
|
6
|
+
*/
|
|
7
|
+
import type { JSONSerializable } from './json.js';
|
|
8
|
+
import type { JSONValue } from './json.js';
|
|
9
|
+
/**
|
|
10
|
+
* Interface for mutable state containers that can serialize and restore their state.
|
|
11
|
+
* Extends JSONSerializable for one-way serialization, adding in-place state restoration.
|
|
12
|
+
*
|
|
13
|
+
* Use JSONSerializable for immutable value objects (with static fromJSON).
|
|
14
|
+
* Use StateSerializable for mutable state that loads into an existing instance.
|
|
15
|
+
*/
|
|
16
|
+
export interface StateSerializable extends JSONSerializable<JSONValue> {
|
|
17
|
+
/**
|
|
18
|
+
* Loads state from a previously serialized JSON value.
|
|
19
|
+
*
|
|
20
|
+
* @param json - The serialized state to load
|
|
21
|
+
*/
|
|
22
|
+
loadStateFromJson(json: JSONValue): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Type guard to check if an object implements StateSerializable.
|
|
26
|
+
*
|
|
27
|
+
* @param obj - The object to check
|
|
28
|
+
* @returns True if the object implements StateSerializable
|
|
29
|
+
*/
|
|
30
|
+
export declare function isStateSerializable(obj: unknown): obj is StateSerializable;
|
|
31
|
+
//# sourceMappingURL=serializable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable.d.ts","sourceRoot":"","sources":["../../../src/types/serializable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB,CAAC,SAAS,CAAC;IACpE;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;CACzC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAO1E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialization interfaces for state persistence.
|
|
3
|
+
*
|
|
4
|
+
* This module provides interfaces for objects that can serialize and deserialize
|
|
5
|
+
* their state, enabling persistence and restoration of runtime state.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Type guard to check if an object implements StateSerializable.
|
|
9
|
+
*
|
|
10
|
+
* @param obj - The object to check
|
|
11
|
+
* @returns True if the object implements StateSerializable
|
|
12
|
+
*/
|
|
13
|
+
export function isStateSerializable(obj) {
|
|
14
|
+
return (obj !== null &&
|
|
15
|
+
typeof obj === 'object' &&
|
|
16
|
+
typeof obj.toJSON === 'function' &&
|
|
17
|
+
typeof obj.loadStateFromJson === 'function');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=serializable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable.js","sourceRoot":"","sources":["../../../src/types/serializable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAQ,GAAyB,CAAC,MAAM,KAAK,UAAU;QACvD,OAAQ,GAAyB,CAAC,iBAAiB,KAAK,UAAU,CACnE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { JSONSchema } from '../types/json.js';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Zod schema to JSON Schema format.
|
|
5
|
+
* Strips the $schema property to reduce token usage.
|
|
6
|
+
*
|
|
7
|
+
* @param schema - The Zod schema to convert
|
|
8
|
+
* @returns JSON Schema representation
|
|
9
|
+
*/
|
|
10
|
+
export declare function zodSchemaToJsonSchema(schema: z.ZodSchema): JSONSchema;
|
|
11
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../src/utils/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG,UAAU,CAIrE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Zod schema to JSON Schema format.
|
|
4
|
+
* Strips the $schema property to reduce token usage.
|
|
5
|
+
*
|
|
6
|
+
* @param schema - The Zod schema to convert
|
|
7
|
+
* @returns JSON Schema representation
|
|
8
|
+
*/
|
|
9
|
+
export function zodSchemaToJsonSchema(schema) {
|
|
10
|
+
const result = z.toJSONSchema(schema);
|
|
11
|
+
const { $schema: _$schema, ...jsonSchema } = result;
|
|
12
|
+
return jsonSchema;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../../../src/utils/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAmB;IACvD,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,CAAC,MAAM,CAAsC,CAAA;IAC1E,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACnD,OAAO,UAAwB,CAAA;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strands-agents/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TypeScript SDK for Strands Agents framework",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"module": "dist/src/index.js",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"license": "Apache-2.0",
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
85
|
+
"@aws-sdk/client-s3": "^3.943.0",
|
|
85
86
|
"@aws-sdk/client-secrets-manager": "^3.943.0",
|
|
86
87
|
"@aws-sdk/credential-providers": "^3.943.0",
|
|
87
88
|
"@google/genai": "^1.40.0",
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
},
|
|
119
120
|
"peerDependencies": {
|
|
120
121
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
122
|
+
"@aws-sdk/client-s3": "^3.943.0",
|
|
121
123
|
"@google/genai": "^1.40.0",
|
|
122
124
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
123
125
|
"openai": "^6.7.0",
|
|
@@ -127,6 +129,9 @@
|
|
|
127
129
|
"@anthropic-ai/sdk": {
|
|
128
130
|
"optional": true
|
|
129
131
|
},
|
|
132
|
+
"@aws-sdk/client-s3": {
|
|
133
|
+
"optional": true
|
|
134
|
+
},
|
|
130
135
|
"@google/genai": {
|
|
131
136
|
"optional": true
|
|
132
137
|
},
|
|
@@ -136,6 +141,6 @@
|
|
|
136
141
|
},
|
|
137
142
|
"overrides": {
|
|
138
143
|
"rollup": "4.52.5",
|
|
139
|
-
"fast-xml-parser": "5.3.
|
|
144
|
+
"fast-xml-parser": ">=5.3.6"
|
|
140
145
|
}
|
|
141
146
|
}
|