@relayfx/sdk 0.3.6 → 0.4.0

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 (96) hide show
  1. package/dist/ai.js +1 -1
  2. package/dist/http-server.js +1 -1
  3. package/dist/{index-mtvz1bjn.js → index-3w6txjtg.js} +63 -426
  4. package/dist/{index-2vsf6dks.js → index-cs3be24t.js} +1 -1
  5. package/dist/{index-e02krw55.js → index-p43mg4kt.js} +5882 -5127
  6. package/dist/{index-8fpd6kvj.js → index-x32kbvxv.js} +1004 -970
  7. package/dist/index.js +487 -22
  8. package/dist/migrations/20260719120000_rename_entity_to_resident/migration.sql +9 -0
  9. package/dist/migrations/mysql/0012_rename_entity_to_resident.sql +5 -0
  10. package/dist/migrations/pg/20260719120000_rename_entity_to_resident/migration.sql +9 -0
  11. package/dist/migrations/sqlite/0012_rename_entity_to_resident.sql +7 -0
  12. package/dist/mysql.js +18 -5
  13. package/dist/postgres.js +569 -550
  14. package/dist/sqlite.js +16 -5
  15. package/dist/types/relay/client-baton-agent.d.ts +30 -0
  16. package/dist/types/relay/client-child-runs.d.ts +35 -0
  17. package/dist/types/relay/client-error-mapping.d.ts +5 -0
  18. package/dist/types/relay/client-event-sequence.d.ts +3 -0
  19. package/dist/types/relay/client-execution-payloads.d.ts +12 -0
  20. package/dist/types/relay/client-public-agents.d.ts +15 -0
  21. package/dist/types/relay/client-public-child-runs.d.ts +9 -0
  22. package/dist/types/relay/client-public-envelope-ready.d.ts +6 -0
  23. package/dist/types/relay/client-public-executions.d.ts +247 -0
  24. package/dist/types/relay/client-public-messaging.d.ts +18 -0
  25. package/dist/types/relay/client-public-residents.d.ts +14 -0
  26. package/dist/types/relay/client-public-schedules.d.ts +6 -0
  27. package/dist/types/relay/client-public-tools.d.ts +12 -0
  28. package/dist/types/relay/client-public-workflows.d.ts +10 -0
  29. package/dist/types/relay/client-public.d.ts +133 -313
  30. package/dist/types/relay/client-runtime-wake.d.ts +10 -0
  31. package/dist/types/relay/client-tool-outcome.d.ts +16 -0
  32. package/dist/types/relay/client-view-mappers.d.ts +16 -0
  33. package/dist/types/relay/client-wait-signal.d.ts +5 -0
  34. package/dist/types/relay/client.d.ts +118 -1
  35. package/dist/types/relay/command.d.ts +6 -6
  36. package/dist/types/relay/http-server.d.ts +55 -37
  37. package/dist/types/relay/index.d.ts +3 -4
  38. package/dist/types/relay/internal-client.d.ts +5 -5
  39. package/dist/types/relay/mysql-migrations.d.ts +1 -1
  40. package/dist/types/relay/operation.d.ts +44 -41
  41. package/dist/types/relay/sqlite-migrations.d.ts +6 -1
  42. package/dist/types/runtime/address/address-resolution-service.d.ts +3 -0
  43. package/dist/types/runtime/agent/agent-loop-events.d.ts +24 -0
  44. package/dist/types/runtime/agent/relay-tool-executor.d.ts +2 -2
  45. package/dist/types/runtime/agent/sequence-allocator.d.ts +1 -0
  46. package/dist/types/runtime/execution/event-log-memory.d.ts +7 -0
  47. package/dist/types/runtime/execution/event-log-repository.d.ts +8 -0
  48. package/dist/types/runtime/execution/event-log-service.d.ts +3 -1
  49. package/dist/types/runtime/index.d.ts +2 -2
  50. package/dist/types/runtime/resident/resident-instance-service.d.ts +76 -0
  51. package/dist/types/runtime/resident/resident-registry-service.d.ts +35 -0
  52. package/dist/types/runtime/runner/runner-runtime-service.d.ts +14 -14
  53. package/dist/types/runtime/tool/tool-runtime-contract.d.ts +4 -1
  54. package/dist/types/runtime/workflow/execution-workflow-state.d.ts +43 -0
  55. package/dist/types/runtime/workflow/execution-workflow.d.ts +6 -0
  56. package/dist/types/schema/agent-schema.d.ts +24 -0
  57. package/dist/types/schema/execution-schema.d.ts +5 -2
  58. package/dist/types/schema/ids-schema.d.ts +6 -6
  59. package/dist/types/schema/index.d.ts +1 -1
  60. package/dist/types/schema/{entity-schema.d.ts → resident-schema.d.ts} +6 -6
  61. package/dist/types/store-sql/envelope/envelope-ready-records.d.ts +51 -0
  62. package/dist/types/store-sql/envelope/envelope-records.d.ts +43 -0
  63. package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -2
  64. package/dist/types/store-sql/envelope/wait-records.d.ts +64 -0
  65. package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +8 -0
  66. package/dist/types/store-sql/execution/execution-event-repository-sql.d.ts +13 -0
  67. package/dist/types/store-sql/execution/execution-event-repository.d.ts +13 -5
  68. package/dist/types/store-sql/index.d.ts +1 -1
  69. package/dist/types/store-sql/portable.d.ts +1 -1
  70. package/dist/types/store-sql/resident/resident-repository.d.ts +36 -0
  71. package/dist/types/store-sql/schema/address-book-schema.d.ts +131 -0
  72. package/dist/types/store-sql/schema/agent-schema.d.ts +954 -0
  73. package/dist/types/store-sql/schema/communication-schema.d.ts +743 -0
  74. package/dist/types/store-sql/schema/envelope-schema.d.ts +701 -0
  75. package/dist/types/store-sql/schema/execution-schema.d.ts +1119 -0
  76. package/dist/types/store-sql/schema/idempotency-schema.d.ts +161 -0
  77. package/dist/types/store-sql/schema/presence-schema.d.ts +116 -0
  78. package/dist/types/store-sql/schema/relay-schema.d.ts +13 -6684
  79. package/dist/types/store-sql/schema/resident-schema.d.ts +294 -0
  80. package/dist/types/store-sql/schema/schedule-schema.d.ts +282 -0
  81. package/dist/types/store-sql/schema/schema-columns.d.ts +1 -0
  82. package/dist/types/store-sql/schema/session-schema.d.ts +228 -0
  83. package/dist/types/store-sql/schema/tool-schema.d.ts +627 -0
  84. package/dist/types/store-sql/schema/workflow-schema.d.ts +996 -0
  85. package/dist/types/store-sql/schema/workspace-schema.d.ts +338 -0
  86. package/dist/types/store-sql/session/session-entry-records.d.ts +52 -0
  87. package/dist/types/store-sql/session/session-records.d.ts +51 -0
  88. package/dist/types/store-sql/session/session-repository.d.ts +2 -3
  89. package/dist/types/store-sql/tool/tool-attempt-records.d.ts +52 -0
  90. package/dist/types/store-sql/tool/tool-call-records.d.ts +121 -0
  91. package/dist/types/store-sql/tool/tool-call-repository.d.ts +1 -2
  92. package/dist/types/store-sql/tool/tool-work-operations.d.ts +11 -0
  93. package/package.json +3 -3
  94. package/dist/types/runtime/entity/entity-instance-service.d.ts +0 -76
  95. package/dist/types/runtime/entity/entity-registry-service.d.ts +0 -35
  96. package/dist/types/store-sql/entity/entity-repository.d.ts +0 -36
