@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.
Files changed (73) hide show
  1. package/dist/index.js +8449 -0
  2. package/dist/migrations/20260701002839_sour_cerebro/migration.sql +160 -0
  3. package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +1971 -0
  4. package/dist/migrations/20260701041134_acoustic_hulk/migration.sql +30 -0
  5. package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +2372 -0
  6. package/dist/migrations/20260701160543_condemned_stryfe/migration.sql +2 -0
  7. package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +2442 -0
  8. package/dist/migrations/20260701220315_heavy_gorgon/migration.sql +5 -0
  9. package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +2495 -0
  10. package/dist/migrations/20260701225444_polite_lord_hawal/migration.sql +24 -0
  11. package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +2821 -0
  12. package/dist/migrations/20260702030128_flaky_misty_knight/migration.sql +1 -0
  13. package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +2821 -0
  14. package/dist/types/ai/index.d.ts +2 -0
  15. package/dist/types/ai/language-model/language-model-registration.d.ts +89 -0
  16. package/dist/types/relay/adapter-outbox.d.ts +19 -0
  17. package/dist/types/relay/client.d.ts +102 -0
  18. package/dist/types/relay/database.d.ts +11 -0
  19. package/dist/types/relay/index.d.ts +10 -0
  20. package/dist/types/relay/operation.d.ts +921 -0
  21. package/dist/types/runtime/address/address-book-service.d.ts +74 -0
  22. package/dist/types/runtime/address/address-resolution-service.d.ts +106 -0
  23. package/dist/types/runtime/agent/agent-loop-service.d.ts +53 -0
  24. package/dist/types/runtime/agent/agent-registry-service.d.ts +31 -0
  25. package/dist/types/runtime/agent/prompt-assembler-service.d.ts +102 -0
  26. package/dist/types/runtime/child/child-run-service.d.ts +90 -0
  27. package/dist/types/runtime/child/parent-notifier-service.d.ts +40 -0
  28. package/dist/types/runtime/cluster/execution-entity.d.ts +393 -0
  29. package/dist/types/runtime/content/artifact-store-service.d.ts +73 -0
  30. package/dist/types/runtime/content/blob-store-service.d.ts +87 -0
  31. package/dist/types/runtime/envelope/envelope-service.d.ts +52 -0
  32. package/dist/types/runtime/execution/event-log-service.d.ts +54 -0
  33. package/dist/types/runtime/execution/execution-service.d.ts +62 -0
  34. package/dist/types/runtime/index.d.ts +25 -0
  35. package/dist/types/runtime/model/language-model-service.d.ts +58 -0
  36. package/dist/types/runtime/model/model-call-policy.d.ts +53 -0
  37. package/dist/types/runtime/observability/runtime-metrics.d.ts +9 -0
  38. package/dist/types/runtime/runner/runner-runtime-service.d.ts +132 -0
  39. package/dist/types/runtime/schedule/scheduler-service.d.ts +34 -0
  40. package/dist/types/runtime/tool/tool-runtime-service.d.ts +85 -0
  41. package/dist/types/runtime/wait/wait-service.d.ts +80 -0
  42. package/dist/types/runtime/wait/wait-signal.d.ts +15 -0
  43. package/dist/types/runtime/workflow/execution-workflow.d.ts +335 -0
  44. package/dist/types/runtime/workspace/workspace-planner-service.d.ts +63 -0
  45. package/dist/types/runtime/workspace/workspace-provider-service.d.ts +108 -0
  46. package/dist/types/runtime/workspace/workspace-runtime-service.d.ts +21 -0
  47. package/dist/types/schema/address-schema.d.ts +77 -0
  48. package/dist/types/schema/agent-schema.d.ts +360 -0
  49. package/dist/types/schema/content-schema.d.ts +106 -0
  50. package/dist/types/schema/envelope-schema.d.ts +167 -0
  51. package/dist/types/schema/execution-schema.d.ts +297 -0
  52. package/dist/types/schema/ids-schema.d.ts +61 -0
  53. package/dist/types/schema/index.d.ts +11 -0
  54. package/dist/types/schema/schedule-schema.d.ts +73 -0
  55. package/dist/types/schema/shared-schema.d.ts +11 -0
  56. package/dist/types/schema/tool-schema.d.ts +53 -0
  57. package/dist/types/schema/workspace-schema.d.ts +78 -0
  58. package/dist/types/store-sql/address/address-book-repository.d.ts +48 -0
  59. package/dist/types/store-sql/agent/agent-definition-repository.d.ts +49 -0
  60. package/dist/types/store-sql/chat/agent-chat-repository.d.ts +31 -0
  61. package/dist/types/store-sql/child/child-execution-repository.d.ts +61 -0
  62. package/dist/types/store-sql/cluster/cluster-registry-repository.d.ts +35 -0
  63. package/dist/types/store-sql/database/database-service.d.ts +25 -0
  64. package/dist/types/store-sql/envelope/envelope-repository.d.ts +158 -0
  65. package/dist/types/store-sql/execution/execution-event-repository.d.ts +86 -0
  66. package/dist/types/store-sql/execution/execution-repository.d.ts +80 -0
  67. package/dist/types/store-sql/idempotency/idempotency-repository.d.ts +42 -0
  68. package/dist/types/store-sql/index.d.ts +15 -0
  69. package/dist/types/store-sql/schedule/schedule-repository.d.ts +83 -0
  70. package/dist/types/store-sql/schema/relay-schema.d.ts +2302 -0
  71. package/dist/types/store-sql/tool/tool-call-repository.d.ts +66 -0
  72. package/dist/types/store-sql/workspace/workspace-lease-repository.d.ts +87 -0
  73. package/package.json +44 -0
