@relayfx/sdk 0.3.7 → 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 (89) hide show
  1. package/dist/ai.js +1 -1
  2. package/dist/http-server.js +1 -1
  3. package/dist/{index-pw46cfne.js → index-3w6txjtg.js} +59 -426
  4. package/dist/{index-h8rx4xya.js → index-cs3be24t.js} +1 -1
  5. package/dist/{index-8awt651b.js → index-p43mg4kt.js} +5774 -5275
  6. package/dist/{index-t5bbk8cp.js → index-x32kbvxv.js} +935 -954
  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 +41 -41
  41. package/dist/types/relay/sqlite-migrations.d.ts +6 -1
  42. package/dist/types/runtime/agent/agent-loop-events.d.ts +24 -0
  43. package/dist/types/runtime/execution/event-log-memory.d.ts +7 -0
  44. package/dist/types/runtime/execution/event-log-repository.d.ts +8 -0
  45. package/dist/types/runtime/index.d.ts +2 -2
  46. package/dist/types/runtime/resident/resident-instance-service.d.ts +76 -0
  47. package/dist/types/runtime/resident/resident-registry-service.d.ts +35 -0
  48. package/dist/types/runtime/runner/runner-runtime-service.d.ts +14 -14
  49. package/dist/types/runtime/workflow/execution-workflow-state.d.ts +43 -0
  50. package/dist/types/schema/execution-schema.d.ts +2 -2
  51. package/dist/types/schema/ids-schema.d.ts +6 -6
  52. package/dist/types/schema/index.d.ts +1 -1
  53. package/dist/types/schema/{entity-schema.d.ts → resident-schema.d.ts} +6 -6
  54. package/dist/types/store-sql/envelope/envelope-ready-records.d.ts +51 -0
  55. package/dist/types/store-sql/envelope/envelope-records.d.ts +43 -0
  56. package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -2
  57. package/dist/types/store-sql/envelope/wait-records.d.ts +64 -0
  58. package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +8 -0
  59. package/dist/types/store-sql/execution/execution-event-repository-sql.d.ts +13 -0
  60. package/dist/types/store-sql/execution/execution-event-repository.d.ts +3 -4
  61. package/dist/types/store-sql/index.d.ts +1 -1
  62. package/dist/types/store-sql/portable.d.ts +1 -1
  63. package/dist/types/store-sql/resident/resident-repository.d.ts +36 -0
  64. package/dist/types/store-sql/schema/address-book-schema.d.ts +131 -0
  65. package/dist/types/store-sql/schema/agent-schema.d.ts +954 -0
  66. package/dist/types/store-sql/schema/communication-schema.d.ts +743 -0
  67. package/dist/types/store-sql/schema/envelope-schema.d.ts +701 -0
  68. package/dist/types/store-sql/schema/execution-schema.d.ts +1119 -0
  69. package/dist/types/store-sql/schema/idempotency-schema.d.ts +161 -0
  70. package/dist/types/store-sql/schema/presence-schema.d.ts +116 -0
  71. package/dist/types/store-sql/schema/relay-schema.d.ts +13 -6684
  72. package/dist/types/store-sql/schema/resident-schema.d.ts +294 -0
  73. package/dist/types/store-sql/schema/schedule-schema.d.ts +282 -0
  74. package/dist/types/store-sql/schema/schema-columns.d.ts +1 -0
  75. package/dist/types/store-sql/schema/session-schema.d.ts +228 -0
  76. package/dist/types/store-sql/schema/tool-schema.d.ts +627 -0
  77. package/dist/types/store-sql/schema/workflow-schema.d.ts +996 -0
  78. package/dist/types/store-sql/schema/workspace-schema.d.ts +338 -0
  79. package/dist/types/store-sql/session/session-entry-records.d.ts +52 -0
  80. package/dist/types/store-sql/session/session-records.d.ts +51 -0
  81. package/dist/types/store-sql/session/session-repository.d.ts +2 -3
  82. package/dist/types/store-sql/tool/tool-attempt-records.d.ts +52 -0
  83. package/dist/types/store-sql/tool/tool-call-records.d.ts +121 -0
  84. package/dist/types/store-sql/tool/tool-call-repository.d.ts +1 -2
  85. package/dist/types/store-sql/tool/tool-work-operations.d.ts +11 -0
  86. package/package.json +3 -3
  87. package/dist/types/runtime/entity/entity-instance-service.d.ts +0 -76
  88. package/dist/types/runtime/entity/entity-registry-service.d.ts +0 -35
  89. package/dist/types/store-sql/entity/entity-repository.d.ts +0 -36
