bedrock-agentcore 0.0.1 → 0.2.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/LICENSE +202 -0
- package/README.md +131 -9
- package/dist/src/_utils/endpoints.d.ts +28 -0
- package/dist/src/_utils/endpoints.d.ts.map +1 -0
- package/dist/src/_utils/endpoints.js +44 -0
- package/dist/src/_utils/endpoints.js.map +1 -0
- package/dist/src/identity/client.d.ts +40 -0
- package/dist/src/identity/client.d.ts.map +1 -0
- package/dist/src/identity/client.js +109 -0
- package/dist/src/identity/client.js.map +1 -0
- package/dist/src/identity/index.d.ts +22 -0
- package/dist/src/identity/index.d.ts.map +1 -0
- package/dist/src/identity/index.js +24 -0
- package/dist/src/identity/index.js.map +1 -0
- package/dist/src/identity/types.d.ts +82 -0
- package/dist/src/identity/types.d.ts.map +1 -0
- package/dist/src/identity/types.js +5 -0
- package/dist/src/identity/types.js.map +1 -0
- package/dist/src/identity/wrappers.d.ts +54 -0
- package/dist/src/identity/wrappers.d.ts.map +1 -0
- package/dist/src/identity/wrappers.js +95 -0
- package/dist/src/identity/wrappers.js.map +1 -0
- package/dist/src/runtime/app.d.ts +144 -0
- package/dist/src/runtime/app.d.ts.map +1 -0
- package/dist/src/runtime/app.js +485 -0
- package/dist/src/runtime/app.js.map +1 -0
- package/dist/src/runtime/client.d.ts +154 -0
- package/dist/src/runtime/client.d.ts.map +1 -0
- package/dist/src/runtime/client.js +319 -0
- package/dist/src/runtime/client.js.map +1 -0
- package/dist/src/runtime/context.d.ts +33 -0
- package/dist/src/runtime/context.d.ts.map +1 -0
- package/dist/src/runtime/context.js +49 -0
- package/dist/src/runtime/context.js.map +1 -0
- package/dist/src/runtime/index.d.ts +8 -0
- package/dist/src/runtime/index.d.ts.map +1 -0
- package/dist/src/runtime/index.js +7 -0
- package/dist/src/runtime/index.js.map +1 -0
- package/dist/src/runtime/types.d.ts +429 -0
- package/dist/src/runtime/types.d.ts.map +1 -0
- package/dist/src/runtime/types.js +26 -0
- package/dist/src/runtime/types.js.map +1 -0
- package/dist/src/tools/browser/client.d.ts +125 -0
- package/dist/src/tools/browser/client.d.ts.map +1 -0
- package/dist/src/tools/browser/client.js +320 -0
- package/dist/src/tools/browser/client.js.map +1 -0
- package/dist/src/tools/browser/index.d.ts +4 -0
- package/dist/src/tools/browser/index.d.ts.map +1 -0
- package/dist/src/tools/browser/index.js +3 -0
- package/dist/src/tools/browser/index.js.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/client.d.ts +147 -0
- package/dist/src/tools/browser/integrations/playwright/client.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/client.js +324 -0
- package/dist/src/tools/browser/integrations/playwright/client.js.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/index.d.ts +20 -0
- package/dist/src/tools/browser/integrations/playwright/index.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/index.js +19 -0
- package/dist/src/tools/browser/integrations/playwright/index.js.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/types.d.ts +169 -0
- package/dist/src/tools/browser/integrations/playwright/types.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/playwright/types.js +2 -0
- package/dist/src/tools/browser/integrations/playwright/types.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.d.ts +20 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.js +33 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts +20 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.js +34 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts +19 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.js +32 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts +19 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.js +32 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/index.d.ts +25 -0
- package/dist/src/tools/browser/integrations/strands/index.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/index.js +25 -0
- package/dist/src/tools/browser/integrations/strands/index.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts +21 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.js +41 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts +29 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.js +52 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/tools.d.ts +119 -0
- package/dist/src/tools/browser/integrations/strands/tools.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/tools.js +141 -0
- package/dist/src/tools/browser/integrations/strands/tools.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.d.ts +22 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.js +37 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts +18 -0
- package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js +31 -0
- package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts +18 -0
- package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js +32 -0
- package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts +17 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js +30 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts +17 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js +30 -0
- package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts +19 -0
- package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/index.js +19 -0
- package/dist/src/tools/browser/integrations/vercel-ai/index.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts +19 -0
- package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js +39 -0
- package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts +22 -0
- package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js +44 -0
- package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts +123 -0
- package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/tools.js +145 -0
- package/dist/src/tools/browser/integrations/vercel-ai/tools.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts +20 -0
- package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js +35 -0
- package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js.map +1 -0
- package/dist/src/tools/browser/types.d.ts +336 -0
- package/dist/src/tools/browser/types.d.ts.map +1 -0
- package/dist/src/tools/browser/types.js +17 -0
- package/dist/src/tools/browser/types.js.map +1 -0
- package/dist/src/tools/code-interpreter/client.d.ts +214 -0
- package/dist/src/tools/code-interpreter/client.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/client.js +518 -0
- package/dist/src/tools/code-interpreter/client.js.map +1 -0
- package/dist/src/tools/code-interpreter/index.d.ts +4 -0
- package/dist/src/tools/code-interpreter/index.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/index.js +5 -0
- package/dist/src/tools/code-interpreter/index.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts +28 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js +47 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts +27 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js +42 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts +33 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js +78 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts +32 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.js +32 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts +94 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.js +112 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts +27 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js +46 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts +26 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js +41 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts +32 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js +77 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts +26 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js +26 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts +94 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js +112 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js.map +1 -0
- package/dist/src/tools/code-interpreter/types.d.ts +473 -0
- package/dist/src/tools/code-interpreter/types.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/types.js +52 -0
- package/dist/src/tools/code-interpreter/types.js.map +1 -0
- package/package.json +134 -12
- package/index.js +0 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,14 +1,136 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://aws.amazon.com/bedrock/agentcore/">
|
|
3
|
+
<img width="150" height="150" alt="Bedrock AgentCore" src="https://github.com/user-attachments/assets/b8b9456d-c9e2-45e1-ac5b-760f21f1ac18" />
|
|
4
|
+
</a>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<h1>Bedrock AgentCore SDK for TypeScript</h1>
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
<p>Deploy AI agents to AWS with VM-level isolation and zero infrastructure</p>
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/bedrock-agentcore"><img alt="npm version" src="https://img.shields.io/npm/v/bedrock-agentcore"/></a>
|
|
12
|
+
<a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.5+-blue"/></a>
|
|
13
|
+
<a href="https://nodejs.org/"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-20+-green"/></a>
|
|
14
|
+
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue"/></a>
|
|
15
|
+
</p>
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
-
|
|
17
|
+
<p>
|
|
18
|
+
<a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html">Documentation</a>
|
|
19
|
+
|
|
|
20
|
+
<a href="https://github.com/awslabs/bedrock-agentcore-samples-typescript">Samples</a>
|
|
21
|
+
|
|
|
22
|
+
<a href="https://github.com/aws/bedrock-agentcore-sdk-python">Python SDK</a>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Why AgentCore?
|
|
29
|
+
|
|
30
|
+
- **Zero infrastructure** — No servers to provision, no containers to manage, no scaling to configure.
|
|
31
|
+
- **Session isolation** — Each agent session runs in its own VM. No shared state, no noisy neighbors.
|
|
32
|
+
- **Long-lived sessions** — Sessions persist across requests. Your agent maintains context without external storage.
|
|
33
|
+
- **Managed tools** — Secure code execution and browser automation, ready to use.
|
|
34
|
+
- **Credential management** — Centralized API keys and OAuth tokens, injected at runtime.
|
|
35
|
+
|
|
36
|
+
Works with [Strands Agents](https://strandsagents.com), [Vercel AI SDK](https://ai-sdk.dev), or any framework.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install bedrock-agentcore @strands-agents/sdk
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime'
|
|
48
|
+
import { Agent, BedrockModel } from '@strands-agents/sdk'
|
|
49
|
+
import { z } from 'zod'
|
|
50
|
+
|
|
51
|
+
const agent = new Agent({
|
|
52
|
+
model: new BedrockModel({ modelId: 'global.amazon.nova-2-lite-v1:0' }),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const app = new BedrockAgentCoreApp({
|
|
56
|
+
invocationHandler: {
|
|
57
|
+
requestSchema: z.object({ prompt: z.string() }),
|
|
58
|
+
process: async function* (request) {
|
|
59
|
+
for await (const event of agent.stream(request.prompt)) {
|
|
60
|
+
if (event.delta?.text) yield { text: event.delta.text }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
app.run()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`BedrockAgentCoreApp` creates an AgentCore Runtime-compliant server—handling request parsing, streaming responses, and session management for seamless deployment.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Tools
|
|
74
|
+
|
|
75
|
+
Give your agent secure code execution with three lines:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { CodeInterpreterTools } from 'bedrock-agentcore/tools/code-interpreter/strands'
|
|
79
|
+
import { Agent, BedrockModel } from '@strands-agents/sdk'
|
|
80
|
+
|
|
81
|
+
const codeInterpreter = new CodeInterpreterTools({ region: 'us-east-1' })
|
|
82
|
+
|
|
83
|
+
const agent = new Agent({
|
|
84
|
+
model: new BedrockModel({ modelId: 'global.amazon.nova-2-lite-v1:0' }),
|
|
85
|
+
tools: codeInterpreter.getTools(),
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Agent can now execute code in a secure sandboxed environment
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Features
|
|
94
|
+
|
|
95
|
+
- **Runtime** — Secure, session-isolated compute → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/runtime)
|
|
96
|
+
- **Code Interpreter** — Execute Python/JS/TS in a sandbox → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/tools/code-interpreter)
|
|
97
|
+
- **Browser** — Cloud-based web automation → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/tools/browser)
|
|
98
|
+
- **Identity** — Manage API keys and OAuth tokens → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/identity)
|
|
99
|
+
- **Memory** — Persistent knowledge across sessions (coming soon)
|
|
100
|
+
- **Gateway** — Transform APIs into MCP tools (coming soon)
|
|
101
|
+
- **Observability** — OpenTelemetry tracing (coming soon)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Installation
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install bedrock-agentcore
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
**Prerequisites:** Node.js 20+, [AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [AgentCore access](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html)
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Deployment
|
|
117
|
+
|
|
118
|
+
- [Sample Applications](https://github.com/awslabs/bedrock-agentcore-samples-typescript) — Working examples with deployment templates
|
|
119
|
+
- [CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/AWS_BedrockAgentCore.html) — Infrastructure as code
|
|
120
|
+
- [AWS CDK](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore-readme.html) — Infrastructure as code
|
|
121
|
+
- [Deployment Guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/getting-started-custom.html) — Step-by-step walkthrough
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Resources
|
|
126
|
+
|
|
127
|
+
- [AgentCore Documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html)
|
|
128
|
+
- [Python SDK](https://github.com/aws/bedrock-agentcore-sdk-python)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Apache 2.0 — see [LICENSE](LICENSE)
|
|
135
|
+
|
|
136
|
+
[Contributing](CONTRIBUTING.md) · [Security](SECURITY.md)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for constructing AWS service endpoints.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Gets the data plane endpoint for the Bedrock AgentCore service.
|
|
6
|
+
*
|
|
7
|
+
* The endpoint can be overridden using the BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT
|
|
8
|
+
* environment variable. Otherwise, it follows the standard AWS endpoint pattern.
|
|
9
|
+
*
|
|
10
|
+
* @param region - AWS region (e.g., 'us-west-2', 'us-east-1')
|
|
11
|
+
* @returns Full HTTPS endpoint URL
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
16
|
+
* // Returns: 'https://bedrock-agentcore.us-west-2.amazonaws.com'
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* With environment variable override:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* process.env.BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT = 'https://custom-endpoint.example.com'
|
|
23
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
24
|
+
* // Returns: 'https://custom-endpoint.example.com'
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDataPlaneEndpoint(region: string): string;
|
|
28
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/_utils/endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAc3D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for constructing AWS service endpoints.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Environment variable for overriding the data plane endpoint.
|
|
6
|
+
*/
|
|
7
|
+
const ENDPOINT_OVERRIDE_ENV = 'BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT';
|
|
8
|
+
/**
|
|
9
|
+
* Gets the data plane endpoint for the Bedrock AgentCore service.
|
|
10
|
+
*
|
|
11
|
+
* The endpoint can be overridden using the BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT
|
|
12
|
+
* environment variable. Otherwise, it follows the standard AWS endpoint pattern.
|
|
13
|
+
*
|
|
14
|
+
* @param region - AWS region (e.g., 'us-west-2', 'us-east-1')
|
|
15
|
+
* @returns Full HTTPS endpoint URL
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
20
|
+
* // Returns: 'https://bedrock-agentcore.us-west-2.amazonaws.com'
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* With environment variable override:
|
|
25
|
+
* ```typescript
|
|
26
|
+
* process.env.BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT = 'https://custom-endpoint.example.com'
|
|
27
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
28
|
+
* // Returns: 'https://custom-endpoint.example.com'
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function getDataPlaneEndpoint(region) {
|
|
32
|
+
// Validate region is not empty
|
|
33
|
+
if (!region || region.trim() === '') {
|
|
34
|
+
throw new Error('Region cannot be empty');
|
|
35
|
+
}
|
|
36
|
+
// Check for environment variable override
|
|
37
|
+
const override = process.env[ENDPOINT_OVERRIDE_ENV];
|
|
38
|
+
if (override) {
|
|
39
|
+
return override;
|
|
40
|
+
}
|
|
41
|
+
// Return standard AWS endpoint pattern
|
|
42
|
+
return `https://bedrock-agentcore.${region}.amazonaws.com`;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../src/_utils/endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,qBAAqB,GAAG,uCAAuC,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,+BAA+B;IAC/B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,CAAC;IAED,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IACnD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,uCAAuC;IACvC,OAAO,6BAA6B,MAAM,gBAAgB,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityClient for AgentCore Identity operations
|
|
3
|
+
*/
|
|
4
|
+
import type { OAuth2TokenRequest, ApiKeyRequest } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Client for interacting with Amazon Bedrock AgentCore Identity service.
|
|
7
|
+
* Provides methods for managing workload identities, credential providers,
|
|
8
|
+
* and retrieving OAuth2 tokens and API keys.
|
|
9
|
+
*/
|
|
10
|
+
export declare class IdentityClient {
|
|
11
|
+
private readonly dataPlaneClient;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new IdentityClient instance
|
|
14
|
+
* @param region - AWS region (defaults to AWS_REGION env var)
|
|
15
|
+
* @throws Error if region cannot be determined
|
|
16
|
+
*/
|
|
17
|
+
constructor(region?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves an OAuth2 access token from AgentCore Identity.
|
|
20
|
+
* Handles both M2M (immediate) and USER_FEDERATION (polling) flows.
|
|
21
|
+
*
|
|
22
|
+
* @param request - OAuth2 token request parameters
|
|
23
|
+
* @returns OAuth2 access token
|
|
24
|
+
* @throws Error if token retrieval fails or times out
|
|
25
|
+
*/
|
|
26
|
+
getOAuth2Token(request: OAuth2TokenRequest): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Polls for OAuth2 token until available or timeout
|
|
29
|
+
*/
|
|
30
|
+
private pollForToken;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an API key from AgentCore Identity token vault.
|
|
33
|
+
*
|
|
34
|
+
* @param request - API key request parameters
|
|
35
|
+
* @returns API key string
|
|
36
|
+
* @throws Error if API key retrieval fails
|
|
37
|
+
*/
|
|
38
|
+
getApiKey(request: ApiKeyRequest): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/identity/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAKnE;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwB;IAExD;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;IAU3B;;;;;;;OAOG;IACG,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsClE;;OAEG;YACW,YAAY;IA6B1B;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CAczD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityClient for AgentCore Identity operations
|
|
3
|
+
*/
|
|
4
|
+
import { BedrockAgentCoreClient, GetResourceOauth2TokenCommand, GetResourceApiKeyCommand, } from '@aws-sdk/client-bedrock-agentcore';
|
|
5
|
+
const POLLING_INTERVAL_MS = 5000; // 5 seconds
|
|
6
|
+
const POLLING_TIMEOUT_MS = 600000; // 10 minutes
|
|
7
|
+
/**
|
|
8
|
+
* Client for interacting with Amazon Bedrock AgentCore Identity service.
|
|
9
|
+
* Provides methods for managing workload identities, credential providers,
|
|
10
|
+
* and retrieving OAuth2 tokens and API keys.
|
|
11
|
+
*/
|
|
12
|
+
export class IdentityClient {
|
|
13
|
+
dataPlaneClient;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new IdentityClient instance
|
|
16
|
+
* @param region - AWS region (defaults to AWS_REGION env var)
|
|
17
|
+
* @throws Error if region cannot be determined
|
|
18
|
+
*/
|
|
19
|
+
constructor(region) {
|
|
20
|
+
const resolvedRegion = region || process.env.AWS_REGION;
|
|
21
|
+
if (!resolvedRegion) {
|
|
22
|
+
throw new Error('AWS region must be specified either as a parameter or via AWS_REGION environment variable');
|
|
23
|
+
}
|
|
24
|
+
this.dataPlaneClient = new BedrockAgentCoreClient({ region: resolvedRegion });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves an OAuth2 access token from AgentCore Identity.
|
|
28
|
+
* Handles both M2M (immediate) and USER_FEDERATION (polling) flows.
|
|
29
|
+
*
|
|
30
|
+
* @param request - OAuth2 token request parameters
|
|
31
|
+
* @returns OAuth2 access token
|
|
32
|
+
* @throws Error if token retrieval fails or times out
|
|
33
|
+
*/
|
|
34
|
+
async getOAuth2Token(request) {
|
|
35
|
+
const command = new GetResourceOauth2TokenCommand({
|
|
36
|
+
resourceCredentialProviderName: request.providerName,
|
|
37
|
+
scopes: request.scopes,
|
|
38
|
+
oauth2Flow: request.authFlow,
|
|
39
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
40
|
+
resourceOauth2ReturnUrl: request.callbackUrl,
|
|
41
|
+
forceAuthentication: request.forceAuthentication,
|
|
42
|
+
sessionUri: request.sessionUri,
|
|
43
|
+
customState: request.customState,
|
|
44
|
+
customParameters: request.customParameters,
|
|
45
|
+
});
|
|
46
|
+
const response = await this.dataPlaneClient.send(command);
|
|
47
|
+
// M2M flow - token returned immediately
|
|
48
|
+
if (response.accessToken) {
|
|
49
|
+
return response.accessToken;
|
|
50
|
+
}
|
|
51
|
+
// USER_FEDERATION flow - authorization URL returned
|
|
52
|
+
if (response.authorizationUrl) {
|
|
53
|
+
// Invoke callback if provided
|
|
54
|
+
if (request.onAuthUrl) {
|
|
55
|
+
await request.onAuthUrl(response.authorizationUrl);
|
|
56
|
+
}
|
|
57
|
+
// Poll for token
|
|
58
|
+
return this.pollForToken({
|
|
59
|
+
...request,
|
|
60
|
+
sessionUri: response.sessionUri,
|
|
61
|
+
forceAuthentication: false,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Identity service did not return a token or authorization URL');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Polls for OAuth2 token until available or timeout
|
|
68
|
+
*/
|
|
69
|
+
async pollForToken(request) {
|
|
70
|
+
const startTime = Date.now();
|
|
71
|
+
while (Date.now() - startTime < POLLING_TIMEOUT_MS) {
|
|
72
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, POLLING_INTERVAL_MS));
|
|
73
|
+
const command = new GetResourceOauth2TokenCommand({
|
|
74
|
+
resourceCredentialProviderName: request.providerName,
|
|
75
|
+
scopes: request.scopes,
|
|
76
|
+
oauth2Flow: request.authFlow,
|
|
77
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
78
|
+
sessionUri: request.sessionUri,
|
|
79
|
+
resourceOauth2ReturnUrl: request.callbackUrl,
|
|
80
|
+
customState: request.customState,
|
|
81
|
+
customParameters: request.customParameters,
|
|
82
|
+
});
|
|
83
|
+
const response = await this.dataPlaneClient.send(command);
|
|
84
|
+
if (response.accessToken) {
|
|
85
|
+
return response.accessToken;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
throw new Error(`Polling timed out after ${POLLING_TIMEOUT_MS / 1000} seconds. User may not have completed authorization.`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves an API key from AgentCore Identity token vault.
|
|
92
|
+
*
|
|
93
|
+
* @param request - API key request parameters
|
|
94
|
+
* @returns API key string
|
|
95
|
+
* @throws Error if API key retrieval fails
|
|
96
|
+
*/
|
|
97
|
+
async getApiKey(request) {
|
|
98
|
+
const command = new GetResourceApiKeyCommand({
|
|
99
|
+
resourceCredentialProviderName: request.providerName,
|
|
100
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
101
|
+
});
|
|
102
|
+
const response = await this.dataPlaneClient.send(command);
|
|
103
|
+
if (!response.apiKey) {
|
|
104
|
+
throw new Error(`No API key returned for provider: ${request.providerName}`);
|
|
105
|
+
}
|
|
106
|
+
return response.apiKey;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/identity/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentCore Identity SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides identity and credential management for AI agents.
|
|
5
|
+
* Supports inbound authentication (SigV4, JWT) and outbound authentication (OAuth2, API keys).
|
|
6
|
+
*
|
|
7
|
+
* @example HOF wrapper usage
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { withAccessToken } from '@aws/bedrock-agentcore-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const myTool = withAccessToken({
|
|
12
|
+
* providerName: 'github',
|
|
13
|
+
* scopes: ['repo'],
|
|
14
|
+
* authFlow: 'M2M',
|
|
15
|
+
* })(async (input: string, token: string) => {
|
|
16
|
+
* // Token automatically injected
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { withAccessToken, withApiKey } from './wrappers.js';
|
|
21
|
+
export * from './types.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG3D,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentCore Identity SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides identity and credential management for AI agents.
|
|
5
|
+
* Supports inbound authentication (SigV4, JWT) and outbound authentication (OAuth2, API keys).
|
|
6
|
+
*
|
|
7
|
+
* @example HOF wrapper usage
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { withAccessToken } from '@aws/bedrock-agentcore-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const myTool = withAccessToken({
|
|
12
|
+
* providerName: 'github',
|
|
13
|
+
* scopes: ['repo'],
|
|
14
|
+
* authFlow: 'M2M',
|
|
15
|
+
* })(async (input: string, token: string) => {
|
|
16
|
+
* // Token automatically injected
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
// Higher-order functions for wrapping tools
|
|
21
|
+
export { withAccessToken, withApiKey } from './wrappers.js';
|
|
22
|
+
// All type definitions
|
|
23
|
+
export * from './types.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4CAA4C;AAC5C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE3D,uBAAuB;AACvB,cAAc,YAAY,CAAA"}
|