@relayfx/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8449 -0
- package/dist/migrations/20260701002839_sour_cerebro/migration.sql +160 -0
- package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +1971 -0
- package/dist/migrations/20260701041134_acoustic_hulk/migration.sql +30 -0
- package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +2372 -0
- package/dist/migrations/20260701160543_condemned_stryfe/migration.sql +2 -0
- package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +2442 -0
- package/dist/migrations/20260701220315_heavy_gorgon/migration.sql +5 -0
- package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +2495 -0
- package/dist/migrations/20260701225444_polite_lord_hawal/migration.sql +24 -0
- package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +2821 -0
- package/dist/migrations/20260702030128_flaky_misty_knight/migration.sql +1 -0
- package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +2821 -0
- package/dist/types/ai/index.d.ts +2 -0
- package/dist/types/ai/language-model/language-model-registration.d.ts +89 -0
- package/dist/types/relay/adapter-outbox.d.ts +19 -0
- package/dist/types/relay/client.d.ts +102 -0
- package/dist/types/relay/database.d.ts +11 -0
- package/dist/types/relay/index.d.ts +10 -0
- package/dist/types/relay/operation.d.ts +921 -0
- package/dist/types/runtime/address/address-book-service.d.ts +74 -0
- package/dist/types/runtime/address/address-resolution-service.d.ts +106 -0
- package/dist/types/runtime/agent/agent-loop-service.d.ts +53 -0
- package/dist/types/runtime/agent/agent-registry-service.d.ts +31 -0
- package/dist/types/runtime/agent/prompt-assembler-service.d.ts +102 -0
- package/dist/types/runtime/child/child-run-service.d.ts +90 -0
- package/dist/types/runtime/child/parent-notifier-service.d.ts +40 -0
- package/dist/types/runtime/cluster/execution-entity.d.ts +393 -0
- package/dist/types/runtime/content/artifact-store-service.d.ts +73 -0
- package/dist/types/runtime/content/blob-store-service.d.ts +87 -0
- package/dist/types/runtime/envelope/envelope-service.d.ts +52 -0
- package/dist/types/runtime/execution/event-log-service.d.ts +54 -0
- package/dist/types/runtime/execution/execution-service.d.ts +62 -0
- package/dist/types/runtime/index.d.ts +25 -0
- package/dist/types/runtime/model/language-model-service.d.ts +58 -0
- package/dist/types/runtime/model/model-call-policy.d.ts +53 -0
- package/dist/types/runtime/observability/runtime-metrics.d.ts +9 -0
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +132 -0
- package/dist/types/runtime/schedule/scheduler-service.d.ts +34 -0
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +85 -0
- package/dist/types/runtime/wait/wait-service.d.ts +80 -0
- package/dist/types/runtime/wait/wait-signal.d.ts +15 -0
- package/dist/types/runtime/workflow/execution-workflow.d.ts +335 -0
- package/dist/types/runtime/workspace/workspace-planner-service.d.ts +63 -0
- package/dist/types/runtime/workspace/workspace-provider-service.d.ts +108 -0
- package/dist/types/runtime/workspace/workspace-runtime-service.d.ts +21 -0
- package/dist/types/schema/address-schema.d.ts +77 -0
- package/dist/types/schema/agent-schema.d.ts +360 -0
- package/dist/types/schema/content-schema.d.ts +106 -0
- package/dist/types/schema/envelope-schema.d.ts +167 -0
- package/dist/types/schema/execution-schema.d.ts +297 -0
- package/dist/types/schema/ids-schema.d.ts +61 -0
- package/dist/types/schema/index.d.ts +11 -0
- package/dist/types/schema/schedule-schema.d.ts +73 -0
- package/dist/types/schema/shared-schema.d.ts +11 -0
- package/dist/types/schema/tool-schema.d.ts +53 -0
- package/dist/types/schema/workspace-schema.d.ts +78 -0
- package/dist/types/store-sql/address/address-book-repository.d.ts +48 -0
- package/dist/types/store-sql/agent/agent-definition-repository.d.ts +49 -0
- package/dist/types/store-sql/chat/agent-chat-repository.d.ts +31 -0
- package/dist/types/store-sql/child/child-execution-repository.d.ts +61 -0
- package/dist/types/store-sql/cluster/cluster-registry-repository.d.ts +35 -0
- package/dist/types/store-sql/database/database-service.d.ts +25 -0
- package/dist/types/store-sql/envelope/envelope-repository.d.ts +158 -0
- package/dist/types/store-sql/execution/execution-event-repository.d.ts +86 -0
- package/dist/types/store-sql/execution/execution-repository.d.ts +80 -0
- package/dist/types/store-sql/idempotency/idempotency-repository.d.ts +42 -0
- package/dist/types/store-sql/index.d.ts +15 -0
- package/dist/types/store-sql/schedule/schedule-repository.d.ts +83 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +2302 -0
- package/dist/types/store-sql/tool/tool-call-repository.d.ts +66 -0
- package/dist/types/store-sql/workspace/workspace-lease-repository.d.ts +87 -0
- package/package.json +44 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Agent, Execution, Ids, Shared } from "../../schema/index";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import * as Database from "../database/database-service";
|
|
4
|
+
declare const ExecutionRepositoryError_base: Schema.Class<ExecutionRepositoryError, Schema.TaggedStruct<"ExecutionRepositoryError", {
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class ExecutionRepositoryError extends ExecutionRepositoryError_base {
|
|
8
|
+
}
|
|
9
|
+
declare const DuplicateExecution_base: Schema.Class<DuplicateExecution, Schema.TaggedStruct<"DuplicateExecution", {
|
|
10
|
+
readonly id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
11
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
12
|
+
};
|
|
13
|
+
}>, import("effect/Cause").YieldableError>;
|
|
14
|
+
export declare class DuplicateExecution extends DuplicateExecution_base {
|
|
15
|
+
}
|
|
16
|
+
declare const ExecutionNotFound_base: Schema.Class<ExecutionNotFound, Schema.TaggedStruct<"ExecutionNotFound", {
|
|
17
|
+
readonly id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
18
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
19
|
+
};
|
|
20
|
+
}>, import("effect/Cause").YieldableError>;
|
|
21
|
+
export declare class ExecutionNotFound extends ExecutionNotFound_base {
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionRecord {
|
|
24
|
+
readonly id: Ids.ExecutionId;
|
|
25
|
+
readonly rootAddressId: Ids.AddressId;
|
|
26
|
+
readonly status: Execution.ExecutionStatus;
|
|
27
|
+
readonly agentDefinitionId?: Ids.AgentDefinitionId;
|
|
28
|
+
readonly agentDefinitionRevision?: Agent.DefinitionRevision;
|
|
29
|
+
readonly agentDefinitionSnapshot?: Agent.Definition;
|
|
30
|
+
readonly metadata: Shared.Metadata;
|
|
31
|
+
readonly createdAt: number;
|
|
32
|
+
readonly updatedAt: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CreateExecutionInput {
|
|
35
|
+
readonly id: Ids.ExecutionId;
|
|
36
|
+
readonly rootAddressId: Ids.AddressId;
|
|
37
|
+
readonly status: Execution.ExecutionStatus;
|
|
38
|
+
readonly agentDefinitionId?: Ids.AgentDefinitionId;
|
|
39
|
+
readonly agentDefinitionRevision?: Agent.DefinitionRevision;
|
|
40
|
+
readonly agentDefinitionSnapshot?: Agent.Definition;
|
|
41
|
+
readonly metadata?: Shared.Metadata;
|
|
42
|
+
readonly createdAt: number;
|
|
43
|
+
}
|
|
44
|
+
export interface TransitionExecutionInput {
|
|
45
|
+
readonly id: Ids.ExecutionId;
|
|
46
|
+
readonly status: Execution.ExecutionStatus;
|
|
47
|
+
readonly metadata?: Shared.Metadata;
|
|
48
|
+
readonly updatedAt: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ExecutionCursor {
|
|
51
|
+
readonly updatedAt: number;
|
|
52
|
+
readonly id: Ids.ExecutionId;
|
|
53
|
+
}
|
|
54
|
+
export interface ListExecutionsInput {
|
|
55
|
+
readonly rootAddressId?: Ids.AddressId;
|
|
56
|
+
readonly status?: Execution.ExecutionStatus;
|
|
57
|
+
readonly limit?: number;
|
|
58
|
+
readonly cursor?: ExecutionCursor;
|
|
59
|
+
}
|
|
60
|
+
export interface ListExecutionsResult {
|
|
61
|
+
readonly records: ReadonlyArray<ExecutionRecord>;
|
|
62
|
+
readonly nextCursor?: ExecutionCursor;
|
|
63
|
+
}
|
|
64
|
+
export interface Interface {
|
|
65
|
+
readonly create: (input: CreateExecutionInput) => Effect.Effect<ExecutionRecord, DuplicateExecution | ExecutionRepositoryError>;
|
|
66
|
+
readonly get: (id: Ids.ExecutionId) => Effect.Effect<ExecutionRecord | undefined, ExecutionRepositoryError>;
|
|
67
|
+
readonly list: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ExecutionRepositoryError>;
|
|
68
|
+
readonly transition: (input: TransitionExecutionInput) => Effect.Effect<ExecutionRecord, ExecutionNotFound | ExecutionRepositoryError>;
|
|
69
|
+
}
|
|
70
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/ExecutionRepository", Interface>;
|
|
71
|
+
export declare class Service extends Service_base {
|
|
72
|
+
}
|
|
73
|
+
export declare const layer: Layer.Layer<Service, never, Database.Service>;
|
|
74
|
+
export declare const memoryLayer: Layer.Layer<Service, never, never>;
|
|
75
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
76
|
+
export declare const create: (input: CreateExecutionInput) => Effect.Effect<ExecutionRecord, ExecutionRepositoryError | DuplicateExecution, Service>;
|
|
77
|
+
export declare const get: (id: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<ExecutionRecord | undefined, ExecutionRepositoryError, Service>;
|
|
78
|
+
export declare const list: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ExecutionRepositoryError, Service>;
|
|
79
|
+
export declare const transition: (input: TransitionExecutionInput) => Effect.Effect<ExecutionRecord, ExecutionRepositoryError | ExecutionNotFound, Service>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Shared } from "../../schema/index";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import * as Database from "../database/database-service";
|
|
4
|
+
declare const IdempotencyRepositoryError_base: Schema.Class<IdempotencyRepositoryError, Schema.TaggedStruct<"IdempotencyRepositoryError", {
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class IdempotencyRepositoryError extends IdempotencyRepositoryError_base {
|
|
8
|
+
}
|
|
9
|
+
export interface OperationInput {
|
|
10
|
+
readonly scope: string;
|
|
11
|
+
readonly operation: string;
|
|
12
|
+
readonly key: string;
|
|
13
|
+
readonly metadata?: Shared.Metadata;
|
|
14
|
+
readonly createdAt: number;
|
|
15
|
+
readonly expiresAt?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface IdempotencyRecord {
|
|
18
|
+
readonly scope: string;
|
|
19
|
+
readonly operation: string;
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly result: Shared.JsonValue;
|
|
22
|
+
readonly metadata: Shared.Metadata;
|
|
23
|
+
readonly createdAt: number;
|
|
24
|
+
readonly expiresAt?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IdempotencyOutcome {
|
|
27
|
+
readonly replayed: boolean;
|
|
28
|
+
readonly record: IdempotencyRecord;
|
|
29
|
+
}
|
|
30
|
+
export interface Interface {
|
|
31
|
+
readonly runOnce: <R>(input: OperationInput, create: Effect.Effect<Shared.JsonValue, IdempotencyRepositoryError, R>) => Effect.Effect<IdempotencyOutcome, IdempotencyRepositoryError, R>;
|
|
32
|
+
readonly transaction: <A, R>(effect: Effect.Effect<A, IdempotencyRepositoryError, R>) => Effect.Effect<A, IdempotencyRepositoryError, R>;
|
|
33
|
+
}
|
|
34
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/IdempotencyRepository", Interface>;
|
|
35
|
+
export declare class Service extends Service_base {
|
|
36
|
+
}
|
|
37
|
+
export declare const layer: Layer.Layer<Service, never, Database.Service>;
|
|
38
|
+
export declare const memoryLayer: Layer.Layer<Service, never, never>;
|
|
39
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
40
|
+
export declare const runOnce: <R>(input: OperationInput, create: Effect.Effect<Shared.JsonValue, IdempotencyRepositoryError, R>) => Effect.Effect<IdempotencyOutcome, IdempotencyRepositoryError, Service | R>;
|
|
41
|
+
export declare const transaction: <A, R>(effect: Effect.Effect<A, IdempotencyRepositoryError, R>) => Effect.Effect<A, IdempotencyRepositoryError, Service | R>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * as AddressBookRepository from "./address/address-book-repository";
|
|
2
|
+
export * as AgentChatRepository from "./chat/agent-chat-repository";
|
|
3
|
+
export * as AgentDefinitionRepository from "./agent/agent-definition-repository";
|
|
4
|
+
export * as ChildExecutionRepository from "./child/child-execution-repository";
|
|
5
|
+
export * as ClusterRegistryRepository from "./cluster/cluster-registry-repository";
|
|
6
|
+
export * as Database from "./database/database-service";
|
|
7
|
+
export * as EnvelopeRepository from "./envelope/envelope-repository";
|
|
8
|
+
export * as ExecutionEventRepository from "./execution/execution-event-repository";
|
|
9
|
+
export * as ExecutionRepository from "./execution/execution-repository";
|
|
10
|
+
export * as IdempotencyRepository from "./idempotency/idempotency-repository";
|
|
11
|
+
export * as RelaySchema from "./schema/relay-schema";
|
|
12
|
+
export * as ScheduleRepository from "./schedule/schedule-repository";
|
|
13
|
+
export * as ToolCallRepository from "./tool/tool-call-repository";
|
|
14
|
+
export * as WorkspaceLeaseRepository from "./workspace/workspace-lease-repository";
|
|
15
|
+
export declare const storeSqlPackage = "./index";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Content, Ids, Schedule, Shared } from "../../schema/index";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import * as Database from "../database/database-service";
|
|
4
|
+
declare const ScheduleRepositoryError_base: Schema.Class<ScheduleRepositoryError, Schema.TaggedStruct<"ScheduleRepositoryError", {
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class ScheduleRepositoryError extends ScheduleRepositoryError_base {
|
|
8
|
+
}
|
|
9
|
+
declare const ScheduleNotFound_base: Schema.Class<ScheduleNotFound, Schema.TaggedStruct<"ScheduleNotFound", {
|
|
10
|
+
readonly id: Schema.brand<Schema.String, "Relay.ScheduleId"> & {
|
|
11
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ScheduleId">;
|
|
12
|
+
};
|
|
13
|
+
}>, import("effect/Cause").YieldableError>;
|
|
14
|
+
export declare class ScheduleNotFound extends ScheduleNotFound_base {
|
|
15
|
+
}
|
|
16
|
+
declare const ScheduleClaimMismatch_base: Schema.Class<ScheduleClaimMismatch, Schema.TaggedStruct<"ScheduleClaimMismatch", {
|
|
17
|
+
readonly id: Schema.brand<Schema.String, "Relay.ScheduleId"> & {
|
|
18
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ScheduleId">;
|
|
19
|
+
};
|
|
20
|
+
readonly worker_id: Schema.String;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
export declare class ScheduleClaimMismatch extends ScheduleClaimMismatch_base {
|
|
23
|
+
}
|
|
24
|
+
export interface CreateScheduleInput {
|
|
25
|
+
readonly id: Ids.ScheduleId;
|
|
26
|
+
readonly kind: Schedule.ScheduleKind;
|
|
27
|
+
readonly targetKind: Schedule.ScheduleTargetKind;
|
|
28
|
+
readonly addressId?: Ids.AddressId;
|
|
29
|
+
readonly waitId?: Ids.WaitId;
|
|
30
|
+
readonly cronExpr?: string;
|
|
31
|
+
readonly input?: ReadonlyArray<Content.Part>;
|
|
32
|
+
readonly nextRunAt: number;
|
|
33
|
+
readonly idempotencyKey?: string;
|
|
34
|
+
readonly metadata?: Shared.Metadata;
|
|
35
|
+
readonly createdAt: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ListSchedulesInput {
|
|
38
|
+
readonly state?: Schedule.ScheduleState;
|
|
39
|
+
}
|
|
40
|
+
export interface CancelScheduleInput {
|
|
41
|
+
readonly id: Ids.ScheduleId;
|
|
42
|
+
readonly cancelledAt: number;
|
|
43
|
+
}
|
|
44
|
+
export interface ClaimDueInput {
|
|
45
|
+
readonly workerId: string;
|
|
46
|
+
readonly now: number;
|
|
47
|
+
readonly claimExpiresAt: number;
|
|
48
|
+
}
|
|
49
|
+
export interface AckScheduleInput {
|
|
50
|
+
readonly id: Ids.ScheduleId;
|
|
51
|
+
readonly workerId: string;
|
|
52
|
+
readonly now: number;
|
|
53
|
+
readonly nextRunAt?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface ReleaseScheduleInput {
|
|
56
|
+
readonly id: Ids.ScheduleId;
|
|
57
|
+
readonly workerId: string;
|
|
58
|
+
readonly nextAvailableAt: number;
|
|
59
|
+
readonly error: string;
|
|
60
|
+
}
|
|
61
|
+
export interface Interface {
|
|
62
|
+
readonly create: (input: CreateScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleRepositoryError>;
|
|
63
|
+
readonly get: (id: Ids.ScheduleId) => Effect.Effect<Schedule.ScheduleRecord | undefined, ScheduleRepositoryError>;
|
|
64
|
+
readonly list: (input: ListSchedulesInput) => Effect.Effect<ReadonlyArray<Schedule.ScheduleRecord>, ScheduleRepositoryError>;
|
|
65
|
+
readonly cancel: (input: CancelScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleNotFound | ScheduleRepositoryError>;
|
|
66
|
+
readonly claimDue: (input: ClaimDueInput) => Effect.Effect<Schedule.ScheduleRecord | undefined, ScheduleRepositoryError>;
|
|
67
|
+
readonly ack: (input: AckScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleNotFound | ScheduleClaimMismatch | ScheduleRepositoryError>;
|
|
68
|
+
readonly release: (input: ReleaseScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleNotFound | ScheduleClaimMismatch | ScheduleRepositoryError>;
|
|
69
|
+
}
|
|
70
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/ScheduleRepository", Interface>;
|
|
71
|
+
export declare class Service extends Service_base {
|
|
72
|
+
}
|
|
73
|
+
export declare const layer: Layer.Layer<Service, never, Database.Service>;
|
|
74
|
+
export declare const memoryLayer: Layer.Layer<Service, never, never>;
|
|
75
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
76
|
+
export declare const create: (input: CreateScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleRepositoryError, Service>;
|
|
77
|
+
export declare const get: (id: string & import("effect/Brand").Brand<"Relay.ScheduleId">) => Effect.Effect<Schedule.ScheduleRecord | undefined, ScheduleRepositoryError, Service>;
|
|
78
|
+
export declare const list: (input: ListSchedulesInput) => Effect.Effect<readonly Schedule.ScheduleRecord[], ScheduleRepositoryError, Service>;
|
|
79
|
+
export declare const cancel: (input: CancelScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleRepositoryError | ScheduleNotFound, Service>;
|
|
80
|
+
export declare const claimDue: (input: ClaimDueInput) => Effect.Effect<Schedule.ScheduleRecord | undefined, ScheduleRepositoryError, Service>;
|
|
81
|
+
export declare const ack: (input: AckScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleRepositoryError | ScheduleNotFound | ScheduleClaimMismatch, Service>;
|
|
82
|
+
export declare const release: (input: ReleaseScheduleInput) => Effect.Effect<Schedule.ScheduleRecord, ScheduleRepositoryError | ScheduleNotFound | ScheduleClaimMismatch, Service>;
|
|
83
|
+
export {};
|