@@ -0,0 +1,74 @@
1
+ import { Address, Ids } from "../../schema/index";
2
+ import { AddressBookRepository } from "../../store-sql/index";
3
+ import { Context, Effect, Layer, Schema } from "effect";
4
+ export declare const RouteKind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
5
+ export type RouteKind = typeof RouteKind.Type;
6
+ export declare const Route: Schema.Struct<{
7
+ readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
8
+ readonly route_key: Schema.String;
9
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
10
+ }>;
11
+ export interface Route extends Address.Route {
12
+ }
13
+ export declare const RouteRecord: Schema.Struct<{
14
+ readonly id: Schema.brand<Schema.String, "Relay.AddressBookEntryId"> & {
15
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressBookEntryId">;
16
+ };
17
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
18
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
19
+ };
20
+ readonly route: Schema.Struct<{
21
+ readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
22
+ readonly route_key: Schema.String;
23
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
24
+ }>;
25
+ readonly created_at: Schema.Int;
26
+ readonly updated_at: Schema.Int;
27
+ }>;
28
+ export interface RouteRecord extends Address.RouteRecord {
29
+ }
30
+ declare const AddressNotFound_base: Schema.Class<AddressNotFound, Schema.TaggedStruct<"AddressNotFound", {
31
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
32
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
33
+ };
34
+ }>, import("effect/Cause").YieldableError>;
35
+ export declare class AddressNotFound extends AddressNotFound_base {
36
+ }
37
+ declare const AddressUnavailable_base: Schema.Class<AddressUnavailable, Schema.TaggedStruct<"AddressUnavailable", {
38
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
39
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
40
+ };
41
+ readonly route_key: Schema.String;
42
+ }>, import("effect/Cause").YieldableError>;
43
+ export declare class AddressUnavailable extends AddressUnavailable_base {
44
+ }
45
+ declare const AddressDeferred_base: Schema.Class<AddressDeferred, Schema.TaggedStruct<"AddressDeferred", {
46
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
47
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
48
+ };
49
+ readonly route_key: Schema.String;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ export declare class AddressDeferred extends AddressDeferred_base {
52
+ }
53
+ declare const AddressBookServiceError_base: Schema.Class<AddressBookServiceError, Schema.TaggedStruct<"AddressBookServiceError", {
54
+ readonly message: Schema.String;
55
+ }>, import("effect/Cause").YieldableError>;
56
+ export declare class AddressBookServiceError extends AddressBookServiceError_base {
57
+ }
58
+ export interface Interface {
59
+ readonly resolve: (addressId: Ids.AddressId) => Effect.Effect<Route, AddressNotFound | AddressUnavailable | AddressDeferred | AddressBookServiceError>;
60
+ readonly register: (addressId: Ids.AddressId, route: Route) => Effect.Effect<Address.RouteRegistered, AddressBookServiceError>;
61
+ readonly get: (addressId: Ids.AddressId) => Effect.Effect<RouteRecord | undefined, AddressBookServiceError>;
62
+ readonly list: () => Effect.Effect<Address.RouteList, AddressBookServiceError>;
63
+ }
64
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/AddressBook", Interface>;
65
+ export declare class Service extends Service_base {
66
+ }
67
+ export declare const layerFromRepository: Layer.Layer<Service, never, AddressBookRepository.Service>;
68
+ export declare const memoryLayer: (entries?: Iterable<readonly [Ids.AddressId, Route]>) => Layer.Layer<Service, never, never>;
69
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
70
+ export declare const resolve: (addressId: string & import("effect/Brand").Brand<"Relay.AddressId">) => Effect.Effect<Route, AddressNotFound | AddressUnavailable | AddressDeferred | AddressBookServiceError, Service>;
71
+ export declare const register: (addressId: string & import("effect/Brand").Brand<"Relay.AddressId">, route: Route) => Effect.Effect<Address.RouteRegistered, AddressBookServiceError, Service>;
72
+ export declare const get: (addressId: string & import("effect/Brand").Brand<"Relay.AddressId">) => Effect.Effect<RouteRecord | undefined, AddressBookServiceError, Service>;
73
+ export declare const list: () => Effect.Effect<Address.RouteList, AddressBookServiceError, Service>;
74
+ export {};
@@ -0,0 +1,106 @@
1
+ import { Ids } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import * as AddressBook from "./address-book-service";
4
+ import * as AgentRegistry from "../agent/agent-registry-service";
5
+ declare const AddressRouteNotFound_base: Schema.Class<AddressRouteNotFound, Schema.TaggedStruct<"AddressRouteNotFound", {
6
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
7
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
8
+ };
9
+ }>, import("effect/Cause").YieldableError>;
10
+ export declare class AddressRouteNotFound extends AddressRouteNotFound_base {
11
+ }
12
+ declare const AddressRouteKindMismatch_base: Schema.Class<AddressRouteKindMismatch, Schema.TaggedStruct<"AddressRouteKindMismatch", {
13
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
14
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
15
+ };
16
+ readonly expected: Schema.Literal<"local-agent">;
17
+ readonly actual: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
18
+ readonly route_key: Schema.String;
19
+ }>, import("effect/Cause").YieldableError>;
20
+ export declare class AddressRouteKindMismatch extends AddressRouteKindMismatch_base {
21
+ }
22
+ declare const AddressAgentDefinitionNotFound_base: Schema.Class<AddressAgentDefinitionNotFound, Schema.TaggedStruct<"AddressAgentDefinitionNotFound", {
23
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
24
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
25
+ };
26
+ readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
27
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
28
+ };
29
+ }>, import("effect/Cause").YieldableError>;
30
+ export declare class AddressAgentDefinitionNotFound extends AddressAgentDefinitionNotFound_base {
31
+ }
32
+ declare const AddressResolutionError_base: Schema.Class<AddressResolutionError, Schema.TaggedStruct<"AddressResolutionError", {
33
+ readonly message: Schema.String;
34
+ }>, import("effect/Cause").YieldableError>;
35
+ export declare class AddressResolutionError extends AddressResolutionError_base {
36
+ }
37
+ export declare const LocalAgentRoute: Schema.Struct<{
38
+ readonly kind: Schema.Literal<"local-agent">;
39
+ readonly route_key: Schema.String;
40
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
41
+ }>;
42
+ export interface LocalAgentRoute extends Schema.Schema.Type<typeof LocalAgentRoute> {
43
+ }
44
+ export declare const LocalAgentTarget: Schema.Struct<{
45
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
46
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
47
+ };
48
+ readonly route: Schema.Struct<{
49
+ readonly kind: Schema.Literal<"local-agent">;
50
+ readonly route_key: Schema.String;
51
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
52
+ }>;
53
+ readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
54
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
55
+ };
56
+ readonly agent_definition_revision: Schema.Int;
57
+ readonly agent_definition_snapshot: Schema.Struct<{
58
+ readonly name: Schema.String;
59
+ readonly instructions: Schema.optionalKey<Schema.String>;
60
+ readonly model: Schema.Struct<{
61
+ readonly provider: Schema.String;
62
+ readonly model: Schema.String;
63
+ readonly registration_key: Schema.optionalKey<Schema.String>;
64
+ readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
65
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
66
+ }>;
67
+ readonly tool_names: Schema.$Array<Schema.String>;
68
+ readonly permissions: Schema.$Array<Schema.Struct<{
69
+ readonly name: Schema.String;
70
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
71
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
72
+ }>>;
73
+ readonly child_run_presets: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
74
+ readonly instructions: Schema.optionalKey<Schema.String>;
75
+ readonly model: Schema.optionalKey<Schema.Struct<{
76
+ readonly provider: Schema.String;
77
+ readonly model: Schema.String;
78
+ readonly registration_key: Schema.optionalKey<Schema.String>;
79
+ readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
80
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
81
+ }>>;
82
+ readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
83
+ readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
84
+ readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
85
+ readonly mode: Schema.Literals<readonly ["share", "fork"]>;
86
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "fresh"]>>;
87
+ }>>;
88
+ readonly output_schema_ref: Schema.optionalKey<Schema.String>;
89
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
90
+ }>>>;
91
+ readonly output_schema_ref: Schema.optionalKey<Schema.String>;
92
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
93
+ }>;
94
+ }>;
95
+ export interface LocalAgentTarget extends Schema.Schema.Type<typeof LocalAgentTarget> {
96
+ }
97
+ export interface Interface {
98
+ readonly resolveLocalAgent: (addressId: Ids.AddressId) => Effect.Effect<LocalAgentTarget, AddressRouteNotFound | AddressRouteKindMismatch | AddressAgentDefinitionNotFound | AddressResolutionError>;
99
+ }
100
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/AddressResolution", Interface>;
101
+ export declare class Service extends Service_base {
102
+ }
103
+ export declare const layer: Layer.Layer<Service, never, AddressBook.Service | AgentRegistry.Service>;
104
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
105
+ export declare const resolveLocalAgent: (addressId: string & import("effect/Brand").Brand<"Relay.AddressId">) => Effect.Effect<LocalAgentTarget, AddressRouteNotFound | AddressRouteKindMismatch | AddressAgentDefinitionNotFound | AddressResolutionError, Service>;
106
+ export {};
@@ -0,0 +1,53 @@
1
+ import { Agent, Content, Execution, Ids, Shared, Tool } from "../../schema/index";
2
+ import { AgentChatRepository } from "../../store-sql/index";
3
+ import { Cause, Context, Effect, Layer, Schema } from "effect";
4
+ import * as EventLog from "../execution/event-log-service";
5
+ import * as LanguageModelService from "../model/language-model-service";
6
+ import * as ModelCallPolicy from "../model/model-call-policy";
7
+ import * as PromptAssembler from "./prompt-assembler-service";
8
+ import * as ToolRuntime from "../tool/tool-runtime-service";
9
+ declare const AgentLoopError_base: Schema.Class<AgentLoopError, Schema.TaggedStruct<"AgentLoopError", {
10
+ readonly message: Schema.String;
11
+ readonly next_event_sequence: Schema.optionalKey<Schema.Int>;
12
+ }>, Cause.YieldableError>;
13
+ export declare class AgentLoopError extends AgentLoopError_base {
14
+ }
15
+ declare const AgentLoopWaitRequested_base: Schema.Class<AgentLoopWaitRequested, Schema.TaggedStruct<"AgentLoopWaitRequested", {
16
+ readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
17
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
18
+ };
19
+ readonly tool_call: Schema.Struct<{
20
+ readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
21
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
22
+ };
23
+ readonly name: Schema.String;
24
+ readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
25
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
26
+ }>;
27
+ readonly next_event_sequence: Schema.Int;
28
+ }>, Cause.YieldableError>;
29
+ export declare class AgentLoopWaitRequested extends AgentLoopWaitRequested_base {
30
+ }
31
+ export interface RunInput {
32
+ readonly executionId: Ids.ExecutionId;
33
+ readonly agent: Agent.Definition;
34
+ readonly input: ReadonlyArray<Content.Part>;
35
+ readonly resumeToolCall?: Tool.Call;
36
+ readonly eventSequence: Execution.ExecutionEventSequence;
37
+ readonly startedAt: number;
38
+ readonly completedAt: number;
39
+ }
40
+ export interface RunResult {
41
+ readonly metadata: Shared.Metadata;
42
+ readonly nextEventSequence: Execution.ExecutionEventSequence;
43
+ }
44
+ export interface Interface {
45
+ readonly run: (input: RunInput) => Effect.Effect<RunResult, AgentLoopError | AgentLoopWaitRequested>;
46
+ }
47
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/AgentLoop", Interface>;
48
+ export declare class Service extends Service_base {
49
+ }
50
+ export declare const layer: Layer.Layer<Service, never, AgentChatRepository.Service | EventLog.Service | LanguageModelService.Service | ModelCallPolicy.Service | PromptAssembler.Service | ToolRuntime.Service>;
51
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
52
+ export declare const run: (input: RunInput) => Effect.Effect<RunResult, AgentLoopError | AgentLoopWaitRequested, Service>;
53
+ export {};
@@ -0,0 +1,31 @@
1
+ import { Agent, Ids } from "../../schema/index";
2
+ import { AgentDefinitionRepository } from "../../store-sql/index";
3
+ import { Context, Effect, Layer, Schema } from "effect";
4
+ declare const AgentDefinitionInvalid_base: Schema.Class<AgentDefinitionInvalid, Schema.TaggedStruct<"AgentDefinitionInvalid", {
5
+ readonly message: Schema.String;
6
+ }>, import("effect/Cause").YieldableError>;
7
+ export declare class AgentDefinitionInvalid extends AgentDefinitionInvalid_base {
8
+ }
9
+ declare const AgentRegistryError_base: Schema.Class<AgentRegistryError, Schema.TaggedStruct<"AgentRegistryError", {
10
+ readonly message: Schema.String;
11
+ }>, import("effect/Cause").YieldableError>;
12
+ export declare class AgentRegistryError extends AgentRegistryError_base {
13
+ }
14
+ export interface Interface {
15
+ readonly register: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, AgentDefinitionInvalid | AgentRegistryError>;
16
+ readonly get: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError>;
17
+ readonly getRevision: (input: AgentDefinitionRepository.GetAgentDefinitionRevisionInput) => Effect.Effect<Agent.DefinitionRevisionRecord | undefined, AgentRegistryError>;
18
+ readonly list: () => Effect.Effect<Agent.DefinitionList, AgentRegistryError>;
19
+ readonly listRevisions: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError>;
20
+ }
21
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/AgentRegistry", Interface>;
22
+ export declare class Service extends Service_base {
23
+ }
24
+ export declare const layer: Layer.Layer<Service, never, AgentDefinitionRepository.Service>;
25
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
26
+ export declare const register: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, AgentDefinitionInvalid | AgentRegistryError, Service>;
27
+ export declare const get: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError, Service>;
28
+ export declare const getRevision: (input: AgentDefinitionRepository.GetAgentDefinitionRevisionInput) => Effect.Effect<Agent.DefinitionRevisionRecord | undefined, AgentRegistryError, Service>;
29
+ export declare const list: () => Effect.Effect<Agent.DefinitionList, AgentRegistryError, Service>;
30
+ export declare const listRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError, Service>;
31
+ export {};
@@ -0,0 +1,102 @@
1
+ import { Agent, Content, Shared, Tool } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import * as Ai from "effect/unstable/ai";
4
+ import * as ArtifactStore from "../content/artifact-store-service";
5
+ import * as BlobStore from "../content/blob-store-service";
6
+ declare const PromptAssemblerError_base: Schema.Class<PromptAssemblerError, Schema.TaggedStruct<"PromptAssemblerError", {
7
+ readonly message: Schema.String;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ /**
10
+ * @experimental
11
+ */
12
+ export declare class PromptAssemblerError extends PromptAssemblerError_base {
13
+ }
14
+ /**
15
+ * Everything an assembler may consider when building the turn-zero prompt.
16
+ *
17
+ * @experimental
18
+ */
19
+ export interface AssembleInput {
20
+ readonly agent: Agent.Definition;
21
+ readonly tools: ReadonlyArray<Tool.Definition>;
22
+ readonly input: ReadonlyArray<Content.Part>;
23
+ /**
24
+ * Reserved truncation hook: when set, the assembler SHOULD keep the
25
+ * assembled prompt within this many tokens. The default layer ignores it
26
+ * (no tokenizer implementation exists yet); summarization/memory layers
27
+ * implement it later. Interface-only in v1.
28
+ */
29
+ readonly tokenBudget?: number;
30
+ readonly metadata?: Shared.Metadata;
31
+ }
32
+ /**
33
+ * @experimental
34
+ */
35
+ export interface Assembled {
36
+ /** Content of the system message the chat is seeded with. */
37
+ readonly system: string;
38
+ /** The turn-zero prompt (typically one user message built from `input`). */
39
+ readonly prompt: Ai.Prompt.Prompt;
40
+ }
41
+ /**
42
+ * @experimental
43
+ */
44
+ export interface Interface {
45
+ readonly assemble: (input: AssembleInput) => Effect.Effect<Assembled, PromptAssemblerError>;
46
+ }
47
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/PromptAssembler", Interface>;
48
+ /**
49
+ * @experimental
50
+ */
51
+ export declare class Service extends Service_base {
52
+ }
53
+ /**
54
+ * Content parts whose conversion is pure — everything except the reference
55
+ * parts (`blob-reference`, `artifact-reference`), which are resolved
56
+ * effectfully through {@link BlobStore} / {@link ArtifactStore}.
57
+ *
58
+ * @experimental
59
+ */
60
+ export type PureContentPart = Content.TextPart | Content.StructuredPart | Content.ToolCallPart | Content.ToolResultPart;
61
+ /**
62
+ * Converts a pure Relay content part into an Effect AI user-message prompt part.
63
+ * Reference parts are resolved separately (see the default layer).
64
+ *
65
+ * @experimental
66
+ */
67
+ export declare const contentToPromptPart: (part: PureContentPart) => Ai.Prompt.UserMessagePart;
68
+ /**
69
+ * Default assembler that resolves reference content parts through the
70
+ * {@link BlobStore} and {@link ArtifactStore} it reads from context. Requires
71
+ * both stores to be provided (`runner-runtime-service.ts` wires passthrough
72
+ * stores by default; see `docs/spec/29-blob-and-artifact-stores.md`).
73
+ *
74
+ * @experimental
75
+ */
76
+ export declare const defaultLayerWithStores: Layer.Layer<Service, never, BlobStore.Service | ArtifactStore.Service>;
77
+ /**
78
+ * Default assembler: reproduces the agent loop's historical prompt construction,
79
+ * minus the model-selection dump (see `docs/spec/28-prompt-assembly.md`).
80
+ * Bakes in passthrough stores so it stays self-contained and behavior is
81
+ * preserved bit-for-bit (see `docs/spec/29-blob-and-artifact-stores.md`).
82
+ *
83
+ * @experimental
84
+ */
85
+ export declare const defaultLayer: Layer.Layer<Service>;
86
+ /**
87
+ * Wraps a custom assembler implementation as a layer.
88
+ *
89
+ * @experimental
90
+ */
91
+ export declare const layer: (implementation: Interface) => Layer.Layer<Service>;
92
+ /**
93
+ * Alias of {@link layer} for test wiring.
94
+ *
95
+ * @experimental
96
+ */
97
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service>;
98
+ /**
99
+ * @experimental
100
+ */
101
+ export declare const assemble: (input: AssembleInput) => Effect.Effect<Assembled, PromptAssemblerError, Service>;
102
+ export {};
@@ -0,0 +1,90 @@
1
+ import { Agent, Execution, Ids, Shared } from "../../schema/index";
2
+ import { ChildExecutionRepository } from "../../store-sql/index";
3
+ import { Context, Effect, Layer, Schema } from "effect";
4
+ import * as EventLog from "../execution/event-log-service";
5
+ declare const StaticChildRunPresetNotFound_base: Schema.Class<StaticChildRunPresetNotFound, Schema.TaggedStruct<"StaticChildRunPresetNotFound", {
6
+ readonly preset_name: Schema.String;
7
+ }>, import("effect/Cause").YieldableError>;
8
+ export declare class StaticChildRunPresetNotFound extends StaticChildRunPresetNotFound_base {
9
+ }
10
+ declare const ChildRunScopeBroadened_base: Schema.Class<ChildRunScopeBroadened, Schema.TaggedStruct<"ChildRunScopeBroadened", {
11
+ readonly field: Schema.Literals<readonly ["tool_names", "permissions"]>;
12
+ readonly value: Schema.String;
13
+ }>, import("effect/Cause").YieldableError>;
14
+ export declare class ChildRunScopeBroadened extends ChildRunScopeBroadened_base {
15
+ }
16
+ declare const ChildRunServiceError_base: Schema.Class<ChildRunServiceError, Schema.TaggedStruct<"ChildRunServiceError", {
17
+ readonly message: Schema.String;
18
+ }>, import("effect/Cause").YieldableError>;
19
+ export declare class ChildRunServiceError extends ChildRunServiceError_base {
20
+ }
21
+ declare const ChildRunWorkspaceUnavailable_base: Schema.Class<ChildRunWorkspaceUnavailable, Schema.TaggedStruct<"ChildRunWorkspaceUnavailable", {
22
+ readonly reason: Schema.String;
23
+ }>, import("effect/Cause").YieldableError>;
24
+ export declare class ChildRunWorkspaceUnavailable extends ChildRunWorkspaceUnavailable_base {
25
+ }
26
+ declare const ChildRunModelMissing_base: Schema.Class<ChildRunModelMissing, Schema.TaggedStruct<"ChildRunModelMissing", {}>, import("effect/Cause").YieldableError>;
27
+ export declare class ChildRunModelMissing extends ChildRunModelMissing_base {
28
+ }
29
+ export interface AgentContext {
30
+ readonly instructions?: string;
31
+ readonly model?: Agent.ModelSelection;
32
+ readonly toolNames: ReadonlyArray<string>;
33
+ readonly permissions: ReadonlyArray<string>;
34
+ readonly outputSchemaRef?: string;
35
+ readonly metadata?: Shared.Metadata;
36
+ }
37
+ export interface ChildRunOverride {
38
+ readonly instructions?: string;
39
+ readonly model?: Agent.ModelSelection;
40
+ readonly toolNames?: ReadonlyArray<string>;
41
+ readonly permissions?: ReadonlyArray<string>;
42
+ readonly workspacePolicy?: Agent.ChildRunWorkspacePolicy;
43
+ readonly outputSchemaRef?: string;
44
+ readonly metadata?: Shared.Metadata;
45
+ }
46
+ export interface ChildRunPreset extends ChildRunOverride {
47
+ }
48
+ export interface SpawnStaticInput {
49
+ readonly childExecutionId: Ids.ChildExecutionId;
50
+ readonly executionId: Ids.ExecutionId;
51
+ readonly addressId: Ids.AddressId;
52
+ readonly parent: AgentContext;
53
+ readonly presets: ReadonlyMap<string, ChildRunPreset>;
54
+ readonly presetName: string;
55
+ readonly eventSequence: Execution.ExecutionEventSequence;
56
+ readonly createdAt: number;
57
+ }
58
+ export interface SpawnDynamicInput {
59
+ readonly childExecutionId: Ids.ChildExecutionId;
60
+ readonly executionId: Ids.ExecutionId;
61
+ readonly addressId: Ids.AddressId;
62
+ readonly parent: AgentContext;
63
+ readonly override?: ChildRunOverride;
64
+ readonly eventSequence: Execution.ExecutionEventSequence;
65
+ readonly createdAt: number;
66
+ }
67
+ export interface Interface {
68
+ readonly spawnStatic: (input: SpawnStaticInput) => Effect.Effect<Execution.ChildRunAccepted, StaticChildRunPresetNotFound | ChildRunScopeBroadened | ChildRunWorkspaceUnavailable | ChildRunServiceError>;
69
+ readonly spawnDynamic: (input: SpawnDynamicInput) => Effect.Effect<Execution.ChildRunAccepted, ChildRunScopeBroadened | ChildRunWorkspaceUnavailable | ChildRunServiceError>;
70
+ }
71
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ChildRunService", Interface>;
72
+ export declare class Service extends Service_base {
73
+ }
74
+ export interface ResolvedChildContext {
75
+ readonly instructions?: string;
76
+ readonly model?: Agent.ModelSelection;
77
+ readonly toolNames: ReadonlyArray<string>;
78
+ readonly permissions: ReadonlyArray<string>;
79
+ readonly workspacePolicy?: Agent.ChildRunWorkspacePolicy;
80
+ readonly outputSchemaRef?: string;
81
+ readonly metadata: Shared.Metadata;
82
+ }
83
+ export declare const layer: Layer.Layer<Service, never, ChildExecutionRepository.Service | EventLog.Service>;
84
+ export declare const memoryLayer: Layer.Layer<Service, never, never>;
85
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
86
+ export declare const resolveForDispatch: (input: Execution.SpawnChildRunInput) => Effect.Effect<ResolvedChildContext, StaticChildRunPresetNotFound | ChildRunScopeBroadened, never>;
87
+ export declare const childDefinition: (parentDefinition: Agent.Definition, context: ResolvedChildContext) => Effect.Effect<Agent.Definition, ChildRunModelMissing>;
88
+ export declare const spawnStatic: (input: SpawnStaticInput) => Effect.Effect<Execution.ChildRunAccepted, StaticChildRunPresetNotFound | ChildRunScopeBroadened | ChildRunServiceError | ChildRunWorkspaceUnavailable, Service>;
89
+ export declare const spawnDynamic: (input: SpawnDynamicInput) => Effect.Effect<Execution.ChildRunAccepted, ChildRunScopeBroadened | ChildRunServiceError | ChildRunWorkspaceUnavailable, Service>;
90
+ export {};
@@ -0,0 +1,40 @@
1
+ import { Content, Ids } from "../../schema/index";
2
+ import { ChildExecutionRepository } from "../../store-sql/index";
3
+ import { Context, Effect, Layer, Ref, Schema } from "effect";
4
+ import * as EventLog from "../execution/event-log-service";
5
+ import * as WaitService from "../wait/wait-service";
6
+ declare const ParentNotifyError_base: Schema.Class<ParentNotifyError, Schema.TaggedStruct<"ParentNotifyError", {
7
+ readonly message: Schema.String;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ export declare class ParentNotifyError extends ParentNotifyError_base {
10
+ }
11
+ export declare const ChildTerminalStatus: Schema.Literals<readonly ["completed", "failed", "cancelled"]>;
12
+ export type ChildTerminalStatus = typeof ChildTerminalStatus.Type;
13
+ export interface NotifyInput {
14
+ readonly parentExecutionId: Ids.ExecutionId;
15
+ readonly childExecutionId: Ids.ChildExecutionId;
16
+ readonly parentWaitId?: Ids.WaitId;
17
+ readonly status: ChildTerminalStatus;
18
+ readonly output: ReadonlyArray<Content.Part>;
19
+ readonly notifiedAt: number;
20
+ }
21
+ export interface Interface {
22
+ readonly notify: (input: NotifyInput) => Effect.Effect<void, ParentNotifyError>;
23
+ }
24
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ParentNotifier", Interface>;
25
+ export declare class Service extends Service_base {
26
+ }
27
+ export interface SignalParentWaitInput {
28
+ readonly executionId: Ids.ExecutionId;
29
+ readonly waitId: Ids.WaitId;
30
+ readonly signaledAt: number;
31
+ }
32
+ export interface MakeOptions {
33
+ readonly signalWait: (input: SignalParentWaitInput) => Effect.Effect<void, unknown>;
34
+ }
35
+ export declare const make: (options: MakeOptions) => Effect.Effect<Interface, never, ChildExecutionRepository.Service | EventLog.Service | WaitService.Service>;
36
+ export declare const layerWith: (options: MakeOptions) => Layer.Layer<Service, never, ChildExecutionRepository.Service | EventLog.Service | WaitService.Service>;
37
+ export declare const memoryLayer: (notifications?: Ref.Ref<ReadonlyArray<NotifyInput>>) => Layer.Layer<Service, never, never>;
38
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
39
+ export declare const notify: (input: NotifyInput) => Effect.Effect<void, ParentNotifyError, Service>;
40
+ export {};