@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 51 lines 1.59 KB
Raw
1 import type * as agentcore from "@distilled.cloud/aws/bedrock-agentcore";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { BrowserCustom } from "./BrowserCustom.ts";
5
6 export interface InvokeBrowserRequest extends Omit<
7 agentcore.InvokeBrowserRequest,
8 "browserIdentifier"
9 > {}
10
11 /**
12 * Performs an OS-level browser action (mouse, keyboard, screenshot) in a session.
13 *
14 * OS-level actions cover interactions the Chrome DevTools Protocol cannot reach — print dialogs, context menus, and JavaScript alerts.
15 *
16 * Bind a {@link BrowserCustom} inside a function runtime to call the
17 * AgentCore data-plane API against it. Provide `AgentCore.InvokeBrowserHttp`
18 * on the Function effect to implement the binding.
19 *
20 * ### Browser Automation
21 * **Example:** Take a Screenshot
22 * ```typescript
23 * // init
24 * const invokeBrowser = yield* AgentCore.InvokeBrowser(browser);
25 *
26 * return {
27 * fetch: Effect.gen(function* () {
28 * // runtime
29 * const result = yield* invokeBrowser({
30 * sessionId,
31 * action: { screenshot: {} },
32 * });
33 * return HttpServerResponse.json({ result: result.result });
34 * }),
35 * };
36 * ```
37 *
38 * @binding
39 */
40 export interface InvokeBrowser extends Binding.Service<
41 InvokeBrowser,
42 "AWS.BedrockAgentCore.InvokeBrowser",
43 <R extends BrowserCustom>(
44 browser: R,
45 ) => Effect.Effect<
46 (
47 request: InvokeBrowserRequest,
48 ) => Effect.Effect<agentcore.InvokeBrowserResponse, agentcore.InvokeBrowserError>
49 >
50 > {}
51 export const InvokeBrowser = Binding.Service<InvokeBrowser>("AWS.BedrockAgentCore.InvokeBrowser");