@relayfx/sdk 0.2.14 → 0.2.16

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 (110) hide show
  1. package/dist/ai.js +2 -2
  2. package/dist/{index-9q3yh32k.js → index-5x686v8w.js} +1815 -1543
  3. package/dist/{index-15f2ewt8.js → index-6dv1dqq1.js} +8 -8
  4. package/dist/{index-gb7d1wfm.js → index-a6vwwhcp.js} +116 -105
  5. package/dist/{index-qg0hy7s1.js → index-per7tyzq.js} +12 -8
  6. package/dist/index.js +5 -5
  7. package/dist/mysql.js +24 -9
  8. package/dist/postgres.js +18 -13
  9. package/dist/sqlite.js +26 -29
  10. package/dist/types/ai/embedding-model/embedding-model-registration.d.ts +2 -2
  11. package/dist/types/relay/adapter-outbox.d.ts +1 -1
  12. package/dist/types/relay/client.d.ts +28 -28
  13. package/dist/types/relay/command.d.ts +10 -4
  14. package/dist/types/relay/database.d.ts +4 -4
  15. package/dist/types/relay/migration-errors.d.ts +8 -2
  16. package/dist/types/relay/mysql.d.ts +2 -2
  17. package/dist/types/relay/operation.d.ts +173 -123
  18. package/dist/types/relay/postgres.d.ts +2 -2
  19. package/dist/types/relay/runtime-capability-policy.d.ts +11 -5
  20. package/dist/types/relay/runtime-database.d.ts +1 -1
  21. package/dist/types/relay/runtime.d.ts +4 -4
  22. package/dist/types/relay/sqlite-migrations.d.ts +1 -1
  23. package/dist/types/relay/sqlite-runtime.d.ts +10 -5
  24. package/dist/types/relay/tool-worker.d.ts +6 -5
  25. package/dist/types/runtime/address/address-book-service.d.ts +3 -3
  26. package/dist/types/runtime/address/address-resolution-service.d.ts +60 -38
  27. package/dist/types/runtime/agent/agent-loop-service.d.ts +14 -5
  28. package/dist/types/runtime/agent/agent-registry-service.d.ts +2 -2
  29. package/dist/types/runtime/agent/prompt-assembler-service.d.ts +1 -1
  30. package/dist/types/runtime/agent/relay-compaction.d.ts +3 -2
  31. package/dist/types/runtime/agent/relay-tool-output.d.ts +4 -1
  32. package/dist/types/runtime/child/child-fan-out-admission-service.d.ts +1 -1
  33. package/dist/types/runtime/child/child-fan-out-runtime.d.ts +12 -8
  34. package/dist/types/runtime/child/child-fan-out-transition-service.d.ts +1 -1
  35. package/dist/types/runtime/child/child-run-service.d.ts +7 -4
  36. package/dist/types/runtime/child/parent-notifier-service.d.ts +4 -2
  37. package/dist/types/runtime/child/spawn-child-run-tool.d.ts +12 -4
  38. package/dist/types/runtime/cluster/execution-entity.d.ts +2 -2
  39. package/dist/types/runtime/content/artifact-store-service.d.ts +2 -2
  40. package/dist/types/runtime/content/blob-store-service.d.ts +1 -1
  41. package/dist/types/runtime/entity/entity-instance-service.d.ts +14 -5
  42. package/dist/types/runtime/entity/entity-registry-service.d.ts +2 -2
  43. package/dist/types/runtime/envelope/envelope-service.d.ts +2 -2
  44. package/dist/types/runtime/execution/active-execution-registry.d.ts +1 -1
  45. package/dist/types/runtime/execution/event-log-service.d.ts +5 -2
  46. package/dist/types/runtime/execution/execution-service.d.ts +1 -1
  47. package/dist/types/runtime/execution/execution-watch-service.d.ts +1 -1
  48. package/dist/types/runtime/execution/session-stream-service.d.ts +1 -1
  49. package/dist/types/runtime/inbox/inbox-service.d.ts +1 -1
  50. package/dist/types/runtime/memory/memory-service.d.ts +1 -1
  51. package/dist/types/runtime/model/embedding-model-service.d.ts +23 -10
  52. package/dist/types/runtime/model/language-model-service.d.ts +20 -6
  53. package/dist/types/runtime/model/model-call-policy.d.ts +1 -1
  54. package/dist/types/runtime/observability/runtime-metrics.d.ts +12 -3
  55. package/dist/types/runtime/presence/presence-service.d.ts +1 -1
  56. package/dist/types/runtime/presence/presence-tool.d.ts +1 -1
  57. package/dist/types/runtime/runner/runner-runtime-service.d.ts +19 -19
  58. package/dist/types/runtime/schedule/scheduler-service.d.ts +3 -3
  59. package/dist/types/runtime/schema-registry/schema-registry-service.d.ts +2 -2
  60. package/dist/types/runtime/session/session-store-service.d.ts +13 -4
  61. package/dist/types/runtime/skill/skill-registry-service.d.ts +2 -2
  62. package/dist/types/runtime/state/execution-state-service.d.ts +5 -2
  63. package/dist/types/runtime/tool/tool-runtime-service.d.ts +42 -19
  64. package/dist/types/runtime/tool/tool-transition-coordinator.d.ts +2 -2
  65. package/dist/types/runtime/topic/topic-service.d.ts +1 -1
  66. package/dist/types/runtime/wait/wait-service.d.ts +1 -1
  67. package/dist/types/runtime/wait/wait-signal.d.ts +12 -3
  68. package/dist/types/runtime/workflow/activity-version-registry.d.ts +7 -3
  69. package/dist/types/runtime/workflow/definition-runtime.d.ts +37 -22
  70. package/dist/types/runtime/workflow/execution-workflow.d.ts +143 -104
  71. package/dist/types/runtime/workspace/workspace-planner-service.d.ts +6 -6
  72. package/dist/types/runtime/workspace/workspace-provider-service.d.ts +11 -7
  73. package/dist/types/runtime/workspace/workspace-runtime-service.d.ts +1 -1
  74. package/dist/types/schema/agent-schema.d.ts +388 -228
  75. package/dist/types/schema/child-orchestration-schema.d.ts +78 -57
  76. package/dist/types/schema/execution-schema.d.ts +118 -54
  77. package/dist/types/schema/workflow-schema.d.ts +243 -243
  78. package/dist/types/schema/workspace-schema.d.ts +1 -1
  79. package/dist/types/store-sql/address/address-book-repository.d.ts +5 -5
  80. package/dist/types/store-sql/agent/agent-definition-repository.d.ts +7 -7
  81. package/dist/types/store-sql/chat/agent-chat-repository.d.ts +2 -2
  82. package/dist/types/store-sql/child/child-execution-repository.d.ts +4 -4
  83. package/dist/types/store-sql/child/child-fan-out-repository.d.ts +2 -2
  84. package/dist/types/store-sql/cluster/cluster-registry-repository.d.ts +5 -5
  85. package/dist/types/store-sql/compaction/compaction-repository.d.ts +3 -3
  86. package/dist/types/store-sql/database/database-service.d.ts +3 -3
  87. package/dist/types/store-sql/database/notification-bus.d.ts +1 -1
  88. package/dist/types/store-sql/database/sql-dialect.d.ts +4 -1
  89. package/dist/types/store-sql/entity/entity-repository.d.ts +2 -2
  90. package/dist/types/store-sql/envelope/envelope-repository.d.ts +13 -13
  91. package/dist/types/store-sql/execution/execution-event-repository.d.ts +4 -4
  92. package/dist/types/store-sql/execution/execution-repository.d.ts +8 -8
  93. package/dist/types/store-sql/idempotency/idempotency-repository.d.ts +5 -5
  94. package/dist/types/store-sql/inbox/inbox-repository.d.ts +1 -1
  95. package/dist/types/store-sql/memory/memory-repository.d.ts +3 -3
  96. package/dist/types/store-sql/permission/permission-rule-repository.d.ts +2 -2
  97. package/dist/types/store-sql/presence/presence-repository.d.ts +2 -2
  98. package/dist/types/store-sql/schedule/schedule-repository.d.ts +9 -9
  99. package/dist/types/store-sql/schema/relay-schema.d.ts +257 -257
  100. package/dist/types/store-sql/session/context-epoch-repository.d.ts +2 -2
  101. package/dist/types/store-sql/session/session-repository.d.ts +5 -5
  102. package/dist/types/store-sql/skill/skill-definition-repository.d.ts +9 -9
  103. package/dist/types/store-sql/state/execution-state-repository.d.ts +2 -2
  104. package/dist/types/store-sql/steering/steering-repository.d.ts +5 -5
  105. package/dist/types/store-sql/tenant/tenant-id.d.ts +2 -2
  106. package/dist/types/store-sql/tool/tool-call-repository.d.ts +19 -16
  107. package/dist/types/store-sql/topic/topic-repository.d.ts +1 -1
  108. package/dist/types/store-sql/workflow/workflow-definition-repository.d.ts +16 -14
  109. package/dist/types/store-sql/workspace/workspace-lease-repository.d.ts +11 -11
  110. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { Schedule } from "../../schema/index";
