@relayfx/sdk 0.1.0 → 0.2.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 (47) hide show
  1. package/dist/ai.js +2 -2
  2. package/dist/{index-vbf5hcw8.js → index-9tx9fh58.js} +320 -33
  3. package/dist/{index-sms8x6cq.js → index-bke4jyr6.js} +1 -1
  4. package/dist/{index-q0z11q9m.js → index-jy6rpstp.js} +5711 -3835
  5. package/dist/index.js +92 -3
  6. package/dist/migrations/20260712180000_child_fan_out/migration.sql +27 -0
  7. package/dist/migrations/20260712190000_workflow_definitions/migration.sql +3 -0
  8. package/dist/migrations/20260712200000_workflow_runtime/migration.sql +2 -0
  9. package/dist/migrations/mysql/0008_child_fan_out.sql +26 -0
  10. package/dist/migrations/mysql/0009_workflow_definitions.sql +3 -0
  11. package/dist/migrations/mysql/0010_workflow_runtime.sql +3 -0
  12. package/dist/migrations/pg/20260712180000_child_fan_out/migration.sql +27 -0
  13. package/dist/migrations/pg/20260712190000_workflow_definitions/migration.sql +3 -0
  14. package/dist/migrations/pg/20260712200000_workflow_runtime/migration.sql +2 -0
  15. package/dist/migrations/sqlite/0008_child_fan_out.sql +27 -0
  16. package/dist/migrations/sqlite/0009_workflow_definitions.sql +3 -0
  17. package/dist/migrations/sqlite/0010_workflow_runtime.sql +3 -0
  18. package/dist/sqlite.js +60 -11
  19. package/dist/types/relay/adapter-outbox.d.ts +3 -3
  20. package/dist/types/relay/client.d.ts +147 -17
  21. package/dist/types/relay/index.d.ts +2 -2
  22. package/dist/types/relay/operation.d.ts +559 -2
  23. package/dist/types/relay/sqlite-migrations.d.ts +16 -1
  24. package/dist/types/relay/sqlite-runtime.d.ts +8 -3
  25. package/dist/types/relay/sqlite.d.ts +3 -1
  26. package/dist/types/runtime/child/child-fan-out-admission-service.d.ts +30 -0
  27. package/dist/types/runtime/child/child-fan-out-runtime.d.ts +34 -0
  28. package/dist/types/runtime/child/child-fan-out-transition-service.d.ts +25 -0
  29. package/dist/types/runtime/cluster/execution-entity.d.ts +4 -2
  30. package/dist/types/runtime/execution/active-execution-registry.d.ts +12 -0
  31. package/dist/types/runtime/execution/execution-service.d.ts +1 -0
  32. package/dist/types/runtime/index.d.ts +5 -0
  33. package/dist/types/runtime/runner/runner-runtime-service.d.ts +14 -14
  34. package/dist/types/runtime/workflow/definition-runtime.d.ts +78 -0
  35. package/dist/types/runtime/workflow/execution-workflow.d.ts +5 -5
  36. package/dist/types/schema/child-orchestration-schema.d.ts +393 -0
  37. package/dist/types/schema/execution-schema.d.ts +2 -2
  38. package/dist/types/schema/ids-schema.d.ts +12 -0
  39. package/dist/types/schema/index.d.ts +3 -0
  40. package/dist/types/schema/wait-schema.d.ts +98 -0
  41. package/dist/types/schema/workflow-schema.d.ts +2062 -0
  42. package/dist/types/store-sql/child/child-fan-out-repository.d.ts +53 -0
  43. package/dist/types/store-sql/index.d.ts +2 -0
  44. package/dist/types/store-sql/portable.d.ts +2 -0
  45. package/dist/types/store-sql/schema/relay-schema.d.ts +1266 -1
  46. package/dist/types/store-sql/workflow/workflow-definition-repository.d.ts +29 -0
  47. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
1
  import { AddressBook, AgentRegistry, EventLog, EntityInstanceService, EntityRegistry, ExecutionWatch, ExecutionState, ExecutionService, EnvelopeService, PresenceService, SessionStream, SkillRegistry, ToolTransitionCoordinator, TopicService, WaitService } from "../runtime/index";
2
2
  import type { Agent as BatonAgent } from "@batonfx/core";
