bedrock-agentcore 0.0.1 → 0.1.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.
Files changed (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +151 -9
  3. package/dist/src/tools/browser/client.d.ts +125 -0
  4. package/dist/src/tools/browser/client.d.ts.map +1 -0
  5. package/dist/src/tools/browser/client.js +320 -0
  6. package/dist/src/tools/browser/client.js.map +1 -0
  7. package/dist/src/tools/browser/index.d.ts +4 -0
  8. package/dist/src/tools/browser/index.d.ts.map +1 -0
  9. package/dist/src/tools/browser/index.js +3 -0
  10. package/dist/src/tools/browser/index.js.map +1 -0
  11. package/dist/src/tools/browser/integrations/playwright/client.d.ts +147 -0
  12. package/dist/src/tools/browser/integrations/playwright/client.d.ts.map +1 -0
  13. package/dist/src/tools/browser/integrations/playwright/client.js +324 -0
  14. package/dist/src/tools/browser/integrations/playwright/client.js.map +1 -0
  15. package/dist/src/tools/browser/integrations/playwright/index.d.ts +20 -0
  16. package/dist/src/tools/browser/integrations/playwright/index.d.ts.map +1 -0
  17. package/dist/src/tools/browser/integrations/playwright/index.js +19 -0
  18. package/dist/src/tools/browser/integrations/playwright/index.js.map +1 -0
  19. package/dist/src/tools/browser/integrations/playwright/types.d.ts +169 -0
  20. package/dist/src/tools/browser/integrations/playwright/types.d.ts.map +1 -0
  21. package/dist/src/tools/browser/integrations/playwright/types.js +2 -0
  22. package/dist/src/tools/browser/integrations/playwright/types.js.map +1 -0
  23. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts +18 -0
  24. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts.map +1 -0
  25. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js +31 -0
  26. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js.map +1 -0
  27. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts +18 -0
  28. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts.map +1 -0
  29. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js +32 -0
  30. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js.map +1 -0
  31. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts +17 -0
  32. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts.map +1 -0
  33. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js +30 -0
  34. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js.map +1 -0
  35. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts +17 -0
  36. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts.map +1 -0
  37. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js +30 -0
  38. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js.map +1 -0
  39. package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts +19 -0
  40. package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts.map +1 -0
  41. package/dist/src/tools/browser/integrations/vercel-ai/index.js +19 -0
  42. package/dist/src/tools/browser/integrations/vercel-ai/index.js.map +1 -0
  43. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts +19 -0
  44. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts.map +1 -0
  45. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js +39 -0
  46. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js.map +1 -0
  47. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts +22 -0
  48. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts.map +1 -0
  49. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js +44 -0
  50. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js.map +1 -0
  51. package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts +123 -0
  52. package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts.map +1 -0
  53. package/dist/src/tools/browser/integrations/vercel-ai/tools.js +145 -0
  54. package/dist/src/tools/browser/integrations/vercel-ai/tools.js.map +1 -0
  55. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts +20 -0
  56. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts.map +1 -0
  57. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js +35 -0
  58. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js.map +1 -0
  59. package/dist/src/tools/browser/types.d.ts +336 -0
  60. package/dist/src/tools/browser/types.d.ts.map +1 -0
  61. package/dist/src/tools/browser/types.js +17 -0
  62. package/dist/src/tools/browser/types.js.map +1 -0
  63. package/dist/src/tools/code-interpreter/client.d.ts +212 -0
  64. package/dist/src/tools/code-interpreter/client.d.ts.map +1 -0
  65. package/dist/src/tools/code-interpreter/client.js +512 -0
  66. package/dist/src/tools/code-interpreter/client.js.map +1 -0
  67. package/dist/src/tools/code-interpreter/index.d.ts +4 -0
  68. package/dist/src/tools/code-interpreter/index.d.ts.map +1 -0
  69. package/dist/src/tools/code-interpreter/index.js +5 -0
  70. package/dist/src/tools/code-interpreter/index.js.map +1 -0
  71. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts +27 -0
  72. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts.map +1 -0
  73. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js +46 -0
  74. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js.map +1 -0
  75. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts +26 -0
  76. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts.map +1 -0
  77. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js +41 -0
  78. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js.map +1 -0
  79. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts +32 -0
  80. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts.map +1 -0
  81. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js +77 -0
  82. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js.map +1 -0
  83. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts +26 -0
  84. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts.map +1 -0
  85. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js +26 -0
  86. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js.map +1 -0
  87. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts +94 -0
  88. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts.map +1 -0
  89. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js +112 -0
  90. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js.map +1 -0
  91. package/dist/src/tools/code-interpreter/types.d.ts +473 -0
  92. package/dist/src/tools/code-interpreter/types.d.ts.map +1 -0
  93. package/dist/src/tools/code-interpreter/types.js +52 -0
  94. package/dist/src/tools/code-interpreter/types.js.map +1 -0
  95. package/package.json +99 -12
  96. package/index.js +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-tool.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/browser/integrations/vercel-ai/type-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE;;;GAGG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB;;;;;;;;;;;;;GAuBvD"}
@@ -0,0 +1,35 @@
1
+ import { tool } from 'ai';
2
+ import { z } from 'zod';
3
+ /**
4
+ * Creates a Vercel AI tool for typing text.
5
+ * Thin wrapper around PlaywrightBrowser.type()
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types
8
+ export function createTypeTool(client) {
9
+ return tool({
10
+ description: 'Type text into an input element',
11
+ inputSchema: z.object({
12
+ selector: z.string().describe('CSS selector for the input element'),
13
+ text: z.string().describe('Text to type'),
14
+ delay: z.number().positive().optional().describe('Time to wait between key presses in milliseconds'),
15
+ timeout: z.number().positive().optional().describe('Maximum time in milliseconds'),
16
+ }),
17
+ execute: async ({ selector, text, delay, timeout }) => {
18
+ 'use step';
19
+ try {
20
+ const params = { selector, text };
21
+ if (delay !== undefined)
22
+ params.delay = delay;
23
+ if (timeout !== undefined)
24
+ params.timeout = timeout;
25
+ await client.type(params);
26
+ return { success: true, message: `Typed text into ${selector}` };
27
+ }
28
+ catch (error) {
29
+ const message = error instanceof Error ? error.message : 'Unknown error';
30
+ return { success: false, error: message };
31
+ }
32
+ },
33
+ });
34
+ }
35
+ //# sourceMappingURL=type-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-tool.js","sourceRoot":"","sources":["../../../../../../src/tools/browser/integrations/vercel-ai/type-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;GAGG;AACH,+HAA+H;AAC/H,MAAM,UAAU,cAAc,CAAC,MAAyB;IACtD,OAAO,IAAI,CAAC;QACV,WAAW,EAAE,iCAAiC;QAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;YACnE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;YACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;YACpG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;SACnF,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;YACpD,UAAU,CAAA;YACV,IAAI,CAAC;gBACH,MAAM,MAAM,GAAyE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBACvG,IAAI,KAAK,KAAK,SAAS;oBAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;gBAC7C,IAAI,OAAO,KAAK,SAAS;oBAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;gBACnD,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBACzB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,QAAQ,EAAE,EAAE,CAAA;YAClE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAA;gBACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;YAC3C,CAAC;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,336 @@
1
+ import type { AwsCredentialIdentityProvider } from '@aws-sdk/types';
2
+ /**
3
+ * Default browser identifier for system browser.
4
+ */
5
+ export declare const DEFAULT_IDENTIFIER = "aws.browser.v1";
6
+ /**
7
+ * Default session name.
8
+ */
9
+ export declare const DEFAULT_SESSION_NAME = "default";
10
+ /**
11
+ * Default session timeout in seconds (1 hour).
12
+ */
13
+ export declare const DEFAULT_TIMEOUT = 3600;
14
+ /**
15
+ * Default AWS region.
16
+ */
17
+ export declare const DEFAULT_REGION = "us-west-2";
18
+ /**
19
+ * Configuration options for BrowserClient.
20
+ */
21
+ export interface BrowserClientConfig {
22
+ /**
23
+ * AWS region where the browser service is deployed.
24
+ * Defaults to process.env.AWS_REGION or 'us-west-2'.
25
+ */
26
+ region?: string;
27
+ /**
28
+ * Browser identifier to use for sessions.
29
+ * Defaults to 'aws.browser.v1' for system browser.
30
+ */
31
+ identifier?: string;
32
+ /**
33
+ * Optional AWS credentials provider.
34
+ * When omitted, the SDK uses the default Node.js credential provider chain.
35
+ *
36
+ * @example
37
+ * Using Vercel OIDC credentials:
38
+ * ```ts
39
+ * import { vercelOidcAwsCredentials } from '\@vercel/oidc-aws-credentials-provider'
40
+ *
41
+ * const browser = new BrowserClient(\{
42
+ * region: process.env.AWS_REGION || 'us-west-2',
43
+ * credentialsProvider: vercelOidcAwsCredentials()
44
+ * \})
45
+ * ```
46
+ */
47
+ credentialsProvider?: AwsCredentialIdentityProvider;
48
+ }
49
+ /**
50
+ * Parameters for starting a browser session.
51
+ */
52
+ export interface StartSessionParams {
53
+ /**
54
+ * Optional name for the browser session.
55
+ * If not provided, defaults to 'default'.
56
+ */
57
+ sessionName?: string;
58
+ /**
59
+ * Session timeout in seconds.
60
+ * Valid range: 1-28800 seconds (1 second to 8 hours).
61
+ * Defaults to 3600 seconds (1 hour).
62
+ */
63
+ timeout?: number;
64
+ /**
65
+ * Viewport dimensions for the browser.
66
+ */
67
+ viewport?: ViewportConfig;
68
+ }
69
+ /**
70
+ * Viewport configuration for browser sessions.
71
+ */
72
+ export interface ViewportConfig {
73
+ /**
74
+ * Viewport width in pixels.
75
+ */
76
+ width: number;
77
+ /**
78
+ * Viewport height in pixels.
79
+ */
80
+ height: number;
81
+ }
82
+ /**
83
+ * Information about an active browser session.
84
+ */
85
+ export interface SessionInfo {
86
+ /**
87
+ * Name of the session.
88
+ */
89
+ sessionName: string;
90
+ /**
91
+ * Unique session identifier assigned by AWS.
92
+ */
93
+ sessionId: string;
94
+ /**
95
+ * Timestamp when the session was created.
96
+ */
97
+ createdAt: Date;
98
+ /**
99
+ * Optional description of the session.
100
+ */
101
+ description?: string;
102
+ }
103
+ /**
104
+ * Parameters for getting browser session details.
105
+ */
106
+ export interface GetSessionParams {
107
+ /**
108
+ * Browser identifier.
109
+ * Uses current instance identifier if not provided.
110
+ */
111
+ browserId?: string;
112
+ /**
113
+ * Session ID to query.
114
+ * Uses current active session ID if not provided.
115
+ */
116
+ sessionId?: string;
117
+ }
118
+ /**
119
+ * Stream endpoint information for browser sessions.
120
+ */
121
+ export interface StreamInfo {
122
+ /**
123
+ * WebSocket endpoint URL for the stream.
124
+ */
125
+ streamEndpoint?: string;
126
+ /**
127
+ * Status of the stream.
128
+ */
129
+ streamStatus?: string;
130
+ }
131
+ /**
132
+ * Live view stream information for browser sessions.
133
+ */
134
+ export interface LiveViewStreamInfo {
135
+ /**
136
+ * WebSocket endpoint URL for the live view stream.
137
+ */
138
+ streamEndpoint?: string;
139
+ }
140
+ /**
141
+ * Browser session streams for automation and live viewing.
142
+ */
143
+ export interface BrowserSessionStreams {
144
+ /**
145
+ * Automation stream for browser control.
146
+ */
147
+ automationStream?: StreamInfo;
148
+ /**
149
+ * Live view stream for viewing browser state.
150
+ */
151
+ liveViewStream?: LiveViewStreamInfo;
152
+ }
153
+ /**
154
+ * Detailed session information returned by getSession.
155
+ */
156
+ export interface GetSessionResponse {
157
+ /**
158
+ * AWS-assigned session identifier.
159
+ */
160
+ sessionId: string;
161
+ /**
162
+ * Browser identifier.
163
+ */
164
+ browserIdentifier: string;
165
+ /**
166
+ * Session name.
167
+ */
168
+ name: string;
169
+ /**
170
+ * Session status.
171
+ * Common values: 'READY', 'TERMINATED'
172
+ */
173
+ status: string;
174
+ /**
175
+ * Timestamp when session was created.
176
+ */
177
+ createdAt: Date;
178
+ /**
179
+ * Timestamp when session was last updated.
180
+ */
181
+ lastUpdatedAt: Date;
182
+ /**
183
+ * Session timeout in seconds.
184
+ */
185
+ sessionTimeoutSeconds: number;
186
+ /**
187
+ * Stream endpoints for browser automation and live viewing.
188
+ */
189
+ streams?: BrowserSessionStreams;
190
+ }
191
+ /**
192
+ * Parameters for listing browser sessions.
193
+ */
194
+ export interface ListSessionsParams {
195
+ /**
196
+ * Browser identifier.
197
+ * Uses current instance identifier if not provided.
198
+ */
199
+ browserId?: string;
200
+ /**
201
+ * Filter by session status.
202
+ * Common values: 'READY', 'TERMINATED'
203
+ */
204
+ status?: string;
205
+ /**
206
+ * Maximum number of results to return (1-100).
207
+ * Defaults to 10
208
+ */
209
+ maxResults?: number;
210
+ /**
211
+ * Pagination token for fetching next page of results.
212
+ */
213
+ nextToken?: string;
214
+ }
215
+ /**
216
+ * Summary information for a browser session in list results.
217
+ */
218
+ export interface SessionSummary {
219
+ /**
220
+ * AWS-assigned session identifier.
221
+ */
222
+ sessionId: string;
223
+ /**
224
+ * Session name.
225
+ */
226
+ name: string;
227
+ /**
228
+ * Session status.
229
+ * Common values: 'READY', 'TERMINATED'
230
+ */
231
+ status: string;
232
+ /**
233
+ * Timestamp when session was created.
234
+ */
235
+ createdAt: Date;
236
+ /**
237
+ * Timestamp when session was last updated.
238
+ */
239
+ lastUpdatedAt: Date;
240
+ }
241
+ /**
242
+ * Response from listing browser sessions.
243
+ */
244
+ export interface ListSessionsResponse {
245
+ /**
246
+ * List of session summaries.
247
+ */
248
+ items: SessionSummary[];
249
+ /**
250
+ * Token for fetching next page of results.
251
+ * Present if there are more results available.
252
+ */
253
+ nextToken?: string;
254
+ }
255
+ /**
256
+ * Parameters for updating the browser automation stream.
257
+ */
258
+ export interface UpdateStreamParams {
259
+ /**
260
+ * Browser identifier.
261
+ * Uses current instance identifier if not provided.
262
+ */
263
+ browserId?: string;
264
+ /**
265
+ * Session ID.
266
+ * Uses current active session ID if not provided.
267
+ */
268
+ sessionId?: string;
269
+ /**
270
+ * New stream status for the automation stream.
271
+ * 'ENABLED' to enable the stream, 'DISABLED' to disable it.
272
+ */
273
+ streamStatus: 'ENABLED' | 'DISABLED';
274
+ }
275
+ /**
276
+ * Response from updating a browser stream.
277
+ */
278
+ export interface UpdateStreamResponse {
279
+ /**
280
+ * Stream endpoint URL.
281
+ */
282
+ streamEndpoint?: string;
283
+ /**
284
+ * Updated stream status.
285
+ */
286
+ streamStatus?: string;
287
+ }
288
+ /**
289
+ * WebSocket connection details for browser automation.
290
+ */
291
+ export interface WebSocketConnection {
292
+ /**
293
+ * WebSocket URL (wss://) for connecting to the browser.
294
+ */
295
+ url: string;
296
+ /**
297
+ * HTTP headers required for WebSocket authentication.
298
+ * Includes Authorization, X-Amz-Date, and security token headers.
299
+ */
300
+ headers: Record<string, string>;
301
+ }
302
+ /**
303
+ * Session status information.
304
+ */
305
+ export interface SessionStatus {
306
+ /**
307
+ * Current status of the session.
308
+ */
309
+ status: 'READY' | 'TERMINATED' | 'TERMINATING';
310
+ /**
311
+ * Timestamp when the session was created.
312
+ */
313
+ createdAt?: Date;
314
+ /**
315
+ * Timestamp when the session was last updated.
316
+ */
317
+ updatedAt?: Date;
318
+ }
319
+ /**
320
+ * Result of a browser operation.
321
+ */
322
+ export interface BrowserOperationResult {
323
+ /**
324
+ * Whether the operation succeeded.
325
+ */
326
+ success: boolean;
327
+ /**
328
+ * Error message if the operation failed.
329
+ */
330
+ error?: string;
331
+ /**
332
+ * Additional data returned from the operation.
333
+ */
334
+ data?: unknown;
335
+ }
336
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/tools/browser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,eAAe,OAAO,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,cAAc,cAAc,CAAA;AAEzC;;GAEG;AACH,MAAM,WAAW,mBAAmB;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ACrC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,OAAO,GAAG,YAAY,GAAG,aAAa,CAAA;IAE9C;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,CAAA;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Default browser identifier for system browser.
3
+ */
4
+ export const DEFAULT_IDENTIFIER = 'aws.browser.v1';
5
+ /**
6
+ * Default session name.
7
+ */
8
+ export const DEFAULT_SESSION_NAME = 'default';
9
+ /**
10
+ * Default session timeout in seconds (1 hour).
11
+ */
12
+ export const DEFAULT_TIMEOUT = 3600;
13
+ /**
14
+ * Default AWS region.
15
+ */
16
+ export const DEFAULT_REGION = 'us-west-2';
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/tools/browser/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAA"}
@@ -0,0 +1,212 @@
1
+ import type { CodeInterpreterConfig, StartSessionParams, SessionInfo, ExecuteCodeParams, ExecuteCommandParams, ReadFilesParams, WriteFilesParams, ListFilesParams, RemoveFilesParams, GetSessionParams, GetSessionResponse, ListSessionsParams, ListSessionsResponse } from './types.js';
2
+ /**
3
+ * Client for AWS Bedrock Code Interpreter.
4
+ *
5
+ * Provides functionality to execute Python, JavaScript, and TypeScript code
6
+ * in isolated sandbox environments with file system access and shell commands.
7
+ *
8
+ * Each CodeInterpreter instance manages a single session. Sessions are automatically
9
+ * created on first use and can be explicitly managed with startSession/stopSession.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const interpreter = new CodeInterpreter({ region: 'us-east-1' })
14
+ *
15
+ * // Execute code (auto-creates session)
16
+ * await interpreter.executeCode({ code: 'print("Hello")' })
17
+ *
18
+ * // Explicitly manage session lifecycle
19
+ * await interpreter.startSession({ sessionName: 'my-session' })
20
+ * await interpreter.executeCode({ code: 'x = 1' })
21
+ * await interpreter.stopSession()
22
+ * ```
23
+ */
24
+ export declare class CodeInterpreter {
25
+ readonly region: string;
26
+ readonly identifier: string;
27
+ private _client;
28
+ private _session;
29
+ private _credentialsProvider;
30
+ /**
31
+ * Creates a new CodeInterpreter instance.
32
+ *
33
+ * @param config - Configuration options
34
+ */
35
+ constructor(config: CodeInterpreterConfig);
36
+ /**
37
+ * Start a new code interpreter session.
38
+ *
39
+ * @param params - Session configuration
40
+ * @returns Session information including AWS-assigned session ID
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const session = await interpreter.startSession({
45
+ * sessionName: 'data-analysis',
46
+ * description: 'Processing customer data',
47
+ * timeout: 1800
48
+ * })
49
+ * ```
50
+ */
51
+ startSession(params?: StartSessionParams): Promise<SessionInfo>;
52
+ /**
53
+ * Stop the active code interpreter session.
54
+ * Gracefully handles non-existent sessions without throwing errors.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * await interpreter.stopSession()
59
+ * ```
60
+ */
61
+ stopSession(): Promise<void>;
62
+ /**
63
+ * Get detailed information about a code interpreter session.
64
+ *
65
+ * @param params - Optional parameters specifying which session to query
66
+ * @returns Detailed session information
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * // Get current active session details
71
+ * const sessionInfo = await interpreter.getSession()
72
+ * console.log(`Session status: ${sessionInfo.status}`)
73
+ *
74
+ * // Get details for a specific session
75
+ * const sessionInfo = await interpreter.getSession({
76
+ * sessionId: 'specific-session-id'
77
+ * })
78
+ * ```
79
+ */
80
+ getSession(params?: GetSessionParams): Promise<GetSessionResponse>;
81
+ /**
82
+ * List code interpreter sessions for this interpreter.
83
+ *
84
+ * @param params - Optional filtering and pagination parameters
85
+ * @returns List of session summaries with optional pagination token
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // List all active sessions
90
+ * const response = await interpreter.listSessions({ status: 'READY' })
91
+ * for (const session of response.items) {
92
+ * console.log(`Session ${session.sessionId}: ${session.status}`)
93
+ * }
94
+ *
95
+ * // Paginate through results
96
+ * let response = await interpreter.listSessions({ maxResults: 10 })
97
+ * while (response.nextToken) {
98
+ * response = await interpreter.listSessions({
99
+ * maxResults: 10,
100
+ * nextToken: response.nextToken
101
+ * })
102
+ * }
103
+ * ```
104
+ */
105
+ listSessions(params?: ListSessionsParams): Promise<ListSessionsResponse>;
106
+ /**
107
+ * Execute code in a code interpreter session.
108
+ * Automatically creates a session if one doesn't exist.
109
+ *
110
+ * @param params - Execution parameters
111
+ * @returns Execution result with output or error
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * // Auto-creates default session
116
+ * const result = await interpreter.executeCode({
117
+ * code: 'print("Hello")',
118
+ * language: 'python'
119
+ * })
120
+ * ```
121
+ */
122
+ executeCode(params: ExecuteCodeParams): Promise<string>;
123
+ /**
124
+ * Execute a shell command in a code interpreter session.
125
+ * Automatically creates a session if one doesn't exist.
126
+ *
127
+ * @param params - Command parameters
128
+ * @returns Command result with output or error
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const result = await interpreter.executeCommand({
133
+ * command: 'ls -la'
134
+ * })
135
+ * ```
136
+ */
137
+ executeCommand(params: ExecuteCommandParams): Promise<string>;
138
+ /**
139
+ * Read files from the code interpreter sandbox.
140
+ * Automatically creates a session if one doesn't exist.
141
+ *
142
+ * @param params - Read parameters
143
+ * @returns Read result with file contents or errors
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const result = await interpreter.readFiles({
148
+ * paths: ['data.txt', 'output.json']
149
+ * })
150
+ * ```
151
+ */
152
+ readFiles(params: ReadFilesParams): Promise<string>;
153
+ /**
154
+ * Write files to the code interpreter sandbox.
155
+ * Automatically creates a session if one doesn't exist.
156
+ *
157
+ * @param params - Write parameters
158
+ * @returns Write result with written file paths or errors
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * await interpreter.writeFiles({
163
+ * files: [
164
+ * { path: 'script.py', content: 'print("Hello")' },
165
+ * { path: 'data.json', content: '{"key": "value"}' }
166
+ * ]
167
+ * })
168
+ * ```
169
+ */
170
+ writeFiles(params: WriteFilesParams): Promise<string>;
171
+ /**
172
+ * List files in the code interpreter sandbox.
173
+ * Automatically creates a session if one doesn't exist.
174
+ *
175
+ * @param params - List parameters
176
+ * @returns List result with file information or error
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const result = await interpreter.listFiles({ path: '/tmp' })
181
+ * ```
182
+ */
183
+ listFiles(params?: ListFilesParams): Promise<string>;
184
+ /**
185
+ * Remove files from the code interpreter sandbox.
186
+ * Automatically creates a session if one doesn't exist.
187
+ *
188
+ * @param params - Remove parameters
189
+ * @returns Remove result with removed file paths or errors
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * await interpreter.removeFiles({
194
+ * paths: ['temp.txt', 'cache.json']
195
+ * })
196
+ * ```
197
+ */
198
+ removeFiles(params: RemoveFilesParams): Promise<string>;
199
+ /**
200
+ * Extract and parse the streaming response from InvokeCodeInterpreterCommand.
201
+ * Returns the raw content string from AWS without additional formatting.
202
+ */
203
+ private _parseInvokeResponse;
204
+ /**
205
+ * Extract text from AWS content array, handling multiple content types:
206
+ * - type: "text" - Direct text output (code execution, commands)
207
+ * - type: "resource" - File content with nested resource object
208
+ * - type: "resource_link" - File metadata (listFiles)
209
+ */
210
+ private _extractFromContentArray;
211
+ }
212
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/tools/code-interpreter/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,YAAY,CAAA;AAGnB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAE3B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,oBAAoB,CAAuD;IAEnF;;;;OAIG;gBACS,MAAM,EAAE,qBAAqB;IAgBzC;;;;;;;;;;;;;;OAcG;IACG,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IA2BrE;;;;;;;;OAQG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBlC;;;;;;;;;;;;;;;;;OAiBG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgCxE;;;;;;;;;;;;;;;;;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