@@ -1 +1,118 @@
1
- export * from "./client-public";
1
+ import { getAgentDefinition, getSkillDefinition, listAgentDefinitionRevisions, listAgentDefinitions, listSkillDefinitionRevisions, listSkillDefinitions, registerAgent, registerAgentDefinition } from "./client-public-agents";
2
+ import { cancelChildFanOut, createChildFanOut, inspectChildFanOut, spawnChildRun } from "./client-public-child-runs";
3
+ import { ackEnvelopeReady, claimEnvelopeReady, releaseEnvelopeReady } from "./client-public-envelope-ready";
4
+ import { cancelExecution, followExecution, getExecution, getSession, inspectExecution, listExecutions, listRunners, listSessions, listWaits, pageExecutionEvents, replayExecution, routeExecution, startExecution, startExecutionByAddress, startExecutionByAgentDefinition, steer, streamExecution, streamSession, watchExecutions } from "./client-public-executions";
5
+ import { awaitWait, getAddressBookRoute, getPresence, listAddressBookRoutes, listInboxMessages, listTopicSubscriptions, publishTopic, registerAddressBookRoute, send, submitInboundEnvelope, subscribeTopic, unsubscribeTopic, wake, watchPresence } from "./client-public-messaging";
6
+ import { askResident, deleteResidentState, destroyResident, getResident, getResidentState, listResidents, listResidentState, putResidentState, registerResidentKind, spawnResident } from "./client-public-residents";
7
+ import { cancelSchedule, createSchedule, listSchedules } from "./client-public-schedules";
8
+ import { claimToolWork, completeToolWork, fulfillToolCall, listPendingApprovals, listPendingToolCalls, listToolAttempts, releaseToolWork, resolvePermission, resolveToolApproval } from "./client-public-tools";
9
+ import { cancelWorkflowRun, getWorkflowDefinitionRevision, inspectWorkflowRun, listWorkflowDefinitionRevisions, registerWorkflowDefinition, replayWorkflowRun, startWorkflowRun } from "./client-public-workflows";
10
+ export { ClientError, EventLogCursorNotFound, ExecutionNotFound, followExecutionFrom, ResidentNamespaceReserved, Service, StateVersionConflict, WaitKindMismatch, } from "./client-public";
11
+ export type { AskResidentInput, FollowExecutionDependencies, Identifier, Interface, RegisterAgent, RegisterAgentInput, RegisterBatonAgentInput, RegisterDefinedAgentInput, StartExecutionByAddressInput, StartExecutionByAgentDefinitionInput, } from "./client-public";
12
+ export declare const executions: {
13
+ start: typeof startExecution;
14
+ startByAddress: typeof startExecutionByAddress;
15
+ startByAgentDefinition: typeof startExecutionByAgentDefinition;
16
+ cancel: typeof cancelExecution;
17
+ get: typeof getExecution;
18
+ list: typeof listExecutions;
19
+ replay: typeof replayExecution;
20
+ pageEvents: typeof pageExecutionEvents;
21
+ inspect: typeof inspectExecution;
22
+ route: typeof routeExecution;
23
+ steer: typeof steer;
24
+ stream: typeof streamExecution;
25
+ follow: typeof followExecution;
26
+ watch: typeof watchExecutions;
27
+ };
28
+ export declare const residents: {
29
+ spawn: typeof spawnResident;
30
+ get: typeof getResident;
31
+ destroy: typeof destroyResident;
32
+ list: typeof listResidents;
33
+ ask: typeof askResident;
34
+ registerKind: typeof registerResidentKind;
35
+ getState: typeof getResidentState;
36
+ putState: typeof putResidentState;
37
+ deleteState: typeof deleteResidentState;
38
+ listState: typeof listResidentState;
39
+ };
40
+ export declare const agents: {
41
+ register: typeof registerAgent;
42
+ registerDefinition: typeof registerAgentDefinition;
43
+ getDefinition: typeof getAgentDefinition;
44
+ listDefinitions: typeof listAgentDefinitions;
45
+ listDefinitionRevisions: typeof listAgentDefinitionRevisions;
46
+ };
47
+ export declare const skills: {
48
+ getDefinition: typeof getSkillDefinition;
49
+ listDefinitions: typeof listSkillDefinitions;
50
+ listDefinitionRevisions: typeof listSkillDefinitionRevisions;
51
+ };
52
+ export declare const sessions: {
53
+ get: typeof getSession;
54
+ list: typeof listSessions;
55
+ stream: typeof streamSession;
56
+ };
57
+ export declare const waits: {
58
+ list: typeof listWaits;
59
+ await: typeof awaitWait;
60
+ wake: typeof wake;
61
+ };
62
+ export declare const envelopes: {
63
+ send: typeof send;
64
+ submitInbound: typeof submitInboundEnvelope;
65
+ listInbox: typeof listInboxMessages;
66
+ claimReady: typeof claimEnvelopeReady;
67
+ ackReady: typeof ackEnvelopeReady;
68
+ releaseReady: typeof releaseEnvelopeReady;
69
+ };
70
+ export declare const tools: {
71
+ listPending: typeof listPendingToolCalls;
72
+ fulfill: typeof fulfillToolCall;
73
+ claimWork: typeof claimToolWork;
74
+ completeWork: typeof completeToolWork;
75
+ releaseWork: typeof releaseToolWork;
76
+ listAttempts: typeof listToolAttempts;
77
+ listPendingApprovals: typeof listPendingApprovals;
78
+ resolveApproval: typeof resolveToolApproval;
79
+ resolvePermission: typeof resolvePermission;
80
+ };
81
+ export declare const topics: {
82
+ subscribe: typeof subscribeTopic;
83
+ unsubscribe: typeof unsubscribeTopic;
84
+ publish: typeof publishTopic;
85
+ listSubscriptions: typeof listTopicSubscriptions;
86
+ };
87
+ export declare const childRuns: {
88
+ spawn: typeof spawnChildRun;
89
+ createFanOut: typeof createChildFanOut;
90
+ cancelFanOut: typeof cancelChildFanOut;
91
+ inspectFanOut: typeof inspectChildFanOut;
92
+ };
93
+ export declare const schedules: {
94
+ create: typeof createSchedule;
95
+ cancel: typeof cancelSchedule;
96
+ list: typeof listSchedules;
97
+ };
98
+ export declare const workflows: {
99
+ registerDefinition: typeof registerWorkflowDefinition;
100
+ getDefinitionRevision: typeof getWorkflowDefinitionRevision;
101
+ listDefinitionRevisions: typeof listWorkflowDefinitionRevisions;
102
+ startRun: typeof startWorkflowRun;
103
+ cancelRun: typeof cancelWorkflowRun;
104
+ replayRun: typeof replayWorkflowRun;
105
+ inspectRun: typeof inspectWorkflowRun;
106
+ };
107
+ export declare const addressBook: {
108
+ register: typeof registerAddressBookRoute;
109
+ get: typeof getAddressBookRoute;
110
+ list: typeof listAddressBookRoutes;
111
+ };
112
+ export declare const presence: {
113
+ get: typeof getPresence;
114
+ watch: typeof watchPresence;
115
+ };
116
+ export declare const runners: {
117
+ list: typeof listRunners;
118
+ };
@@ -34,14 +34,14 @@ declare const CommandReplyInvalid_base: Schema.Class<CommandReplyInvalid, Schema
34
34
  }>, import("effect/Cause").YieldableError>;
