@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 48 lines 1.67 KB
Raw
1 import type * as sfn from "@distilled.cloud/aws/sfn";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Activity } from "./Activity.ts";
5
6 export interface GetActivityTaskRequest extends Omit<sfn.GetActivityTaskInput, "activityArn"> {}
7
8 /**
9 * Runtime binding for `states:GetActivityTask` — the activity worker's
10 * long-poll. Bind this operation to an {@link Activity} inside a function
11 * runtime to receive scheduled activity tasks with the activity ARN
12 * injected automatically.
13 *
14 * The call blocks for up to 60 seconds when no task is scheduled (an empty
15 * `taskToken` means the poll timed out) — size the host's timeout
16 * accordingly. Complete the returned task with `SendTaskSuccess` /
17 * `SendTaskFailure`, keeping it alive with `SendTaskHeartbeat`.
18 * ### Activity Workers
19 * **Example:** Poll for a task and complete it
20 * ```typescript
21 * const getActivityTask = yield* StepFunctions.GetActivityTask(activity);
22 * const sendTaskSuccess = yield* StepFunctions.SendTaskSuccess(activity);
23 *
24 * const task = yield* getActivityTask({ workerName: "worker-1" });
25 * if (task.taskToken) {
26 * yield* sendTaskSuccess({
27 * taskToken: task.taskToken,
28 * output: JSON.stringify({ handled: true }),
29 * });
30 * }
31 * ```
32 *
33 * @binding
34 */
35 export interface GetActivityTask extends Binding.Service<
36 GetActivityTask,
37 "AWS.StepFunctions.GetActivityTask",
38 (
39 activity: Activity,
40 ) => Effect.Effect<
41 (
42 request?: GetActivityTaskRequest,
43 ) => Effect.Effect<sfn.GetActivityTaskOutput, sfn.GetActivityTaskError>
44 >
45 > {}
46 export const GetActivityTask = Binding.Service<GetActivityTask>(
47 "AWS.StepFunctions.GetActivityTask",
48 );