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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/browser/integrations/vercel-ai/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8B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O,CAAC,IAAI,CAAC;IAIlC;;;;;;OAMG;IACH,SAAS,IAAI,iBAAiB;CAG/B"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified BrowserTools for Vercel AI SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides browser automation tools and session management in one class.
|
|
5
|
+
* Thin wrapper around PlaywrightBrowser - all logic lives in the Playwright integration.
|
|
6
|
+
*/
|
|
7
|
+
import { PlaywrightBrowser } from '../playwright/client.js';
|
|
8
|
+
import { createNavigateTool } from './navigate-tool.js';
|
|
9
|
+
import { createClickTool } from './click-tool.js';
|
|
10
|
+
import { createTypeTool } from './type-tool.js';
|
|
11
|
+
import { createGetTextTool } from './get-text-tool.js';
|
|
12
|
+
import { createGetHtmlTool } from './get-html-tool.js';
|
|
13
|
+
import { createScreenshotTool } from './screenshot-tool.js';
|
|
14
|
+
import { createEvaluateTool } from './evaluate-tool.js';
|
|
15
|
+
/**
|
|
16
|
+
* BrowserTools - All-in-one browser automation for Vercel AI SDK
|
|
17
|
+
*
|
|
18
|
+
* Provides browser automation tools and session management.
|
|
19
|
+
* All browser logic is in PlaywrightBrowser - this is just a thin wrapper.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { BrowserTools } from 'bedrock-agentcore/browser/vercel-ai'
|
|
24
|
+
* import { ToolLoopAgent } from 'ai'
|
|
25
|
+
* import { bedrock } from '@ai-sdk/amazon-bedrock'
|
|
26
|
+
*
|
|
27
|
+
* // Create tools instance
|
|
28
|
+
* const browser = new BrowserTools({ region: 'us-west-2' })
|
|
29
|
+
*
|
|
30
|
+
* // Start session (optional - automatically started on first use)
|
|
31
|
+
* await browser.startSession()
|
|
32
|
+
*
|
|
33
|
+
* // Create agent with browser tools
|
|
34
|
+
* const agent = new ToolLoopAgent({
|
|
35
|
+
* model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
|
|
36
|
+
* tools: browser.tools,
|
|
37
|
+
* })
|
|
38
|
+
*
|
|
39
|
+
* // Or use client directly
|
|
40
|
+
* await browser.getClient().navigate({ url: 'https://example.com' })
|
|
41
|
+
*
|
|
42
|
+
* // Clean up when done
|
|
43
|
+
* await browser.stopSession()
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class BrowserTools {
|
|
47
|
+
client;
|
|
48
|
+
/**
|
|
49
|
+
* Tool for navigating to URLs
|
|
50
|
+
*/
|
|
51
|
+
navigate;
|
|
52
|
+
/**
|
|
53
|
+
* Tool for clicking elements
|
|
54
|
+
*/
|
|
55
|
+
click;
|
|
56
|
+
/**
|
|
57
|
+
* Tool for typing text
|
|
58
|
+
*/
|
|
59
|
+
type;
|
|
60
|
+
/**
|
|
61
|
+
* Tool for getting text content
|
|
62
|
+
*/
|
|
63
|
+
getText;
|
|
64
|
+
/**
|
|
65
|
+
* Tool for getting HTML
|
|
66
|
+
*/
|
|
67
|
+
getHtml;
|
|
68
|
+
/**
|
|
69
|
+
* Tool for taking screenshots
|
|
70
|
+
*/
|
|
71
|
+
screenshot;
|
|
72
|
+
/**
|
|
73
|
+
* Tool for evaluating JavaScript
|
|
74
|
+
*/
|
|
75
|
+
evaluate;
|
|
76
|
+
/**
|
|
77
|
+
* All tools in an object for easy spreading into agent config
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const agent = new ToolLoopAgent({
|
|
82
|
+
* tools: browser.tools, // spreads all browser tools
|
|
83
|
+
* })
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
tools;
|
|
87
|
+
constructor(config = {}) {
|
|
88
|
+
this.client = new PlaywrightBrowser(config);
|
|
89
|
+
// Create all tools - each is a thin wrapper around client methods
|
|
90
|
+
this.navigate = createNavigateTool(this.client);
|
|
91
|
+
this.click = createClickTool(this.client);
|
|
92
|
+
this.type = createTypeTool(this.client);
|
|
93
|
+
this.getText = createGetTextTool(this.client);
|
|
94
|
+
this.getHtml = createGetHtmlTool(this.client);
|
|
95
|
+
this.screenshot = createScreenshotTool(this.client);
|
|
96
|
+
this.evaluate = createEvaluateTool(this.client);
|
|
97
|
+
// Create tools object for easy spreading
|
|
98
|
+
this.tools = {
|
|
99
|
+
navigate: this.navigate,
|
|
100
|
+
click: this.click,
|
|
101
|
+
type: this.type,
|
|
102
|
+
getText: this.getText,
|
|
103
|
+
getHtml: this.getHtml,
|
|
104
|
+
screenshot: this.screenshot,
|
|
105
|
+
evaluate: this.evaluate,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Start a browser session
|
|
110
|
+
*
|
|
111
|
+
* Sessions are automatically started on first tool use, but you can
|
|
112
|
+
* call this explicitly to start the session upfront.
|
|
113
|
+
*
|
|
114
|
+
* @param sessionName - Optional session name for AWS
|
|
115
|
+
* @param timeout - Optional session timeout in seconds (default: 3600, max: 28800)
|
|
116
|
+
* @returns Session information
|
|
117
|
+
*/
|
|
118
|
+
async startSession(sessionName, timeout) {
|
|
119
|
+
const params = {};
|
|
120
|
+
if (sessionName !== undefined)
|
|
121
|
+
params.sessionName = sessionName;
|
|
122
|
+
if (timeout !== undefined)
|
|
123
|
+
params.timeout = timeout;
|
|
124
|
+
return this.client.startSession(Object.keys(params).length > 0 ? params : undefined);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Stop the current browser session
|
|
128
|
+
*
|
|
129
|
+
* Call this when you're done using the tools to clean up resources.
|
|
130
|
+
*/
|
|
131
|
+
async stopSession() {
|
|
132
|
+
await this.client.stopSession();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get the underlying PlaywrightBrowser
|
|
136
|
+
*
|
|
137
|
+
* Provides direct access to the client for advanced use cases.
|
|
138
|
+
*
|
|
139
|
+
* @returns The PlaywrightBrowser instance
|
|
140
|
+
*/
|
|
141
|
+
getClient() {
|
|
142
|
+
return this.client;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../../src/tools/browser/integrations/vercel-ai/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAAmB;IAEjC;;OAEG;IACa,QAAQ,CAAuC;IAE/D;;OAEG;IACa,KAAK,CAAoC;IAEzD;;OAEG;IACa,IAAI,CAAmC;IAEvD;;OAEG;IACa,OAAO,CAAsC;IAE7D;;OAEG;IACa,OAAO,CAAsC;IAE7D;;OAEG;IACa,UAAU,CAAyC;IAEnE;;OAEG;IACa,QAAQ,CAAuC;IAE/D;;;;;;;;;OASG;IACa,KAAK,CAQpB;IAED,YAAY,SAA8B,EAAE;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;QAE3C,kEAAkE;QAClE,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC/C,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,c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P,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PlaywrightBrowser } from '../playwright/client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Vercel AI tool for typing text.
|
|
4
|
+
* Thin wrapper around PlaywrightBrowser.type()
|
|
5
|
+
*/
|
|
6
|
+
export declare function createTypeTool(client: PlaywrightBrowser): import("ai").Tool<{
|
|
7
|
+
selector: string;
|
|
8
|
+
text: string;
|
|
9
|
+
delay?: number | undefined;
|
|
10
|
+
timeout?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
success: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
error?: never;
|
|
15
|
+
} | {
|
|
16
|
+
success: boolean;
|
|
17
|
+
error: string;
|
|
18
|
+
message?: never;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=type-tool.d.ts.map
|
|
@@ -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;;GAE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C,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,YAAY,EAAE,SAAS,GAAG,UAAU,CAAA;CACrC;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"}
|