2
2
  import { ExecutionRepository, ScheduleRepository } from "../../store-sql/portable";
3
- import { Config, Context, Cron, Effect, Layer, Schema } from "effect";
3
+ import { Config, Context, Cron, Effect, Layer, Option, Schema } from "effect";
4
4
  import { Service as EventLogService } from "../execution/event-log-service";
5
5
  import { Service as WaitServiceService } from "../wait/wait-service";
6
6
  declare const SchedulerError_base: Schema.Class<SchedulerError, Schema.TaggedStruct<"SchedulerError", {
@@ -17,13 +17,13 @@ export declare class ScheduleCronInvalid extends ScheduleCronInvalid_base {
17
17
  export interface Interface {
18
18
  readonly runOnce: Effect.Effect<number, SchedulerError>;
19
19
  }
20
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/SchedulerService", Interface>;
20
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/schedule/scheduler-service/Service", Interface>;
21
21
  export declare class Service extends Service_base {
22
22
  }
23
23
  export declare const pollIntervalMillisConfig: Config.Config<number>;
24
24
  export declare const claimTtlMillisConfig: Config.Config<number>;
25
25
  export declare const enabledConfig: Config.Config<boolean>;
26
- export declare const workerIdConfig: Config.Config<string>;
26
+ export declare const workerIdConfig: Config.Config<Option.Option<string>>;
27
27
  export declare const parseCron: (cronExpr: string) => Effect.Effect<Cron.Cron, ScheduleCronInvalid>;
28
28
  export declare const startIdempotencyKey: (schedule: Schedule.ScheduleRecord) => string;
29
29
  export declare const make: Effect.Effect<Interface, Config.ConfigError, ExecutionRepository.Service | ScheduleRepository.Service | EventLogService | WaitServiceService | import("effect/unstable/cluster/Sharding").Sharding>;
@@ -15,11 +15,11 @@ export interface Interface {
15
15
  readonly registrations: Effect.Effect<ReadonlyArray<Registration>>;
16
16
  readonly resolve: (ref: string) => Effect.Effect<Registration, SchemaRefNotRegistered>;
17
17
  }
18
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/SchemaRegistry", Interface>;
18
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/schema-registry/schema-registry-service/Service", Interface>;
19
19
  export declare class Service extends Service_base {
20
20
  }
21
21
  export declare const layer: (initialRegistrations?: ReadonlyArray<Registration>) => Layer.Layer<Service, never, never>;
22
- export declare const memoryLayer: (initialRegistrations?: ReadonlyArray<Registration>) => Layer.Layer<Service, never, never>;
22
+ export declare const memoryLayer: typeof layer;
23
23
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
24
24
  export declare const register: (registration: Registration) => Effect.Effect<void, never, Service>;
25
25
  export declare const registrations: () => Effect.Effect<readonly Registration[], never, Service>;
@@ -3,12 +3,21 @@ import { Ids } from "../../schema/index";
3
3
  import { SessionRepository } from "../../store-sql/portable";
4
4
  import { Context, Effect, Layer } from "effect";
5
5
  export type Interface = Session.Interface;
6
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/RelaySessionStore", Session.Interface>;
6
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/session/session-store-service/Service", Session.Interface>;
7
7
  export declare class Service extends Service_base {
8
8
  }
9
9
  export declare const make: (sessionId: string & import("effect/Brand").Brand<"Relay.SessionId">, entryScope?: string | undefined) => Effect.Effect<Session.Interface, never, SessionRepository.Service>;
10
- export declare const serviceLayer: (sessionId: Ids.SessionId, entryScope?: string) => Layer.Layer<Service, never, SessionRepository.Service>;
11
- export declare const layer: (sessionId: Ids.SessionId, entryScope?: string) => Layer.Layer<Session.SessionStore, never, SessionRepository.Service>;
12
- export declare const memoryLayer: (sessionId: Ids.SessionId, entryScope?: string) => Layer.Layer<Session.SessionStore, never, never>;
10
+ export declare const serviceLayer: {
11
+ (sessionId: Ids.SessionId, entryScope?: string): Layer.Layer<Service, never, SessionRepository.Service>;
12
+ (entryScope?: string): (sessionId: Ids.SessionId) => Layer.Layer<Service, never, SessionRepository.Service>;
13
+ };
14
+ export declare const layer: {
15
+ (sessionId: Ids.SessionId, entryScope?: string): Layer.Layer<Session.SessionStore, never, SessionRepository.Service>;
16
+ (entryScope?: string): (sessionId: Ids.SessionId) => Layer.Layer<Session.SessionStore, never, SessionRepository.Service>;
17
+ };
18
+ export declare const memoryLayer: {
19
+ (sessionId: Ids.SessionId, entryScope?: string): Layer.Layer<Session.SessionStore>;
20
+ (entryScope?: string): (sessionId: Ids.SessionId) => Layer.Layer<Session.SessionStore>;
21
+ };
13
22
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Session.SessionStore, never, never>;
14
23
  export {};
@@ -20,13 +20,13 @@ export interface Interface {
20
20
  readonly register: (input: Skill.RegisterDefinitionPayload) => Effect.Effect<Skill.DefinitionRegistered, SkillDefinitionInvalid | SkillRegistryError>;
21
21
  readonly get: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRecord | undefined, SkillRegistryError>;
22
22
  readonly getRevision: (input: SkillDefinitionRepository.GetSkillDefinitionRevisionInput) => Effect.Effect<Skill.DefinitionRevisionRecord | undefined, SkillRegistryError>;
23
- readonly list: () => Effect.Effect<Skill.DefinitionList, SkillRegistryError>;
23
+ readonly list: Effect.Effect<Skill.DefinitionList, SkillRegistryError>;
24
24
  readonly listRevisions: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRevisionList, SkillRegistryError>;
25
25
  readonly pinExecution: (input: PinExecutionSkillsInput) => Effect.Effect<Skill.ExecutionPinList, SkillRegistryError>;
26
26
  readonly listPins: (executionId: Ids.ExecutionId) => Effect.Effect<Skill.ExecutionPinList, SkillRegistryError>;
27
27
  readonly getPinned: (input: SkillDefinitionRepository.GetPinnedSkillInput) => Effect.Effect<Skill.ExecutionPinRecord | undefined, SkillRegistryError>;
28
28
  }
29
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/SkillRegistry", Interface>;
29
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/skill/skill-registry-service/Service", Interface>;
30
30
  export declare class Service extends Service_base {
31
31
  }
32
32
  export declare const layer: Layer.Layer<Service, never, SkillDefinitionRepository.Service>;
@@ -19,7 +19,10 @@ export interface StateKey<A, I extends Shared.JsonValue> {
19
19
  readonly name: string;
20
20
  readonly schema: Schema.Codec<A, I>;
21
21
  }
22
- export declare const key: <A, I extends Shared.JsonValue>(name: string, schema: Schema.Codec<A, I>) => StateKey<A, I>;
22
+ export declare const key: {
23
+ <A, I extends Shared.JsonValue>(name: string, schema: Schema.Codec<A, I>): StateKey<A, I>;
24
+ (name: string): <A, I extends Shared.JsonValue>(schema: Schema.Codec<A, I>) => StateKey<A, I>;
25
+ };
23
26
  export interface PutInput<A, I extends Shared.JsonValue> {
24
27
  readonly executionId: Ids.ExecutionId;
25
28
  readonly key: StateKey<A, I>;
@@ -48,7 +51,7 @@ export interface Interface {
48
51
  readonly remove: (input: RemoveInput) => Effect.Effect<State.StateRecordView | undefined, ExecutionStateRepository.StateVersionConflict | ExecutionStateError>;
49
52
  readonly list: (input: ListInput) => Effect.Effect<ReadonlyArray<State.StateRecordView>, ExecutionStateError>;
50
53
  }
51
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ExecutionStateService", Interface>;
54
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/state/execution-state-service/Service", Interface>;
52
55
  export declare class Service extends Service_base {
53
56
  }
54
57
  export declare const layer: Layer.Layer<Service, never, ExecutionStateRepository.Service | BlobStoreService>;
@@ -1,5 +1,5 @@
1
1
  import { Execution, Ids, Shared, Tool } from "../../schema/index";
2
- import { EnvelopeRepository, ScheduleRepository, ToolCallRepository } from "../../store-sql/portable";
2
+ import { ToolCallRepository } from "../../store-sql/portable";
3
3
  import { Tool as AiTool, Toolkit } from "effect/unstable/ai";
4
4
  import { Context, Effect, Layer, Schema } from "effect";
5
5
  import { Service as EventLogService } from "../execution/event-log-service";
@@ -50,7 +50,7 @@ export interface ToolExecutionContext {
50
50
  }
51
51
  export interface ToolCallInfoData extends ToolExecutionContext {
52
52
  }
53
- declare const ToolCallInfo_base: Context.ServiceClass<ToolCallInfo, "@relayfx/runtime/ToolCallInfo", ToolCallInfoData>;
53
+ declare const ToolCallInfo_base: Context.ServiceClass<ToolCallInfo, "@relayfx/runtime/tool/tool-runtime-service/ToolCallInfo", ToolCallInfoData>;
54
54
  export declare class ToolCallInfo extends ToolCallInfo_base {
55
55
  }
56
56
  export interface RegisteredTool {
@@ -58,10 +58,10 @@ export interface RegisteredTool {
58
58
  readonly tool: AiTool.Any;
59
59
  readonly placement?: Tool.Placement | undefined;
60
60
  readonly requiredPermissions?: ReadonlyArray<string>;
61
- readonly validateInput?: (input: Shared.JsonValue) => Effect.Effect<void, ToolInputInvalid, any>;
62
- readonly run?: ((input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, unknown, any>) | undefined;
61
+ readonly validateInput?: (input: Shared.JsonValue) => Effect.Effect<void, ToolInputInvalid>;
62
+ readonly run?: ((input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError>) | undefined;
63
63
  }
64
- export interface ToolOptions<Input extends Schema.Constraint, Output extends Schema.Constraint> {
64
+ export interface ToolOptions<Input extends Schema.ConstraintCodec<unknown, unknown, never, never>, Output extends Schema.ConstraintCodec<unknown, unknown, never, never>> {
65
65
  readonly description: string;
66
66
  readonly input: Input;
67
67
  readonly output: Output;
@@ -71,7 +71,7 @@ export interface ToolOptions<Input extends Schema.Constraint, Output extends Sch
71
71
  readonly needsApproval?: boolean | undefined;
72
72
  readonly metadata?: Shared.Metadata | undefined;
73
73
  readonly placement?: Tool.Placement | undefined;
74
- readonly run: (input: Input["Type"], context: ToolExecutionContext) => Effect.Effect<Output["Type"], unknown, any>;
74
+ readonly run: (input: Input["Type"], context: ToolExecutionContext) => Effect.Effect<Output["Type"], ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, ToolCallInfo>;
75
75
  }
76
76
  export interface DynamicToolOptions {
77
77
  readonly description: string;
@@ -83,7 +83,7 @@ export interface DynamicToolOptions {
83
83
  readonly needsApproval?: boolean | undefined;
84
84
  readonly metadata?: Shared.Metadata | undefined;
85
85
  readonly placement?: Tool.Placement | undefined;
86
- readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, unknown, any>;
86
+ readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError>;
87
87
  }
88
88
  export interface ToolkitToolOptions {
89
89
  readonly permissions?: ReadonlyArray<Tool.Permission> | undefined;
@@ -107,15 +107,24 @@ export interface Interface {
107
107
  readonly register: (tool: RegisteredTool) => Effect.Effect<void>;
108
108
  readonly definitions: Effect.Effect<ReadonlyArray<Tool.Definition>>;
109
109
  readonly registeredTools: Effect.Effect<ReadonlyArray<RegisteredTool>>;
110
- readonly run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, any>;
110
+ readonly run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, never>;
111
111
  }
112
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ToolRuntime", Interface>;
112
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/tool/tool-runtime-service/Service", Interface>;
113
113
  export declare class Service extends Service_base {
114
114
  }
115
115
  export declare const toolFromRegistered: (tool: RegisteredTool) => AiTool.Any;
116
- export declare const toolsFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.WithHandler<Tools>, options?: ToolkitRegistrationOptions) => ReadonlyArray<RegisteredTool>;
117
- export declare const tool: <const Name extends string, Input extends Schema.Constraint, Output extends Schema.Constraint>(name: Name, options: ToolOptions<Input, Output>) => RegisteredTool;
118
- export declare const dynamicTool: <const Name extends string>(name: Name, options: DynamicToolOptions) => RegisteredTool;
116
+ export declare const toolsFromToolkit: {
117
+ <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.WithHandler<Tools>, options?: ToolkitRegistrationOptions): ReadonlyArray<RegisteredTool>;
118
+ (options?: ToolkitRegistrationOptions): <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.WithHandler<Tools>) => ReadonlyArray<RegisteredTool>;
119
+ };
120
+ export declare const tool: {
121
+ <const Name extends string, Input extends Schema.ConstraintCodec<unknown, unknown, never, never>, Output extends Schema.ConstraintCodec<unknown, unknown, never, never>>(name: Name, options: ToolOptions<Input, Output>): RegisteredTool;
122
+ <Input extends Schema.ConstraintCodec<unknown, unknown, never, never>, Output extends Schema.ConstraintCodec<unknown, unknown, never, never>>(options: ToolOptions<Input, Output>): <const Name extends string>(name: Name) => RegisteredTool;
123
+ };
124
+ export declare const dynamicTool: {
125
+ <const Name extends string>(name: Name, options: DynamicToolOptions): RegisteredTool;
126
+ (options: DynamicToolOptions): <const Name extends string>(name: Name) => RegisteredTool;
127
+ };
119
128
  export interface PlacedToolOptions {
120
129
  readonly permissions?: ReadonlyArray<Tool.Permission> | undefined;
121
130
  readonly requiredPermissions?: ReadonlyArray<string> | undefined;
@@ -123,17 +132,31 @@ export interface PlacedToolOptions {
123
132
  readonly needsApproval?: boolean | undefined;
124
133
  readonly metadata?: Shared.Metadata | undefined;
125
134
  }
126
- export declare const clientTool: (modelTool: AiTool.Any, options?: PlacedToolOptions) => RegisteredTool;
127
- export declare const remoteTool: (modelTool: AiTool.Any, options: PlacedToolOptions & {
128
- readonly queue: Tool.PlacementKey;
129
- }) => RegisteredTool;
135
+ export declare const clientTool: {
136
+ (modelTool: AiTool.Any, options?: PlacedToolOptions): RegisteredTool;
137
+ (options?: PlacedToolOptions): (modelTool: AiTool.Any) => RegisteredTool;
138
+ };
139
+ export declare const remoteTool: {
140
+ (modelTool: AiTool.Any, options: PlacedToolOptions & {
141
+ readonly queue: Tool.PlacementKey;
142
+ }): RegisteredTool;
143
+ (options: PlacedToolOptions & {
144
+ readonly queue: Tool.PlacementKey;
145
+ }): (modelTool: AiTool.Any) => RegisteredTool;
146
+ };
130
147
  export declare const layer: (initialTools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService>;
131
- export declare const layerFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService | Exclude<AiTool.HandlersFor<Tools>, import("effect/Scope").Scope>>;
148
+ export declare const layerFromToolkit: {
149
+ <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions): Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService | AiTool.HandlersFor<Tools>>;
150
+ (options?: ToolkitRegistrationOptions): <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService | AiTool.HandlersFor<Tools>>;
151
+ };
132
152
  export declare const memoryLayer: (tools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, never>;
133
- export declare const memoryLayerFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions) => Layer.Layer<Service, never, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<AiTool.HandlersFor<Tools>, import("effect/Scope").Scope>, WaitServiceService>, ToolCallRepository.Service>, EnvelopeRepository.Service>, ScheduleRepository.Service>, EventLogService>>;
153
+ export declare const memoryLayerFromToolkit: {
154
+ <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions): Layer.Layer<Service, never, Exclude<AiTool.HandlersFor<Tools>, ToolCallRepository.Service | EventLogService | WaitServiceService>>;
155
+ (options?: ToolkitRegistrationOptions): <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Layer.Layer<Service, never, Exclude<AiTool.HandlersFor<Tools>, ToolCallRepository.Service | EventLogService | WaitServiceService>>;
156
+ };
134
157
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
135
158
  export declare const register: (registeredTool: RegisteredTool) => Effect.Effect<void, never, Service>;
136
159
  export declare const definitions: () => Effect.Effect<readonly Tool.Definition[], never, Service>;
137
160
  export declare const registeredTools: () => Effect.Effect<readonly RegisteredTool[], never, Service>;
138
- export declare const run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, any>;
161
+ export declare const run: (input: RunInput) => Effect.Effect<Tool.Result, ToolExecutionFailed | ToolExecutionWaitRequested | ToolInputInvalid | ToolNotRegistered | ToolPermissionDenied | ToolRuntimeError, Service>;
139
162
  export {};
@@ -4,10 +4,10 @@ import type { SqlError } from "effect/unstable/sql/SqlError";
4
4
  export interface Interface {
5
5
  readonly coordinate: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError, R>;
6
6
  }
7
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ToolTransitionCoordinator", Interface>;
7
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/tool/tool-transition-coordinator/Service", Interface>;
8
8
  export declare class Service extends Service_base {
9
9
  }
10
10
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
11
11
  export declare const sqlLayer: Layer.Layer<Service, never, SqlClient>;
12
- export declare const coordinate: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, SqlError | E, Service | R>;
12
+ export declare const coordinate: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError, R | Service>;
13
13
  export {};
@@ -37,7 +37,7 @@ export interface Interface {
37
37
  readonly publish: (input: PublishInput) => Effect.Effect<PublishResult, TopicServiceError>;
38
38
  readonly list: (input: ListInput) => Effect.Effect<ReadonlyArray<TopicRepository.Subscription>, TopicServiceError>;
39
39
  }
40
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/TopicService", Interface>;
40
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/topic/topic-service/Service", Interface>;
41
41
  export declare class Service extends Service_base {
42
42
  }
43
43
  export declare const layer: Layer.Layer<Service, never, EnvelopeRepository.Service | ExecutionRepository.Service | TopicRepository.Service | InboxServiceService>;
@@ -66,7 +66,7 @@ export interface Interface {
66
66
  readonly timeout: (input: TimeoutInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError>;
67
67
  readonly cancel: (input: CancelWaitInput) => Effect.Effect<WaitTransition, WaitNotFound | WaitServiceError>;
68
68
  }
69
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WaitService", Interface>;
69
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/wait/wait-service/Service", Interface>;
70
70
  export declare class Service extends Service_base {
71
71
  }
72
72
  export declare const layer: Layer.Layer<Service, never, EnvelopeRepository.Service | ScheduleRepository.Service | EventLogService>;
@@ -1,9 +1,17 @@
1
1
  import { Ids } from "../../schema/index";
2
2
  import { ExecutionRepository } from "../../store-sql/portable";
3
- import { Effect } from "effect";
3
+ import { Effect, Schema } from "effect";
4
+ import { ExecutionWorkflowFailed } from "../workflow/execution-workflow";
4
5
  import type { SignalWaitInput, WaitSignalState } from "../workflow/execution-workflow";
5
6
  export interface ExecutionSignalClient {
6
- readonly signalWait: (input: SignalWaitInput) => Effect.Effect<void, unknown>;
7
+ readonly signalWait: (input: SignalWaitInput) => Effect.Effect<void, {
8
+ readonly _tag: string;
9
+ }>;
10
+ }
11
+ declare const WaitSignalError_base: Schema.Class<WaitSignalError, Schema.TaggedStruct<"WaitSignalError", {
12
+ readonly message: Schema.String;
13
+ }>, import("effect/Cause").YieldableError>;
14
+ export declare class WaitSignalError extends WaitSignalError_base {
7
15
  }
8
16
  export type ExecutionClientFactory = (executionId: Ids.ExecutionId) => ExecutionSignalClient;
9
17
  export interface SignalWorkflowWaitInput {
@@ -13,4 +21,5 @@ export interface SignalWorkflowWaitInput {
13
21
  readonly state: WaitSignalState;
14
22
  readonly signaledAt: number;
15
23
  }
16
- export declare const signalWorkflowWait: (input: SignalWorkflowWaitInput) => Effect.Effect<void, unknown, ExecutionRepository.Service>;
24
+ export declare const signalWorkflowWait: (input: SignalWorkflowWaitInput) => Effect.Effect<void, WaitSignalError | ExecutionWorkflowFailed, ExecutionRepository.Service>;
25
+ export {};
@@ -72,9 +72,13 @@ export declare const currentManifest: () => Effect.Effect<{
72
72
  signature_hash: string;
73
73
  }[];
74
74
  }, import("effect/PlatformError").PlatformError, Crypto.Crypto>;
75
- export declare const diffManifests: (baseline: ActivityManifest, current: ActivityManifest) => {
76
- breaking: ActivityManifestChange[];
77
- additive: ActivityManifestChange[];
75
+ export declare function diffManifests(baseline: ActivityManifest, current: ActivityManifest): {
76
+ breaking: Array<ActivityManifestChange>;
77
+ additive: Array<ActivityManifestChange>;
78
+ };
79
+ export declare function diffManifests(current: ActivityManifest): (baseline: ActivityManifest) => {
80
+ breaking: Array<ActivityManifestChange>;
81
+ additive: Array<ActivityManifestChange>;
78
82
  };
79
83
  export declare const evaluateGuard: (input: {
80
84
  readonly baseline: ActivityManifest;
@@ -1,6 +1,7 @@
1
1
  import { ChildOrchestration, Ids, Shared, Workflow } from "../../schema/index";
2
2
  import { WorkflowDefinitionRepository } from "../../store-sql/portable";
3
3
  import { Cause, Context, Effect, Layer, Schema } from "effect";
4
+ import { SqlError } from "effect/unstable/sql/SqlError";
4
5
  export interface SideEffectContext {
5
6
  readonly execution_id: Ids.ExecutionId;
6
7
  readonly operation_id: Ids.WorkflowOperationId;
@@ -28,32 +29,45 @@ declare const PinnedDefinitionMismatch_base: Schema.Class<PinnedDefinitionMismat
28
29
  }>, Cause.YieldableError>;
29
30
  export declare class PinnedDefinitionMismatch extends PinnedDefinitionMismatch_base {
30
31
  }
32
+ declare const WorkflowRuntimeError_base: Schema.Class<WorkflowRuntimeError, Schema.TaggedStruct<"WorkflowRuntimeError", {
33
+ readonly message: Schema.String;
34
+ }>, Cause.YieldableError>;
35
+ export declare class WorkflowRuntimeError extends WorkflowRuntimeError_base {
36
+ }
37
+ declare const WorkflowJoinPolicyNotSatisfied_base: Schema.Class<WorkflowJoinPolicyNotSatisfied, Schema.TaggedStruct<"WorkflowJoinPolicyNotSatisfied", {
38
+ readonly policy: Schema.String;
39
+ }>, Cause.YieldableError>;
40
+ export declare class WorkflowJoinPolicyNotSatisfied extends WorkflowJoinPolicyNotSatisfied_base {
41
+ }
31
42
  export interface Handlers {
32
- readonly tool?: (executionId: Ids.ExecutionId, operation: typeof Workflow.ToolOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, unknown>;
33
- readonly child: (executionId: Ids.ExecutionId, operation: typeof Workflow.ChildOperation.Type | typeof Workflow.DispatchableChildOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, unknown>;
34
- readonly approval: (executionId: Ids.ExecutionId, operation: typeof Workflow.ApprovalOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, unknown>;
35
- readonly timer: (executionId: Ids.ExecutionId, operation: typeof Workflow.TimerOperation.Type, context: SideEffectContext) => Effect.Effect<void, unknown>;
36
- readonly branch: (executionId: Ids.ExecutionId, operation: typeof Workflow.BranchOperation.Type, context: SideEffectContext) => Effect.Effect<boolean, unknown>;
37
- readonly structuredCompletion: (schemaRef: string, value: Shared.JsonValue | undefined, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, unknown>;
38
- readonly createChildFanOut?: (definition: ChildOrchestration.FanOutDefinition, context: SideEffectContext) => Effect.Effect<ChildOrchestration.FanOutState, unknown>;
39
- readonly admitChildFanOut?: (fanOutId: Ids.ChildFanOutId) => Effect.Effect<void, unknown>;
40
- readonly inspectChildFanOut?: (fanOutId: Ids.ChildFanOutId) => Effect.Effect<ChildOrchestration.FanOutState | undefined, unknown>;
43
+ readonly tool?: (executionId: Ids.ExecutionId, operation: typeof Workflow.ToolOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, WorkflowRuntimeError>;
44
+ readonly child: (executionId: Ids.ExecutionId, operation: typeof Workflow.ChildOperation.Type | typeof Workflow.DispatchableChildOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, WorkflowRuntimeError>;
45
+ readonly approval: (executionId: Ids.ExecutionId, operation: typeof Workflow.ApprovalOperation.Type, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, WorkflowRuntimeError>;
46
+ readonly timer: (executionId: Ids.ExecutionId, operation: typeof Workflow.TimerOperation.Type, context: SideEffectContext) => Effect.Effect<void, WorkflowRuntimeError>;
47
+ readonly branch: (executionId: Ids.ExecutionId, operation: typeof Workflow.BranchOperation.Type, context: SideEffectContext) => Effect.Effect<boolean, WorkflowRuntimeError>;
48
+ readonly structuredCompletion: (schemaRef: string, value: Shared.JsonValue | undefined, context: SideEffectContext) => Effect.Effect<Shared.JsonValue, WorkflowRuntimeError>;
49
+ readonly createChildFanOut?: (definition: ChildOrchestration.FanOutDefinition, context: SideEffectContext) => Effect.Effect<ChildOrchestration.FanOutState, WorkflowRuntimeError>;
50
+ readonly admitChildFanOut?: (fanOutId: Ids.ChildFanOutId) => Effect.Effect<void, WorkflowRuntimeError>;
51
+ readonly inspectChildFanOut?: (fanOutId: Ids.ChildFanOutId) => Effect.Effect<ChildOrchestration.FanOutState | undefined, WorkflowRuntimeError>;
41
52
  }
42
- declare const HandlerService_base: Context.ServiceClass<HandlerService, "@relayfx/runtime/WorkflowDefinitionHandlers", Handlers>;
53
+ declare const HandlerService_base: Context.ServiceClass<HandlerService, "@relayfx/runtime/workflow/definition-runtime/HandlerService", Handlers>;
43
54
  export declare class HandlerService extends HandlerService_base {
44
55
  }
45
56
  export interface Interface {
46
- readonly start: (input: Workflow.StartRunPayload) => Effect.Effect<Workflow.RunRecord, unknown>;
47
- readonly run: (executionId: Ids.ExecutionId) => Effect.Effect<Shared.JsonValue | undefined, unknown>;
48
- readonly recover: () => Effect.Effect<ReadonlyArray<Ids.ExecutionId>, unknown>;
49
- readonly inspect: (executionId: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, unknown>;
50
- readonly replay: (executionId: Ids.ExecutionId) => Effect.Effect<ReadonlyArray<Workflow.LifecycleEvent>, unknown>;
51
- readonly cancel: (executionId: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, unknown>;
57
+ readonly start: (input: Workflow.StartRunPayload) => Effect.Effect<Workflow.RunRecord, WorkflowDefinitionRepository.RepositoryError | SqlError>;
58
+ readonly run: (executionId: Ids.ExecutionId) => Effect.Effect<Shared.JsonValue | undefined, WorkflowExecutionError>;
59
+ readonly recover: Effect.Effect<ReadonlyArray<Ids.ExecutionId>, WorkflowRuntimeError>;
60
+ readonly inspect: (executionId: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, WorkflowDefinitionRepository.RepositoryError | SqlError>;
61
+ readonly replay: (executionId: Ids.ExecutionId) => Effect.Effect<ReadonlyArray<Workflow.LifecycleEvent>, WorkflowDefinitionRepository.RepositoryError | SqlError>;
62
+ readonly cancel: (executionId: Ids.ExecutionId) => Effect.Effect<Workflow.RunRecord | undefined, WorkflowDefinitionRepository.RepositoryError | SqlError>;
52
63
  }
53
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/WorkflowDefinitionRuntime", Interface>;
64
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/workflow/definition-runtime/Service", Interface>;
54
65
  export declare class Service extends Service_base {
55
66
  }
56
- export declare const fanOutIdFor: (executionId: Ids.ExecutionId, fanOutKey: string) => string & import("effect/Brand").Brand<"Relay.ChildFanOutId">;
67
+ export declare const fanOutIdFor: {
68
+ (fanOutKey: string): (executionId: Ids.ExecutionId) => Ids.ChildFanOutId;
69
+ (executionId: Ids.ExecutionId, fanOutKey: string): Ids.ChildFanOutId;
70
+ };
57
71
  declare const WorkflowCancelled_base: Schema.Class<WorkflowCancelled, Schema.TaggedStruct<"WorkflowCancelled", {}>, Cause.YieldableError>;
58
72
  export declare class WorkflowCancelled extends WorkflowCancelled_base {
59
73
  }
@@ -71,10 +85,11 @@ declare const WorkflowJoining_base: Schema.Class<WorkflowJoining, Schema.TaggedS
71
85
  }>, Cause.YieldableError>;
72
86
  export declare class WorkflowJoining extends WorkflowJoining_base {
73
87
  }
88
+ type WorkflowExecutionError = WorkflowDefinitionRepository.RepositoryError | SqlError | WorkflowRuntimeError | UnsupportedOperation | PinnedDefinitionNotFound | PinnedDefinitionMismatch | WorkflowCancelled | WorkflowBudgetExceeded | WorkflowJoining | WorkflowJoinPolicyNotSatisfied;
74
89
  export declare const validate: (definition: Workflow.Definition) => Effect.Effect<void, never, never> | Effect.Effect<never, UnsupportedOperation, never>;
75
- export declare const run: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<Schema.Json | undefined, unknown, WorkflowDefinitionRepository.Service | HandlerService>;
90
+ export declare const run: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<Schema.Json | undefined, PinnedDefinitionMismatch | PinnedDefinitionNotFound | WorkflowDefinitionRepository.RepositoryError | SqlError | UnsupportedOperation | WorkflowBudgetExceeded | WorkflowCancelled | WorkflowJoinPolicyNotSatisfied | WorkflowJoining | WorkflowRuntimeError, HandlerService | WorkflowDefinitionRepository.Service>;
76
91
  export declare const handlersLayer: (handlers: Handlers) => Layer.Layer<HandlerService, never, never>;
77
- export declare const testHandlersLayer: (handlers: Handlers) => Layer.Layer<HandlerService, never, never>;
78
- export declare const layerFromRuntime: Layer.Layer<Service, unknown, WorkflowDefinitionRepository.Service | HandlerService>;
79
- export declare const layer: Layer.Layer<Service, unknown, WorkflowDefinitionRepository.Service | HandlerService>;
92
+ export declare const testHandlersLayer: typeof handlersLayer;
93
+ export declare const layerFromRuntime: Layer.Layer<Service, WorkflowRuntimeError, HandlerService | WorkflowDefinitionRepository.Service>;
94
+ export declare const layer: Layer.Layer<Service, WorkflowRuntimeError, HandlerService | WorkflowDefinitionRepository.Service>;
80
95
  export {};