35
35
  export declare class CommandReplyInvalid extends CommandReplyInvalid_base {
36
36
  }
37
- declare const EntityNotFound_base: Schema.Class<EntityNotFound, Schema.TaggedStruct<"EntityNotFound", {
38
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
39
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
37
+ declare const ResidentNotFound_base: Schema.Class<ResidentNotFound, Schema.TaggedStruct<"ResidentNotFound", {
38
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
39
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
40
40
  };
41
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
42
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
41
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
42
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
43
43
  };
44
44
  }>, import("effect/Cause").YieldableError>;
45
- export declare class EntityNotFound extends EntityNotFound_base {
45
+ export declare class ResidentNotFound extends ResidentNotFound_base {
46
46
  }
47
47
  export {};
@@ -1,9 +1,9 @@
1
- import type { Agent, Entity, Envelope, Execution, Ids, Inbox, Presence, Shared, State } from "../schema/index";
1
+ import type { Agent, Resident, Envelope, Execution, Ids, Inbox, Presence, Shared, State } from "../schema/index";
2
2
  export { StateVersionConflict } from "./state-version-conflict";
3
3
  import type { StateVersionConflict } from "./state-version-conflict";
4
4
  import { Context } from "effect";
5
5
  import type { Effect, Scope, Stream } from "effect";
6
- import type { CancelExecutionAccepted, CancelExecutionInput, ClaimToolWorkInput, CompleteToolWorkInput, DeleteEntityStateInput, DestroyEntityInput, ExecutionInspection, ExecutionListChange, FulfillToolCallInput, GetEntityInput, GetEntityStateInput, GetOrCreateEntityInput, ListEntitiesInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListPendingToolCallsInput, ListEntityStateInput, ListToolAttemptsInput, ListWaitsInput, PendingToolCallList, PutEntityStateInput, ReleaseToolWorkInput, ResolvePermissionInput, SessionStreamItem, SpawnChildRunInput, StartExecutionResult, SteerAccepted, SteerInput, StreamExecutionInput, StreamSessionInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, WaitView, WakeAccepted, WakeInput, WatchExecutionsInput } from "./operation";
6
+ import type { CancelExecutionAccepted, CancelExecutionInput, ClaimToolWorkInput, CompleteToolWorkInput, DeleteResidentStateInput, DestroyResidentInput, ExecutionInspection, ExecutionListChange, FulfillToolCallInput, GetResidentInput, GetResidentStateInput, ListResidentsInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListPendingToolCallsInput, ListResidentStateInput, ListToolAttemptsInput, ListWaitsInput, PendingToolCallList, PutResidentStateInput, ReleaseToolWorkInput, ResolvePermissionInput, SessionStreamItem, SpawnResidentInput, SpawnChildRunInput, StartExecutionResult, SteerAccepted, SteerInput, StreamExecutionInput, StreamSessionInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, WaitView, WakeAccepted, WakeInput, WatchExecutionsInput } from "./operation";
7
7
  export interface ClientError {
8
8
  readonly _tag: "ClientError";
9
9
  readonly message: string;
@@ -17,8 +17,8 @@ export interface ExecutionNotFound {
17
17
  readonly _tag: "ExecutionNotFound";
18
18
  readonly execution_id: Ids.ExecutionId;
19
19
  }
20
- export interface EntityNamespaceReserved {
21
- readonly _tag: "EntityNamespaceReserved";
20
+ export interface ResidentNamespaceReserved {
21
+ readonly _tag: "ResidentNamespaceReserved";
22
22
  readonly id: string;
23
23
  readonly message: string;
24
24
  }
@@ -42,39 +42,57 @@ export interface StartExecutionByAddressInput {
42
42
  readonly metadata?: Shared.Metadata;
43
43
  }
44
44
  export interface ClientInterface {
45
- readonly listAgentDefinitions: (_?: void) => Effect.Effect<Agent.DefinitionList, ClientError>;
46
- readonly registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
47
- readonly startExecutionByAddress: (input: StartExecutionByAddressInput) => Effect.Effect<StartExecutionResult, EntityNamespaceReserved | ClientError>;
48
- readonly cancelExecution: (input: CancelExecutionInput) => Effect.Effect<CancelExecutionAccepted, ClientError>;
49
- readonly steer: (input: SteerInput) => Effect.Effect<SteerAccepted, ClientError>;
50
- readonly getExecution: (id: Ids.ExecutionId) => Effect.Effect<Execution.Execution | undefined, ClientError>;
51
- readonly inspectExecution: (executionId: Ids.ExecutionId) => Effect.Effect<ExecutionInspection, ExecutionNotFound | ClientError>;
52
- readonly listExecutions: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ClientError>;
53
- readonly send: (input: Envelope.SendInput) => Effect.Effect<Envelope.EnvelopeAccepted, ClientError>;
54
- readonly listWaits: (input: ListWaitsInput) => Effect.Effect<ReadonlyArray<WaitView>, ClientError>;
55
- readonly wake: (input: WakeInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
56
- readonly resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
57
- readonly spawnChildRun: (input: SpawnChildRunInput) => Effect.Effect<Execution.ChildRunAccepted, ClientError>;
58
- readonly streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError>;
59
- readonly streamSession: (input: StreamSessionInput) => Stream.Stream<SessionStreamItem, EventLogCursorNotFound | ClientError>;
60
- readonly watchExecutions: (input: WatchExecutionsInput) => Stream.Stream<ExecutionListChange, ClientError>;
61
- readonly getPresence: (scope: Presence.Scope) => Effect.Effect<Presence.View, ClientError>;
62
- readonly watchPresence: (scope: Presence.Scope) => Stream.Stream<Presence.View, ClientError>;
63
- readonly listPendingToolCalls: (input: ListPendingToolCallsInput) => Effect.Effect<PendingToolCallList, ClientError>;
64
- readonly fulfillToolCall: (input: FulfillToolCallInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
65
- readonly claimToolWork: (input: ClaimToolWorkInput) => Effect.Effect<ToolWorkLease | null, ClientError>;
66
- readonly completeToolWork: (input: CompleteToolWorkInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
67
- readonly releaseToolWork: (input: ReleaseToolWorkInput) => Effect.Effect<ToolWorkReleased, ClientError>;
68
- readonly listToolAttempts: (input: ListToolAttemptsInput) => Effect.Effect<ToolAttemptList, ClientError>;
69
- readonly getOrCreateEntity: (input: GetOrCreateEntityInput) => Effect.Effect<Entity.Instance, ClientError>;
70
- readonly listEntities: (input: ListEntitiesInput) => Effect.Effect<ReadonlyArray<Entity.Instance>, ClientError>;
71
- readonly getEntity: (input: GetEntityInput) => Effect.Effect<Entity.Instance | undefined, ClientError>;
72
- readonly destroyEntity: (input: DestroyEntityInput) => Effect.Effect<Entity.Instance, ClientError>;
73
- readonly listInboxMessages: (input: ListInboxMessagesInput) => Effect.Effect<ReadonlyArray<Inbox.Message>, ClientError>;
74
- readonly getEntityState: (input: GetEntityStateInput) => Effect.Effect<State.StateRecordView | undefined, ClientError>;
75
- readonly putEntityState: (input: PutEntityStateInput) => Effect.Effect<State.StateRecordView, StateVersionConflict | ClientError>;
76
- readonly deleteEntityState: (input: DeleteEntityStateInput) => Effect.Effect<State.StateRecordView | undefined, StateVersionConflict | ClientError>;
77
- readonly listEntityState: (input: ListEntityStateInput) => Effect.Effect<ReadonlyArray<State.StateRecordView>, ClientError>;
45
+ readonly agents: {
46
+ readonly listDefinitions: (_?: void) => Effect.Effect<Agent.DefinitionList, ClientError>;
47
+ readonly registerDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
48
+ };
49
+ readonly executions: {
50
+ readonly startByAddress: (input: StartExecutionByAddressInput) => Effect.Effect<StartExecutionResult, ResidentNamespaceReserved | ClientError>;
51
+ readonly cancel: (input: CancelExecutionInput) => Effect.Effect<CancelExecutionAccepted, ClientError>;
52
+ readonly steer: (input: SteerInput) => Effect.Effect<SteerAccepted, ClientError>;
53
+ readonly get: (id: Ids.ExecutionId) => Effect.Effect<Execution.Execution | undefined, ClientError>;
54
+ readonly inspect: (executionId: Ids.ExecutionId) => Effect.Effect<ExecutionInspection, ExecutionNotFound | ClientError>;
55
+ readonly list: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ClientError>;
56
+ readonly stream: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError>;
57
+ readonly watch: (input: WatchExecutionsInput) => Stream.Stream<ExecutionListChange, ClientError>;
58
+ };
59
+ readonly envelopes: {
60
+ readonly send: (input: Envelope.SendInput) => Effect.Effect<Envelope.EnvelopeAccepted, ClientError>;
61
+ readonly listInbox: (input: ListInboxMessagesInput) => Effect.Effect<ReadonlyArray<Inbox.Message>, ClientError>;
62
+ };
63
+ readonly waits: {
64
+ readonly list: (input: ListWaitsInput) => Effect.Effect<ReadonlyArray<WaitView>, ClientError>;
65
+ readonly wake: (input: WakeInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
66
+ };
67
+ readonly tools: {
68
+ readonly resolvePermission: (input: ResolvePermissionInput) => Effect.Effect<WakeAccepted, WaitKindMismatch | ClientError>;
69
+ readonly listPending: (input: ListPendingToolCallsInput) => Effect.Effect<PendingToolCallList, ClientError>;
70
+ readonly fulfill: (input: FulfillToolCallInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
71
+ readonly claimWork: (input: ClaimToolWorkInput) => Effect.Effect<ToolWorkLease | null, ClientError>;
72
+ readonly completeWork: (input: CompleteToolWorkInput) => Effect.Effect<ToolOutcomeAccepted, ClientError>;
73
+ readonly releaseWork: (input: ReleaseToolWorkInput) => Effect.Effect<ToolWorkReleased, ClientError>;
74
+ readonly listAttempts: (input: ListToolAttemptsInput) => Effect.Effect<ToolAttemptList, ClientError>;
75
+ };
76
+ readonly childRuns: {
77
+ readonly spawn: (input: SpawnChildRunInput) => Effect.Effect<Execution.ChildRunAccepted, ClientError>;
78
+ };
79
+ readonly sessions: {
80
+ readonly stream: (input: StreamSessionInput) => Stream.Stream<SessionStreamItem, EventLogCursorNotFound | ClientError>;
81
+ };
82
+ readonly presence: {
83
+ readonly get: (scope: Presence.Scope) => Effect.Effect<Presence.View, ClientError>;
84
+ readonly watch: (scope: Presence.Scope) => Stream.Stream<Presence.View, ClientError>;
85
+ };
86
+ readonly residents: {
87
+ readonly spawn: (input: SpawnResidentInput) => Effect.Effect<Resident.Instance, ClientError>;
88
+ readonly list: (input: ListResidentsInput) => Effect.Effect<ReadonlyArray<Resident.Instance>, ClientError>;
89
+ readonly get: (input: GetResidentInput) => Effect.Effect<Resident.Instance | undefined, ClientError>;
90
+ readonly destroy: (input: DestroyResidentInput) => Effect.Effect<Resident.Instance, ClientError>;
91
+ readonly getState: (input: GetResidentStateInput) => Effect.Effect<State.StateRecordView | undefined, ClientError>;
92
+ readonly putState: (input: PutResidentStateInput) => Effect.Effect<State.StateRecordView, StateVersionConflict | ClientError>;
93
+ readonly deleteState: (input: DeleteResidentStateInput) => Effect.Effect<State.StateRecordView | undefined, StateVersionConflict | ClientError>;
94
+ readonly listState: (input: ListResidentStateInput) => Effect.Effect<ReadonlyArray<State.StateRecordView>, ClientError>;
95
+ };
78
96
  }
79
97
  export interface PresenceInterface {
80
98
  readonly register: (input: {
@@ -1,5 +1,4 @@
1
1
  import * as AdapterOutboxModule from "./adapter-outbox";
2
- import * as ClientModule from "./client-public";
3
2
  import * as ChildFanOutHostModule from "./child-fan-out-host";
4
3
  import * as CommandModule from "./command";
5
4
  import * as OperationModule from "./operation";
@@ -7,7 +6,7 @@ import * as ToolWorkerModule from "./tool-worker";
7
6
  import * as RuntimeModule from "./runtime";
8
7
  import * as WorkflowDefinitionHostModule from "./workflow-definition-host";
9
8
  import { DatabaseIdentity, makeDatabaseIdentity } from "./database-identity";
10
- import { Address, Agent, ChildOrchestration, Content, Entity, Envelope, Execution, Ids, Inbox, Pagination, Presence, Schedule, Shared, Skill, State, Tool, Waits, Workflow } from "../schema/index";
9
+ import { Address, Agent, ChildOrchestration, Content, Resident, Envelope, Execution, Ids, Inbox, Pagination, Presence, Schedule, Shared, Skill, State, Tool, Waits, Workflow } from "../schema/index";
11
10
  import * as ArtifactStoreModule from "../runtime/content/artifact-store-service";
12
11
  import * as BlobStoreModule from "../runtime/content/blob-store-service";
13
12
  import * as EmbeddingModelServiceModule from "../runtime/model/embedding-model-service";
@@ -18,7 +17,7 @@ import * as SchemaRegistryModule from "../runtime/schema-registry/schema-registr
18
17
  import * as ToolRuntimeModule from "./tool-runtime";
19
18
  import * as LanguageModelRegistrationModule from "./language-model-registration";
20
19
  export import AdapterOutbox = AdapterOutboxModule;
21
- export import Client = ClientModule;
20
+ export * as Client from "./client";
22
21
  export import ChildFanOutHost = ChildFanOutHostModule;
23
22
  export import Command = CommandModule;
24
23
  export import Operation = OperationModule;
@@ -34,4 +33,4 @@ export import PromptAssembler = PromptAssemblerModule;
34
33
  export import SchemaRegistry = SchemaRegistryModule;
35
34
  export import ToolRuntime = ToolRuntimeModule;
36
35
  export import LanguageModelRegistration = LanguageModelRegistrationModule;
37
- export { Address, Agent, ChildOrchestration, Content, DatabaseIdentity, Entity, Envelope, Execution, Ids, Inbox, Pagination, Presence, Schedule, Shared, Skill, State, Tool, Waits, Workflow, makeDatabaseIdentity, };
36
+ export { Address, Agent, ChildOrchestration, Content, DatabaseIdentity, Resident, Envelope, Execution, Ids, Inbox, Pagination, Presence, Schedule, Shared, Skill, State, Tool, Waits, Workflow, makeDatabaseIdentity, };
@@ -1,8 +1,8 @@
1
1
  import { Service as AddressBookService } from "../runtime/address/address-book-service";
2
2
  import { Service as AgentRegistryService } from "../runtime/agent/agent-registry-service";
3
3
  import { Service as EnvelopeServiceService } from "../runtime/envelope/envelope-service";
4
- import { Service as EntityInstanceServiceService } from "../runtime/entity/entity-instance-service";
5
- import { Service as EntityRegistryService } from "../runtime/entity/entity-registry-service";
4
+ import { Service as ResidentInstanceServiceService } from "../runtime/resident/resident-instance-service";
5
+ import { Service as ResidentRegistryService } from "../runtime/resident/resident-registry-service";
6
6
  import { Service as EventLogService } from "../runtime/execution/event-log-service";
7
7
  import { Service as ExecutionServiceService } from "../runtime/execution/execution-service";
8
8
  import { Service as ExecutionWatchService } from "../runtime/execution/execution-watch-service";
@@ -16,7 +16,7 @@ import { Service as WaitServiceService } from "../runtime/wait/wait-service";
16
16
  import { ChildExecutionRepository, ChildFanOutRepository, ClusterRegistryRepository, EnvelopeRepository, ExecutionRepository, InboxRepository, ScheduleRepository, SessionRepository, SteeringRepository, ToolCallRepository, WorkflowDefinitionRepository } from "../store-sql/portable";
17
17
  import { Layer } from "effect";
18
18
  import { Sharding, ShardingConfig } from "effect/unstable/cluster";
19
- import { Service, type Interface } from "./client-public";
20
- export type RuntimeRequirements = AgentRegistryService | EntityRegistryService | EntityInstanceServiceService | AddressBookService | ExecutionServiceService | EnvelopeServiceService | WaitServiceService | EventLogService | SessionStreamService | ExecutionWatchService | ExecutionStateService | PresenceServiceService | EnvelopeRepository.Service | ExecutionRepository.Service | InboxRepository.Service | TopicServiceService | ToolCallRepository.Service | ChildExecutionRepository.Service | ChildFanOutRepository.Service | SessionRepository.Service | SteeringRepository.Service | ClusterRegistryRepository.Service | ScheduleRepository.Service | SkillRegistryService | ToolTransitionCoordinatorService | WorkflowDefinitionRepository.Service | Sharding.Sharding | ShardingConfig.ShardingConfig;
19
+ import { Service, type FlatInterface } from "./client-public";
20
+ export type RuntimeRequirements = AgentRegistryService | ResidentRegistryService | ResidentInstanceServiceService | AddressBookService | ExecutionServiceService | EnvelopeServiceService | WaitServiceService | EventLogService | SessionStreamService | ExecutionWatchService | ExecutionStateService | PresenceServiceService | EnvelopeRepository.Service | ExecutionRepository.Service | InboxRepository.Service | TopicServiceService | ToolCallRepository.Service | ChildExecutionRepository.Service | ChildFanOutRepository.Service | SessionRepository.Service | SteeringRepository.Service | ClusterRegistryRepository.Service | ScheduleRepository.Service | SkillRegistryService | ToolTransitionCoordinatorService | WorkflowDefinitionRepository.Service | Sharding.Sharding | ShardingConfig.ShardingConfig;
21
21
  export declare const layerFromRuntime: Layer.Layer<Service, never, RuntimeRequirements>;
22
- export declare const testLayer: (implementation: Omit<Interface, "registerWorkflowDefinition" | "getWorkflowDefinitionRevision" | "listWorkflowDefinitionRevisions" | "startWorkflowRun" | "inspectWorkflowRun" | "replayWorkflowRun" | "cancelWorkflowRun" | "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities" | "followExecution" | "pageExecutionEvents"> & Partial<Interface>) => Layer.Layer<Service, never, never>;
22
+ export declare const testLayer: (implementation: Omit<FlatInterface, "registerWorkflowDefinition" | "getWorkflowDefinitionRevision" | "listWorkflowDefinitionRevisions" | "startWorkflowRun" | "inspectWorkflowRun" | "replayWorkflowRun" | "cancelWorkflowRun" | "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerResidentKind" | "spawnResident" | "getResident" | "destroyResident" | "listResidents" | "followExecution" | "pageExecutionEvents"> & Partial<FlatInterface>) => Layer.Layer<Service, never, never>;
@@ -1 +1 @@
1
- export declare const migrations: readonly [readonly [1, "baseline", string], readonly [2, "durable_tool_placement", string], readonly [3, "durable_inbox", string], readonly [4, "execution_state", string], readonly [5, "durable_entities", string], readonly [6, "ephemeral_presence", string], readonly [7, "topic_subscriptions", string], readonly [8, "child_fan_out", string], readonly [9, "workflow_definitions", string], readonly [10, "workflow_runtime", string]];
1
+ export declare const migrations: readonly [readonly [1, "baseline", string], readonly [2, "durable_tool_placement", string], readonly [3, "durable_inbox", string], readonly [4, "execution_state", string], readonly [5, "durable_entities", string], readonly [6, "ephemeral_presence", string], readonly [7, "topic_subscriptions", string], readonly [8, "child_fan_out", string], readonly [9, "workflow_definitions", string], readonly [10, "workflow_runtime", string], readonly [11, "execution_scoped_tool_calls", string], readonly [12, "rename_entity_to_resident", string]];
@@ -188,12 +188,12 @@ export declare const StartExecutionResult: Schema.Struct<{
188
188
  }>;
189
189
  export interface StartExecutionResult extends Schema.Schema.Type<typeof StartExecutionResult> {
190
190
  }
191
- export declare const GetOrCreateEntityInput: Schema.Struct<{
192
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
193
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
191
+ export declare const SpawnResidentInput: Schema.Struct<{
192
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
193
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
194
194
  };
195
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
196
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
195
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
196
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
197
197
  };
198
198
  readonly input: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
199
199
  readonly type: Schema.Literal<"text">;
@@ -247,48 +247,48 @@ export declare const GetOrCreateEntityInput: Schema.Struct<{
247
247
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
248
248
  readonly created_at: Schema.Int;
249
249
  }>;
250
- export interface GetOrCreateEntityInput extends Schema.Schema.Type<typeof GetOrCreateEntityInput> {
250
+ export interface SpawnResidentInput extends Schema.Schema.Type<typeof SpawnResidentInput> {
251
251
  }
252
- export declare const GetEntityInput: Schema.Struct<{
253
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
254
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
252
+ export declare const GetResidentInput: Schema.Struct<{
253
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
254
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
255
255
  };
256
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
257
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
256
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
257
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
258
258
  };
259
259
  }>;
260
- export interface GetEntityInput extends Schema.Schema.Type<typeof GetEntityInput> {
260
+ export interface GetResidentInput extends Schema.Schema.Type<typeof GetResidentInput> {
261
261
  }
262
- export declare const DestroyEntityInput: Schema.Struct<{
263
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
264
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
262
+ export declare const DestroyResidentInput: Schema.Struct<{
263
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
264
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
265
265
  };
266
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
267
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
266
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
267
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
268
268
  };
269
269
  readonly reason: Schema.optionalKey<Schema.String>;
270
270
  readonly destroyed_at: Schema.Int;
271
271
  }>;
272
- export interface DestroyEntityInput extends Schema.Schema.Type<typeof DestroyEntityInput> {
272
+ export interface DestroyResidentInput extends Schema.Schema.Type<typeof DestroyResidentInput> {
273
273
  }
274
- export declare const ListEntitiesInput: Schema.Struct<{
275
- readonly kind: Schema.optionalKey<Schema.brand<Schema.String, "Relay.EntityKindName"> & {
276
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
274
+ export declare const ListResidentsInput: Schema.Struct<{
275
+ readonly kind: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
276
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
277
277
  }>;
278
- readonly after_kind: Schema.optionalKey<Schema.brand<Schema.String, "Relay.EntityKindName"> & {
279
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
278
+ readonly after_kind: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
279
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
280
280
  }>;
281
281
  readonly after_key: Schema.optionalKey<Schema.String>;
282
282
  readonly limit: Schema.optionalKey<Schema.Int>;
283
283
  }>;
284
- export interface ListEntitiesInput extends Schema.Schema.Type<typeof ListEntitiesInput> {
284
+ export interface ListResidentsInput extends Schema.Schema.Type<typeof ListResidentsInput> {
285
285
  }
286
- export declare const EntityInstance: Schema.Struct<{
287
- readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
288
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
286
+ export declare const ResidentInstance: Schema.Struct<{
287
+ readonly kind: Schema.brand<Schema.String, "Relay.ResidentKindName"> & {
288
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKindName">;
289
289
  };
290
- readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
291
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
290
+ readonly key: Schema.brand<Schema.String, "Relay.ResidentKey"> & {
291
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ResidentKey">;
292
292
  };
293
293
  readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
294
294
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
@@ -310,15 +310,15 @@ export declare const StreamExecutionInput: Schema.Struct<{
310
310
  }>;
311
311
  export interface StreamExecutionInput extends Schema.Schema.Type<typeof StreamExecutionInput> {
312
312
  }
313
- export declare const GetEntityStateInput: Schema.Struct<{
313
+ export declare const GetResidentStateInput: Schema.Struct<{
314
314
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
315
315
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
316
316
  };
317
317
  readonly key: Schema.String;
318
318
  }>;
319
- export interface GetEntityStateInput extends Schema.Schema.Type<typeof GetEntityStateInput> {
319
+ export interface GetResidentStateInput extends Schema.Schema.Type<typeof GetResidentStateInput> {
320
320
  }
321
- export declare const PutEntityStateInput: Schema.Struct<{
321
+ export declare const PutResidentStateInput: Schema.Struct<{
322
322
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
323
323
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
324
324
  };
@@ -328,9 +328,9 @@ export declare const PutEntityStateInput: Schema.Struct<{
328
328
  readonly idempotency_key: Schema.optionalKey<Schema.String>;
329
329
  readonly updated_at: Schema.Int;
330
330
  }>;
331
- export interface PutEntityStateInput extends Schema.Schema.Type<typeof PutEntityStateInput> {
331
+ export interface PutResidentStateInput extends Schema.Schema.Type<typeof PutResidentStateInput> {
332
332
  }
333
- export declare const DeleteEntityStateInput: Schema.Struct<{
333
+ export declare const DeleteResidentStateInput: Schema.Struct<{
334
334
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
335
335
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
336
336
  };
@@ -339,9 +339,9 @@ export declare const DeleteEntityStateInput: Schema.Struct<{
339
339
  readonly idempotency_key: Schema.optionalKey<Schema.String>;
340
340
  readonly removed_at: Schema.Int;
341
341
  }>;
342
- export interface DeleteEntityStateInput extends Schema.Schema.Type<typeof DeleteEntityStateInput> {
342
+ export interface DeleteResidentStateInput extends Schema.Schema.Type<typeof DeleteResidentStateInput> {
343
343
  }
344
- export declare const ListEntityStateInput: Schema.Struct<{
344
+ export declare const ListResidentStateInput: Schema.Struct<{
345
345
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
346
346
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
347
347
  };
@@ -349,7 +349,7 @@ export declare const ListEntityStateInput: Schema.Struct<{
349
349
  readonly after_key: Schema.optionalKey<Schema.String>;
350
350
  readonly limit: Schema.optionalKey<Schema.Int>;
351
351
  }>;
352
- export interface ListEntityStateInput extends Schema.Schema.Type<typeof ListEntityStateInput> {
352
+ export interface ListResidentStateInput extends Schema.Schema.Type<typeof ListResidentStateInput> {
353
353
  }
354
354
  export declare const WaitTerminalState: Schema.Literals<readonly ["resolved", "timed_out", "cancelled"]>;
355
355
  export type WaitTerminalState = typeof WaitTerminalState.Type;
@@ -647,7 +647,7 @@ export declare const FollowExecutionItem: Schema.Union<readonly [Schema.Struct<{
647
647
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
648
648
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
649
649
  }>;
650
- 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"]>;
650
+ 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"]>;
651
651
  readonly sequence: Schema.Int;
652
652
  readonly cursor: Schema.String;
653
653
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -2404,7 +2404,7 @@ export declare const SessionStreamItem: Schema.Union<readonly [Schema.TaggedStru
2404
2404
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
2405
2405
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
2406
2406
  }>;
2407
- 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"]>;
2407
+ 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"]>;
2408
2408
  readonly sequence: Schema.Int;
2409
2409
  readonly cursor: Schema.String;
2410
2410
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -2715,7 +2715,7 @@ export declare const ReplayExecutionResult: Schema.Struct<{
2715
2715
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
2716
2716
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
2717
2717
  }>;
2718
- 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"]>;
2718
+ 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"]>;
2719
2719
  readonly sequence: Schema.Int;
2720
2720
  readonly cursor: Schema.String;
2721
2721
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -2797,7 +2797,7 @@ export declare const PageExecutionEventsResult: Schema.Struct<{
2797
2797
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
2798
2798
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
2799
2799
  }>;
2800
- 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"]>;
2800
+ 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"]>;
2801
2801
  readonly sequence: Schema.Int;
2802
2802
  readonly cursor: Schema.String;
2803
2803
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -55,5 +55,10 @@ export declare const migrations: readonly [{
55
55
  readonly name: "execution_scoped_tool_calls";
56
56
  readonly file: "0011_execution_scoped_tool_calls.sql";
57
57
  readonly source: string;
58
+ }, {
59
+ readonly id: 12;
60
+ readonly name: "rename_entity_to_resident";
61
+ readonly file: "0012_rename_entity_to_resident.sql";
62
+ readonly source: string;
58
63
  }];
59
- export declare const loader: Effect.Effect<(readonly [1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11, "baseline" | "child_fan_out" | "durable_entities" | "durable_inbox" | "durable_tool_placement" | "ephemeral_presence" | "execution_scoped_tool_calls" | "execution_state" | "topic_subscriptions" | "workflow_definitions" | "workflow_runtime", Effect.Effect<Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient>, never, never>])[], never, never>;
64
+ export declare const loader: Effect.Effect<(readonly [1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12, "baseline" | "child_fan_out" | "durable_entities" | "durable_inbox" | "durable_tool_placement" | "ephemeral_presence" | "execution_scoped_tool_calls" | "execution_state" | "rename_entity_to_resident" | "topic_subscriptions" | "workflow_definitions" | "workflow_runtime", Effect.Effect<Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient>, never, never>])[], never, never>;
@@ -0,0 +1,24 @@
1
+ import { Content, Execution, Shared, Tool } from "../../schema/index";
2
+ import type { Response } from "effect/unstable/ai";
3
+ import type { RunInput } from "./agent-loop-service";
4
+ declare const inputPreparedEvent: (input: RunInput, definitions: ReadonlyArray<Tool.Definition>) => Execution.ExecutionEvent;
5
+ declare const usageReportedEvent: (input: RunInput, part: Response.FinishPart, sequence: Execution.ExecutionEventSequence) => Execution.ExecutionEvent;
6
+ declare const budgetExceededEvent: (input: RunInput, tokensUsed: number, tokenBudget: number, sequence: Execution.ExecutionEventSequence) => Execution.ExecutionEvent;
7
+ declare const outputDeltaEvent: (input: RunInput, part: Response.TextDeltaPart, deltaIndex: number) => Execution.ExecutionEvent;
8
+ declare const reasoningDeltaEvent: (input: RunInput, part: Response.ReasoningPart | Response.ReasoningDeltaPart, deltaIndex: number) => Execution.ExecutionEvent;
9
+ declare const toolCallDeltaEvent: (input: RunInput, part: Response.ToolParamsDeltaPart, toolCallName: string | undefined, sequence: Execution.ExecutionEventSequence, deltaIndex: number) => Execution.ExecutionEvent;
10
+ declare const outputCompletedEvent: (input: RunInput, content: ReadonlyArray<Content.Part>, outputText: string, sequence: Execution.ExecutionEventSequence, structuredOutput?: Shared.JsonValue) => Execution.ExecutionEvent;
11
+ declare const completedContent: (outputText: string) => ReadonlyArray<Content.Part>;
12
+ declare const modelOutputMetadata: (event: Execution.ExecutionEvent) => Shared.Metadata;
13
+ export declare const AgentLoopEvents: {
14
+ budgetExceededEvent: typeof budgetExceededEvent;
15
+ completedContent: typeof completedContent;
16
+ inputPreparedEvent: typeof inputPreparedEvent;
17
+ modelOutputMetadata: typeof modelOutputMetadata;
18
+ outputCompletedEvent: typeof outputCompletedEvent;
19
+ outputDeltaEvent: typeof outputDeltaEvent;
20
+ reasoningDeltaEvent: typeof reasoningDeltaEvent;
21
+ toolCallDeltaEvent: typeof toolCallDeltaEvent;
22
+ usageReportedEvent: typeof usageReportedEvent;
23
+ };
24
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Layer } from "effect";
2
+ import type { EventLogCursorNotFound, EventLogError, Service } from "./event-log-service";
3
+ export declare const makeMemoryLayer: (eventLog: {
4
+ readonly EventLogCursorNotFound: typeof EventLogCursorNotFound;
5
+ readonly EventLogError: typeof EventLogError;
6
+ readonly Service: typeof Service;
7
+ }) => Layer.Layer<Service, never, never>;
@@ -0,0 +1,8 @@
1
+ import { ExecutionEventRepository } from "../../store-sql/portable";
2
+ import { Layer } from "effect";
3
+ import type { EventLogCursorNotFound, EventLogError, Service } from "./event-log-service";
4
+ export declare const makeRepositoryLayer: (eventLog: {
5
+ readonly EventLogCursorNotFound: typeof EventLogCursorNotFound;
6
+ readonly EventLogError: typeof EventLogError;
7
+ readonly Service: typeof Service;
8
+ }) => Layer.Layer<Service, never, ExecutionEventRepository.Service>;
@@ -11,8 +11,8 @@ export * as ChildFanOutRuntime from "./child/child-fan-out-runtime";
11
11
  export * as SpawnChildRunTool from "./child/spawn-child-run-tool";
12
12
  export * as ExecutionEntity from "./cluster/execution-entity";
13
13
  export * as EnvelopeService from "./envelope/envelope-service";
14
- export * as EntityInstanceService from "./entity/entity-instance-service";
15
- export * as EntityRegistry from "./entity/entity-registry-service";
14
+ export * as ResidentInstanceService from "./resident/resident-instance-service";
15
+ export * as ResidentRegistry from "./resident/resident-registry-service";
16
16
  export * as InboxService from "./inbox/inbox-service";
17
17
  export * as TopicService from "./topic/topic-service";
18
18
  export * as PublishToTopicTool from "./topic/publish-to-topic-tool";