1import type * as agentcore from "@distilled.cloud/aws/bedrock-agentcore";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { BrowserCustom } from "./BrowserCustom.ts";
5
6export interface SaveBrowserSessionProfileRequest extends Omit<
7 agentcore.SaveBrowserSessionProfileRequest,
8 "browserIdentifier"
9> {}
10
11/**
12 * Persists a browser session's state to a reusable browser profile.
13 *
14 * Bind a {@link BrowserCustom} inside a function runtime to call the
15 * AgentCore data-plane API against it. Provide `AgentCore.SaveBrowserSessionProfileHttp`
16 * on the Function effect to implement the binding.
17 *
18 * ### Browser Profiles
19 * **Example:** Save a Session Profile
20 * ```typescript
21 * // init
22 * const saveBrowserSessionProfile = yield* AgentCore.SaveBrowserSessionProfile(browser);
23 *
24 * return {
25 * fetch: Effect.gen(function* () {
26 * // runtime
27 * yield* saveBrowserSessionProfile({
28 * sessionId,
29 * profileIdentifier,
30 * });
31 * return HttpServerResponse.json({ saved: true });
32 * }),
33 * };
34 * ```
35 *
36 * @binding
37 */
38export interface SaveBrowserSessionProfile extends Binding.Service<
39 SaveBrowserSessionProfile,
40 "AWS.BedrockAgentCore.SaveBrowserSessionProfile",
41 <R extends BrowserCustom>(
42 browser: R,
43 ) => Effect.Effect<
44 (
45 request: SaveBrowserSessionProfileRequest,
46 ) => Effect.Effect<
47 agentcore.SaveBrowserSessionProfileResponse,
48 agentcore.SaveBrowserSessionProfileError
49 >
50 >
51> {}
52export const SaveBrowserSessionProfile =
53 Binding.Service<SaveBrowserSessionProfile>(
54 "AWS.BedrockAgentCore.SaveBrowserSessionProfile",
55 );