@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, 06:00 UTC

main
ts 56 lines 1.71 KB
Raw
1 import type * as bedrock from "@distilled.cloud/aws/bedrock-agent";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { DataSource } from "./DataSource.ts";
5
6 /**
7 * The `GetIngestionJob` request with the binding-injected `knowledgeBaseId`
8 * and `dataSourceId` removed — they are supplied automatically from the
9 * bound {@link DataSource}.
10 */
11 export interface GetIngestionJobRequest extends Omit<
12 bedrock.GetIngestionJobRequest,
13 "knowledgeBaseId" | "dataSourceId"
14 > {}
15
16 /**
17 * Runtime binding for `bedrock-agent:GetIngestionJob` — read the status and
18 * statistics of an ingestion job started on the bound {@link DataSource}.
19 *
20 * The binding grants the function `bedrock:GetIngestionJob` scoped to the
21 * data source's parent knowledge base.
22 *
23 * ### Syncing a Data Source
24 * **Example:** Poll an Ingestion Job to Completion
25 * ```typescript
26 * // init
27 * const getIngestionJob = yield* Bedrock.GetIngestionJob(dataSource);
28 *
29 * // runtime
30 * const { ingestionJob } = yield* getIngestionJob({
31 * ingestionJobId: jobId,
32 * }).pipe(
33 * Effect.repeat({
34 * schedule: Schedule.spaced("5 seconds"),
35 * until: (r) =>
36 * r.ingestionJob.status === "COMPLETE" ||
37 * r.ingestionJob.status === "FAILED",
38 * times: 36,
39 * }),
40 * );
41 * ```
42 *
43 * @binding
44 */
45 export interface GetIngestionJob extends Binding.Service<
46 GetIngestionJob,
47 "AWS.Bedrock.GetIngestionJob",
48 <D extends DataSource>(
49 dataSource: D,
50 ) => Effect.Effect<
51 (
52 request: GetIngestionJobRequest,
53 ) => Effect.Effect<bedrock.GetIngestionJobResponse, bedrock.GetIngestionJobError>
54 >
55 > {}
56 export const GetIngestionJob = Binding.Service<GetIngestionJob>("AWS.Bedrock.GetIngestionJob");