3
- import { Address, Agent, Content, Entity, Envelope, Execution, Ids, Inbox, Presence, Shared, Skill, State, Tool } from "../schema/index";
4
- import { ChildExecutionRepository, ClusterRegistryRepository, EnvelopeRepository, ExecutionRepository, InboxRepository, ScheduleRepository, SessionRepository, SteeringRepository, ToolCallRepository } from "../store-sql/portable";
3
+ import { Address, Agent, ChildOrchestration, Content, Entity, Envelope, Execution, Ids, Inbox, Presence, Shared, Skill, State, Tool, Workflow } from "../schema/index";
4
+ import { ChildExecutionRepository, ChildFanOutRepository, ClusterRegistryRepository, EnvelopeRepository, ExecutionRepository, InboxRepository, ScheduleRepository, SessionRepository, SteeringRepository, ToolCallRepository, WorkflowDefinitionRepository } from "../store-sql/portable";
5
5
  import { Context, Effect, Layer, Schema, Stream } from "effect";
6
6
  import { Sharding, ShardingConfig } from "effect/unstable/cluster";
7
- import type { AckEnvelopeReadyInput, CancelExecutionAccepted, CancelExecutionInput, CancelScheduleInput, CancelScheduleResult, ClaimEnvelopeReadyInput, CreateScheduleInput, CreateScheduleResult, EnvelopeReadyAcked, EnvelopeReadyLease, EnvelopeReadyReleased, ExecutionInspection, ExecutionListChange, GetSessionInput, GetSessionResult, GetEntityStateInput, PutEntityStateInput, DeleteEntityStateInput, ListEntityStateInput, GetOrCreateEntityInput, GetEntityInput, DestroyEntityInput, ListEntitiesInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListTopicSubscriptionsInput, PublishTopicInput, SubscribeTopicInput, TopicPublishAccepted, TopicSubscription, UnsubscribeTopicInput, ListPendingApprovalsInput, SessionStreamItem, StreamSessionInput, WatchExecutionsInput, ListRunnersResult, ListSchedulesInput, ListSchedulesResult, ListSessionsInput, ListSessionsResult, ListWaitsInput, PendingToolApprovalList, PendingToolCallList, ListPendingToolCallsInput, FulfillToolCallInput, ClaimToolWorkInput, CompleteToolWorkInput, ReleaseToolWorkInput, ListToolAttemptsInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, ReleaseEnvelopeReadyInput, ReplayExecutionInput, ReplayExecutionResult, ResolvePermissionInput, ResolveToolApprovalInput, RouteExecutionResult, StartExecutionInput, StartExecutionResult, SpawnChildRunInput, SteerAccepted, SteerInput, StreamExecutionInput, SubmitInboundEnvelopeAccepted, SubmitInboundEnvelopeInput, WaitView, WakeAccepted, WakeInput } from "./operation";
7
+ import type { AckEnvelopeReadyInput, CancelExecutionAccepted, CancelExecutionInput, CancelScheduleInput, CancelScheduleResult, ClaimEnvelopeReadyInput, CreateScheduleInput, CreateScheduleResult, EnvelopeReadyAcked, EnvelopeReadyLease, EnvelopeReadyReleased, ExecutionInspection, ExecutionListChange, GetSessionInput, GetSessionResult, GetEntityStateInput, PutEntityStateInput, DeleteEntityStateInput, ListEntityStateInput, GetOrCreateEntityInput, GetEntityInput, DestroyEntityInput, ListEntitiesInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListTopicSubscriptionsInput, PublishTopicInput, SubscribeTopicInput, TopicPublishAccepted, TopicSubscription, UnsubscribeTopicInput, ListPendingApprovalsInput, SessionStreamItem, StreamSessionInput, WatchExecutionsInput, ListRunnersResult, ListSchedulesInput, ListSchedulesResult, ListSessionsInput, ListSessionsResult, ListWaitsInput, PendingToolApprovalList, PendingToolCallList, ListPendingToolCallsInput, FulfillToolCallInput, ClaimToolWorkInput, CompleteToolWorkInput, ReleaseToolWorkInput, ListToolAttemptsInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, ReleaseEnvelopeReadyInput, ReplayExecutionInput, ReplayExecutionResult, ResolvePermissionInput, ResolveToolApprovalInput, RouteExecutionResult, StartExecutionInput, StartExecutionResult, SpawnChildRunInput, CancelChildFanOutInput, CancelChildFanOutResult, CreateChildFanOutInput, InspectChildFanOutInput, InspectChildFanOutResult, SteerAccepted, SteerInput, StreamExecutionInput, SubmitInboundEnvelopeAccepted, SubmitInboundEnvelopeInput, WaitView, WakeAccepted, WakeInput } from "./operation";
8
8
  import { EventLogCursorNotFound } from "./operation";