@@ -105,6 +105,8 @@ export interface RunInput {
105
105
  readonly eventSequence: Execution.ExecutionEventSequence;
106
106
  readonly createdAt: number;
107
107
  readonly extraTools?: ReadonlyArray<RegisteredTool>;
108
+ readonly onRequested?: Effect.Effect<void>;
109
+ readonly beforeSettlement?: Effect.Effect<Execution.ExecutionEventSequence>;
108
110
  readonly transformResult?: (result: Tool.Result) => Effect.Effect<Tool.Result, ToolRuntimeError>;
109
111
  }
110
112
  export type RunError = ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError;
@@ -112,10 +114,11 @@ export interface Interface {
112
114
  readonly register: (tool: RegisteredTool) => Effect.Effect<void>;
113
115
  readonly definitions: Effect.Effect<ReadonlyArray<Tool.Definition>>;
114
116
  readonly registeredTools: Effect.Effect<ReadonlyArray<RegisteredTool>>;
117
+ readonly prepare: (input: RunInput) => Effect.Effect<void, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolRuntimeError>;
115
118
  readonly run: (input: RunInput) => Effect.Effect<Tool.Result, RunError>;
116
119
  }
117
120
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/tool/tool-runtime-contract/Service", Interface>;
118
121
  export declare class Service extends Service_base {
119
122
  }
120
- export declare const testLayer: (implementation: Interface) => Layer.Layer<Service>;
123
+ export declare const testLayer: (implementation: Omit<Interface, "prepare"> & Partial<Pick<Interface, "prepare">>) => Layer.Layer<Service>;
121
124
  export {};
