@devries-cameron20 / t3code Mirror · read-only
Fork 0

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, 04:45 UTC

main
ts 58 lines 1.85 KB
Raw
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 { Runtime } from "./Runtime.ts";
5
6 export interface InvokeAgentRuntimeCommandRequest extends Omit<
7 agentcore.InvokeAgentRuntimeCommandRequest,
8 "agentRuntimeArn"
9 > {}
10
11 /**
12 * Runs a shell command inside an agent hosted in an AgentCore Runtime and
13 * streams back the command output.
14 *
15 * Bind a {@link Runtime} inside a function runtime to execute commands in
16 * the hosted agent's sandbox (requests with the same `runtimeSessionId`
17 * land on the same sandbox). Provide
18 * `AgentCore.InvokeAgentRuntimeCommandHttp` on the Function effect to
19 * implement the binding.
20 *
21 * ### Invoking an Agent
22 * **Example:** Run a Command in a Hosted Agent
23 * ```typescript
24 * // init
25 * const invokeCommand = yield* AgentCore.InvokeAgentRuntimeCommand(runtime);
26 *
27 * return {
28 * fetch: Effect.gen(function* () {
29 * // runtime
30 * const response = yield* invokeCommand({
31 * runtimeSessionId: "session-0000000000000000000000000000000001",
32 * body: { command: "echo hello" },
33 * });
34 * const chunks = yield* Stream.runCollect(response.stream);
35 * return HttpServerResponse.json({ chunks: Array.from(chunks) });
36 * }),
37 * };
38 * ```
39 *
40 * @binding
41 */
42 export interface InvokeAgentRuntimeCommand extends Binding.Service<
43 InvokeAgentRuntimeCommand,
44 "AWS.BedrockAgentCore.InvokeAgentRuntimeCommand",
45 <R extends Runtime>(
46 runtime: R,
47 ) => Effect.Effect<
48 (
49 request: InvokeAgentRuntimeCommandRequest,
50 ) => Effect.Effect<
51 agentcore.InvokeAgentRuntimeCommandResponse,
52 agentcore.InvokeAgentRuntimeCommandError
53 >
54 >
55 > {}
56 export const InvokeAgentRuntimeCommand = Binding.Service<InvokeAgentRuntimeCommand>(
57 "AWS.BedrockAgentCore.InvokeAgentRuntimeCommand",
58 );