9
9
  export { EventLogCursorNotFound } from "./operation";
10
10
  import { AwaitWaitInput, WaitOutcome } from "./operation";
11
+ import { FollowExecutionInput, FollowExecutionItem } from "./operation";
11
12
  import { CommandReplyInvalid, CommandTimedOut, EntityNotFound } from "./command";
12
13
  import type { Command } from "./command";
13
14
  declare const ClientError_base: Schema.Class<ClientError, Schema.TaggedStruct<"ClientError", {
@@ -28,6 +29,16 @@ declare const EntityNamespaceReserved_base: Schema.Class<EntityNamespaceReserved
28
29
  }>, import("effect/Cause").YieldableError>;
29
30
  export declare class EntityNamespaceReserved extends EntityNamespaceReserved_base {
30
31
  }
32
+ declare const WaitKindMismatch_base: Schema.Class<WaitKindMismatch, Schema.TaggedStruct<"WaitKindMismatch", {
33
+ readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
34
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
35
+ };
36
+ readonly expected: Schema.String;
37
+ readonly actual: Schema.String;
38
+ readonly message: Schema.String;
39
+ }>, import("effect/Cause").YieldableError>;
40
+ export declare class WaitKindMismatch extends WaitKindMismatch_base {
41
+ }
31
42
  export interface AskEntityInput<Name extends string, I extends Schema.Top, O extends Schema.Top> {
32
43
  readonly kind: Ids.EntityKindName;
33
44
  readonly key: Ids.EntityKey;
@@ -88,6 +99,13 @@ export interface Interface {
88
99
  readonly getEntity: (input: GetEntityInput) => Effect.Effect<Entity.Instance | undefined, ClientError>;
89
100
  readonly destroyEntity: (input: DestroyEntityInput) => Effect.Effect<Entity.Instance, ClientError>;
90
101
  readonly listEntities: (input: ListEntitiesInput) => Effect.Effect<ReadonlyArray<Entity.Instance>, ClientError>;
102
+ readonly registerWorkflowDefinition: (input: Workflow.RegisterDefinitionPayload) => Effect.Effect<Workflow.DefinitionRegistered, ClientError>;
103
+ readonly getWorkflowDefinitionRevision: (id: Ids.WorkflowDefinitionId, revision?: Workflow.DefinitionRevision) => Effect.Effect<Workflow.DefinitionRevisionRecord | undefined, ClientError>;
104
+ readonly listWorkflowDefinitionRevisions: (id: Ids.WorkflowDefinitionId) => Effect.Effect<Workflow.DefinitionRevisionList, ClientError>;
105
+ readonly startWorkflowRun: (input: Workflow.StartRunPayload) => Effect.Effect<Workflow.RunRecord, ClientError>;
106
+ readonly inspectWorkflowRun: (id: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, ClientError>;
107
+ readonly replayWorkflowRun: (id: Ids.ExecutionId) => Effect.Effect<ReadonlyArray<Workflow.LifecycleEvent>, ClientError>;
108
+ readonly cancelWorkflowRun: (id: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, ClientError>;
91
109
  readonly registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
92
110
  readonly registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
93
111
  readonly getAgentDefinition: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError>;
@@ -122,6 +140,7 @@ export interface Interface {
122
140
  readonly askEntity: <Name extends string, I extends Schema.Top, O extends Schema.Top>(input: AskEntityInput<Name, I, O>) => Effect.Effect<O["Type"], CommandTimedOut | CommandReplyInvalid | EntityNotFound | ClientError, I["EncodingServices"] | O["DecodingServices"]>;
123
141
  readonly awaitWait: (input: AwaitWaitInput) => Effect.Effect<WaitOutcome, ClientError>;
124
142
  readonly streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError>;
143
+ readonly followExecution: (input: FollowExecutionInput) => Stream.Stream<FollowExecutionItem, EventLogCursorNotFound | ClientError>;
125
144
  readonly streamSession: (input: StreamSessionInput) => Stream.Stream<SessionStreamItem, EventLogCursorNotFound | ClientError>;
126
145
  readonly watchExecutions: (input: WatchExecutionsInput) => Stream.Stream<ExecutionListChange, ClientError>;
127
146
  readonly getEntityState: (input: GetEntityStateInput) => Effect.Effect<State.StateRecordView | undefined, ClientError>;
@@ -130,18 +149,21 @@ export interface Interface {
130
149
  readonly listEntityState: (input: ListEntityStateInput) => Effect.Effect<ReadonlyArray<State.StateRecordView>, ClientError>;
131
150
  readonly getPresence: (scope: Presence.Scope) => Effect.Effect<Presence.View, ClientError>;
132
151
  readonly watchPresence: (scope: Presence.Scope) => Stream.Stream<Presence.View, ClientError>;
133
- readonly wake: (input: WakeInput) => Effect.Effect<WakeAccepted, ClientError>;
152
+ readonly wake: (input: WakeInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
134
153
  readonly listPendingApprovals: (input: ListPendingApprovalsInput) => Effect.Effect<PendingToolApprovalList, ClientError>;
135
- readonly resolveToolApproval: (input: ResolveToolApprovalInput) => Effect.Effect<WakeAccepted, ClientError>;
136
- readonly resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, ClientError>;
154
+ readonly resolveToolApproval: (input: ResolveToolApprovalInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
155
+ readonly resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
137
156
  readonly listPendingToolCalls: (input: ListPendingToolCallsInput) => Effect.Effect<PendingToolCallList, ClientError>;
138
157
  readonly fulfillToolCall: (input: FulfillToolCallInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
139
158
  readonly claimToolWork: (input: ClaimToolWorkInput) => Effect.Effect<ToolWorkLease | null, ClientError>;
140
159
  readonly completeToolWork: (input: CompleteToolWorkInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
141
160
  readonly releaseToolWork: (input: ReleaseToolWorkInput) => Effect.Effect<ToolWorkReleased, ClientError>;
142
161
  readonly listToolAttempts: (input: ListToolAttemptsInput) => Effect.Effect<ToolAttemptList, ClientError>;
143
- readonly submitInboundEnvelope: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, ClientError>;
162
+ readonly submitInboundEnvelope: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, WaitKindMismatch | ClientError>;
144
163
  readonly spawnChildRun: (input: SpawnChildRunInput) => Effect.Effect<Execution.ChildRunAccepted, ClientError>;
164
+ readonly createChildFanOut: (input: CreateChildFanOutInput) => Effect.Effect<ChildOrchestration.FanOutState, ClientError>;
165
+ readonly cancelChildFanOut: (input: CancelChildFanOutInput) => Effect.Effect<CancelChildFanOutResult, ClientError>;
166
+ readonly inspectChildFanOut: (input: InspectChildFanOutInput) => Effect.Effect<InspectChildFanOutResult, ClientError>;
145
167
  readonly claimEnvelopeReady: (input: ClaimEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyLease | null, ClientError>;
146
168
  readonly ackEnvelopeReady: (input: AckEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyAcked, ClientError>;
147
169
  readonly releaseEnvelopeReady: (input: ReleaseEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyReleased, ClientError>;
@@ -152,8 +174,14 @@ export interface Interface {
152
174
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/sdk/Client", Interface>;
153
175
  export declare class Service extends Service_base {
154
176
  }
155
- export declare const layerFromRuntime: Layer.Layer<Service, never, AgentRegistry.Service | EntityRegistry.Service | EntityInstanceService.Service | AddressBook.Service | ExecutionService.Service | EnvelopeService.Service | WaitService.Service | EventLog.Service | SessionStream.Service | ExecutionWatch.Service | ExecutionState.Service | PresenceService.Service | EnvelopeRepository.Service | ExecutionRepository.Service | InboxRepository.Service | TopicService.Service | ToolCallRepository.Service | ChildExecutionRepository.Service | SessionRepository.Service | SteeringRepository.Service | ClusterRegistryRepository.Service | ScheduleRepository.Service | SkillRegistry.Service | ToolTransitionCoordinator.Service | Sharding.Sharding | ShardingConfig.ShardingConfig>;
156
- export declare const testLayer: (implementation: Omit<Interface, "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities"> & Partial<Pick<Interface, "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities">>) => Layer.Layer<Service, never, never>;
177
+ export interface FollowExecutionDependencies {
178
+ readonly getExecution: (id: Ids.ExecutionId) => Effect.Effect<Execution.Execution | undefined, ClientError>;
179
+ readonly inspectExecution: (executionId: Ids.ExecutionId) => Effect.Effect<ExecutionInspection, ExecutionNotFound | ClientError>;
180
+ readonly streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError>;
181
+ }
182
+ export declare const followExecutionFrom: (dependencies: FollowExecutionDependencies) => (input: FollowExecutionInput) => Stream.Stream<FollowExecutionItem, EventLogCursorNotFound | ClientError>;
183
+ export declare const layerFromRuntime: Layer.Layer<Service, never, AgentRegistry.Service | EntityRegistry.Service | EntityInstanceService.Service | AddressBook.Service | ExecutionService.Service | EnvelopeService.Service | WaitService.Service | EventLog.Service | SessionStream.Service | ExecutionWatch.Service | ExecutionState.Service | PresenceService.Service | EnvelopeRepository.Service | ExecutionRepository.Service | InboxRepository.Service | TopicService.Service | ToolCallRepository.Service | ChildExecutionRepository.Service | ChildFanOutRepository.Service | SessionRepository.Service | SteeringRepository.Service | ClusterRegistryRepository.Service | ScheduleRepository.Service | SkillRegistry.Service | ToolTransitionCoordinator.Service | WorkflowDefinitionRepository.Service | Sharding.Sharding | ShardingConfig.ShardingConfig>;
184
+ export declare const testLayer: (implementation: Omit<Interface, "registerWorkflowDefinition" | "getWorkflowDefinitionRevision" | "listWorkflowDefinitionRevisions" | "startWorkflowRun" | "inspectWorkflowRun" | "replayWorkflowRun" | "cancelWorkflowRun" | "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities" | "followExecution"> & Partial<Interface>) => Layer.Layer<Service, never, never>;
157
185
  export declare const registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError, Service>;
158
186
  export declare const registerEntityKind: (input: Entity.KindDefinition) => Effect.Effect<Entity.KindDefinition, ClientError, Service>;
159
187
  export declare const getOrCreateEntity: (input: GetOrCreateEntityInput) => Effect.Effect<Entity.Instance, ClientError, Service>;
@@ -191,6 +219,105 @@ export declare const listInboxMessages: (input: ListInboxMessagesInput) => Effec
191
219
  export declare const inspectExecution: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<ExecutionInspection, ClientError | ExecutionNotFound, Service>;
192
220
  export declare const send: (input: Envelope.SendInput) => Effect.Effect<Envelope.EnvelopeAccepted, ClientError, Service>;
193
221
  export declare const streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError, Service>;
222
+ export declare const followExecution: (input: FollowExecutionInput) => Stream.Stream<Schema.Struct.ReadonlySide<{
223
+ readonly _tag: Schema.tag<"event">;
224
+ readonly event: Schema.Struct<{
225
+ readonly id: Schema.brand<Schema.String, "Relay.EventId"> & {
226
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EventId">;
227
+ };
228
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
229
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
230
+ };
231
+ readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
232
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
233
+ }>;
234
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
235
+ readonly sequence: Schema.Int;
236
+ readonly cursor: Schema.String;
237
+ readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
238
+ readonly type: Schema.Literal<"text">;
239
+ readonly text: Schema.String;
240
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
241
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
242
+ }>, Schema.Struct<{
243
+ readonly type: Schema.Literal<"structured">;
244
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
245
+ readonly schema_ref: Schema.optionalKey<Schema.String>;
246
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
247
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
248
+ }>, Schema.Struct<{
249
+ readonly type: Schema.Literal<"blob-reference">;
250
+ readonly uri: Schema.String;
251
+ readonly media_type: Schema.String;
252
+ readonly filename: Schema.optionalKey<Schema.String>;
253
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
254
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
255
+ }>, Schema.Struct<{
256
+ readonly type: Schema.Literal<"artifact-reference">;
257
+ readonly artifact_id: Schema.String;
258
+ readonly media_type: Schema.optionalKey<Schema.String>;
259
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
260
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
261
+ }>, Schema.Struct<{
262
+ readonly type: Schema.Literal<"tool-call">;
263
+ readonly call: Schema.Struct<{
264
+ readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
265
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
266
+ };
267
+ readonly name: Schema.String;
268
+ readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
269
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
270
+ }>;
271
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
272
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
273
+ }>, Schema.Struct<{
274
+ readonly type: Schema.Literal<"tool-result">;
275
+ readonly result: Schema.Struct<{
276
+ readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
277
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
278
+ };
279
+ readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
280
+ readonly error: Schema.optionalKey<Schema.String>;
281
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
282
+ }>;
283
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
284
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
285
+ }>]>>>;
286
+ readonly data: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
287
+ readonly created_at: Schema.Int;
288
+ }>;
289
+ }, "Type"> | Schema.Struct.ReadonlySide<{
290
+ readonly _tag: Schema.tag<"reconnecting">;
291
+ readonly message: Schema.String;
292
+ readonly attempt: Schema.Int;
293
+ }, "Type"> | Schema.Struct.ReadonlySide<{
294
+ readonly _tag: Schema.tag<"stopped">;
295
+ readonly reason: Schema.Union<readonly [Schema.Struct<{
296
+ readonly _tag: Schema.tag<"terminal">;
297
+ readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
298
+ }>, Schema.Struct<{
299
+ readonly _tag: Schema.tag<"actionable_wait">;
300
+ readonly wait: Schema.Struct<{
301
+ readonly wait_id: Schema.brand<Schema.String, "Relay.WaitId"> & {
302
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
303
+ };
304
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
305
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
306
+ };
307
+ readonly envelope_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.EnvelopeId"> & {
308
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EnvelopeId">;
309
+ }>;
310
+ readonly kind: Schema.optionalKey<Schema.Literals<readonly ["permission", "tool_approval", "tool_placement", "child_join", "inbox", "reply", "timer", "external"]>>;
311
+ readonly mode: Schema.Literals<readonly ["reply", "event", "until", "child"]>;
312
+ readonly correlation_key: Schema.optionalKey<Schema.String>;
313
+ readonly state: Schema.Literals<readonly ["open", "resolved", "timed_out", "cancelled"]>;
314
+ readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
315
+ readonly created_at: Schema.Int;
316
+ readonly resolved_at: Schema.optionalKey<Schema.Int>;
317
+ }>;
318
+ }>]>;
319
+ readonly cursor: Schema.NullOr<Schema.String>;
320
+ }, "Type">, EventLogCursorNotFound | ClientError, Service>;
194
321
  export declare const streamSession: (input: StreamSessionInput) => Stream.Stream<Schema.Struct.ReadonlySide<{
195
322
  readonly _tag: Schema.tag<"execution_joined">;
196
323
  readonly execution: Schema.Struct<{
@@ -224,7 +351,7 @@ export declare const streamSession: (input: StreamSessionInput) => Stream.Stream
224
351
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
225
352
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
226
353
  }>;
227
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
354
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
228
355
  readonly sequence: Schema.Int;
229
356
  readonly cursor: Schema.String;
230
357
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -288,11 +415,11 @@ export declare const watchExecutions: (input: WatchExecutionsInput) => Stream.St
288
415
  readonly kind: "user-agent" | "agent-agent";
289
416
  readonly created_at: number;
290
417
  readonly updated_at: number;
291
- readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
292
- readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
293
418
  readonly root_address_id: string & import("effect/Brand").Brand<"Relay.AddressId">;
294
- readonly agent_id?: string & import("effect/Brand").Brand<"Relay.AgentId">;
419
+ readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
420
+ readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
295
421
  readonly session_id?: string & import("effect/Brand").Brand<"Relay.SessionId">;
422
+ readonly agent_id?: string & import("effect/Brand").Brand<"Relay.AgentId">;
296
423
  }[];
297
424
  readonly _tag: "snapshot";
298
425
  readonly next_cursor?: string;
@@ -320,18 +447,21 @@ export declare const watchExecutions: (input: WatchExecutionsInput) => Stream.St
320
447
  }, "Type">, ClientError, Service>;
321
448
  export declare const getPresence: (scope: Presence.Scope) => Effect.Effect<Presence.View, ClientError, Service>;
322
449
  export declare const watchPresence: (scope: Presence.Scope) => Stream.Stream<Presence.View, ClientError, Service>;
323
- export declare const wake: (input: WakeInput) => Effect.Effect<WakeAccepted, ClientError, Service>;
450
+ export declare const wake: (input: WakeInput) => Effect.Effect<WakeAccepted, ClientError | WaitKindMismatch, Service>;
324
451
  export declare const listPendingApprovals: (input: ListPendingApprovalsInput) => Effect.Effect<PendingToolApprovalList, ClientError, Service>;
325
- export declare const resolveToolApproval: (input: ResolveToolApprovalInput) => Effect.Effect<WakeAccepted, ClientError, Service>;
326
- export declare const resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, ClientError, Service>;
452
+ export declare const resolveToolApproval: (input: ResolveToolApprovalInput) => Effect.Effect<WakeAccepted, ClientError | WaitKindMismatch, Service>;
453
+ export declare const resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, ClientError | WaitKindMismatch, Service>;
327
454
  export declare const listPendingToolCalls: (input: ListPendingToolCallsInput) => Effect.Effect<PendingToolCallList, ClientError, Service>;
328
455
  export declare const fulfillToolCall: (input: FulfillToolCallInput) => Effect.Effect<ToolOutcomeAccepted, ClientError, Service>;
329
456
  export declare const claimToolWork: (input: ClaimToolWorkInput) => Effect.Effect<ToolWorkLease | null, ClientError, Service>;
330
457
  export declare const completeToolWork: (input: CompleteToolWorkInput) => Effect.Effect<ToolOutcomeAccepted, ClientError, Service>;
331
458
  export declare const releaseToolWork: (input: ReleaseToolWorkInput) => Effect.Effect<ToolWorkReleased, ClientError, Service>;
332
459
  export declare const listToolAttempts: (input: ListToolAttemptsInput) => Effect.Effect<ToolAttemptList, ClientError, Service>;
333
- export declare const submitInboundEnvelope: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, ClientError, Service>;
460
+ export declare const submitInboundEnvelope: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, ClientError | WaitKindMismatch, Service>;
334
461
  export declare const spawnChildRun: (input: SpawnChildRunInput) => Effect.Effect<Execution.ChildRunAccepted, ClientError, Service>;
462
+ export declare const createChildFanOut: (input: CreateChildFanOutInput) => Effect.Effect<ChildOrchestration.FanOutState, ClientError, Service>;
463
+ export declare const cancelChildFanOut: (input: CancelChildFanOutInput) => Effect.Effect<CancelChildFanOutResult, ClientError, Service>;
464
+ export declare const inspectChildFanOut: (input: InspectChildFanOutInput) => Effect.Effect<InspectChildFanOutResult, ClientError, Service>;
335
465
  export declare const claimEnvelopeReady: (input: ClaimEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyLease | null, ClientError, Service>;
336
466
  export declare const ackEnvelopeReady: (input: AckEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyAcked, ClientError, Service>;
337
467
  export declare const releaseEnvelopeReady: (input: ReleaseEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyReleased, ClientError, Service>;
@@ -4,8 +4,8 @@ export * as Command from "./command";
4
4
  export * as Database from "./database";
5
5
  export * as Operation from "./operation";
6
6
  export * as ToolWorker from "./tool-worker";
7
- export { Address, Agent, Content, Entity, Envelope, Execution, Ids, Presence, Schedule, Shared, Skill, Tool, } from "../schema/index";
8
- export { AddressBook, AddressResolution, AgentLoop, AgentRegistry, ActivityVersionRegistry, ArtifactStore, BlobStore, ChildRunService, EnvelopeService, EventLog, ExecutionEntity, ExecutionService, ExecutionWorkflow, LanguageModelService, ModelCallPolicy, PresenceService, PresenceTool, PromptAssembler, SchedulerService, SchemaRegistry, SkillRegistry, ToolRuntime, WaitService, } from "../runtime/index";
7
+ export { Address, Agent, Content, Entity, Envelope, Execution, Ids, Presence, Schedule, Shared, Skill, Tool, Waits, Workflow, } from "../schema/index";
8
+ export { AddressBook, AddressResolution, AgentLoop, AgentRegistry, ActivityVersionRegistry, ArtifactStore, BlobStore, ChildRunService, ChildFanOutRuntime, EnvelopeService, EventLog, ExecutionEntity, ExecutionService, ExecutionWorkflow, LanguageModelService, ModelCallPolicy, PresenceService, PresenceTool, PromptAssembler, SchedulerService, SchemaRegistry, SkillRegistry, ToolRuntime, WaitService, WorkflowDefinitionRuntime, } from "../runtime/index";
9
9
  export { RunnerRuntime } from "../runtime/index";
10
10
  export { LanguageModelRegistration } from "../ai/index";
11
11
  export { RelaySchema, SkillDefinitionRepository } from "../store-sql/index";