@@ -0,0 +1,43 @@
1
+ import { AgentEvent } from "@batonfx/core";
2
+ import { Content, Execution, Ids, Shared } from "../../schema/index";
3
+ import { EnvelopeRepository, ExecutionRepository } from "../../store-sql/portable";
4
+ import { Schema } from "effect";
5
+ import type { StartInput, WaitSignalState, WaitSnapshot } from "./execution-workflow";
6
+ declare const toWaitSnapshot: (record: EnvelopeRepository.WaitRecord) => WaitSnapshot;
7
+ declare const terminalWaitState: (wait: WaitSnapshot) => WaitSignalState | undefined;
8
+ declare const agentDefinitionPinCount: (input: StartInput) => number;
9
+ declare const waitIdFromRecord: (record: ExecutionRepository.ExecutionRecord) => (string & import("effect/Brand").Brand<"Relay.WaitId">) | undefined;
10
+ declare const workflowGenerationForStart: (input: StartInput) => number;
11
+ declare const workflowGenerationFromRecord: (record: ExecutionRepository.ExecutionRecord) => number;
12
+ declare const generationMetadata: (generation: number) => Shared.Metadata;
13
+ declare const memorySubjectFromMetadata: (metadata: Shared.Metadata | undefined) => Schema.Json | undefined;
14
+ declare const metadataSetting: (input: StartInput, key: string) => Shared.JsonValue | undefined;
15
+ declare const steeringEnabledForStart: (input: StartInput) => boolean;
16
+ export interface ChildDispatchContext {
17
+ readonly parentExecutionId: Ids.ExecutionId;
18
+ readonly childExecutionId: Ids.ChildExecutionId;
19
+ readonly parentWaitId?: Ids.WaitId;
20
+ }
21
+ declare const childDispatchContext: (input: StartInput) => ChildDispatchContext | undefined;
22
+ declare const terminalOutput: (execution: Execution.Execution) => ReadonlyArray<Content.Part>;
23
+ declare const waitIdFromExecution: (execution: Execution.Execution) => (string & import("effect/Brand").Brand<"Relay.WaitId">) | undefined;
24
+ declare const pendingSuspensionFromExecution: (execution: Execution.Execution) => AgentEvent.AgentSuspended | undefined;
25
+ export declare const ExecutionWorkflowState: {
26
+ agentDefinitionPinCount: typeof agentDefinitionPinCount;
27
+ childDispatchContext: typeof childDispatchContext;
28
+ continueAsNewAfterTurnsMetadataKey: string;
29
+ generationMetadata: typeof generationMetadata;
30
+ memorySubjectFromMetadata: typeof memorySubjectFromMetadata;
31
+ metadataSetting: typeof metadataSetting;
32
+ pendingSuspensionFromExecution: typeof pendingSuspensionFromExecution;
33
+ steeringEnabledForStart: typeof steeringEnabledForStart;
34
+ terminalOutput: typeof terminalOutput;
35
+ terminalWaitState: typeof terminalWaitState;
36
+ toolOutputMaxBytesMetadataKey: string;
37
+ toWaitSnapshot: typeof toWaitSnapshot;
38
+ waitIdFromExecution: typeof waitIdFromExecution;
39
+ waitIdFromRecord: typeof waitIdFromRecord;
40
+ workflowGenerationForStart: typeof workflowGenerationForStart;
41
+ workflowGenerationFromRecord: typeof workflowGenerationFromRecord;
42
+ };
43
+ export {};
@@ -120,6 +120,9 @@ export declare const StartInput: Schema.Struct<{
120
120
  readonly fallback?: "allow" | "ask" | "deny";
121
121
  };
122
122
  readonly turn_policy?: Agent.TurnPolicySnapshot;
123
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
124
+ readonly concurrency: Schema.Finite;
125
+ }, "Encoded">;
123
126
  readonly compaction_policy?: {
124
127
  readonly context_window: number;
125
128
  readonly reserve_tokens: number;
@@ -405,6 +408,9 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
405
408
  readonly fallback?: "allow" | "ask" | "deny";
406
409
  };
407
410
  readonly turn_policy?: Agent.TurnPolicySnapshot;
