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
| 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 { Memory } from "./Memory.ts"; |
| 5 | |
| 6 | export interface GetEventRequest extends Omit<agentcore.GetEventInput, "memoryId"> {} |
| 7 | |
| 8 | /** |
| 9 | * Fetches a single short-term event from an actor's session. |
| 10 | * |
| 11 | * Bind a {@link Memory} inside a function runtime to call the |
| 12 | * AgentCore data-plane API against it. Provide `AgentCore.GetEventHttp` |
| 13 | * on the Function effect to implement the binding. |
| 14 | * |
| 15 | * ### Reading Events |
| 16 | * **Example:** Fetch an Event by Id |
| 17 | * ```typescript |
| 18 | * // init |
| 19 | * const getEvent = yield* AgentCore.GetEvent(memory); |
| 20 | * |
| 21 | * return { |
| 22 | * fetch: Effect.gen(function* () { |
| 23 | * // runtime |
| 24 | * const result = yield* getEvent({ |
| 25 | * actorId: "user-1", |
| 26 | * sessionId: "session-1", |
| 27 | * eventId, |
| 28 | * }); |
| 29 | * return HttpServerResponse.json({ event: result.event }); |
| 30 | * }), |
| 31 | * }; |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetEvent extends Binding.Service< |
| 37 | GetEvent, |
| 38 | "AWS.BedrockAgentCore.GetEvent", |
| 39 | <R extends Memory>( |
| 40 | memory: R, |
| 41 | ) => Effect.Effect< |
| 42 | (request: GetEventRequest) => Effect.Effect<agentcore.GetEventOutput, agentcore.GetEventError> |
| 43 | > |
| 44 | > {} |
| 45 | export const GetEvent = Binding.Service<GetEvent>("AWS.BedrockAgentCore.GetEvent"); |