@relayfx/sdk 0.0.49 → 0.1.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.
- package/README.md +5 -0
- package/dist/ai.js +42 -17218
- package/dist/index-q0z11q9m.js +18726 -0
- package/dist/index-sms8x6cq.js +137 -0
- package/dist/index-vbf5hcw8.js +2156 -0
- package/dist/index.js +741 -18835
- package/dist/migrations/20260712120000_durable_inbox/migration.sql +9 -0
- package/dist/migrations/20260712140000_execution_state/migration.sql +5 -0
- package/dist/migrations/20260712150000_durable_entities/migration.sql +15 -0
- package/dist/migrations/20260712160000_ephemeral_presence/migration.sql +13 -0
- package/dist/migrations/20260712170000_topic_subscriptions/migration.sql +3 -0
- package/dist/migrations/mysql/0003_durable_inbox.sql +3 -0
- package/dist/migrations/mysql/0004_execution_state.sql +3 -0
- package/dist/migrations/mysql/0005_durable_entities.sql +13 -0
- package/dist/migrations/mysql/0006_ephemeral_presence.sql +12 -0
- package/dist/migrations/mysql/0007_topic_subscriptions.sql +1 -0
- package/dist/migrations/pg/20260712120000_durable_inbox/migration.sql +9 -0
- package/dist/migrations/pg/20260712140000_execution_state/migration.sql +5 -0
- package/dist/migrations/pg/20260712150000_durable_entities/migration.sql +15 -0
- package/dist/migrations/pg/20260712160000_ephemeral_presence/migration.sql +13 -0
- package/dist/migrations/pg/20260712170000_topic_subscriptions/migration.sql +3 -0
- package/dist/migrations/sqlite/0003_durable_inbox.sql +9 -0
- package/dist/migrations/sqlite/0004_execution_state.sql +3 -0
- package/dist/migrations/sqlite/0005_durable_entities.sql +15 -0
- package/dist/migrations/sqlite/0006_ephemeral_presence.sql +12 -0
- package/dist/migrations/sqlite/0007_topic_subscriptions.sql +3 -0
- package/dist/sqlite.js +688 -0
- package/dist/types/relay/client.d.ts +197 -17
- package/dist/types/relay/command.d.ts +41 -0
- package/dist/types/relay/database.d.ts +1 -0
- package/dist/types/relay/index.d.ts +3 -2
- package/dist/types/relay/operation.d.ts +520 -2
- package/dist/types/relay/sqlite-migrations.d.ts +39 -0
- package/dist/types/relay/sqlite-runtime.d.ts +5 -0
- package/dist/types/relay/sqlite.d.ts +27 -0
- package/dist/types/runtime/address/address-book-service.d.ts +4 -4
- package/dist/types/runtime/address/address-resolution-service.d.ts +1 -1
- package/dist/types/runtime/agent/agent-loop-service.d.ts +2 -2
- package/dist/types/runtime/agent/agent-registry-service.d.ts +1 -1
- package/dist/types/runtime/agent/relay-compaction.d.ts +1 -1
- package/dist/types/runtime/agent/relay-permissions.d.ts +1 -1
- package/dist/types/runtime/agent/relay-steering.d.ts +1 -1
- package/dist/types/runtime/child/child-run-service.d.ts +1 -1
- package/dist/types/runtime/child/parent-notifier-service.d.ts +1 -1
- package/dist/types/runtime/cluster/execution-entity.d.ts +1 -1
- package/dist/types/runtime/entity/entity-instance-service.d.ts +67 -0
- package/dist/types/runtime/entity/entity-registry-service.d.ts +35 -0
- package/dist/types/runtime/envelope/envelope-service.d.ts +7 -3
- package/dist/types/runtime/execution/event-log-service.d.ts +1 -1
- package/dist/types/runtime/execution/execution-service.d.ts +1 -1
- package/dist/types/runtime/execution/execution-watch-service.d.ts +32 -0
- package/dist/types/runtime/execution/session-stream-service.d.ts +33 -0
- package/dist/types/runtime/inbox/inbox-service.d.ts +76 -0
- package/dist/types/runtime/inbox/send-message-tool.d.ts +27 -0
- package/dist/types/runtime/inbox/wait-for-messages-tool.d.ts +34 -0
- package/dist/types/runtime/index.d.ts +13 -0
- package/dist/types/runtime/memory/memory-service.d.ts +1 -1
- package/dist/types/runtime/presence/presence-service.d.ts +30 -0
- package/dist/types/runtime/presence/presence-tool.d.ts +20 -0
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +18 -18
- package/dist/types/runtime/schedule/scheduler-service.d.ts +1 -1
- package/dist/types/runtime/session/session-store-service.d.ts +1 -1
- package/dist/types/runtime/skill/skill-registry-service.d.ts +1 -1
- package/dist/types/runtime/state/execution-state-service.d.ts +57 -0
- package/dist/types/runtime/state/state-tools.d.ts +5 -0
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +1 -1
- package/dist/types/runtime/topic/publish-to-topic-tool.d.ts +24 -0
- package/dist/types/runtime/topic/topic-service.d.ts +50 -0
- package/dist/types/runtime/wait/wait-service.d.ts +2 -1
- package/dist/types/runtime/wait/wait-signal.d.ts +1 -1
- package/dist/types/runtime/workflow/execution-workflow.d.ts +2 -2
- package/dist/types/runtime/workspace/workspace-planner-service.d.ts +1 -1
- package/dist/types/schema/address-schema.d.ts +6 -6
- package/dist/types/schema/entity-schema.d.ts +40 -0
- package/dist/types/schema/envelope-schema.d.ts +1 -0
- package/dist/types/schema/execution-schema.d.ts +2 -2
- package/dist/types/schema/ids-schema.d.ts +8 -0
- package/dist/types/schema/inbox-schema.d.ts +81 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/dist/types/schema/presence-schema.d.ts +28 -0
- package/dist/types/schema/state-schema.d.ts +35 -0
- package/dist/types/store-sql/address/address-book-repository.d.ts +1 -1
- package/dist/types/store-sql/database/database-service.d.ts +4 -18
- package/dist/types/store-sql/database/notification-bus.d.ts +2 -0
- package/dist/types/store-sql/database/sql-dialect.d.ts +13 -0
- package/dist/types/store-sql/entity/entity-repository.d.ts +36 -0
- package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -0
- package/dist/types/store-sql/execution/execution-event-repository.d.ts +2 -1
- package/dist/types/store-sql/execution/execution-repository.d.ts +12 -2
- package/dist/types/store-sql/inbox/inbox-repository.d.ts +56 -0
- package/dist/types/store-sql/index.d.ts +6 -0
- package/dist/types/store-sql/portable.d.ts +27 -0
- package/dist/types/store-sql/presence/presence-repository.d.ts +51 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +1352 -140
- package/dist/types/store-sql/state/execution-state-repository.d.ts +80 -0
- package/dist/types/store-sql/tenant/tenant-id.d.ts +0 -2
- package/dist/types/store-sql/topic/topic-repository.d.ts +44 -0
- package/package.json +26 -4
- package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +0 -1971
- package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +0 -2372
- package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +0 -2442
- package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +0 -2495
- package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
- package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
- package/dist/migrations/20260705003847_nervous_banshee/snapshot.json +0 -2954
- package/dist/migrations/20260705012626_common_stryfe/snapshot.json +0 -3378
- package/dist/migrations/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
- package/dist/migrations/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
- package/dist/migrations/20260705030344_short_patriot/snapshot.json +0 -3873
- package/dist/migrations/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
- package/dist/migrations/20260706185931_regular_shadow_king/snapshot.json +0 -4844
- package/dist/migrations/20260706233300_equal_cyclops/snapshot.json +0 -4883
- package/dist/migrations/20260709030349_agent_id_rename/snapshot.json +0 -4883
- package/dist/migrations/20260709214238_faithful_black_widow/snapshot.json +0 -5426
- package/dist/migrations/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
- package/dist/migrations/pg/20260701002839_sour_cerebro/snapshot.json +0 -1971
- package/dist/migrations/pg/20260701041134_acoustic_hulk/snapshot.json +0 -2372
- package/dist/migrations/pg/20260701160543_condemned_stryfe/snapshot.json +0 -2442
- package/dist/migrations/pg/20260701220315_heavy_gorgon/snapshot.json +0 -2495
- package/dist/migrations/pg/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
- package/dist/migrations/pg/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
- package/dist/migrations/pg/20260705003847_nervous_banshee/snapshot.json +0 -2954
- package/dist/migrations/pg/20260705012626_common_stryfe/snapshot.json +0 -3378
- package/dist/migrations/pg/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
- package/dist/migrations/pg/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
- package/dist/migrations/pg/20260705030344_short_patriot/snapshot.json +0 -3873
- package/dist/migrations/pg/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
- package/dist/migrations/pg/20260706185931_regular_shadow_king/snapshot.json +0 -4844
- package/dist/migrations/pg/20260706233300_equal_cyclops/snapshot.json +0 -4883
- package/dist/migrations/pg/20260709030349_agent_id_rename/snapshot.json +0 -4883
- package/dist/migrations/pg/20260709214238_faithful_black_widow/snapshot.json +0 -5426
- package/dist/migrations/pg/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
|
@@ -0,0 +1,2156 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
__export,
|
|
4
|
+
exports_address_book_service,
|
|
5
|
+
exports_address_schema,
|
|
6
|
+
exports_agent_registry_service,
|
|
7
|
+
exports_agent_schema,
|
|
8
|
+
exports_child_execution_repository,
|
|
9
|
+
exports_child_run_service,
|
|
10
|
+
exports_cluster_registry_repository,
|
|
11
|
+
exports_content_schema,
|
|
12
|
+
exports_entity_instance_service,
|
|
13
|
+
exports_entity_registry_service,
|
|
14
|
+
exports_entity_schema,
|
|
15
|
+
exports_envelope_repository,
|
|
16
|
+
exports_envelope_schema,
|
|
17
|
+
exports_envelope_service,
|
|
18
|
+
exports_event_log_service,
|
|
19
|
+
exports_execution_entity,
|
|
20
|
+
exports_execution_repository,
|
|
21
|
+
exports_execution_schema,
|
|
22
|
+
exports_execution_service,
|
|
23
|
+
exports_execution_state_service,
|
|
24
|
+
exports_execution_watch_service,
|
|
25
|
+
exports_ids_schema,
|
|
26
|
+
exports_inbox_repository,
|
|
27
|
+
exports_inbox_schema,
|
|
28
|
+
exports_presence_service,
|
|
29
|
+
exports_schedule_repository,
|
|
30
|
+
exports_schedule_schema,
|
|
31
|
+
exports_scheduler_service,
|
|
32
|
+
exports_schema_registry_service,
|
|
33
|
+
exports_session_repository,
|
|
34
|
+
exports_session_stream_service,
|
|
35
|
+
exports_shared_schema,
|
|
36
|
+
exports_skill_registry_service,
|
|
37
|
+
exports_state_schema,
|
|
38
|
+
exports_steering_repository,
|
|
39
|
+
exports_tool_call_repository,
|
|
40
|
+
exports_tool_schema,
|
|
41
|
+
exports_tool_transition_coordinator,
|
|
42
|
+
exports_topic_service,
|
|
43
|
+
exports_wait_service,
|
|
44
|
+
exports_wait_signal
|
|
45
|
+
} from "./index-q0z11q9m.js";
|
|
46
|
+
|
|
47
|
+
// src/operation.ts
|
|
48
|
+
var exports_operation = {};
|
|
49
|
+
__export(exports_operation, {
|
|
50
|
+
WatchExecutionsInput: () => WatchExecutionsInput,
|
|
51
|
+
WakeInput: () => WakeInput,
|
|
52
|
+
WakeAccepted: () => WakeAccepted,
|
|
53
|
+
WaitView: () => WaitView,
|
|
54
|
+
WaitTerminalState: () => WaitTerminalState,
|
|
55
|
+
WaitState: () => WaitState,
|
|
56
|
+
WaitOutcome: () => WaitOutcome,
|
|
57
|
+
UnsubscribeTopicInput: () => UnsubscribeTopicInput,
|
|
58
|
+
TopicSubscription: () => TopicSubscription,
|
|
59
|
+
TopicPublishAccepted: () => TopicPublishAccepted,
|
|
60
|
+
ToolWorkReleased: () => ToolWorkReleased,
|
|
61
|
+
ToolWorkLease: () => ToolWorkLease,
|
|
62
|
+
ToolOutcomeAccepted: () => ToolOutcomeAccepted,
|
|
63
|
+
ToolCallSummary: () => ToolCallSummary,
|
|
64
|
+
ToolAttemptList: () => ToolAttemptList,
|
|
65
|
+
ToolAttempt: () => ToolAttempt,
|
|
66
|
+
SubscribeTopicInput: () => SubscribeTopicInput,
|
|
67
|
+
SubmitInboundEnvelopeInput: () => SubmitInboundEnvelopeInput,
|
|
68
|
+
SubmitInboundEnvelopeAccepted: () => SubmitInboundEnvelopeAccepted,
|
|
69
|
+
StreamSessionInput: () => StreamSessionInput,
|
|
70
|
+
StreamExecutionInput: () => StreamExecutionInput,
|
|
71
|
+
SteeringKind: () => SteeringKind,
|
|
72
|
+
SteerInput: () => SteerInput,
|
|
73
|
+
SteerAccepted: () => SteerAccepted,
|
|
74
|
+
StartExecutionResult: () => StartExecutionResult,
|
|
75
|
+
StartExecutionInput: () => StartExecutionInput,
|
|
76
|
+
SpawnChildRunInput: () => SpawnChildRunInput,
|
|
77
|
+
SessionSummary: () => SessionSummary,
|
|
78
|
+
SessionStreamItem: () => SessionStreamItem,
|
|
79
|
+
RunnerSummary: () => RunnerSummary,
|
|
80
|
+
RouteExecutionResult: () => RouteExecutionResult,
|
|
81
|
+
ResolveToolApprovalInput: () => ResolveToolApprovalInput,
|
|
82
|
+
ResolvePermissionInput: () => ResolvePermissionInput,
|
|
83
|
+
ReplayExecutionResult: () => ReplayExecutionResult,
|
|
84
|
+
ReplayExecutionInput: () => ReplayExecutionInput,
|
|
85
|
+
ReleaseToolWorkInput: () => ReleaseToolWorkInput,
|
|
86
|
+
ReleaseEnvelopeReadyInput: () => ReleaseEnvelopeReadyInput,
|
|
87
|
+
PutEntityStateInput: () => PutEntityStateInput,
|
|
88
|
+
PublishTopicInput: () => PublishTopicInput,
|
|
89
|
+
PermissionAnswer: () => PermissionAnswer,
|
|
90
|
+
PendingToolCallList: () => PendingToolCallList,
|
|
91
|
+
PendingToolCall: () => PendingToolCall,
|
|
92
|
+
PendingToolApprovalList: () => PendingToolApprovalList,
|
|
93
|
+
PendingToolApproval: () => PendingToolApproval,
|
|
94
|
+
ListWaitsInput: () => ListWaitsInput,
|
|
95
|
+
ListTopicSubscriptionsInput: () => ListTopicSubscriptionsInput,
|
|
96
|
+
ListToolAttemptsInput: () => ListToolAttemptsInput,
|
|
97
|
+
ListSessionsResult: () => ListSessionsResult,
|
|
98
|
+
ListSessionsInput: () => ListSessionsInput,
|
|
99
|
+
ListSchedulesResult: () => ListSchedulesResult,
|
|
100
|
+
ListSchedulesInput: () => ListSchedulesInput,
|
|
101
|
+
ListRunnersResult: () => ListRunnersResult,
|
|
102
|
+
ListPendingToolCallsInput: () => ListPendingToolCallsInput,
|
|
103
|
+
ListPendingApprovalsInput: () => ListPendingApprovalsInput,
|
|
104
|
+
ListInboxMessagesInput: () => ListInboxMessagesInput,
|
|
105
|
+
ListExecutionsResult: () => ListExecutionsResult,
|
|
106
|
+
ListExecutionsInput: () => ListExecutionsInput,
|
|
107
|
+
ListEntityStateInput: () => ListEntityStateInput,
|
|
108
|
+
ListEntitiesInput: () => ListEntitiesInput,
|
|
109
|
+
GetSessionResult: () => GetSessionResult,
|
|
110
|
+
GetSessionInput: () => GetSessionInput,
|
|
111
|
+
GetOrCreateEntityInput: () => GetOrCreateEntityInput,
|
|
112
|
+
GetEntityStateInput: () => GetEntityStateInput,
|
|
113
|
+
GetEntityInput: () => GetEntityInput,
|
|
114
|
+
FulfillToolCallInput: () => FulfillToolCallInput,
|
|
115
|
+
ExecutionListChange: () => ExecutionListChange,
|
|
116
|
+
ExecutionInspection: () => ExecutionInspection,
|
|
117
|
+
ExecutionCursor: () => ExecutionCursor,
|
|
118
|
+
EventLogCursorNotFound: () => EventLogCursorNotFound,
|
|
119
|
+
EnvelopeReadyReleased: () => EnvelopeReadyReleased,
|
|
120
|
+
EnvelopeReadyLease: () => EnvelopeReadyLease,
|
|
121
|
+
EnvelopeReadyAcked: () => EnvelopeReadyAcked,
|
|
122
|
+
EntityInstance: () => EntityInstance,
|
|
123
|
+
DestroyEntityInput: () => DestroyEntityInput,
|
|
124
|
+
DeleteEntityStateInput: () => DeleteEntityStateInput,
|
|
125
|
+
CreateScheduleResult: () => CreateScheduleResult,
|
|
126
|
+
CreateScheduleInput: () => CreateScheduleInput,
|
|
127
|
+
ConversationSummary: () => ConversationSummary,
|
|
128
|
+
ConversationKind: () => ConversationKind,
|
|
129
|
+
CompleteToolWorkInput: () => CompleteToolWorkInput,
|
|
130
|
+
ClaimToolWorkInput: () => ClaimToolWorkInput,
|
|
131
|
+
ClaimEnvelopeReadyInput: () => ClaimEnvelopeReadyInput,
|
|
132
|
+
ChildRunSummary: () => ChildRunSummary,
|
|
133
|
+
CancelScheduleResult: () => CancelScheduleResult,
|
|
134
|
+
CancelScheduleInput: () => CancelScheduleInput,
|
|
135
|
+
CancelExecutionInput: () => CancelExecutionInput,
|
|
136
|
+
CancelExecutionAccepted: () => CancelExecutionAccepted,
|
|
137
|
+
AwaitWaitInput: () => AwaitWaitInput,
|
|
138
|
+
AckEnvelopeReadyInput: () => AckEnvelopeReadyInput
|
|
139
|
+
});
|
|
140
|
+
import { Schema } from "effect";
|
|
141
|
+
var StartExecutionInput = Schema.Struct({
|
|
142
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
143
|
+
root_address_id: exports_ids_schema.AddressId,
|
|
144
|
+
session_id: Schema.optionalKey(exports_ids_schema.SessionId),
|
|
145
|
+
input: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
146
|
+
event_sequence: exports_execution_schema.ExecutionEventSequence,
|
|
147
|
+
started_at: exports_shared_schema.TimestampMillis,
|
|
148
|
+
completed_at: exports_shared_schema.TimestampMillis,
|
|
149
|
+
agent_id: Schema.optionalKey(exports_ids_schema.AgentId),
|
|
150
|
+
agent_revision: Schema.optionalKey(exports_agent_schema.DefinitionRevision),
|
|
151
|
+
agent_snapshot: Schema.optionalKey(exports_agent_schema.Definition),
|
|
152
|
+
agent_tool_input_schema_digests: Schema.optionalKey(exports_agent_schema.ToolInputSchemaDigests),
|
|
153
|
+
wait_id: Schema.optionalKey(exports_ids_schema.WaitId),
|
|
154
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
155
|
+
}).annotate({ identifier: "Relay.Operation.StartExecutionInput" });
|
|
156
|
+
var StartExecutionResult = Schema.Struct({
|
|
157
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
158
|
+
status: exports_execution_schema.ExecutionStatus,
|
|
159
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
160
|
+
}).annotate({ identifier: "Relay.Operation.StartExecutionResult" });
|
|
161
|
+
var GetOrCreateEntityInput = Schema.Struct({
|
|
162
|
+
kind: exports_ids_schema.EntityKindName,
|
|
163
|
+
key: exports_ids_schema.EntityKey,
|
|
164
|
+
input: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
165
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata),
|
|
166
|
+
created_at: exports_shared_schema.TimestampMillis
|
|
167
|
+
}).annotate({ identifier: "Relay.Operation.GetOrCreateEntityInput" });
|
|
168
|
+
var GetEntityInput = Schema.Struct({ kind: exports_ids_schema.EntityKindName, key: exports_ids_schema.EntityKey }).annotate({
|
|
169
|
+
identifier: "Relay.Operation.GetEntityInput"
|
|
170
|
+
});
|
|
171
|
+
var DestroyEntityInput = Schema.Struct({
|
|
172
|
+
kind: exports_ids_schema.EntityKindName,
|
|
173
|
+
key: exports_ids_schema.EntityKey,
|
|
174
|
+
reason: Schema.optionalKey(Schema.String),
|
|
175
|
+
destroyed_at: exports_shared_schema.TimestampMillis
|
|
176
|
+
}).annotate({ identifier: "Relay.Operation.DestroyEntityInput" });
|
|
177
|
+
var ListEntitiesInput = Schema.Struct({
|
|
178
|
+
kind: Schema.optionalKey(exports_ids_schema.EntityKindName),
|
|
179
|
+
after_kind: Schema.optionalKey(exports_ids_schema.EntityKindName),
|
|
180
|
+
after_key: Schema.optionalKey(Schema.String),
|
|
181
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
182
|
+
}).annotate({ identifier: "Relay.Operation.ListEntitiesInput" });
|
|
183
|
+
var EntityInstance = exports_entity_schema.Instance;
|
|
184
|
+
var StreamExecutionInput = Schema.Struct({
|
|
185
|
+
execution_id: exports_execution_schema.Execution.fields.id,
|
|
186
|
+
after_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString),
|
|
187
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
188
|
+
}).annotate({ identifier: "Relay.Operation.StreamExecutionInput" });
|
|
189
|
+
var GetEntityStateInput = Schema.Struct({ execution_id: exports_ids_schema.ExecutionId, key: exports_state_schema.StateKey }).annotate({
|
|
190
|
+
identifier: "Relay.Operation.GetEntityStateInput"
|
|
191
|
+
});
|
|
192
|
+
var PutEntityStateInput = Schema.Struct({
|
|
193
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
194
|
+
key: exports_state_schema.StateKey,
|
|
195
|
+
value: exports_shared_schema.JsonValue,
|
|
196
|
+
expected_version: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
197
|
+
idempotency_key: Schema.optionalKey(exports_state_schema.StateIdempotencyKey.check(Schema.makeFilter((value) => !value.startsWith("relay:internal:")))),
|
|
198
|
+
updated_at: exports_shared_schema.TimestampMillis
|
|
199
|
+
}).annotate({ identifier: "Relay.Operation.PutEntityStateInput" });
|
|
200
|
+
var DeleteEntityStateInput = Schema.Struct({
|
|
201
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
202
|
+
key: exports_state_schema.StateKey,
|
|
203
|
+
expected_version: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
204
|
+
idempotency_key: Schema.optionalKey(exports_state_schema.StateIdempotencyKey.check(Schema.makeFilter((value) => !value.startsWith("relay:internal:")))),
|
|
205
|
+
removed_at: exports_shared_schema.TimestampMillis
|
|
206
|
+
}).annotate({ identifier: "Relay.Operation.DeleteEntityStateInput" });
|
|
207
|
+
var ListEntityStateInput = Schema.Struct({
|
|
208
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
209
|
+
prefix: Schema.optionalKey(Schema.String),
|
|
210
|
+
after_key: Schema.optionalKey(Schema.String),
|
|
211
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
212
|
+
}).annotate({ identifier: "Relay.Operation.ListEntityStateInput" });
|
|
213
|
+
var WaitTerminalState = Schema.Literals(["resolved", "timed_out", "cancelled"]).annotate({
|
|
214
|
+
identifier: "Relay.Operation.WaitTerminalState"
|
|
215
|
+
});
|
|
216
|
+
var AwaitWaitInput = Schema.Struct({
|
|
217
|
+
wait_id: exports_ids_schema.WaitId,
|
|
218
|
+
execution_id: exports_ids_schema.ExecutionId
|
|
219
|
+
}).annotate({ identifier: "Relay.Operation.AwaitWaitInput" });
|
|
220
|
+
var WaitOutcome = Schema.Struct({
|
|
221
|
+
wait_id: exports_ids_schema.WaitId,
|
|
222
|
+
state: WaitTerminalState,
|
|
223
|
+
content: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
224
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
225
|
+
}).annotate({ identifier: "Relay.Operation.WaitOutcome" });
|
|
226
|
+
var CancelExecutionInput = Schema.Struct({
|
|
227
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
228
|
+
cancelled_at: exports_shared_schema.TimestampMillis,
|
|
229
|
+
reason: Schema.optionalKey(Schema.String)
|
|
230
|
+
}).annotate({ identifier: "Relay.Operation.CancelExecutionInput" });
|
|
231
|
+
var CancelExecutionAccepted = Schema.Struct({
|
|
232
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
233
|
+
status: exports_execution_schema.ExecutionStatus
|
|
234
|
+
}).annotate({ identifier: "Relay.Operation.CancelExecutionAccepted" });
|
|
235
|
+
var SteeringKind = Schema.Literals(["steering", "follow_up"]).annotate({
|
|
236
|
+
identifier: "Relay.Operation.SteeringKind"
|
|
237
|
+
});
|
|
238
|
+
var SteerInput = Schema.Struct({
|
|
239
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
240
|
+
kind: SteeringKind,
|
|
241
|
+
content: Schema.Array(exports_content_schema.Part),
|
|
242
|
+
created_at: exports_shared_schema.TimestampMillis
|
|
243
|
+
}).annotate({ identifier: "Relay.Operation.SteerInput" });
|
|
244
|
+
var SteerAccepted = Schema.Struct({
|
|
245
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
246
|
+
kind: SteeringKind,
|
|
247
|
+
sequence: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
248
|
+
}).annotate({ identifier: "Relay.Operation.SteerAccepted" });
|
|
249
|
+
var WakeInput = Schema.Struct({
|
|
250
|
+
wait_id: exports_ids_schema.WaitId,
|
|
251
|
+
state: WaitTerminalState,
|
|
252
|
+
signaled_at: exports_shared_schema.TimestampMillis,
|
|
253
|
+
from: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
254
|
+
content: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
255
|
+
correlation_key: Schema.optionalKey(Schema.String),
|
|
256
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
257
|
+
}).annotate({ identifier: "Relay.Operation.WakeInput" });
|
|
258
|
+
var WakeAccepted = Schema.Struct({
|
|
259
|
+
wait_id: exports_ids_schema.WaitId,
|
|
260
|
+
state: WaitTerminalState,
|
|
261
|
+
signaled_at: exports_shared_schema.TimestampMillis
|
|
262
|
+
}).annotate({ identifier: "Relay.Operation.WakeAccepted" });
|
|
263
|
+
var WaitState = Schema.Literals(["open", "resolved", "timed_out", "cancelled"]).annotate({
|
|
264
|
+
identifier: "Relay.Operation.WaitState"
|
|
265
|
+
});
|
|
266
|
+
var ListWaitsInput = Schema.Struct({
|
|
267
|
+
state: Schema.optionalKey(WaitState),
|
|
268
|
+
execution_id: Schema.optionalKey(exports_ids_schema.ExecutionId),
|
|
269
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
270
|
+
}).annotate({ identifier: "Relay.Operation.ListWaitsInput" });
|
|
271
|
+
var WaitView = Schema.Struct({
|
|
272
|
+
wait_id: exports_ids_schema.WaitId,
|
|
273
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
274
|
+
envelope_id: Schema.optionalKey(exports_ids_schema.EnvelopeId),
|
|
275
|
+
mode: exports_envelope_schema.WaitMode,
|
|
276
|
+
correlation_key: Schema.optionalKey(Schema.String),
|
|
277
|
+
state: WaitState,
|
|
278
|
+
metadata: exports_shared_schema.Metadata,
|
|
279
|
+
created_at: exports_shared_schema.TimestampMillis,
|
|
280
|
+
resolved_at: Schema.optionalKey(exports_shared_schema.TimestampMillis)
|
|
281
|
+
}).annotate({ identifier: "Relay.Operation.WaitView" });
|
|
282
|
+
var PendingToolApproval = Schema.Struct({
|
|
283
|
+
wait_id: exports_ids_schema.WaitId,
|
|
284
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
285
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
286
|
+
tool_name: exports_shared_schema.NonEmptyString,
|
|
287
|
+
input: exports_shared_schema.JsonValue,
|
|
288
|
+
requested_at: exports_shared_schema.TimestampMillis
|
|
289
|
+
}).annotate({ identifier: "Relay.Operation.PendingToolApproval" });
|
|
290
|
+
var ListPendingApprovalsInput = Schema.Struct({
|
|
291
|
+
execution_id: exports_ids_schema.ExecutionId
|
|
292
|
+
}).annotate({ identifier: "Relay.Operation.ListPendingApprovalsInput" });
|
|
293
|
+
var PendingToolApprovalList = Schema.Struct({
|
|
294
|
+
approvals: Schema.Array(PendingToolApproval)
|
|
295
|
+
}).annotate({ identifier: "Relay.Operation.PendingToolApprovalList" });
|
|
296
|
+
var PendingToolCall = Schema.Struct({
|
|
297
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
298
|
+
call: exports_tool_schema.Call,
|
|
299
|
+
definition: exports_tool_schema.Definition,
|
|
300
|
+
placement: exports_tool_schema.Placement,
|
|
301
|
+
state: exports_tool_schema.CallState,
|
|
302
|
+
wait_id: exports_ids_schema.WaitId,
|
|
303
|
+
idempotency_key: Schema.String,
|
|
304
|
+
requested_at: exports_shared_schema.TimestampMillis
|
|
305
|
+
}).annotate({ identifier: "Relay.Operation.PendingToolCall" });
|
|
306
|
+
var ListPendingToolCallsInput = Schema.Struct({
|
|
307
|
+
execution_id: Schema.optionalKey(exports_ids_schema.ExecutionId),
|
|
308
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
309
|
+
}).annotate({ identifier: "Relay.Operation.ListPendingToolCallsInput" });
|
|
310
|
+
var PendingToolCallList = Schema.Struct({
|
|
311
|
+
tool_calls: Schema.Array(PendingToolCall)
|
|
312
|
+
}).annotate({ identifier: "Relay.Operation.PendingToolCallList" });
|
|
313
|
+
var FulfillToolCallInput = Schema.Struct({
|
|
314
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
315
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
316
|
+
outcome: exports_tool_schema.ExternalOutcome,
|
|
317
|
+
fulfilled_at: exports_shared_schema.TimestampMillis
|
|
318
|
+
}).annotate({ identifier: "Relay.Operation.FulfillToolCallInput" });
|
|
319
|
+
var ClaimToolWorkInput = Schema.Struct({
|
|
320
|
+
queue: exports_tool_schema.PlacementKey,
|
|
321
|
+
worker_id: exports_tool_schema.WorkerId,
|
|
322
|
+
now: exports_shared_schema.TimestampMillis,
|
|
323
|
+
claim_expires_at: exports_shared_schema.TimestampMillis
|
|
324
|
+
}).annotate({ identifier: "Relay.Operation.ClaimToolWorkInput" });
|
|
325
|
+
var CompleteToolWorkInput = Schema.Struct({
|
|
326
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
327
|
+
attempt_id: exports_ids_schema.ToolAttemptId,
|
|
328
|
+
worker_id: exports_tool_schema.WorkerId,
|
|
329
|
+
outcome: exports_tool_schema.ExternalOutcome,
|
|
330
|
+
completed_at: exports_shared_schema.TimestampMillis
|
|
331
|
+
}).annotate({ identifier: "Relay.Operation.CompleteToolWorkInput" });
|
|
332
|
+
var ReleaseToolWorkInput = Schema.Struct({
|
|
333
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
334
|
+
attempt_id: exports_ids_schema.ToolAttemptId,
|
|
335
|
+
worker_id: exports_tool_schema.WorkerId,
|
|
336
|
+
released_at: exports_shared_schema.TimestampMillis,
|
|
337
|
+
next_available_at: exports_shared_schema.TimestampMillis,
|
|
338
|
+
error: Schema.optionalKey(Schema.String)
|
|
339
|
+
}).annotate({ identifier: "Relay.Operation.ReleaseToolWorkInput" });
|
|
340
|
+
var ListToolAttemptsInput = Schema.Struct({
|
|
341
|
+
tool_call_id: exports_ids_schema.ToolCallId
|
|
342
|
+
}).annotate({ identifier: "Relay.Operation.ListToolAttemptsInput" });
|
|
343
|
+
var ToolAttempt = Schema.Struct({
|
|
344
|
+
attempt_id: exports_ids_schema.ToolAttemptId,
|
|
345
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
346
|
+
attempt_number: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
347
|
+
state: exports_tool_schema.AttemptState,
|
|
348
|
+
worker_id: Schema.optionalKey(Schema.String),
|
|
349
|
+
claim_expires_at: Schema.optionalKey(exports_shared_schema.TimestampMillis),
|
|
350
|
+
error: Schema.optionalKey(Schema.String),
|
|
351
|
+
created_at: exports_shared_schema.TimestampMillis,
|
|
352
|
+
completed_at: Schema.optionalKey(exports_shared_schema.TimestampMillis)
|
|
353
|
+
}).annotate({ identifier: "Relay.Operation.ToolAttempt" });
|
|
354
|
+
var ToolAttemptList = Schema.Struct({
|
|
355
|
+
attempts: Schema.Array(ToolAttempt)
|
|
356
|
+
}).annotate({ identifier: "Relay.Operation.ToolAttemptList" });
|
|
357
|
+
var ToolOutcomeAccepted = Schema.Struct({
|
|
358
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
359
|
+
attempt: ToolAttempt,
|
|
360
|
+
duplicate: Schema.Boolean
|
|
361
|
+
}).annotate({ identifier: "Relay.Operation.ToolOutcomeAccepted" });
|
|
362
|
+
var ToolWorkLease = Schema.Struct({
|
|
363
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
364
|
+
call: exports_tool_schema.Call,
|
|
365
|
+
definition: exports_tool_schema.Definition,
|
|
366
|
+
placement: exports_tool_schema.Placement,
|
|
367
|
+
attempt: ToolAttempt,
|
|
368
|
+
queue: exports_tool_schema.PlacementKey,
|
|
369
|
+
worker_id: exports_tool_schema.WorkerId,
|
|
370
|
+
claim_expires_at: exports_shared_schema.TimestampMillis,
|
|
371
|
+
idempotency_key: Schema.String
|
|
372
|
+
}).annotate({ identifier: "Relay.Operation.ToolWorkLease" });
|
|
373
|
+
var ToolWorkReleased = Schema.Struct({
|
|
374
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
375
|
+
state: Schema.Literal("waiting"),
|
|
376
|
+
next_available_at: exports_shared_schema.TimestampMillis
|
|
377
|
+
}).annotate({ identifier: "Relay.Operation.ToolWorkReleased" });
|
|
378
|
+
var SpawnChildRunInput = Schema.Struct({
|
|
379
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
380
|
+
child_execution_id: Schema.optionalKey(exports_ids_schema.ChildExecutionId),
|
|
381
|
+
address_id: exports_ids_schema.AddressId,
|
|
382
|
+
preset_name: Schema.optionalKey(exports_shared_schema.NonEmptyString),
|
|
383
|
+
instructions: Schema.optionalKey(Schema.String),
|
|
384
|
+
model: Schema.optionalKey(exports_agent_schema.ModelSelection),
|
|
385
|
+
tool_names: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
386
|
+
permissions: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
387
|
+
workspace_policy: Schema.optionalKey(exports_agent_schema.ChildRunWorkspacePolicy),
|
|
388
|
+
output_schema_ref: Schema.optionalKey(Schema.String),
|
|
389
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata),
|
|
390
|
+
input: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
391
|
+
wait: Schema.optionalKey(Schema.Boolean)
|
|
392
|
+
}).annotate({ identifier: "Relay.Operation.SpawnChildRunInput" });
|
|
393
|
+
var ResolveToolApprovalInput = Schema.Struct({
|
|
394
|
+
wait_id: exports_ids_schema.WaitId,
|
|
395
|
+
approved: Schema.Boolean,
|
|
396
|
+
comment: Schema.optionalKey(Schema.String),
|
|
397
|
+
resolved_at: exports_shared_schema.TimestampMillis
|
|
398
|
+
}).annotate({ identifier: "Relay.Operation.ResolveToolApprovalInput" });
|
|
399
|
+
var PermissionAnswer = Schema.Literals(["Approved", "Denied", "Always"]).annotate({
|
|
400
|
+
identifier: "Relay.Operation.PermissionAnswer"
|
|
401
|
+
});
|
|
402
|
+
var ResolvePermissionInput = Schema.Struct({
|
|
403
|
+
wait_id: exports_ids_schema.WaitId,
|
|
404
|
+
answer: PermissionAnswer,
|
|
405
|
+
reason: Schema.optionalKey(Schema.String),
|
|
406
|
+
resolved_at: exports_shared_schema.TimestampMillis
|
|
407
|
+
}).annotate({ identifier: "Relay.Operation.ResolvePermissionInput" });
|
|
408
|
+
var SubmitInboundEnvelopeInput = Schema.Struct({
|
|
409
|
+
envelope: exports_envelope_schema.SendInput,
|
|
410
|
+
wake: WakeInput
|
|
411
|
+
}).annotate({ identifier: "Relay.Operation.SubmitInboundEnvelopeInput" });
|
|
412
|
+
var SubmitInboundEnvelopeAccepted = Schema.Struct({
|
|
413
|
+
envelope: exports_envelope_schema.EnvelopeAccepted,
|
|
414
|
+
wake: WakeAccepted
|
|
415
|
+
}).annotate({ identifier: "Relay.Operation.SubmitInboundEnvelopeAccepted" });
|
|
416
|
+
var ClaimEnvelopeReadyInput = Schema.Struct({
|
|
417
|
+
route_type: exports_address_schema.RouteKind,
|
|
418
|
+
route_key: Schema.optionalKey(Schema.String),
|
|
419
|
+
worker_id: exports_shared_schema.NonEmptyString,
|
|
420
|
+
now: exports_shared_schema.TimestampMillis,
|
|
421
|
+
claim_expires_at: exports_shared_schema.TimestampMillis
|
|
422
|
+
}).annotate({ identifier: "Relay.Operation.ClaimEnvelopeReadyInput" });
|
|
423
|
+
var EnvelopeReadyLease = Schema.Struct({
|
|
424
|
+
ready: exports_envelope_schema.EnvelopeReady,
|
|
425
|
+
worker_id: exports_shared_schema.NonEmptyString,
|
|
426
|
+
claim_expires_at: exports_shared_schema.TimestampMillis
|
|
427
|
+
}).annotate({ identifier: "Relay.Operation.EnvelopeReadyLease" });
|
|
428
|
+
var AckEnvelopeReadyInput = Schema.Struct({
|
|
429
|
+
envelope_ready_id: exports_ids_schema.EnvelopeReadyId,
|
|
430
|
+
worker_id: exports_shared_schema.NonEmptyString,
|
|
431
|
+
acknowledged_at: exports_shared_schema.TimestampMillis
|
|
432
|
+
}).annotate({ identifier: "Relay.Operation.AckEnvelopeReadyInput" });
|
|
433
|
+
var EnvelopeReadyAcked = Schema.Struct({
|
|
434
|
+
envelope_ready_id: exports_ids_schema.EnvelopeReadyId,
|
|
435
|
+
state: Schema.Literal("acknowledged"),
|
|
436
|
+
acknowledged_at: exports_shared_schema.TimestampMillis
|
|
437
|
+
}).annotate({ identifier: "Relay.Operation.EnvelopeReadyAcked" });
|
|
438
|
+
var ReleaseEnvelopeReadyInput = Schema.Struct({
|
|
439
|
+
envelope_ready_id: exports_ids_schema.EnvelopeReadyId,
|
|
440
|
+
worker_id: exports_shared_schema.NonEmptyString,
|
|
441
|
+
next_available_at: exports_shared_schema.TimestampMillis,
|
|
442
|
+
error: Schema.optionalKey(Schema.String)
|
|
443
|
+
}).annotate({ identifier: "Relay.Operation.ReleaseEnvelopeReadyInput" });
|
|
444
|
+
var EnvelopeReadyReleased = Schema.Struct({
|
|
445
|
+
envelope_ready_id: exports_ids_schema.EnvelopeReadyId,
|
|
446
|
+
state: Schema.Literal("ready"),
|
|
447
|
+
next_available_at: exports_shared_schema.TimestampMillis
|
|
448
|
+
}).annotate({ identifier: "Relay.Operation.EnvelopeReadyReleased" });
|
|
449
|
+
var CreateScheduleInput = Schema.Struct({
|
|
450
|
+
schedule_id: exports_ids_schema.ScheduleId,
|
|
451
|
+
kind: exports_schedule_schema.ScheduleKind,
|
|
452
|
+
target_kind: exports_schedule_schema.ScheduleTargetKind,
|
|
453
|
+
address_id: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
454
|
+
wait_id: Schema.optionalKey(exports_ids_schema.WaitId),
|
|
455
|
+
cron_expr: Schema.optionalKey(exports_shared_schema.NonEmptyString),
|
|
456
|
+
input: Schema.optionalKey(Schema.Array(exports_content_schema.Part)),
|
|
457
|
+
next_run_at: exports_shared_schema.TimestampMillis,
|
|
458
|
+
idempotency_key: Schema.optionalKey(exports_shared_schema.NonEmptyString),
|
|
459
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
460
|
+
}).annotate({ identifier: "Relay.Operation.CreateScheduleInput" });
|
|
461
|
+
var CreateScheduleResult = Schema.Struct({
|
|
462
|
+
schedule: exports_schedule_schema.ScheduleRecord
|
|
463
|
+
}).annotate({ identifier: "Relay.Operation.CreateScheduleResult" });
|
|
464
|
+
var CancelScheduleInput = Schema.Struct({
|
|
465
|
+
schedule_id: exports_ids_schema.ScheduleId,
|
|
466
|
+
cancelled_at: exports_shared_schema.TimestampMillis
|
|
467
|
+
}).annotate({ identifier: "Relay.Operation.CancelScheduleInput" });
|
|
468
|
+
var CancelScheduleResult = Schema.Struct({
|
|
469
|
+
schedule: exports_schedule_schema.ScheduleRecord
|
|
470
|
+
}).annotate({ identifier: "Relay.Operation.CancelScheduleResult" });
|
|
471
|
+
var ListSchedulesInput = Schema.Struct({
|
|
472
|
+
state: Schema.optionalKey(exports_schedule_schema.ScheduleState)
|
|
473
|
+
}).annotate({ identifier: "Relay.Operation.ListSchedulesInput" });
|
|
474
|
+
var ListSchedulesResult = Schema.Struct({
|
|
475
|
+
schedules: Schema.Array(exports_schedule_schema.ScheduleRecord)
|
|
476
|
+
}).annotate({ identifier: "Relay.Operation.ListSchedulesResult" });
|
|
477
|
+
var ListExecutionsInput = Schema.Struct({
|
|
478
|
+
root_address_id: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
479
|
+
status: Schema.optionalKey(exports_execution_schema.ExecutionStatus),
|
|
480
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
|
|
481
|
+
cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
482
|
+
}).annotate({ identifier: "Relay.Operation.ListExecutionsInput" });
|
|
483
|
+
var SubscribeTopicInput = Schema.Struct({
|
|
484
|
+
topic_address_id: exports_ids_schema.AddressId,
|
|
485
|
+
subscriber_execution_id: exports_ids_schema.ExecutionId,
|
|
486
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata)
|
|
487
|
+
}).annotate({ identifier: "Relay.Operation.SubscribeTopicInput" });
|
|
488
|
+
var TopicSubscription = Schema.Struct({
|
|
489
|
+
topic_address_id: exports_ids_schema.AddressId,
|
|
490
|
+
subscriber_execution_id: exports_ids_schema.ExecutionId,
|
|
491
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata),
|
|
492
|
+
created_at: exports_shared_schema.TimestampMillis
|
|
493
|
+
}).annotate({ identifier: "Relay.Operation.TopicSubscription" });
|
|
494
|
+
var PublishTopicInput = Schema.Struct({
|
|
495
|
+
topic_address_id: exports_ids_schema.AddressId,
|
|
496
|
+
from: exports_ids_schema.AddressId,
|
|
497
|
+
content: Schema.Array(exports_content_schema.Part),
|
|
498
|
+
metadata: Schema.optionalKey(exports_shared_schema.Metadata),
|
|
499
|
+
idempotency_key: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
500
|
+
}).annotate({ identifier: "Relay.Operation.PublishTopicInput" });
|
|
501
|
+
var TopicPublishAccepted = Schema.Struct({
|
|
502
|
+
envelope_id: exports_ids_schema.EnvelopeId,
|
|
503
|
+
subscriber_count: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
504
|
+
}).annotate({ identifier: "Relay.Operation.TopicPublishAccepted" });
|
|
505
|
+
var UnsubscribeTopicInput = Schema.Struct({
|
|
506
|
+
topic_address_id: exports_ids_schema.AddressId,
|
|
507
|
+
subscriber_execution_id: exports_ids_schema.ExecutionId
|
|
508
|
+
}).annotate({ identifier: "Relay.Operation.UnsubscribeTopicInput" });
|
|
509
|
+
var ListTopicSubscriptionsInput = Schema.Struct({
|
|
510
|
+
topic_address_id: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
511
|
+
subscriber_execution_id: Schema.optionalKey(exports_ids_schema.ExecutionId)
|
|
512
|
+
}).annotate({ identifier: "Relay.Operation.ListTopicSubscriptionsInput" });
|
|
513
|
+
var ListInboxMessagesInput = Schema.Struct({
|
|
514
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
515
|
+
include_consumed: Schema.optionalKey(Schema.Boolean),
|
|
516
|
+
after_sequence: Schema.optionalKey(exports_inbox_schema.MessageSequence),
|
|
517
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
518
|
+
}).annotate({ identifier: "Relay.Operation.ListInboxMessagesInput" });
|
|
519
|
+
var ConversationKind = Schema.Literals(["user-agent", "agent-agent"]).annotate({
|
|
520
|
+
identifier: "Relay.Operation.ConversationKind"
|
|
521
|
+
});
|
|
522
|
+
var ConversationSummary = Schema.Struct({
|
|
523
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
524
|
+
root_address_id: exports_ids_schema.AddressId,
|
|
525
|
+
session_id: Schema.optionalKey(exports_ids_schema.SessionId),
|
|
526
|
+
status: exports_execution_schema.ExecutionStatus,
|
|
527
|
+
kind: ConversationKind,
|
|
528
|
+
agent_id: Schema.optionalKey(exports_ids_schema.AgentId),
|
|
529
|
+
metadata: exports_shared_schema.Metadata,
|
|
530
|
+
created_at: exports_shared_schema.TimestampMillis,
|
|
531
|
+
updated_at: exports_shared_schema.TimestampMillis
|
|
532
|
+
}).annotate({ identifier: "Relay.Operation.ConversationSummary" });
|
|
533
|
+
var ExecutionCursor = Schema.Struct({
|
|
534
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
535
|
+
after_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
536
|
+
}).annotate({ identifier: "Relay.Operation.ExecutionCursor" });
|
|
537
|
+
|
|
538
|
+
class EventLogCursorNotFound extends Schema.TaggedErrorClass()("EventLogCursorNotFound", { execution_id: exports_ids_schema.ExecutionId, cursor: exports_shared_schema.NonEmptyString }) {
|
|
539
|
+
}
|
|
540
|
+
var StreamSessionInput = Schema.Struct({
|
|
541
|
+
session_id: exports_ids_schema.SessionId,
|
|
542
|
+
resume: Schema.optionalKey(Schema.Array(ExecutionCursor))
|
|
543
|
+
}).annotate({ identifier: "Relay.Operation.StreamSessionInput" });
|
|
544
|
+
var SessionStreamItem = Schema.Union([
|
|
545
|
+
Schema.TaggedStruct("execution_joined", { execution: ConversationSummary }),
|
|
546
|
+
Schema.TaggedStruct("execution_event", { event: exports_execution_schema.ExecutionEvent })
|
|
547
|
+
]).annotate({ identifier: "Relay.Operation.SessionStreamItem" });
|
|
548
|
+
var WatchExecutionsInput = Schema.Struct({
|
|
549
|
+
root_address_id: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
550
|
+
session_id: Schema.optionalKey(exports_ids_schema.SessionId),
|
|
551
|
+
status: Schema.optionalKey(exports_execution_schema.ExecutionStatus),
|
|
552
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
553
|
+
}).annotate({ identifier: "Relay.Operation.WatchExecutionsInput" });
|
|
554
|
+
var ExecutionListChange = Schema.Union([
|
|
555
|
+
Schema.TaggedStruct("snapshot", {
|
|
556
|
+
records: Schema.Array(ConversationSummary),
|
|
557
|
+
next_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
558
|
+
}),
|
|
559
|
+
Schema.TaggedStruct("upsert", { record: ConversationSummary })
|
|
560
|
+
]).annotate({ identifier: "Relay.Operation.ExecutionListChange" });
|
|
561
|
+
var ToolCallSummary = Schema.Struct({
|
|
562
|
+
tool_call_id: exports_ids_schema.ToolCallId,
|
|
563
|
+
tool_name: exports_shared_schema.NonEmptyString,
|
|
564
|
+
input: exports_shared_schema.JsonValue,
|
|
565
|
+
metadata: exports_shared_schema.Metadata,
|
|
566
|
+
requested_at: exports_shared_schema.TimestampMillis
|
|
567
|
+
}).annotate({ identifier: "Relay.Operation.ToolCallSummary" });
|
|
568
|
+
var ChildRunSummary = Schema.Struct({
|
|
569
|
+
child_execution_id: exports_ids_schema.ChildExecutionId,
|
|
570
|
+
address_id: exports_ids_schema.AddressId,
|
|
571
|
+
status: exports_execution_schema.ExecutionStatus,
|
|
572
|
+
metadata: exports_shared_schema.Metadata,
|
|
573
|
+
created_at: exports_shared_schema.TimestampMillis,
|
|
574
|
+
updated_at: exports_shared_schema.TimestampMillis
|
|
575
|
+
}).annotate({ identifier: "Relay.Operation.ChildRunSummary" });
|
|
576
|
+
var ExecutionInspection = Schema.Struct({
|
|
577
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
578
|
+
status: exports_execution_schema.ExecutionStatus,
|
|
579
|
+
waiting_on: Schema.Array(WaitView),
|
|
580
|
+
pending_tool_calls: Schema.Array(ToolCallSummary),
|
|
581
|
+
child_runs: Schema.Array(ChildRunSummary),
|
|
582
|
+
last_event_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
583
|
+
}).annotate({ identifier: "Relay.Operation.ExecutionInspection" });
|
|
584
|
+
var ListExecutionsResult = Schema.Struct({
|
|
585
|
+
records: Schema.Array(ConversationSummary),
|
|
586
|
+
next_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
587
|
+
}).annotate({ identifier: "Relay.Operation.ListExecutionsResult" });
|
|
588
|
+
var ListSessionsInput = Schema.Struct({
|
|
589
|
+
root_address_id: Schema.optionalKey(exports_ids_schema.AddressId),
|
|
590
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
|
|
591
|
+
cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
592
|
+
}).annotate({ identifier: "Relay.Operation.ListSessionsInput" });
|
|
593
|
+
var SessionSummary = Schema.Struct({
|
|
594
|
+
session_id: exports_ids_schema.SessionId,
|
|
595
|
+
root_address_id: exports_ids_schema.AddressId,
|
|
596
|
+
metadata: exports_shared_schema.Metadata,
|
|
597
|
+
created_at: exports_shared_schema.TimestampMillis,
|
|
598
|
+
updated_at: exports_shared_schema.TimestampMillis
|
|
599
|
+
}).annotate({ identifier: "Relay.Operation.SessionSummary" });
|
|
600
|
+
var ListSessionsResult = Schema.Struct({
|
|
601
|
+
records: Schema.Array(SessionSummary),
|
|
602
|
+
next_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
603
|
+
}).annotate({ identifier: "Relay.Operation.ListSessionsResult" });
|
|
604
|
+
var GetSessionInput = Schema.Struct({
|
|
605
|
+
session_id: exports_ids_schema.SessionId,
|
|
606
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
|
|
607
|
+
cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
608
|
+
}).annotate({ identifier: "Relay.Operation.GetSessionInput" });
|
|
609
|
+
var GetSessionResult = Schema.Struct({
|
|
610
|
+
session: SessionSummary,
|
|
611
|
+
executions: Schema.Array(ConversationSummary),
|
|
612
|
+
next_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString)
|
|
613
|
+
}).annotate({ identifier: "Relay.Operation.GetSessionResult" });
|
|
614
|
+
var ReplayExecutionInput = Schema.Struct({
|
|
615
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
616
|
+
after_cursor: Schema.optionalKey(exports_shared_schema.NonEmptyString),
|
|
617
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
618
|
+
}).annotate({ identifier: "Relay.Operation.ReplayExecutionInput" });
|
|
619
|
+
var ReplayExecutionResult = Schema.Struct({
|
|
620
|
+
events: Schema.Array(exports_execution_schema.ExecutionEvent)
|
|
621
|
+
}).annotate({ identifier: "Relay.Operation.ReplayExecutionResult" });
|
|
622
|
+
var RunnerSummary = Schema.Struct({
|
|
623
|
+
address: Schema.String,
|
|
624
|
+
healthy: Schema.Boolean,
|
|
625
|
+
last_heartbeat: exports_shared_schema.TimestampMillis,
|
|
626
|
+
owned_shards: Schema.Int
|
|
627
|
+
}).annotate({ identifier: "Relay.Operation.RunnerSummary" });
|
|
628
|
+
var ListRunnersResult = Schema.Struct({
|
|
629
|
+
runners: Schema.Array(RunnerSummary),
|
|
630
|
+
total_shards: Schema.Int
|
|
631
|
+
}).annotate({ identifier: "Relay.Operation.ListRunnersResult" });
|
|
632
|
+
var RouteExecutionResult = Schema.Struct({
|
|
633
|
+
execution_id: exports_ids_schema.ExecutionId,
|
|
634
|
+
shard: Schema.String,
|
|
635
|
+
runner_address: Schema.NullOr(Schema.String),
|
|
636
|
+
owned: Schema.Boolean
|
|
637
|
+
}).annotate({ identifier: "Relay.Operation.RouteExecutionResult" });
|
|
638
|
+
|
|
639
|
+
// src/command.ts
|
|
640
|
+
var exports_command = {};
|
|
641
|
+
__export(exports_command, {
|
|
642
|
+
outputSchemaRef: () => outputSchemaRef,
|
|
643
|
+
make: () => make,
|
|
644
|
+
inputSchemaRef: () => inputSchemaRef,
|
|
645
|
+
EntityNotFound: () => EntityNotFound,
|
|
646
|
+
CommandTimedOut: () => CommandTimedOut,
|
|
647
|
+
CommandReplyInvalid: () => CommandReplyInvalid
|
|
648
|
+
});
|
|
649
|
+
import { Schema as Schema2 } from "effect";
|
|
650
|
+
var make = (name, options) => ({ name, ...options });
|
|
651
|
+
var inputSchemaRef = (name) => `relay/command/${name}/input`;
|
|
652
|
+
var outputSchemaRef = (name) => `relay/command/${name}/output`;
|
|
653
|
+
|
|
654
|
+
class CommandTimedOut extends Schema2.TaggedErrorClass()("CommandTimedOut", {
|
|
655
|
+
command: exports_shared_schema.NonEmptyString,
|
|
656
|
+
wait_id: exports_ids_schema.WaitId,
|
|
657
|
+
timeout: Schema2.String
|
|
658
|
+
}) {
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
class CommandReplyInvalid extends Schema2.TaggedErrorClass()("CommandReplyInvalid", {
|
|
662
|
+
command: exports_shared_schema.NonEmptyString,
|
|
663
|
+
wait_id: exports_ids_schema.WaitId,
|
|
664
|
+
message: Schema2.String
|
|
665
|
+
}) {
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
class EntityNotFound extends Schema2.TaggedErrorClass()("EntityNotFound", {
|
|
669
|
+
kind: exports_ids_schema.EntityKindName,
|
|
670
|
+
key: exports_ids_schema.EntityKey
|
|
671
|
+
}) {
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// src/client.ts
|
|
675
|
+
var exports_client = {};
|
|
676
|
+
__export(exports_client, {
|
|
677
|
+
watchPresence: () => watchPresence,
|
|
678
|
+
watchExecutions: () => watchExecutions,
|
|
679
|
+
wake: () => wake,
|
|
680
|
+
unsubscribeTopic: () => unsubscribeTopic,
|
|
681
|
+
testLayer: () => testLayer,
|
|
682
|
+
subscribeTopic: () => subscribeTopic,
|
|
683
|
+
submitInboundEnvelope: () => submitInboundEnvelope,
|
|
684
|
+
streamSession: () => streamSession,
|
|
685
|
+
streamExecution: () => streamExecution,
|
|
686
|
+
steer: () => steer,
|
|
687
|
+
startExecutionByAgentDefinition: () => startExecutionByAgentDefinition,
|
|
688
|
+
startExecutionByAddress: () => startExecutionByAddress,
|
|
689
|
+
startExecution: () => startExecution,
|
|
690
|
+
spawnChildRun: () => spawnChildRun,
|
|
691
|
+
send: () => send,
|
|
692
|
+
routeExecution: () => routeExecution,
|
|
693
|
+
resolveToolApproval: () => resolveToolApproval,
|
|
694
|
+
resolvePermission: () => resolvePermission,
|
|
695
|
+
replayExecution: () => replayExecution,
|
|
696
|
+
releaseToolWork: () => releaseToolWork,
|
|
697
|
+
releaseEnvelopeReady: () => releaseEnvelopeReady,
|
|
698
|
+
registerEntityKind: () => registerEntityKind,
|
|
699
|
+
registerAgentDefinition: () => registerAgentDefinition,
|
|
700
|
+
registerAgent: () => registerAgent,
|
|
701
|
+
registerAddressBookRoute: () => registerAddressBookRoute,
|
|
702
|
+
publishTopic: () => publishTopic,
|
|
703
|
+
listWaits: () => listWaits,
|
|
704
|
+
listTopicSubscriptions: () => listTopicSubscriptions,
|
|
705
|
+
listToolAttempts: () => listToolAttempts,
|
|
706
|
+
listSkillDefinitions: () => listSkillDefinitions,
|
|
707
|
+
listSkillDefinitionRevisions: () => listSkillDefinitionRevisions,
|
|
708
|
+
listSessions: () => listSessions,
|
|
709
|
+
listSchedules: () => listSchedules,
|
|
710
|
+
listRunners: () => listRunners,
|
|
711
|
+
listPendingToolCalls: () => listPendingToolCalls,
|
|
712
|
+
listPendingApprovals: () => listPendingApprovals,
|
|
713
|
+
listInboxMessages: () => listInboxMessages,
|
|
714
|
+
listExecutions: () => listExecutions,
|
|
715
|
+
listEntities: () => listEntities,
|
|
716
|
+
listAgentDefinitions: () => listAgentDefinitions,
|
|
717
|
+
listAgentDefinitionRevisions: () => listAgentDefinitionRevisions,
|
|
718
|
+
listAddressBookRoutes: () => listAddressBookRoutes,
|
|
719
|
+
layerFromRuntime: () => layerFromRuntime,
|
|
720
|
+
inspectExecution: () => inspectExecution,
|
|
721
|
+
getSkillDefinition: () => getSkillDefinition,
|
|
722
|
+
getSession: () => getSession,
|
|
723
|
+
getPresence: () => getPresence,
|
|
724
|
+
getOrCreateEntity: () => getOrCreateEntity,
|
|
725
|
+
getExecution: () => getExecution,
|
|
726
|
+
getEntity: () => getEntity,
|
|
727
|
+
getAgentDefinition: () => getAgentDefinition,
|
|
728
|
+
getAddressBookRoute: () => getAddressBookRoute,
|
|
729
|
+
fulfillToolCall: () => fulfillToolCall,
|
|
730
|
+
destroyEntity: () => destroyEntity,
|
|
731
|
+
createSchedule: () => createSchedule,
|
|
732
|
+
completeToolWork: () => completeToolWork,
|
|
733
|
+
claimToolWork: () => claimToolWork,
|
|
734
|
+
claimEnvelopeReady: () => claimEnvelopeReady,
|
|
735
|
+
cancelSchedule: () => cancelSchedule,
|
|
736
|
+
cancelExecution: () => cancelExecution,
|
|
737
|
+
awaitWait: () => awaitWait,
|
|
738
|
+
askEntity: () => askEntity,
|
|
739
|
+
ackEnvelopeReady: () => ackEnvelopeReady,
|
|
740
|
+
Service: () => Service,
|
|
741
|
+
ExecutionNotFound: () => ExecutionNotFound,
|
|
742
|
+
EventLogCursorNotFound: () => EventLogCursorNotFound,
|
|
743
|
+
EntityNamespaceReserved: () => EntityNamespaceReserved,
|
|
744
|
+
ClientError: () => ClientError
|
|
745
|
+
});
|
|
746
|
+
import { Clock, Context, Effect, Layer, Option, Schema as Schema3, SchemaGetter, SchemaIssue, Stream } from "effect";
|
|
747
|
+
import { EntityId, ShardId, Sharding, ShardingConfig } from "effect/unstable/cluster";
|
|
748
|
+
class ClientError extends Schema3.TaggedErrorClass()("ClientError", {
|
|
749
|
+
message: Schema3.String
|
|
750
|
+
}) {
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
class ExecutionNotFound extends Schema3.TaggedErrorClass()("ExecutionNotFound", {
|
|
754
|
+
execution_id: exports_ids_schema.ExecutionId
|
|
755
|
+
}) {
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
class EntityNamespaceReserved extends Schema3.TaggedErrorClass()("EntityNamespaceReserved", { id: Schema3.String, message: Schema3.String }) {
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
class Service extends Context.Service()("@relayfx/sdk/Client") {
|
|
762
|
+
}
|
|
763
|
+
var errorMessage = (error) => {
|
|
764
|
+
if (error instanceof Error)
|
|
765
|
+
return error.message;
|
|
766
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
767
|
+
return error.message;
|
|
768
|
+
}
|
|
769
|
+
if (typeof error === "object" && error !== null && "_tag" in error && typeof error._tag === "string") {
|
|
770
|
+
return error._tag;
|
|
771
|
+
}
|
|
772
|
+
return String(error);
|
|
773
|
+
};
|
|
774
|
+
var toClientError = (error) => new ClientError({ message: errorMessage(error) });
|
|
775
|
+
var rejectReserved = (id, prefix) => id.startsWith(prefix) ? Effect.fail(new EntityNamespaceReserved({ id, message: "start entities via Client.getOrCreateEntity" })) : Effect.void;
|
|
776
|
+
var replyValueFrom = (content) => {
|
|
777
|
+
if (content === undefined || content.length === 0)
|
|
778
|
+
return Option.none();
|
|
779
|
+
const structured = content.find((part) => part.type === "structured");
|
|
780
|
+
if (structured !== undefined)
|
|
781
|
+
return Option.some(structured.value);
|
|
782
|
+
const text = content.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
783
|
+
if (text.length === 0)
|
|
784
|
+
return Option.none();
|
|
785
|
+
try {
|
|
786
|
+
return Option.some(JSON.parse(text));
|
|
787
|
+
} catch {
|
|
788
|
+
return Option.none();
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
var toStreamError = (error) => Option.match(Schema3.decodeUnknownOption(EventLogCursorNotFound)(error), {
|
|
792
|
+
onNone: () => toClientError(error),
|
|
793
|
+
onSome: (cursorError) => cursorError
|
|
794
|
+
});
|
|
795
|
+
var malformedCursor = (wire) => new SchemaIssue.InvalidValue(Option.some(wire), { message: "Malformed pagination cursor" });
|
|
796
|
+
var decodeCursorFields = (wire) => Effect.gen(function* () {
|
|
797
|
+
const decoded = yield* Effect.try({
|
|
798
|
+
try: () => globalThis.atob(wire),
|
|
799
|
+
catch: () => malformedCursor(wire)
|
|
800
|
+
});
|
|
801
|
+
const separator = decoded.indexOf(":");
|
|
802
|
+
if (separator === -1)
|
|
803
|
+
return yield* Effect.fail(malformedCursor(wire));
|
|
804
|
+
const updatedAt = Number(decoded.slice(0, separator));
|
|
805
|
+
if (!Number.isFinite(updatedAt))
|
|
806
|
+
return yield* Effect.fail(malformedCursor(wire));
|
|
807
|
+
return { updatedAt, id: decoded.slice(separator + 1) };
|
|
808
|
+
});
|
|
809
|
+
var ExecutionCursorFromString = exports_shared_schema.NonEmptyString.pipe(Schema3.decodeTo(Schema3.Struct({ updatedAt: Schema3.Int, id: exports_ids_schema.ExecutionId }), {
|
|
810
|
+
decode: SchemaGetter.transformOrFail((wire) => decodeCursorFields(wire)),
|
|
811
|
+
encode: SchemaGetter.transform((cursor) => globalThis.btoa(`${cursor.updatedAt}:${cursor.id}`))
|
|
812
|
+
})).annotate({ identifier: "Relay.Client.ExecutionCursor" });
|
|
813
|
+
var encodeExecutionCursor = (cursor) => Schema3.encodeEffect(ExecutionCursorFromString)(cursor).pipe(Effect.mapError(toClientError));
|
|
814
|
+
var SessionCursorFromString = exports_shared_schema.NonEmptyString.pipe(Schema3.decodeTo(Schema3.Struct({ updatedAt: Schema3.Int, id: exports_ids_schema.SessionId }), {
|
|
815
|
+
decode: SchemaGetter.transformOrFail((wire) => decodeCursorFields(wire)),
|
|
816
|
+
encode: SchemaGetter.transform((cursor) => globalThis.btoa(`${cursor.updatedAt}:${cursor.id}`))
|
|
817
|
+
})).annotate({ identifier: "Relay.Client.SessionCursor" });
|
|
818
|
+
var conversationKind = (metadata) => metadata.kind === "agent-agent" ? "agent-agent" : "user-agent";
|
|
819
|
+
var toConversationSummary = (record) => ({
|
|
820
|
+
execution_id: record.id,
|
|
821
|
+
root_address_id: record.rootAddressId,
|
|
822
|
+
...record.sessionId === undefined ? {} : { session_id: record.sessionId },
|
|
823
|
+
status: record.status,
|
|
824
|
+
kind: conversationKind(record.metadata),
|
|
825
|
+
...record.agentId === undefined ? {} : { agent_id: record.agentId },
|
|
826
|
+
metadata: record.metadata,
|
|
827
|
+
created_at: record.createdAt,
|
|
828
|
+
updated_at: record.updatedAt
|
|
829
|
+
});
|
|
830
|
+
var toExecutionView = (record) => ({
|
|
831
|
+
id: record.id,
|
|
832
|
+
root_address_id: record.rootAddressId,
|
|
833
|
+
...record.sessionId === undefined ? {} : { session_id: record.sessionId },
|
|
834
|
+
status: record.status,
|
|
835
|
+
...record.agentId === undefined ? {} : { agent_id: record.agentId },
|
|
836
|
+
...record.agentRevision === undefined ? {} : { agent_revision: record.agentRevision },
|
|
837
|
+
...record.agentSnapshot === undefined ? {} : { agent_snapshot: record.agentSnapshot },
|
|
838
|
+
...record.agentToolInputSchemaDigests === undefined ? {} : { agent_tool_input_schema_digests: record.agentToolInputSchemaDigests },
|
|
839
|
+
metadata: record.metadata,
|
|
840
|
+
created_at: record.createdAt,
|
|
841
|
+
updated_at: record.updatedAt
|
|
842
|
+
});
|
|
843
|
+
var toWaitView = (record) => ({
|
|
844
|
+
wait_id: record.id,
|
|
845
|
+
execution_id: record.executionId,
|
|
846
|
+
...record.envelopeId === undefined ? {} : { envelope_id: record.envelopeId },
|
|
847
|
+
mode: record.mode,
|
|
848
|
+
...record.correlationKey === undefined ? {} : { correlation_key: record.correlationKey },
|
|
849
|
+
state: record.state,
|
|
850
|
+
metadata: record.metadata,
|
|
851
|
+
created_at: record.createdAt,
|
|
852
|
+
...record.resolvedAt === undefined ? {} : { resolved_at: record.resolvedAt }
|
|
853
|
+
});
|
|
854
|
+
var toSessionSummary = (record) => ({
|
|
855
|
+
session_id: record.id,
|
|
856
|
+
root_address_id: record.rootAddressId,
|
|
857
|
+
metadata: record.metadata,
|
|
858
|
+
created_at: record.createdAt,
|
|
859
|
+
updated_at: record.updatedAt
|
|
860
|
+
});
|
|
861
|
+
var toToolCallSummary = (record) => ({
|
|
862
|
+
tool_call_id: record.call.id,
|
|
863
|
+
tool_name: record.call.name,
|
|
864
|
+
input: record.call.input,
|
|
865
|
+
metadata: record.call.metadata ?? {},
|
|
866
|
+
requested_at: record.createdAt
|
|
867
|
+
});
|
|
868
|
+
var toChildRunSummary = (record) => ({
|
|
869
|
+
child_execution_id: record.id,
|
|
870
|
+
address_id: record.addressId,
|
|
871
|
+
status: record.status,
|
|
872
|
+
metadata: record.metadata,
|
|
873
|
+
created_at: record.createdAt,
|
|
874
|
+
updated_at: record.updatedAt
|
|
875
|
+
});
|
|
876
|
+
var executionIdFromIdempotencyKey = (idempotencyKey) => exports_ids_schema.ExecutionId.make(`execution:${idempotencyKey}`);
|
|
877
|
+
var metadataWithIdempotencyKey = (metadata, idempotencyKey) => ({
|
|
878
|
+
...metadata,
|
|
879
|
+
idempotency_key: idempotencyKey
|
|
880
|
+
});
|
|
881
|
+
var startExecutionByAddressPayload = (input) => ({
|
|
882
|
+
execution_id: input.execution_id ?? executionIdFromIdempotencyKey(input.idempotency_key),
|
|
883
|
+
root_address_id: input.address_id,
|
|
884
|
+
...input.session_id === undefined ? {} : { session_id: input.session_id },
|
|
885
|
+
...input.input === undefined ? {} : { input: [...input.input] },
|
|
886
|
+
event_sequence: input.event_sequence ?? 0,
|
|
887
|
+
started_at: input.started_at,
|
|
888
|
+
completed_at: input.completed_at,
|
|
889
|
+
...input.wait_id === undefined ? {} : { wait_id: input.wait_id },
|
|
890
|
+
metadata: metadataWithIdempotencyKey(input.metadata, input.idempotency_key)
|
|
891
|
+
});
|
|
892
|
+
var startExecutionByAgentDefinitionPayload = (input, definition) => ({
|
|
893
|
+
execution_id: input.execution_id ?? executionIdFromIdempotencyKey(input.idempotency_key),
|
|
894
|
+
root_address_id: input.root_address_id,
|
|
895
|
+
...input.session_id === undefined ? {} : { session_id: input.session_id },
|
|
896
|
+
...input.input === undefined ? {} : { input: [...input.input] },
|
|
897
|
+
event_sequence: input.event_sequence ?? 0,
|
|
898
|
+
started_at: input.started_at,
|
|
899
|
+
completed_at: input.completed_at,
|
|
900
|
+
agent_id: input.agent_id,
|
|
901
|
+
agent_revision: definition.current_revision,
|
|
902
|
+
agent_snapshot: definition.definition,
|
|
903
|
+
...definition.tool_input_schema_digests === undefined ? {} : { agent_tool_input_schema_digests: definition.tool_input_schema_digests },
|
|
904
|
+
...input.wait_id === undefined ? {} : { wait_id: input.wait_id },
|
|
905
|
+
metadata: metadataWithIdempotencyKey(input.metadata, input.idempotency_key)
|
|
906
|
+
});
|
|
907
|
+
var isRegisterBatonAgentInput = (input) => ("agent" in input);
|
|
908
|
+
var toolRefsFromBatonAgent = (agent) => {
|
|
909
|
+
const tools = agent.toolkit.tools;
|
|
910
|
+
return Object.values(tools).map((tool) => ({ name: tool.name }));
|
|
911
|
+
};
|
|
912
|
+
var modelSelectionFromBatonAgent = (selection) => ({
|
|
913
|
+
provider: selection.provider,
|
|
914
|
+
model: selection.model,
|
|
915
|
+
...selection.registrationKey === undefined ? {} : { registration_key: selection.registrationKey }
|
|
916
|
+
});
|
|
917
|
+
var decodeBatonAgentName = (name) => Schema3.decodeUnknownEffect(exports_shared_schema.NonEmptyString)(name).pipe(Effect.mapError(() => new ClientError({ message: "Baton agent name must not be blank" })));
|
|
918
|
+
var decodeBatonAgentMetadata = (metadata) => metadata === undefined ? Effect.succeed(undefined) : Schema3.decodeUnknownEffect(exports_shared_schema.Metadata)(metadata).pipe(Effect.mapError(() => new ClientError({ message: "Baton agent metadata must be JSON metadata" })));
|
|
919
|
+
var decodeBatonMemorySubject = (subject) => Schema3.decodeUnknownEffect(exports_ids_schema.MemorySubjectId)(subject).pipe(Effect.mapError(() => new ClientError({ message: "Baton agent memory subject must be a MemorySubjectId" })));
|
|
920
|
+
var metadataFromBatonAgent = Effect.fn("Client.metadataFromBatonAgent")(function* (input) {
|
|
921
|
+
const agentMetadata = yield* decodeBatonAgentMetadata(input.agent.metadata);
|
|
922
|
+
const memorySubject = input.agent.memory === undefined ? undefined : yield* decodeBatonMemorySubject(input.agent.memory.subject);
|
|
923
|
+
const metadata = {
|
|
924
|
+
...agentMetadata,
|
|
925
|
+
...memorySubject === undefined ? {} : { memory_subject_id: memorySubject },
|
|
926
|
+
...input.metadata
|
|
927
|
+
};
|
|
928
|
+
return Object.keys(metadata).length === 0 ? undefined : metadata;
|
|
929
|
+
});
|
|
930
|
+
var modelSelectionFromRegisterInput = (input) => {
|
|
931
|
+
if (input.model !== undefined)
|
|
932
|
+
return Effect.succeed(input.model);
|
|
933
|
+
if (input.agent.model !== undefined)
|
|
934
|
+
return Effect.succeed(modelSelectionFromBatonAgent(input.agent.model));
|
|
935
|
+
return Effect.fail(new ClientError({ message: "Client.registerAgent requires model or agent.model" }));
|
|
936
|
+
};
|
|
937
|
+
var batonTurnPolicyInvalid = (detail) => new ClientError({ message: `Baton agent turn policy is not durably portable: ${detail}` });
|
|
938
|
+
var turnPolicySnapshotFromBaton = Effect.fn("Client.turnPolicySnapshotFromBaton")(function* (snapshot) {
|
|
939
|
+
let nodes = 0;
|
|
940
|
+
const visit = (current, depth) => Effect.gen(function* () {
|
|
941
|
+
if (typeof current !== "object" || current === null || Array.isArray(current)) {
|
|
942
|
+
return yield* Effect.fail(batonTurnPolicyInvalid("snapshot nodes must be objects"));
|
|
943
|
+
}
|
|
944
|
+
const node = current;
|
|
945
|
+
nodes += 1;
|
|
946
|
+
if (depth > exports_agent_schema.maxTurnPolicySnapshotDepth) {
|
|
947
|
+
return yield* Effect.fail(batonTurnPolicyInvalid(`depth exceeds ${exports_agent_schema.maxTurnPolicySnapshotDepth}`));
|
|
948
|
+
}
|
|
949
|
+
if (nodes > exports_agent_schema.maxTurnPolicySnapshotNodes) {
|
|
950
|
+
return yield* Effect.fail(batonTurnPolicyInvalid(`node count exceeds ${exports_agent_schema.maxTurnPolicySnapshotNodes}`));
|
|
951
|
+
}
|
|
952
|
+
switch (node._tag) {
|
|
953
|
+
case "Recurs":
|
|
954
|
+
if (typeof node.count !== "number" || !Number.isInteger(node.count) || node.count < 0) {
|
|
955
|
+
return yield* Effect.fail(batonTurnPolicyInvalid("recurs count must be a non-negative integer"));
|
|
956
|
+
}
|
|
957
|
+
return { kind: "recurs", count: node.count };
|
|
958
|
+
case "UntilToolCall":
|
|
959
|
+
if (typeof node.name !== "string" || node.name.trim().length === 0) {
|
|
960
|
+
return yield* Effect.fail(batonTurnPolicyInvalid("until-tool-call name must not be blank"));
|
|
961
|
+
}
|
|
962
|
+
return { kind: "until-tool-call", name: node.name };
|
|
963
|
+
case "Both":
|
|
964
|
+
return {
|
|
965
|
+
kind: "both",
|
|
966
|
+
first: yield* visit(node.first, depth + 1),
|
|
967
|
+
second: yield* visit(node.second, depth + 1)
|
|
968
|
+
};
|
|
969
|
+
default:
|
|
970
|
+
return yield* Effect.fail(batonTurnPolicyInvalid("snapshot tag is not recognized"));
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
return yield* visit(snapshot, 1);
|
|
974
|
+
});
|
|
975
|
+
var turnPolicyFieldsFromRegisterInput = Effect.fn("Client.turnPolicyFieldsFromRegisterInput")(function* (input) {
|
|
976
|
+
if (input.max_tool_turns !== undefined)
|
|
977
|
+
return { max_tool_turns: input.max_tool_turns };
|
|
978
|
+
const snapshot = input.agent.policy.snapshot;
|
|
979
|
+
if (snapshot === undefined) {
|
|
980
|
+
return yield* Effect.fail(batonTurnPolicyInvalid("opaque policies require an explicit max_tool_turns replacement"));
|
|
981
|
+
}
|
|
982
|
+
const durable = yield* turnPolicySnapshotFromBaton(snapshot);
|
|
983
|
+
if (durable.kind === "recurs" && durable.count === exports_agent_schema.defaultMaxToolTurns)
|
|
984
|
+
return {};
|
|
985
|
+
if (durable.kind === "recurs" && durable.count > 0)
|
|
986
|
+
return { max_tool_turns: durable.count };
|
|
987
|
+
return { turn_policy: durable };
|
|
988
|
+
});
|
|
989
|
+
var registerAgentPayload = Effect.fn("Client.registerAgentPayload")(function* (input) {
|
|
990
|
+
if (!isRegisterBatonAgentInput(input))
|
|
991
|
+
return exports_agent_schema.define(input);
|
|
992
|
+
const name = yield* decodeBatonAgentName(input.agent.name);
|
|
993
|
+
const model = yield* modelSelectionFromRegisterInput(input);
|
|
994
|
+
const metadata = yield* metadataFromBatonAgent(input);
|
|
995
|
+
const turnPolicy = yield* turnPolicyFieldsFromRegisterInput(input);
|
|
996
|
+
return exports_agent_schema.define({
|
|
997
|
+
id: input.id,
|
|
998
|
+
name,
|
|
999
|
+
...input.agent.instructions === undefined ? {} : { instructions: input.agent.instructions },
|
|
1000
|
+
model,
|
|
1001
|
+
tools: toolRefsFromBatonAgent(input.agent),
|
|
1002
|
+
permissions: input.permissions ?? [],
|
|
1003
|
+
...input.skill_definition_ids === undefined ? {} : { skill_definition_ids: input.skill_definition_ids },
|
|
1004
|
+
...input.permission_rules === undefined ? {} : { permission_rules: input.permission_rules },
|
|
1005
|
+
...turnPolicy,
|
|
1006
|
+
...input.max_wait_turns === undefined ? {} : { max_wait_turns: input.max_wait_turns },
|
|
1007
|
+
...input.token_budget === undefined ? {} : { token_budget: input.token_budget },
|
|
1008
|
+
...input.child_run_presets === undefined ? {} : { child_run_presets: input.child_run_presets },
|
|
1009
|
+
...input.handoff_targets === undefined ? {} : { handoff_targets: input.handoff_targets },
|
|
1010
|
+
...input.output_schema_ref === undefined ? {} : { output_schema_ref: input.output_schema_ref },
|
|
1011
|
+
...metadata === undefined ? {} : { metadata }
|
|
1012
|
+
});
|
|
1013
|
+
});
|
|
1014
|
+
var agentDefinitionNotFound = (id) => new ClientError({ message: `Agent not found: ${id}` });
|
|
1015
|
+
var wakeMetadata = (input) => ({
|
|
1016
|
+
...input.metadata,
|
|
1017
|
+
...input.from === undefined ? {} : { from: input.from },
|
|
1018
|
+
...input.content === undefined ? {} : { content: input.content },
|
|
1019
|
+
...input.correlation_key === undefined ? {} : { correlation_key: input.correlation_key }
|
|
1020
|
+
});
|
|
1021
|
+
var toPendingToolApproval = (record) => ({
|
|
1022
|
+
wait_id: record.id,
|
|
1023
|
+
execution_id: record.executionId,
|
|
1024
|
+
tool_call_id: exports_ids_schema.ToolCallId.make(String(record.metadata.tool_call_id ?? "")),
|
|
1025
|
+
tool_name: String(record.metadata.tool_name ?? ""),
|
|
1026
|
+
input: record.metadata.input ?? null,
|
|
1027
|
+
requested_at: record.createdAt
|
|
1028
|
+
});
|
|
1029
|
+
var isToolApprovalWait = (record) => record.metadata.kind === "tool-approval";
|
|
1030
|
+
var toToolAttempt = (record) => ({
|
|
1031
|
+
attempt_id: record.id,
|
|
1032
|
+
tool_call_id: record.callId,
|
|
1033
|
+
attempt_number: record.attemptNumber,
|
|
1034
|
+
state: record.state,
|
|
1035
|
+
...record.workerId === undefined ? {} : { worker_id: record.workerId },
|
|
1036
|
+
...record.claimExpiresAt === undefined ? {} : { claim_expires_at: record.claimExpiresAt },
|
|
1037
|
+
...record.error === undefined ? {} : { error: record.error },
|
|
1038
|
+
created_at: record.createdAt,
|
|
1039
|
+
...record.completedAt === undefined ? {} : { completed_at: record.completedAt }
|
|
1040
|
+
});
|
|
1041
|
+
var toPendingToolCall = (record) => record.definition === undefined || record.waitId === undefined ? undefined : {
|
|
1042
|
+
execution_id: record.executionId,
|
|
1043
|
+
call: record.call,
|
|
1044
|
+
definition: record.definition,
|
|
1045
|
+
placement: record.placement,
|
|
1046
|
+
state: record.state,
|
|
1047
|
+
wait_id: record.waitId,
|
|
1048
|
+
idempotency_key: record.idempotencyKey,
|
|
1049
|
+
requested_at: record.createdAt
|
|
1050
|
+
};
|
|
1051
|
+
var toToolOutcomeAccepted = (accepted) => ({
|
|
1052
|
+
tool_call_id: accepted.call.call.id,
|
|
1053
|
+
attempt: toToolAttempt(accepted.attempt),
|
|
1054
|
+
duplicate: accepted.duplicate
|
|
1055
|
+
});
|
|
1056
|
+
var toToolWorkLease = (lease) => ({
|
|
1057
|
+
execution_id: lease.call.executionId,
|
|
1058
|
+
call: lease.call.call,
|
|
1059
|
+
definition: lease.call.definition,
|
|
1060
|
+
placement: lease.call.placement,
|
|
1061
|
+
attempt: toToolAttempt(lease.attempt),
|
|
1062
|
+
queue: lease.queue,
|
|
1063
|
+
worker_id: lease.workerId,
|
|
1064
|
+
claim_expires_at: lease.claimExpiresAt,
|
|
1065
|
+
idempotency_key: lease.idempotencyKey
|
|
1066
|
+
});
|
|
1067
|
+
var toolWaitId = (callId) => exports_ids_schema.WaitId.make(`wait:tool:${callId}`);
|
|
1068
|
+
var acceptedWaitOutcome = (wait) => Schema3.decodeUnknownEffect(exports_tool_schema.ExternalOutcome)(wait.metadata.external_outcome).pipe(Effect.mapError(toClientError));
|
|
1069
|
+
var resolveToolOutcomeWait = Effect.fn("Client.resolveToolOutcomeWait")(function* (waits, eventLog, call, outcome, completedAt) {
|
|
1070
|
+
const waitId = call.waitId ?? toolWaitId(call.call.id);
|
|
1071
|
+
const wait = yield* waits.get(waitId).pipe(Effect.mapError(toClientError));
|
|
1072
|
+
if (wait === undefined)
|
|
1073
|
+
return yield* new ClientError({ message: `Tool wait not found: ${waitId}` });
|
|
1074
|
+
if (wait.executionId !== call.executionId) {
|
|
1075
|
+
return yield* new ClientError({ message: `Tool wait does not match call: ${call.call.id}` });
|
|
1076
|
+
}
|
|
1077
|
+
if (wait.state === "resolved") {
|
|
1078
|
+
const accepted = yield* acceptedWaitOutcome(wait);
|
|
1079
|
+
if (exports_shared_schema.canonicalString(accepted) !== exports_shared_schema.canonicalString(outcome)) {
|
|
1080
|
+
return yield* new ClientError({ message: `Tool outcome conflicts with accepted wait: ${call.call.id}` });
|
|
1081
|
+
}
|
|
1082
|
+
return wait;
|
|
1083
|
+
}
|
|
1084
|
+
if (wait.state !== "open") {
|
|
1085
|
+
return yield* new ClientError({ message: `Tool wait is ${wait.state}: ${call.call.id}` });
|
|
1086
|
+
}
|
|
1087
|
+
const eventSequence = yield* nextEventSequence(eventLog, call.executionId);
|
|
1088
|
+
const resolved = yield* waits.wake({
|
|
1089
|
+
waitId,
|
|
1090
|
+
resolvedAt: completedAt,
|
|
1091
|
+
eventSequence,
|
|
1092
|
+
metadata: { kind: "tool-placement", external_outcome: outcome }
|
|
1093
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1094
|
+
if (!resolved.transitioned) {
|
|
1095
|
+
const accepted = yield* acceptedWaitOutcome(resolved.wait);
|
|
1096
|
+
if (exports_shared_schema.canonicalString(accepted) !== exports_shared_schema.canonicalString(outcome)) {
|
|
1097
|
+
return yield* new ClientError({ message: `Tool outcome conflicts with accepted wait: ${call.call.id}` });
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return resolved.wait;
|
|
1101
|
+
});
|
|
1102
|
+
var signalToolOutcome = Effect.fn("Client.signalToolOutcome")(function* (executionRepository, makeExecutionClient, wait, signaledAt) {
|
|
1103
|
+
yield* exports_wait_signal.signalWorkflowWait({
|
|
1104
|
+
makeExecutionClient,
|
|
1105
|
+
executionId: wait.executionId,
|
|
1106
|
+
waitId: wait.id,
|
|
1107
|
+
state: "resolved",
|
|
1108
|
+
signaledAt
|
|
1109
|
+
}).pipe(Effect.provideService(exports_execution_repository.Service, executionRepository), Effect.mapError(toClientError));
|
|
1110
|
+
});
|
|
1111
|
+
var toReady = (record) => ({
|
|
1112
|
+
id: record.id,
|
|
1113
|
+
envelope_id: record.envelopeId,
|
|
1114
|
+
route_key: record.routeKey,
|
|
1115
|
+
available_at: record.availableAt,
|
|
1116
|
+
attempt: record.attempt,
|
|
1117
|
+
metadata: record.metadata
|
|
1118
|
+
});
|
|
1119
|
+
var toLease = (record) => ({
|
|
1120
|
+
ready: toReady(record),
|
|
1121
|
+
worker_id: record.claimOwner ?? "unclaimed",
|
|
1122
|
+
claim_expires_at: record.claimExpiresAt ?? record.updatedAt
|
|
1123
|
+
});
|
|
1124
|
+
var nextEventSequence = Effect.fn("Client.nextEventSequence")(function* (eventLog, executionId) {
|
|
1125
|
+
const max = yield* eventLog.maxSequence(executionId).pipe(Effect.mapError(toClientError));
|
|
1126
|
+
return max === undefined ? 0 : max + 1;
|
|
1127
|
+
});
|
|
1128
|
+
var wakeRuntime = Effect.fn("Client.wakeRuntime")(function* (waits, eventLog, executionRepository, makeExecutionClient, input) {
|
|
1129
|
+
const wait = yield* waits.get(input.wait_id).pipe(Effect.mapError(toClientError));
|
|
1130
|
+
if (wait === undefined)
|
|
1131
|
+
return yield* new ClientError({ message: `Wait not found: ${input.wait_id}` });
|
|
1132
|
+
if (input.state === "cancelled" && wait.metadata.kind === "tool-placement") {
|
|
1133
|
+
return yield* new ClientError({ message: "Tool placement waits must be cancelled through cancelExecution" });
|
|
1134
|
+
}
|
|
1135
|
+
const eventSequence = yield* nextEventSequence(eventLog, wait.executionId);
|
|
1136
|
+
const result = input.state === "resolved" ? yield* waits.wake({
|
|
1137
|
+
waitId: input.wait_id,
|
|
1138
|
+
resolvedAt: input.signaled_at,
|
|
1139
|
+
eventSequence,
|
|
1140
|
+
metadata: wakeMetadata(input)
|
|
1141
|
+
}).pipe(Effect.mapError(toClientError)) : input.state === "timed_out" ? yield* waits.timeout({
|
|
1142
|
+
waitId: input.wait_id,
|
|
1143
|
+
timedOutAt: input.signaled_at,
|
|
1144
|
+
eventSequence,
|
|
1145
|
+
metadata: wakeMetadata(input)
|
|
1146
|
+
}).pipe(Effect.mapError(toClientError)) : yield* waits.cancel({
|
|
1147
|
+
waitId: input.wait_id,
|
|
1148
|
+
cancelledAt: input.signaled_at,
|
|
1149
|
+
eventSequence,
|
|
1150
|
+
metadata: wakeMetadata(input)
|
|
1151
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1152
|
+
if (result.transitioned) {
|
|
1153
|
+
yield* exports_wait_signal.signalWorkflowWait({
|
|
1154
|
+
makeExecutionClient,
|
|
1155
|
+
executionId: result.wait.executionId,
|
|
1156
|
+
waitId: result.wait.id,
|
|
1157
|
+
state: input.state,
|
|
1158
|
+
signaledAt: input.signaled_at
|
|
1159
|
+
}).pipe(Effect.provideService(exports_execution_repository.Service, executionRepository), Effect.mapError(toClientError));
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
wait_id: result.wait.id,
|
|
1163
|
+
state: input.state,
|
|
1164
|
+
signaled_at: input.signaled_at
|
|
1165
|
+
};
|
|
1166
|
+
});
|
|
1167
|
+
var childJoinWaitId = (childExecutionId) => exports_ids_schema.WaitId.make(`wait:child:${childExecutionId}`);
|
|
1168
|
+
var childSpawnFingerprintKey = "relay_child_spawn_fingerprint";
|
|
1169
|
+
var childExecutionIdForSpawn = (input) => input.child_execution_id ?? exports_ids_schema.ChildExecutionId.make(`${input.execution_id}:child:${input.address_id}`);
|
|
1170
|
+
var parentContextFromDefinition = (definition, fingerprint) => ({
|
|
1171
|
+
...definition.instructions === undefined ? {} : { instructions: definition.instructions },
|
|
1172
|
+
model: definition.model,
|
|
1173
|
+
tool_names: definition.tool_names,
|
|
1174
|
+
permissions: definition.permissions.map((permission) => permission.name),
|
|
1175
|
+
...definition.output_schema_ref === undefined ? {} : { output_schema_ref: definition.output_schema_ref },
|
|
1176
|
+
metadata: { ...definition.metadata, [childSpawnFingerprintKey]: fingerprint }
|
|
1177
|
+
});
|
|
1178
|
+
var internalSpawnChildRunInput = (input, pin, createdAt) => ({
|
|
1179
|
+
execution_id: input.execution_id,
|
|
1180
|
+
child_execution_id: childExecutionIdForSpawn(input),
|
|
1181
|
+
address_id: input.address_id,
|
|
1182
|
+
parent_context: parentContextFromDefinition(pin.agentSnapshot, exports_shared_schema.canonicalString(input)),
|
|
1183
|
+
...pin.agentSnapshot.child_run_presets === undefined ? {} : { presets: pin.agentSnapshot.child_run_presets },
|
|
1184
|
+
...input.preset_name === undefined ? {} : { preset_name: input.preset_name },
|
|
1185
|
+
...input.instructions === undefined ? {} : { instructions: input.instructions },
|
|
1186
|
+
...input.model === undefined ? {} : { model: input.model },
|
|
1187
|
+
...input.tool_names === undefined ? {} : { tool_names: input.tool_names },
|
|
1188
|
+
...input.permissions === undefined ? {} : { permissions: input.permissions },
|
|
1189
|
+
...input.workspace_policy === undefined ? {} : { workspace_policy: input.workspace_policy },
|
|
1190
|
+
...input.output_schema_ref === undefined ? {} : { output_schema_ref: input.output_schema_ref },
|
|
1191
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata },
|
|
1192
|
+
...input.input === undefined ? {} : { input: input.input },
|
|
1193
|
+
...input.wait === undefined ? {} : { wait: input.wait },
|
|
1194
|
+
created_at: createdAt
|
|
1195
|
+
});
|
|
1196
|
+
var childSpawnFingerprint = (record) => {
|
|
1197
|
+
const parentMetadata = record.metadata.parent_metadata;
|
|
1198
|
+
if (parentMetadata === null || typeof parentMetadata !== "object" || Array.isArray(parentMetadata))
|
|
1199
|
+
return;
|
|
1200
|
+
const fingerprint = parentMetadata[childSpawnFingerprintKey];
|
|
1201
|
+
return typeof fingerprint === "string" ? fingerprint : undefined;
|
|
1202
|
+
};
|
|
1203
|
+
var createChildJoinWait = Effect.fn("Client.createChildJoinWait")(function* (waits, eventLog, input, accepted, createdAt) {
|
|
1204
|
+
const waitId = childJoinWaitId(accepted.child_execution_id);
|
|
1205
|
+
const eventSequence = yield* nextEventSequence(eventLog, input.execution_id);
|
|
1206
|
+
yield* waits.createDetached({
|
|
1207
|
+
waitId,
|
|
1208
|
+
executionId: input.execution_id,
|
|
1209
|
+
mode: "child",
|
|
1210
|
+
correlationKey: accepted.child_execution_id,
|
|
1211
|
+
metadata: {
|
|
1212
|
+
parent_execution_id: input.execution_id,
|
|
1213
|
+
child_execution_id: accepted.child_execution_id
|
|
1214
|
+
},
|
|
1215
|
+
eventSequence,
|
|
1216
|
+
createdAt
|
|
1217
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1218
|
+
return waitId;
|
|
1219
|
+
});
|
|
1220
|
+
var reconcileExistingChildSpawn = Effect.fn("Client.reconcileExistingChildSpawn")(function* (childExecutions, waits, eventLog, input) {
|
|
1221
|
+
const childExecutionId = childExecutionIdForSpawn(input);
|
|
1222
|
+
const existing = yield* childExecutions.get(childExecutionId).pipe(Effect.mapError(toClientError));
|
|
1223
|
+
if (existing === undefined)
|
|
1224
|
+
return;
|
|
1225
|
+
if (existing.executionId !== input.execution_id || existing.addressId !== input.address_id || childSpawnFingerprint(existing) !== exports_shared_schema.canonicalString(input)) {
|
|
1226
|
+
return yield* new ClientError({ message: `Child execution conflicts: ${childExecutionId}` });
|
|
1227
|
+
}
|
|
1228
|
+
const spawned = yield* eventLog.findByCursor({
|
|
1229
|
+
executionId: input.execution_id,
|
|
1230
|
+
cursor: `${input.execution_id}:child:${childExecutionId}:spawned`
|
|
1231
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1232
|
+
if (Option.isNone(spawned)) {
|
|
1233
|
+
return yield* new ClientError({ message: `Child spawn event missing: ${childExecutionId}` });
|
|
1234
|
+
}
|
|
1235
|
+
const parentWaitId = input.wait === true ? childJoinWaitId(childExecutionId) : undefined;
|
|
1236
|
+
if (parentWaitId !== undefined) {
|
|
1237
|
+
const wait = yield* waits.get(parentWaitId).pipe(Effect.mapError(toClientError));
|
|
1238
|
+
if (wait === undefined) {
|
|
1239
|
+
return yield* new ClientError({ message: `Child join wait missing: ${childExecutionId}` });
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
accepted: { child_execution_id: childExecutionId, execution_id: input.execution_id },
|
|
1244
|
+
createdAt: existing.createdAt,
|
|
1245
|
+
parentWaitId
|
|
1246
|
+
};
|
|
1247
|
+
});
|
|
1248
|
+
var parentDefinitionPin = Effect.fn("Client.parentDefinitionPin")(function* (executionRepository, executionId) {
|
|
1249
|
+
const record = yield* executionRepository.get(executionId).pipe(Effect.mapError(toClientError));
|
|
1250
|
+
if (record === undefined) {
|
|
1251
|
+
return yield* new ClientError({ message: `Execution not found: ${executionId}` });
|
|
1252
|
+
}
|
|
1253
|
+
if (record.agentId === undefined || record.agentRevision === undefined || record.agentSnapshot === undefined) {
|
|
1254
|
+
return yield* new ClientError({ message: `Parent execution is not pinned to an agent: ${executionId}` });
|
|
1255
|
+
}
|
|
1256
|
+
return {
|
|
1257
|
+
agentId: record.agentId,
|
|
1258
|
+
agentRevision: record.agentRevision,
|
|
1259
|
+
agentSnapshot: record.agentSnapshot,
|
|
1260
|
+
...record.agentToolInputSchemaDigests === undefined ? {} : { agentToolInputSchemaDigests: record.agentToolInputSchemaDigests }
|
|
1261
|
+
};
|
|
1262
|
+
});
|
|
1263
|
+
var childStartInput = (input, accepted, pin, definition, createdAt, parentWaitId) => ({
|
|
1264
|
+
execution_id: exports_ids_schema.ExecutionId.make(accepted.child_execution_id),
|
|
1265
|
+
root_address_id: input.address_id,
|
|
1266
|
+
input: input.input === undefined ? [] : [...input.input],
|
|
1267
|
+
event_sequence: 0,
|
|
1268
|
+
started_at: createdAt,
|
|
1269
|
+
completed_at: createdAt,
|
|
1270
|
+
agent_id: pin.agentId,
|
|
1271
|
+
agent_revision: pin.agentRevision,
|
|
1272
|
+
agent_snapshot: definition,
|
|
1273
|
+
...pin.agentToolInputSchemaDigests === undefined ? {} : { agent_tool_input_schema_digests: pin.agentToolInputSchemaDigests },
|
|
1274
|
+
metadata: {
|
|
1275
|
+
parent_execution_id: input.execution_id,
|
|
1276
|
+
child_execution_id: accepted.child_execution_id,
|
|
1277
|
+
...parentWaitId === undefined ? {} : { parent_wait_id: parentWaitId }
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
var layerFromRuntime = Layer.effect(Service, Effect.gen(function* () {
|
|
1281
|
+
const makeExecutionClient = yield* exports_execution_entity.client;
|
|
1282
|
+
const executions = yield* exports_execution_service.Service;
|
|
1283
|
+
const envelopes = yield* exports_envelope_service.Service;
|
|
1284
|
+
const waits = yield* exports_wait_service.Service;
|
|
1285
|
+
const eventLog = yield* exports_event_log_service.Service;
|
|
1286
|
+
const sessionStream = yield* exports_session_stream_service.Service;
|
|
1287
|
+
const executionWatch = yield* exports_execution_watch_service.Service;
|
|
1288
|
+
const executionState = yield* exports_execution_state_service.Service;
|
|
1289
|
+
const presence = yield* exports_presence_service.Service;
|
|
1290
|
+
const envelopeReady = yield* exports_envelope_repository.Service;
|
|
1291
|
+
const executionRepository = yield* exports_execution_repository.Service;
|
|
1292
|
+
const inboxRepository = yield* exports_inbox_repository.Service;
|
|
1293
|
+
const topicService = yield* exports_topic_service.Service;
|
|
1294
|
+
const toolCalls = yield* exports_tool_call_repository.Service;
|
|
1295
|
+
const childExecutions = yield* exports_child_execution_repository.Service;
|
|
1296
|
+
const sessionRepository = yield* exports_session_repository.Service;
|
|
1297
|
+
const steering = yield* exports_steering_repository.Service;
|
|
1298
|
+
const agentRegistry = yield* exports_agent_registry_service.Service;
|
|
1299
|
+
const entityRegistry = yield* exports_entity_registry_service.Service;
|
|
1300
|
+
const entities = yield* exports_entity_instance_service.Service;
|
|
1301
|
+
const addressBook = yield* exports_address_book_service.Service;
|
|
1302
|
+
const sharding = yield* Sharding.Sharding;
|
|
1303
|
+
const shardingConfig = yield* ShardingConfig.ShardingConfig;
|
|
1304
|
+
const clusterRegistry = yield* exports_cluster_registry_repository.Service;
|
|
1305
|
+
const schedules = yield* exports_schedule_repository.Service;
|
|
1306
|
+
const skillRegistry = yield* exports_skill_registry_service.Service;
|
|
1307
|
+
const toolTransitions = yield* exports_tool_transition_coordinator.Service;
|
|
1308
|
+
const schemaRegistry = yield* Effect.serviceOption(exports_schema_registry_service.Service);
|
|
1309
|
+
const coordinateToolTransition = (effect) => toolTransitions.coordinate(effect).pipe(Effect.mapError(toClientError));
|
|
1310
|
+
const coordinateChildSpawn = (effect) => toolTransitions.coordinate(effect).pipe(Effect.mapError(toClientError));
|
|
1311
|
+
const sendEnvelope = Effect.fn("Client.runtime.send")(function* (input) {
|
|
1312
|
+
const identity = input.idempotency_key ?? input.correlation_key ?? `${input.from}:${input.to}`;
|
|
1313
|
+
const executionId = exports_ids_schema.ExecutionId.make(input.correlation_key ?? `execution:send:${identity}`);
|
|
1314
|
+
const envelopeId = exports_ids_schema.EnvelopeId.make(`${executionId}:envelope:${identity}`);
|
|
1315
|
+
const createdAt = yield* Clock.currentTimeMillis;
|
|
1316
|
+
const maxSequence = yield* eventLog.maxSequence(executionId).pipe(Effect.mapError(toClientError));
|
|
1317
|
+
return yield* envelopes.send({
|
|
1318
|
+
envelopeId,
|
|
1319
|
+
executionId,
|
|
1320
|
+
input,
|
|
1321
|
+
eventSequence: maxSequence === undefined ? 0 : maxSequence + 1,
|
|
1322
|
+
createdAt
|
|
1323
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1324
|
+
});
|
|
1325
|
+
const waitOutcomeFrom = Effect.fn("Client.runtime.waitOutcome")(function* (wait) {
|
|
1326
|
+
const reply = wait.state === "resolved" ? yield* envelopeReady.getEnvelope(exports_ids_schema.EnvelopeId.make(`envelope:reply:${wait.id}`)).pipe(Effect.mapError(toClientError)) : undefined;
|
|
1327
|
+
return {
|
|
1328
|
+
wait_id: wait.id,
|
|
1329
|
+
state: wait.state,
|
|
1330
|
+
...reply === undefined ? {} : { content: reply.content },
|
|
1331
|
+
...Object.keys(wait.metadata).length === 0 ? {} : { metadata: wait.metadata }
|
|
1332
|
+
};
|
|
1333
|
+
});
|
|
1334
|
+
const awaitWaitOperation = Effect.fn("Client.runtime.awaitWait")(function* (input) {
|
|
1335
|
+
const current = yield* envelopeReady.getWait(input.wait_id).pipe(Effect.mapError(toClientError));
|
|
1336
|
+
if (current === undefined) {
|
|
1337
|
+
return yield* new ClientError({ message: `wait ${input.wait_id} not found` });
|
|
1338
|
+
}
|
|
1339
|
+
if (current.state !== "open")
|
|
1340
|
+
return yield* waitOutcomeFrom(current);
|
|
1341
|
+
yield* eventLog.stream({ executionId: input.execution_id }).pipe(Stream.filter((event) => (event.type === "wait.woken" || event.type === "wait.timed_out" || event.type === "wait.cancelled") && event.data?.wait_id === input.wait_id), Stream.take(1), Stream.runDrain, Effect.mapError(toClientError));
|
|
1342
|
+
const terminal = yield* envelopeReady.getWait(input.wait_id).pipe(Effect.mapError(toClientError));
|
|
1343
|
+
if (terminal === undefined || terminal.state === "open") {
|
|
1344
|
+
return yield* new ClientError({ message: `wait ${input.wait_id} did not reach a terminal state` });
|
|
1345
|
+
}
|
|
1346
|
+
return yield* waitOutcomeFrom(terminal);
|
|
1347
|
+
});
|
|
1348
|
+
return Service.of({
|
|
1349
|
+
registerEntityKind: (input) => entityRegistry.registerKind(input).pipe(Effect.mapError(toClientError)),
|
|
1350
|
+
getOrCreateEntity: (input) => entities.getOrCreate({
|
|
1351
|
+
kind: input.kind,
|
|
1352
|
+
key: input.key,
|
|
1353
|
+
createdAt: input.created_at,
|
|
1354
|
+
...input.input === undefined ? {} : { input: input.input },
|
|
1355
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
1356
|
+
}).pipe(Effect.mapError(toClientError)),
|
|
1357
|
+
getEntity: (input) => entities.get(input).pipe(Effect.mapError(toClientError)),
|
|
1358
|
+
destroyEntity: (input) => entities.destroy({
|
|
1359
|
+
kind: input.kind,
|
|
1360
|
+
key: input.key,
|
|
1361
|
+
destroyedAt: input.destroyed_at,
|
|
1362
|
+
...input.reason === undefined ? {} : { reason: input.reason }
|
|
1363
|
+
}).pipe(Effect.mapError(toClientError)),
|
|
1364
|
+
listEntities: (input) => entities.list({
|
|
1365
|
+
...input.kind === undefined ? {} : { kind: input.kind },
|
|
1366
|
+
...input.after_kind === undefined ? {} : { afterKind: input.after_kind },
|
|
1367
|
+
...input.after_key === undefined ? {} : { afterKey: input.after_key },
|
|
1368
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1369
|
+
}).pipe(Effect.mapError(toClientError)),
|
|
1370
|
+
registerAgent: Effect.fn("Client.runtime.registerAgent")(function* (input) {
|
|
1371
|
+
const payload = yield* registerAgentPayload(input);
|
|
1372
|
+
const registered = yield* agentRegistry.register(payload).pipe(Effect.mapError(toClientError));
|
|
1373
|
+
if (input.address !== undefined) {
|
|
1374
|
+
yield* addressBook.register(input.address, { kind: "local-agent", route_key: payload.id }).pipe(Effect.mapError(toClientError));
|
|
1375
|
+
}
|
|
1376
|
+
return registered;
|
|
1377
|
+
}),
|
|
1378
|
+
registerAgentDefinition: Effect.fn("Client.runtime.registerAgentDefinition")(function* (input) {
|
|
1379
|
+
return yield* agentRegistry.register(input).pipe(Effect.mapError(toClientError));
|
|
1380
|
+
}),
|
|
1381
|
+
getAgentDefinition: Effect.fn("Client.runtime.getAgentDefinition")(function* (id) {
|
|
1382
|
+
return yield* agentRegistry.get(id).pipe(Effect.mapError(toClientError));
|
|
1383
|
+
}),
|
|
1384
|
+
listAgentDefinitions: Effect.fn("Client.runtime.listAgentDefinitions")(function* () {
|
|
1385
|
+
return yield* agentRegistry.list().pipe(Effect.mapError(toClientError));
|
|
1386
|
+
}),
|
|
1387
|
+
listAgentDefinitionRevisions: Effect.fn("Client.runtime.listAgentDefinitionRevisions")(function* (id) {
|
|
1388
|
+
return yield* agentRegistry.listRevisions(id).pipe(Effect.mapError(toClientError));
|
|
1389
|
+
}),
|
|
1390
|
+
getSkillDefinition: Effect.fn("Client.runtime.getSkillDefinition")(function* (id) {
|
|
1391
|
+
return yield* skillRegistry.get(id).pipe(Effect.mapError(toClientError));
|
|
1392
|
+
}),
|
|
1393
|
+
listSkillDefinitions: Effect.fn("Client.runtime.listSkillDefinitions")(function* () {
|
|
1394
|
+
return yield* skillRegistry.list().pipe(Effect.mapError(toClientError));
|
|
1395
|
+
}),
|
|
1396
|
+
listSkillDefinitionRevisions: Effect.fn("Client.runtime.listSkillDefinitionRevisions")(function* (id) {
|
|
1397
|
+
return yield* skillRegistry.listRevisions(id).pipe(Effect.mapError(toClientError));
|
|
1398
|
+
}),
|
|
1399
|
+
registerAddressBookRoute: Effect.fn("Client.runtime.registerAddressBookRoute")(function* (input) {
|
|
1400
|
+
yield* rejectReserved(input.address_id, "address:entity:");
|
|
1401
|
+
return yield* addressBook.register(input.address_id, input.route).pipe(Effect.mapError(toClientError));
|
|
1402
|
+
}),
|
|
1403
|
+
getAddressBookRoute: Effect.fn("Client.runtime.getAddressBookRoute")(function* (id) {
|
|
1404
|
+
return yield* addressBook.get(id).pipe(Effect.mapError(toClientError));
|
|
1405
|
+
}),
|
|
1406
|
+
listAddressBookRoutes: Effect.fn("Client.runtime.listAddressBookRoutes")(function* () {
|
|
1407
|
+
return yield* addressBook.list().pipe(Effect.mapError(toClientError));
|
|
1408
|
+
}),
|
|
1409
|
+
startExecution: Effect.fn("Client.runtime.startExecution")(function* (input) {
|
|
1410
|
+
yield* rejectReserved(input.execution_id, "execution:entity:");
|
|
1411
|
+
if (input.session_id !== undefined)
|
|
1412
|
+
yield* rejectReserved(input.session_id, "session:entity:");
|
|
1413
|
+
const client = makeExecutionClient(input.execution_id);
|
|
1414
|
+
return yield* client.start(input).pipe(Effect.mapError(toClientError));
|
|
1415
|
+
}),
|
|
1416
|
+
startExecutionByAddress: Effect.fn("Client.runtime.startExecutionByAddress")(function* (input) {
|
|
1417
|
+
yield* rejectReserved(input.idempotency_key, "entity:");
|
|
1418
|
+
if (input.execution_id !== undefined)
|
|
1419
|
+
yield* rejectReserved(input.execution_id, "execution:entity:");
|
|
1420
|
+
if (input.session_id !== undefined)
|
|
1421
|
+
yield* rejectReserved(input.session_id, "session:entity:");
|
|
1422
|
+
const payload = startExecutionByAddressPayload(input);
|
|
1423
|
+
const client = makeExecutionClient(payload.execution_id);
|
|
1424
|
+
return yield* client.start(payload).pipe(Effect.mapError(toClientError));
|
|
1425
|
+
}),
|
|
1426
|
+
startExecutionByAgentDefinition: Effect.fn("Client.runtime.startExecutionByAgentDefinition")(function* (input) {
|
|
1427
|
+
yield* rejectReserved(input.idempotency_key, "entity:");
|
|
1428
|
+
if (input.execution_id !== undefined)
|
|
1429
|
+
yield* rejectReserved(input.execution_id, "execution:entity:");
|
|
1430
|
+
if (input.session_id !== undefined)
|
|
1431
|
+
yield* rejectReserved(input.session_id, "session:entity:");
|
|
1432
|
+
const definition = yield* agentRegistry.get(input.agent_id).pipe(Effect.mapError(toClientError));
|
|
1433
|
+
if (definition === undefined)
|
|
1434
|
+
return yield* Effect.fail(agentDefinitionNotFound(input.agent_id));
|
|
1435
|
+
const payload = startExecutionByAgentDefinitionPayload(input, definition);
|
|
1436
|
+
const client = makeExecutionClient(payload.execution_id);
|
|
1437
|
+
return yield* client.start(payload).pipe(Effect.mapError(toClientError));
|
|
1438
|
+
}),
|
|
1439
|
+
cancelExecution: Effect.fn("Client.runtime.cancelExecution")(function* (input) {
|
|
1440
|
+
const client = makeExecutionClient(input.execution_id);
|
|
1441
|
+
return yield* client.cancel({
|
|
1442
|
+
execution_id: input.execution_id,
|
|
1443
|
+
cancelled_at: input.cancelled_at,
|
|
1444
|
+
...input.reason === undefined ? {} : { reason: input.reason }
|
|
1445
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1446
|
+
}),
|
|
1447
|
+
steer: Effect.fn("Client.runtime.steer")(function* (input) {
|
|
1448
|
+
const execution = yield* executionRepository.get(input.execution_id).pipe(Effect.mapError(toClientError));
|
|
1449
|
+
if (execution === undefined) {
|
|
1450
|
+
return yield* new ClientError({ message: `Execution not found: ${input.execution_id}` });
|
|
1451
|
+
}
|
|
1452
|
+
if (execution.status !== "running") {
|
|
1453
|
+
return yield* new ClientError({ message: `Execution is not running: ${input.execution_id}` });
|
|
1454
|
+
}
|
|
1455
|
+
const record = yield* steering.appendForRunning({
|
|
1456
|
+
executionId: input.execution_id,
|
|
1457
|
+
kind: input.kind,
|
|
1458
|
+
content: input.content,
|
|
1459
|
+
createdAt: input.created_at
|
|
1460
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1461
|
+
return { execution_id: record.executionId, kind: record.kind, sequence: record.sequence };
|
|
1462
|
+
}),
|
|
1463
|
+
getExecution: Effect.fn("Client.runtime.getExecution")(function* (id) {
|
|
1464
|
+
const record = yield* executionRepository.get(id).pipe(Effect.mapError(toClientError));
|
|
1465
|
+
return record === undefined ? undefined : toExecutionView(record);
|
|
1466
|
+
}),
|
|
1467
|
+
inspectExecution: Effect.fn("Client.runtime.inspectExecution")(function* (executionId) {
|
|
1468
|
+
const execution = yield* executionRepository.get(executionId).pipe(Effect.mapError(toClientError));
|
|
1469
|
+
if (execution === undefined)
|
|
1470
|
+
return yield* new ExecutionNotFound({ execution_id: executionId });
|
|
1471
|
+
const openWaits = yield* envelopeReady.listAllWaits({ executionId, state: "open" }).pipe(Effect.mapError(toClientError));
|
|
1472
|
+
const calls = yield* toolCalls.listCalls(executionId).pipe(Effect.mapError(toClientError));
|
|
1473
|
+
const pendingChunks = yield* Effect.forEach(calls, (call) => toolCalls.getResult(call.call.id).pipe(Effect.mapError(toClientError), Effect.map((result) => result === undefined ? [toToolCallSummary(call)] : [])));
|
|
1474
|
+
const children = yield* childExecutions.listByExecution(executionId).pipe(Effect.mapError(toClientError));
|
|
1475
|
+
const maxSequence = yield* eventLog.maxSequence(executionId).pipe(Effect.mapError(toClientError));
|
|
1476
|
+
const lastEvent = maxSequence === undefined ? undefined : yield* eventLog.findBySequence({ executionId, sequence: maxSequence }).pipe(Effect.mapError(toClientError), Effect.map(Option.getOrUndefined));
|
|
1477
|
+
return {
|
|
1478
|
+
execution_id: execution.id,
|
|
1479
|
+
status: execution.status,
|
|
1480
|
+
waiting_on: openWaits.map(toWaitView),
|
|
1481
|
+
pending_tool_calls: pendingChunks.flat(),
|
|
1482
|
+
child_runs: children.map(toChildRunSummary),
|
|
1483
|
+
...lastEvent === undefined ? {} : { last_event_cursor: lastEvent.cursor }
|
|
1484
|
+
};
|
|
1485
|
+
}),
|
|
1486
|
+
listWaits: Effect.fn("Client.runtime.listWaits")(function* (input) {
|
|
1487
|
+
const records = yield* envelopeReady.listWaits({
|
|
1488
|
+
...input.state === undefined ? {} : { state: input.state },
|
|
1489
|
+
...input.execution_id === undefined ? {} : { executionId: input.execution_id },
|
|
1490
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1491
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1492
|
+
return records.map(toWaitView);
|
|
1493
|
+
}),
|
|
1494
|
+
listExecutions: Effect.fn("Client.runtime.listExecutions")(function* (input) {
|
|
1495
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema3.decodeEffect(ExecutionCursorFromString)(input.cursor).pipe(Effect.mapError(toClientError));
|
|
1496
|
+
const result = yield* executionRepository.list({
|
|
1497
|
+
...input.root_address_id === undefined ? {} : { rootAddressId: input.root_address_id },
|
|
1498
|
+
...input.status === undefined ? {} : { status: input.status },
|
|
1499
|
+
...input.limit === undefined ? {} : { limit: input.limit },
|
|
1500
|
+
...cursor === undefined ? {} : { cursor }
|
|
1501
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1502
|
+
const nextCursor = result.nextCursor === undefined ? undefined : yield* Schema3.encodeEffect(ExecutionCursorFromString)(result.nextCursor).pipe(Effect.mapError(toClientError));
|
|
1503
|
+
return {
|
|
1504
|
+
records: result.records.map(toConversationSummary),
|
|
1505
|
+
...nextCursor === undefined ? {} : { next_cursor: nextCursor }
|
|
1506
|
+
};
|
|
1507
|
+
}),
|
|
1508
|
+
subscribeTopic: Effect.fn("Client.runtime.subscribeTopic")(function* (input) {
|
|
1509
|
+
return yield* topicService.subscribe({
|
|
1510
|
+
topicAddressId: input.topic_address_id,
|
|
1511
|
+
subscriberExecutionId: input.subscriber_execution_id,
|
|
1512
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
1513
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1514
|
+
}),
|
|
1515
|
+
unsubscribeTopic: Effect.fn("Client.runtime.unsubscribeTopic")(function* (input) {
|
|
1516
|
+
return yield* topicService.unsubscribe({
|
|
1517
|
+
topicAddressId: input.topic_address_id,
|
|
1518
|
+
subscriberExecutionId: input.subscriber_execution_id
|
|
1519
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1520
|
+
}),
|
|
1521
|
+
publishTopic: Effect.fn("Client.runtime.publishTopic")(function* (input) {
|
|
1522
|
+
return yield* topicService.publish({
|
|
1523
|
+
topicAddressId: input.topic_address_id,
|
|
1524
|
+
from: input.from,
|
|
1525
|
+
content: input.content,
|
|
1526
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata },
|
|
1527
|
+
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key }
|
|
1528
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1529
|
+
}),
|
|
1530
|
+
listTopicSubscriptions: Effect.fn("Client.runtime.listTopicSubscriptions")(function* (input) {
|
|
1531
|
+
return yield* topicService.list({
|
|
1532
|
+
...input.topic_address_id === undefined ? {} : { topicAddressId: input.topic_address_id },
|
|
1533
|
+
...input.subscriber_execution_id === undefined ? {} : { subscriberExecutionId: input.subscriber_execution_id }
|
|
1534
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1535
|
+
}),
|
|
1536
|
+
listInboxMessages: Effect.fn("Client.runtime.listInboxMessages")(function* (input) {
|
|
1537
|
+
return yield* inboxRepository.list({
|
|
1538
|
+
executionId: input.execution_id,
|
|
1539
|
+
...input.include_consumed === undefined ? {} : { includeConsumed: input.include_consumed },
|
|
1540
|
+
...input.after_sequence === undefined ? {} : { afterSequence: input.after_sequence },
|
|
1541
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1542
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1543
|
+
}),
|
|
1544
|
+
listSessions: Effect.fn("Client.runtime.listSessions")(function* (input) {
|
|
1545
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema3.decodeEffect(SessionCursorFromString)(input.cursor).pipe(Effect.mapError(toClientError));
|
|
1546
|
+
const result = yield* sessionRepository.list({
|
|
1547
|
+
...input.root_address_id === undefined ? {} : { rootAddressId: input.root_address_id },
|
|
1548
|
+
...input.limit === undefined ? {} : { limit: input.limit },
|
|
1549
|
+
...cursor === undefined ? {} : { cursor }
|
|
1550
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1551
|
+
const nextCursor = result.nextCursor === undefined ? undefined : yield* Schema3.encodeEffect(SessionCursorFromString)(result.nextCursor).pipe(Effect.mapError(toClientError));
|
|
1552
|
+
return {
|
|
1553
|
+
records: result.records.map(toSessionSummary),
|
|
1554
|
+
...nextCursor === undefined ? {} : { next_cursor: nextCursor }
|
|
1555
|
+
};
|
|
1556
|
+
}),
|
|
1557
|
+
getSession: Effect.fn("Client.runtime.getSession")(function* (input) {
|
|
1558
|
+
const session = yield* sessionRepository.get(input.session_id).pipe(Effect.mapError(toClientError));
|
|
1559
|
+
if (session === undefined)
|
|
1560
|
+
return yield* new ClientError({ message: `Session not found: ${input.session_id}` });
|
|
1561
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema3.decodeEffect(ExecutionCursorFromString)(input.cursor).pipe(Effect.mapError(toClientError));
|
|
1562
|
+
const result = yield* executionRepository.list({
|
|
1563
|
+
sessionId: input.session_id,
|
|
1564
|
+
...input.limit === undefined ? {} : { limit: input.limit },
|
|
1565
|
+
...cursor === undefined ? {} : { cursor }
|
|
1566
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1567
|
+
const nextCursor = result.nextCursor === undefined ? undefined : yield* Schema3.encodeEffect(ExecutionCursorFromString)(result.nextCursor).pipe(Effect.mapError(toClientError));
|
|
1568
|
+
return {
|
|
1569
|
+
session: toSessionSummary(session),
|
|
1570
|
+
executions: result.records.map(toConversationSummary),
|
|
1571
|
+
...nextCursor === undefined ? {} : { next_cursor: nextCursor }
|
|
1572
|
+
};
|
|
1573
|
+
}),
|
|
1574
|
+
replayExecution: Effect.fn("Client.runtime.replayExecution")(function* (input) {
|
|
1575
|
+
const events = yield* eventLog.replay({
|
|
1576
|
+
executionId: input.execution_id,
|
|
1577
|
+
...input.after_cursor === undefined ? {} : { afterCursor: input.after_cursor },
|
|
1578
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1579
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1580
|
+
return { events };
|
|
1581
|
+
}),
|
|
1582
|
+
listRunners: Effect.fn("Client.runtime.listRunners")(function* () {
|
|
1583
|
+
const runners = yield* clusterRegistry.listRunners().pipe(Effect.mapError(toClientError));
|
|
1584
|
+
return {
|
|
1585
|
+
runners: runners.map((runner) => ({
|
|
1586
|
+
address: runner.address,
|
|
1587
|
+
healthy: runner.healthy,
|
|
1588
|
+
last_heartbeat: runner.lastHeartbeat,
|
|
1589
|
+
owned_shards: runner.ownedShards
|
|
1590
|
+
})),
|
|
1591
|
+
total_shards: shardingConfig.shardsPerGroup * shardingConfig.availableShardGroups.length
|
|
1592
|
+
};
|
|
1593
|
+
}),
|
|
1594
|
+
routeExecution: Effect.fn("Client.runtime.routeExecution")(function* (executionId) {
|
|
1595
|
+
const shard = ShardId.toString(sharding.getShardId(EntityId.make(executionId), "execution"));
|
|
1596
|
+
const owner = yield* clusterRegistry.lockOwner(shard).pipe(Effect.mapError(toClientError));
|
|
1597
|
+
const runnerAddress = owner ?? null;
|
|
1598
|
+
const self = Option.map(shardingConfig.runnerAddress, (address) => `${address.host}:${address.port}`);
|
|
1599
|
+
return {
|
|
1600
|
+
execution_id: executionId,
|
|
1601
|
+
shard,
|
|
1602
|
+
runner_address: runnerAddress,
|
|
1603
|
+
owned: runnerAddress !== null && Option.getOrNull(self) === runnerAddress
|
|
1604
|
+
};
|
|
1605
|
+
}),
|
|
1606
|
+
send: sendEnvelope,
|
|
1607
|
+
askEntity: Effect.fn("Client.runtime.askEntity")(function* (input) {
|
|
1608
|
+
const instance = yield* entities.get({ kind: input.kind, key: input.key }).pipe(Effect.mapError(toClientError));
|
|
1609
|
+
if (instance === undefined || instance.status === "destroyed") {
|
|
1610
|
+
return yield* new EntityNotFound({ kind: input.kind, key: input.key });
|
|
1611
|
+
}
|
|
1612
|
+
const encoded = yield* Schema3.encodeUnknownEffect(input.command.input)(input.input).pipe(Effect.mapError(toClientError));
|
|
1613
|
+
const inputRef = inputSchemaRef(input.command.name);
|
|
1614
|
+
const outputRef = outputSchemaRef(input.command.name);
|
|
1615
|
+
if (Option.isSome(schemaRegistry)) {
|
|
1616
|
+
yield* schemaRegistry.value.register({ ref: inputRef, schema: input.command.input });
|
|
1617
|
+
yield* schemaRegistry.value.register({ ref: outputRef, schema: input.command.output });
|
|
1618
|
+
}
|
|
1619
|
+
const correlation = `command:${input.command.name}:${globalThis.crypto.randomUUID()}`;
|
|
1620
|
+
const accepted = yield* sendEnvelope({
|
|
1621
|
+
from: input.from,
|
|
1622
|
+
to: instance.address_id,
|
|
1623
|
+
content: [{ type: "structured", value: encoded, schema_ref: inputRef }],
|
|
1624
|
+
idempotency_key: correlation,
|
|
1625
|
+
wait: {
|
|
1626
|
+
mode: "reply",
|
|
1627
|
+
correlation_key: correlation,
|
|
1628
|
+
...input.timeout === undefined ? {} : { timeout: input.timeout }
|
|
1629
|
+
},
|
|
1630
|
+
metadata: {
|
|
1631
|
+
...input.metadata,
|
|
1632
|
+
command: input.command.name,
|
|
1633
|
+
command_input_schema_ref: inputRef,
|
|
1634
|
+
command_output_schema_ref: outputRef
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
if (accepted.wait_id === undefined) {
|
|
1638
|
+
return yield* new ClientError({ message: "askEntity send did not create a reply wait" });
|
|
1639
|
+
}
|
|
1640
|
+
const outcome = yield* awaitWaitOperation({ wait_id: accepted.wait_id, execution_id: accepted.execution_id });
|
|
1641
|
+
if (outcome.state === "timed_out") {
|
|
1642
|
+
return yield* new CommandTimedOut({
|
|
1643
|
+
command: input.command.name,
|
|
1644
|
+
wait_id: outcome.wait_id,
|
|
1645
|
+
timeout: input.timeout ?? "unspecified"
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
if (outcome.state === "cancelled") {
|
|
1649
|
+
return yield* new ClientError({ message: `reply wait ${outcome.wait_id} was cancelled` });
|
|
1650
|
+
}
|
|
1651
|
+
const replyValue = replyValueFrom(outcome.content);
|
|
1652
|
+
if (replyValue._tag === "None") {
|
|
1653
|
+
return yield* new CommandReplyInvalid({
|
|
1654
|
+
command: input.command.name,
|
|
1655
|
+
wait_id: outcome.wait_id,
|
|
1656
|
+
message: "reply carried no decodable content"
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
return yield* Schema3.decodeUnknownEffect(input.command.output)(replyValue.value).pipe(Effect.mapError((issue) => new CommandReplyInvalid({
|
|
1660
|
+
command: input.command.name,
|
|
1661
|
+
wait_id: outcome.wait_id,
|
|
1662
|
+
message: errorMessage(issue)
|
|
1663
|
+
})));
|
|
1664
|
+
}),
|
|
1665
|
+
awaitWait: awaitWaitOperation,
|
|
1666
|
+
streamExecution: (input) => executions.stream({
|
|
1667
|
+
executionId: input.execution_id,
|
|
1668
|
+
...input.after_cursor === undefined ? {} : { afterCursor: input.after_cursor },
|
|
1669
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1670
|
+
}).pipe(Stream.mapError(toStreamError)),
|
|
1671
|
+
streamSession: (input) => sessionStream.stream({
|
|
1672
|
+
sessionId: input.session_id,
|
|
1673
|
+
...input.resume === undefined ? {} : {
|
|
1674
|
+
resume: input.resume.map((item) => ({
|
|
1675
|
+
executionId: item.execution_id,
|
|
1676
|
+
...item.after_cursor === undefined ? {} : { afterCursor: item.after_cursor }
|
|
1677
|
+
}))
|
|
1678
|
+
}
|
|
1679
|
+
}).pipe(Stream.map((item) => item._tag === "execution_joined" ? { _tag: "execution_joined", execution: toConversationSummary(item.record) } : item), Stream.mapError(toStreamError)),
|
|
1680
|
+
watchExecutions: (input) => executionWatch.watch({
|
|
1681
|
+
...input.root_address_id === undefined ? {} : { rootAddressId: input.root_address_id },
|
|
1682
|
+
...input.session_id === undefined ? {} : { sessionId: input.session_id },
|
|
1683
|
+
...input.status === undefined ? {} : { status: input.status },
|
|
1684
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1685
|
+
}).pipe(Stream.mapEffect((change) => change._tag === "snapshot" ? change.nextCursor === undefined ? Effect.succeed({
|
|
1686
|
+
_tag: "snapshot",
|
|
1687
|
+
records: change.records.map(toConversationSummary)
|
|
1688
|
+
}) : encodeExecutionCursor(change.nextCursor).pipe(Effect.map((next_cursor) => ({
|
|
1689
|
+
_tag: "snapshot",
|
|
1690
|
+
records: change.records.map(toConversationSummary),
|
|
1691
|
+
next_cursor
|
|
1692
|
+
}))) : Effect.succeed({
|
|
1693
|
+
_tag: "upsert",
|
|
1694
|
+
record: toConversationSummary(change.record)
|
|
1695
|
+
})), Stream.mapError(toClientError)),
|
|
1696
|
+
getEntityState: Effect.fn("Client.runtime.getEntityState")((input) => executionState.getRecord(input.execution_id, input.key).pipe(Effect.mapError(toClientError))),
|
|
1697
|
+
putEntityState: Effect.fn("Client.runtime.putEntityState")((input) => executionState.put({
|
|
1698
|
+
executionId: input.execution_id,
|
|
1699
|
+
key: exports_execution_state_service.key(input.key, exports_shared_schema.JsonValue),
|
|
1700
|
+
value: input.value,
|
|
1701
|
+
...input.expected_version === undefined ? {} : { expectedVersion: input.expected_version },
|
|
1702
|
+
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key },
|
|
1703
|
+
updatedAt: input.updated_at
|
|
1704
|
+
}).pipe(Effect.mapError((error) => error instanceof exports_execution_state_service.StateVersionConflict ? error : toClientError(error)))),
|
|
1705
|
+
deleteEntityState: Effect.fn("Client.runtime.deleteEntityState")((input) => executionState.remove({
|
|
1706
|
+
executionId: input.execution_id,
|
|
1707
|
+
key: input.key,
|
|
1708
|
+
...input.expected_version === undefined ? {} : { expectedVersion: input.expected_version },
|
|
1709
|
+
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key },
|
|
1710
|
+
removedAt: input.removed_at
|
|
1711
|
+
}).pipe(Effect.mapError((error) => error instanceof exports_execution_state_service.StateVersionConflict ? error : toClientError(error)))),
|
|
1712
|
+
listEntityState: Effect.fn("Client.runtime.listEntityState")((input) => executionState.list({
|
|
1713
|
+
executionId: input.execution_id,
|
|
1714
|
+
...input.prefix === undefined ? {} : { prefix: input.prefix },
|
|
1715
|
+
...input.after_key === undefined ? {} : { afterKey: input.after_key },
|
|
1716
|
+
...input.limit === undefined ? {} : { limit: input.limit }
|
|
1717
|
+
}).pipe(Effect.mapError(toClientError))),
|
|
1718
|
+
getPresence: (scope) => presence.list(scope).pipe(Effect.mapError(toClientError)),
|
|
1719
|
+
watchPresence: (scope) => presence.watch(scope).pipe(Stream.mapError(toClientError)),
|
|
1720
|
+
wake: Effect.fn("Client.runtime.wake")(function* (input) {
|
|
1721
|
+
return yield* wakeRuntime(waits, eventLog, executionRepository, makeExecutionClient, input);
|
|
1722
|
+
}),
|
|
1723
|
+
listPendingApprovals: Effect.fn("Client.runtime.listPendingApprovals")(function* (input) {
|
|
1724
|
+
const records = yield* envelopeReady.listWaits({ executionId: input.execution_id, state: "open" }).pipe(Effect.mapError(toClientError));
|
|
1725
|
+
return { approvals: records.filter(isToolApprovalWait).map(toPendingToolApproval) };
|
|
1726
|
+
}),
|
|
1727
|
+
resolveToolApproval: Effect.fn("Client.runtime.resolveToolApproval")(function* (input) {
|
|
1728
|
+
return yield* wakeRuntime(waits, eventLog, executionRepository, makeExecutionClient, {
|
|
1729
|
+
wait_id: input.wait_id,
|
|
1730
|
+
state: "resolved",
|
|
1731
|
+
signaled_at: input.resolved_at,
|
|
1732
|
+
metadata: {
|
|
1733
|
+
approved: input.approved,
|
|
1734
|
+
...input.comment === undefined ? {} : { comment: input.comment }
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
}),
|
|
1738
|
+
resolvePermission: Effect.fn("Client.runtime.resolvePermission")(function* (input) {
|
|
1739
|
+
return yield* wakeRuntime(waits, eventLog, executionRepository, makeExecutionClient, {
|
|
1740
|
+
wait_id: input.wait_id,
|
|
1741
|
+
state: "resolved",
|
|
1742
|
+
signaled_at: input.resolved_at,
|
|
1743
|
+
metadata: {
|
|
1744
|
+
answer: input.answer,
|
|
1745
|
+
...input.reason === undefined ? {} : { reason: input.reason }
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
}),
|
|
1749
|
+
listPendingToolCalls: Effect.fn("Client.runtime.listPendingToolCalls")(function* (input) {
|
|
1750
|
+
const openWaits = yield* envelopeReady.listAllWaits({
|
|
1751
|
+
state: "open",
|
|
1752
|
+
...input.execution_id === undefined ? {} : { executionId: input.execution_id }
|
|
1753
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1754
|
+
const records = yield* Effect.forEach(openWaits.filter((wait) => wait.metadata.kind === "tool-placement"), (wait) => toolCalls.getCall(exports_ids_schema.ToolCallId.make(String(wait.metadata.tool_call_id ?? ""))).pipe(Effect.mapError(toClientError), Effect.map((call) => call?.placement.kind === "client" && call.state === "waiting" ? toPendingToolCall(call) : undefined)));
|
|
1755
|
+
const sorted = records.filter((record) => record !== undefined).toSorted((left, right) => left.requested_at - right.requested_at || left.call.id.localeCompare(right.call.id));
|
|
1756
|
+
return { tool_calls: input.limit === undefined ? sorted : sorted.slice(0, input.limit) };
|
|
1757
|
+
}),
|
|
1758
|
+
fulfillToolCall: Effect.fn("Client.runtime.fulfillToolCall")(function* (input) {
|
|
1759
|
+
const coordinated = yield* coordinateToolTransition(Effect.gen(function* () {
|
|
1760
|
+
const call = yield* toolCalls.getCall(input.tool_call_id).pipe(Effect.mapError(toClientError));
|
|
1761
|
+
if (call === undefined || call.executionId !== input.execution_id || call.placement.kind !== "client") {
|
|
1762
|
+
return yield* new ClientError({ message: `Client tool call not found: ${input.tool_call_id}` });
|
|
1763
|
+
}
|
|
1764
|
+
const wait = yield* resolveToolOutcomeWait(waits, eventLog, call, input.outcome, input.fulfilled_at);
|
|
1765
|
+
const accepted = yield* toolCalls.acceptClientOutcome({
|
|
1766
|
+
executionId: input.execution_id,
|
|
1767
|
+
callId: input.tool_call_id,
|
|
1768
|
+
outcome: input.outcome,
|
|
1769
|
+
submittedAt: input.fulfilled_at
|
|
1770
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1771
|
+
return { wait, accepted };
|
|
1772
|
+
}));
|
|
1773
|
+
yield* signalToolOutcome(executionRepository, makeExecutionClient, coordinated.wait, input.fulfilled_at);
|
|
1774
|
+
return toToolOutcomeAccepted(coordinated.accepted);
|
|
1775
|
+
}),
|
|
1776
|
+
claimToolWork: Effect.fn("Client.runtime.claimToolWork")(function* (input) {
|
|
1777
|
+
const lease = yield* coordinateToolTransition(toolCalls.claimRemote({
|
|
1778
|
+
queue: input.queue,
|
|
1779
|
+
workerId: input.worker_id,
|
|
1780
|
+
now: input.now,
|
|
1781
|
+
claimExpiresAt: input.claim_expires_at
|
|
1782
|
+
}).pipe(Effect.mapError(toClientError)));
|
|
1783
|
+
return lease === undefined ? null : toToolWorkLease(lease);
|
|
1784
|
+
}),
|
|
1785
|
+
completeToolWork: Effect.fn("Client.runtime.completeToolWork")(function* (input) {
|
|
1786
|
+
const coordinated = yield* coordinateToolTransition(Effect.gen(function* () {
|
|
1787
|
+
const call = yield* toolCalls.getCall(input.tool_call_id).pipe(Effect.mapError(toClientError));
|
|
1788
|
+
const active = call !== undefined && call.placement.kind === "remote" && call.state === "running" && call.activeAttemptId === input.attempt_id && call.claimOwner === input.worker_id && call.claimExpiresAt !== undefined && call.claimExpiresAt > input.completed_at;
|
|
1789
|
+
const acceptedRetry = call !== undefined && call.placement.kind === "remote" && call.state === "submitted" && call.activeAttemptId === input.attempt_id && call.externalOutcome !== undefined;
|
|
1790
|
+
if (call === undefined || !active && !acceptedRetry) {
|
|
1791
|
+
return yield* new ClientError({ message: `Remote tool claim is not active: ${input.tool_call_id}` });
|
|
1792
|
+
}
|
|
1793
|
+
const wait = yield* resolveToolOutcomeWait(waits, eventLog, call, input.outcome, input.completed_at);
|
|
1794
|
+
const accepted = yield* toolCalls.acceptRemoteOutcome({
|
|
1795
|
+
callId: input.tool_call_id,
|
|
1796
|
+
attemptId: input.attempt_id,
|
|
1797
|
+
workerId: input.worker_id,
|
|
1798
|
+
outcome: input.outcome,
|
|
1799
|
+
submittedAt: input.completed_at
|
|
1800
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1801
|
+
return { wait, accepted };
|
|
1802
|
+
}));
|
|
1803
|
+
yield* signalToolOutcome(executionRepository, makeExecutionClient, coordinated.wait, input.completed_at);
|
|
1804
|
+
return toToolOutcomeAccepted(coordinated.accepted);
|
|
1805
|
+
}),
|
|
1806
|
+
releaseToolWork: Effect.fn("Client.runtime.releaseToolWork")(function* (input) {
|
|
1807
|
+
const call = yield* coordinateToolTransition(toolCalls.releaseRemote({
|
|
1808
|
+
callId: input.tool_call_id,
|
|
1809
|
+
attemptId: input.attempt_id,
|
|
1810
|
+
workerId: input.worker_id,
|
|
1811
|
+
releasedAt: input.released_at,
|
|
1812
|
+
nextAvailableAt: input.next_available_at,
|
|
1813
|
+
...input.error === undefined ? {} : { error: input.error }
|
|
1814
|
+
}).pipe(Effect.mapError(toClientError)));
|
|
1815
|
+
return {
|
|
1816
|
+
tool_call_id: call.call.id,
|
|
1817
|
+
state: "waiting",
|
|
1818
|
+
next_available_at: call.availableAt
|
|
1819
|
+
};
|
|
1820
|
+
}),
|
|
1821
|
+
listToolAttempts: Effect.fn("Client.runtime.listToolAttempts")(function* (input) {
|
|
1822
|
+
const attempts = yield* toolCalls.listAttempts(input.tool_call_id).pipe(Effect.mapError(toClientError));
|
|
1823
|
+
return { attempts: attempts.map(toToolAttempt) };
|
|
1824
|
+
}),
|
|
1825
|
+
submitInboundEnvelope: Effect.fn("Client.runtime.submitInboundEnvelope")(function* (input) {
|
|
1826
|
+
const envelope = yield* executions.send(input.envelope).pipe(Effect.mapError(toClientError));
|
|
1827
|
+
const wakeResult = yield* wakeRuntime(waits, eventLog, executionRepository, makeExecutionClient, input.wake);
|
|
1828
|
+
return { envelope, wake: wakeResult };
|
|
1829
|
+
}),
|
|
1830
|
+
spawnChildRun: Effect.fn("Client.runtime.spawnChildRun")(function* (input) {
|
|
1831
|
+
const pin = yield* parentDefinitionPin(executionRepository, input.execution_id);
|
|
1832
|
+
const createdAt = yield* Clock.currentTimeMillis;
|
|
1833
|
+
const internal = internalSpawnChildRunInput(input, pin, createdAt);
|
|
1834
|
+
const context = yield* exports_child_run_service.resolveForDispatch(internal).pipe(Effect.mapError((error) => new ClientError({ message: error._tag })));
|
|
1835
|
+
const definition = yield* exports_child_run_service.childDefinition(pin.agentSnapshot, context).pipe(Effect.mapError((error) => new ClientError({ message: error._tag })));
|
|
1836
|
+
const coordinated = yield* coordinateChildSpawn(Effect.gen(function* () {
|
|
1837
|
+
const existing = yield* reconcileExistingChildSpawn(childExecutions, waits, eventLog, input);
|
|
1838
|
+
if (existing !== undefined)
|
|
1839
|
+
return existing;
|
|
1840
|
+
const accepted = yield* executions.spawnChildRun(internal).pipe(Effect.mapError(toClientError));
|
|
1841
|
+
const parentWaitId = input.wait === true ? yield* createChildJoinWait(waits, eventLog, internal, accepted, createdAt) : undefined;
|
|
1842
|
+
return { accepted, createdAt, parentWaitId };
|
|
1843
|
+
})).pipe(Effect.catch((error) => error.message === "DuplicateChildExecution" ? coordinateChildSpawn(reconcileExistingChildSpawn(childExecutions, waits, eventLog, input).pipe(Effect.flatMap((existing) => existing === undefined ? Effect.fail(new ClientError({ message: `Child execution retry missing: ${input.execution_id}` })) : Effect.succeed(existing)))) : Effect.fail(error)));
|
|
1844
|
+
const startPayload = childStartInput(internal, coordinated.accepted, pin, definition, coordinated.createdAt, coordinated.parentWaitId);
|
|
1845
|
+
const client = makeExecutionClient(startPayload.execution_id);
|
|
1846
|
+
yield* client.dispatch(startPayload).pipe(Effect.mapError(toClientError));
|
|
1847
|
+
return coordinated.accepted;
|
|
1848
|
+
}),
|
|
1849
|
+
claimEnvelopeReady: Effect.fn("Client.runtime.claimEnvelopeReady")(function* (input) {
|
|
1850
|
+
return yield* envelopeReady.claimReady({
|
|
1851
|
+
routeType: input.route_type,
|
|
1852
|
+
...input.route_key === undefined ? {} : { routeKey: input.route_key },
|
|
1853
|
+
workerId: input.worker_id,
|
|
1854
|
+
now: input.now,
|
|
1855
|
+
claimExpiresAt: input.claim_expires_at
|
|
1856
|
+
}).pipe(Effect.map((record) => record === undefined ? null : toLease(record)), Effect.mapError(toClientError));
|
|
1857
|
+
}),
|
|
1858
|
+
ackEnvelopeReady: Effect.fn("Client.runtime.ackEnvelopeReady")(function* (input) {
|
|
1859
|
+
return yield* envelopeReady.ackReady({
|
|
1860
|
+
id: input.envelope_ready_id,
|
|
1861
|
+
workerId: input.worker_id,
|
|
1862
|
+
now: input.acknowledged_at
|
|
1863
|
+
}).pipe(Effect.map((record) => ({
|
|
1864
|
+
envelope_ready_id: record.id,
|
|
1865
|
+
state: "acknowledged",
|
|
1866
|
+
acknowledged_at: record.acknowledgedAt ?? input.acknowledged_at
|
|
1867
|
+
})), Effect.mapError(toClientError));
|
|
1868
|
+
}),
|
|
1869
|
+
releaseEnvelopeReady: Effect.fn("Client.runtime.releaseEnvelopeReady")(function* (input) {
|
|
1870
|
+
return yield* envelopeReady.releaseReady({
|
|
1871
|
+
id: input.envelope_ready_id,
|
|
1872
|
+
workerId: input.worker_id,
|
|
1873
|
+
nextAvailableAt: input.next_available_at,
|
|
1874
|
+
...input.error === undefined ? {} : { error: input.error }
|
|
1875
|
+
}).pipe(Effect.map((record) => ({
|
|
1876
|
+
envelope_ready_id: record.id,
|
|
1877
|
+
state: "ready",
|
|
1878
|
+
next_available_at: record.availableAt
|
|
1879
|
+
})), Effect.mapError(toClientError));
|
|
1880
|
+
}),
|
|
1881
|
+
createSchedule: Effect.fn("Client.runtime.createSchedule")(function* (input) {
|
|
1882
|
+
if (input.cron_expr !== undefined) {
|
|
1883
|
+
yield* exports_scheduler_service.parseCron(input.cron_expr).pipe(Effect.mapError(toClientError));
|
|
1884
|
+
}
|
|
1885
|
+
const createdAt = yield* Clock.currentTimeMillis;
|
|
1886
|
+
const schedule = yield* schedules.create({
|
|
1887
|
+
id: input.schedule_id,
|
|
1888
|
+
kind: input.kind,
|
|
1889
|
+
targetKind: input.target_kind,
|
|
1890
|
+
nextRunAt: input.next_run_at,
|
|
1891
|
+
createdAt,
|
|
1892
|
+
...input.address_id === undefined ? {} : { addressId: input.address_id },
|
|
1893
|
+
...input.wait_id === undefined ? {} : { waitId: input.wait_id },
|
|
1894
|
+
...input.cron_expr === undefined ? {} : { cronExpr: input.cron_expr },
|
|
1895
|
+
...input.input === undefined ? {} : { input: input.input },
|
|
1896
|
+
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key },
|
|
1897
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
1898
|
+
}).pipe(Effect.mapError(toClientError));
|
|
1899
|
+
return { schedule };
|
|
1900
|
+
}),
|
|
1901
|
+
cancelSchedule: Effect.fn("Client.runtime.cancelSchedule")(function* (input) {
|
|
1902
|
+
const schedule = yield* schedules.cancel({ id: input.schedule_id, cancelledAt: input.cancelled_at }).pipe(Effect.mapError(toClientError));
|
|
1903
|
+
return { schedule };
|
|
1904
|
+
}),
|
|
1905
|
+
listSchedules: Effect.fn("Client.runtime.listSchedules")(function* (input) {
|
|
1906
|
+
const records = yield* schedules.list(input.state === undefined ? {} : { state: input.state }).pipe(Effect.mapError(toClientError));
|
|
1907
|
+
return { schedules: records };
|
|
1908
|
+
})
|
|
1909
|
+
});
|
|
1910
|
+
}));
|
|
1911
|
+
var testLayer = (implementation) => Layer.succeed(Service, Service.of({
|
|
1912
|
+
...implementation,
|
|
1913
|
+
registerEntityKind: implementation.registerEntityKind ?? ((input) => Effect.succeed(input)),
|
|
1914
|
+
getOrCreateEntity: implementation.getOrCreateEntity ?? (() => Effect.fail(new ClientError({ message: "Entity service unavailable" }))),
|
|
1915
|
+
getEntity: implementation.getEntity ?? (() => Effect.succeed(undefined)),
|
|
1916
|
+
destroyEntity: implementation.destroyEntity ?? (() => Effect.fail(new ClientError({ message: "Entity service unavailable" }))),
|
|
1917
|
+
listEntities: implementation.listEntities ?? (() => Effect.succeed([])),
|
|
1918
|
+
streamSession: implementation.streamSession ?? (() => Stream.empty),
|
|
1919
|
+
watchExecutions: implementation.watchExecutions ?? (() => Stream.empty),
|
|
1920
|
+
getPresence: implementation.getPresence ?? ((scope) => Effect.succeed({ scope, entries: [], observed_at: 0 })),
|
|
1921
|
+
watchPresence: implementation.watchPresence ?? (() => Stream.empty)
|
|
1922
|
+
}));
|
|
1923
|
+
var registerAgentDefinition = Effect.fn("Client.registerAgentDefinition.call")(function* (input) {
|
|
1924
|
+
const service = yield* Service;
|
|
1925
|
+
return yield* service.registerAgentDefinition(input);
|
|
1926
|
+
});
|
|
1927
|
+
var registerEntityKind = Effect.fn("Client.registerEntityKind.call")(function* (input) {
|
|
1928
|
+
const service = yield* Service;
|
|
1929
|
+
return yield* service.registerEntityKind(input);
|
|
1930
|
+
});
|
|
1931
|
+
var getOrCreateEntity = Effect.fn("Client.getOrCreateEntity.call")(function* (input) {
|
|
1932
|
+
const service = yield* Service;
|
|
1933
|
+
return yield* service.getOrCreateEntity(input);
|
|
1934
|
+
});
|
|
1935
|
+
var getEntity = Effect.fn("Client.getEntity.call")(function* (input) {
|
|
1936
|
+
const service = yield* Service;
|
|
1937
|
+
return yield* service.getEntity(input);
|
|
1938
|
+
});
|
|
1939
|
+
var destroyEntity = Effect.fn("Client.destroyEntity.call")(function* (input) {
|
|
1940
|
+
const service = yield* Service;
|
|
1941
|
+
return yield* service.destroyEntity(input);
|
|
1942
|
+
});
|
|
1943
|
+
var listEntities = Effect.fn("Client.listEntities.call")(function* (input) {
|
|
1944
|
+
const service = yield* Service;
|
|
1945
|
+
return yield* service.listEntities(input);
|
|
1946
|
+
});
|
|
1947
|
+
var registerAgent = Effect.fn("Client.registerAgent.call")(function* (input) {
|
|
1948
|
+
const service = yield* Service;
|
|
1949
|
+
return yield* service.registerAgent(input);
|
|
1950
|
+
});
|
|
1951
|
+
var getAgentDefinition = Effect.fn("Client.getAgentDefinition.call")(function* (id) {
|
|
1952
|
+
const service = yield* Service;
|
|
1953
|
+
return yield* service.getAgentDefinition(id);
|
|
1954
|
+
});
|
|
1955
|
+
var listAgentDefinitions = Effect.fn("Client.listAgentDefinitions.call")(function* () {
|
|
1956
|
+
const service = yield* Service;
|
|
1957
|
+
return yield* service.listAgentDefinitions();
|
|
1958
|
+
});
|
|
1959
|
+
var listAgentDefinitionRevisions = Effect.fn("Client.listAgentDefinitionRevisions.call")(function* (id) {
|
|
1960
|
+
const service = yield* Service;
|
|
1961
|
+
return yield* service.listAgentDefinitionRevisions(id);
|
|
1962
|
+
});
|
|
1963
|
+
var getSkillDefinition = Effect.fn("Client.getSkillDefinition.call")(function* (id) {
|
|
1964
|
+
const service = yield* Service;
|
|
1965
|
+
return yield* service.getSkillDefinition(id);
|
|
1966
|
+
});
|
|
1967
|
+
var listSkillDefinitions = Effect.fn("Client.listSkillDefinitions.call")(function* () {
|
|
1968
|
+
const service = yield* Service;
|
|
1969
|
+
return yield* service.listSkillDefinitions();
|
|
1970
|
+
});
|
|
1971
|
+
var listSkillDefinitionRevisions = Effect.fn("Client.listSkillDefinitionRevisions.call")(function* (id) {
|
|
1972
|
+
const service = yield* Service;
|
|
1973
|
+
return yield* service.listSkillDefinitionRevisions(id);
|
|
1974
|
+
});
|
|
1975
|
+
var registerAddressBookRoute = Effect.fn("Client.registerAddressBookRoute.call")(function* (input) {
|
|
1976
|
+
const service = yield* Service;
|
|
1977
|
+
return yield* service.registerAddressBookRoute(input);
|
|
1978
|
+
});
|
|
1979
|
+
var getAddressBookRoute = Effect.fn("Client.getAddressBookRoute.call")(function* (id) {
|
|
1980
|
+
const service = yield* Service;
|
|
1981
|
+
return yield* service.getAddressBookRoute(id);
|
|
1982
|
+
});
|
|
1983
|
+
var listAddressBookRoutes = Effect.fn("Client.listAddressBookRoutes.call")(function* () {
|
|
1984
|
+
const service = yield* Service;
|
|
1985
|
+
return yield* service.listAddressBookRoutes();
|
|
1986
|
+
});
|
|
1987
|
+
var startExecution = Effect.fn("Client.startExecution.call")(function* (input) {
|
|
1988
|
+
const service = yield* Service;
|
|
1989
|
+
return yield* service.startExecution(input);
|
|
1990
|
+
});
|
|
1991
|
+
var startExecutionByAddress = Effect.fn("Client.startExecutionByAddress.call")(function* (input) {
|
|
1992
|
+
const service = yield* Service;
|
|
1993
|
+
return yield* service.startExecutionByAddress(input);
|
|
1994
|
+
});
|
|
1995
|
+
var startExecutionByAgentDefinition = Effect.fn("Client.startExecutionByAgentDefinition.call")(function* (input) {
|
|
1996
|
+
const service = yield* Service;
|
|
1997
|
+
return yield* service.startExecutionByAgentDefinition(input);
|
|
1998
|
+
});
|
|
1999
|
+
var cancelExecution = Effect.fn("Client.cancelExecution.call")(function* (input) {
|
|
2000
|
+
const service = yield* Service;
|
|
2001
|
+
return yield* service.cancelExecution(input);
|
|
2002
|
+
});
|
|
2003
|
+
var steer = Effect.fn("Client.steer.call")(function* (input) {
|
|
2004
|
+
const service = yield* Service;
|
|
2005
|
+
return yield* service.steer(input);
|
|
2006
|
+
});
|
|
2007
|
+
var getExecution = Effect.fn("Client.getExecution.call")(function* (id) {
|
|
2008
|
+
const service = yield* Service;
|
|
2009
|
+
return yield* service.getExecution(id);
|
|
2010
|
+
});
|
|
2011
|
+
var listExecutions = Effect.fn("Client.listExecutions.call")(function* (input) {
|
|
2012
|
+
const service = yield* Service;
|
|
2013
|
+
return yield* service.listExecutions(input);
|
|
2014
|
+
});
|
|
2015
|
+
var listSessions = Effect.fn("Client.listSessions.call")(function* (input) {
|
|
2016
|
+
const service = yield* Service;
|
|
2017
|
+
return yield* service.listSessions(input);
|
|
2018
|
+
});
|
|
2019
|
+
var getSession = Effect.fn("Client.getSession.call")(function* (input) {
|
|
2020
|
+
const service = yield* Service;
|
|
2021
|
+
return yield* service.getSession(input);
|
|
2022
|
+
});
|
|
2023
|
+
var listWaits = Effect.fn("Client.listWaits.call")(function* (input) {
|
|
2024
|
+
const service = yield* Service;
|
|
2025
|
+
return yield* service.listWaits(input);
|
|
2026
|
+
});
|
|
2027
|
+
var replayExecution = Effect.fn("Client.replayExecution.call")(function* (input) {
|
|
2028
|
+
const service = yield* Service;
|
|
2029
|
+
return yield* service.replayExecution(input);
|
|
2030
|
+
});
|
|
2031
|
+
var listRunners = Effect.fn("Client.listRunners.call")(function* () {
|
|
2032
|
+
const service = yield* Service;
|
|
2033
|
+
return yield* service.listRunners();
|
|
2034
|
+
});
|
|
2035
|
+
var routeExecution = Effect.fn("Client.routeExecution.call")(function* (executionId) {
|
|
2036
|
+
const service = yield* Service;
|
|
2037
|
+
return yield* service.routeExecution(executionId);
|
|
2038
|
+
});
|
|
2039
|
+
var subscribeTopic = Effect.fn("Client.subscribeTopic.call")(function* (input) {
|
|
2040
|
+
const service = yield* Service;
|
|
2041
|
+
return yield* service.subscribeTopic(input);
|
|
2042
|
+
});
|
|
2043
|
+
var unsubscribeTopic = Effect.fn("Client.unsubscribeTopic.call")(function* (input) {
|
|
2044
|
+
const service = yield* Service;
|
|
2045
|
+
return yield* service.unsubscribeTopic(input);
|
|
2046
|
+
});
|
|
2047
|
+
var publishTopic = Effect.fn("Client.publishTopic.call")(function* (input) {
|
|
2048
|
+
const service = yield* Service;
|
|
2049
|
+
return yield* service.publishTopic(input);
|
|
2050
|
+
});
|
|
2051
|
+
var listTopicSubscriptions = Effect.fn("Client.listTopicSubscriptions.call")(function* (input) {
|
|
2052
|
+
const service = yield* Service;
|
|
2053
|
+
return yield* service.listTopicSubscriptions(input);
|
|
2054
|
+
});
|
|
2055
|
+
var listInboxMessages = Effect.fn("Client.listInboxMessages.call")(function* (input) {
|
|
2056
|
+
const service = yield* Service;
|
|
2057
|
+
return yield* service.listInboxMessages(input);
|
|
2058
|
+
});
|
|
2059
|
+
var inspectExecution = Effect.fn("Client.inspectExecution.call")(function* (executionId) {
|
|
2060
|
+
const service = yield* Service;
|
|
2061
|
+
return yield* service.inspectExecution(executionId);
|
|
2062
|
+
});
|
|
2063
|
+
var send = Effect.fn("Client.send.call")(function* (input) {
|
|
2064
|
+
const service = yield* Service;
|
|
2065
|
+
return yield* service.send(input);
|
|
2066
|
+
});
|
|
2067
|
+
var streamExecution = (input) => Stream.unwrap(Service.pipe(Effect.map((service) => service.streamExecution(input))));
|
|
2068
|
+
var streamSession = (input) => Stream.unwrap(Service.pipe(Effect.map((service) => service.streamSession(input))));
|
|
2069
|
+
var watchExecutions = (input) => Stream.unwrap(Service.pipe(Effect.map((service) => service.watchExecutions(input))));
|
|
2070
|
+
var getPresence = Effect.fn("Client.getPresence.call")(function* (scope) {
|
|
2071
|
+
const service = yield* Service;
|
|
2072
|
+
return yield* service.getPresence(scope);
|
|
2073
|
+
});
|
|
2074
|
+
var watchPresence = (scope) => Stream.unwrap(Service.pipe(Effect.map((service) => service.watchPresence(scope))));
|
|
2075
|
+
var wake = Effect.fn("Client.wake.call")(function* (input) {
|
|
2076
|
+
const service = yield* Service;
|
|
2077
|
+
return yield* service.wake(input);
|
|
2078
|
+
});
|
|
2079
|
+
var listPendingApprovals = Effect.fn("Client.listPendingApprovals.call")(function* (input) {
|
|
2080
|
+
const service = yield* Service;
|
|
2081
|
+
return yield* service.listPendingApprovals(input);
|
|
2082
|
+
});
|
|
2083
|
+
var resolveToolApproval = Effect.fn("Client.resolveToolApproval.call")(function* (input) {
|
|
2084
|
+
const service = yield* Service;
|
|
2085
|
+
return yield* service.resolveToolApproval(input);
|
|
2086
|
+
});
|
|
2087
|
+
var resolvePermission = Effect.fn("Client.resolvePermission.call")(function* (input) {
|
|
2088
|
+
const service = yield* Service;
|
|
2089
|
+
return yield* service.resolvePermission(input);
|
|
2090
|
+
});
|
|
2091
|
+
var listPendingToolCalls = Effect.fn("Client.listPendingToolCalls.call")(function* (input) {
|
|
2092
|
+
const service = yield* Service;
|
|
2093
|
+
return yield* service.listPendingToolCalls(input);
|
|
2094
|
+
});
|
|
2095
|
+
var fulfillToolCall = Effect.fn("Client.fulfillToolCall.call")(function* (input) {
|
|
2096
|
+
const service = yield* Service;
|
|
2097
|
+
return yield* service.fulfillToolCall(input);
|
|
2098
|
+
});
|
|
2099
|
+
var claimToolWork = Effect.fn("Client.claimToolWork.call")(function* (input) {
|
|
2100
|
+
const service = yield* Service;
|
|
2101
|
+
return yield* service.claimToolWork(input);
|
|
2102
|
+
});
|
|
2103
|
+
var completeToolWork = Effect.fn("Client.completeToolWork.call")(function* (input) {
|
|
2104
|
+
const service = yield* Service;
|
|
2105
|
+
return yield* service.completeToolWork(input);
|
|
2106
|
+
});
|
|
2107
|
+
var releaseToolWork = Effect.fn("Client.releaseToolWork.call")(function* (input) {
|
|
2108
|
+
const service = yield* Service;
|
|
2109
|
+
return yield* service.releaseToolWork(input);
|
|
2110
|
+
});
|
|
2111
|
+
var listToolAttempts = Effect.fn("Client.listToolAttempts.call")(function* (input) {
|
|
2112
|
+
const service = yield* Service;
|
|
2113
|
+
return yield* service.listToolAttempts(input);
|
|
2114
|
+
});
|
|
2115
|
+
var submitInboundEnvelope = Effect.fn("Client.submitInboundEnvelope.call")(function* (input) {
|
|
2116
|
+
const service = yield* Service;
|
|
2117
|
+
return yield* service.submitInboundEnvelope(input);
|
|
2118
|
+
});
|
|
2119
|
+
var spawnChildRun = Effect.fn("Client.spawnChildRun.call")(function* (input) {
|
|
2120
|
+
const service = yield* Service;
|
|
2121
|
+
return yield* service.spawnChildRun(input);
|
|
2122
|
+
});
|
|
2123
|
+
var claimEnvelopeReady = Effect.fn("Client.claimEnvelopeReady.call")(function* (input) {
|
|
2124
|
+
const service = yield* Service;
|
|
2125
|
+
return yield* service.claimEnvelopeReady(input);
|
|
2126
|
+
});
|
|
2127
|
+
var ackEnvelopeReady = Effect.fn("Client.ackEnvelopeReady.call")(function* (input) {
|
|
2128
|
+
const service = yield* Service;
|
|
2129
|
+
return yield* service.ackEnvelopeReady(input);
|
|
2130
|
+
});
|
|
2131
|
+
var releaseEnvelopeReady = Effect.fn("Client.releaseEnvelopeReady.call")(function* (input) {
|
|
2132
|
+
const service = yield* Service;
|
|
2133
|
+
return yield* service.releaseEnvelopeReady(input);
|
|
2134
|
+
});
|
|
2135
|
+
var createSchedule = Effect.fn("Client.createSchedule.call")(function* (input) {
|
|
2136
|
+
const service = yield* Service;
|
|
2137
|
+
return yield* service.createSchedule(input);
|
|
2138
|
+
});
|
|
2139
|
+
var cancelSchedule = Effect.fn("Client.cancelSchedule.call")(function* (input) {
|
|
2140
|
+
const service = yield* Service;
|
|
2141
|
+
return yield* service.cancelSchedule(input);
|
|
2142
|
+
});
|
|
2143
|
+
var listSchedules = Effect.fn("Client.listSchedules.call")(function* (input) {
|
|
2144
|
+
const service = yield* Service;
|
|
2145
|
+
return yield* service.listSchedules(input);
|
|
2146
|
+
});
|
|
2147
|
+
var askEntity = Effect.fn("Client.askEntity.call")(function* (input) {
|
|
2148
|
+
const service = yield* Service;
|
|
2149
|
+
return yield* service.askEntity(input);
|
|
2150
|
+
});
|
|
2151
|
+
var awaitWait = Effect.fn("Client.awaitWait.call")(function* (input) {
|
|
2152
|
+
const service = yield* Service;
|
|
2153
|
+
return yield* service.awaitWait(input);
|
|
2154
|
+
});
|
|
2155
|
+
|
|
2156
|
+
export { exports_operation, exports_command, Service, exports_client };
|