@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 { Envelope, Execution, Ids, Shared } from "../../schema/index";
|
|
2
|
+
import { EnvelopeRepository, ScheduleRepository } from "../../store-sql/index";
|
|
3
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
+
import * as EventLog from "../execution/event-log-service";
|
|
5
|
+
declare const WaitNotFound_base: Schema.Class<WaitNotFound, Schema.TaggedStruct<"WaitNotFound", {
|
|
6
|
+
readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
7
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
8
|
+
};
|
|
9
|
+
}>, import("effect/Cause").YieldableError>;
|
|
10
|
+
export declare class WaitNotFound extends WaitNotFound_base {
|
|
11
|
+
}
|
|
12
|
+
declare const WaitDefinitionMissing_base: Schema.Class<WaitDefinitionMissing, Schema.TaggedStruct<"WaitDefinitionMissing", {
|
|
13
|
+
readonly envelope_id: Schema.brand<Schema.String, "Relay.EnvelopeId"> & {
|
|
14
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EnvelopeId">;
|
|
15
|
+
};
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
17
|
+
export declare class WaitDefinitionMissing extends WaitDefinitionMissing_base {
|
|
18
|
+
}
|
|
19
|
+
declare const WaitServiceError_base: Schema.Class<WaitServiceError, Schema.TaggedStruct<"WaitServiceError", {
|
|
20
|
+
readonly message: Schema.String;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
export declare class WaitServiceError extends WaitServiceError_base {
|
|
23
|
+
}
|
|
24
|
+
export interface CreateWaitInput {
|
|
25
|
+
readonly waitId: Ids.WaitId;
|
|
26
|
+
readonly envelope: Envelope.Envelope;
|
|
27
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateDetachedWaitInput {
|
|
30
|
+
readonly waitId: Ids.WaitId;
|
|
31
|
+
readonly executionId: Ids.ExecutionId;
|
|
32
|
+
readonly mode: Envelope.WaitMode;
|
|
33
|
+
readonly correlationKey?: string;
|
|
34
|
+
readonly metadata?: Shared.Metadata;
|
|
35
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
36
|
+
readonly createdAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface WakeInput {
|
|
39
|
+
readonly waitId: Ids.WaitId;
|
|
40
|
+
readonly resolvedAt: number;
|
|
41
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
42
|
+
readonly metadata?: Shared.Metadata;
|
|
43
|
+
}
|
|
44
|
+
export interface TimeoutInput {
|
|
45
|
+
readonly waitId: Ids.WaitId;
|
|
46
|
+
readonly timedOutAt: number;
|
|
47
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
48
|
+
readonly metadata?: Shared.Metadata;
|
|
49
|
+
}
|
|
50
|
+
export interface CancelWaitInput {
|
|
51
|
+
readonly waitId: Ids.WaitId;
|
|
52
|
+
readonly cancelledAt: number;
|
|
53
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
54
|
+
readonly metadata?: Shared.Metadata;
|
|
55
|
+
}
|
|
56
|
+
export interface WaitTransition {
|
|
57
|
+
readonly wait: EnvelopeRepository.WaitRecord;
|
|
58
|
+
readonly transitioned: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface Interface {
|
|
61
|
+
readonly create: (input: CreateWaitInput) => Effect.Effect<EnvelopeRepository.WaitRecord, WaitDefinitionMissing | WaitServiceError>;
|
|
62
|
+
readonly createDetached: (input: CreateDetachedWaitInput) => Effect.Effect<EnvelopeRepository.WaitRecord, WaitServiceError>;
|
|
63
|
+
readonly get: (id: Ids.WaitId) => Effect.Effect<EnvelopeRepository.WaitRecord | undefined, WaitServiceError>;
|
|
64
|
+
readonly wake: (input: WakeInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError>;
|
|
65
|
+
readonly timeout: (input: TimeoutInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError>;
|
|
66
|
+
readonly cancel: (input: CancelWaitInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError>;
|
|
67
|
+
}
|
|
68
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WaitService", Interface>;
|
|
69
|
+
export declare class Service extends Service_base {
|
|
70
|
+
}
|
|
71
|
+
export declare const layer: Layer.Layer<Service, never, EnvelopeRepository.Service | ScheduleRepository.Service | EventLog.Service>;
|
|
72
|
+
export declare const memoryLayer: Layer.Layer<Service, never, never>;
|
|
73
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
74
|
+
export declare const create: (input: CreateWaitInput) => Effect.Effect<EnvelopeRepository.WaitRecord, WaitDefinitionMissing | WaitServiceError, Service>;
|
|
75
|
+
export declare const createDetached: (input: CreateDetachedWaitInput) => Effect.Effect<EnvelopeRepository.WaitRecord, WaitServiceError, Service>;
|
|
76
|
+
export declare const get: (id: string & import("effect/Brand").Brand<"Relay.WaitId">) => Effect.Effect<EnvelopeRepository.WaitRecord | undefined, WaitServiceError, Service>;
|
|
77
|
+
export declare const wake: (input: WakeInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError, Service>;
|
|
78
|
+
export declare const timeout: (input: TimeoutInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError, Service>;
|
|
79
|
+
export declare const cancel: (input: CancelWaitInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError, Service>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ids } from "../../schema/index";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import * as ExecutionWorkflow from "../workflow/execution-workflow";
|
|
4
|
+
export interface ExecutionSignalClient {
|
|
5
|
+
readonly signalWait: (input: ExecutionWorkflow.SignalWaitInput) => Effect.Effect<void, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export type ExecutionClientFactory = (executionId: Ids.ExecutionId) => ExecutionSignalClient;
|
|
8
|
+
export interface SignalWorkflowWaitInput {
|
|
9
|
+
readonly makeExecutionClient: ExecutionClientFactory;
|
|
10
|
+
readonly executionId: Ids.ExecutionId;
|
|
11
|
+
readonly waitId: Ids.WaitId;
|
|
12
|
+
readonly state: ExecutionWorkflow.WaitSignalState;
|
|
13
|
+
readonly signaledAt: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const signalWorkflowWait: (input: SignalWorkflowWaitInput) => Effect.Effect<void, unknown, never>;
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { Ids } from "../../schema/index";
|
|
2
|
+
import { ExecutionRepository } from "../../store-sql/index";
|
|
3
|
+
import { Workflow } from "effect/unstable/workflow";
|
|
4
|
+
import { Effect, Layer, Option, Schema } from "effect";
|
|
5
|
+
import * as AddressResolution from "../address/address-resolution-service";
|
|
6
|
+
import * as AgentLoop from "../agent/agent-loop-service";
|
|
7
|
+
import * as EventLog from "../execution/event-log-service";
|
|
8
|
+
import * as ExecutionService from "../execution/execution-service";
|
|
9
|
+
import * as ToolRuntime from "../tool/tool-runtime-service";
|
|
10
|
+
import * as WaitService from "../wait/wait-service";
|
|
11
|
+
import * as WorkspacePlanner from "../workspace/workspace-planner-service";
|
|
12
|
+
declare const ExecutionWorkflowFailed_base: Schema.Class<ExecutionWorkflowFailed, Schema.TaggedStruct<"ExecutionWorkflowFailed", {
|
|
13
|
+
readonly message: Schema.String;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
export declare class ExecutionWorkflowFailed extends ExecutionWorkflowFailed_base {
|
|
16
|
+
}
|
|
17
|
+
export declare const StartInput: Schema.Struct<{
|
|
18
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
19
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
20
|
+
};
|
|
21
|
+
readonly root_address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
|
|
22
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
|
|
23
|
+
};
|
|
24
|
+
readonly input: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
25
|
+
readonly type: Schema.Literal<"text">;
|
|
26
|
+
readonly text: Schema.String;
|
|
27
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"structured">;
|
|
30
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
31
|
+
readonly schema_ref: Schema.optionalKey<Schema.String>;
|
|
32
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
33
|
+
}>, Schema.Struct<{
|
|
34
|
+
readonly type: Schema.Literal<"blob-reference">;
|
|
35
|
+
readonly uri: Schema.String;
|
|
36
|
+
readonly media_type: Schema.String;
|
|
37
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
38
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
39
|
+
}>, Schema.Struct<{
|
|
40
|
+
readonly type: Schema.Literal<"artifact-reference">;
|
|
41
|
+
readonly artifact_id: Schema.String;
|
|
42
|
+
readonly media_type: Schema.optionalKey<Schema.String>;
|
|
43
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
44
|
+
}>, Schema.Struct<{
|
|
45
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
46
|
+
readonly call: Schema.Struct<{
|
|
47
|
+
readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
48
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
49
|
+
};
|
|
50
|
+
readonly name: Schema.String;
|
|
51
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
52
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
53
|
+
}>;
|
|
54
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
55
|
+
}>, Schema.Struct<{
|
|
56
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
57
|
+
readonly result: Schema.Struct<{
|
|
58
|
+
readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
59
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
60
|
+
};
|
|
61
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
62
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
63
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
64
|
+
}>;
|
|
65
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
66
|
+
}>]>>>;
|
|
67
|
+
readonly event_sequence: Schema.Int;
|
|
68
|
+
readonly started_at: Schema.Int;
|
|
69
|
+
readonly completed_at: Schema.Int;
|
|
70
|
+
readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
|
|
71
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
|
|
72
|
+
}>;
|
|
73
|
+
readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
|
|
74
|
+
readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
|
|
75
|
+
readonly name: Schema.String;
|
|
76
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
77
|
+
readonly model: Schema.Struct<{
|
|
78
|
+
readonly provider: Schema.String;
|
|
79
|
+
readonly model: Schema.String;
|
|
80
|
+
readonly registration_key: Schema.optionalKey<Schema.String>;
|
|
81
|
+
readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
82
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
83
|
+
}>;
|
|
84
|
+
readonly tool_names: Schema.$Array<Schema.String>;
|
|
85
|
+
readonly permissions: Schema.$Array<Schema.Struct<{
|
|
86
|
+
readonly name: Schema.String;
|
|
87
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
88
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
89
|
+
}>>;
|
|
90
|
+
readonly child_run_presets: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
91
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
92
|
+
readonly model: Schema.optionalKey<Schema.Struct<{
|
|
93
|
+
readonly provider: Schema.String;
|
|
94
|
+
readonly model: Schema.String;
|
|
95
|
+
readonly registration_key: Schema.optionalKey<Schema.String>;
|
|
96
|
+
readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
97
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
98
|
+
}>>;
|
|
99
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
100
|
+
readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
101
|
+
readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
|
|
102
|
+
readonly mode: Schema.Literals<readonly ["share", "fork"]>;
|
|
103
|
+
readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "fresh"]>>;
|
|
104
|
+
}>>;
|
|
105
|
+
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
106
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
107
|
+
}>>>;
|
|
108
|
+
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
109
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
110
|
+
}>>;
|
|
111
|
+
readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
112
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
113
|
+
}>;
|
|
114
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
115
|
+
}>;
|
|
116
|
+
export interface StartInput extends Schema.Schema.Type<typeof StartInput> {
|
|
117
|
+
}
|
|
118
|
+
export declare const WaitSignalState: Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>;
|
|
119
|
+
export type WaitSignalState = typeof WaitSignalState.Type;
|
|
120
|
+
export declare const WaitSignal: Schema.Struct<{
|
|
121
|
+
readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
122
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
123
|
+
};
|
|
124
|
+
readonly state: Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>;
|
|
125
|
+
readonly signaled_at: Schema.Int;
|
|
126
|
+
}>;
|
|
127
|
+
export interface WaitSignal extends Schema.Schema.Type<typeof WaitSignal> {
|
|
128
|
+
}
|
|
129
|
+
export declare const SignalWaitInput: Schema.Struct<{
|
|
130
|
+
readonly workflow_execution_id: Schema.String;
|
|
131
|
+
readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
132
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
133
|
+
};
|
|
134
|
+
readonly state: Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>;
|
|
135
|
+
readonly signaled_at: Schema.Int;
|
|
136
|
+
}>;
|
|
137
|
+
export interface SignalWaitInput extends Schema.Schema.Type<typeof SignalWaitInput> {
|
|
138
|
+
}
|
|
139
|
+
export declare const CancelExecutionInput: Schema.Struct<{
|
|
140
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
141
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
142
|
+
};
|
|
143
|
+
readonly cancelled_at: Schema.Int;
|
|
144
|
+
readonly reason: Schema.optionalKey<Schema.String>;
|
|
145
|
+
}>;
|
|
146
|
+
export interface CancelExecutionInput extends Schema.Schema.Type<typeof CancelExecutionInput> {
|
|
147
|
+
}
|
|
148
|
+
export declare const CancelExecutionResult: Schema.Struct<{
|
|
149
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
150
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
151
|
+
};
|
|
152
|
+
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
|
|
153
|
+
}>;
|
|
154
|
+
export interface CancelExecutionResult extends Schema.Schema.Type<typeof CancelExecutionResult> {
|
|
155
|
+
}
|
|
156
|
+
export declare const WaitSnapshot: Schema.Struct<{
|
|
157
|
+
readonly id: Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
158
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
159
|
+
};
|
|
160
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
161
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
162
|
+
};
|
|
163
|
+
readonly envelope_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.EnvelopeId"> & {
|
|
164
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EnvelopeId">;
|
|
165
|
+
}>;
|
|
166
|
+
readonly mode: Schema.Literals<readonly ["reply", "event", "until", "child"]>;
|
|
167
|
+
readonly correlation_key: Schema.optionalKey<Schema.String>;
|
|
168
|
+
readonly state: Schema.Literals<readonly ["open", "resolved", "timed_out", "cancelled"]>;
|
|
169
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
170
|
+
readonly created_at: Schema.Int;
|
|
171
|
+
readonly resolved_at: Schema.optionalKey<Schema.Int>;
|
|
172
|
+
}>;
|
|
173
|
+
export interface WaitSnapshot extends Schema.Schema.Type<typeof WaitSnapshot> {
|
|
174
|
+
}
|
|
175
|
+
export declare const StartResult: Schema.Struct<{
|
|
176
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
177
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
178
|
+
};
|
|
179
|
+
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
|
|
180
|
+
readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
181
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
182
|
+
}>;
|
|
183
|
+
readonly wait_state: Schema.optionalKey<Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>>;
|
|
184
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
185
|
+
}>;
|
|
186
|
+
export interface StartResult extends Schema.Schema.Type<typeof StartResult> {
|
|
187
|
+
}
|
|
188
|
+
export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/Start", Schema.Struct<{
|
|
189
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
190
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
191
|
+
};
|
|
192
|
+
readonly root_address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
|
|
193
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
|
|
194
|
+
};
|
|
195
|
+
readonly input: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
196
|
+
readonly type: Schema.Literal<"text">;
|
|
197
|
+
readonly text: Schema.String;
|
|
198
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
199
|
+
}>, Schema.Struct<{
|
|
200
|
+
readonly type: Schema.Literal<"structured">;
|
|
201
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
202
|
+
readonly schema_ref: Schema.optionalKey<Schema.String>;
|
|
203
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly type: Schema.Literal<"blob-reference">;
|
|
206
|
+
readonly uri: Schema.String;
|
|
207
|
+
readonly media_type: Schema.String;
|
|
208
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
209
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
210
|
+
}>, Schema.Struct<{
|
|
211
|
+
readonly type: Schema.Literal<"artifact-reference">;
|
|
212
|
+
readonly artifact_id: Schema.String;
|
|
213
|
+
readonly media_type: Schema.optionalKey<Schema.String>;
|
|
214
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
217
|
+
readonly call: Schema.Struct<{
|
|
218
|
+
readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
219
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
220
|
+
};
|
|
221
|
+
readonly name: Schema.String;
|
|
222
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
223
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
224
|
+
}>;
|
|
225
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
226
|
+
}>, Schema.Struct<{
|
|
227
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
228
|
+
readonly result: Schema.Struct<{
|
|
229
|
+
readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
230
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
231
|
+
};
|
|
232
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
233
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
234
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
235
|
+
}>;
|
|
236
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
237
|
+
}>]>>>;
|
|
238
|
+
readonly event_sequence: Schema.Int;
|
|
239
|
+
readonly started_at: Schema.Int;
|
|
240
|
+
readonly completed_at: Schema.Int;
|
|
241
|
+
readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
|
|
242
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
|
|
243
|
+
}>;
|
|
244
|
+
readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
|
|
245
|
+
readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
|
|
246
|
+
readonly name: Schema.String;
|
|
247
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
248
|
+
readonly model: Schema.Struct<{
|
|
249
|
+
readonly provider: Schema.String;
|
|
250
|
+
readonly model: Schema.String;
|
|
251
|
+
readonly registration_key: Schema.optionalKey<Schema.String>;
|
|
252
|
+
readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
253
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
254
|
+
}>;
|
|
255
|
+
readonly tool_names: Schema.$Array<Schema.String>;
|
|
256
|
+
readonly permissions: Schema.$Array<Schema.Struct<{
|
|
257
|
+
readonly name: Schema.String;
|
|
258
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
259
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
260
|
+
}>>;
|
|
261
|
+
readonly child_run_presets: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
262
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
263
|
+
readonly model: Schema.optionalKey<Schema.Struct<{
|
|
264
|
+
readonly provider: Schema.String;
|
|
265
|
+
readonly model: Schema.String;
|
|
266
|
+
readonly registration_key: Schema.optionalKey<Schema.String>;
|
|
267
|
+
readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
268
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
269
|
+
}>>;
|
|
270
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
271
|
+
readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
272
|
+
readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
|
|
273
|
+
readonly mode: Schema.Literals<readonly ["share", "fork"]>;
|
|
274
|
+
readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "fresh"]>>;
|
|
275
|
+
}>>;
|
|
276
|
+
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
277
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
278
|
+
}>>>;
|
|
279
|
+
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
280
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
281
|
+
}>>;
|
|
282
|
+
readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
283
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
284
|
+
}>;
|
|
285
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
286
|
+
}>, Schema.Struct<{
|
|
287
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
288
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
289
|
+
};
|
|
290
|
+
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
|
|
291
|
+
readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
|
|
292
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
293
|
+
}>;
|
|
294
|
+
readonly wait_state: Schema.optionalKey<Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>>;
|
|
295
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
296
|
+
}>, typeof ExecutionWorkflowFailed>;
|
|
297
|
+
export declare const layer: Layer.Layer<never, never, ExecutionRepository.Service | AddressResolution.Service | EventLog.Service | WaitService.Service | ToolRuntime.Service | AgentLoop.Service | ExecutionService.Service | WorkspacePlanner.Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
298
|
+
export declare const start: <const Discard extends boolean = false>(input: StartInput, options?: {
|
|
299
|
+
readonly discard?: Discard;
|
|
300
|
+
}) => Effect.Effect<Discard extends true ? string : {
|
|
301
|
+
readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
302
|
+
readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
|
|
303
|
+
readonly metadata?: {
|
|
304
|
+
readonly [x: string]: Schema.Json;
|
|
305
|
+
};
|
|
306
|
+
readonly wait_id?: string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
307
|
+
readonly wait_state?: "cancelled" | "resolved" | "timed_out";
|
|
308
|
+
}, Discard extends true ? never : ExecutionWorkflowFailed, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
309
|
+
export declare const startRequest: (input: StartInput) => Effect.Effect<{
|
|
310
|
+
readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
311
|
+
readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
|
|
312
|
+
readonly metadata?: {
|
|
313
|
+
readonly [x: string]: Schema.Json;
|
|
314
|
+
};
|
|
315
|
+
readonly wait_id?: string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
316
|
+
readonly wait_state?: "cancelled" | "resolved" | "timed_out";
|
|
317
|
+
}, ExecutionWorkflowFailed, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
318
|
+
export declare const cancelRequest: (input: CancelExecutionInput) => Effect.Effect<{
|
|
319
|
+
execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
320
|
+
status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
|
|
321
|
+
}, ExecutionWorkflowFailed, ExecutionRepository.Service | EventLog.Service | WaitService.Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
322
|
+
export declare const poll: (executionId: string) => Effect.Effect<Option.Option<Workflow.Result<{
|
|
323
|
+
readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
324
|
+
readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
|
|
325
|
+
readonly metadata?: {
|
|
326
|
+
readonly [x: string]: Schema.Json;
|
|
327
|
+
};
|
|
328
|
+
readonly wait_id?: string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
329
|
+
readonly wait_state?: "cancelled" | "resolved" | "timed_out";
|
|
330
|
+
}, ExecutionWorkflowFailed>>, never, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
331
|
+
export declare const resume: (executionId: string) => Effect.Effect<void, never, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
332
|
+
export declare const workflowExecutionId: (input: StartInput) => Effect.Effect<string, never, never>;
|
|
333
|
+
export declare const workflowExecutionIdForExecution: (executionId: Ids.ExecutionId) => Effect.Effect<string, never, never>;
|
|
334
|
+
export declare const signalWait: (input: SignalWaitInput) => Effect.Effect<void, never, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
|
|
335
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Agent, Ids, Shared, Tool, Workspace } from "../../schema/index";
|
|
2
|
+
import { WorkspaceLeaseRepository } from "../../store-sql/index";
|
|
3
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
+
import * as EventLog from "../execution/event-log-service";
|
|
5
|
+
import * as WorkspaceProvider from "./workspace-provider-service";
|
|
6
|
+
import * as WorkspaceRuntime from "./workspace-runtime-service";
|
|
7
|
+
declare const WorkspaceRuntimeMissing_base: Schema.Class<WorkspaceRuntimeMissing, Schema.TaggedStruct<"WorkspaceRuntimeMissing", {
|
|
8
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
9
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
10
|
+
};
|
|
11
|
+
}>, import("effect/Cause").YieldableError>;
|
|
12
|
+
export declare class WorkspaceRuntimeMissing extends WorkspaceRuntimeMissing_base {
|
|
13
|
+
}
|
|
14
|
+
declare const WorkspaceLeaseMissingRef_base: Schema.Class<WorkspaceLeaseMissingRef, Schema.TaggedStruct<"WorkspaceLeaseMissingRef", {
|
|
15
|
+
readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
|
|
16
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
17
|
+
};
|
|
18
|
+
}>, import("effect/Cause").YieldableError>;
|
|
19
|
+
export declare class WorkspaceLeaseMissingRef extends WorkspaceLeaseMissingRef_base {
|
|
20
|
+
}
|
|
21
|
+
declare const WorkspacePlannerError_base: Schema.Class<WorkspacePlannerError, Schema.TaggedStruct<"WorkspacePlannerError", {
|
|
22
|
+
readonly message: Schema.String;
|
|
23
|
+
}>, import("effect/Cause").YieldableError>;
|
|
24
|
+
export declare class WorkspacePlannerError extends WorkspacePlannerError_base {
|
|
25
|
+
}
|
|
26
|
+
export interface EnsureInput {
|
|
27
|
+
readonly executionId: Ids.ExecutionId;
|
|
28
|
+
readonly agent: Agent.Definition;
|
|
29
|
+
readonly toolDefinitions: ReadonlyArray<Tool.Definition>;
|
|
30
|
+
readonly request?: Workspace.WorkspaceRequest;
|
|
31
|
+
readonly now: number;
|
|
32
|
+
}
|
|
33
|
+
export interface WorkspacePlan {
|
|
34
|
+
readonly lease: Workspace.WorkspaceLeaseRecord;
|
|
35
|
+
readonly runtimeLayer: Layer.Layer<WorkspaceRuntime.Service>;
|
|
36
|
+
}
|
|
37
|
+
export interface LifecycleInput {
|
|
38
|
+
readonly executionId: Ids.ExecutionId;
|
|
39
|
+
readonly now: number;
|
|
40
|
+
}
|
|
41
|
+
export interface FailureInput extends LifecycleInput {
|
|
42
|
+
readonly metadata?: Shared.Metadata;
|
|
43
|
+
}
|
|
44
|
+
export interface Interface {
|
|
45
|
+
readonly ensure: (input: EnsureInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError | WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError>;
|
|
46
|
+
readonly suspend: (input: LifecycleInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError | WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceCapabilityUnsupported | WorkspaceProvider.WorkspaceProviderError>;
|
|
47
|
+
readonly resume: (input: LifecycleInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError | WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError>;
|
|
48
|
+
readonly attach: (input: LifecycleInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError | WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError>;
|
|
49
|
+
readonly release: (input: LifecycleInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError | WorkspaceProvider.WorkspaceProviderError>;
|
|
50
|
+
readonly fail: (input: FailureInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspacePlannerError>;
|
|
51
|
+
}
|
|
52
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WorkspacePlanner", Interface>;
|
|
53
|
+
export declare class Service extends Service_base {
|
|
54
|
+
}
|
|
55
|
+
export declare const layer: Layer.Layer<Service, never, WorkspaceLeaseRepository.Service | EventLog.Service>;
|
|
56
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
57
|
+
export declare const ensure: (input: EnsureInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError | WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError, Service>;
|
|
58
|
+
export declare const suspend: (input: LifecycleInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceCapabilityUnsupported | WorkspaceProvider.WorkspaceProviderError | WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError, Service>;
|
|
59
|
+
export declare const resume: (input: LifecycleInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError | WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError, Service>;
|
|
60
|
+
export declare const attach: (input: LifecycleInput) => Effect.Effect<WorkspacePlan | undefined, WorkspaceProvider.WorkspaceNotFound | WorkspaceProvider.WorkspaceUnavailable | WorkspaceProvider.WorkspaceProviderError | WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError, Service>;
|
|
61
|
+
export declare const release: (input: LifecycleInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspaceProvider.WorkspaceProviderError | WorkspaceRuntimeMissing | WorkspaceLeaseMissingRef | WorkspacePlannerError, Service>;
|
|
62
|
+
export declare const fail: (input: FailureInput) => Effect.Effect<Workspace.WorkspaceLeaseRecord | undefined, WorkspacePlannerError, Service>;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Ids, Workspace } from "../../schema/index";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
declare const WorkspaceNotFound_base: Schema.Class<WorkspaceNotFound, Schema.TaggedStruct<"WorkspaceNotFound", {
|
|
4
|
+
readonly sandbox_ref: Schema.brand<Schema.String, "Relay.WorkspaceRef"> & {
|
|
5
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WorkspaceRef">;
|
|
6
|
+
};
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
export declare class WorkspaceNotFound extends WorkspaceNotFound_base {
|
|
9
|
+
}
|
|
10
|
+
declare const WorkspaceUnavailable_base: Schema.Class<WorkspaceUnavailable, Schema.TaggedStruct<"WorkspaceUnavailable", {
|
|
11
|
+
readonly sandbox_ref: Schema.brand<Schema.String, "Relay.WorkspaceRef"> & {
|
|
12
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WorkspaceRef">;
|
|
13
|
+
};
|
|
14
|
+
readonly message: Schema.String;
|
|
15
|
+
}>, import("effect/Cause").YieldableError>;
|
|
16
|
+
export declare class WorkspaceUnavailable extends WorkspaceUnavailable_base {
|
|
17
|
+
}
|
|
18
|
+
declare const WorkspaceCapabilityUnsupported_base: Schema.Class<WorkspaceCapabilityUnsupported, Schema.TaggedStruct<"WorkspaceCapabilityUnsupported", {
|
|
19
|
+
readonly capability: Schema.Literals<readonly ["suspend", "snapshot", "fork"]>;
|
|
20
|
+
readonly provider_key: Schema.String;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
export declare class WorkspaceCapabilityUnsupported extends WorkspaceCapabilityUnsupported_base {
|
|
23
|
+
}
|
|
24
|
+
declare const WorkspaceProviderError_base: Schema.Class<WorkspaceProviderError, Schema.TaggedStruct<"WorkspaceProviderError", {
|
|
25
|
+
readonly provider_key: Schema.String;
|
|
26
|
+
readonly message: Schema.String;
|
|
27
|
+
}>, import("effect/Cause").YieldableError>;
|
|
28
|
+
export declare class WorkspaceProviderError extends WorkspaceProviderError_base {
|
|
29
|
+
}
|
|
30
|
+
export interface WorkspaceCommandInput {
|
|
31
|
+
readonly command: string;
|
|
32
|
+
readonly args?: ReadonlyArray<string>;
|
|
33
|
+
readonly cwd?: string;
|
|
34
|
+
readonly input?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkspaceCommandResult {
|
|
37
|
+
readonly exitCode: number;
|
|
38
|
+
readonly stdout: string;
|
|
39
|
+
readonly stderr: string;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkspaceSpec {
|
|
42
|
+
readonly executionId: Ids.ExecutionId;
|
|
43
|
+
readonly request?: Workspace.WorkspaceRequest;
|
|
44
|
+
}
|
|
45
|
+
export interface WorkspaceHandle {
|
|
46
|
+
readonly ref: Ids.WorkspaceRef;
|
|
47
|
+
readonly providerKey: Workspace.WorkspaceProviderKey;
|
|
48
|
+
readonly capabilities: Workspace.WorkspaceCapabilities;
|
|
49
|
+
readonly readFile: (path: string) => Effect.Effect<string, WorkspaceNotFound | WorkspaceProviderError>;
|
|
50
|
+
readonly writeFile: (path: string, content: string) => Effect.Effect<void, WorkspaceNotFound | WorkspaceProviderError>;
|
|
51
|
+
readonly exec: (input: WorkspaceCommandInput) => Effect.Effect<WorkspaceCommandResult, WorkspaceProviderError>;
|
|
52
|
+
}
|
|
53
|
+
export interface Interface {
|
|
54
|
+
readonly providerKey: Workspace.WorkspaceProviderKey;
|
|
55
|
+
readonly capabilities: Workspace.WorkspaceCapabilities;
|
|
56
|
+
readonly acquire: (spec: WorkspaceSpec) => Effect.Effect<WorkspaceHandle, WorkspaceProviderError>;
|
|
57
|
+
readonly resume: (ref: Ids.WorkspaceRef) => Effect.Effect<WorkspaceHandle, WorkspaceNotFound | WorkspaceUnavailable | WorkspaceProviderError>;
|
|
58
|
+
readonly suspend: (ref: Ids.WorkspaceRef) => Effect.Effect<Ids.WorkspaceRef, WorkspaceNotFound | WorkspaceProviderError>;
|
|
59
|
+
readonly snapshot: (ref: Ids.WorkspaceRef, name?: string) => Effect.Effect<Ids.SnapshotRef, WorkspaceNotFound | WorkspaceCapabilityUnsupported | WorkspaceProviderError>;
|
|
60
|
+
readonly fork: (ref: Ids.WorkspaceRef, spec?: Partial<WorkspaceSpec>) => Effect.Effect<Ids.WorkspaceRef, WorkspaceNotFound | WorkspaceCapabilityUnsupported | WorkspaceProviderError>;
|
|
61
|
+
readonly destroy: (ref: Ids.WorkspaceRef) => Effect.Effect<void, WorkspaceProviderError>;
|
|
62
|
+
}
|
|
63
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WorkspaceProvider", Interface>;
|
|
64
|
+
export declare class Service extends Service_base {
|
|
65
|
+
}
|
|
66
|
+
export declare const memoryHandle: (ref: Ids.WorkspaceRef, providerKey?: Workspace.WorkspaceProviderKey) => WorkspaceHandle;
|
|
67
|
+
export declare const memoryLayer: (providerKey?: Workspace.WorkspaceProviderKey) => Layer.Layer<Service, never, never>;
|
|
68
|
+
export interface DaytonaSandbox {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
state?: string;
|
|
71
|
+
readonly start: () => Effect.Effect<void, WorkspaceProviderError>;
|
|
72
|
+
readonly stop: () => Effect.Effect<void, WorkspaceProviderError>;
|
|
73
|
+
readonly readFile?: (path: string) => Effect.Effect<string, WorkspaceProviderError>;
|
|
74
|
+
readonly writeFile?: (path: string, content: string) => Effect.Effect<void, WorkspaceProviderError>;
|
|
75
|
+
readonly exec?: (input: WorkspaceCommandInput) => Effect.Effect<WorkspaceCommandResult, WorkspaceProviderError>;
|
|
76
|
+
readonly createSnapshot?: (name?: string) => Effect.Effect<string, WorkspaceProviderError>;
|
|
77
|
+
readonly fork?: () => Effect.Effect<string, WorkspaceProviderError>;
|
|
78
|
+
}
|
|
79
|
+
export interface DaytonaClient {
|
|
80
|
+
readonly create: (options: Record<string, unknown>) => Effect.Effect<DaytonaSandbox, WorkspaceProviderError>;
|
|
81
|
+
readonly get: (ref: Ids.WorkspaceRef) => Effect.Effect<DaytonaSandbox, WorkspaceNotFound | WorkspaceProviderError>;
|
|
82
|
+
readonly delete: (ref: Ids.WorkspaceRef) => Effect.Effect<void, WorkspaceProviderError>;
|
|
83
|
+
}
|
|
84
|
+
export interface DaytonaLayerConfig {
|
|
85
|
+
readonly providerKey?: Workspace.WorkspaceProviderKey;
|
|
86
|
+
readonly autoArchiveInterval?: number;
|
|
87
|
+
readonly client: DaytonaClient;
|
|
88
|
+
}
|
|
89
|
+
export declare const daytonaLayer: (config: DaytonaLayerConfig) => Layer.Layer<Service, never, never>;
|
|
90
|
+
export interface LocalDockerCommand {
|
|
91
|
+
readonly args: ReadonlyArray<string>;
|
|
92
|
+
readonly input?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface LocalDockerLayerConfig {
|
|
95
|
+
readonly providerKey?: Workspace.WorkspaceProviderKey;
|
|
96
|
+
readonly defaultImage: string;
|
|
97
|
+
readonly volumePrefix: string;
|
|
98
|
+
readonly run: (command: LocalDockerCommand) => Effect.Effect<WorkspaceCommandResult, WorkspaceProviderError>;
|
|
99
|
+
}
|
|
100
|
+
export declare const localDockerLayer: (config: LocalDockerLayerConfig) => Layer.Layer<Service, never, never>;
|
|
101
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
102
|
+
export declare const acquire: (spec: WorkspaceSpec) => Effect.Effect<WorkspaceHandle, WorkspaceProviderError, Service>;
|
|
103
|
+
export declare const resume: (ref: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">) => Effect.Effect<WorkspaceHandle, WorkspaceNotFound | WorkspaceUnavailable | WorkspaceProviderError, Service>;
|
|
104
|
+
export declare const suspend: (ref: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">) => Effect.Effect<string & import("effect/Brand").Brand<"Relay.WorkspaceRef">, WorkspaceNotFound | WorkspaceProviderError, Service>;
|
|
105
|
+
export declare const snapshot: (ref: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">, name?: string | undefined) => Effect.Effect<string & import("effect/Brand").Brand<"Relay.SnapshotRef">, WorkspaceNotFound | WorkspaceCapabilityUnsupported | WorkspaceProviderError, Service>;
|
|
106
|
+
export declare const fork: (ref: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">, spec?: Partial<WorkspaceSpec> | undefined) => Effect.Effect<string & import("effect/Brand").Brand<"Relay.WorkspaceRef">, WorkspaceNotFound | WorkspaceCapabilityUnsupported | WorkspaceProviderError, Service>;
|
|
107
|
+
export declare const destroy: (ref: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">) => Effect.Effect<void, WorkspaceProviderError, Service>;
|
|
108
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
import * as WorkspaceProvider from "./workspace-provider-service";
|
|
3
|
+
declare const WorkspaceRuntimeError_base: Schema.Class<WorkspaceRuntimeError, Schema.TaggedStruct<"WorkspaceRuntimeError", {
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
}>, import("effect/Cause").YieldableError>;
|
|
6
|
+
export declare class WorkspaceRuntimeError extends WorkspaceRuntimeError_base {
|
|
7
|
+
}
|
|
8
|
+
export interface Interface {
|
|
9
|
+
readonly readFile: (path: string) => Effect.Effect<string, WorkspaceRuntimeError>;
|
|
10
|
+
readonly writeFile: (path: string, content: string) => Effect.Effect<void, WorkspaceRuntimeError>;
|
|
11
|
+
readonly exec: (input: WorkspaceProvider.WorkspaceCommandInput) => Effect.Effect<WorkspaceProvider.WorkspaceCommandResult, WorkspaceRuntimeError>;
|
|
12
|
+
}
|
|
13
|
+
declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WorkspaceRuntime", Interface>;
|
|
14
|
+
export declare class Service extends Service_base {
|
|
15
|
+
}
|
|
16
|
+
export declare const layerFromHandle: (handle: WorkspaceProvider.WorkspaceHandle) => Layer.Layer<Service, never, never>;
|
|
17
|
+
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
18
|
+
export declare const readFile: (path: string) => Effect.Effect<string, WorkspaceRuntimeError, Service>;
|
|
19
|
+
export declare const writeFile: (path: string, content: string) => Effect.Effect<void, WorkspaceRuntimeError, Service>;
|
|
20
|
+
export declare const exec: (input: WorkspaceProvider.WorkspaceCommandInput) => Effect.Effect<WorkspaceProvider.WorkspaceCommandResult, WorkspaceRuntimeError, Service>;
|
|
21
|
+
export {};
|