| 1 | import type * as agentcore from "@distilled.cloud/aws/bedrock-agentcore"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { BrowserCustom } from "./BrowserCustom.ts"; |
| 5 | |
| 6 | export interface UpdateBrowserStreamRequest extends Omit< |
| 7 | agentcore.UpdateBrowserStreamRequest, |
| 8 | "browserIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Updates a browser session's automation stream. |
| 13 | * |
| 14 | * Bind a {@link BrowserCustom} inside a function runtime to call the |
| 15 | * AgentCore data-plane API against it. Provide `AgentCore.UpdateBrowserStreamHttp` |
| 16 | * on the Function effect to implement the binding. |
| 17 | * |
| 18 | * ### Browser Automation |
| 19 | * **Example:** Release the Automation Stream |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const updateBrowserStream = yield* AgentCore.UpdateBrowserStream(browser); |
| 23 | * |
| 24 | * return { |
| 25 | * fetch: Effect.gen(function* () { |
| 26 | * // runtime |
| 27 | * yield* updateBrowserStream({ |
| 28 | * sessionId, |
| 29 | * streamUpdate: { |
| 30 | * automationStreamUpdate: { streamStatus: "ENABLED" }, |
| 31 | * }, |
| 32 | * }); |
| 33 | * return HttpServerResponse.json({ updated: true }); |
| 34 | * }), |
| 35 | * }; |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface UpdateBrowserStream extends Binding.Service< |
| 41 | UpdateBrowserStream, |
| 42 | "AWS.BedrockAgentCore.UpdateBrowserStream", |
| 43 | <R extends BrowserCustom>( |
| 44 | browser: R, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: UpdateBrowserStreamRequest, |
| 48 | ) => Effect.Effect< |
| 49 | agentcore.UpdateBrowserStreamResponse, |
| 50 | agentcore.UpdateBrowserStreamError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | export const UpdateBrowserStream = Binding.Service<UpdateBrowserStream>( |
| 55 | "AWS.BedrockAgentCore.UpdateBrowserStream", |
| 56 | ); |