| 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 { CodeInterpreter } from "./CodeInterpreter.ts"; |
| 5 | |
| 6 | export interface GetCodeInterpreterSessionRequest extends Omit< |
| 7 | agentcore.GetCodeInterpreterSessionRequest, |
| 8 | "codeInterpreterIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Reads a code interpreter session's configuration and status. |
| 13 | * |
| 14 | * Bind a {@link CodeInterpreter} inside a function runtime to call the |
| 15 | * AgentCore data-plane API against it. Provide `AgentCore.GetCodeInterpreterSessionHttp` |
| 16 | * on the Function effect to implement the binding. |
| 17 | * |
| 18 | * ### Inspecting Sessions |
| 19 | * **Example:** Read a Session |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const getCodeInterpreterSession = yield* AgentCore.GetCodeInterpreterSession(codeInterpreter); |
| 23 | * |
| 24 | * return { |
| 25 | * fetch: Effect.gen(function* () { |
| 26 | * // runtime |
| 27 | * const result = yield* getCodeInterpreterSession({ sessionId }); |
| 28 | * return HttpServerResponse.json({ status: result.status }); |
| 29 | * }), |
| 30 | * }; |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface GetCodeInterpreterSession extends Binding.Service< |
| 36 | GetCodeInterpreterSession, |
| 37 | "AWS.BedrockAgentCore.GetCodeInterpreterSession", |
| 38 | <R extends CodeInterpreter>( |
| 39 | codeInterpreter: R, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: GetCodeInterpreterSessionRequest, |
| 43 | ) => Effect.Effect< |
| 44 | agentcore.GetCodeInterpreterSessionResponse, |
| 45 | agentcore.GetCodeInterpreterSessionError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | export const GetCodeInterpreterSession = |
| 50 | Binding.Service<GetCodeInterpreterSession>( |
| 51 | "AWS.BedrockAgentCore.GetCodeInterpreterSession", |
| 52 | ); |