411
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
412
+ readonly concurrency: Schema.Finite;
413
+ }, "Encoded">;
408
414
  readonly compaction_policy?: {
409
415
  readonly context_window: number;
410
416
  readonly reserve_tokens: number;
@@ -143,6 +143,9 @@ declare const DefinitionSchema: Schema.Struct<{
143
143
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["allow", "deny", "ask"]>>;
144
144
  }>>;
145
145
  readonly turn_policy: Schema.optionalKey<Schema.Codec<TurnPolicySnapshot, TurnPolicySnapshot, never, never>>;
146
+ readonly tool_execution: Schema.optionalKey<Schema.Struct<{
147
+ readonly concurrency: Schema.Finite;
148
+ }>>;
146
149
  readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
147
150
  readonly context_window: Schema.Finite;
148
151
  readonly reserve_tokens: Schema.Finite;
@@ -213,6 +216,9 @@ export interface DefineInput {
213
216
  readonly skill_definition_ids?: ReadonlyArray<SkillDefinitionId>;
214
217
  readonly permission_rules?: PermissionRuleset;
215
218
  readonly turn_policy?: TurnPolicySnapshot;
219
+ readonly tool_execution?: {
220
+ readonly concurrency: number;
221
+ };
216
222
  readonly compaction_policy?: CompactionPolicy;
217
223
  readonly max_tool_turns?: number;
218
224
  readonly max_wait_turns?: number;
@@ -260,6 +266,9 @@ export declare const DefinitionRecord: Schema.Struct<{
260
266
  readonly fallback?: "allow" | "ask" | "deny";
261
267
  };
262
268
  readonly turn_policy?: TurnPolicySnapshot;
269
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
270
+ readonly concurrency: Schema.Finite;
271
+ }, "Encoded">;
263
272
  readonly compaction_policy?: {
264
273
  readonly context_window: number;
265
274
  readonly reserve_tokens: number;
@@ -373,6 +382,9 @@ export declare const DefinitionRevisionRecord: Schema.Struct<{
373
382
  readonly fallback?: "allow" | "ask" | "deny";
374
383
  };
375
384
  readonly turn_policy?: TurnPolicySnapshot;
385
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
386
+ readonly concurrency: Schema.Finite;
387
+ }, "Encoded">;
376
388
  readonly compaction_policy?: {
377
389
  readonly context_window: number;
378
390
  readonly reserve_tokens: number;
@@ -484,6 +496,9 @@ export declare const RegisterDefinitionPayload: Schema.Struct<{
484
496
  readonly fallback?: "allow" | "ask" | "deny";
485
497
  };
486
498
  readonly turn_policy?: TurnPolicySnapshot;
499
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
500
+ readonly concurrency: Schema.Finite;
501
+ }, "Encoded">;
487
502
  readonly compaction_policy?: {
488
503
  readonly context_window: number;
489
504
  readonly reserve_tokens: number;
@@ -595,6 +610,9 @@ export declare const DefinitionRegistered: Schema.Struct<{
595
610
  readonly fallback?: "allow" | "ask" | "deny";
596
611
  };
597
612
  readonly turn_policy?: TurnPolicySnapshot;
613
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
614
+ readonly concurrency: Schema.Finite;
615
+ }, "Encoded">;
598
616
  readonly compaction_policy?: {
599
617
  readonly context_window: number;
600
618
  readonly reserve_tokens: number;
@@ -710,6 +728,9 @@ export declare const DefinitionList: Schema.Struct<{
710
728
  readonly fallback?: "allow" | "ask" | "deny";
711
729
  };
712
730
  readonly turn_policy?: TurnPolicySnapshot;
731
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
732
+ readonly concurrency: Schema.Finite;
733
+ }, "Encoded">;
713
734
  readonly compaction_policy?: {
714
735
  readonly context_window: number;
715
736
  readonly reserve_tokens: number;
@@ -825,6 +846,9 @@ export declare const DefinitionRevisionList: Schema.Struct<{
825
846
  readonly fallback?: "allow" | "ask" | "deny";
826
847
  };
827
848
  readonly turn_policy?: TurnPolicySnapshot;
849
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
850
+ readonly concurrency: Schema.Finite;
851
+ }, "Encoded">;
828
852
  readonly compaction_policy?: {
829
853
  readonly context_window: number;
830
854
  readonly reserve_tokens: number;
@@ -50,6 +50,9 @@ export declare const Execution: Schema.Struct<{
50
50
  readonly fallback?: "allow" | "ask" | "deny";
51
51
  };
52
52
  readonly turn_policy?: import("./agent-schema").TurnPolicySnapshot;
53
+ readonly tool_execution?: Schema.Struct.ReadonlySide<{
54
+ readonly concurrency: Schema.Finite;
55
+ }, "Encoded">;
53
56
  readonly compaction_policy?: {
54
57
  readonly context_window: number;
55
58
  readonly reserve_tokens: number;
@@ -382,7 +385,7 @@ export declare const ChildRunAccepted: Schema.Struct<{
382
385
  export interface ChildRunAccepted extends Schema.Schema.Type<typeof ChildRunAccepted> {
383
386
  }
384
387
  export declare const childSessionId: (childExecutionId: ChildExecutionId) => string & import("effect/Brand").Brand<"Relay.SessionId">;
385
- export declare const ExecutionEventType: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "agent.compaction.committed", "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"]>;
388
+ export declare const ExecutionEventType: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "agent.compaction.committed", "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", "resident.created", "resident.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"]>;
386
389
  export type ExecutionEventType = typeof ExecutionEventType.Type;
387
390
  export declare const CompactionCommittedEventData: Schema.Struct<{
388
391
  readonly checkpoint_id: Schema.brand<Schema.String, "Relay.SessionEntryId"> & {
@@ -405,7 +408,7 @@ export declare const ExecutionEvent: Schema.Struct<{
405
408
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
406
409
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
407
410
  }>;
408
- 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.toolcall.delta", "model.output.completed", "model.usage.reported", "agent.compaction.committed", "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"]>;
411
+ 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.toolcall.delta", "model.output.completed", "model.usage.reported", "agent.compaction.committed", "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", "resident.created", "resident.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"]>;
409
412
  readonly sequence: Schema.Int;
410
413
  readonly cursor: Schema.String;
411
414
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -24,14 +24,14 @@ export declare const WorkflowOperationId: Schema.brand<Schema.String, "Relay.Wor
24
24
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WorkflowOperationId">;
25
25
  };
26
26
  export type WorkflowOperationId = typeof WorkflowOperationId.Type;
27
- export declare const EntityKindName: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
28
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
27
+ export declare const ResidentKindName: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
28
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
29
29
  };
30
- export type EntityKindName = typeof EntityKindName.Type;
31
- export declare const EntityKey: Schema.brand<Schema.String, "Relay.EntityKey"> & {
32
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
30
+ export type ResidentKindName = typeof ResidentKindName.Type;
31
+ export declare const ResidentKey: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
32
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
33
33
  };
34
- export type EntityKey = typeof EntityKey.Type;
34
+ export type ResidentKey = typeof ResidentKey.Type;
35
35
  export declare const SkillDefinitionId: Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
36
36
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
37
37
  };
@@ -3,7 +3,7 @@ export * as Agent from "./agent-schema";
3
3
  export * as ChildOrchestration from "./child-orchestration-schema";
4
4
  export * as Content from "./content-schema";
5
5
  export * as Envelope from "./envelope-schema";
6
- export * as Entity from "./entity-schema";
6
+ export * as Resident from "./resident-schema";
7
7
  export * as Execution from "./execution-schema";
8
8
  export * as Ids from "./ids-schema";
9
9
  export * as Inbox from "./inbox-schema";
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  export declare const KindDefinition: Schema.Struct<{
3
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
4
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
3
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
4
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
5
5
  };
6
6
  readonly agent_id: Schema.brand<Schema.String, "Relay.AgentId"> & {
7
7
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
@@ -19,11 +19,11 @@ export interface KindDefinition extends Schema.Schema.Type<typeof KindDefinition
19
19
  export declare const InstanceStatus: Schema.Literals<readonly ["active", "destroyed"]>;
20
20
  export type InstanceStatus = typeof InstanceStatus.Type;
21
21
  export declare const Instance: Schema.Struct<{
22
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
23
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
22
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
23
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
24
24
  };
25
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
26
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
25
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
26
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
27
27
  };
28
28
  readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
29
29
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
@@ -0,0 +1,51 @@
1
+ import { Ids } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import type { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import type { AckReadyInput, ClaimReadyInput, EnvelopeReadyClaimMismatch, EnvelopeReadyNotFound, EnvelopeReadyRecord, EnvelopeRepositoryError, ReleaseReadyInput } from "./envelope-repository";
5
+ export declare const envelopeReadyRow: Schema.Struct<{
6
+ readonly id: Schema.String;
7
+ readonly envelope_id: Schema.String;
8
+ readonly route_type: Schema.String;
9
+ readonly route_key: Schema.String;
10
+ readonly state: Schema.String;
11
+ readonly available_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
12
+ readonly attempt: Schema.Finite;
13
+ readonly claim_owner: Schema.Union<readonly [Schema.String, Schema.Null]>;
14
+ readonly claim_expires_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
15
+ readonly last_error: Schema.Union<readonly [Schema.String, Schema.Null]>;
16
+ readonly idempotency_key: Schema.Union<readonly [Schema.String, Schema.Null]>;
17
+ readonly metadata_json: Schema.Unknown;
18
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
19
+ readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
20
+ readonly claimed_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
21
+ readonly acknowledged_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
22
+ }>;
23
+ interface EnvelopeReadyRecordErrors {
24
+ readonly EnvelopeRepositoryError: {
25
+ readonly make: (input: {
26
+ readonly message: string;
27
+ }) => EnvelopeRepositoryError;
28
+ };
29
+ readonly EnvelopeReadyNotFound: {
30
+ readonly make: (input: {
31
+ readonly id: Ids.EnvelopeReadyId;
32
+ }) => EnvelopeReadyNotFound;
33
+ };
34
+ readonly EnvelopeReadyClaimMismatch: {
35
+ readonly make: (input: {
36
+ readonly id: Ids.EnvelopeReadyId;
37
+ readonly worker_id: string;
38
+ }) => EnvelopeReadyClaimMismatch;
39
+ };
40
+ }
41
+ interface MakeEnvelopeReadyRecordOperationsInput {
42
+ readonly sql: SqlClient;
43
+ readonly ts: (millis: number) => Date | number;
44
+ readonly errors: EnvelopeReadyRecordErrors;
45
+ }
46
+ export declare const makeEnvelopeReadyRecordOperations: ({ sql, ts, errors }: MakeEnvelopeReadyRecordOperationsInput) => {
47
+ claimReady: (input: ClaimReadyInput) => Effect.Effect<EnvelopeReadyRecord | undefined, EnvelopeRepositoryError, never>;
48
+ releaseReady: (input: ReleaseReadyInput) => Effect.Effect<EnvelopeReadyRecord, EnvelopeReadyClaimMismatch | EnvelopeReadyNotFound | EnvelopeRepositoryError, never>;
49
+ ackReady: (input: AckReadyInput) => Effect.Effect<EnvelopeReadyRecord, EnvelopeReadyClaimMismatch | EnvelopeReadyNotFound | EnvelopeRepositoryError, never>;
50
+ };
51
+ export {};
@@ -0,0 +1,43 @@
1
+ import { Envelope, Ids } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import { envelopeReadyRow } from "./envelope-ready-records";
5
+ import type { AcceptEnvelopeInput, EnvelopeReadyClaimMismatch, EnvelopeReadyNotFound, EnvelopeRepositoryError, Interface, WaitNotFound } from "./envelope-repository";
6
+ import { waitRow } from "./wait-records";
7
+ export declare const envelopeRow: Schema.Struct<{
8
+ readonly id: Schema.String;
9
+ readonly execution_id: Schema.String;
10
+ readonly from_address_id: Schema.String;
11
+ readonly to_address_id: Schema.String;
12
+ readonly content_json: Schema.Unknown;
13
+ readonly wait_json: Schema.Unknown;
14
+ readonly correlation_key: Schema.Union<readonly [Schema.String, Schema.Null]>;
15
+ readonly metadata_json: Schema.Unknown;
16
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
17
+ }>;
18
+ export declare const accepted: (input: AcceptEnvelopeInput) => Envelope.EnvelopeAccepted;
19
+ interface EnvelopeRecordErrors {
20
+ readonly EnvelopeRepositoryError: {
21
+ readonly make: (input: {
22
+ readonly message: string;
23
+ }) => EnvelopeRepositoryError;
24
+ };
25
+ readonly EnvelopeReadyNotFound: {
26
+ readonly make: (input: {
27
+ readonly id: Ids.EnvelopeReadyId;
28
+ }) => EnvelopeReadyNotFound;
29
+ };
30
+ readonly EnvelopeReadyClaimMismatch: {
31
+ readonly make: (input: {
32
+ readonly id: Ids.EnvelopeReadyId;
33
+ readonly worker_id: string;
34
+ }) => EnvelopeReadyClaimMismatch;
35
+ };
36
+ readonly WaitNotFound: {
37
+ readonly make: (input: {
38
+ readonly id: Ids.WaitId;
39
+ }) => WaitNotFound;
40
+ };
41
+ }
42
+ export declare const makeEnvelopeRepository: (errors: EnvelopeRecordErrors) => Effect.Effect<Interface, never, SqlClient>;
43
+ export { envelopeReadyRow, waitRow };
@@ -1,6 +1,5 @@
1
1
  import { Address, Envelope, Ids, Shared } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Schema } from "effect";
3
- import { SqlClient } from "effect/unstable/sql/SqlClient";
4
3
  export declare const WaitState: Schema.Literals<readonly ["open", "resolved", "timed_out", "cancelled"]>;
5
4
  export type WaitState = typeof WaitState.Type;
6
5
  export declare const EnvelopeReadyState: Schema.Literals<readonly ["ready", "claimed", "acknowledged"]>;
@@ -188,7 +187,7 @@ export declare const EnvelopeReadyRow: Schema.Struct<{
188
187
  readonly claimed_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
189
188
  readonly acknowledged_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
190
189
  }>;
191
- export declare const layer: Layer.Layer<Service, never, SqlClient>;
190
+ export declare const layer: Layer.Layer<Service, never, import("effect/unstable/sql/SqlClient").SqlClient>;
192
191
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
193
192
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
194
193
  export declare const acceptEnvelope: (input: AcceptEnvelopeInput) => Effect.Effect<Envelope.EnvelopeAccepted, EnvelopeRepositoryError, Service>;
@@ -0,0 +1,64 @@
1
+ import { Ids, Shared } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import type { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import type { CompleteWaitInput, CreateWaitInput, EnvelopeRepositoryError, ListAllWaitsInput, ListWaitsInput, ResolveWaitInput, WaitNotFound, WaitRecord } from "./envelope-repository";
5
+ export declare const waitRow: Schema.Struct<{
6
+ readonly id: Schema.String;
7
+ readonly execution_id: Schema.String;
8
+ readonly envelope_id: Schema.Union<readonly [Schema.String, Schema.Null]>;
9
+ readonly mode: Schema.String;
10
+ readonly correlation_key: Schema.Union<readonly [Schema.String, Schema.Null]>;
11
+ readonly state: Schema.String;
12
+ readonly metadata_json: Schema.Unknown;
13
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
14
+ readonly resolved_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
15
+ }>;
16
+ export declare const metadata: (input: Shared.Metadata | undefined) => {
17
+ readonly [x: string]: Schema.Json;
18
+ };
19
+ export declare const listWaitsLimit: (input: ListWaitsInput) => number;
20
+ declare const compareWaitsDesc: (left: WaitRecord, right: WaitRecord) => number;
21
+ export declare const waitRecordOrdering: {
22
+ compareWaitsDesc: typeof compareWaitsDesc;
23
+ };
24
+ interface WaitRecordErrors {
25
+ readonly EnvelopeRepositoryError: {
26
+ readonly make: (input: {
27
+ readonly message: string;
28
+ }) => EnvelopeRepositoryError;
29
+ };
30
+ readonly WaitNotFound: {
31
+ readonly make: (input: {
32
+ readonly id: Ids.WaitId;
33
+ }) => WaitNotFound;
34
+ };
35
+ }
36
+ interface MakeWaitRecordOperationsInput {
37
+ readonly sql: SqlClient;
38
+ readonly ts: (millis: number) => Date | number;
39
+ readonly errors: WaitRecordErrors;
40
+ }
41
+ export declare const makeWaitRecordOperations: ({ sql, ts, errors }: MakeWaitRecordOperationsInput) => {
42
+ getWaitRow: (tenantId: Ids.TenantId, id: Ids.WaitId) => Effect.Effect<Schema.Struct.ReadonlySide<{
43
+ readonly id: Schema.String;
44
+ readonly execution_id: Schema.String;
45
+ readonly envelope_id: Schema.Union<readonly [Schema.String, Schema.Null]>;
46
+ readonly mode: Schema.String;
47
+ readonly correlation_key: Schema.Union<readonly [Schema.String, Schema.Null]>;
48
+ readonly state: Schema.String;
49
+ readonly metadata_json: Schema.Unknown;
50
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
51
+ readonly resolved_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite, Schema.Null]>;
52
+ }, "Type"> | undefined, EnvelopeRepositoryError, never>;
53
+ getWait: (id: string & import("effect/Brand").Brand<"Relay.WaitId">) => Effect.Effect<WaitRecord | undefined, EnvelopeRepositoryError, never>;
54
+ createWait: (input: CreateWaitInput) => Effect.Effect<WaitRecord, EnvelopeRepositoryError, never>;
55
+ listWaits: (input: ListWaitsInput) => Effect.Effect<WaitRecord[], EnvelopeRepositoryError, never>;
56
+ findOpenByCorrelation: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, correlationKey: string) => Effect.Effect<WaitRecord | undefined, EnvelopeRepositoryError, never>;
57
+ listAllWaits: (input: ListAllWaitsInput) => Effect.Effect<WaitRecord[], EnvelopeRepositoryError, never>;
58
+ completeWait: (input: CompleteWaitInput) => Effect.Effect<{
59
+ wait: WaitRecord;
60
+ transitioned: boolean;
61
+ }, EnvelopeRepositoryError | WaitNotFound, never>;
62
+ resolveWait: (input: ResolveWaitInput) => Effect.Effect<WaitRecord, EnvelopeRepositoryError | WaitNotFound, never>;
63
+ };
64
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Layer } from "effect";
2
+ import type { DuplicateExecutionEvent, ExecutionEventCursorNotFound, ExecutionEventOrderViolation, Service } from "./execution-event-repository";
3
+ export declare const makeMemoryLayer: (repository: {
4
+ readonly DuplicateExecutionEvent: typeof DuplicateExecutionEvent;
5
+ readonly ExecutionEventOrderViolation: typeof ExecutionEventOrderViolation;
6
+ readonly ExecutionEventCursorNotFound: typeof ExecutionEventCursorNotFound;
7
+ readonly Service: typeof Service;
8
+ }) => Layer.Layer<Service, never, never>;
@@ -0,0 +1,13 @@
1
+ import { Layer } from "effect";
2
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
3
+ import { Service as NotificationBusService } from "../database/notification-bus";
4
+ import type { DuplicateExecutionEvent, ExecutionEventCursorNotFound, ExecutionEventOrderViolation, ExecutionEventRepositoryError, ExecutionEventRow, Service, executionEventsChannel } from "./execution-event-repository";
5
+ export declare const makeLayer: (repository: {
6
+ readonly DuplicateExecutionEvent: typeof DuplicateExecutionEvent;
7
+ readonly ExecutionEventOrderViolation: typeof ExecutionEventOrderViolation;
8
+ readonly ExecutionEventCursorNotFound: typeof ExecutionEventCursorNotFound;
9
+ readonly ExecutionEventRepositoryError: typeof ExecutionEventRepositoryError;
10
+ readonly ExecutionEventRow: typeof ExecutionEventRow;
11
+ readonly Service: typeof Service;
12
+ readonly executionEventsChannel: typeof executionEventsChannel;
13
+ }) => Layer.Layer<Service, never, NotificationBusService | SqlClient>;
@@ -1,7 +1,6 @@
1
1
  import { Execution, Ids } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
