| 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 { Runtime } from "./Runtime.ts"; |
| 5 | |
| 6 | export interface StopRuntimeSessionRequest extends Omit< |
| 7 | agentcore.StopRuntimeSessionRequest, |
| 8 | "agentRuntimeArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Stops a specific session on the agent runtime. |
| 13 | * |
| 14 | * Bind a {@link Runtime} inside a function runtime to call the |
| 15 | * AgentCore data-plane API against it. Provide `AgentCore.StopRuntimeSessionHttp` |
| 16 | * on the Function effect to implement the binding. |
| 17 | * |
| 18 | * ### Runtime Sessions |
| 19 | * **Example:** Stop a Runtime Session |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const stopRuntimeSession = yield* AgentCore.StopRuntimeSession(runtime); |
| 23 | * |
| 24 | * return { |
| 25 | * fetch: Effect.gen(function* () { |
| 26 | * // runtime |
| 27 | * yield* stopRuntimeSession({ runtimeSessionId }); |
| 28 | * return HttpServerResponse.json({ stopped: true }); |
| 29 | * }), |
| 30 | * }; |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface StopRuntimeSession extends Binding.Service< |
| 36 | StopRuntimeSession, |
| 37 | "AWS.BedrockAgentCore.StopRuntimeSession", |
| 38 | <R extends Runtime>( |
| 39 | runtime: R, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: StopRuntimeSessionRequest, |
| 43 | ) => Effect.Effect< |
| 44 | agentcore.StopRuntimeSessionResponse, |
| 45 | agentcore.StopRuntimeSessionError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | export const StopRuntimeSession = Binding.Service<StopRuntimeSession>( |
| 50 | "AWS.BedrockAgentCore.StopRuntimeSession", |
| 51 | ); |