@relayfx/sdk 0.7.10 → 0.7.11
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/http-server.js +1 -1
- package/dist/{index-gwgea1te.js → index-d1je4njg.js} +4088 -3764
- package/dist/{index-nb078xsy.js → index-j8k41y47.js} +26 -4
- package/dist/{index-m7dpw880.js → index-skcp0xvt.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/migrations/20260723190000_transactional_event_head/migration.sql +22 -0
- package/dist/migrations/20260724010000_execution_event_archive_manifests/migration.sql +66 -0
- package/dist/migrations/20260724120000_execution_event_identity_directory/migration.sql +15 -0
- package/dist/migrations/20260724230000_idempotent_steering/migration.sql +7 -0
- package/dist/migrations/mysql/0015_transactional_event_head.sql +32 -0
- package/dist/migrations/mysql/0016_execution_event_archive_manifests.sql +65 -0
- package/dist/migrations/mysql/0017_execution_event_identity_directory.sql +20 -0
- package/dist/migrations/mysql/0018_idempotent_steering.sql +7 -0
- package/dist/migrations/pg/20260723190000_transactional_event_head/migration.sql +22 -0
- package/dist/migrations/pg/20260724010000_execution_event_archive_manifests/migration.sql +66 -0
- package/dist/migrations/pg/20260724120000_execution_event_identity_directory/migration.sql +15 -0
- package/dist/migrations/pg/20260724230000_idempotent_steering/migration.sql +7 -0
- package/dist/migrations/sqlite/0015_transactional_event_head.sql +22 -0
- package/dist/migrations/sqlite/0016_execution_event_archive_manifests.sql +45 -0
- package/dist/migrations/sqlite/0017_execution_event_identity_directory.sql +13 -0
- package/dist/migrations/sqlite/0018_idempotent_steering.sql +5 -0
- package/dist/mysql.js +49 -8
- package/dist/postgres.js +135 -13
- package/dist/sqlite.js +115 -4
- package/dist/types/relay/client-public-executions.d.ts +1 -1
- package/dist/types/relay/client-public.d.ts +2 -2
- package/dist/types/relay/http-server.d.ts +2 -2
- package/dist/types/relay/mysql-migrations.d.ts +1 -1
- package/dist/types/relay/operation.d.ts +9 -0
- package/dist/types/relay/sqlite-migrations.d.ts +21 -1
- package/dist/types/runtime/agent/agent-loop-events.d.ts +10 -9
- package/dist/types/runtime/agent/agent-loop-service.d.ts +1 -0
- package/dist/types/runtime/agent/emission-ordinal-allocator.d.ts +7 -0
- package/dist/types/runtime/agent/relay-permissions.d.ts +4 -7
- package/dist/types/runtime/agent/relay-steering.d.ts +5 -5
- package/dist/types/runtime/agent/relay-tool-executor.d.ts +3 -2
- package/dist/types/runtime/envelope/envelope-service.d.ts +2 -1
- package/dist/types/runtime/execution/event-log-service.d.ts +5 -4
- package/dist/types/runtime/execution/execution-service.d.ts +1 -1
- package/dist/types/runtime/inbox/inbox-service.d.ts +6 -6
- package/dist/types/runtime/schedule/scheduler-service.d.ts +3 -4
- package/dist/types/runtime/state/execution-state-service.d.ts +2 -2
- package/dist/types/runtime/tool/tool-runtime-contract.d.ts +2 -0
- package/dist/types/runtime/tool/tool-runtime-identifiers.d.ts +6 -0
- package/dist/types/runtime/wait/wait-service.d.ts +5 -5
- package/dist/types/runtime/workflow/execution-workflow.d.ts +2 -3
- package/dist/types/runtime/workspace/workspace-planner-service.d.ts +2 -0
- package/dist/types/schema/workflow-schema.d.ts +1 -0
- package/dist/types/store-sql/execution/archive-compression.d.ts +11 -0
- package/dist/types/store-sql/execution/event-history-file-system.d.ts +7 -0
- package/dist/types/store-sql/execution/event-history-store.d.ts +93 -0
- package/dist/types/store-sql/execution/execution-event-archive-codec.d.ts +69 -0
- package/dist/types/store-sql/execution/execution-event-archive-repository-memory.d.ts +28 -0
- package/dist/types/store-sql/execution/execution-event-archive-repository-sql.d.ts +19 -0
- package/dist/types/store-sql/execution/execution-event-archive-repository.d.ts +175 -0
- package/dist/types/store-sql/execution/execution-event-head-memory.d.ts +13 -0
- package/dist/types/store-sql/execution/execution-event-head.d.ts +40 -0
- package/dist/types/store-sql/execution/execution-event-identity-directory.d.ts +26 -0
- package/dist/types/store-sql/execution/execution-event-repository-archive-aware.d.ts +7 -0
- package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +6 -1
- package/dist/types/store-sql/execution/execution-event-repository.d.ts +6 -4
- package/dist/types/store-sql/inbox/inbox-repository.d.ts +6 -2
- package/dist/types/store-sql/schema/communication-schema.d.ts +15 -0
- package/dist/types/store-sql/schema/execution-schema.d.ts +583 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +1 -1
- package/dist/types/store-sql/state/execution-state-repository.d.ts +2 -1
- package/dist/types/store-sql/steering/steering-model.d.ts +60 -0
- package/dist/types/store-sql/steering/steering-repository.d.ts +5 -50
- package/package.json +3 -3
- package/dist/types/relay/client-event-sequence.d.ts +0 -3
- package/dist/types/runtime/agent/sequence-allocator.d.ts +0 -9
|
@@ -2,20 +2,21 @@ import type { AgentEvent, ModelTelemetry } from "@batonfx/core";
|
|
|
2
2
|
import { Content, Execution, Shared, Tool } from "../../schema/index";
|
|
3
3
|
import type { Response } from "effect/unstable/ai";
|
|
4
4
|
import type { RunInput } from "./agent-loop-service";
|
|
5
|
+
type ExecutionEventDraft = Omit<Execution.ExecutionEvent, "sequence">;
|
|
5
6
|
declare const legacyTelemetryCursor: (input: RunInput, event: ModelTelemetry.Event) => string;
|
|
6
7
|
declare const legacyUsageCursor: (input: RunInput, event: ModelTelemetry.ModelAttemptCompleted) => string;
|
|
7
|
-
declare const telemetryEvent: (input: RunInput, sessionId: string, event: ModelTelemetry.Event,
|
|
8
|
-
declare const inputPreparedEvent: (input: RunInput, definitions: ReadonlyArray<Tool.Definition>) =>
|
|
9
|
-
declare const usageReportedEvent: (input: RunInput, sessionId: string, event: ModelTelemetry.ModelAttemptCompleted,
|
|
10
|
-
declare const budgetExceededEvent: (input: RunInput, tokensUsed: number, tokenBudget: number
|
|
11
|
-
declare const outputDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.TextDeltaPart, deltaIndex: number, createdAt: number) =>
|
|
12
|
-
declare const reasoningDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.ReasoningPart | Response.ReasoningDeltaPart, deltaIndex: number, createdAt: number) =>
|
|
13
|
-
declare const toolCallDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.ToolParamsDeltaPart, toolCallName: string | undefined,
|
|
14
|
-
declare const outputCompletedEvent: (input: RunInput, content: ReadonlyArray<Content.Part>, outputText: string,
|
|
8
|
+
declare const telemetryEvent: (input: RunInput, sessionId: string, event: ModelTelemetry.Event, createdAt: number) => ExecutionEventDraft;
|
|
9
|
+
declare const inputPreparedEvent: (input: RunInput, definitions: ReadonlyArray<Tool.Definition>) => ExecutionEventDraft;
|
|
10
|
+
declare const usageReportedEvent: (input: RunInput, sessionId: string, event: ModelTelemetry.ModelAttemptCompleted, createdAt: number) => ExecutionEventDraft;
|
|
11
|
+
declare const budgetExceededEvent: (input: RunInput, tokensUsed: number, tokenBudget: number) => ExecutionEventDraft;
|
|
12
|
+
declare const outputDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.TextDeltaPart, deltaIndex: number, createdAt: number) => ExecutionEventDraft;
|
|
13
|
+
declare const reasoningDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.ReasoningPart | Response.ReasoningDeltaPart, deltaIndex: number, createdAt: number) => ExecutionEventDraft;
|
|
14
|
+
declare const toolCallDeltaEvent: (input: RunInput, modelPart: AgentEvent.ModelPart, part: Response.ToolParamsDeltaPart, toolCallName: string | undefined, deltaIndex: number, createdAt: number) => ExecutionEventDraft;
|
|
15
|
+
declare const outputCompletedEvent: (input: RunInput, content: ReadonlyArray<Content.Part>, outputText: string, structuredOutput?: Shared.JsonValue, structuredIdentity?: {
|
|
15
16
|
readonly modelCallId: string;
|
|
16
17
|
readonly modelAttemptId: string;
|
|
17
18
|
readonly attempt: number;
|
|
18
|
-
}) =>
|
|
19
|
+
}) => ExecutionEventDraft;
|
|
19
20
|
declare const completedContent: (outputText: string) => ReadonlyArray<Content.Part>;
|
|
20
21
|
declare const modelOutputMetadata: (event: Execution.ExecutionEvent) => Shared.Metadata;
|
|
21
22
|
export declare const AgentLoopEvents: {
|
|
@@ -32,6 +32,7 @@ export declare class AgentLoopWaitRequested extends AgentLoopWaitRequested_base
|
|
|
32
32
|
}
|
|
33
33
|
export interface RunInput {
|
|
34
34
|
readonly executionId: Ids.ExecutionId;
|
|
35
|
+
readonly operationId: string;
|
|
35
36
|
readonly origin?: Execution.ExecutionOrigin;
|
|
36
37
|
readonly sessionId?: Ids.SessionId;
|
|
37
38
|
readonly agent: Agent.Definition;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
/** Invocation-local deterministic emission ordinals. These are never durable event sequences. */
|
|
3
|
+
export interface EmissionOrdinalAllocator {
|
|
4
|
+
readonly allocate: (count: number) => Effect.Effect<number>;
|
|
5
|
+
readonly current: Effect.Effect<number>;
|
|
6
|
+
}
|
|
7
|
+
export declare const make: Effect.Effect<EmissionOrdinalAllocator>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { Approvals, Permissions } from "@batonfx/core";
|
|
2
2
|
import { Agent, Execution, Ids } from "../../schema/index";
|
|
3
3
|
import { PermissionRuleRepository } from "../../store-sql/portable";
|
|
4
|
-
import {
|
|
4
|
+
import { Layer } from "effect";
|
|
5
5
|
import type { Interface as EventLogInterface } from "../execution/event-log-service";
|
|
6
6
|
import type { Interface as WaitServiceInterface } from "../wait/wait-service";
|
|
7
|
-
export interface SequenceAllocator {
|
|
8
|
-
readonly allocate: (count: number) => Effect.Effect<Execution.ExecutionEventSequence>;
|
|
9
|
-
readonly current: Effect.Effect<Execution.ExecutionEventSequence>;
|
|
10
|
-
readonly resetTo: (sequence: Execution.ExecutionEventSequence) => Effect.Effect<void>;
|
|
11
|
-
}
|
|
12
7
|
export interface Config {
|
|
13
8
|
readonly ruleset: Agent.PermissionRuleset;
|
|
14
9
|
readonly repository: PermissionRuleRepository.Interface;
|
|
15
10
|
readonly waits: WaitServiceInterface;
|
|
16
11
|
readonly eventLog: EventLogInterface;
|
|
17
|
-
readonly allocator: SequenceAllocator;
|
|
18
12
|
readonly executionId: Ids.ExecutionId;
|
|
13
|
+
readonly operationId: string;
|
|
14
|
+
readonly resumedPermissionWaitId?: Ids.WaitId;
|
|
15
|
+
readonly resumedPermissionToolCallId?: string;
|
|
19
16
|
readonly agentName: string;
|
|
20
17
|
readonly scope: string;
|
|
21
18
|
readonly startedAt: number;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Steering } from "@batonfx/core";
|
|
2
|
-
import {
|
|
2
|
+
import { Ids } from "../../schema/index";
|
|
3
3
|
import { SteeringRepository } from "../../store-sql/portable";
|
|
4
4
|
import { Effect, Layer } from "effect";
|
|
5
5
|
import type { Interface } from "../execution/event-log-service";
|
|
6
|
-
export interface
|
|
7
|
-
readonly allocate: (count: number) => Effect.Effect<
|
|
6
|
+
export interface EmissionOrdinalAllocator {
|
|
7
|
+
readonly allocate: (count: number) => Effect.Effect<number>;
|
|
8
8
|
}
|
|
9
9
|
export interface Config {
|
|
10
10
|
readonly repository: SteeringRepository.Interface;
|
|
11
11
|
readonly eventLog: Interface;
|
|
12
|
-
readonly allocator:
|
|
12
|
+
readonly allocator: EmissionOrdinalAllocator;
|
|
13
13
|
readonly executionId: Ids.ExecutionId;
|
|
14
|
+
readonly operationId: string;
|
|
14
15
|
readonly startedAt: number;
|
|
15
|
-
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
16
16
|
}
|
|
17
17
|
export declare const layer: (config: Config) => Layer.Layer<Steering.Steering>;
|
|
@@ -7,10 +7,11 @@ export interface Config {
|
|
|
7
7
|
readonly toolRuntime: ToolRuntimeInterface;
|
|
8
8
|
readonly eventLog: EventLogInterface;
|
|
9
9
|
readonly allocator: {
|
|
10
|
-
readonly
|
|
11
|
-
readonly advanceTo: (sequence: Execution.ExecutionEventSequence) => Effect.Effect<void>;
|
|
10
|
+
readonly allocate: (count: number) => Effect.Effect<number>;
|
|
12
11
|
};
|
|
13
12
|
readonly executionId: Ids.ExecutionId;
|
|
13
|
+
readonly operationId: string;
|
|
14
|
+
readonly resumedPermissionWaitId?: Ids.WaitId;
|
|
14
15
|
readonly permissions: ReadonlyArray<Tool.Permission>;
|
|
15
16
|
readonly startedAt: number;
|
|
16
17
|
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
@@ -35,7 +35,8 @@ export interface SendInput {
|
|
|
35
35
|
readonly envelopeId: Ids.EnvelopeId;
|
|
36
36
|
readonly executionId: Ids.ExecutionId;
|
|
37
37
|
readonly input: Envelope.SendInput;
|
|
38
|
-
|
|
38
|
+
/** @deprecated Event ordering is allocated transactionally by the event repository. */
|
|
39
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
39
40
|
readonly createdAt: number;
|
|
40
41
|
readonly waitId?: Ids.WaitId;
|
|
41
42
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Execution, Ids } from "../../schema/index";
|
|
2
2
|
import { ExecutionEventRepository } from "../../store-sql/portable";
|
|
3
3
|
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
4
|
+
export type ExecutionEventDraft = ExecutionEventRepository.ExecutionEventDraft;
|
|
4
5
|
declare const EventLogCursorNotFound_base: Schema.Class<EventLogCursorNotFound, Schema.TaggedStruct<"EventLogCursorNotFound", {
|
|
5
6
|
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
6
7
|
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
@@ -74,15 +75,15 @@ export declare class Service extends Service_base {
|
|
|
74
75
|
}
|
|
75
76
|
export declare const layerFromRepository: Layer.Layer<Service, never, ExecutionEventRepository.Service>;
|
|
76
77
|
export declare const memoryLayer: Layer.Layer<Service, never, never>;
|
|
77
|
-
type TestImplementation = Omit<Interface, "
|
|
78
|
+
type TestImplementation = Omit<Interface, "page"> & Partial<Pick<Interface, "page">>;
|
|
78
79
|
export declare const testLayer: (implementation: TestImplementation) => Layer.Layer<Service, never, never>;
|
|
79
80
|
export declare const appendIdempotentTo: {
|
|
80
|
-
(eventLog: Interface, input:
|
|
81
|
-
(input:
|
|
81
|
+
(eventLog: Interface, input: ExecutionEventRepository.ExecutionEventDraft): Effect.Effect<Execution.ExecutionEvent, EventLogError>;
|
|
82
|
+
(input: ExecutionEventRepository.ExecutionEventDraft): (eventLog: Interface) => Effect.Effect<Execution.ExecutionEvent, EventLogError>;
|
|
82
83
|
};
|
|
83
84
|
export declare const append: (input: Execution.ExecutionEvent) => Effect.Effect<Execution.ExecutionEvent, EventLogError, Service>;
|
|
84
85
|
export declare const appendNext: (input: ExecutionEventRepository.AppendNextInput) => Effect.Effect<Execution.ExecutionEvent, EventLogError, Service>;
|
|
85
|
-
export declare const appendIdempotent: (input:
|
|
86
|
+
export declare const appendIdempotent: (input: ExecutionEventRepository.ExecutionEventDraft) => Effect.Effect<Execution.ExecutionEvent, EventLogError, Service>;
|
|
86
87
|
export declare const replay: (input: ReplayInput) => Effect.Effect<readonly Execution.ExecutionEvent[], EventLogCursorNotFound | EventLogError, Service>;
|
|
87
88
|
export declare const page: (input: PageInput) => Effect.Effect<PageResult, EventLogCursorNotFound | EventLogError, Service>;
|
|
88
89
|
export declare const findBySequenceOrCursor: (input: FindBySequenceOrCursorInput) => Effect.Effect<Option.Option<Execution.ExecutionEvent>, EventLogError, Service>;
|
|
@@ -41,7 +41,7 @@ export interface RunProgramResult {
|
|
|
41
41
|
}
|
|
42
42
|
export interface CancelInput {
|
|
43
43
|
readonly executionId: Ids.ExecutionId;
|
|
44
|
-
readonly eventSequence
|
|
44
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
45
45
|
readonly cancelledAt: number;
|
|
46
46
|
readonly reason?: string;
|
|
47
47
|
readonly metadata?: Shared.Metadata;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Content, Envelope, Execution, Ids, Inbox } from "../../schema/index";
|
|
2
|
-
import { EnvelopeRepository, ExecutionRepository, InboxRepository } from "../../store-sql/portable";
|
|
2
|
+
import { EnvelopeRepository, ExecutionEventRepository, ExecutionRepository, InboxRepository } from "../../store-sql/portable";
|
|
3
3
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
-
import { Service as EventLogService } from "../execution/event-log-service";
|
|
5
4
|
import { Service as WaitService } from "../wait/wait-service";
|
|
6
5
|
import type { ExecutionClientFactory } from "../wait/wait-signal";
|
|
7
6
|
declare const InboxDeliveryError_base: Schema.Class<InboxDeliveryError, Schema.TaggedStruct<"InboxDeliveryError", {
|
|
@@ -28,7 +27,8 @@ export interface DeliverInput {
|
|
|
28
27
|
readonly acceptance?: EnvelopeRepository.AcceptEnvelopeInput;
|
|
29
28
|
readonly idempotencyKey?: string;
|
|
30
29
|
readonly replyWaitId?: Ids.WaitId;
|
|
31
|
-
|
|
30
|
+
/** @deprecated Durable event order is allocated by the execution event head. */
|
|
31
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
32
32
|
readonly createdAt: number;
|
|
33
33
|
}
|
|
34
34
|
export interface DeliverResult {
|
|
@@ -64,9 +64,9 @@ export interface SignalDependencies {
|
|
|
64
64
|
readonly makeExecutionClient: ExecutionClientFactory;
|
|
65
65
|
readonly executionRepository: ExecutionRepository.Service["Service"];
|
|
66
66
|
}
|
|
67
|
-
export declare const layer: Layer.Layer<Service, never, EnvelopeRepository.Service | InboxRepository.Service |
|
|
68
|
-
export declare const layerWithSignal: (dependencies: SignalDependencies) => Layer.Layer<Service, never, EnvelopeRepository.Service | InboxRepository.Service |
|
|
69
|
-
export declare const memoryLayer: Layer.Layer<Service, never,
|
|
67
|
+
export declare const layer: Layer.Layer<Service, never, EnvelopeRepository.Service | InboxRepository.Service | WaitService>;
|
|
68
|
+
export declare const layerWithSignal: (dependencies: SignalDependencies) => Layer.Layer<Service, never, EnvelopeRepository.Service | InboxRepository.Service | WaitService>;
|
|
69
|
+
export declare const memoryLayer: Layer.Layer<Service | InboxRepository.Service | ExecutionEventRepository.Service, never, WaitService>;
|
|
70
70
|
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
71
71
|
export declare const deliver: (input: DeliverInput) => Effect.Effect<DeliverResult, InboxDeliveryError, Service>;
|
|
72
72
|
export declare const ensureReplyWait: (input: EnsureReplyWaitInput) => Effect.Effect<void, InboxDeliveryError, Service>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schedule } from "../../schema/index";
|
|
2
2
|
import { ExecutionRepository, ScheduleRepository } from "../../store-sql/portable";
|
|
3
3
|
import { Config, Context, Cron, Effect, Layer, Option, Schema } from "effect";
|
|
4
|
-
import { Service as EventLogService } from "../execution/event-log-service";
|
|
5
4
|
import { Service as WaitServiceService } from "../wait/wait-service";
|
|
6
5
|
declare const SchedulerError_base: Schema.Class<SchedulerError, Schema.TaggedStruct<"SchedulerError", {
|
|
7
6
|
readonly message: Schema.String;
|
|
@@ -26,9 +25,9 @@ export declare const enabledConfig: Config.Config<boolean>;
|
|
|
26
25
|
export declare const workerIdConfig: Config.Config<Option.Option<string>>;
|
|
27
26
|
export declare const parseCron: (cronExpr: string) => Effect.Effect<Cron.Cron, ScheduleCronInvalid>;
|
|
28
27
|
export declare const startIdempotencyKey: (schedule: Schedule.ScheduleRecord) => string;
|
|
29
|
-
export declare const make: Effect.Effect<Interface, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service |
|
|
30
|
-
export declare const layer: Layer.Layer<Service, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service |
|
|
31
|
-
export declare const memoryLayer: Layer.Layer<Service, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service |
|
|
28
|
+
export declare const make: Effect.Effect<Interface, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service | WaitServiceService | import("effect/unstable/cluster/Sharding").Sharding>;
|
|
29
|
+
export declare const layer: Layer.Layer<Service, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service | WaitServiceService | import("effect/unstable/cluster/Sharding").Sharding>;
|
|
30
|
+
export declare const memoryLayer: Layer.Layer<Service, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service | WaitServiceService | import("effect/unstable/cluster/Sharding").Sharding>;
|
|
32
31
|
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
33
32
|
export declare const runOnce: () => Effect.Effect<number, SchedulerError, Service>;
|
|
34
33
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ids, Shared, State } from "../../schema/index";
|
|
2
|
-
import { ExecutionStateRepository } from "../../store-sql/portable";
|
|
2
|
+
import { ExecutionEventRepository, ExecutionRepository, ExecutionStateRepository } from "../../store-sql/portable";
|
|
3
3
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
4
|
import { Service as BlobStoreService } from "../content/blob-store-service";
|
|
5
5
|
export declare const StateVersionConflict: typeof ExecutionStateRepository.StateVersionConflict;
|
|
@@ -55,6 +55,6 @@ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/stat
|
|
|
55
55
|
export declare class Service extends Service_base {
|
|
56
56
|
}
|
|
57
57
|
export declare const layer: Layer.Layer<Service, never, ExecutionStateRepository.Service | BlobStoreService>;
|
|
58
|
-
export declare const memoryLayer: Layer.Layer<Service, never, BlobStoreService>;
|
|
58
|
+
export declare const memoryLayer: Layer.Layer<Service | ExecutionStateRepository.Service | ExecutionRepository.Service | ExecutionEventRepository.Service, never, BlobStoreService>;
|
|
59
59
|
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
60
60
|
export {};
|
|
@@ -100,6 +100,8 @@ export interface PlacedToolOptions {
|
|
|
100
100
|
export type ToolkitRegistrationOptions = ToolkitToolOptions | ((tool: AiTool.Any) => ToolkitToolOptions);
|
|
101
101
|
export interface RunInput {
|
|
102
102
|
readonly executionId: Ids.ExecutionId;
|
|
103
|
+
readonly operationId: string;
|
|
104
|
+
readonly resumedPermissionWaitId?: Ids.WaitId;
|
|
103
105
|
readonly call: Tool.Call;
|
|
104
106
|
readonly permissions: ReadonlyArray<Tool.Permission>;
|
|
105
107
|
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
@@ -2,8 +2,14 @@ import { Ids } from "../../schema/index";
|
|
|
2
2
|
export type ToolWaitKind = "approval" | "permission" | "tool";
|
|
3
3
|
declare const eventId: (executionId: Ids.ExecutionId, toolCallId: Ids.ToolCallId | string, kind: "tool-requested" | "tool-result" | "approval-requested" | "approval-resolved" | "permission-requested" | "permission-resolved") => string & import("effect/Brand").Brand<"Relay.EventId">;
|
|
4
4
|
declare const waitId: (kind: ToolWaitKind, executionId: Ids.ExecutionId, toolCallId: Ids.ToolCallId | string) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
5
|
+
declare const permissionWaitId: (executionId: Ids.ExecutionId, operationId: string, toolCallId: Ids.ToolCallId | string) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
6
|
+
declare const permissionEventId: (executionId: Ids.ExecutionId, operationId: string, toolCallId: Ids.ToolCallId | string, kind: "requested" | "resolved") => string & import("effect/Brand").Brand<"Relay.EventId">;
|
|
7
|
+
declare const permissionEventIdForWait: (permissionWait: Ids.WaitId | string, kind: "requested" | "resolved") => string & import("effect/Brand").Brand<"Relay.EventId">;
|
|
5
8
|
export declare const Identifiers: {
|
|
6
9
|
eventId: typeof eventId;
|
|
10
|
+
permissionEventId: typeof permissionEventId;
|
|
11
|
+
permissionEventIdForWait: typeof permissionEventIdForWait;
|
|
12
|
+
permissionWaitId: typeof permissionWaitId;
|
|
7
13
|
waitId: typeof waitId;
|
|
8
14
|
};
|
|
9
15
|
export {};
|
|
@@ -24,7 +24,7 @@ export declare class WaitServiceError extends WaitServiceError_base {
|
|
|
24
24
|
export interface CreateWaitInput {
|
|
25
25
|
readonly waitId: Ids.WaitId;
|
|
26
26
|
readonly envelope: Envelope.Envelope;
|
|
27
|
-
readonly eventSequence
|
|
27
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
28
28
|
}
|
|
29
29
|
export interface CreateDetachedWaitInput {
|
|
30
30
|
readonly waitId: Ids.WaitId;
|
|
@@ -33,25 +33,25 @@ export interface CreateDetachedWaitInput {
|
|
|
33
33
|
readonly correlationKey?: string;
|
|
34
34
|
readonly metadata?: Shared.Metadata;
|
|
35
35
|
readonly timeout?: string;
|
|
36
|
-
readonly eventSequence
|
|
36
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
37
37
|
readonly createdAt: number;
|
|
38
38
|
}
|
|
39
39
|
export interface WakeInput {
|
|
40
40
|
readonly waitId: Ids.WaitId;
|
|
41
41
|
readonly resolvedAt: number;
|
|
42
|
-
readonly eventSequence
|
|
42
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
43
43
|
readonly metadata?: Shared.Metadata;
|
|
44
44
|
}
|
|
45
45
|
export interface TimeoutInput {
|
|
46
46
|
readonly waitId: Ids.WaitId;
|
|
47
47
|
readonly timedOutAt: number;
|
|
48
|
-
readonly eventSequence
|
|
48
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
49
49
|
readonly metadata?: Shared.Metadata;
|
|
50
50
|
}
|
|
51
51
|
export interface CancelWaitInput {
|
|
52
52
|
readonly waitId: Ids.WaitId;
|
|
53
53
|
readonly cancelledAt: number;
|
|
54
|
-
readonly eventSequence
|
|
54
|
+
readonly eventSequence?: Execution.ExecutionEventSequence;
|
|
55
55
|
readonly metadata?: Shared.Metadata;
|
|
56
56
|
}
|
|
57
57
|
export interface WaitTransition {
|
|
@@ -6,7 +6,6 @@ import { Cause, Effect, Layer, Option, Schema } from "effect";
|
|
|
6
6
|
import { AgentLoopBudgetExceeded, AgentLoopError } from "../agent/agent-loop-error";
|
|
7
7
|
import { Service as AgentLoopService } from "../agent/agent-loop-service";
|
|
8
8
|
import { ChildTerminalStatus } from "../child/parent-notifier-service";
|
|
9
|
-
import { Service as EventLogService } from "../execution/event-log-service";
|
|
10
9
|
import { Service as ToolRuntimeService } from "../tool/tool-runtime-service";
|
|
11
10
|
import { Service as ToolTransitionCoordinatorService } from "../tool/tool-transition-coordinator";
|
|
12
11
|
declare const ExecutionWorkflowFailed_base: Schema.Class<ExecutionWorkflowFailed, Schema.TaggedStruct<"ExecutionWorkflowFailed", {
|
|
@@ -523,7 +522,7 @@ export declare const sessionEntryScope: {
|
|
|
523
522
|
(input: StartInput, turn: number): string;
|
|
524
523
|
(turn: number): (input: StartInput) => string;
|
|
525
524
|
};
|
|
526
|
-
export declare const layer: Layer.Layer<never, never, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service |
|
|
525
|
+
export declare const layer: Layer.Layer<never, never, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service | import("../wait/wait-service").Service | ToolRuntimeService | import("../address/address-resolution-service").Service | import("../skill/skill-registry-service").Service | import("../execution/execution-service").Service | ToolTransitionCoordinatorService | import("../workspace/workspace-planner-service").Service | AgentLoopService | WorkflowEngine.WorkflowEngine>;
|
|
527
526
|
interface StartOptions<Discard extends boolean> {
|
|
528
527
|
readonly discard?: Discard;
|
|
529
528
|
}
|
|
@@ -536,7 +535,7 @@ export declare const dispatchRequest: (input: StartInput) => Effect.Effect<void,
|
|
|
536
535
|
export declare const cancelRequest: (input: CancelExecutionInput) => Effect.Effect<{
|
|
537
536
|
execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
538
537
|
status: "cancelled" | "completed" | "failed" | "queued" | "running" | "waiting";
|
|
539
|
-
}, ExecutionWorkflowFailed, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service |
|
|
538
|
+
}, ExecutionWorkflowFailed, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service | import("../wait/wait-service").Service | import("../execution/execution-service").Service | ToolTransitionCoordinatorService | WorkflowEngine.WorkflowEngine>;
|
|
540
539
|
export declare const poll: (executionId: string) => Effect.Effect<Option.Option<Workflow.Result<{
|
|
541
540
|
readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
542
541
|
readonly status: "cancelled" | "completed" | "failed" | "queued" | "running" | "waiting";
|
|
@@ -26,6 +26,7 @@ export declare class WorkspacePlannerError extends WorkspacePlannerError_base {
|
|
|
26
26
|
}
|
|
27
27
|
export interface EnsureInput {
|
|
28
28
|
readonly executionId: Ids.ExecutionId;
|
|
29
|
+
readonly operationId: string;
|
|
29
30
|
readonly agent: Agent.Definition;
|
|
30
31
|
readonly toolDefinitions: ReadonlyArray<Tool.Definition>;
|
|
31
32
|
readonly request?: Workspace.WorkspaceRequest;
|
|
@@ -38,6 +39,7 @@ export interface WorkspacePlan {
|
|
|
38
39
|
export interface LifecycleInput {
|
|
39
40
|
readonly executionId: Ids.ExecutionId;
|
|
40
41
|
readonly now: number;
|
|
42
|
+
readonly operationKey?: string;
|
|
41
43
|
}
|
|
42
44
|
export interface FailureInput extends LifecycleInput {
|
|
43
45
|
readonly metadata?: Shared.Metadata;
|
|
@@ -921,6 +921,7 @@ export declare const Definition: Schema.Union<readonly [Schema.Struct<{
|
|
|
921
921
|
}>]>;
|
|
922
922
|
export type Definition = typeof Definition.Type;
|
|
923
923
|
export declare const canonicalDefinition: (definition: Definition) => string;
|
|
924
|
+
export declare const sha256String: (value: string) => string;
|
|
924
925
|
export declare const digestDefinition: (definition: Definition) => DefinitionDigest;
|
|
925
926
|
export declare const DefinitionRevisionRecord: Schema.Struct<{
|
|
926
927
|
readonly id: Schema.brand<Schema.String, "Relay.WorkflowDefinitionId"> & {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
declare const ArchiveCompressionError_base: Schema.Class<ArchiveCompressionError, Schema.TaggedStruct<"ArchiveCompressionError", {
|
|
3
|
+
readonly reason: Schema.Literals<readonly ["invalid-stream", "limit-exceeded"]>;
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
}>, import("effect/Cause").YieldableError>;
|
|
6
|
+
export declare class ArchiveCompressionError extends ArchiveCompressionError_base {
|
|
7
|
+
}
|
|
8
|
+
export declare const collectBoundedBytes: (readable: ReadableStream<Uint8Array<ArrayBufferLike>>, maximumOutputBytes: number) => Effect.Effect<Uint8Array<ArrayBuffer>, ArchiveCompressionError, never>;
|
|
9
|
+
export declare const compressGzip: (bytes: Uint8Array<ArrayBufferLike>, maximumOutputBytes: number) => Effect.Effect<Uint8Array<ArrayBuffer>, ArchiveCompressionError, never>;
|
|
10
|
+
export declare const decompressGzip: (bytes: Uint8Array<ArrayBufferLike>, maximumOutputBytes: number) => Effect.Effect<Uint8Array<ArrayBuffer>, ArchiveCompressionError, never>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Crypto, Layer, Path } from "effect";
|
|
2
|
+
import { FileSystem } from "effect/FileSystem";
|
|
3
|
+
import { Service } from "./event-history-store";
|
|
4
|
+
export interface Options {
|
|
5
|
+
readonly rootDirectory: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const layer: (options: Options) => Layer.Layer<Service, never, FileSystem | Crypto.Crypto | Path.Path>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Context, Crypto, Effect, Layer, Schema } from "effect";
|
|
2
|
+
export declare const maximumHistoryObjectBytes: number;
|
|
3
|
+
export declare const StoredHistoryObject: Schema.Struct<{
|
|
4
|
+
readonly key: Schema.String;
|
|
5
|
+
readonly checksum: Schema.String;
|
|
6
|
+
readonly size: Schema.Int;
|
|
7
|
+
}>;
|
|
8
|
+
export interface StoredHistoryObject extends Schema.Schema.Type<typeof StoredHistoryObject> {
|
|
9
|
+
}
|
|
10
|
+
export declare const ByteRange: Schema.Struct<{
|
|
11
|
+
readonly offset: Schema.Int;
|
|
12
|
+
readonly length: Schema.Int;
|
|
13
|
+
}>;
|
|
14
|
+
export interface ByteRange extends Schema.Schema.Type<typeof ByteRange> {
|
|
15
|
+
}
|
|
16
|
+
export interface PutImmutableInput {
|
|
17
|
+
readonly bytes: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
export type HistoryObjectStat = {
|
|
20
|
+
readonly exists: false;
|
|
21
|
+
} | {
|
|
22
|
+
readonly exists: true;
|
|
23
|
+
readonly size: number;
|
|
24
|
+
};
|
|
25
|
+
declare const HistoryObjectNotFound_base: Schema.Class<HistoryObjectNotFound, Schema.TaggedStruct<"HistoryObjectNotFound", {
|
|
26
|
+
readonly key: Schema.String;
|
|
27
|
+
}>, import("effect/Cause").YieldableError>;
|
|
28
|
+
export declare class HistoryObjectNotFound extends HistoryObjectNotFound_base {
|
|
29
|
+
}
|
|
30
|
+
declare const HistoryObjectIntegrityError_base: Schema.Class<HistoryObjectIntegrityError, Schema.TaggedStruct<"HistoryObjectIntegrityError", {
|
|
31
|
+
readonly key: Schema.String;
|
|
32
|
+
readonly reason: Schema.Literals<readonly ["size-mismatch", "checksum-mismatch"]>;
|
|
33
|
+
}>, import("effect/Cause").YieldableError>;
|
|
34
|
+
export declare class HistoryObjectIntegrityError extends HistoryObjectIntegrityError_base {
|
|
35
|
+
}
|
|
36
|
+
declare const HistoryObjectSizeError_base: Schema.Class<HistoryObjectSizeError, Schema.TaggedStruct<"HistoryObjectSizeError", {
|
|
37
|
+
readonly operation: Schema.Literals<readonly ["put", "read", "delete"]>;
|
|
38
|
+
readonly source: Schema.Literals<readonly ["input", "descriptor", "stored"]>;
|
|
39
|
+
readonly size: Schema.Int;
|
|
40
|
+
readonly limit: Schema.Int;
|
|
41
|
+
}>, import("effect/Cause").YieldableError>;
|
|
42
|
+
export declare class HistoryObjectSizeError extends HistoryObjectSizeError_base {
|
|
43
|
+
}
|
|
44
|
+
declare const HistoryWriteError_base: Schema.Class<HistoryWriteError, Schema.TaggedStruct<"HistoryWriteError", {
|
|
45
|
+
readonly message: Schema.String;
|
|
46
|
+
}>, import("effect/Cause").YieldableError>;
|
|
47
|
+
export declare class HistoryWriteError extends HistoryWriteError_base {
|
|
48
|
+
}
|
|
49
|
+
declare const HistoryReadError_base: Schema.Class<HistoryReadError, Schema.TaggedStruct<"HistoryReadError", {
|
|
50
|
+
readonly reason: Schema.Literals<readonly ["invalid-range", "io"]>;
|
|
51
|
+
readonly message: Schema.String;
|
|
52
|
+
}>, import("effect/Cause").YieldableError>;
|
|
53
|
+
export declare class HistoryReadError extends HistoryReadError_base {
|
|
54
|
+
}
|
|
55
|
+
declare const HistoryDeleteError_base: Schema.Class<HistoryDeleteError, Schema.TaggedStruct<"HistoryDeleteError", {
|
|
56
|
+
readonly message: Schema.String;
|
|
57
|
+
}>, import("effect/Cause").YieldableError>;
|
|
58
|
+
export declare class HistoryDeleteError extends HistoryDeleteError_base {
|
|
59
|
+
}
|
|
60
|
+
declare const HistoryDurabilityError_base: Schema.Class<HistoryDurabilityError, Schema.TaggedStruct<"HistoryDurabilityError", {
|
|
61
|
+
readonly operation: Schema.Literals<readonly ["put", "delete"]>;
|
|
62
|
+
readonly directory: Schema.String;
|
|
63
|
+
readonly reason: Schema.Literals<readonly ["BadArgument", "AlreadyExists", "BadResource", "Busy", "InvalidData", "NotFound", "PermissionDenied", "TimedOut", "UnexpectedEof", "Unknown", "WouldBlock", "WriteZero"]>;
|
|
64
|
+
readonly message: Schema.String;
|
|
65
|
+
}>, import("effect/Cause").YieldableError>;
|
|
66
|
+
export declare class HistoryDurabilityError extends HistoryDurabilityError_base {
|
|
67
|
+
}
|
|
68
|
+
export type ReadFailure = HistoryObjectNotFound | HistoryObjectIntegrityError | HistoryObjectSizeError | HistoryReadError;
|
|
69
|
+
export type PutFailure = HistoryObjectSizeError | HistoryWriteError | HistoryDurabilityError;
|
|
70
|
+
export type DeleteFailure = HistoryObjectIntegrityError | HistoryObjectSizeError | HistoryDeleteError | HistoryDurabilityError;
|
|
71
|
+
export interface Interface {
|
|
72
|
+
readonly putImmutable: (input: PutImmutableInput) => Effect.Effect<StoredHistoryObject, PutFailure>;
|
|
73
|
+
readonly read: (object: StoredHistoryObject, range?: ByteRange) => Effect.Effect<Uint8Array, ReadFailure>;
|
|
74
|
+
readonly stat: (object: StoredHistoryObject) => Effect.Effect<HistoryObjectStat, HistoryObjectSizeError | HistoryReadError>;
|
|
75
|
+
readonly delete: (object: StoredHistoryObject) => Effect.Effect<void, DeleteFailure>;
|
|
76
|
+
}
|
|
77
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/execution/event-history-store/Service", Interface>;
|
|
78
|
+
export declare class Service extends Service_base {
|
|
79
|
+
}
|
|
80
|
+
export declare const validateHistoryObjectSize: (operation: "delete" | "put" | "read", source: "descriptor" | "input" | "stored", size: number | bigint) => Effect.Effect<number, HistoryObjectSizeError, never>;
|
|
81
|
+
export declare const describeBytes: (crypto: Crypto.Crypto, bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<Schema.Struct.ReadonlySide<{
|
|
82
|
+
readonly key: Schema.String;
|
|
83
|
+
readonly checksum: Schema.String;
|
|
84
|
+
readonly size: Schema.Int;
|
|
85
|
+
}, "Type">, import("effect/PlatformError").PlatformError, never>;
|
|
86
|
+
export declare const readRange: (crypto: Crypto.Crypto, object: StoredHistoryObject, bytes: Uint8Array<ArrayBufferLike>, range?: ByteRange | undefined) => Effect.Effect<Uint8Array<ArrayBuffer>, HistoryObjectIntegrityError | HistoryReadError, never>;
|
|
87
|
+
export declare const memoryLayer: Layer.Layer<Service, never, Crypto.Crypto>;
|
|
88
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service>;
|
|
89
|
+
export declare const putImmutable: (input: PutImmutableInput) => Effect.Effect<StoredHistoryObject, PutFailure, Service>;
|
|
90
|
+
export declare const read: (object: StoredHistoryObject, range?: ByteRange | undefined) => Effect.Effect<Uint8Array<ArrayBufferLike>, ReadFailure, Service>;
|
|
91
|
+
export declare const stat: (object: StoredHistoryObject) => Effect.Effect<HistoryObjectStat, HistoryObjectSizeError | HistoryReadError, Service>;
|
|
92
|
+
export declare const deleteObject: (object: StoredHistoryObject) => Effect.Effect<void, DeleteFailure, Service>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Execution } from "../../schema/index";
|
|
2
|
+
import { Crypto, Effect, Schema } from "effect";
|
|
3
|
+
export declare const maximumArchiveBlockBytes: number;
|
|
4
|
+
export declare const maximumArchivePayloadBytes: number;
|
|
5
|
+
export declare const maximumArchiveBlockEventCount = 4096;
|
|
6
|
+
declare const Metadata: Schema.Union<readonly [Schema.Struct<{
|
|
7
|
+
readonly format: Schema.Literal<"relay.execution-event-archive-block">;
|
|
8
|
+
readonly encoding: Schema.Literal<"json">;
|
|
9
|
+
readonly execution_id: Schema.String;
|
|
10
|
+
readonly first_sequence: Schema.Int;
|
|
11
|
+
readonly last_sequence: Schema.Int;
|
|
12
|
+
readonly event_count: Schema.Int;
|
|
13
|
+
readonly checksum: Schema.String;
|
|
14
|
+
readonly version: Schema.Literal<1>;
|
|
15
|
+
readonly compression: Schema.Literal<"none">;
|
|
16
|
+
readonly payload_bytes: Schema.Int;
|
|
17
|
+
}>, Schema.Struct<{
|
|
18
|
+
readonly format: Schema.Literal<"relay.execution-event-archive-block">;
|
|
19
|
+
readonly encoding: Schema.Literal<"json">;
|
|
20
|
+
readonly execution_id: Schema.String;
|
|
21
|
+
readonly first_sequence: Schema.Int;
|
|
22
|
+
readonly last_sequence: Schema.Int;
|
|
23
|
+
readonly event_count: Schema.Int;
|
|
24
|
+
readonly checksum: Schema.String;
|
|
25
|
+
readonly version: Schema.Literal<2>;
|
|
26
|
+
readonly compression: Schema.Literal<"gzip">;
|
|
27
|
+
readonly compressed_bytes: Schema.Int;
|
|
28
|
+
readonly uncompressed_bytes: Schema.Int;
|
|
29
|
+
}>]>;
|
|
30
|
+
export type Metadata = Schema.Schema.Type<typeof Metadata>;
|
|
31
|
+
export interface DecodedBlock {
|
|
32
|
+
readonly metadata: Metadata;
|
|
33
|
+
readonly events: ReadonlyArray<Execution.ExecutionEvent>;
|
|
34
|
+
}
|
|
35
|
+
declare const ArchiveBlockCodecError_base: Schema.Class<ArchiveBlockCodecError, Schema.TaggedStruct<"ArchiveBlockCodecError", {
|
|
36
|
+
readonly reason: Schema.Literals<readonly ["invalid-events", "invalid-header", "invalid-framing", "limit-exceeded", "truncated", "checksum-mismatch", "invalid-payload"]>;
|
|
37
|
+
readonly message: Schema.String;
|
|
38
|
+
}>, import("effect/Cause").YieldableError>;
|
|
39
|
+
export declare class ArchiveBlockCodecError extends ArchiveBlockCodecError_base {
|
|
40
|
+
}
|
|
41
|
+
export declare const encodeBlock: (input: readonly Execution.ExecutionEvent[]) => Effect.Effect<Uint8Array<ArrayBuffer>, ArchiveBlockCodecError, Crypto.Crypto>;
|
|
42
|
+
export declare const decodeBlock: (block: Uint8Array<ArrayBufferLike>) => Effect.Effect<{
|
|
43
|
+
metadata: Schema.Struct.ReadonlySide<{
|
|
44
|
+
readonly format: Schema.Literal<"relay.execution-event-archive-block">;
|
|
45
|
+
readonly encoding: Schema.Literal<"json">;
|
|
46
|
+
readonly execution_id: Schema.String;
|
|
47
|
+
readonly first_sequence: Schema.Int;
|
|
48
|
+
readonly last_sequence: Schema.Int;
|
|
49
|
+
readonly event_count: Schema.Int;
|
|
50
|
+
readonly checksum: Schema.String;
|
|
51
|
+
readonly version: Schema.Literal<1>;
|
|
52
|
+
readonly compression: Schema.Literal<"none">;
|
|
53
|
+
readonly payload_bytes: Schema.Int;
|
|
54
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
55
|
+
readonly format: Schema.Literal<"relay.execution-event-archive-block">;
|
|
56
|
+
readonly encoding: Schema.Literal<"json">;
|
|
57
|
+
readonly execution_id: Schema.String;
|
|
58
|
+
readonly first_sequence: Schema.Int;
|
|
59
|
+
readonly last_sequence: Schema.Int;
|
|
60
|
+
readonly event_count: Schema.Int;
|
|
61
|
+
readonly checksum: Schema.String;
|
|
62
|
+
readonly version: Schema.Literal<2>;
|
|
63
|
+
readonly compression: Schema.Literal<"gzip">;
|
|
64
|
+
readonly compressed_bytes: Schema.Int;
|
|
65
|
+
readonly uncompressed_bytes: Schema.Int;
|
|
66
|
+
}, "Type">;
|
|
67
|
+
events: readonly Execution.ExecutionEvent[];
|
|
68
|
+
}, ArchiveBlockCodecError, Crypto.Crypto>;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Execution, Ids } from "../../schema/index";
|
|
2
|
+
import { Crypto, Effect, Layer } from "effect";
|
|
3
|
+
import { Service as EventHistoryStore } from "./event-history-store";
|
|
4
|
+
import { Service as MemoryEventHeadService } from "./execution-event-head-memory";
|
|
5
|
+
import { Service as EventRepositoryService } from "./execution-event-repository";
|
|
6
|
+
import type { ArchiveIntegrityError, ArchiveGenerationConflict, ArchiveHeadNotFound, ArchiveManifestInvalid, ArchivePublicationStale, ArchiveRepositoryError, Manifest, PublicationInput, Service } from "./execution-event-archive-repository";
|
|
7
|
+
export declare const makeMemoryLayer: (repository: {
|
|
8
|
+
readonly validatePublication: typeof import("./execution-event-archive-repository").validatePublication;
|
|
9
|
+
readonly verifyPublication: (input: PublicationInput) => Effect.Effect<{
|
|
10
|
+
readonly input: PublicationInput;
|
|
11
|
+
readonly events: ReadonlyArray<Execution.ExecutionEvent>;
|
|
12
|
+
}, ArchiveManifestInvalid, import("./event-history-store").Service | import("effect").Crypto.Crypto>;
|
|
13
|
+
readonly ArchiveIntegrityError: typeof ArchiveIntegrityError;
|
|
14
|
+
readonly ArchiveGenerationConflict: typeof ArchiveGenerationConflict;
|
|
15
|
+
readonly ArchiveHeadNotFound: typeof ArchiveHeadNotFound;
|
|
16
|
+
readonly ArchiveManifestInvalid: typeof ArchiveManifestInvalid;
|
|
17
|
+
readonly ArchivePublicationStale: typeof ArchivePublicationStale;
|
|
18
|
+
readonly ArchiveRepositoryError: typeof ArchiveRepositoryError;
|
|
19
|
+
readonly Service: typeof Service;
|
|
20
|
+
}, restored?: {
|
|
21
|
+
readonly manifests?: ReadonlyArray<Manifest>;
|
|
22
|
+
readonly pointers?: ReadonlyArray<{
|
|
23
|
+
readonly tenantId: Ids.TenantId;
|
|
24
|
+
readonly executionId: Ids.ExecutionId;
|
|
25
|
+
readonly generation: number | null;
|
|
26
|
+
readonly archivedThrough: number | null;
|
|
27
|
+
}>;
|
|
28
|
+
}) => Layer.Layer<Service, never, Crypto.Crypto | MemoryEventHeadService | EventRepositoryService | EventHistoryStore>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Crypto, Effect, Layer } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
3
|
+
import { Service as EventHistoryStore } from "./event-history-store";
|
|
4
|
+
import type { ArchiveIntegrityError, ArchiveGenerationConflict, ArchiveHeadNotFound, ArchiveManifestInvalid, ArchivePublicationStale, ArchiveRepositoryError, PublicationInput, Service } from "./execution-event-archive-repository";
|
|
5
|
+
export declare const makeLayer: (repository: {
|
|
6
|
+
readonly validatePublication: typeof import("./execution-event-archive-repository").validatePublication;
|
|
7
|
+
readonly verifyPublication: (input: PublicationInput) => Effect.Effect<{
|
|
8
|
+
readonly input: PublicationInput;
|
|
9
|
+
readonly events: ReadonlyArray<import("../../schema/index").Execution.ExecutionEvent>;
|
|
10
|
+
}, ArchiveManifestInvalid, import("./event-history-store").Service | import("effect").Crypto.Crypto>;
|
|
11
|
+
readonly ArchiveIntegrityError: typeof ArchiveIntegrityError;
|
|
12
|
+
readonly ArchiveGenerationConflict: typeof ArchiveGenerationConflict;
|
|
13
|
+
readonly ArchiveHeadNotFound: typeof ArchiveHeadNotFound;
|
|
14
|
+
readonly ArchiveManifestInvalid: typeof ArchiveManifestInvalid;
|
|
15
|
+
readonly ArchivePublicationStale: typeof ArchivePublicationStale;
|
|
16
|
+
readonly ArchiveRepositoryError: typeof ArchiveRepositoryError;
|
|
17
|
+
readonly Manifest: typeof import("./execution-event-archive-repository").Manifest;
|
|
18
|
+
readonly Service: typeof Service;
|
|
19
|
+
}) => Layer.Layer<Service, never, Crypto.Crypto | EventHistoryStore | SqlClient>;
|