3
- import { SqlClient } from "effect/unstable/sql/SqlClient";
4
- import { Service as NotificationBusService, type Transport } from "../database/notification-bus";
3
+ import { type Transport } from "../database/notification-bus";
5
4
  export declare const executionEventsChannel = "relay_execution_events";
6
5
  declare const DuplicateExecutionEvent_base: Schema.Class<DuplicateExecutionEvent, Schema.TaggedStruct<"DuplicateExecutionEvent", {
7
6
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
@@ -39,6 +38,13 @@ export interface ListInput {
39
38
  readonly afterCursor?: string;
40
39
  readonly limit?: number;
41
40
  }
41
+ export interface AppendNextInput extends Omit<Execution.ExecutionEvent, "sequence"> {
42
+ readonly minimumSequence?: Execution.ExecutionEventSequence;
43
+ }
44
+ export interface AppendNextResult {
45
+ readonly event: Execution.ExecutionEvent;
46
+ readonly inserted: boolean;
47
+ }
42
48
  export interface FindBySequenceOrCursorInput {
43
49
  readonly executionId: Ids.ExecutionId;
44
50
  readonly sequence: Execution.ExecutionEventSequence;
@@ -84,6 +90,7 @@ export interface PageResult {
84
90
  export interface Interface {
85
91
  readonly signalTransport: Transport;
86
92
  readonly append: (input: Execution.ExecutionEvent) => Effect.Effect<Execution.ExecutionEvent, DuplicateExecutionEvent | ExecutionEventOrderViolation | ExecutionEventRepositoryError>;
93
+ readonly appendNext: (input: AppendNextInput) => Effect.Effect<AppendNextResult, DuplicateExecutionEvent | ExecutionEventRepositoryError>;
87
94
  readonly list: (input: ListInput) => Effect.Effect<ReadonlyArray<Execution.ExecutionEvent>, ExecutionEventCursorNotFound | ExecutionEventRepositoryError>;
88
95
  readonly findBySequenceOrCursor: (input: FindBySequenceOrCursorInput) => Effect.Effect<Option.Option<Execution.ExecutionEvent>, ExecutionEventRepositoryError>;
89
96
  readonly findByCursor: (input: FindByCursorInput) => Effect.Effect<Option.Option<Execution.ExecutionEvent>, ExecutionEventRepositoryError>;
@@ -110,12 +117,13 @@ export declare const ExecutionEventRow: Schema.Struct<{
110
117
  readonly data_json: Schema.Unknown;
111
118
  readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
112
119
  }>;
113
- export declare const layer: Layer.Layer<Service, never, NotificationBusService | SqlClient>;
114
- export declare const layerWithBus: Layer.Layer<Service, never, SqlClient>;
120
+ export declare const layer: Layer.Layer<Service, never, import("../database/notification-bus").Service | import("effect/unstable/sql/SqlClient").SqlClient>;
121
+ export declare const layerWithBus: Layer.Layer<Service, never, import("effect/unstable/sql/SqlClient").SqlClient>;
115
122
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
116
- type TestImplementation = Omit<Interface, "page"> & Partial<Pick<Interface, "page">>;
123
+ export type TestImplementation = Omit<Interface, "appendNext" | "page"> & Partial<Pick<Interface, "appendNext" | "page">>;
117
124
  export declare const testLayer: (implementation: TestImplementation) => Layer.Layer<Service, never, never>;
118
125
  export declare const append: (input: Execution.ExecutionEvent) => Effect.Effect<Execution.ExecutionEvent, DuplicateExecutionEvent | ExecutionEventOrderViolation | ExecutionEventRepositoryError, Service>;
126
+ export declare const appendNext: (input: AppendNextInput) => Effect.Effect<AppendNextResult, DuplicateExecutionEvent | ExecutionEventRepositoryError, Service>;
119
127
  export declare const list: (input: ListInput) => Effect.Effect<readonly Execution.ExecutionEvent[], ExecutionEventCursorNotFound | ExecutionEventRepositoryError, Service>;
120
128
  export declare const page: (input: PageInput) => Effect.Effect<PageResult, ExecutionEventCursorNotFound | ExecutionEventRepositoryError, Service>;
121
129
  export declare const findBySequenceOrCursor: (input: FindBySequenceOrCursorInput) => Effect.Effect<Option.Option<Execution.ExecutionEvent>, ExecutionEventRepositoryError, Service>;
@@ -8,7 +8,7 @@ export * as CompactionRepository from "./compaction/compaction-repository";
8
8
  export * as Database from "./database/database-service";
9
9
  export * as SqlDialect from "./database/sql-dialect";
10
10
  export * as EnvelopeRepository from "./envelope/envelope-repository";
11
- export * as EntityRepository from "./entity/entity-repository";
11
+ export * as ResidentRepository from "./resident/resident-repository";
12
12
  export * as ExecutionEventRepository from "./execution/execution-event-repository";
13
13
  export * as ExecutionRepository from "./execution/execution-repository";
14
14
  export * as ExecutionStateRepository from "./state/execution-state-repository";
@@ -7,7 +7,7 @@ export * as ClusterRegistryRepository from "./cluster/cluster-registry-repositor
7
7
  export * as CompactionRepository from "./compaction/compaction-repository";
8
8
  export * as ContextEpochRepository from "./session/context-epoch-repository";
9
9
  export * as EnvelopeRepository from "./envelope/envelope-repository";
10
- export * as EntityRepository from "./entity/entity-repository";
10
+ export * as ResidentRepository from "./resident/resident-repository";
11
11
  export * as ExecutionEventRepository from "./execution/execution-event-repository";
12
12
  export * as ExecutionRepository from "./execution/execution-repository";
13
13
  export * as ExecutionStateRepository from "./state/execution-state-repository";
@@ -0,0 +1,36 @@
1
+ import { Ids, Resident } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ declare const ResidentRepositoryError_base: Schema.Class<ResidentRepositoryError, Schema.TaggedStruct<"ResidentRepositoryError", {
5
+ readonly message: Schema.String;
6
+ }>, import("effect/Cause").YieldableError>;
7
+ export declare class ResidentRepositoryError extends ResidentRepositoryError_base {
8
+ }
9
+ export interface CreateInstanceInput {
10
+ readonly kind: Ids.ResidentKindName;
11
+ readonly key: Ids.ResidentKey;
12
+ readonly addressId: Ids.AddressId;
13
+ readonly executionId: (generation: number) => Ids.ExecutionId;
14
+ readonly createdAt: number;
15
+ }
16
+ export interface Interface {
17
+ readonly putKind: (definition: Resident.KindDefinition) => Effect.Effect<Resident.KindDefinition, ResidentRepositoryError>;
18
+ readonly getKind: (kind: Ids.ResidentKindName) => Effect.Effect<Resident.KindDefinition | undefined, ResidentRepositoryError>;
19
+ readonly listKinds: (_?: never) => Effect.Effect<ReadonlyArray<Resident.KindDefinition>, ResidentRepositoryError>;
20
+ readonly spawn: (input: CreateInstanceInput) => Effect.Effect<Resident.Instance, ResidentRepositoryError>;
21
+ readonly get: (kind: Ids.ResidentKindName, key: Ids.ResidentKey) => Effect.Effect<Resident.Instance | undefined, ResidentRepositoryError>;
22
+ readonly destroy: (kind: Ids.ResidentKindName, key: Ids.ResidentKey, destroyedAt: number) => Effect.Effect<Resident.Instance | undefined, ResidentRepositoryError>;
23
+ readonly list: (input: {
24
+ readonly kind?: Ids.ResidentKindName;
25
+ readonly afterKind?: Ids.ResidentKindName;
26
+ readonly afterKey?: string;
27
+ readonly limit?: number;
28
+ }) => Effect.Effect<ReadonlyArray<Resident.Instance>, ResidentRepositoryError>;
29
+ }
30
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/resident/resident-repository/Service", Interface>;
31
+ export declare class Service extends Service_base {
32
+ }
33
+ export declare const layer: Layer.Layer<Service, never, SqlClient>;
34
+ export declare const memoryLayer: Layer.Layer<Service, never, never>;
35
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
36
+ export {};