@relayfx/sdk 0.6.1 → 0.7.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/dist/ai.js +1 -1
- package/dist/http-server.js +1 -1
- package/dist/{index-dm4yqr8f.js → index-7mmmxqw7.js} +1 -1
- package/dist/{index-ftgf8py0.js → index-n5sqnw4s.js} +1168 -1070
- package/dist/{index-fh2ftte9.js → index-q7xzf506.js} +6 -0
- package/dist/{index-5vjhqzbk.js → index-qa93yf6j.js} +1516 -800
- package/dist/index.js +265 -229
- package/dist/mysql.js +4 -4
- package/dist/postgres.js +4 -4
- package/dist/sqlite.js +4 -4
- package/dist/types/relay/client-public-executions.d.ts +2 -2
- package/dist/types/relay/operation.d.ts +4 -4
- package/dist/types/runtime/agent/agent-loop-error.d.ts +2 -2
- package/dist/types/runtime/agent/relay-compaction.d.ts +4 -0
- package/dist/types/schema/execution-schema.d.ts +8 -2
- package/dist/types/store-sql/prompt-wire.d.ts +4 -0
- package/dist/types/store-sql/session/session-entry-records.d.ts +3 -0
- package/dist/types/store-sql/session/session-repository.d.ts +7 -0
- package/package.json +15 -4
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
exports_model_middleware,
|
|
10
10
|
exports_model_registry,
|
|
11
11
|
exports_model_resilience,
|
|
12
|
+
exports_model_telemetry,
|
|
12
13
|
exports_permissions,
|
|
13
14
|
exports_session,
|
|
14
15
|
exports_skill_source,
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
exports_tool_executor,
|
|
17
18
|
exports_tool_output,
|
|
18
19
|
exports_turn_policy
|
|
19
|
-
} from "./index-
|
|
20
|
+
} from "./index-qa93yf6j.js";
|
|
20
21
|
import {
|
|
21
22
|
ClientError,
|
|
22
23
|
EventLogCursorNotFound,
|
|
@@ -46,7 +47,7 @@ import {
|
|
|
46
47
|
exports_workflow_schema,
|
|
47
48
|
exports_workspace_schema,
|
|
48
49
|
followExecutionFrom
|
|
49
|
-
} from "./index-
|
|
50
|
+
} from "./index-q7xzf506.js";
|
|
50
51
|
import {
|
|
51
52
|
__export
|
|
52
53
|
} from "./index-nb39b5ae.js";
|
|
@@ -298,14 +299,20 @@ var contentToPromptPart = (part) => {
|
|
|
298
299
|
var toAssemblerError = (error) => PromptAssemblerError.make({
|
|
299
300
|
message: error.reason !== undefined ? `${error._tag}: ${error.reason}` : error.message !== undefined ? `${error._tag}: ${error.message}` : error._tag
|
|
300
301
|
});
|
|
301
|
-
var resolveBlobPart = (blobs, part) => blobs.resolve(part).pipe(Effect4.
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
302
|
+
var resolveBlobPart = (blobs, part) => blobs.resolve(part).pipe(Effect4.mapError(toAssemblerError), Effect4.flatMap((resolved) => Effect4.gen(function* () {
|
|
303
|
+
const data = resolved._tag === "Bytes" ? resolved.bytes : yield* Effect4.try({
|
|
304
|
+
try: () => new URL(resolved.url),
|
|
305
|
+
catch: () => PromptAssemblerError.make({ message: "BlobStore resolved an invalid URL" })
|
|
306
|
+
});
|
|
307
|
+
return [
|
|
308
|
+
Prompt.makePart("file", {
|
|
309
|
+
mediaType: resolved.mediaType,
|
|
310
|
+
data,
|
|
311
|
+
...resolved.fileName === undefined ? {} : { fileName: resolved.fileName },
|
|
312
|
+
...part.provider_options === undefined ? {} : { options: part.provider_options }
|
|
313
|
+
})
|
|
314
|
+
];
|
|
315
|
+
})));
|
|
309
316
|
var resolveNestedPart = (blobs, part) => {
|
|
310
317
|
switch (part.type) {
|
|
311
318
|
case "blob-reference":
|
|
@@ -1031,27 +1038,91 @@ __export(exports_agent_chat_repository, {
|
|
|
1031
1038
|
AgentChatRow: () => AgentChatRow,
|
|
1032
1039
|
AgentChatRepositoryError: () => AgentChatRepositoryError
|
|
1033
1040
|
});
|
|
1034
|
-
import { Context as Context13, Effect as Effect14, Layer as Layer13, Schema as
|
|
1041
|
+
import { Context as Context13, Effect as Effect14, Layer as Layer13, Schema as Schema15 } from "effect";
|
|
1042
|
+
import { Prompt as Prompt3 } from "effect/unstable/ai";
|
|
1035
1043
|
import { SqlClient as SqlClient3 } from "effect/unstable/sql/SqlClient";
|
|
1036
|
-
|
|
1037
|
-
|
|
1044
|
+
|
|
1045
|
+
// ../store-sql/src/prompt-wire.ts
|
|
1046
|
+
import { Schema as Schema14 } from "effect";
|
|
1047
|
+
import { Prompt as Prompt2 } from "effect/unstable/ai";
|
|
1048
|
+
var Byte = Schema14.Int.check(Schema14.isBetween({ minimum: 0, maximum: 255 }));
|
|
1049
|
+
var FileDataWire = Schema14.Union([
|
|
1050
|
+
Schema14.TaggedStruct("String", { value: Schema14.String }),
|
|
1051
|
+
Schema14.TaggedStruct("Bytes", { value: Schema14.Array(Byte) }),
|
|
1052
|
+
Schema14.TaggedStruct("Url", { value: Schema14.String })
|
|
1053
|
+
]);
|
|
1054
|
+
var fileDataToWire = (data) => typeof data === "string" ? { _tag: "String", value: data } : data instanceof Uint8Array ? { _tag: "Bytes", value: Array.from(data) } : { _tag: "Url", value: data.toString() };
|
|
1055
|
+
var encodeMessage = (prompt, message, messageIndex) => ({
|
|
1056
|
+
...message,
|
|
1057
|
+
content: Array.isArray(message.content) ? message.content.map((part, partIndex) => {
|
|
1058
|
+
const actualContent = prompt.content[messageIndex]?.content;
|
|
1059
|
+
const actualPart = Array.isArray(actualContent) ? actualContent[partIndex] : undefined;
|
|
1060
|
+
return part.type === "file" && actualPart?.type === "file" ? { ...part, data: fileDataToWire(actualPart.data) } : part;
|
|
1061
|
+
}) : message.content
|
|
1062
|
+
});
|
|
1063
|
+
var encodePrompt = (prompt) => {
|
|
1064
|
+
const encoded = Schema14.encodeSync(Prompt2.Prompt)(prompt);
|
|
1065
|
+
return Schema14.decodeUnknownSync(exports_shared_schema.JsonValue)({
|
|
1066
|
+
content: encoded.content.map((message, messageIndex) => encodeMessage(prompt, message, messageIndex))
|
|
1067
|
+
});
|
|
1068
|
+
};
|
|
1069
|
+
var decodePrompt = (value) => {
|
|
1070
|
+
const content = typeof value === "object" && value !== null && !Array.isArray(value) && "content" in value ? value.content : undefined;
|
|
1071
|
+
const decodedContent = Array.isArray(content) ? content.map((message) => {
|
|
1072
|
+
if (typeof message !== "object" || message === null || Array.isArray(message))
|
|
1073
|
+
return message;
|
|
1074
|
+
const messageContent = message.content;
|
|
1075
|
+
return {
|
|
1076
|
+
...message,
|
|
1077
|
+
content: Array.isArray(messageContent) ? messageContent.map((part) => {
|
|
1078
|
+
if (typeof part !== "object" || part === null || Array.isArray(part) || part.type !== "file") {
|
|
1079
|
+
return part;
|
|
1080
|
+
}
|
|
1081
|
+
const data = Schema14.decodeUnknownSync(FileDataWire)(part.data);
|
|
1082
|
+
return {
|
|
1083
|
+
...part,
|
|
1084
|
+
data: data._tag === "String" ? data.value : data._tag === "Bytes" ? Uint8Array.from(data.value) : new URL(data.value)
|
|
1085
|
+
};
|
|
1086
|
+
}) : messageContent
|
|
1087
|
+
};
|
|
1088
|
+
}) : content;
|
|
1089
|
+
return Schema14.decodeUnknownSync(Prompt2.Prompt)({ content: decodedContent });
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
// ../store-sql/src/chat/agent-chat-repository.ts
|
|
1093
|
+
class AgentChatRepositoryError extends Schema15.TaggedErrorClass()("AgentChatRepositoryError", {
|
|
1094
|
+
message: Schema15.String
|
|
1038
1095
|
}) {
|
|
1039
1096
|
}
|
|
1040
1097
|
|
|
1041
1098
|
class Service15 extends Context13.Service()("@relayfx/store-sql/chat/agent-chat-repository/Service") {
|
|
1042
1099
|
}
|
|
1043
|
-
var AgentChatRow =
|
|
1044
|
-
execution_id:
|
|
1045
|
-
export_json:
|
|
1046
|
-
updated_at:
|
|
1100
|
+
var AgentChatRow = Schema15.Struct({
|
|
1101
|
+
execution_id: Schema15.String,
|
|
1102
|
+
export_json: Schema15.Unknown,
|
|
1103
|
+
updated_at: Schema15.Union([Schema15.Date, Schema15.String, Schema15.Finite])
|
|
1047
1104
|
}).annotate({ identifier: "Relay.AgentChat.Row" });
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
exportData: decodeJson(row.export_json),
|
|
1051
|
-
updatedAt: fromDbTimestamp(row.updated_at)
|
|
1105
|
+
var AgentChatExportWire = Schema15.TaggedStruct("RelayAgentChatExportV1", {
|
|
1106
|
+
prompt: exports_shared_schema.JsonValue
|
|
1052
1107
|
});
|
|
1053
1108
|
var toRepositoryError2 = (error) => AgentChatRepositoryError.make({ message: String(error) });
|
|
1054
|
-
var
|
|
1109
|
+
var encodeExport = (exportData) => {
|
|
1110
|
+
const prompt = Schema15.decodeUnknownSync(Prompt3.Prompt)(exportData);
|
|
1111
|
+
return Schema15.encodeSync(AgentChatExportWire)({ _tag: "RelayAgentChatExportV1", prompt: encodePrompt(prompt) });
|
|
1112
|
+
};
|
|
1113
|
+
var decodeExport = (value) => {
|
|
1114
|
+
const wire = Schema15.decodeUnknownSync(AgentChatExportWire)(decodeJson(value));
|
|
1115
|
+
return Schema15.encodeSync(Prompt3.Prompt)(decodePrompt(wire.prompt));
|
|
1116
|
+
};
|
|
1117
|
+
var toRecord = (row) => Effect14.try({
|
|
1118
|
+
try: () => ({
|
|
1119
|
+
executionId: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
1120
|
+
exportData: decodeExport(row.export_json),
|
|
1121
|
+
updatedAt: fromDbTimestamp(row.updated_at)
|
|
1122
|
+
}),
|
|
1123
|
+
catch: toRepositoryError2
|
|
1124
|
+
});
|
|
1125
|
+
var decodeRow2 = (row) => Schema15.decodeUnknownEffect(AgentChatRow)(row).pipe(Effect14.mapError(toRepositoryError2));
|
|
1055
1126
|
var layer9 = Layer13.effect(Service15, Effect14.gen(function* () {
|
|
1056
1127
|
const sql = yield* SqlClient3;
|
|
1057
1128
|
const selectByKey = (tenantId, executionId) => sql`
|
|
@@ -1060,19 +1131,19 @@ var layer9 = Layer13.effect(Service15, Effect14.gen(function* () {
|
|
|
1060
1131
|
WHERE tenant_id = ${tenantId} AND execution_id = ${executionId}
|
|
1061
1132
|
`;
|
|
1062
1133
|
const upsert2 = sql.onDialectOrElse({
|
|
1063
|
-
mysql: () => (tenantId, input) => sql.withTransaction(Effect14.gen(function* () {
|
|
1134
|
+
mysql: () => (tenantId, input, exportData) => sql.withTransaction(Effect14.gen(function* () {
|
|
1064
1135
|
yield* sql`
|
|
1065
1136
|
INSERT INTO relay_agent_chats (tenant_id, execution_id, export_json, updated_at)
|
|
1066
|
-
VALUES (${tenantId}, ${input.executionId}, ${encodeJson(
|
|
1137
|
+
VALUES (${tenantId}, ${input.executionId}, ${encodeJson(exportData)}, ${timestampParam(sql, input.updatedAt)})
|
|
1067
1138
|
ON DUPLICATE KEY UPDATE
|
|
1068
1139
|
export_json = VALUES(export_json),
|
|
1069
1140
|
updated_at = VALUES(updated_at)
|
|
1070
1141
|
`;
|
|
1071
1142
|
return yield* selectByKey(tenantId, input.executionId);
|
|
1072
1143
|
})),
|
|
1073
|
-
orElse: () => (tenantId, input) => sql`
|
|
1144
|
+
orElse: () => (tenantId, input, exportData) => sql`
|
|
1074
1145
|
INSERT INTO relay_agent_chats (tenant_id, execution_id, export_json, updated_at)
|
|
1075
|
-
VALUES (${tenantId}, ${input.executionId}, ${encodeJson(
|
|
1146
|
+
VALUES (${tenantId}, ${input.executionId}, ${encodeJson(exportData)}, ${timestampParam(sql, input.updatedAt)})
|
|
1076
1147
|
ON CONFLICT (tenant_id, execution_id) DO UPDATE SET
|
|
1077
1148
|
export_json = excluded.export_json,
|
|
1078
1149
|
updated_at = excluded.updated_at
|
|
@@ -1081,34 +1152,43 @@ var layer9 = Layer13.effect(Service15, Effect14.gen(function* () {
|
|
|
1081
1152
|
});
|
|
1082
1153
|
const save = Effect14.fn("AgentChatRepository.save")(function* (input) {
|
|
1083
1154
|
const tenantId = yield* current();
|
|
1084
|
-
const
|
|
1155
|
+
const exportData = yield* Effect14.try({ try: () => encodeExport(input.exportData), catch: toRepositoryError2 });
|
|
1156
|
+
const rows = yield* upsert2(tenantId, input, exportData).pipe(Effect14.mapError(toRepositoryError2));
|
|
1085
1157
|
const row = rows[0];
|
|
1086
1158
|
if (row === undefined) {
|
|
1087
1159
|
return yield* AgentChatRepositoryError.make({ message: "Agent chat upsert returned no row" });
|
|
1088
1160
|
}
|
|
1089
|
-
return toRecord(yield* decodeRow2(row));
|
|
1161
|
+
return yield* toRecord(yield* decodeRow2(row));
|
|
1090
1162
|
});
|
|
1091
1163
|
const get = Effect14.fn("AgentChatRepository.get")(function* (executionId) {
|
|
1092
1164
|
const tenantId = yield* current();
|
|
1093
1165
|
const rows = yield* selectByKey(tenantId, executionId).pipe(Effect14.mapError(toRepositoryError2));
|
|
1094
|
-
return rows[0] === undefined ? undefined : toRecord(yield* decodeRow2(rows[0]));
|
|
1166
|
+
return rows[0] === undefined ? undefined : yield* toRecord(yield* decodeRow2(rows[0]));
|
|
1095
1167
|
});
|
|
1096
1168
|
return Service15.of({ save, get });
|
|
1097
1169
|
}));
|
|
1098
1170
|
var memoryLayer7 = Layer13.sync(Service15, () => {
|
|
1099
1171
|
const chats = new Map;
|
|
1172
|
+
const cloneExport = (exportData) => Effect14.try({
|
|
1173
|
+
try: () => decodeExport(encodeExport(exportData)),
|
|
1174
|
+
catch: toRepositoryError2
|
|
1175
|
+
});
|
|
1100
1176
|
return Service15.of({
|
|
1101
1177
|
save: Effect14.fn("AgentChatRepository.memory.save")(function* (input) {
|
|
1178
|
+
const exportData = yield* cloneExport(input.exportData);
|
|
1102
1179
|
const record = {
|
|
1103
1180
|
executionId: input.executionId,
|
|
1104
|
-
exportData
|
|
1181
|
+
exportData,
|
|
1105
1182
|
updatedAt: input.updatedAt
|
|
1106
1183
|
};
|
|
1107
1184
|
yield* Effect14.sync(() => chats.set(input.executionId, record));
|
|
1108
|
-
return record;
|
|
1185
|
+
return { ...record, exportData: yield* cloneExport(record.exportData) };
|
|
1109
1186
|
}),
|
|
1110
1187
|
get: Effect14.fn("AgentChatRepository.memory.get")(function* (executionId) {
|
|
1111
|
-
|
|
1188
|
+
const record = yield* Effect14.sync(() => chats.get(executionId));
|
|
1189
|
+
if (record === undefined)
|
|
1190
|
+
return;
|
|
1191
|
+
return { ...record, exportData: yield* cloneExport(record.exportData) };
|
|
1112
1192
|
})
|
|
1113
1193
|
});
|
|
1114
1194
|
});
|
|
@@ -1137,32 +1217,32 @@ __export(exports_agent_definition_repository, {
|
|
|
1137
1217
|
AgentDefinitionRevisionRow: () => AgentDefinitionRevisionRow,
|
|
1138
1218
|
AgentDefinitionRepositoryError: () => AgentDefinitionRepositoryError
|
|
1139
1219
|
});
|
|
1140
|
-
import { Context as Context14, Effect as Effect15, Layer as Layer14, Schema as
|
|
1220
|
+
import { Context as Context14, Effect as Effect15, Layer as Layer14, Schema as Schema16 } from "effect";
|
|
1141
1221
|
import { SqlClient as SqlClient4 } from "effect/unstable/sql/SqlClient";
|
|
1142
|
-
class AgentDefinitionRepositoryError extends
|
|
1143
|
-
message:
|
|
1222
|
+
class AgentDefinitionRepositoryError extends Schema16.TaggedErrorClass()("AgentDefinitionRepositoryError", {
|
|
1223
|
+
message: Schema16.String
|
|
1144
1224
|
}) {
|
|
1145
1225
|
}
|
|
1146
1226
|
|
|
1147
1227
|
class Service16 extends Context14.Service()("@relayfx/store-sql/agent/agent-definition-repository/Service") {
|
|
1148
1228
|
}
|
|
1149
|
-
var AgentDefinitionRow =
|
|
1150
|
-
id:
|
|
1151
|
-
current_revision:
|
|
1152
|
-
definition_json:
|
|
1153
|
-
tool_input_schema_digests_json:
|
|
1154
|
-
created_at:
|
|
1155
|
-
updated_at:
|
|
1229
|
+
var AgentDefinitionRow = Schema16.Struct({
|
|
1230
|
+
id: Schema16.String,
|
|
1231
|
+
current_revision: Schema16.Finite,
|
|
1232
|
+
definition_json: Schema16.Unknown,
|
|
1233
|
+
tool_input_schema_digests_json: Schema16.Unknown,
|
|
1234
|
+
created_at: Schema16.Union([Schema16.Date, Schema16.String, Schema16.Finite]),
|
|
1235
|
+
updated_at: Schema16.Union([Schema16.Date, Schema16.String, Schema16.Finite])
|
|
1156
1236
|
}).annotate({ identifier: "Relay.AgentDefinition.Row" });
|
|
1157
|
-
var AgentDefinitionRevisionRow =
|
|
1158
|
-
agent_id:
|
|
1159
|
-
revision:
|
|
1160
|
-
definition_json:
|
|
1161
|
-
tool_input_schema_digests_json:
|
|
1162
|
-
created_at:
|
|
1237
|
+
var AgentDefinitionRevisionRow = Schema16.Struct({
|
|
1238
|
+
agent_id: Schema16.String,
|
|
1239
|
+
revision: Schema16.Finite,
|
|
1240
|
+
definition_json: Schema16.Unknown,
|
|
1241
|
+
tool_input_schema_digests_json: Schema16.Unknown,
|
|
1242
|
+
created_at: Schema16.Union([Schema16.Date, Schema16.String, Schema16.Finite])
|
|
1163
1243
|
}).annotate({ identifier: "Relay.AgentDefinitionRevision.Row" });
|
|
1164
1244
|
var nonEmptyDigests = (digests) => digests === undefined || Object.keys(digests).length === 0 ? undefined : structuredClone(digests);
|
|
1165
|
-
var cloneDefinition = (definition) =>
|
|
1245
|
+
var cloneDefinition = (definition) => Schema16.decodeUnknownSync(exports_agent_schema.Definition)(globalThis.structuredClone(definition));
|
|
1166
1246
|
var rowDigests = (json) => nonEmptyDigests(decodeJson(json));
|
|
1167
1247
|
var toRecord2 = (row) => {
|
|
1168
1248
|
const toolInputSchemaDigests = rowDigests(row.tool_input_schema_digests_json);
|
|
@@ -1201,9 +1281,9 @@ var compareByCreatedAtDesc = (left, right) => {
|
|
|
1201
1281
|
return createdAt === 0 ? left.id.localeCompare(right.id) : createdAt;
|
|
1202
1282
|
};
|
|
1203
1283
|
var toRepositoryError3 = (error) => AgentDefinitionRepositoryError.make({ message: String(error) });
|
|
1204
|
-
var mapPutError = (error) =>
|
|
1205
|
-
var decodeRow3 = (row) =>
|
|
1206
|
-
var decodeRevisionRow = (row) =>
|
|
1284
|
+
var mapPutError = (error) => Schema16.is(AgentDefinitionRepositoryError)(error) ? error : toRepositoryError3(error);
|
|
1285
|
+
var decodeRow3 = (row) => Schema16.decodeUnknownEffect(AgentDefinitionRow)(row).pipe(Effect15.mapError(toRepositoryError3));
|
|
1286
|
+
var decodeRevisionRow = (row) => Schema16.decodeUnknownEffect(AgentDefinitionRevisionRow)(row).pipe(Effect15.mapError(toRepositoryError3));
|
|
1207
1287
|
var layer10 = Layer14.effect(Service16, Effect15.gen(function* () {
|
|
1208
1288
|
const sql = yield* SqlClient4;
|
|
1209
1289
|
const columns = sql.literal(["id", "current_revision", "definition_json", "tool_input_schema_digests_json", "created_at", "updated_at"].join(", "));
|
|
@@ -1407,34 +1487,34 @@ __export(exports_child_execution_repository, {
|
|
|
1407
1487
|
ChildExecutionRepositoryError: () => ChildExecutionRepositoryError,
|
|
1408
1488
|
ChildExecutionNotFound: () => ChildExecutionNotFound
|
|
1409
1489
|
});
|
|
1410
|
-
import { Context as Context15, Effect as Effect16, Layer as Layer15, Predicate, Schema as
|
|
1490
|
+
import { Context as Context15, Effect as Effect16, Layer as Layer15, Predicate, Schema as Schema17 } from "effect";
|
|
1411
1491
|
import { SqlClient as SqlClient5 } from "effect/unstable/sql/SqlClient";
|
|
1412
1492
|
import { isSqlError } from "effect/unstable/sql/SqlError";
|
|
1413
|
-
class ChildExecutionRepositoryError extends
|
|
1414
|
-
message:
|
|
1493
|
+
class ChildExecutionRepositoryError extends Schema17.TaggedErrorClass()("ChildExecutionRepositoryError", {
|
|
1494
|
+
message: Schema17.String
|
|
1415
1495
|
}) {
|
|
1416
1496
|
}
|
|
1417
1497
|
|
|
1418
|
-
class DuplicateChildExecution extends
|
|
1498
|
+
class DuplicateChildExecution extends Schema17.TaggedErrorClass()("DuplicateChildExecution", {
|
|
1419
1499
|
id: exports_ids_schema.ChildExecutionId
|
|
1420
1500
|
}) {
|
|
1421
1501
|
}
|
|
1422
1502
|
|
|
1423
|
-
class ChildExecutionNotFound extends
|
|
1503
|
+
class ChildExecutionNotFound extends Schema17.TaggedErrorClass()("ChildExecutionNotFound", {
|
|
1424
1504
|
id: exports_ids_schema.ChildExecutionId
|
|
1425
1505
|
}) {
|
|
1426
1506
|
}
|
|
1427
1507
|
|
|
1428
1508
|
class Service17 extends Context15.Service()("@relayfx/store-sql/child/child-execution-repository/Service") {
|
|
1429
1509
|
}
|
|
1430
|
-
var ChildExecutionRow =
|
|
1431
|
-
id:
|
|
1432
|
-
execution_id:
|
|
1433
|
-
address_id:
|
|
1434
|
-
status:
|
|
1435
|
-
metadata_json:
|
|
1436
|
-
created_at:
|
|
1437
|
-
updated_at:
|
|
1510
|
+
var ChildExecutionRow = Schema17.Struct({
|
|
1511
|
+
id: Schema17.String,
|
|
1512
|
+
execution_id: Schema17.String,
|
|
1513
|
+
address_id: Schema17.String,
|
|
1514
|
+
status: Schema17.String,
|
|
1515
|
+
metadata_json: Schema17.Unknown,
|
|
1516
|
+
created_at: Schema17.Union([Schema17.Date, Schema17.String, Schema17.Finite]),
|
|
1517
|
+
updated_at: Schema17.Union([Schema17.Date, Schema17.String, Schema17.Finite])
|
|
1438
1518
|
}).annotate({ identifier: "Relay.ChildExecution.Row" });
|
|
1439
1519
|
var metadata2 = (input) => input ?? {};
|
|
1440
1520
|
var toRecord3 = (row) => ({
|
|
@@ -1457,7 +1537,7 @@ var isDuplicateConstraint = (error) => {
|
|
|
1457
1537
|
const cause = error.reason.cause;
|
|
1458
1538
|
return Predicate.hasProperty(cause, "code") && (cause.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || cause.code === 1555) || Predicate.hasProperty(cause, "errno") && cause.errno === 1555;
|
|
1459
1539
|
};
|
|
1460
|
-
var decodeRow4 = (row) =>
|
|
1540
|
+
var decodeRow4 = (row) => Schema17.decodeUnknownEffect(ChildExecutionRow)(row).pipe(Effect16.mapError(toRepositoryError4));
|
|
1461
1541
|
var layer11 = Layer15.effect(Service17, Effect16.gen(function* () {
|
|
1462
1542
|
const sql = yield* SqlClient5;
|
|
1463
1543
|
const columns = sql.literal(["id", "execution_id", "address_id", "status", "metadata_json", "created_at", "updated_at"].join(", "));
|
|
@@ -1614,35 +1694,35 @@ __export(exports_child_fan_out_repository, {
|
|
|
1614
1694
|
ChildFanOutRepositoryError: () => ChildFanOutRepositoryError,
|
|
1615
1695
|
ChildFanOutConflict: () => ChildFanOutConflict
|
|
1616
1696
|
});
|
|
1617
|
-
import { Context as Context16, Effect as Effect17, Layer as Layer16, Schema as
|
|
1697
|
+
import { Context as Context16, Effect as Effect17, Layer as Layer16, Schema as Schema18, Semaphore } from "effect";
|
|
1618
1698
|
import { SqlClient as SqlClient6 } from "effect/unstable/sql/SqlClient";
|
|
1619
|
-
class ChildFanOutRepositoryError extends
|
|
1699
|
+
class ChildFanOutRepositoryError extends Schema18.TaggedErrorClass()("ChildFanOutRepositoryError", { message: Schema18.String }) {
|
|
1620
1700
|
}
|
|
1621
1701
|
|
|
1622
|
-
class ChildFanOutConflict extends
|
|
1702
|
+
class ChildFanOutConflict extends Schema18.TaggedErrorClass()("ChildFanOutConflict", {
|
|
1623
1703
|
fan_out_id: exports_ids_schema.ChildFanOutId
|
|
1624
1704
|
}) {
|
|
1625
1705
|
}
|
|
1626
1706
|
|
|
1627
1707
|
class Service18 extends Context16.Service()("@relayfx/store-sql/child/child-fan-out-repository/Service") {
|
|
1628
1708
|
}
|
|
1629
|
-
var FanOutRow =
|
|
1630
|
-
definition_json:
|
|
1709
|
+
var FanOutRow = Schema18.Struct({
|
|
1710
|
+
definition_json: Schema18.Unknown,
|
|
1631
1711
|
state: exports_child_orchestration_schema.AggregateState,
|
|
1632
|
-
satisfied_at:
|
|
1633
|
-
failed_at:
|
|
1634
|
-
cancelled_at:
|
|
1712
|
+
satisfied_at: Schema18.NullOr(Schema18.Union([Schema18.Date, Schema18.String, Schema18.Finite])),
|
|
1713
|
+
failed_at: Schema18.NullOr(Schema18.Union([Schema18.Date, Schema18.String, Schema18.Finite])),
|
|
1714
|
+
cancelled_at: Schema18.NullOr(Schema18.Union([Schema18.Date, Schema18.String, Schema18.Finite]))
|
|
1635
1715
|
});
|
|
1636
|
-
var MemberRow =
|
|
1637
|
-
child_execution_id:
|
|
1638
|
-
ordinal:
|
|
1716
|
+
var MemberRow = Schema18.Struct({
|
|
1717
|
+
child_execution_id: Schema18.String,
|
|
1718
|
+
ordinal: Schema18.Finite,
|
|
1639
1719
|
state: exports_child_orchestration_schema.MemberState,
|
|
1640
|
-
output_json:
|
|
1641
|
-
error:
|
|
1642
|
-
completed_at:
|
|
1720
|
+
output_json: Schema18.NullOr(Schema18.Unknown),
|
|
1721
|
+
error: Schema18.NullOr(Schema18.String),
|
|
1722
|
+
completed_at: Schema18.NullOr(Schema18.Union([Schema18.Date, Schema18.String, Schema18.Finite]))
|
|
1643
1723
|
});
|
|
1644
1724
|
var repositoryError = (error) => ChildFanOutRepositoryError.make({ message: String(error) });
|
|
1645
|
-
var cloneDefinition2 = (value) =>
|
|
1725
|
+
var cloneDefinition2 = (value) => Schema18.decodeUnknownSync(exports_child_orchestration_schema.FanOutDefinition)(globalThis.structuredClone(value));
|
|
1646
1726
|
var sameDefinition = (left, right) => exports_shared_schema.canonicalEquals(left, right);
|
|
1647
1727
|
var terminal = (state) => state === "completed" || state === "failed" || state === "cancelled";
|
|
1648
1728
|
var foldState = (state) => {
|
|
@@ -1685,9 +1765,9 @@ var layer12 = Layer16.effect(Service18, Effect17.gen(function* () {
|
|
|
1685
1765
|
const rows = yield* sql`SELECT definition_json, state, satisfied_at, failed_at, cancelled_at FROM relay_child_fan_outs WHERE tenant_id = ${tenantId} AND id = ${id}`;
|
|
1686
1766
|
if (rows[0] === undefined)
|
|
1687
1767
|
return;
|
|
1688
|
-
const row = yield*
|
|
1768
|
+
const row = yield* Schema18.decodeUnknownEffect(FanOutRow)(rows[0]);
|
|
1689
1769
|
const memberRows = yield* sql`SELECT child_execution_id, ordinal, state, output_json, error, completed_at FROM relay_child_fan_out_members WHERE tenant_id = ${tenantId} AND fan_out_id = ${id} ORDER BY ordinal ASC`;
|
|
1690
|
-
const decodedMembers = yield* Effect17.forEach(memberRows, (member) =>
|
|
1770
|
+
const decodedMembers = yield* Effect17.forEach(memberRows, (member) => Schema18.decodeUnknownEffect(MemberRow)(member));
|
|
1691
1771
|
const definition = cloneDefinition2(decodeJson(row.definition_json));
|
|
1692
1772
|
return {
|
|
1693
1773
|
...definition,
|
|
@@ -1937,23 +2017,23 @@ __export(exports_cluster_registry_repository, {
|
|
|
1937
2017
|
LockRow: () => LockRow,
|
|
1938
2018
|
ClusterRegistryError: () => ClusterRegistryError
|
|
1939
2019
|
});
|
|
1940
|
-
import { Context as Context17, Effect as Effect18, Layer as Layer17, Schema as
|
|
2020
|
+
import { Context as Context17, Effect as Effect18, Layer as Layer17, Schema as Schema19 } from "effect";
|
|
1941
2021
|
import { SqlClient as SqlClient7 } from "effect/unstable/sql/SqlClient";
|
|
1942
|
-
class ClusterRegistryError extends
|
|
1943
|
-
message:
|
|
2022
|
+
class ClusterRegistryError extends Schema19.TaggedErrorClass()("ClusterRegistryError", {
|
|
2023
|
+
message: Schema19.String
|
|
1944
2024
|
}) {
|
|
1945
2025
|
}
|
|
1946
2026
|
|
|
1947
2027
|
class Service19 extends Context17.Service()("@relayfx/store-sql/cluster/cluster-registry-repository/Service") {
|
|
1948
2028
|
}
|
|
1949
|
-
var RunnerRow =
|
|
1950
|
-
address:
|
|
1951
|
-
healthy:
|
|
1952
|
-
last_heartbeat:
|
|
1953
|
-
owned_shards:
|
|
2029
|
+
var RunnerRow = Schema19.Struct({
|
|
2030
|
+
address: Schema19.String,
|
|
2031
|
+
healthy: Schema19.Union([Schema19.Boolean, Schema19.Finite, Schema19.String]),
|
|
2032
|
+
last_heartbeat: Schema19.Union([Schema19.Date, Schema19.String, Schema19.Finite]),
|
|
2033
|
+
owned_shards: Schema19.Union([Schema19.Finite, Schema19.String, Schema19.BigInt])
|
|
1954
2034
|
}).annotate({ identifier: "Relay.ClusterRegistry.RunnerRow" });
|
|
1955
|
-
var LockRow =
|
|
1956
|
-
address:
|
|
2035
|
+
var LockRow = Schema19.Struct({
|
|
2036
|
+
address: Schema19.String
|
|
1957
2037
|
}).annotate({ identifier: "Relay.ClusterRegistry.LockRow" });
|
|
1958
2038
|
var toRunnerRecord = (row) => ({
|
|
1959
2039
|
address: row.address,
|
|
@@ -1962,8 +2042,8 @@ var toRunnerRecord = (row) => ({
|
|
|
1962
2042
|
ownedShards: Number(row.owned_shards)
|
|
1963
2043
|
});
|
|
1964
2044
|
var toRegistryError = (error) => ClusterRegistryError.make({ message: String(error) });
|
|
1965
|
-
var decodeRunnerRow = (row) =>
|
|
1966
|
-
var decodeLockRow = (row) =>
|
|
2045
|
+
var decodeRunnerRow = (row) => Schema19.decodeUnknownEffect(RunnerRow)(row).pipe(Effect18.mapError(toRegistryError));
|
|
2046
|
+
var decodeLockRow = (row) => Schema19.decodeUnknownEffect(LockRow)(row).pipe(Effect18.mapError(toRegistryError));
|
|
1967
2047
|
var layer13 = Layer17.effect(Service19, Effect18.gen(function* () {
|
|
1968
2048
|
const sql = yield* SqlClient7;
|
|
1969
2049
|
const selectRunners = () => sql`
|
|
@@ -2010,22 +2090,22 @@ __export(exports_compaction_repository, {
|
|
|
2010
2090
|
CompactionRepositoryError: () => CompactionRepositoryError,
|
|
2011
2091
|
CompactionCheckpointRow: () => CompactionCheckpointRow
|
|
2012
2092
|
});
|
|
2013
|
-
import { Context as Context18, Effect as Effect19, Layer as Layer18, Schema as
|
|
2093
|
+
import { Context as Context18, Effect as Effect19, Layer as Layer18, Schema as Schema20 } from "effect";
|
|
2014
2094
|
import { SqlClient as SqlClient8 } from "effect/unstable/sql/SqlClient";
|
|
2015
|
-
class CompactionRepositoryError extends
|
|
2016
|
-
message:
|
|
2095
|
+
class CompactionRepositoryError extends Schema20.TaggedErrorClass()("CompactionRepositoryError", {
|
|
2096
|
+
message: Schema20.String
|
|
2017
2097
|
}) {
|
|
2018
2098
|
}
|
|
2019
2099
|
|
|
2020
2100
|
class Service20 extends Context18.Service()("@relayfx/store-sql/compaction/compaction-repository/Service") {
|
|
2021
2101
|
}
|
|
2022
|
-
var CompactionCheckpointRow =
|
|
2023
|
-
execution_id:
|
|
2024
|
-
checkpoint_id:
|
|
2025
|
-
summary:
|
|
2026
|
-
first_kept_entry_id:
|
|
2027
|
-
turn:
|
|
2028
|
-
created_at:
|
|
2102
|
+
var CompactionCheckpointRow = Schema20.Struct({
|
|
2103
|
+
execution_id: Schema20.String,
|
|
2104
|
+
checkpoint_id: Schema20.String,
|
|
2105
|
+
summary: Schema20.String,
|
|
2106
|
+
first_kept_entry_id: Schema20.String,
|
|
2107
|
+
turn: Schema20.Finite,
|
|
2108
|
+
created_at: Schema20.Union([Schema20.Date, Schema20.String, Schema20.Finite])
|
|
2029
2109
|
}).annotate({ identifier: "Relay.CompactionCheckpoint.Row" });
|
|
2030
2110
|
var toRecord4 = (row) => ({
|
|
2031
2111
|
executionId: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
@@ -2036,7 +2116,7 @@ var toRecord4 = (row) => ({
|
|
|
2036
2116
|
createdAt: fromDbTimestamp(row.created_at)
|
|
2037
2117
|
});
|
|
2038
2118
|
var toRepositoryError5 = (error) => CompactionRepositoryError.make({ message: String(error) });
|
|
2039
|
-
var decodeRow5 = (row) =>
|
|
2119
|
+
var decodeRow5 = (row) => Schema20.decodeUnknownEffect(CompactionCheckpointRow)(row).pipe(Effect19.mapError(toRepositoryError5));
|
|
2040
2120
|
var key = (input) => `${input.executionId}:${input.checkpointId}`;
|
|
2041
2121
|
var sameCheckpoint = (record, input) => record.summary === input.summary && record.firstKeptEntryId === input.firstKeptEntryId && record.turn === input.turn;
|
|
2042
2122
|
var conflict = (input) => CompactionRepositoryError.make({
|
|
@@ -2160,20 +2240,20 @@ __export(exports_context_epoch_repository, {
|
|
|
2160
2240
|
ContextEpochRow: () => ContextEpochRow,
|
|
2161
2241
|
ContextEpochRepositoryError: () => ContextEpochRepositoryError
|
|
2162
2242
|
});
|
|
2163
|
-
import { Context as Context19, Effect as Effect20, Layer as Layer19, Schema as
|
|
2243
|
+
import { Context as Context19, Effect as Effect20, Layer as Layer19, Schema as Schema21 } from "effect";
|
|
2164
2244
|
import { SqlClient as SqlClient9 } from "effect/unstable/sql/SqlClient";
|
|
2165
|
-
class ContextEpochRepositoryError extends
|
|
2166
|
-
message:
|
|
2245
|
+
class ContextEpochRepositoryError extends Schema21.TaggedErrorClass()("ContextEpochRepositoryError", {
|
|
2246
|
+
message: Schema21.String
|
|
2167
2247
|
}) {
|
|
2168
2248
|
}
|
|
2169
2249
|
|
|
2170
2250
|
class Service21 extends Context19.Service()("@relayfx/store-sql/session/context-epoch-repository/Service") {
|
|
2171
2251
|
}
|
|
2172
|
-
var ContextEpochRow =
|
|
2173
|
-
execution_id:
|
|
2174
|
-
baseline:
|
|
2175
|
-
dynamic_source_ids_json:
|
|
2176
|
-
opened_at:
|
|
2252
|
+
var ContextEpochRow = Schema21.Struct({
|
|
2253
|
+
execution_id: Schema21.String,
|
|
2254
|
+
baseline: Schema21.String,
|
|
2255
|
+
dynamic_source_ids_json: Schema21.Unknown,
|
|
2256
|
+
opened_at: Schema21.Union([Schema21.Date, Schema21.String, Schema21.Finite])
|
|
2177
2257
|
}).annotate({ identifier: "Relay.ContextEpoch.Row" });
|
|
2178
2258
|
var toRecord5 = (row) => ({
|
|
2179
2259
|
executionId: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
@@ -2182,7 +2262,7 @@ var toRecord5 = (row) => ({
|
|
|
2182
2262
|
openedAt: fromDbTimestamp(row.opened_at)
|
|
2183
2263
|
});
|
|
2184
2264
|
var toRepositoryError6 = (error) => ContextEpochRepositoryError.make({ message: String(error) });
|
|
2185
|
-
var decodeRow6 = (row) =>
|
|
2265
|
+
var decodeRow6 = (row) => Schema21.decodeUnknownEffect(ContextEpochRow)(row).pipe(Effect20.mapError(toRepositoryError6));
|
|
2186
2266
|
var sameEpoch = (record2, input) => record2.baseline === input.baseline && exports_shared_schema.canonicalEquals(record2.dynamicSourceIds, input.dynamicSourceIds);
|
|
2187
2267
|
var conflict2 = (executionId) => ContextEpochRepositoryError.make({ message: `Context epoch already exists with different payload: ${executionId}` });
|
|
2188
2268
|
var cloneRecord3 = (record2) => structuredClone(record2);
|
|
@@ -2296,30 +2376,30 @@ __export(exports_envelope_repository, {
|
|
|
2296
2376
|
EnvelopeReadyClaimMismatch: () => EnvelopeReadyClaimMismatch,
|
|
2297
2377
|
EnvelopeNotFound: () => EnvelopeNotFound
|
|
2298
2378
|
});
|
|
2299
|
-
import { Context as Context20, Effect as Effect24, Layer as Layer20, Schema as
|
|
2379
|
+
import { Context as Context20, Effect as Effect24, Layer as Layer20, Schema as Schema25 } from "effect";
|
|
2300
2380
|
|
|
2301
2381
|
// ../store-sql/src/envelope/envelope-records.ts
|
|
2302
|
-
import { Effect as Effect23, Schema as
|
|
2382
|
+
import { Effect as Effect23, Schema as Schema24 } from "effect";
|
|
2303
2383
|
import { SqlClient as SqlClient10 } from "effect/unstable/sql/SqlClient";
|
|
2304
2384
|
|
|
2305
2385
|
// ../store-sql/src/envelope/envelope-ready-records.ts
|
|
2306
|
-
import { Effect as Effect21, Schema as
|
|
2307
|
-
var DbTimestamp =
|
|
2308
|
-
var NullableDbTimestamp =
|
|
2309
|
-
var NullableString =
|
|
2310
|
-
var envelopeReadyRow =
|
|
2311
|
-
id:
|
|
2312
|
-
envelope_id:
|
|
2313
|
-
route_type:
|
|
2314
|
-
route_key:
|
|
2315
|
-
state:
|
|
2386
|
+
import { Effect as Effect21, Schema as Schema22 } from "effect";
|
|
2387
|
+
var DbTimestamp = Schema22.Union([Schema22.Date, Schema22.String, Schema22.Finite]);
|
|
2388
|
+
var NullableDbTimestamp = Schema22.Union([Schema22.Date, Schema22.String, Schema22.Finite, Schema22.Null]);
|
|
2389
|
+
var NullableString = Schema22.Union([Schema22.String, Schema22.Null]);
|
|
2390
|
+
var envelopeReadyRow = Schema22.Struct({
|
|
2391
|
+
id: Schema22.String,
|
|
2392
|
+
envelope_id: Schema22.String,
|
|
2393
|
+
route_type: Schema22.String,
|
|
2394
|
+
route_key: Schema22.String,
|
|
2395
|
+
state: Schema22.String,
|
|
2316
2396
|
available_at: DbTimestamp,
|
|
2317
|
-
attempt:
|
|
2397
|
+
attempt: Schema22.Finite,
|
|
2318
2398
|
claim_owner: NullableString,
|
|
2319
2399
|
claim_expires_at: NullableDbTimestamp,
|
|
2320
2400
|
last_error: NullableString,
|
|
2321
2401
|
idempotency_key: NullableString,
|
|
2322
|
-
metadata_json:
|
|
2402
|
+
metadata_json: Schema22.Unknown,
|
|
2323
2403
|
created_at: DbTimestamp,
|
|
2324
2404
|
updated_at: DbTimestamp,
|
|
2325
2405
|
claimed_at: NullableDbTimestamp,
|
|
@@ -2352,7 +2432,7 @@ var toReadyRecord = (row) => {
|
|
|
2352
2432
|
var makeEnvelopeReadyRecordOperations = ({ sql, ts, errors }) => {
|
|
2353
2433
|
const { EnvelopeRepositoryError, EnvelopeReadyNotFound, EnvelopeReadyClaimMismatch } = errors;
|
|
2354
2434
|
const toRepositoryError7 = (error) => EnvelopeRepositoryError.make({ message: String(error) });
|
|
2355
|
-
const decodeReadyRow = (row) =>
|
|
2435
|
+
const decodeReadyRow = (row) => Schema22.decodeUnknownEffect(envelopeReadyRow)(row).pipe(Effect21.mapError(toRepositoryError7));
|
|
2356
2436
|
const readyColumns = sql.literal("id, envelope_id, route_type, route_key, state, available_at, attempt, claim_owner, claim_expires_at, last_error, idempotency_key, metadata_json, created_at, updated_at, claimed_at, acknowledged_at");
|
|
2357
2437
|
const selectReadyById = (tenantId, id) => sql`
|
|
2358
2438
|
SELECT ${readyColumns}
|
|
@@ -2525,18 +2605,18 @@ var makeEnvelopeReadyRecordOperations = ({ sql, ts, errors }) => {
|
|
|
2525
2605
|
};
|
|
2526
2606
|
|
|
2527
2607
|
// ../store-sql/src/envelope/wait-records.ts
|
|
2528
|
-
import { Effect as Effect22, Schema as
|
|
2529
|
-
var DbTimestamp2 =
|
|
2530
|
-
var NullableDbTimestamp2 =
|
|
2531
|
-
var NullableString2 =
|
|
2532
|
-
var waitRow =
|
|
2533
|
-
id:
|
|
2534
|
-
execution_id:
|
|
2608
|
+
import { Effect as Effect22, Schema as Schema23 } from "effect";
|
|
2609
|
+
var DbTimestamp2 = Schema23.Union([Schema23.Date, Schema23.String, Schema23.Finite]);
|
|
2610
|
+
var NullableDbTimestamp2 = Schema23.Union([Schema23.Date, Schema23.String, Schema23.Finite, Schema23.Null]);
|
|
2611
|
+
var NullableString2 = Schema23.Union([Schema23.String, Schema23.Null]);
|
|
2612
|
+
var waitRow = Schema23.Struct({
|
|
2613
|
+
id: Schema23.String,
|
|
2614
|
+
execution_id: Schema23.String,
|
|
2535
2615
|
envelope_id: NullableString2,
|
|
2536
|
-
mode:
|
|
2616
|
+
mode: Schema23.String,
|
|
2537
2617
|
correlation_key: NullableString2,
|
|
2538
|
-
state:
|
|
2539
|
-
metadata_json:
|
|
2618
|
+
state: Schema23.String,
|
|
2619
|
+
metadata_json: Schema23.Unknown,
|
|
2540
2620
|
created_at: DbTimestamp2,
|
|
2541
2621
|
resolved_at: NullableDbTimestamp2
|
|
2542
2622
|
}).annotate({ identifier: "Relay.Wait.Row" });
|
|
@@ -2564,7 +2644,7 @@ var waitRecordOrdering = { compareWaitsDesc };
|
|
|
2564
2644
|
var makeWaitRecordOperations = ({ sql, ts, errors }) => {
|
|
2565
2645
|
const { EnvelopeRepositoryError, WaitNotFound } = errors;
|
|
2566
2646
|
const toRepositoryError7 = (error) => EnvelopeRepositoryError.make({ message: String(error) });
|
|
2567
|
-
const decodeWaitRow = (row) =>
|
|
2647
|
+
const decodeWaitRow = (row) => Schema23.decodeUnknownEffect(waitRow)(row).pipe(Effect22.mapError(toRepositoryError7));
|
|
2568
2648
|
const waitColumns = sql.literal("id, execution_id, envelope_id, mode, correlation_key, state, metadata_json, created_at, resolved_at");
|
|
2569
2649
|
const selectWaitById = (tenantId, id) => sql`
|
|
2570
2650
|
SELECT ${waitColumns}
|
|
@@ -2705,17 +2785,17 @@ var makeWaitRecordOperations = ({ sql, ts, errors }) => {
|
|
|
2705
2785
|
};
|
|
2706
2786
|
|
|
2707
2787
|
// ../store-sql/src/envelope/envelope-records.ts
|
|
2708
|
-
var DbTimestamp3 =
|
|
2709
|
-
var NullableString3 =
|
|
2710
|
-
var envelopeRow =
|
|
2711
|
-
id:
|
|
2712
|
-
execution_id:
|
|
2713
|
-
from_address_id:
|
|
2714
|
-
to_address_id:
|
|
2715
|
-
content_json:
|
|
2716
|
-
wait_json:
|
|
2788
|
+
var DbTimestamp3 = Schema24.Union([Schema24.Date, Schema24.String, Schema24.Finite]);
|
|
2789
|
+
var NullableString3 = Schema24.Union([Schema24.String, Schema24.Null]);
|
|
2790
|
+
var envelopeRow = Schema24.Struct({
|
|
2791
|
+
id: Schema24.String,
|
|
2792
|
+
execution_id: Schema24.String,
|
|
2793
|
+
from_address_id: Schema24.String,
|
|
2794
|
+
to_address_id: Schema24.String,
|
|
2795
|
+
content_json: Schema24.Unknown,
|
|
2796
|
+
wait_json: Schema24.Unknown,
|
|
2717
2797
|
correlation_key: NullableString3,
|
|
2718
|
-
metadata_json:
|
|
2798
|
+
metadata_json: Schema24.Unknown,
|
|
2719
2799
|
created_at: DbTimestamp3
|
|
2720
2800
|
}).annotate({ identifier: "Relay.Envelope.Row" });
|
|
2721
2801
|
var decodeMetadata3 = (value) => decodeJson(value);
|
|
@@ -2744,7 +2824,7 @@ var makeEnvelopeRepository = (errors) => Effect23.gen(function* () {
|
|
|
2744
2824
|
const toRepositoryError7 = (error) => EnvelopeRepositoryError.make({ message: String(error) });
|
|
2745
2825
|
const ts = (millis) => timestampParam(sql, millis);
|
|
2746
2826
|
const envelopeColumns = sql.literal("id, execution_id, from_address_id, to_address_id, content_json, wait_json, correlation_key, metadata_json, created_at");
|
|
2747
|
-
const decodeEnvelopeRow = (row) =>
|
|
2827
|
+
const decodeEnvelopeRow = (row) => Schema24.decodeUnknownEffect(envelopeRow)(row).pipe(Effect23.mapError(toRepositoryError7));
|
|
2748
2828
|
const acceptEnvelope = Effect23.fn("EnvelopeRepository.acceptEnvelope")(function* (input) {
|
|
2749
2829
|
const tenantId = yield* current();
|
|
2750
2830
|
const envelope = input.envelope;
|
|
@@ -2804,36 +2884,36 @@ var makeEnvelopeRepository = (errors) => Effect23.gen(function* () {
|
|
|
2804
2884
|
});
|
|
2805
2885
|
|
|
2806
2886
|
// ../store-sql/src/envelope/envelope-repository.ts
|
|
2807
|
-
var WaitState =
|
|
2887
|
+
var WaitState = Schema25.Literals(["open", "resolved", "timed_out", "cancelled"]).annotate({
|
|
2808
2888
|
identifier: "Relay.Store.WaitState"
|
|
2809
2889
|
});
|
|
2810
|
-
var EnvelopeReadyState =
|
|
2890
|
+
var EnvelopeReadyState = Schema25.Literals(["ready", "claimed", "acknowledged"]).annotate({
|
|
2811
2891
|
identifier: "Relay.Store.EnvelopeReadyState"
|
|
2812
2892
|
});
|
|
2813
2893
|
|
|
2814
|
-
class EnvelopeRepositoryError extends
|
|
2815
|
-
message:
|
|
2894
|
+
class EnvelopeRepositoryError extends Schema25.TaggedErrorClass()("EnvelopeRepositoryError", {
|
|
2895
|
+
message: Schema25.String
|
|
2816
2896
|
}) {
|
|
2817
2897
|
}
|
|
2818
2898
|
|
|
2819
|
-
class EnvelopeNotFound extends
|
|
2899
|
+
class EnvelopeNotFound extends Schema25.TaggedErrorClass()("EnvelopeNotFound", {
|
|
2820
2900
|
id: exports_ids_schema.EnvelopeId
|
|
2821
2901
|
}) {
|
|
2822
2902
|
}
|
|
2823
2903
|
|
|
2824
|
-
class WaitNotFound extends
|
|
2904
|
+
class WaitNotFound extends Schema25.TaggedErrorClass()("WaitNotFound", {
|
|
2825
2905
|
id: exports_ids_schema.WaitId
|
|
2826
2906
|
}) {
|
|
2827
2907
|
}
|
|
2828
2908
|
|
|
2829
|
-
class EnvelopeReadyNotFound extends
|
|
2909
|
+
class EnvelopeReadyNotFound extends Schema25.TaggedErrorClass()("EnvelopeReadyNotFound", {
|
|
2830
2910
|
id: exports_ids_schema.EnvelopeReadyId
|
|
2831
2911
|
}) {
|
|
2832
2912
|
}
|
|
2833
2913
|
|
|
2834
|
-
class EnvelopeReadyClaimMismatch extends
|
|
2914
|
+
class EnvelopeReadyClaimMismatch extends Schema25.TaggedErrorClass()("EnvelopeReadyClaimMismatch", {
|
|
2835
2915
|
id: exports_ids_schema.EnvelopeReadyId,
|
|
2836
|
-
worker_id:
|
|
2916
|
+
worker_id: Schema25.String
|
|
2837
2917
|
}) {
|
|
2838
2918
|
}
|
|
2839
2919
|
|
|
@@ -3052,35 +3132,35 @@ __export(exports_resident_repository, {
|
|
|
3052
3132
|
Service: () => Service23,
|
|
3053
3133
|
ResidentRepositoryError: () => ResidentRepositoryError
|
|
3054
3134
|
});
|
|
3055
|
-
import { Clock as Clock2, Context as Context21, Effect as Effect25, Layer as Layer21, Ref as Ref4, Schema as
|
|
3135
|
+
import { Clock as Clock2, Context as Context21, Effect as Effect25, Layer as Layer21, Ref as Ref4, Schema as Schema26, SchemaGetter } from "effect";
|
|
3056
3136
|
import { SqlClient as SqlClient11 } from "effect/unstable/sql/SqlClient";
|
|
3057
|
-
class ResidentRepositoryError extends
|
|
3058
|
-
message:
|
|
3137
|
+
class ResidentRepositoryError extends Schema26.TaggedErrorClass()("ResidentRepositoryError", {
|
|
3138
|
+
message: Schema26.String
|
|
3059
3139
|
}) {
|
|
3060
3140
|
}
|
|
3061
3141
|
|
|
3062
3142
|
class Service23 extends Context21.Service()("@relayfx/store-sql/resident/resident-repository/Service") {
|
|
3063
3143
|
}
|
|
3064
|
-
var KindRow =
|
|
3065
|
-
kind:
|
|
3066
|
-
agent_id:
|
|
3067
|
-
inbox_policy_json:
|
|
3068
|
-
state_enabled:
|
|
3144
|
+
var KindRow = Schema26.Struct({
|
|
3145
|
+
kind: Schema26.String,
|
|
3146
|
+
agent_id: Schema26.String,
|
|
3147
|
+
inbox_policy_json: Schema26.Unknown,
|
|
3148
|
+
state_enabled: Schema26.NullOr(Schema26.Union([Schema26.Boolean, Schema26.Finite])).pipe(Schema26.decodeTo(Schema26.NullOr(Schema26.Boolean), {
|
|
3069
3149
|
decode: SchemaGetter.transform((value) => value === null ? null : value === true || value === 1),
|
|
3070
3150
|
encode: SchemaGetter.transform((value) => value === null ? null : value ? 1 : 0)
|
|
3071
3151
|
})),
|
|
3072
|
-
continue_as_new_after_turns:
|
|
3073
|
-
metadata_json:
|
|
3074
|
-
});
|
|
3075
|
-
var InstanceRow =
|
|
3076
|
-
kind:
|
|
3077
|
-
key:
|
|
3078
|
-
address_id:
|
|
3079
|
-
execution_id:
|
|
3080
|
-
generation:
|
|
3081
|
-
status:
|
|
3082
|
-
created_at:
|
|
3083
|
-
destroyed_at:
|
|
3152
|
+
continue_as_new_after_turns: Schema26.NullOr(Schema26.Finite),
|
|
3153
|
+
metadata_json: Schema26.Unknown
|
|
3154
|
+
});
|
|
3155
|
+
var InstanceRow = Schema26.Struct({
|
|
3156
|
+
kind: Schema26.String,
|
|
3157
|
+
key: Schema26.String,
|
|
3158
|
+
address_id: Schema26.String,
|
|
3159
|
+
execution_id: Schema26.String,
|
|
3160
|
+
generation: Schema26.Finite,
|
|
3161
|
+
status: Schema26.String,
|
|
3162
|
+
created_at: Schema26.Union([Schema26.Date, Schema26.String, Schema26.Finite]),
|
|
3163
|
+
destroyed_at: Schema26.NullOr(Schema26.Union([Schema26.Date, Schema26.String, Schema26.Finite]))
|
|
3084
3164
|
});
|
|
3085
3165
|
var repositoryError2 = (error) => ResidentRepositoryError.make({ message: String(error) });
|
|
3086
3166
|
var toKind = (row) => ({
|
|
@@ -3101,8 +3181,8 @@ var toInstance = (row) => ({
|
|
|
3101
3181
|
created_at: fromDbTimestamp(row.created_at),
|
|
3102
3182
|
...row.destroyed_at === null ? {} : { destroyed_at: fromDbTimestamp(row.destroyed_at) }
|
|
3103
3183
|
});
|
|
3104
|
-
var decodeKind = (row) =>
|
|
3105
|
-
var decodeInstance = (row) =>
|
|
3184
|
+
var decodeKind = (row) => Schema26.decodeUnknownEffect(KindRow)(row).pipe(Effect25.map(toKind), Effect25.mapError(repositoryError2));
|
|
3185
|
+
var decodeInstance = (row) => Schema26.decodeUnknownEffect(InstanceRow)(row).pipe(Effect25.map(toInstance), Effect25.mapError(repositoryError2));
|
|
3106
3186
|
var layer17 = Layer21.effect(Service23, Effect25.gen(function* () {
|
|
3107
3187
|
const sql = yield* SqlClient11;
|
|
3108
3188
|
const getKind = Effect25.fn("ResidentRepository.getKind")(function* (kind) {
|
|
@@ -3264,7 +3344,7 @@ __export(exports_execution_event_repository, {
|
|
|
3264
3344
|
ExecutionEventCursorNotFound: () => ExecutionEventCursorNotFound,
|
|
3265
3345
|
DuplicateExecutionEvent: () => DuplicateExecutionEvent
|
|
3266
3346
|
});
|
|
3267
|
-
import { Context as Context23, Effect as Effect29, Layer as Layer25, Schema as
|
|
3347
|
+
import { Context as Context23, Effect as Effect29, Layer as Layer25, Schema as Schema28, Stream as Stream4 } from "effect";
|
|
3268
3348
|
|
|
3269
3349
|
// ../store-sql/src/database/notification-bus.ts
|
|
3270
3350
|
var exports_notification_bus = {};
|
|
@@ -3458,7 +3538,7 @@ var makeMemoryLayer = (repository) => {
|
|
|
3458
3538
|
};
|
|
3459
3539
|
|
|
3460
3540
|
// ../store-sql/src/execution/execution-event-repository-sql.ts
|
|
3461
|
-
import { Effect as Effect28, Filter, Layer as Layer24, Option as Option3, Schema as
|
|
3541
|
+
import { Effect as Effect28, Filter, Layer as Layer24, Option as Option3, Schema as Schema27, Stream as Stream3 } from "effect";
|
|
3462
3542
|
import { SqlClient as SqlClient13 } from "effect/unstable/sql/SqlClient";
|
|
3463
3543
|
var pageResult2 = (events, limit, direction) => {
|
|
3464
3544
|
const hasMore = events.length > limit;
|
|
@@ -3502,7 +3582,7 @@ var makeLayer = (repository) => {
|
|
|
3502
3582
|
};
|
|
3503
3583
|
};
|
|
3504
3584
|
const toRepositoryError7 = (error) => ExecutionEventRepositoryError.make({ message: String(error) });
|
|
3505
|
-
const decodeRow7 = (row) =>
|
|
3585
|
+
const decodeRow7 = (row) => Schema27.decodeUnknownEffect(ExecutionEventRow)(row).pipe(Effect28.mapError(toRepositoryError7));
|
|
3506
3586
|
const parsePointer = (executionId, payload) => {
|
|
3507
3587
|
const separator = payload.lastIndexOf(":");
|
|
3508
3588
|
if (separator <= 0 || separator === payload.length - 1)
|
|
@@ -3616,7 +3696,7 @@ var makeLayer = (repository) => {
|
|
|
3616
3696
|
return yield* ExecutionEventRepositoryError.make({ message: "Execution event append returned no row" });
|
|
3617
3697
|
}
|
|
3618
3698
|
return toEvent(yield* decodeRow7(row));
|
|
3619
|
-
})).pipe(Effect28.mapError((error) =>
|
|
3699
|
+
})).pipe(Effect28.mapError((error) => Schema27.is(DuplicateExecutionEvent)(error) || Schema27.is(ExecutionEventOrderViolation)(error) ? error : toRepositoryError7(error)));
|
|
3620
3700
|
});
|
|
3621
3701
|
const appendNext = Effect28.fn("ExecutionEventRepository.appendNext")(function* (input) {
|
|
3622
3702
|
const tenantId = yield* current();
|
|
@@ -3654,7 +3734,7 @@ var makeLayer = (repository) => {
|
|
|
3654
3734
|
return yield* ExecutionEventRepositoryError.make({ message: "Execution event append returned no row" });
|
|
3655
3735
|
}
|
|
3656
3736
|
return { event: toEvent(yield* decodeRow7(row)), inserted: true };
|
|
3657
|
-
})).pipe(Effect28.mapError((error) =>
|
|
3737
|
+
})).pipe(Effect28.mapError((error) => Schema27.is(DuplicateExecutionEvent)(error) ? error : toRepositoryError7(error)));
|
|
3658
3738
|
});
|
|
3659
3739
|
const list4 = Effect28.fn("ExecutionEventRepository.list")(function* (input) {
|
|
3660
3740
|
const tenantId = yield* current();
|
|
@@ -3739,10 +3819,10 @@ var makeLayer = (repository) => {
|
|
|
3739
3819
|
const row = rows[0];
|
|
3740
3820
|
return row === undefined ? Option3.none() : Option3.some(toEvent(yield* decodeRow7(row)));
|
|
3741
3821
|
});
|
|
3742
|
-
const AggregateRow =
|
|
3743
|
-
value:
|
|
3822
|
+
const AggregateRow = Schema27.Struct({
|
|
3823
|
+
value: Schema27.NullishOr(Schema27.Union([Schema27.Finite, Schema27.String, Schema27.BigInt]))
|
|
3744
3824
|
});
|
|
3745
|
-
const decodeAggregate = (row) =>
|
|
3825
|
+
const decodeAggregate = (row) => Schema27.decodeUnknownEffect(AggregateRow)(row).pipe(Effect28.mapError(toRepositoryError7));
|
|
3746
3826
|
const maxSequence = Effect28.fn("ExecutionEventRepository.maxSequence")(function* (executionId) {
|
|
3747
3827
|
const tenantId = yield* current();
|
|
3748
3828
|
const rows = yield* sql`
|
|
@@ -3856,43 +3936,43 @@ var makeLayer = (repository) => {
|
|
|
3856
3936
|
// ../store-sql/src/execution/execution-event-repository.ts
|
|
3857
3937
|
var executionEventsChannel = "relay_execution_events";
|
|
3858
3938
|
|
|
3859
|
-
class DuplicateExecutionEvent extends
|
|
3939
|
+
class DuplicateExecutionEvent extends Schema28.TaggedErrorClass()("DuplicateExecutionEvent", {
|
|
3860
3940
|
execution_id: exports_ids_schema.ExecutionId,
|
|
3861
3941
|
sequence: exports_execution_schema.ExecutionEventSequence,
|
|
3862
3942
|
cursor: exports_shared_schema.NonEmptyString
|
|
3863
3943
|
}) {
|
|
3864
3944
|
}
|
|
3865
3945
|
|
|
3866
|
-
class ExecutionEventOrderViolation extends
|
|
3946
|
+
class ExecutionEventOrderViolation extends Schema28.TaggedErrorClass()("ExecutionEventOrderViolation", {
|
|
3867
3947
|
execution_id: exports_ids_schema.ExecutionId,
|
|
3868
3948
|
sequence: exports_execution_schema.ExecutionEventSequence,
|
|
3869
3949
|
previous_sequence: exports_execution_schema.ExecutionEventSequence
|
|
3870
3950
|
}) {
|
|
3871
3951
|
}
|
|
3872
3952
|
|
|
3873
|
-
class ExecutionEventCursorNotFound extends
|
|
3953
|
+
class ExecutionEventCursorNotFound extends Schema28.TaggedErrorClass()("ExecutionEventCursorNotFound", {
|
|
3874
3954
|
execution_id: exports_ids_schema.ExecutionId,
|
|
3875
3955
|
cursor: exports_shared_schema.NonEmptyString
|
|
3876
3956
|
}) {
|
|
3877
3957
|
}
|
|
3878
3958
|
|
|
3879
|
-
class ExecutionEventRepositoryError extends
|
|
3880
|
-
message:
|
|
3959
|
+
class ExecutionEventRepositoryError extends Schema28.TaggedErrorClass()("ExecutionEventRepositoryError", {
|
|
3960
|
+
message: Schema28.String
|
|
3881
3961
|
}) {
|
|
3882
3962
|
}
|
|
3883
3963
|
|
|
3884
3964
|
class Service25 extends Context23.Service()("@relayfx/store-sql/execution/execution-event-repository/Service") {
|
|
3885
3965
|
}
|
|
3886
|
-
var ExecutionEventRow =
|
|
3887
|
-
id:
|
|
3888
|
-
execution_id:
|
|
3889
|
-
child_execution_id:
|
|
3890
|
-
type:
|
|
3891
|
-
sequence:
|
|
3892
|
-
cursor:
|
|
3893
|
-
content_json:
|
|
3894
|
-
data_json:
|
|
3895
|
-
created_at:
|
|
3966
|
+
var ExecutionEventRow = Schema28.Struct({
|
|
3967
|
+
id: Schema28.String,
|
|
3968
|
+
execution_id: Schema28.String,
|
|
3969
|
+
child_execution_id: Schema28.NullishOr(Schema28.String),
|
|
3970
|
+
type: Schema28.String,
|
|
3971
|
+
sequence: Schema28.Union([Schema28.Finite, Schema28.String]),
|
|
3972
|
+
cursor: Schema28.String,
|
|
3973
|
+
content_json: Schema28.NullishOr(Schema28.Unknown),
|
|
3974
|
+
data_json: Schema28.Unknown,
|
|
3975
|
+
created_at: Schema28.Union([Schema28.Date, Schema28.String, Schema28.Finite])
|
|
3896
3976
|
}).annotate({ identifier: "Relay.ExecutionEvent.Row" });
|
|
3897
3977
|
var layer18 = makeLayer({
|
|
3898
3978
|
DuplicateExecutionEvent,
|
|
@@ -3982,19 +4062,19 @@ __export(exports_execution_repository, {
|
|
|
3982
4062
|
ExecutionNotFound: () => ExecutionNotFound2,
|
|
3983
4063
|
DuplicateExecution: () => DuplicateExecution
|
|
3984
4064
|
});
|
|
3985
|
-
import { Context as Context24, Effect as Effect30, Filter as Filter2, Layer as Layer26, Option as Option5, PubSub as PubSub3, Schema as
|
|
4065
|
+
import { Context as Context24, Effect as Effect30, Filter as Filter2, Layer as Layer26, Option as Option5, PubSub as PubSub3, Schema as Schema29, Stream as Stream5 } from "effect";
|
|
3986
4066
|
import { SqlClient as SqlClient14 } from "effect/unstable/sql/SqlClient";
|
|
3987
|
-
class ExecutionRepositoryError extends
|
|
3988
|
-
message:
|
|
4067
|
+
class ExecutionRepositoryError extends Schema29.TaggedErrorClass()("ExecutionRepositoryError", {
|
|
4068
|
+
message: Schema29.String
|
|
3989
4069
|
}) {
|
|
3990
4070
|
}
|
|
3991
4071
|
|
|
3992
|
-
class DuplicateExecution extends
|
|
4072
|
+
class DuplicateExecution extends Schema29.TaggedErrorClass()("DuplicateExecution", {
|
|
3993
4073
|
id: exports_ids_schema.ExecutionId
|
|
3994
4074
|
}) {
|
|
3995
4075
|
}
|
|
3996
4076
|
|
|
3997
|
-
class ExecutionNotFound2 extends
|
|
4077
|
+
class ExecutionNotFound2 extends Schema29.TaggedErrorClass()("ExecutionNotFound", {
|
|
3998
4078
|
id: exports_ids_schema.ExecutionId
|
|
3999
4079
|
}) {
|
|
4000
4080
|
}
|
|
@@ -4002,18 +4082,18 @@ var executionsChangedChannel = "relay_executions_changed";
|
|
|
4002
4082
|
|
|
4003
4083
|
class Service26 extends Context24.Service()("@relayfx/store-sql/execution/execution-repository/Service") {
|
|
4004
4084
|
}
|
|
4005
|
-
var ExecutionRow =
|
|
4006
|
-
id:
|
|
4007
|
-
root_address_id:
|
|
4008
|
-
session_id:
|
|
4009
|
-
status:
|
|
4010
|
-
agent_id:
|
|
4011
|
-
agent_revision:
|
|
4012
|
-
agent_snapshot_json:
|
|
4013
|
-
agent_tool_input_schema_digests_json:
|
|
4014
|
-
metadata_json:
|
|
4015
|
-
created_at:
|
|
4016
|
-
updated_at:
|
|
4085
|
+
var ExecutionRow = Schema29.Struct({
|
|
4086
|
+
id: Schema29.String,
|
|
4087
|
+
root_address_id: Schema29.String,
|
|
4088
|
+
session_id: Schema29.NullishOr(Schema29.String),
|
|
4089
|
+
status: Schema29.String,
|
|
4090
|
+
agent_id: Schema29.NullishOr(Schema29.String),
|
|
4091
|
+
agent_revision: Schema29.NullishOr(Schema29.Finite),
|
|
4092
|
+
agent_snapshot_json: Schema29.NullishOr(Schema29.Unknown),
|
|
4093
|
+
agent_tool_input_schema_digests_json: Schema29.Unknown,
|
|
4094
|
+
metadata_json: Schema29.Unknown,
|
|
4095
|
+
created_at: Schema29.Union([Schema29.Date, Schema29.String, Schema29.Finite]),
|
|
4096
|
+
updated_at: Schema29.Union([Schema29.Date, Schema29.String, Schema29.Finite])
|
|
4017
4097
|
}).annotate({ identifier: "Relay.Execution.Row" });
|
|
4018
4098
|
var metadata4 = (input) => input ?? {};
|
|
4019
4099
|
var nonEmptyDigests2 = (digests) => digests === undefined || Object.keys(digests).length === 0 ? undefined : structuredClone(digests);
|
|
@@ -4036,7 +4116,7 @@ var validateCreateInput = (input) => {
|
|
|
4036
4116
|
}
|
|
4037
4117
|
return Effect30.void;
|
|
4038
4118
|
};
|
|
4039
|
-
var cloneAgentDefinition = (definition) =>
|
|
4119
|
+
var cloneAgentDefinition = (definition) => Schema29.decodeUnknownSync(exports_agent_schema.Definition)(globalThis.structuredClone(definition));
|
|
4040
4120
|
var cloneRecord4 = (record2) => ({
|
|
4041
4121
|
...record2,
|
|
4042
4122
|
metadata: globalThis.structuredClone(record2.metadata),
|
|
@@ -4065,9 +4145,9 @@ var parsePointer = (tenantId, payload) => {
|
|
|
4065
4145
|
const prefix = `${tenantId}:`;
|
|
4066
4146
|
if (!payload.startsWith(prefix) || payload.length === prefix.length)
|
|
4067
4147
|
return Option5.none();
|
|
4068
|
-
return
|
|
4148
|
+
return Schema29.decodeUnknownOption(exports_ids_schema.ExecutionId)(payload.slice(prefix.length));
|
|
4069
4149
|
};
|
|
4070
|
-
var decodeRow7 = (row) =>
|
|
4150
|
+
var decodeRow7 = (row) => Schema29.decodeUnknownEffect(ExecutionRow)(row).pipe(Effect30.mapError(toRepositoryError7));
|
|
4071
4151
|
var maxListLimit = 100;
|
|
4072
4152
|
var defaultListLimit = 50;
|
|
4073
4153
|
var listLimit = (input) => Math.min(Math.max(input.limit ?? defaultListLimit, 1), maxListLimit);
|
|
@@ -4332,29 +4412,29 @@ __export(exports_execution_state_repository, {
|
|
|
4332
4412
|
ExecutionStateRepositoryError: () => ExecutionStateRepositoryError,
|
|
4333
4413
|
ExecutionStateExecutionNotFound: () => ExecutionStateExecutionNotFound
|
|
4334
4414
|
});
|
|
4335
|
-
import { Context as Context25, Effect as Effect31, Layer as Layer27, Option as Option6, Schema as
|
|
4415
|
+
import { Context as Context25, Effect as Effect31, Layer as Layer27, Option as Option6, Schema as Schema30 } from "effect";
|
|
4336
4416
|
import { SqlClient as SqlClient15 } from "effect/unstable/sql/SqlClient";
|
|
4337
|
-
class StateVersionConflict2 extends
|
|
4417
|
+
class StateVersionConflict2 extends Schema30.TaggedErrorClass()("StateVersionConflict", {
|
|
4338
4418
|
execution_id: exports_ids_schema.ExecutionId,
|
|
4339
|
-
key:
|
|
4340
|
-
expected_version:
|
|
4341
|
-
actual_version:
|
|
4419
|
+
key: Schema30.String,
|
|
4420
|
+
expected_version: Schema30.Int,
|
|
4421
|
+
actual_version: Schema30.Int
|
|
4342
4422
|
}) {
|
|
4343
4423
|
}
|
|
4344
4424
|
|
|
4345
|
-
class ExecutionStateRepositoryError extends
|
|
4425
|
+
class ExecutionStateRepositoryError extends Schema30.TaggedErrorClass()("ExecutionStateRepositoryError", { message: Schema30.String }) {
|
|
4346
4426
|
}
|
|
4347
4427
|
|
|
4348
|
-
class ExecutionStateExecutionNotFound extends
|
|
4428
|
+
class ExecutionStateExecutionNotFound extends Schema30.TaggedErrorClass()("ExecutionStateExecutionNotFound", { execution_id: exports_ids_schema.ExecutionId }) {
|
|
4349
4429
|
}
|
|
4350
4430
|
|
|
4351
|
-
class StateIdempotencyConflict extends
|
|
4431
|
+
class StateIdempotencyConflict extends Schema30.TaggedErrorClass()("StateIdempotencyConflict", {
|
|
4352
4432
|
execution_id: exports_ids_schema.ExecutionId,
|
|
4353
|
-
idempotency_key:
|
|
4354
|
-
recorded_key:
|
|
4355
|
-
requested_key:
|
|
4356
|
-
recorded_op:
|
|
4357
|
-
requested_op:
|
|
4433
|
+
idempotency_key: Schema30.String,
|
|
4434
|
+
recorded_key: Schema30.String,
|
|
4435
|
+
requested_key: Schema30.String,
|
|
4436
|
+
recorded_op: Schema30.Literals(["put", "delete"]),
|
|
4437
|
+
requested_op: Schema30.Literals(["put", "delete"])
|
|
4358
4438
|
}) {
|
|
4359
4439
|
}
|
|
4360
4440
|
|
|
@@ -4570,7 +4650,7 @@ var layer20 = Layer27.effect(Service27, Effect31.gen(function* () {
|
|
|
4570
4650
|
})).pipe(Effect31.tap((record2) => eventRepository.findByCursor({
|
|
4571
4651
|
executionId: input.executionId,
|
|
4572
4652
|
cursor: `${input.executionId}:state:${input.key}:${record2.version}`
|
|
4573
|
-
}).pipe(Effect31.flatMap(Option6.match({ onNone: () => Effect31.void, onSome: eventRepository.notifyAppended })))), Effect31.mapError((cause) =>
|
|
4653
|
+
}).pipe(Effect31.flatMap(Option6.match({ onNone: () => Effect31.void, onSome: eventRepository.notifyAppended })))), Effect31.mapError((cause) => Schema30.is(StateVersionConflict2)(cause) || Schema30.is(StateIdempotencyConflict)(cause) || Schema30.is(ExecutionStateExecutionNotFound)(cause) ? cause : error(cause)));
|
|
4574
4654
|
});
|
|
4575
4655
|
const remove = Effect31.fn("ExecutionStateRepository.remove")(function* (input) {
|
|
4576
4656
|
const tenant = yield* current();
|
|
@@ -4615,7 +4695,7 @@ var layer20 = Layer27.effect(Service27, Effect31.gen(function* () {
|
|
|
4615
4695
|
})).pipe(Effect31.tap((record2) => record2 === undefined ? Effect31.void : eventRepository.findByCursor({
|
|
4616
4696
|
executionId: input.executionId,
|
|
4617
4697
|
cursor: `${input.executionId}:state:${input.key}:${record2.version + 1}`
|
|
4618
|
-
}).pipe(Effect31.flatMap(Option6.match({ onNone: () => Effect31.void, onSome: eventRepository.notifyAppended })))), Effect31.mapError((cause) =>
|
|
4698
|
+
}).pipe(Effect31.flatMap(Option6.match({ onNone: () => Effect31.void, onSome: eventRepository.notifyAppended })))), Effect31.mapError((cause) => Schema30.is(StateVersionConflict2)(cause) || Schema30.is(StateIdempotencyConflict)(cause) || Schema30.is(ExecutionStateExecutionNotFound)(cause) ? cause : error(cause)));
|
|
4619
4699
|
});
|
|
4620
4700
|
const list6 = Effect31.fn("ExecutionStateRepository.list")(function* (input) {
|
|
4621
4701
|
const tenant = yield* current();
|
|
@@ -4630,26 +4710,26 @@ var layer20 = Layer27.effect(Service27, Effect31.gen(function* () {
|
|
|
4630
4710
|
}));
|
|
4631
4711
|
var testLayer22 = (implementation) => Layer27.succeed(Service27, Service27.of(implementation));
|
|
4632
4712
|
// ../store-sql/src/idempotency/idempotency-repository.ts
|
|
4633
|
-
import { Context as Context26, Effect as Effect32, HashMap, Layer as Layer28, Option as Option7, Ref as Ref5, Schema as
|
|
4713
|
+
import { Context as Context26, Effect as Effect32, HashMap, Layer as Layer28, Option as Option7, Ref as Ref5, Schema as Schema31, Semaphore as Semaphore3 } from "effect";
|
|
4634
4714
|
import { SqlClient as SqlClient16 } from "effect/unstable/sql/SqlClient";
|
|
4635
|
-
class IdempotencyRepositoryError extends
|
|
4636
|
-
message:
|
|
4715
|
+
class IdempotencyRepositoryError extends Schema31.TaggedErrorClass()("IdempotencyRepositoryError", {
|
|
4716
|
+
message: Schema31.String
|
|
4637
4717
|
}) {
|
|
4638
4718
|
}
|
|
4639
4719
|
|
|
4640
4720
|
class Service28 extends Context26.Service()("@relayfx/store-sql/idempotency/idempotency-repository/Service") {
|
|
4641
4721
|
}
|
|
4642
|
-
var IdempotencyRow =
|
|
4643
|
-
scope:
|
|
4644
|
-
operation:
|
|
4645
|
-
key:
|
|
4646
|
-
result_json:
|
|
4647
|
-
metadata_json:
|
|
4648
|
-
created_at:
|
|
4649
|
-
expires_at:
|
|
4722
|
+
var IdempotencyRow = Schema31.Struct({
|
|
4723
|
+
scope: Schema31.String,
|
|
4724
|
+
operation: Schema31.String,
|
|
4725
|
+
key: Schema31.String,
|
|
4726
|
+
result_json: Schema31.NullishOr(Schema31.Unknown),
|
|
4727
|
+
metadata_json: Schema31.Unknown,
|
|
4728
|
+
created_at: Schema31.Union([Schema31.Date, Schema31.String, Schema31.Finite]),
|
|
4729
|
+
expires_at: Schema31.NullishOr(Schema31.Union([Schema31.Date, Schema31.String, Schema31.Finite]))
|
|
4650
4730
|
}).annotate({ identifier: "Relay.Idempotency.Row" });
|
|
4651
|
-
var AffectedRow =
|
|
4652
|
-
affected:
|
|
4731
|
+
var AffectedRow = Schema31.Struct({
|
|
4732
|
+
affected: Schema31.Union([Schema31.Finite, Schema31.String, Schema31.BigInt])
|
|
4653
4733
|
}).annotate({ identifier: "Relay.Idempotency.AffectedRow" });
|
|
4654
4734
|
var operationId = (input) => `${input.scope}:${input.operation}:${input.key}`;
|
|
4655
4735
|
var metadata5 = (input) => input ?? {};
|
|
@@ -4665,8 +4745,8 @@ var toRecord7 = (row) => {
|
|
|
4665
4745
|
...expiresAt === undefined ? {} : { expiresAt }
|
|
4666
4746
|
};
|
|
4667
4747
|
};
|
|
4668
|
-
var toRepositoryError8 = (error2) =>
|
|
4669
|
-
var decodeRow8 = (row) =>
|
|
4748
|
+
var toRepositoryError8 = (error2) => Schema31.is(IdempotencyRepositoryError)(error2) ? error2 : IdempotencyRepositoryError.make({ message: String(error2) });
|
|
4749
|
+
var decodeRow8 = (row) => Schema31.decodeUnknownEffect(IdempotencyRow)(row).pipe(Effect32.mapError(toRepositoryError8));
|
|
4670
4750
|
var layer21 = Layer28.effect(Service28, Effect32.gen(function* () {
|
|
4671
4751
|
const sql = yield* SqlClient16;
|
|
4672
4752
|
const keyColumn = sql.onDialectOrElse({
|
|
@@ -4708,7 +4788,7 @@ var layer21 = Layer28.effect(Service28, Effect32.gen(function* () {
|
|
|
4708
4788
|
mysql: () => (tenantId, input) => Effect32.gen(function* () {
|
|
4709
4789
|
yield* sql`INSERT IGNORE ${claimBody(tenantId, input)}`;
|
|
4710
4790
|
const rows = yield* sql`SELECT ROW_COUNT() AS affected`;
|
|
4711
|
-
const decoded = yield*
|
|
4791
|
+
const decoded = yield* Schema31.decodeUnknownEffect(AffectedRow)(rows[0]);
|
|
4712
4792
|
return Number(decoded.affected) > 0;
|
|
4713
4793
|
}),
|
|
4714
4794
|
orElse: () => (tenantId, input) => sql`INSERT ${claimBody(tenantId, input)} ON CONFLICT DO NOTHING RETURNING scope`.pipe(Effect32.map((rows) => rows.length > 0))
|
|
@@ -4798,34 +4878,34 @@ __export(exports_inbox_repository, {
|
|
|
4798
4878
|
Service: () => Service29,
|
|
4799
4879
|
InboxRepositoryError: () => InboxRepositoryError
|
|
4800
4880
|
});
|
|
4801
|
-
import { Context as Context27, Effect as Effect33, Layer as Layer29, Ref as Ref6, Schema as
|
|
4881
|
+
import { Context as Context27, Effect as Effect33, Layer as Layer29, Ref as Ref6, Schema as Schema32 } from "effect";
|
|
4802
4882
|
import { SqlClient as SqlClient17 } from "effect/unstable/sql/SqlClient";
|
|
4803
|
-
class InboxRepositoryError extends
|
|
4804
|
-
message:
|
|
4883
|
+
class InboxRepositoryError extends Schema32.TaggedErrorClass()("InboxRepositoryError", {
|
|
4884
|
+
message: Schema32.String
|
|
4805
4885
|
}) {
|
|
4806
4886
|
}
|
|
4807
4887
|
|
|
4808
4888
|
class Service29 extends Context27.Service()("@relayfx/store-sql/inbox/inbox-repository/Service") {
|
|
4809
4889
|
}
|
|
4810
|
-
var error2 = (e) =>
|
|
4890
|
+
var error2 = (e) => Schema32.is(InboxRepositoryError)(e) ? e : InboxRepositoryError.make({
|
|
4811
4891
|
message: `${e.message}: ${String(e.cause)}`
|
|
4812
4892
|
});
|
|
4813
|
-
var DbNumber =
|
|
4814
|
-
var InboxRow =
|
|
4815
|
-
execution_id:
|
|
4893
|
+
var DbNumber = Schema32.Union([Schema32.Finite, Schema32.FiniteFromString]);
|
|
4894
|
+
var InboxRow = Schema32.Struct({
|
|
4895
|
+
execution_id: Schema32.String,
|
|
4816
4896
|
sequence: DbNumber,
|
|
4817
|
-
from_address_id:
|
|
4818
|
-
envelope_id:
|
|
4819
|
-
content_json:
|
|
4820
|
-
reply_wait_id:
|
|
4821
|
-
correlation_key:
|
|
4822
|
-
idempotency_key:
|
|
4823
|
-
drain_id:
|
|
4824
|
-
consumed_at:
|
|
4825
|
-
metadata_json:
|
|
4826
|
-
created_at:
|
|
4827
|
-
});
|
|
4828
|
-
var rowToMessage = (value) =>
|
|
4897
|
+
from_address_id: Schema32.String,
|
|
4898
|
+
envelope_id: Schema32.NullOr(Schema32.String),
|
|
4899
|
+
content_json: Schema32.Unknown,
|
|
4900
|
+
reply_wait_id: Schema32.NullOr(Schema32.String),
|
|
4901
|
+
correlation_key: Schema32.NullOr(Schema32.String),
|
|
4902
|
+
idempotency_key: Schema32.NullOr(Schema32.String),
|
|
4903
|
+
drain_id: Schema32.NullOr(Schema32.String),
|
|
4904
|
+
consumed_at: Schema32.NullOr(Schema32.Union([Schema32.Date, Schema32.String, Schema32.Finite])),
|
|
4905
|
+
metadata_json: Schema32.NullOr(Schema32.Unknown),
|
|
4906
|
+
created_at: Schema32.Union([Schema32.Date, Schema32.String, Schema32.Finite])
|
|
4907
|
+
});
|
|
4908
|
+
var rowToMessage = (value) => Schema32.decodeUnknownEffect(InboxRow)(value).pipe(Effect33.flatMap((row) => Schema32.decodeUnknownEffect(exports_inbox_schema.Message)({
|
|
4829
4909
|
execution_id: row.execution_id,
|
|
4830
4910
|
sequence: row.sequence,
|
|
4831
4911
|
from: row.from_address_id,
|
|
@@ -4900,10 +4980,10 @@ var layer22 = Layer29.effect(Service29, Effect33.gen(function* () {
|
|
|
4900
4980
|
const old = yield* sql`SELECT message_sequences_json FROM relay_inbox_drains WHERE tenant_id=${tenant} AND execution_id=${input.executionId} AND drain_id=${input.drainId}`;
|
|
4901
4981
|
let sequences;
|
|
4902
4982
|
if (old[0] !== undefined)
|
|
4903
|
-
sequences = yield*
|
|
4983
|
+
sequences = yield* Schema32.decodeUnknownEffect(Schema32.Array(DbNumber))(decodeJson(old[0].message_sequences_json)).pipe(Effect33.mapError((cause) => InboxRepositoryError.make({ message: String(cause) })));
|
|
4904
4984
|
else {
|
|
4905
4985
|
const rows2 = yield* sql`SELECT sequence FROM relay_inbox_messages WHERE tenant_id=${tenant} AND execution_id=${input.executionId} AND consumed_at IS NULL ORDER BY sequence ASC LIMIT ${sql.literal(String(input.maxBatch ?? 100))}`;
|
|
4906
|
-
sequences = yield* Effect33.forEach(rows2, (row) =>
|
|
4986
|
+
sequences = yield* Effect33.forEach(rows2, (row) => Schema32.decodeUnknownEffect(Schema32.Struct({ sequence: DbNumber }))(row).pipe(Effect33.map((decoded) => decoded.sequence), Effect33.mapError((cause) => InboxRepositoryError.make({ message: String(cause) }))));
|
|
4907
4987
|
if (sequences.length === 0)
|
|
4908
4988
|
return [];
|
|
4909
4989
|
yield* sql`UPDATE relay_inbox_messages SET drain_id=${input.drainId}, consumed_at=${timestampParam(sql, input.consumedAt)} WHERE tenant_id=${tenant} AND execution_id=${input.executionId} AND ${sql.in("sequence", sequences)}`;
|
|
@@ -4990,10 +5070,10 @@ __export(exports_topic_repository, {
|
|
|
4990
5070
|
TopicRepositoryError: () => TopicRepositoryError,
|
|
4991
5071
|
Service: () => Service30
|
|
4992
5072
|
});
|
|
4993
|
-
import { Context as Context28, Effect as Effect34, Layer as Layer30, Ref as Ref7, Schema as
|
|
5073
|
+
import { Context as Context28, Effect as Effect34, Layer as Layer30, Ref as Ref7, Schema as Schema33 } from "effect";
|
|
4994
5074
|
import { SqlClient as SqlClient18 } from "effect/unstable/sql/SqlClient";
|
|
4995
|
-
class TopicRepositoryError extends
|
|
4996
|
-
message:
|
|
5075
|
+
class TopicRepositoryError extends Schema33.TaggedErrorClass()("TopicRepositoryError", {
|
|
5076
|
+
message: Schema33.String
|
|
4997
5077
|
}) {
|
|
4998
5078
|
}
|
|
4999
5079
|
|
|
@@ -5093,47 +5173,47 @@ __export(exports_memory_repository, {
|
|
|
5093
5173
|
MemoryRow: () => MemoryRow,
|
|
5094
5174
|
MemoryRepositoryError: () => MemoryRepositoryError
|
|
5095
5175
|
});
|
|
5096
|
-
import { Context as Context29, Effect as Effect35, Layer as Layer31, Ref as Ref8, Schema as
|
|
5097
|
-
import { Prompt as
|
|
5176
|
+
import { Context as Context29, Effect as Effect35, Layer as Layer31, Ref as Ref8, Schema as Schema34 } from "effect";
|
|
5177
|
+
import { Prompt as Prompt4 } from "effect/unstable/ai";
|
|
5098
5178
|
import { SqlClient as SqlClient19 } from "effect/unstable/sql/SqlClient";
|
|
5099
|
-
class MemoryRepositoryError extends
|
|
5100
|
-
message:
|
|
5179
|
+
class MemoryRepositoryError extends Schema34.TaggedErrorClass()("MemoryRepositoryError", {
|
|
5180
|
+
message: Schema34.String
|
|
5101
5181
|
}) {
|
|
5102
5182
|
}
|
|
5103
5183
|
|
|
5104
5184
|
class Service31 extends Context29.Service()("@relayfx/store-sql/memory/memory-repository/Service") {
|
|
5105
5185
|
}
|
|
5106
5186
|
var recallCandidateCap = 1000;
|
|
5107
|
-
var MemoryRow =
|
|
5108
|
-
id:
|
|
5109
|
-
agent:
|
|
5110
|
-
subject:
|
|
5111
|
-
embedding:
|
|
5112
|
-
parts_json:
|
|
5113
|
-
metadata_json:
|
|
5114
|
-
created_at:
|
|
5187
|
+
var MemoryRow = Schema34.Struct({
|
|
5188
|
+
id: Schema34.String,
|
|
5189
|
+
agent: Schema34.String,
|
|
5190
|
+
subject: Schema34.String,
|
|
5191
|
+
embedding: Schema34.Union([Schema34.Array(Schema34.Finite), Schema34.String]),
|
|
5192
|
+
parts_json: Schema34.Unknown,
|
|
5193
|
+
metadata_json: Schema34.Unknown,
|
|
5194
|
+
created_at: Schema34.Union([Schema34.Date, Schema34.String, Schema34.Finite])
|
|
5115
5195
|
}).annotate({ identifier: "Relay.Memory.Row" });
|
|
5116
5196
|
var toRepositoryError9 = (error4) => MemoryRepositoryError.make({ message: String(error4) });
|
|
5117
|
-
var decodeRow9 = (row) =>
|
|
5118
|
-
var MemoryFileDataWire =
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5197
|
+
var decodeRow9 = (row) => Schema34.decodeUnknownEffect(MemoryRow)(row).pipe(Effect35.mapError(toRepositoryError9));
|
|
5198
|
+
var MemoryFileDataWire = Schema34.Union([
|
|
5199
|
+
Schema34.TaggedStruct("String", { value: Schema34.String }),
|
|
5200
|
+
Schema34.TaggedStruct("Bytes", { value: Schema34.Array(Schema34.Finite) }),
|
|
5201
|
+
Schema34.TaggedStruct("Url", { value: Schema34.String })
|
|
5122
5202
|
]);
|
|
5123
|
-
var MemoryPartWire =
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
type:
|
|
5127
|
-
mediaType:
|
|
5128
|
-
fileName:
|
|
5203
|
+
var MemoryPartWire = Schema34.Union([
|
|
5204
|
+
Schema34.Struct({ type: Schema34.Literal("text"), text: Schema34.String, options: Prompt4.ProviderOptions }),
|
|
5205
|
+
Schema34.Struct({
|
|
5206
|
+
type: Schema34.Literal("file"),
|
|
5207
|
+
mediaType: Schema34.String,
|
|
5208
|
+
fileName: Schema34.optional(Schema34.String),
|
|
5129
5209
|
data: MemoryFileDataWire,
|
|
5130
|
-
options:
|
|
5210
|
+
options: Prompt4.ProviderOptions
|
|
5131
5211
|
})
|
|
5132
5212
|
]);
|
|
5133
|
-
var MemoryPartsWire =
|
|
5134
|
-
parts:
|
|
5213
|
+
var MemoryPartsWire = Schema34.TaggedStruct("RelayMemoryPartsV1", {
|
|
5214
|
+
parts: Schema34.Array(MemoryPartWire)
|
|
5135
5215
|
});
|
|
5136
|
-
var LegacyMemoryParts =
|
|
5216
|
+
var LegacyMemoryParts = Schema34.Array(Schema34.Union([Prompt4.TextPart, Prompt4.FilePart]));
|
|
5137
5217
|
var encodeParts = (parts) => {
|
|
5138
5218
|
const wireParts = parts.map((part) => {
|
|
5139
5219
|
if (part.type === "text")
|
|
@@ -5149,18 +5229,18 @@ var encodeParts = (parts) => {
|
|
|
5149
5229
|
options: part.options
|
|
5150
5230
|
};
|
|
5151
5231
|
});
|
|
5152
|
-
return
|
|
5232
|
+
return Schema34.encodeSync(MemoryPartsWire)({ _tag: "RelayMemoryPartsV1", parts: wireParts });
|
|
5153
5233
|
};
|
|
5154
5234
|
var decodeParts = (value) => {
|
|
5155
5235
|
const decoded = decodeJson(value);
|
|
5156
5236
|
if (typeof decoded !== "object" || decoded === null || !("_tag" in decoded)) {
|
|
5157
|
-
return
|
|
5237
|
+
return Schema34.decodeUnknownEffect(LegacyMemoryParts)(decoded).pipe(Effect35.mapError(toRepositoryError9));
|
|
5158
5238
|
}
|
|
5159
|
-
return
|
|
5239
|
+
return Schema34.decodeUnknownEffect(MemoryPartsWire)(decoded).pipe(Effect35.map((wire) => wire.parts.map((part) => {
|
|
5160
5240
|
if (part.type === "text")
|
|
5161
|
-
return
|
|
5241
|
+
return Prompt4.makePart("text", { text: part.text, options: part.options });
|
|
5162
5242
|
const data = part.data._tag === "String" ? part.data.value : part.data._tag === "Bytes" ? new Uint8Array(part.data.value) : new URL(part.data.value);
|
|
5163
|
-
return
|
|
5243
|
+
return Prompt4.makePart("file", {
|
|
5164
5244
|
mediaType: part.mediaType,
|
|
5165
5245
|
...part.fileName === undefined ? {} : { fileName: part.fileName },
|
|
5166
5246
|
data,
|
|
@@ -5168,7 +5248,7 @@ var decodeParts = (value) => {
|
|
|
5168
5248
|
});
|
|
5169
5249
|
})), Effect35.mapError(toRepositoryError9));
|
|
5170
5250
|
};
|
|
5171
|
-
var decodeMetadata4 = (value) =>
|
|
5251
|
+
var decodeMetadata4 = (value) => Schema34.decodeUnknownEffect(exports_shared_schema.Metadata)(decodeJson(value)).pipe(Effect35.mapError(toRepositoryError9));
|
|
5172
5252
|
var parsePgFloatArray = (value) => {
|
|
5173
5253
|
const body = value.startsWith("{") && value.endsWith("}") ? value.slice(1, -1) : value;
|
|
5174
5254
|
if (body.length === 0)
|
|
@@ -5221,7 +5301,7 @@ var clonePart = (part) => {
|
|
|
5221
5301
|
if (part.type !== "file")
|
|
5222
5302
|
return structuredClone(part);
|
|
5223
5303
|
const data = typeof part.data === "string" ? part.data : part.data instanceof Uint8Array ? new Uint8Array(part.data) : new URL(part.data.toString());
|
|
5224
|
-
return
|
|
5304
|
+
return Prompt4.makePart("file", {
|
|
5225
5305
|
mediaType: part.mediaType,
|
|
5226
5306
|
...part.fileName === undefined ? {} : { fileName: part.fileName },
|
|
5227
5307
|
data,
|
|
@@ -5243,7 +5323,7 @@ var layer24 = Layer31.effect(Service31, Effect35.gen(function* () {
|
|
|
5243
5323
|
});
|
|
5244
5324
|
const decodeEmbedding = sql.onDialectOrElse({
|
|
5245
5325
|
pg: () => (value) => typeof value === "string" ? parsePgFloatArray(value) : value,
|
|
5246
|
-
orElse: () => (value) => typeof value === "string" ?
|
|
5326
|
+
orElse: () => (value) => typeof value === "string" ? Schema34.decodeUnknownSync(Schema34.fromJsonString(Schema34.Array(Schema34.Finite)))(value) : value
|
|
5247
5327
|
});
|
|
5248
5328
|
const toRecord8 = (row) => Effect35.all({ parts: decodeParts(row.parts_json), metadata: decodeMetadata4(row.metadata_json) }).pipe(Effect35.map(({ metadata: metadata6, parts }) => ({
|
|
5249
5329
|
id: row.id,
|
|
@@ -5409,20 +5489,20 @@ __export(exports_permission_rule_repository, {
|
|
|
5409
5489
|
PermissionRuleRow: () => PermissionRuleRow,
|
|
5410
5490
|
PermissionRuleRepositoryError: () => PermissionRuleRepositoryError
|
|
5411
5491
|
});
|
|
5412
|
-
import { Context as Context30, Effect as Effect36, Layer as Layer32, Schema as
|
|
5492
|
+
import { Context as Context30, Effect as Effect36, Layer as Layer32, Schema as Schema35 } from "effect";
|
|
5413
5493
|
import { SqlClient as SqlClient20 } from "effect/unstable/sql/SqlClient";
|
|
5414
|
-
class PermissionRuleRepositoryError extends
|
|
5415
|
-
message:
|
|
5494
|
+
class PermissionRuleRepositoryError extends Schema35.TaggedErrorClass()("PermissionRuleRepositoryError", {
|
|
5495
|
+
message: Schema35.String
|
|
5416
5496
|
}) {
|
|
5417
5497
|
}
|
|
5418
5498
|
|
|
5419
5499
|
class Service32 extends Context30.Service()("@relayfx/store-sql/permission/permission-rule-repository/Service") {
|
|
5420
5500
|
}
|
|
5421
|
-
var PermissionRuleRow =
|
|
5422
|
-
agent:
|
|
5423
|
-
scope:
|
|
5424
|
-
rule_json:
|
|
5425
|
-
created_at:
|
|
5501
|
+
var PermissionRuleRow = Schema35.Struct({
|
|
5502
|
+
agent: Schema35.String,
|
|
5503
|
+
scope: Schema35.String,
|
|
5504
|
+
rule_json: Schema35.Unknown,
|
|
5505
|
+
created_at: Schema35.Union([Schema35.Date, Schema35.String, Schema35.Finite])
|
|
5426
5506
|
}).annotate({ identifier: "Relay.PermissionRule.Row" });
|
|
5427
5507
|
var toRecord8 = (row) => ({
|
|
5428
5508
|
agent: row.agent,
|
|
@@ -5431,7 +5511,7 @@ var toRecord8 = (row) => ({
|
|
|
5431
5511
|
createdAt: fromDbTimestamp(row.created_at)
|
|
5432
5512
|
});
|
|
5433
5513
|
var toRepositoryError10 = (error4) => PermissionRuleRepositoryError.make({ message: String(error4) });
|
|
5434
|
-
var decodeRow10 = (row) =>
|
|
5514
|
+
var decodeRow10 = (row) => Schema35.decodeUnknownEffect(PermissionRuleRow)(row).pipe(Effect36.mapError(toRepositoryError10));
|
|
5435
5515
|
var memoryKey = (agent, scope, pattern) => `${agent}\x00${scope}\x00${pattern}`;
|
|
5436
5516
|
var layer25 = Layer32.effect(Service32, Effect36.gen(function* () {
|
|
5437
5517
|
const sql = yield* SqlClient20;
|
|
@@ -5528,24 +5608,24 @@ __export(exports_presence_repository, {
|
|
|
5528
5608
|
Service: () => Service33,
|
|
5529
5609
|
PresenceRepositoryError: () => PresenceRepositoryError
|
|
5530
5610
|
});
|
|
5531
|
-
import { Clock as Clock3, Context as Context31, Effect as Effect37, Layer as Layer33, PubSub as PubSub4, Schema as
|
|
5611
|
+
import { Clock as Clock3, Context as Context31, Effect as Effect37, Layer as Layer33, PubSub as PubSub4, Schema as Schema36, Stream as Stream6 } from "effect";
|
|
5532
5612
|
import { SqlClient as SqlClient21 } from "effect/unstable/sql/SqlClient";
|
|
5533
5613
|
var presenceChangedChannel = "relay_presence";
|
|
5534
5614
|
|
|
5535
|
-
class PresenceRepositoryError extends
|
|
5615
|
+
class PresenceRepositoryError extends Schema36.TaggedErrorClass()("PresenceRepositoryError", { message: Schema36.String }) {
|
|
5536
5616
|
}
|
|
5537
5617
|
|
|
5538
5618
|
class Service33 extends Context31.Service()("@relayfx/store-sql/presence/presence-repository/Service") {
|
|
5539
5619
|
}
|
|
5540
5620
|
var pointer = (scope) => `${scope.kind}:${scope.id}`;
|
|
5541
5621
|
var error4 = (cause) => PresenceRepositoryError.make({ message: String(cause) });
|
|
5542
|
-
var Row =
|
|
5543
|
-
id:
|
|
5544
|
-
scope_kind:
|
|
5545
|
-
scope_id:
|
|
5546
|
-
metadata_json:
|
|
5547
|
-
connected_at:
|
|
5548
|
-
expires_at:
|
|
5622
|
+
var Row = Schema36.Struct({
|
|
5623
|
+
id: Schema36.String,
|
|
5624
|
+
scope_kind: Schema36.String,
|
|
5625
|
+
scope_id: Schema36.String,
|
|
5626
|
+
metadata_json: Schema36.Unknown,
|
|
5627
|
+
connected_at: Schema36.Union([Schema36.Date, Schema36.String, Schema36.Finite]),
|
|
5628
|
+
expires_at: Schema36.Union([Schema36.Date, Schema36.String, Schema36.Finite])
|
|
5549
5629
|
});
|
|
5550
5630
|
var layer26 = Layer33.effect(Service33, Effect37.gen(function* () {
|
|
5551
5631
|
const sql = yield* SqlClient21;
|
|
@@ -5576,7 +5656,7 @@ var layer26 = Layer33.effect(Service33, Effect37.gen(function* () {
|
|
|
5576
5656
|
const rows = yield* sql`SELECT id, scope_kind, scope_id, metadata_json, connected_at, expires_at FROM relay_presence
|
|
5577
5657
|
WHERE tenant_id = ${tenant} AND scope_kind = ${scope.kind} AND scope_id = ${scope.id} AND expires_at > ${now}
|
|
5578
5658
|
ORDER BY connected_at, id`.pipe(Effect37.mapError(error4));
|
|
5579
|
-
return yield* Effect37.forEach(rows, (value) =>
|
|
5659
|
+
return yield* Effect37.forEach(rows, (value) => Schema36.decodeUnknownEffect(Row)(value).pipe(Effect37.map((row) => ({
|
|
5580
5660
|
id: row.id,
|
|
5581
5661
|
scope: { kind: row.scope_kind, id: row.scope_id },
|
|
5582
5662
|
metadata: decodeJson(row.metadata_json),
|
|
@@ -5658,44 +5738,44 @@ __export(exports_schedule_repository, {
|
|
|
5658
5738
|
ScheduleNotFound: () => ScheduleNotFound,
|
|
5659
5739
|
ScheduleClaimMismatch: () => ScheduleClaimMismatch
|
|
5660
5740
|
});
|
|
5661
|
-
import { Context as Context32, Effect as Effect38, Layer as Layer34, Schema as
|
|
5741
|
+
import { Context as Context32, Effect as Effect38, Layer as Layer34, Schema as Schema37 } from "effect";
|
|
5662
5742
|
import { SqlClient as SqlClient22 } from "effect/unstable/sql/SqlClient";
|
|
5663
|
-
class ScheduleRepositoryError extends
|
|
5664
|
-
message:
|
|
5743
|
+
class ScheduleRepositoryError extends Schema37.TaggedErrorClass()("ScheduleRepositoryError", {
|
|
5744
|
+
message: Schema37.String
|
|
5665
5745
|
}) {
|
|
5666
5746
|
}
|
|
5667
5747
|
|
|
5668
|
-
class ScheduleNotFound extends
|
|
5748
|
+
class ScheduleNotFound extends Schema37.TaggedErrorClass()("ScheduleNotFound", {
|
|
5669
5749
|
id: exports_ids_schema.ScheduleId
|
|
5670
5750
|
}) {
|
|
5671
5751
|
}
|
|
5672
5752
|
|
|
5673
|
-
class ScheduleClaimMismatch extends
|
|
5753
|
+
class ScheduleClaimMismatch extends Schema37.TaggedErrorClass()("ScheduleClaimMismatch", {
|
|
5674
5754
|
id: exports_ids_schema.ScheduleId,
|
|
5675
|
-
worker_id:
|
|
5755
|
+
worker_id: Schema37.String
|
|
5676
5756
|
}) {
|
|
5677
5757
|
}
|
|
5678
5758
|
|
|
5679
5759
|
class Service34 extends Context32.Service()("@relayfx/store-sql/schedule/schedule-repository/Service") {
|
|
5680
5760
|
}
|
|
5681
|
-
var ScheduleRow =
|
|
5682
|
-
id:
|
|
5683
|
-
kind:
|
|
5684
|
-
target_kind:
|
|
5685
|
-
address_id:
|
|
5686
|
-
wait_id:
|
|
5687
|
-
cron_expr:
|
|
5688
|
-
input_json:
|
|
5689
|
-
state:
|
|
5690
|
-
next_run_at:
|
|
5691
|
-
attempt:
|
|
5692
|
-
claim_owner:
|
|
5693
|
-
claim_expires_at:
|
|
5694
|
-
last_error:
|
|
5695
|
-
idempotency_key:
|
|
5696
|
-
metadata_json:
|
|
5697
|
-
created_at:
|
|
5698
|
-
updated_at:
|
|
5761
|
+
var ScheduleRow = Schema37.Struct({
|
|
5762
|
+
id: Schema37.String,
|
|
5763
|
+
kind: Schema37.String,
|
|
5764
|
+
target_kind: Schema37.String,
|
|
5765
|
+
address_id: Schema37.NullishOr(Schema37.String),
|
|
5766
|
+
wait_id: Schema37.NullishOr(Schema37.String),
|
|
5767
|
+
cron_expr: Schema37.NullishOr(Schema37.String),
|
|
5768
|
+
input_json: Schema37.NullishOr(Schema37.Unknown),
|
|
5769
|
+
state: Schema37.String,
|
|
5770
|
+
next_run_at: Schema37.Union([Schema37.Date, Schema37.String, Schema37.Finite]),
|
|
5771
|
+
attempt: Schema37.Union([Schema37.Finite, Schema37.String, Schema37.BigInt]),
|
|
5772
|
+
claim_owner: Schema37.NullishOr(Schema37.String),
|
|
5773
|
+
claim_expires_at: Schema37.NullishOr(Schema37.Union([Schema37.Date, Schema37.String, Schema37.Finite])),
|
|
5774
|
+
last_error: Schema37.NullishOr(Schema37.String),
|
|
5775
|
+
idempotency_key: Schema37.NullishOr(Schema37.String),
|
|
5776
|
+
metadata_json: Schema37.Unknown,
|
|
5777
|
+
created_at: Schema37.Union([Schema37.Date, Schema37.String, Schema37.Finite]),
|
|
5778
|
+
updated_at: Schema37.Union([Schema37.Date, Schema37.String, Schema37.Finite])
|
|
5699
5779
|
}).annotate({ identifier: "Relay.Schedule.Row" });
|
|
5700
5780
|
var metadata6 = (input) => input ?? {};
|
|
5701
5781
|
var validationError = (input) => {
|
|
@@ -5733,7 +5813,7 @@ var toRecord9 = (row) => {
|
|
|
5733
5813
|
};
|
|
5734
5814
|
};
|
|
5735
5815
|
var toRepositoryError11 = (error5) => ScheduleRepositoryError.make({ message: String(error5) });
|
|
5736
|
-
var decodeRow11 = (row) =>
|
|
5816
|
+
var decodeRow11 = (row) => Schema37.decodeUnknownEffect(ScheduleRow)(row).pipe(Effect38.mapError(toRepositoryError11));
|
|
5737
5817
|
var cancellableStates = new Set(["active", "claimed"]);
|
|
5738
5818
|
var columnsText = "id, kind, target_kind, address_id, wait_id, cron_expr, input_json, state, next_run_at, attempt, claim_owner, claim_expires_at, last_error, idempotency_key, metadata_json, created_at, updated_at";
|
|
5739
5819
|
var layer27 = Layer34.effect(Service34, Effect38.gen(function* () {
|
|
@@ -6208,68 +6288,31 @@ __export(exports_session_repository, {
|
|
|
6208
6288
|
Service: () => Service35,
|
|
6209
6289
|
DuplicateSession: () => DuplicateSession
|
|
6210
6290
|
});
|
|
6211
|
-
import { Context as Context33, Effect as Effect41, Layer as Layer35, Schema as
|
|
6291
|
+
import { Context as Context33, Effect as Effect41, Layer as Layer35, Schema as Schema41 } from "effect";
|
|
6212
6292
|
|
|
6213
6293
|
// ../store-sql/src/session/session-entry-records.ts
|
|
6214
|
-
import { Effect as Effect39, Schema as
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
created_at: Schema37.Union([Schema37.Date, Schema37.String, Schema37.Finite])
|
|
6294
|
+
import { Effect as Effect39, Schema as Schema38 } from "effect";
|
|
6295
|
+
var sessionEntryRow = Schema38.Struct({
|
|
6296
|
+
id: Schema38.String,
|
|
6297
|
+
session_id: Schema38.String,
|
|
6298
|
+
parent_id: Schema38.Union([Schema38.String, Schema38.Null, Schema38.Undefined]),
|
|
6299
|
+
tag: Schema38.String,
|
|
6300
|
+
payload_json: Schema38.Unknown,
|
|
6301
|
+
created_at: Schema38.Union([Schema38.Date, Schema38.String, Schema38.Finite])
|
|
6223
6302
|
}).annotate({ identifier: "Relay.SessionEntry.Row" });
|
|
6224
|
-
var
|
|
6225
|
-
Schema37.TaggedStruct("String", { value: Schema37.String }),
|
|
6226
|
-
Schema37.TaggedStruct("Bytes", { value: Schema37.Array(Schema37.Finite) }),
|
|
6227
|
-
Schema37.TaggedStruct("Url", { value: Schema37.String })
|
|
6228
|
-
]);
|
|
6229
|
-
var CheckpointPromptWire = Schema37.TaggedStruct("RelaySessionCheckpointPromptV1", {
|
|
6303
|
+
var CheckpointPromptWire = Schema38.TaggedStruct("RelaySessionCheckpointPromptV1", {
|
|
6230
6304
|
prompt: exports_shared_schema.JsonValue
|
|
6231
6305
|
});
|
|
6232
|
-
var
|
|
6233
|
-
var encodePromptMessage = (prompt, message, messageIndex) => ({
|
|
6234
|
-
...message,
|
|
6235
|
-
content: Array.isArray(message.content) ? message.content.map((part, partIndex) => {
|
|
6236
|
-
const actualContent = prompt.content[messageIndex]?.content;
|
|
6237
|
-
const actualPart = Array.isArray(actualContent) ? actualContent[partIndex] : undefined;
|
|
6238
|
-
return part.type === "file" && actualPart?.type === "file" ? { ...part, data: fileDataToWire(actualPart.data) } : part;
|
|
6239
|
-
}) : message.content
|
|
6240
|
-
});
|
|
6241
|
-
var encodePromptContent = (prompt) => {
|
|
6242
|
-
const encoded = Schema37.encodeSync(Prompt3.Prompt)(prompt);
|
|
6243
|
-
return Schema37.decodeUnknownSync(exports_shared_schema.JsonValue)({
|
|
6244
|
-
content: encoded.content.map((message, messageIndex) => encodePromptMessage(prompt, message, messageIndex))
|
|
6245
|
-
});
|
|
6246
|
-
};
|
|
6247
|
-
var decodePromptContent = (value) => {
|
|
6248
|
-
const content = typeof value === "object" && value !== null && !Array.isArray(value) && "content" in value ? value.content : undefined;
|
|
6249
|
-
const decodedContent = Array.isArray(content) ? content.map((message) => {
|
|
6250
|
-
if (typeof message !== "object" || message === null || Array.isArray(message))
|
|
6251
|
-
return message;
|
|
6252
|
-
const messageContent = message.content;
|
|
6253
|
-
return {
|
|
6254
|
-
...message,
|
|
6255
|
-
content: Array.isArray(messageContent) ? messageContent.map((part) => {
|
|
6256
|
-
if (typeof part !== "object" || part === null || Array.isArray(part) || part.type !== "file") {
|
|
6257
|
-
return part;
|
|
6258
|
-
}
|
|
6259
|
-
const data = Schema37.decodeUnknownSync(FileDataWire)(part.data);
|
|
6260
|
-
return {
|
|
6261
|
-
...part,
|
|
6262
|
-
data: data._tag === "String" ? data.value : data._tag === "Bytes" ? Uint8Array.from(data.value) : new URL(data.value)
|
|
6263
|
-
};
|
|
6264
|
-
}) : messageContent
|
|
6265
|
-
};
|
|
6266
|
-
}) : content;
|
|
6267
|
-
return Schema37.decodeUnknownSync(Prompt3.Prompt)({ content: decodedContent });
|
|
6268
|
-
};
|
|
6269
|
-
var encodeCheckpointPrompt = (prompt) => Schema37.encodeSync(CheckpointPromptWire)({
|
|
6306
|
+
var encodeCheckpointPrompt = (prompt) => Schema38.encodeSync(CheckpointPromptWire)({
|
|
6270
6307
|
_tag: "RelaySessionCheckpointPromptV1",
|
|
6271
|
-
prompt:
|
|
6272
|
-
});
|
|
6308
|
+
prompt: encodePrompt(prompt)
|
|
6309
|
+
});
|
|
6310
|
+
var CheckpointTelemetryWire = Schema38.Array(exports_model_telemetry.Event);
|
|
6311
|
+
var encodeCheckpointTelemetry = Schema38.encodeSync(CheckpointTelemetryWire);
|
|
6312
|
+
var decodeCheckpointTelemetry = Schema38.decodeUnknownSync(CheckpointTelemetryWire);
|
|
6313
|
+
var CheckpointCommitWire = exports_model_telemetry.CompactionCommit;
|
|
6314
|
+
var encodeCheckpointCommit = Schema38.encodeSync(CheckpointCommitWire);
|
|
6315
|
+
var decodeCheckpointCommit = Schema38.decodeUnknownSync(CheckpointCommitWire);
|
|
6273
6316
|
var comparableEntry = (entry) => {
|
|
6274
6317
|
const { createdAt: _createdAt, ...value } = entry;
|
|
6275
6318
|
return value;
|
|
@@ -6303,6 +6346,8 @@ var appendToRecord = (input) => {
|
|
|
6303
6346
|
_tag: "Compaction",
|
|
6304
6347
|
version: 2,
|
|
6305
6348
|
projectedHistory: input.input.projectedHistory,
|
|
6349
|
+
telemetry: input.input.telemetry,
|
|
6350
|
+
...input.input.compactionCommit === undefined ? {} : { compactionCommit: input.input.compactionCommit },
|
|
6306
6351
|
...input.input.summary === undefined ? {} : { summary: input.input.summary }
|
|
6307
6352
|
} : {
|
|
6308
6353
|
...base,
|
|
@@ -6316,13 +6361,13 @@ var appendToRecord = (input) => {
|
|
|
6316
6361
|
};
|
|
6317
6362
|
var makeSessionEntryRecords = (errors) => {
|
|
6318
6363
|
const { SessionRepositoryError, SessionConflict } = errors;
|
|
6319
|
-
const decodeCheckpointPrompt = (value) =>
|
|
6320
|
-
try: () =>
|
|
6364
|
+
const decodeCheckpointPrompt = (value) => Schema38.decodeUnknownEffect(CheckpointPromptWire)(value).pipe(Effect39.flatMap((wire) => Effect39.try({
|
|
6365
|
+
try: () => decodePrompt(wire.prompt),
|
|
6321
6366
|
catch: (error5) => SessionRepositoryError.make({ message: `Invalid Session checkpoint prompt: ${String(error5)}` })
|
|
6322
|
-
})), Effect39.mapError((error5) =>
|
|
6367
|
+
})), Effect39.mapError((error5) => Schema38.is(SessionRepositoryError)(error5) ? error5 : SessionRepositoryError.make({ message: `Invalid Session checkpoint prompt: ${String(error5)}` })));
|
|
6323
6368
|
const clonePrompt = (prompt) => {
|
|
6324
|
-
const wire = prompt.pipe(encodeCheckpointPrompt,
|
|
6325
|
-
return
|
|
6369
|
+
const wire = prompt.pipe(encodeCheckpointPrompt, Schema38.decodeUnknownSync(CheckpointPromptWire));
|
|
6370
|
+
return decodePrompt(wire.prompt);
|
|
6326
6371
|
};
|
|
6327
6372
|
const payloadFromInput = (input) => {
|
|
6328
6373
|
switch (input._tag) {
|
|
@@ -6367,6 +6412,8 @@ var makeSessionEntryRecords = (errors) => {
|
|
|
6367
6412
|
return input.version === 2 ? {
|
|
6368
6413
|
version: 2,
|
|
6369
6414
|
projectedHistory: encodeCheckpointPrompt(input.projectedHistory),
|
|
6415
|
+
telemetry: encodeCheckpointTelemetry(input.telemetry),
|
|
6416
|
+
...input.compactionCommit === undefined ? {} : { compactionCommit: encodeCheckpointCommit(input.compactionCommit) },
|
|
6370
6417
|
...input.summary === undefined ? {} : { summary: input.summary },
|
|
6371
6418
|
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
6372
6419
|
} : {
|
|
@@ -6436,11 +6483,22 @@ var makeSessionEntryRecords = (errors) => {
|
|
|
6436
6483
|
summary: String(payload.summary ?? "")
|
|
6437
6484
|
});
|
|
6438
6485
|
case "Compaction":
|
|
6439
|
-
return payload.version === 2 ? decodeCheckpointPrompt(payload.projectedHistory).pipe(Effect39.
|
|
6486
|
+
return payload.version === 2 ? decodeCheckpointPrompt(payload.projectedHistory).pipe(Effect39.flatMap((projectedHistory) => Effect39.try({
|
|
6487
|
+
try: () => ({
|
|
6488
|
+
projectedHistory,
|
|
6489
|
+
telemetry: payload.telemetry === undefined ? [] : decodeCheckpointTelemetry(payload.telemetry),
|
|
6490
|
+
compactionCommit: payload.compactionCommit === undefined ? undefined : decodeCheckpointCommit(payload.compactionCommit)
|
|
6491
|
+
}),
|
|
6492
|
+
catch: (error5) => SessionRepositoryError.make({
|
|
6493
|
+
message: `Invalid Session checkpoint telemetry: ${String(error5)}`
|
|
6494
|
+
})
|
|
6495
|
+
})), Effect39.map(({ projectedHistory, telemetry, compactionCommit }) => ({
|
|
6440
6496
|
...base,
|
|
6441
6497
|
_tag: "Compaction",
|
|
6442
6498
|
version: 2,
|
|
6443
6499
|
projectedHistory,
|
|
6500
|
+
telemetry,
|
|
6501
|
+
...compactionCommit === undefined ? {} : { compactionCommit },
|
|
6444
6502
|
...payload.summary === undefined ? {} : { summary: String(payload.summary) }
|
|
6445
6503
|
}))) : Effect39.succeed({
|
|
6446
6504
|
...base,
|
|
@@ -6459,9 +6517,19 @@ var makeSessionEntryRecords = (errors) => {
|
|
|
6459
6517
|
}
|
|
6460
6518
|
};
|
|
6461
6519
|
const promptEquivalence = (left, right) => exports_shared_schema.canonicalEquals(encodeCheckpointPrompt(left), encodeCheckpointPrompt(right));
|
|
6520
|
+
const telemetryEquivalence = (left, right) => exports_shared_schema.canonicalEquals(encodeCheckpointTelemetry(left), encodeCheckpointTelemetry(right));
|
|
6521
|
+
const commitEquivalence = (left, right) => {
|
|
6522
|
+
if (left._tag !== "Compaction" || left.version !== 2 || right._tag !== "Compaction" || right.version !== 2) {
|
|
6523
|
+
return false;
|
|
6524
|
+
}
|
|
6525
|
+
if (left.compactionCommit === undefined || right.compactionCommit === undefined) {
|
|
6526
|
+
return left.compactionCommit === right.compactionCommit;
|
|
6527
|
+
}
|
|
6528
|
+
return exports_shared_schema.canonicalEquals(encodeCheckpointCommit(left.compactionCommit), encodeCheckpointCommit(right.compactionCommit));
|
|
6529
|
+
};
|
|
6462
6530
|
const sameEntry = (left, right) => {
|
|
6463
6531
|
if (left._tag === "Compaction" && left.version === 2 && right._tag === "Compaction" && right.version === 2) {
|
|
6464
|
-
return left.id === right.id && left.sessionId === right.sessionId && left.parentId === right.parentId && left.summary === right.summary && promptEquivalence(left.projectedHistory, right.projectedHistory);
|
|
6532
|
+
return left.id === right.id && left.sessionId === right.sessionId && left.parentId === right.parentId && left.summary === right.summary && promptEquivalence(left.projectedHistory, right.projectedHistory) && telemetryEquivalence(left.telemetry, right.telemetry) && commitEquivalence(left, right);
|
|
6465
6533
|
}
|
|
6466
6534
|
return exports_shared_schema.canonicalEquals(comparableEntry(left), comparableEntry(right));
|
|
6467
6535
|
};
|
|
@@ -6491,25 +6559,25 @@ var makeSessionEntryRecords = (errors) => {
|
|
|
6491
6559
|
};
|
|
6492
6560
|
|
|
6493
6561
|
// ../store-sql/src/session/session-records.ts
|
|
6494
|
-
import { Effect as Effect40, Schema as
|
|
6562
|
+
import { Effect as Effect40, Schema as Schema40 } from "effect";
|
|
6495
6563
|
import { SqlClient as SqlClient23 } from "effect/unstable/sql/SqlClient";
|
|
6496
6564
|
|
|
6497
6565
|
// ../store-sql/src/session/session-row.ts
|
|
6498
|
-
import { Schema as
|
|
6499
|
-
var sessionRow =
|
|
6500
|
-
id:
|
|
6501
|
-
root_address_id:
|
|
6502
|
-
leaf_entry_id:
|
|
6503
|
-
owner_execution_id:
|
|
6504
|
-
owner_epoch:
|
|
6505
|
-
owner_released:
|
|
6506
|
-
metadata_json:
|
|
6507
|
-
created_at:
|
|
6508
|
-
updated_at:
|
|
6566
|
+
import { Schema as Schema39 } from "effect";
|
|
6567
|
+
var sessionRow = Schema39.Struct({
|
|
6568
|
+
id: Schema39.String,
|
|
6569
|
+
root_address_id: Schema39.String,
|
|
6570
|
+
leaf_entry_id: Schema39.Union([Schema39.String, Schema39.Null, Schema39.Undefined]),
|
|
6571
|
+
owner_execution_id: Schema39.Union([Schema39.String, Schema39.Null, Schema39.Undefined]),
|
|
6572
|
+
owner_epoch: Schema39.Union([Schema39.Finite, Schema39.String, Schema39.BigInt]),
|
|
6573
|
+
owner_released: Schema39.Union([Schema39.Boolean, Schema39.Finite, Schema39.String, Schema39.BigInt]),
|
|
6574
|
+
metadata_json: Schema39.Unknown,
|
|
6575
|
+
created_at: Schema39.Union([Schema39.Date, Schema39.String, Schema39.Finite]),
|
|
6576
|
+
updated_at: Schema39.Union([Schema39.Date, Schema39.String, Schema39.Finite])
|
|
6509
6577
|
}).annotate({ identifier: "Relay.Session.Row" });
|
|
6510
6578
|
var releasedFlag = (value) => value === true || value === 1 || value === "1" || value === 1n || value === "true";
|
|
6511
|
-
var CountRow =
|
|
6512
|
-
value:
|
|
6579
|
+
var CountRow = Schema39.Struct({
|
|
6580
|
+
value: Schema39.Union([Schema39.Finite, Schema39.String, Schema39.BigInt])
|
|
6513
6581
|
}).annotate({ identifier: "Relay.SessionEntry.CountRow" });
|
|
6514
6582
|
var metadata7 = (input) => input ?? {};
|
|
6515
6583
|
var toSessionRecord = (row) => ({
|
|
@@ -6588,9 +6656,9 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
|
|
|
6588
6656
|
return toRepositoryError12(error5);
|
|
6589
6657
|
}));
|
|
6590
6658
|
}
|
|
6591
|
-
const decodeSessionRow = (row) =>
|
|
6592
|
-
const decodeEntryRow = (row) =>
|
|
6593
|
-
const decodeCountRow = (row) =>
|
|
6659
|
+
const decodeSessionRow = (row) => Schema40.decodeUnknownEffect(sessionRow)(row).pipe(Effect40.mapError(toRepositoryError12));
|
|
6660
|
+
const decodeEntryRow = (row) => Schema40.decodeUnknownEffect(sessionEntryRow)(row).pipe(Effect40.mapError(toRepositoryError12));
|
|
6661
|
+
const decodeCountRow = (row) => Schema40.decodeUnknownEffect(CountRow)(row).pipe(Effect40.mapError(toRepositoryError12));
|
|
6594
6662
|
const selectSessionByKey = (tenantId, id) => sql`
|
|
6595
6663
|
SELECT id, root_address_id, leaf_entry_id, owner_execution_id, owner_epoch, owner_released, metadata_json, created_at, updated_at
|
|
6596
6664
|
FROM relay_sessions
|
|
@@ -6824,6 +6892,8 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
|
|
|
6824
6892
|
_tag: "Compaction",
|
|
6825
6893
|
version: 2,
|
|
6826
6894
|
projectedHistory: input.projectedHistory,
|
|
6895
|
+
telemetry: input.telemetry,
|
|
6896
|
+
...input.compactionCommit === undefined ? {} : { compactionCommit: input.compactionCommit },
|
|
6827
6897
|
...input.summary === undefined ? {} : { summary: input.summary }
|
|
6828
6898
|
},
|
|
6829
6899
|
createdAt: input.createdAt
|
|
@@ -6914,19 +6984,19 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
|
|
|
6914
6984
|
});
|
|
6915
6985
|
|
|
6916
6986
|
// ../store-sql/src/session/session-repository.ts
|
|
6917
|
-
class SessionRepositoryError extends
|
|
6918
|
-
message:
|
|
6987
|
+
class SessionRepositoryError extends Schema41.TaggedErrorClass()("SessionRepositoryError", {
|
|
6988
|
+
message: Schema41.String
|
|
6919
6989
|
}) {
|
|
6920
6990
|
}
|
|
6921
6991
|
|
|
6922
|
-
class DuplicateSession extends
|
|
6992
|
+
class DuplicateSession extends Schema41.TaggedErrorClass()("DuplicateSession", {
|
|
6923
6993
|
id: exports_ids_schema.SessionId
|
|
6924
6994
|
}) {
|
|
6925
6995
|
}
|
|
6926
6996
|
|
|
6927
|
-
class SessionConflict extends
|
|
6928
|
-
reason:
|
|
6929
|
-
message:
|
|
6997
|
+
class SessionConflict extends Schema41.TaggedErrorClass()("SessionConflict", {
|
|
6998
|
+
reason: Schema41.Literals(["stale-leaf", "checkpoint-id-reused", "checkpoint-not-on-active-path", "fenced"]),
|
|
6999
|
+
message: Schema41.String
|
|
6930
7000
|
}) {
|
|
6931
7001
|
}
|
|
6932
7002
|
|
|
@@ -7093,6 +7163,8 @@ var memoryLayer26 = Layer35.sync(Service35, () => {
|
|
|
7093
7163
|
_tag: "Compaction",
|
|
7094
7164
|
version: 2,
|
|
7095
7165
|
projectedHistory: input.projectedHistory,
|
|
7166
|
+
telemetry: input.telemetry,
|
|
7167
|
+
...input.compactionCommit === undefined ? {} : { compactionCommit: input.compactionCommit },
|
|
7096
7168
|
...input.summary === undefined ? {} : { summary: input.summary }
|
|
7097
7169
|
},
|
|
7098
7170
|
createdAt: input.createdAt
|
|
@@ -7216,36 +7288,36 @@ __export(exports_skill_definition_repository, {
|
|
|
7216
7288
|
Service: () => Service36,
|
|
7217
7289
|
ExecutionSkillPinRow: () => ExecutionSkillPinRow
|
|
7218
7290
|
});
|
|
7219
|
-
import { Context as Context34, Effect as Effect42, HashSet, Layer as Layer36, Schema as
|
|
7291
|
+
import { Context as Context34, Effect as Effect42, HashSet, Layer as Layer36, Schema as Schema42, Semaphore as Semaphore4 } from "effect";
|
|
7220
7292
|
import { SqlClient as SqlClient24 } from "effect/unstable/sql/SqlClient";
|
|
7221
|
-
class SkillDefinitionRepositoryError extends
|
|
7222
|
-
message:
|
|
7293
|
+
class SkillDefinitionRepositoryError extends Schema42.TaggedErrorClass()("SkillDefinitionRepositoryError", {
|
|
7294
|
+
message: Schema42.String
|
|
7223
7295
|
}) {
|
|
7224
7296
|
}
|
|
7225
7297
|
|
|
7226
7298
|
class Service36 extends Context34.Service()("@relayfx/store-sql/skill/skill-definition-repository/Service") {
|
|
7227
7299
|
}
|
|
7228
|
-
var SkillDefinitionRow =
|
|
7229
|
-
id:
|
|
7230
|
-
current_revision:
|
|
7231
|
-
definition_json:
|
|
7232
|
-
created_at:
|
|
7233
|
-
updated_at:
|
|
7300
|
+
var SkillDefinitionRow = Schema42.Struct({
|
|
7301
|
+
id: Schema42.String,
|
|
7302
|
+
current_revision: Schema42.Finite,
|
|
7303
|
+
definition_json: Schema42.Unknown,
|
|
7304
|
+
created_at: Schema42.Union([Schema42.Date, Schema42.String, Schema42.Finite]),
|
|
7305
|
+
updated_at: Schema42.Union([Schema42.Date, Schema42.String, Schema42.Finite])
|
|
7234
7306
|
}).annotate({ identifier: "Relay.SkillDefinition.Row" });
|
|
7235
|
-
var SkillDefinitionRevisionRow =
|
|
7236
|
-
skill_definition_id:
|
|
7237
|
-
revision:
|
|
7238
|
-
definition_json:
|
|
7239
|
-
created_at:
|
|
7307
|
+
var SkillDefinitionRevisionRow = Schema42.Struct({
|
|
7308
|
+
skill_definition_id: Schema42.String,
|
|
7309
|
+
revision: Schema42.Finite,
|
|
7310
|
+
definition_json: Schema42.Unknown,
|
|
7311
|
+
created_at: Schema42.Union([Schema42.Date, Schema42.String, Schema42.Finite])
|
|
7240
7312
|
}).annotate({ identifier: "Relay.SkillDefinitionRevision.Row" });
|
|
7241
|
-
var ExecutionSkillPinRow =
|
|
7242
|
-
execution_id:
|
|
7243
|
-
skill_definition_id:
|
|
7244
|
-
skill_definition_revision:
|
|
7245
|
-
skill_definition_snapshot_json:
|
|
7246
|
-
created_at:
|
|
7313
|
+
var ExecutionSkillPinRow = Schema42.Struct({
|
|
7314
|
+
execution_id: Schema42.String,
|
|
7315
|
+
skill_definition_id: Schema42.String,
|
|
7316
|
+
skill_definition_revision: Schema42.Finite,
|
|
7317
|
+
skill_definition_snapshot_json: Schema42.Unknown,
|
|
7318
|
+
created_at: Schema42.Union([Schema42.Date, Schema42.String, Schema42.Finite])
|
|
7247
7319
|
}).annotate({ identifier: "Relay.ExecutionSkillPin.Row" });
|
|
7248
|
-
var cloneDefinition3 = (definition) =>
|
|
7320
|
+
var cloneDefinition3 = (definition) => Schema42.decodeUnknownSync(exports_skill_schema.Definition)(globalThis.structuredClone(definition));
|
|
7249
7321
|
var toRecord10 = (row) => ({
|
|
7250
7322
|
id: exports_ids_schema.SkillDefinitionId.make(row.id),
|
|
7251
7323
|
currentRevision: row.current_revision,
|
|
@@ -7301,11 +7373,11 @@ var missingSkillMessage = (requested, records) => {
|
|
|
7301
7373
|
return `Skill definition not found: ${requested.find((id) => !HashSet.has(found, id)) ?? requested[0]}`;
|
|
7302
7374
|
};
|
|
7303
7375
|
var toRepositoryError12 = (error5) => SkillDefinitionRepositoryError.make({ message: String(error5) });
|
|
7304
|
-
var mapPutError2 = (error5) =>
|
|
7305
|
-
var isUniqueViolation = (error5) => !
|
|
7306
|
-
var decodeRow12 = (row) =>
|
|
7307
|
-
var decodeRevisionRow2 = (row) =>
|
|
7308
|
-
var decodePinRow = (row) =>
|
|
7376
|
+
var mapPutError2 = (error5) => Schema42.is(SkillDefinitionRepositoryError)(error5) ? error5 : toRepositoryError12(error5);
|
|
7377
|
+
var isUniqueViolation = (error5) => !Schema42.is(SkillDefinitionRepositoryError)(error5) && /unique|duplicate/i.test(String(error5));
|
|
7378
|
+
var decodeRow12 = (row) => Schema42.decodeUnknownEffect(SkillDefinitionRow)(row).pipe(Effect42.mapError(toRepositoryError12));
|
|
7379
|
+
var decodeRevisionRow2 = (row) => Schema42.decodeUnknownEffect(SkillDefinitionRevisionRow)(row).pipe(Effect42.mapError(toRepositoryError12));
|
|
7380
|
+
var decodePinRow = (row) => Schema42.decodeUnknownEffect(ExecutionSkillPinRow)(row).pipe(Effect42.mapError(toRepositoryError12));
|
|
7309
7381
|
var layer29 = Layer36.effect(Service36, Effect42.gen(function* () {
|
|
7310
7382
|
const sql = yield* SqlClient24;
|
|
7311
7383
|
const columns3 = sql.literal(["id", "current_revision", "definition_json", "created_at", "updated_at"].join(", "));
|
|
@@ -7642,37 +7714,37 @@ __export(exports_steering_repository, {
|
|
|
7642
7714
|
SteeringDrainRow: () => SteeringDrainRow,
|
|
7643
7715
|
Service: () => Service37
|
|
7644
7716
|
});
|
|
7645
|
-
import { Context as Context35, Effect as Effect43, Layer as Layer37, Ref as Ref9, Schema as
|
|
7717
|
+
import { Context as Context35, Effect as Effect43, Layer as Layer37, Ref as Ref9, Schema as Schema43 } from "effect";
|
|
7646
7718
|
import { SqlClient as SqlClient25 } from "effect/unstable/sql/SqlClient";
|
|
7647
|
-
class SteeringRepositoryError extends
|
|
7648
|
-
message:
|
|
7719
|
+
class SteeringRepositoryError extends Schema43.TaggedErrorClass()("SteeringRepositoryError", {
|
|
7720
|
+
message: Schema43.String
|
|
7649
7721
|
}) {
|
|
7650
7722
|
}
|
|
7651
7723
|
|
|
7652
7724
|
class Service37 extends Context35.Service()("@relayfx/store-sql/steering/steering-repository/Service") {
|
|
7653
7725
|
}
|
|
7654
|
-
var SteeringKindSchema =
|
|
7655
|
-
var DbTimestamp4 =
|
|
7656
|
-
var SteeringMessageRow =
|
|
7657
|
-
execution_id:
|
|
7726
|
+
var SteeringKindSchema = Schema43.Literals(["steering", "follow_up"]);
|
|
7727
|
+
var DbTimestamp4 = Schema43.Union([Schema43.Date, Schema43.String, Schema43.Finite]);
|
|
7728
|
+
var SteeringMessageRow = Schema43.Struct({
|
|
7729
|
+
execution_id: Schema43.String,
|
|
7658
7730
|
kind: SteeringKindSchema,
|
|
7659
|
-
sequence:
|
|
7660
|
-
content_json:
|
|
7661
|
-
drain_id:
|
|
7662
|
-
consumed_at:
|
|
7731
|
+
sequence: Schema43.Union([Schema43.Finite, Schema43.String]),
|
|
7732
|
+
content_json: Schema43.Unknown,
|
|
7733
|
+
drain_id: Schema43.NullishOr(Schema43.String),
|
|
7734
|
+
consumed_at: Schema43.NullishOr(DbTimestamp4),
|
|
7663
7735
|
created_at: DbTimestamp4
|
|
7664
7736
|
}).annotate({ identifier: "Relay.SteeringMessage.Row" });
|
|
7665
|
-
var SteeringDrainRow =
|
|
7666
|
-
execution_id:
|
|
7737
|
+
var SteeringDrainRow = Schema43.Struct({
|
|
7738
|
+
execution_id: Schema43.String,
|
|
7667
7739
|
kind: SteeringKindSchema,
|
|
7668
|
-
drain_id:
|
|
7669
|
-
message_sequences_json:
|
|
7740
|
+
drain_id: Schema43.String,
|
|
7741
|
+
message_sequences_json: Schema43.Unknown,
|
|
7670
7742
|
created_at: DbTimestamp4
|
|
7671
7743
|
}).annotate({ identifier: "Relay.SteeringDrain.Row" });
|
|
7672
7744
|
var toRepositoryError13 = (error5) => SteeringRepositoryError.make({ message: String(error5) });
|
|
7673
|
-
var mapTransactionError = (effect) => effect.pipe(Effect43.mapError((error5) =>
|
|
7674
|
-
var decodeMessageRow = (row) =>
|
|
7675
|
-
var decodeDrainRow = (row) =>
|
|
7745
|
+
var mapTransactionError = (effect) => effect.pipe(Effect43.mapError((error5) => Schema43.is(SteeringRepositoryError)(error5) ? error5 : toRepositoryError13(error5)));
|
|
7746
|
+
var decodeMessageRow = (row) => Schema43.decodeUnknownEffect(SteeringMessageRow)(row).pipe(Effect43.mapError(toRepositoryError13));
|
|
7747
|
+
var decodeDrainRow = (row) => Schema43.decodeUnknownEffect(SteeringDrainRow)(row).pipe(Effect43.mapError(toRepositoryError13));
|
|
7676
7748
|
var toMessageRecord = (row) => {
|
|
7677
7749
|
const consumedAt = fromNullableDbTimestamp(row.consumed_at);
|
|
7678
7750
|
return {
|
|
@@ -7981,29 +8053,29 @@ __export(exports_tool_call_repository, {
|
|
|
7981
8053
|
DuplicateToolResult: () => DuplicateToolResult,
|
|
7982
8054
|
DuplicateToolCall: () => DuplicateToolCall
|
|
7983
8055
|
});
|
|
7984
|
-
import { Context as Context36, Effect as Effect47, Layer as Layer38, Schema as
|
|
8056
|
+
import { Context as Context36, Effect as Effect47, Layer as Layer38, Schema as Schema47 } from "effect";
|
|
7985
8057
|
import { dual } from "effect/Function";
|
|
7986
8058
|
|
|
7987
8059
|
// ../store-sql/src/tool/tool-call-records.ts
|
|
7988
|
-
import { Effect as Effect46, Schema as
|
|
8060
|
+
import { Effect as Effect46, Schema as Schema46 } from "effect";
|
|
7989
8061
|
import { SqlClient as SqlClient26 } from "effect/unstable/sql/SqlClient";
|
|
7990
8062
|
import { isSqlError as isSqlError2 } from "effect/unstable/sql/SqlError";
|
|
7991
8063
|
|
|
7992
8064
|
// ../store-sql/src/tool/tool-attempt-records.ts
|
|
7993
|
-
import { Effect as Effect44, Schema as
|
|
7994
|
-
var toolAttemptRow =
|
|
7995
|
-
id:
|
|
7996
|
-
tool_call_id:
|
|
7997
|
-
attempt_number:
|
|
7998
|
-
state:
|
|
7999
|
-
worker_id:
|
|
8000
|
-
claim_expires_at:
|
|
8001
|
-
error:
|
|
8002
|
-
created_at:
|
|
8003
|
-
completed_at:
|
|
8065
|
+
import { Effect as Effect44, Schema as Schema44 } from "effect";
|
|
8066
|
+
var toolAttemptRow = Schema44.Struct({
|
|
8067
|
+
id: Schema44.String,
|
|
8068
|
+
tool_call_id: Schema44.String,
|
|
8069
|
+
attempt_number: Schema44.Union([Schema44.Finite, Schema44.String, Schema44.BigInt]),
|
|
8070
|
+
state: Schema44.String,
|
|
8071
|
+
worker_id: Schema44.NullishOr(Schema44.String),
|
|
8072
|
+
claim_expires_at: Schema44.NullishOr(Schema44.Union([Schema44.Date, Schema44.String, Schema44.Finite])),
|
|
8073
|
+
error: Schema44.NullishOr(Schema44.String),
|
|
8074
|
+
created_at: Schema44.Union([Schema44.Date, Schema44.String, Schema44.Finite]),
|
|
8075
|
+
completed_at: Schema44.NullishOr(Schema44.Union([Schema44.Date, Schema44.String, Schema44.Finite]))
|
|
8004
8076
|
}).annotate({ identifier: "Relay.ToolAttempt.Row" });
|
|
8005
|
-
var MaxAttemptRow =
|
|
8006
|
-
max_attempt:
|
|
8077
|
+
var MaxAttemptRow = Schema44.Struct({
|
|
8078
|
+
max_attempt: Schema44.NullishOr(Schema44.Union([Schema44.Finite, Schema44.String, Schema44.BigInt]))
|
|
8007
8079
|
});
|
|
8008
8080
|
var toolAttemptId = (attemptNumber) => exports_ids_schema.ToolAttemptId.make(`tool-attempt:${attemptNumber}`);
|
|
8009
8081
|
var makeToolAttemptRecordOperations = ({
|
|
@@ -8027,15 +8099,15 @@ var makeToolAttemptRecordOperations = ({
|
|
|
8027
8099
|
id: exports_ids_schema.ToolAttemptId.make(row.id),
|
|
8028
8100
|
callId: exports_ids_schema.ToolCallId.make(row.tool_call_id),
|
|
8029
8101
|
attemptNumber: Number(row.attempt_number),
|
|
8030
|
-
state:
|
|
8102
|
+
state: Schema44.decodeUnknownSync(exports_tool_schema.AttemptState)(row.state),
|
|
8031
8103
|
...row.worker_id === null || row.worker_id === undefined ? {} : { workerId: row.worker_id },
|
|
8032
8104
|
...row.claim_expires_at === null || row.claim_expires_at === undefined ? {} : { claimExpiresAt: fromDbTimestamp(row.claim_expires_at) },
|
|
8033
8105
|
...row.error === null || row.error === undefined ? {} : { error: row.error },
|
|
8034
8106
|
createdAt: fromDbTimestamp(row.created_at),
|
|
8035
8107
|
...row.completed_at === null || row.completed_at === undefined ? {} : { completedAt: fromDbTimestamp(row.completed_at) }
|
|
8036
8108
|
});
|
|
8037
|
-
const decodeAttemptRow = (row) =>
|
|
8038
|
-
const decodeMaxAttemptRow = (row) =>
|
|
8109
|
+
const decodeAttemptRow = (row) => Schema44.decodeUnknownEffect(toolAttemptRow)(row).pipe(Effect44.mapError(toRepositoryError14));
|
|
8110
|
+
const decodeMaxAttemptRow = (row) => Schema44.decodeUnknownEffect(Schema44.UndefinedOr(MaxAttemptRow))(row).pipe(Effect44.mapError(toRepositoryError14));
|
|
8039
8111
|
const selectAttempts = (tenantId, executionId, callId) => sql`
|
|
8040
8112
|
SELECT ${attemptColumns}
|
|
8041
8113
|
FROM relay_tool_attempts
|
|
@@ -8118,13 +8190,13 @@ var makeToolAttemptRecordOperations = ({
|
|
|
8118
8190
|
};
|
|
8119
8191
|
|
|
8120
8192
|
// ../store-sql/src/tool/tool-work-operations.ts
|
|
8121
|
-
import { Effect as Effect45, Schema as
|
|
8122
|
-
var ExpiredCallRow =
|
|
8123
|
-
id:
|
|
8124
|
-
execution_id:
|
|
8125
|
-
active_attempt_id:
|
|
8193
|
+
import { Effect as Effect45, Schema as Schema45 } from "effect";
|
|
8194
|
+
var ExpiredCallRow = Schema45.Struct({
|
|
8195
|
+
id: Schema45.String,
|
|
8196
|
+
execution_id: Schema45.String,
|
|
8197
|
+
active_attempt_id: Schema45.NullishOr(Schema45.String)
|
|
8126
8198
|
});
|
|
8127
|
-
var IdRow =
|
|
8199
|
+
var IdRow = Schema45.Struct({ id: Schema45.String, execution_id: Schema45.String });
|
|
8128
8200
|
var makeToolWorkOperations = ({
|
|
8129
8201
|
records,
|
|
8130
8202
|
attempts,
|
|
@@ -8287,7 +8359,7 @@ var makeToolWorkOperations = ({
|
|
|
8287
8359
|
WHERE tenant_id = ${tenantId} AND placement_kind = 'remote' AND placement_key = ${input.queue}
|
|
8288
8360
|
AND state = 'running' AND claim_expires_at IS NOT NULL AND claim_expires_at <= ${ts(input.now)}
|
|
8289
8361
|
`.pipe(Effect45.mapError(toRepositoryError14));
|
|
8290
|
-
const expired = yield*
|
|
8362
|
+
const expired = yield* Schema45.decodeUnknownEffect(Schema45.Array(ExpiredCallRow))(expiredRows).pipe(Effect45.mapError(toRepositoryError14));
|
|
8291
8363
|
for (const row of expired) {
|
|
8292
8364
|
const executionId2 = exports_ids_schema.ExecutionId.make(row.execution_id);
|
|
8293
8365
|
if (row.active_attempt_id !== null && row.active_attempt_id !== undefined) {
|
|
@@ -8301,7 +8373,7 @@ var makeToolWorkOperations = ({
|
|
|
8301
8373
|
`.pipe(Effect45.mapError(toRepositoryError14));
|
|
8302
8374
|
}
|
|
8303
8375
|
const candidateRows = yield* selectClaimCandidate(tenantId, input).pipe(Effect45.mapError(toRepositoryError14));
|
|
8304
|
-
const candidates = yield*
|
|
8376
|
+
const candidates = yield* Schema45.decodeUnknownEffect(Schema45.Array(IdRow))(candidateRows).pipe(Effect45.mapError(toRepositoryError14));
|
|
8305
8377
|
const candidate = candidates[0];
|
|
8306
8378
|
if (candidate === undefined)
|
|
8307
8379
|
return;
|
|
@@ -8476,54 +8548,54 @@ var makeToolWorkOperations = ({
|
|
|
8476
8548
|
};
|
|
8477
8549
|
|
|
8478
8550
|
// ../store-sql/src/tool/tool-call-records.ts
|
|
8479
|
-
var toolCallRow =
|
|
8480
|
-
id:
|
|
8481
|
-
execution_id:
|
|
8482
|
-
name:
|
|
8483
|
-
input_json:
|
|
8484
|
-
definition_json:
|
|
8485
|
-
placement_kind:
|
|
8486
|
-
placement_key:
|
|
8487
|
-
state:
|
|
8488
|
-
wait_id:
|
|
8489
|
-
idempotency_key:
|
|
8490
|
-
available_at:
|
|
8491
|
-
active_attempt_id:
|
|
8492
|
-
claim_owner:
|
|
8493
|
-
claimed_at:
|
|
8494
|
-
claim_expires_at:
|
|
8495
|
-
external_outcome_json:
|
|
8496
|
-
external_outcome_at:
|
|
8497
|
-
metadata_json:
|
|
8498
|
-
created_at:
|
|
8499
|
-
updated_at:
|
|
8551
|
+
var toolCallRow = Schema46.Struct({
|
|
8552
|
+
id: Schema46.String,
|
|
8553
|
+
execution_id: Schema46.String,
|
|
8554
|
+
name: Schema46.String,
|
|
8555
|
+
input_json: Schema46.Unknown,
|
|
8556
|
+
definition_json: Schema46.NullishOr(Schema46.Unknown),
|
|
8557
|
+
placement_kind: Schema46.String,
|
|
8558
|
+
placement_key: Schema46.NullishOr(Schema46.String),
|
|
8559
|
+
state: Schema46.String,
|
|
8560
|
+
wait_id: Schema46.NullishOr(Schema46.String),
|
|
8561
|
+
idempotency_key: Schema46.String,
|
|
8562
|
+
available_at: Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite]),
|
|
8563
|
+
active_attempt_id: Schema46.NullishOr(Schema46.String),
|
|
8564
|
+
claim_owner: Schema46.NullishOr(Schema46.String),
|
|
8565
|
+
claimed_at: Schema46.NullishOr(Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite])),
|
|
8566
|
+
claim_expires_at: Schema46.NullishOr(Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite])),
|
|
8567
|
+
external_outcome_json: Schema46.NullishOr(Schema46.Unknown),
|
|
8568
|
+
external_outcome_at: Schema46.NullishOr(Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite])),
|
|
8569
|
+
metadata_json: Schema46.Unknown,
|
|
8570
|
+
created_at: Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite]),
|
|
8571
|
+
updated_at: Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite])
|
|
8500
8572
|
}).annotate({ identifier: "Relay.ToolCall.Row" });
|
|
8501
|
-
var toolResultRow =
|
|
8502
|
-
tool_call_id:
|
|
8503
|
-
output_json:
|
|
8504
|
-
error:
|
|
8505
|
-
metadata_json:
|
|
8506
|
-
created_at:
|
|
8573
|
+
var toolResultRow = Schema46.Struct({
|
|
8574
|
+
tool_call_id: Schema46.String,
|
|
8575
|
+
output_json: Schema46.Unknown,
|
|
8576
|
+
error: Schema46.NullishOr(Schema46.String),
|
|
8577
|
+
metadata_json: Schema46.Unknown,
|
|
8578
|
+
created_at: Schema46.Union([Schema46.Date, Schema46.String, Schema46.Finite])
|
|
8507
8579
|
}).annotate({ identifier: "Relay.ToolResult.Row" });
|
|
8508
8580
|
var metadata8 = (input) => input ?? {};
|
|
8509
8581
|
var normalizeCall = (call) => ({ ...call, metadata: metadata8(call.metadata) });
|
|
8510
8582
|
var sameCallIdentity = (left, right) => exports_shared_schema.canonicalEquals(normalizeCall(left), normalizeCall(right));
|
|
8511
8583
|
var toolCallRecordIdentity = { sameCallIdentity };
|
|
8512
|
-
var placementFromRow = (row) =>
|
|
8584
|
+
var placementFromRow = (row) => Schema46.decodeUnknownSync(exports_tool_schema.Placement)(row.placement_kind === "remote" ? { kind: "remote", queue: row.placement_key } : row.placement_kind === "mcp" ? { kind: "mcp", server_id: row.placement_key } : { kind: row.placement_kind });
|
|
8513
8585
|
var toCallRecord = (row) => {
|
|
8514
|
-
const definition = row.definition_json === null || row.definition_json === undefined ? undefined :
|
|
8515
|
-
const outcome = row.external_outcome_json === null || row.external_outcome_json === undefined ? undefined :
|
|
8586
|
+
const definition = row.definition_json === null || row.definition_json === undefined ? undefined : Schema46.decodeUnknownSync(exports_tool_schema.Definition)(decodeJson(row.definition_json));
|
|
8587
|
+
const outcome = row.external_outcome_json === null || row.external_outcome_json === undefined ? undefined : Schema46.decodeUnknownSync(exports_tool_schema.ExternalOutcome)(decodeJson(row.external_outcome_json));
|
|
8516
8588
|
return {
|
|
8517
8589
|
executionId: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
8518
8590
|
call: normalizeCall({
|
|
8519
8591
|
id: exports_ids_schema.ToolCallId.make(row.id),
|
|
8520
8592
|
name: row.name,
|
|
8521
|
-
input:
|
|
8522
|
-
metadata:
|
|
8593
|
+
input: Schema46.decodeUnknownSync(exports_shared_schema.JsonValue)(decodeJson(row.input_json)),
|
|
8594
|
+
metadata: Schema46.decodeUnknownSync(exports_shared_schema.Metadata)(decodeJson(row.metadata_json))
|
|
8523
8595
|
}),
|
|
8524
8596
|
...definition === undefined ? {} : { definition },
|
|
8525
8597
|
placement: placementFromRow(row),
|
|
8526
|
-
state:
|
|
8598
|
+
state: Schema46.decodeUnknownSync(exports_tool_schema.CallState)(row.state),
|
|
8527
8599
|
...row.wait_id === null || row.wait_id === undefined ? {} : { waitId: exports_ids_schema.WaitId.make(row.wait_id) },
|
|
8528
8600
|
idempotencyKey: row.idempotency_key,
|
|
8529
8601
|
availableAt: fromDbTimestamp(row.available_at),
|
|
@@ -8540,9 +8612,9 @@ var toCallRecord = (row) => {
|
|
|
8540
8612
|
var toResultRecord = (row) => ({
|
|
8541
8613
|
result: {
|
|
8542
8614
|
call_id: exports_ids_schema.ToolCallId.make(row.tool_call_id),
|
|
8543
|
-
output:
|
|
8615
|
+
output: Schema46.decodeUnknownSync(exports_shared_schema.JsonValue)(decodeJson(row.output_json)),
|
|
8544
8616
|
...row.error === null || row.error === undefined ? {} : { error: row.error },
|
|
8545
|
-
metadata:
|
|
8617
|
+
metadata: Schema46.decodeUnknownSync(exports_shared_schema.Metadata)(decodeJson(row.metadata_json))
|
|
8546
8618
|
},
|
|
8547
8619
|
createdAt: fromDbTimestamp(row.created_at)
|
|
8548
8620
|
});
|
|
@@ -8659,8 +8731,8 @@ var makeToolCallRecordSupport = ({ sql, errors, toolCallIdempotencyKey }) => {
|
|
|
8659
8731
|
`,
|
|
8660
8732
|
orElse: () => selectCallByKey
|
|
8661
8733
|
});
|
|
8662
|
-
const decodeCallRow = (row) =>
|
|
8663
|
-
const decodeResultRow = (row) =>
|
|
8734
|
+
const decodeCallRow = (row) => Schema46.decodeUnknownEffect(toolCallRow)(row).pipe(Effect46.mapError(toRepositoryError14));
|
|
8735
|
+
const decodeResultRow = (row) => Schema46.decodeUnknownEffect(toolResultRow)(row).pipe(Effect46.mapError(toRepositoryError14));
|
|
8664
8736
|
const decodeCall = Effect46.fn("ToolCallRepository.decodeCall")(function* (row) {
|
|
8665
8737
|
const decoded = yield* decodeCallRow(row);
|
|
8666
8738
|
return yield* Effect46.try({ try: () => toCallRecord(decoded), catch: toRepositoryError14 });
|
|
@@ -8792,44 +8864,44 @@ var makeToolCallRepository = ({
|
|
|
8792
8864
|
});
|
|
8793
8865
|
|
|
8794
8866
|
// ../store-sql/src/tool/tool-call-repository.ts
|
|
8795
|
-
class ToolCallRepositoryError extends
|
|
8796
|
-
message:
|
|
8867
|
+
class ToolCallRepositoryError extends Schema47.TaggedErrorClass()("ToolCallRepositoryError", {
|
|
8868
|
+
message: Schema47.String
|
|
8797
8869
|
}) {
|
|
8798
8870
|
}
|
|
8799
8871
|
|
|
8800
|
-
class ToolCallNotFound extends
|
|
8872
|
+
class ToolCallNotFound extends Schema47.TaggedErrorClass()("ToolCallNotFound", {
|
|
8801
8873
|
id: exports_ids_schema.ToolCallId
|
|
8802
8874
|
}) {
|
|
8803
8875
|
}
|
|
8804
8876
|
|
|
8805
|
-
class DuplicateToolCall extends
|
|
8877
|
+
class DuplicateToolCall extends Schema47.TaggedErrorClass()("DuplicateToolCall", {
|
|
8806
8878
|
id: exports_ids_schema.ToolCallId
|
|
8807
8879
|
}) {
|
|
8808
8880
|
}
|
|
8809
8881
|
|
|
8810
|
-
class DuplicateToolResult extends
|
|
8882
|
+
class DuplicateToolResult extends Schema47.TaggedErrorClass()("DuplicateToolResult", {
|
|
8811
8883
|
call_id: exports_ids_schema.ToolCallId
|
|
8812
8884
|
}) {
|
|
8813
8885
|
}
|
|
8814
8886
|
|
|
8815
|
-
class ToolCallConflict extends
|
|
8887
|
+
class ToolCallConflict extends Schema47.TaggedErrorClass()("ToolCallConflict", {
|
|
8816
8888
|
id: exports_ids_schema.ToolCallId
|
|
8817
8889
|
}) {
|
|
8818
8890
|
}
|
|
8819
8891
|
|
|
8820
|
-
class ToolCallTransitionRejected extends
|
|
8892
|
+
class ToolCallTransitionRejected extends Schema47.TaggedErrorClass()("ToolCallTransitionRejected", {
|
|
8821
8893
|
id: exports_ids_schema.ToolCallId,
|
|
8822
|
-
message:
|
|
8894
|
+
message: Schema47.String
|
|
8823
8895
|
}) {
|
|
8824
8896
|
}
|
|
8825
8897
|
|
|
8826
|
-
class ToolOutcomeConflict extends
|
|
8898
|
+
class ToolOutcomeConflict extends Schema47.TaggedErrorClass()("ToolOutcomeConflict", {
|
|
8827
8899
|
id: exports_ids_schema.ToolCallId
|
|
8828
8900
|
}) {
|
|
8829
8901
|
}
|
|
8830
8902
|
|
|
8831
|
-
class ToolClaimRejected extends
|
|
8832
|
-
message:
|
|
8903
|
+
class ToolClaimRejected extends Schema47.TaggedErrorClass()("ToolClaimRejected", {
|
|
8904
|
+
message: Schema47.String
|
|
8833
8905
|
}) {
|
|
8834
8906
|
}
|
|
8835
8907
|
var lengthPrefixed = (value) => `${[...value].length}:${value}`;
|
|
@@ -9296,57 +9368,57 @@ __export(exports_workspace_lease_repository, {
|
|
|
9296
9368
|
Service: () => Service39,
|
|
9297
9369
|
DuplicateWorkspaceLease: () => DuplicateWorkspaceLease
|
|
9298
9370
|
});
|
|
9299
|
-
import { Context as Context37, Effect as Effect48, Layer as Layer39, Schema as
|
|
9371
|
+
import { Context as Context37, Effect as Effect48, Layer as Layer39, Schema as Schema48 } from "effect";
|
|
9300
9372
|
import { SqlClient as SqlClient27 } from "effect/unstable/sql/SqlClient";
|
|
9301
|
-
class WorkspaceLeaseRepositoryError extends
|
|
9302
|
-
message:
|
|
9373
|
+
class WorkspaceLeaseRepositoryError extends Schema48.TaggedErrorClass()("WorkspaceLeaseRepositoryError", {
|
|
9374
|
+
message: Schema48.String
|
|
9303
9375
|
}) {
|
|
9304
9376
|
}
|
|
9305
9377
|
|
|
9306
|
-
class DuplicateWorkspaceLease extends
|
|
9378
|
+
class DuplicateWorkspaceLease extends Schema48.TaggedErrorClass()("DuplicateWorkspaceLease", {
|
|
9307
9379
|
execution_id: exports_ids_schema.ExecutionId
|
|
9308
9380
|
}) {
|
|
9309
9381
|
}
|
|
9310
9382
|
|
|
9311
|
-
class WorkspaceLeaseNotFound extends
|
|
9383
|
+
class WorkspaceLeaseNotFound extends Schema48.TaggedErrorClass()("WorkspaceLeaseNotFound", {
|
|
9312
9384
|
execution_id: exports_ids_schema.ExecutionId
|
|
9313
9385
|
}) {
|
|
9314
9386
|
}
|
|
9315
9387
|
|
|
9316
9388
|
class Service39 extends Context37.Service()("@relayfx/store-sql/workspace/workspace-lease-repository/Service") {
|
|
9317
9389
|
}
|
|
9318
|
-
var WorkspaceLeaseRow =
|
|
9319
|
-
id:
|
|
9320
|
-
execution_id:
|
|
9321
|
-
provider_key:
|
|
9322
|
-
sandbox_ref:
|
|
9323
|
-
latest_snapshot_ref:
|
|
9324
|
-
status:
|
|
9325
|
-
resume_strategy:
|
|
9326
|
-
region:
|
|
9327
|
-
request_json:
|
|
9328
|
-
metadata_json:
|
|
9329
|
-
created_at:
|
|
9330
|
-
updated_at:
|
|
9390
|
+
var WorkspaceLeaseRow = Schema48.Struct({
|
|
9391
|
+
id: Schema48.String,
|
|
9392
|
+
execution_id: Schema48.String,
|
|
9393
|
+
provider_key: Schema48.String,
|
|
9394
|
+
sandbox_ref: Schema48.NullishOr(Schema48.String),
|
|
9395
|
+
latest_snapshot_ref: Schema48.NullishOr(Schema48.String),
|
|
9396
|
+
status: Schema48.String,
|
|
9397
|
+
resume_strategy: Schema48.String,
|
|
9398
|
+
region: Schema48.NullishOr(Schema48.String),
|
|
9399
|
+
request_json: Schema48.NullishOr(Schema48.Unknown),
|
|
9400
|
+
metadata_json: Schema48.Unknown,
|
|
9401
|
+
created_at: Schema48.Union([Schema48.Date, Schema48.String, Schema48.Finite]),
|
|
9402
|
+
updated_at: Schema48.Union([Schema48.Date, Schema48.String, Schema48.Finite])
|
|
9331
9403
|
}).annotate({ identifier: "Relay.WorkspaceLease.Row" });
|
|
9332
|
-
var WorkspaceSnapshotRow =
|
|
9333
|
-
id:
|
|
9334
|
-
lease_id:
|
|
9335
|
-
execution_id:
|
|
9336
|
-
reason:
|
|
9337
|
-
snapshot_ref:
|
|
9338
|
-
metadata_json:
|
|
9339
|
-
created_at:
|
|
9404
|
+
var WorkspaceSnapshotRow = Schema48.Struct({
|
|
9405
|
+
id: Schema48.String,
|
|
9406
|
+
lease_id: Schema48.String,
|
|
9407
|
+
execution_id: Schema48.String,
|
|
9408
|
+
reason: Schema48.String,
|
|
9409
|
+
snapshot_ref: Schema48.String,
|
|
9410
|
+
metadata_json: Schema48.Unknown,
|
|
9411
|
+
created_at: Schema48.Union([Schema48.Date, Schema48.String, Schema48.Finite])
|
|
9340
9412
|
}).annotate({ identifier: "Relay.WorkspaceSnapshot.Row" });
|
|
9341
9413
|
var metadata9 = (input) => input ?? {};
|
|
9342
9414
|
var terminalStatuses = new Set(["released", "failed"]);
|
|
9343
9415
|
var isActive = (record2) => !terminalStatuses.has(record2.status);
|
|
9344
|
-
var cloneLease = (record2) =>
|
|
9345
|
-
var cloneSnapshot = (record2) =>
|
|
9416
|
+
var cloneLease = (record2) => Schema48.decodeUnknownSync(exports_workspace_schema.WorkspaceLeaseRecord)(globalThis.structuredClone(record2));
|
|
9417
|
+
var cloneSnapshot = (record2) => Schema48.decodeUnknownSync(exports_workspace_schema.WorkspaceSnapshotRecord)(globalThis.structuredClone(record2));
|
|
9346
9418
|
var toRepositoryError14 = (error5) => WorkspaceLeaseRepositoryError.make({ message: String(error5) });
|
|
9347
|
-
var decodeLeaseRow = (row) =>
|
|
9348
|
-
var decodeSnapshotRow = (row) =>
|
|
9349
|
-
var decodeRequest = (value) =>
|
|
9419
|
+
var decodeLeaseRow = (row) => Schema48.decodeUnknownEffect(WorkspaceLeaseRow)(row).pipe(Effect48.mapError(toRepositoryError14));
|
|
9420
|
+
var decodeSnapshotRow = (row) => Schema48.decodeUnknownEffect(WorkspaceSnapshotRow)(row).pipe(Effect48.mapError(toRepositoryError14));
|
|
9421
|
+
var decodeRequest = (value) => Schema48.decodeUnknownSync(exports_workspace_schema.WorkspaceRequest)(decodeJson(value));
|
|
9350
9422
|
var toLeaseRecord = (row) => ({
|
|
9351
9423
|
id: exports_ids_schema.WorkspaceLeaseId.make(row.id),
|
|
9352
9424
|
execution_id: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
@@ -9699,10 +9771,10 @@ __export(exports_workflow_definition_repository, {
|
|
|
9699
9771
|
Service: () => Service40,
|
|
9700
9772
|
RepositoryError: () => RepositoryError
|
|
9701
9773
|
});
|
|
9702
|
-
import { Clock as Clock4, Context as Context38, Effect as Effect49, Layer as Layer40, Schema as
|
|
9774
|
+
import { Clock as Clock4, Context as Context38, Effect as Effect49, Layer as Layer40, Schema as Schema49 } from "effect";
|
|
9703
9775
|
import { SqlClient as SqlClient28 } from "effect/unstable/sql/SqlClient";
|
|
9704
|
-
class RepositoryError extends
|
|
9705
|
-
message:
|
|
9776
|
+
class RepositoryError extends Schema49.TaggedErrorClass()("WorkflowDefinitionRepositoryError", {
|
|
9777
|
+
message: Schema49.String
|
|
9706
9778
|
}) {
|
|
9707
9779
|
}
|
|
9708
9780
|
|
|
@@ -9956,8 +10028,8 @@ var transition2 = (sql, tenant, id, status, now, data) => sql.withTransaction(Ef
|
|
|
9956
10028
|
var decodeDefinition = (row) => ({
|
|
9957
10029
|
id: exports_ids_schema.WorkflowDefinitionId.make(row.workflow_definition_id),
|
|
9958
10030
|
revision: Number(row.revision),
|
|
9959
|
-
digest:
|
|
9960
|
-
definition:
|
|
10031
|
+
digest: Schema49.decodeUnknownSync(exports_workflow_schema.DefinitionDigest)(row.digest),
|
|
10032
|
+
definition: Schema49.decodeUnknownSync(exports_workflow_schema.Definition)(decodeJson(row.definition_json)),
|
|
9961
10033
|
created_at: fromDbTimestamp(row.created_at)
|
|
9962
10034
|
});
|
|
9963
10035
|
var decodeRun = (row) => ({
|
|
@@ -9965,19 +10037,19 @@ var decodeRun = (row) => ({
|
|
|
9965
10037
|
pin: {
|
|
9966
10038
|
workflow_definition_id: exports_ids_schema.WorkflowDefinitionId.make(row.workflow_definition_id),
|
|
9967
10039
|
workflow_definition_revision: Number(row.workflow_definition_revision),
|
|
9968
|
-
workflow_definition_digest:
|
|
10040
|
+
workflow_definition_digest: Schema49.decodeUnknownSync(exports_workflow_schema.DefinitionDigest)(row.workflow_definition_digest)
|
|
9969
10041
|
},
|
|
9970
|
-
status:
|
|
10042
|
+
status: Schema49.decodeUnknownSync(exports_workflow_schema.RunStatus)(row.status),
|
|
9971
10043
|
created_at: fromDbTimestamp(row.created_at),
|
|
9972
10044
|
updated_at: fromDbTimestamp(row.updated_at)
|
|
9973
10045
|
});
|
|
9974
10046
|
var decodeOperation = (row) => ({
|
|
9975
10047
|
execution_id: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
9976
10048
|
operation_id: exports_ids_schema.WorkflowOperationId.make(row.operation_id),
|
|
9977
|
-
status:
|
|
10049
|
+
status: Schema49.decodeUnknownSync(exports_workflow_schema.OperationStatus)(row.status),
|
|
9978
10050
|
...row.fan_out_id === null || row.fan_out_id === undefined ? {} : { fan_out_id: exports_ids_schema.ChildFanOutId.make(row.fan_out_id) },
|
|
9979
10051
|
...row.decision === null || row.decision === undefined ? {} : { decision: Boolean(row.decision) },
|
|
9980
|
-
...row.output_json === null || row.output_json === undefined ? {} : { output:
|
|
10052
|
+
...row.output_json === null || row.output_json === undefined ? {} : { output: Schema49.decodeUnknownSync(exports_workflow_schema.OperationState.fields.output)(decodeJson(row.output_json)) },
|
|
9981
10053
|
...row.attempt === null || row.attempt === undefined ? {} : { attempt: Number(row.attempt) },
|
|
9982
10054
|
...row.backoff_until === null || row.backoff_until === undefined ? {} : { backoff_until: fromDbTimestamp(row.backoff_until) },
|
|
9983
10055
|
...row.compensation_operation_id === null || row.compensation_operation_id === undefined ? {} : { compensation_operation_id: exports_ids_schema.WorkflowOperationId.make(row.compensation_operation_id) },
|
|
@@ -9988,17 +10060,17 @@ var decodeOperation = (row) => ({
|
|
|
9988
10060
|
var decodeLifecycle = (row) => ({
|
|
9989
10061
|
execution_id: exports_ids_schema.ExecutionId.make(row.execution_id),
|
|
9990
10062
|
sequence: Number(row.sequence),
|
|
9991
|
-
type:
|
|
10063
|
+
type: Schema49.decodeUnknownSync(exports_workflow_schema.LifecycleEventType)(row.event_type),
|
|
9992
10064
|
...row.operation_id === null || row.operation_id === undefined ? {} : { operation_id: exports_ids_schema.WorkflowOperationId.make(row.operation_id) },
|
|
9993
|
-
...row.data_json === null || row.data_json === undefined ? {} : { data:
|
|
10065
|
+
...row.data_json === null || row.data_json === undefined ? {} : { data: Schema49.decodeUnknownSync(exports_workflow_schema.LifecycleEvent.fields.data)(decodeJson(row.data_json)) },
|
|
9994
10066
|
created_at: fromDbTimestamp(row.created_at)
|
|
9995
10067
|
});
|
|
9996
10068
|
// ../runtime/src/tool/tool-runtime-service.ts
|
|
9997
10069
|
import { Tool as AiTool } from "effect/unstable/ai";
|
|
9998
|
-
import { Chunk, Context as Context41, Effect as Effect55, Function as Function8, HashSet as HashSet3, Layer as Layer45, Option as Option12, Ref as Ref12, Schema as
|
|
10070
|
+
import { Chunk, Context as Context41, Effect as Effect55, Function as Function8, HashSet as HashSet3, Layer as Layer45, Option as Option12, Ref as Ref12, Schema as Schema52, Sink, Stream as Stream10 } from "effect";
|
|
9999
10071
|
|
|
10000
10072
|
// ../runtime/src/execution/event-log-service.ts
|
|
10001
|
-
import { Context as Context39, Effect as Effect53, Function as Function7, Layer as Layer43, Option as Option10, Schema as
|
|
10073
|
+
import { Context as Context39, Effect as Effect53, Function as Function7, Layer as Layer43, Option as Option10, Schema as Schema50, Stream as Stream9 } from "effect";
|
|
10002
10074
|
|
|
10003
10075
|
// ../runtime/src/execution/event-log-memory.ts
|
|
10004
10076
|
import { Effect as Effect51, HashMap as HashMap2, HashSet as HashSet2, Layer as Layer41, Option as Option8, PubSub as PubSub5, Ref as Ref10, Stream as Stream7 } from "effect";
|
|
@@ -10351,14 +10423,14 @@ var makeRepositoryLayer = (eventLog) => {
|
|
|
10351
10423
|
};
|
|
10352
10424
|
|
|
10353
10425
|
// ../runtime/src/execution/event-log-service.ts
|
|
10354
|
-
class EventLogCursorNotFound2 extends
|
|
10426
|
+
class EventLogCursorNotFound2 extends Schema50.TaggedErrorClass()("EventLogCursorNotFound", {
|
|
10355
10427
|
execution_id: exports_ids_schema.ExecutionId,
|
|
10356
10428
|
cursor: exports_shared_schema.NonEmptyString
|
|
10357
10429
|
}) {
|
|
10358
10430
|
}
|
|
10359
10431
|
|
|
10360
|
-
class EventLogError extends
|
|
10361
|
-
message:
|
|
10432
|
+
class EventLogError extends Schema50.TaggedErrorClass()("EventLogError", {
|
|
10433
|
+
message: Schema50.String
|
|
10362
10434
|
}) {
|
|
10363
10435
|
}
|
|
10364
10436
|
|
|
@@ -10427,19 +10499,19 @@ var sumUsage2 = Effect53.fn("EventLog.sumUsage.call")(function* (executionId) {
|
|
|
10427
10499
|
});
|
|
10428
10500
|
|
|
10429
10501
|
// ../runtime/src/wait/wait-service.ts
|
|
10430
|
-
import { Context as Context40, Duration as Duration2, Effect as Effect54, Layer as Layer44, Option as Option11, Schema as
|
|
10431
|
-
class WaitNotFound2 extends
|
|
10502
|
+
import { Context as Context40, Duration as Duration2, Effect as Effect54, Layer as Layer44, Option as Option11, Schema as Schema51 } from "effect";
|
|
10503
|
+
class WaitNotFound2 extends Schema51.TaggedErrorClass()("WaitNotFound", {
|
|
10432
10504
|
wait_id: exports_ids_schema.WaitId
|
|
10433
10505
|
}) {
|
|
10434
10506
|
}
|
|
10435
10507
|
|
|
10436
|
-
class WaitDefinitionMissing extends
|
|
10508
|
+
class WaitDefinitionMissing extends Schema51.TaggedErrorClass()("WaitDefinitionMissing", {
|
|
10437
10509
|
envelope_id: exports_ids_schema.EnvelopeId
|
|
10438
10510
|
}) {
|
|
10439
10511
|
}
|
|
10440
10512
|
|
|
10441
|
-
class WaitServiceError extends
|
|
10442
|
-
message:
|
|
10513
|
+
class WaitServiceError extends Schema51.TaggedErrorClass()("WaitServiceError", {
|
|
10514
|
+
message: Schema51.String
|
|
10443
10515
|
}) {
|
|
10444
10516
|
}
|
|
10445
10517
|
|
|
@@ -10719,20 +10791,20 @@ var upsertTool = (registry, tool) => {
|
|
|
10719
10791
|
return Chunk.map(registry, (registered) => registered.definition.name === tool.definition.name ? tool : registered);
|
|
10720
10792
|
};
|
|
10721
10793
|
var registerTool = (tools, tool) => Ref12.update(tools, (registry) => upsertTool(registry, tool));
|
|
10722
|
-
var jsonValue2 = (value) =>
|
|
10723
|
-
var fallbackParametersSchema =
|
|
10794
|
+
var jsonValue2 = (value) => Schema52.decodeUnknownSync(exports_shared_schema.JsonValue)(value);
|
|
10795
|
+
var fallbackParametersSchema = Schema52.Struct({});
|
|
10724
10796
|
var parametersForInputSchema = (inputSchema) => {
|
|
10725
10797
|
const schema = exports_tool_schema.parametersSchema(inputSchema);
|
|
10726
10798
|
return schema.ast._tag === "Unknown" || schema.ast._tag === "Declaration" ? { parameters: fallbackParametersSchema, jsonSchema: inputSchema } : { parameters: schema };
|
|
10727
10799
|
};
|
|
10728
10800
|
var attachJsonSchema = (tool, jsonSchema) => jsonSchema === undefined ? tool : Object.assign(tool, { jsonSchema });
|
|
10729
|
-
var isStructFieldMap = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((field) =>
|
|
10801
|
+
var isStructFieldMap = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((field) => Schema52.isSchema(field));
|
|
10730
10802
|
var jsonSchemaFromEffectToolParameters = (tool) => {
|
|
10731
10803
|
const parameters = tool.parametersSchema;
|
|
10732
|
-
if (
|
|
10804
|
+
if (Schema52.isSchema(parameters))
|
|
10733
10805
|
return AiTool.getJsonSchema(tool);
|
|
10734
10806
|
if (isStructFieldMap(parameters))
|
|
10735
|
-
return AiTool.getJsonSchemaFromSchema(
|
|
10807
|
+
return AiTool.getJsonSchemaFromSchema(Schema52.Struct(parameters));
|
|
10736
10808
|
return AiTool.getJsonSchema(tool);
|
|
10737
10809
|
};
|
|
10738
10810
|
var runHandledToolkitTool = (toolkit, name, input, services) => {
|
|
@@ -10746,7 +10818,7 @@ var runHandledToolkitTool = (toolkit, name, input, services) => {
|
|
|
10746
10818
|
message: "Tool handler did not produce a final result"
|
|
10747
10819
|
})),
|
|
10748
10820
|
onSome: (result) => result.isFailure ? Effect55.fail(ToolExecutionFailed.make({ tool_name: String(name), message: String(result.result) })) : Effect55.succeed(jsonValue2(result.encodedResult))
|
|
10749
|
-
})), Effect55.provide(services), Effect55.mapError((error5) =>
|
|
10821
|
+
})), Effect55.provide(services), Effect55.mapError((error5) => Schema52.is(ToolExecutionFailed)(error5) ? error5 : ToolExecutionFailed.make({ tool_name: String(name), message: String(error5) })));
|
|
10750
10822
|
};
|
|
10751
10823
|
var finalToolResult = (tool, input, idempotencyKey) => Effect55.gen(function* () {
|
|
10752
10824
|
if (tool.run === undefined) {
|
|
@@ -10843,7 +10915,7 @@ var recordRequested = (repository, eventLog, input, tool) => repository.ensureCa
|
|
|
10843
10915
|
var repairResultEvent = (eventLog, input, record2) => ensureToolEvent(eventLog, resultEvent({ ...input, createdAt: record2.createdAt - 1 }, record2.result, input.eventSequence + 1));
|
|
10844
10916
|
var persistReceived = (repository, input, result) => repository.recordResult({ executionId: input.executionId, result, createdAt: input.createdAt + 1 }).pipe(Effect55.catchTag("DuplicateToolResult", () => repository.getResult(input.executionId, result.call_id).pipe(Effect55.mapError(mapRepositoryError2), Effect55.flatMap((existing) => existing === undefined ? Effect55.fail(ToolRuntimeError.make({ message: "DuplicateToolResult" })) : Effect55.succeed(existing)))), Effect55.mapError(preserveRecordResultError));
|
|
10845
10917
|
var recordReceived = (eventLog, input, record2) => ensureToolEvent(eventLog, resultEvent({ ...input, createdAt: record2.createdAt - 1 }, record2.result, input.eventSequence + 1)).pipe(Effect55.as(record2.result));
|
|
10846
|
-
var nonEmptyName = (name) =>
|
|
10918
|
+
var nonEmptyName = (name) => Schema52.decodeUnknownSync(exports_shared_schema.NonEmptyString)(name);
|
|
10847
10919
|
var needsApprovalFromEffectTool = (tool) => tool.needsApproval === undefined ? undefined : typeof tool.needsApproval === "boolean" ? tool.needsApproval : true;
|
|
10848
10920
|
var definitionFromEffectTool = (modelTool, options) => ({
|
|
10849
10921
|
name: modelTool.name,
|
|
@@ -10884,8 +10956,8 @@ var tool = Function8.dual(2, (name, options) => {
|
|
|
10884
10956
|
tool: effectTool,
|
|
10885
10957
|
...options.placement === undefined ? {} : { placement: options.placement },
|
|
10886
10958
|
...options.requiredPermissions === undefined ? {} : { requiredPermissions: options.requiredPermissions },
|
|
10887
|
-
validateInput: (input) =>
|
|
10888
|
-
run: (input, context) =>
|
|
10959
|
+
validateInput: (input) => Schema52.decodeUnknownEffect(inputSchema)(input).pipe(Effect55.mapError((error5) => ToolInputInvalid.make({ tool_name: name, message: error5.message })), Effect55.asVoid),
|
|
10960
|
+
run: (input, context) => Schema52.decodeUnknownEffect(inputSchema)(input).pipe(Effect55.mapError((error5) => ToolExecutionFailed.make({ tool_name: name, message: error5.message })), Effect55.flatMap((decoded) => options.run(decoded, context)), Effect55.provideService(ToolCallInfo, context), Effect55.flatMap((output) => Schema52.encodeUnknownEffect(outputSchema)(output).pipe(Effect55.mapError((error5) => ToolExecutionFailed.make({ tool_name: name, message: error5.message })))), Effect55.map(jsonValue2))
|
|
10889
10961
|
};
|
|
10890
10962
|
});
|
|
10891
10963
|
var dynamicTool = Function8.dual(2, (name, options) => {
|
|
@@ -10893,7 +10965,7 @@ var dynamicTool = Function8.dual(2, (name, options) => {
|
|
|
10893
10965
|
const modelTool = attachJsonSchema(AiTool.dynamic(name, {
|
|
10894
10966
|
description: options.description,
|
|
10895
10967
|
parameters: parameters.parameters,
|
|
10896
|
-
success:
|
|
10968
|
+
success: Schema52.Unknown,
|
|
10897
10969
|
needsApproval: options.needsApproval
|
|
10898
10970
|
}), parameters.jsonSchema);
|
|
10899
10971
|
return {
|
|
@@ -10938,7 +11010,7 @@ var externalOutcomeResult = (call, input) => {
|
|
|
10938
11010
|
return Effect55.succeed(placementFailureResult(input, call.externalOutcome.message));
|
|
10939
11011
|
}
|
|
10940
11012
|
const placement = call.placement.kind;
|
|
10941
|
-
return
|
|
11013
|
+
return Schema52.decodeUnknownEffect(exports_tool_schema.resultSchema(call.definition.output_schema))(call.externalOutcome.output).pipe(Effect55.map((output) => ({ call_id: input.call.id, output: jsonValue2(output) })), Effect55.catch((error5) => Effect55.succeed(placementFailureResult(input, `invalid ${placement} result: ${error5.message}`))));
|
|
10942
11014
|
};
|
|
10943
11015
|
var runExternalTool = (repository, waits, call, input) => Effect55.gen(function* () {
|
|
10944
11016
|
const waitId2 = placementWaitId(input);
|
|
@@ -10972,7 +11044,7 @@ var runExternalTool = (repository, waits, call, input) => Effect55.gen(function*
|
|
|
10972
11044
|
return placementFailureResult(input, "Tool execution timed out");
|
|
10973
11045
|
if (wait.state === "cancelled")
|
|
10974
11046
|
return placementFailureResult(input, "Tool execution cancelled");
|
|
10975
|
-
const repairedCall = waitingCall.externalOutcome === undefined && waitingCall.placement.kind === "client" ? yield*
|
|
11047
|
+
const repairedCall = waitingCall.externalOutcome === undefined && waitingCall.placement.kind === "client" ? yield* Schema52.decodeUnknownEffect(exports_tool_schema.ExternalOutcome)(wait.metadata.external_outcome).pipe(Effect55.mapError((error5) => ToolRuntimeError.make({ message: error5.message })), Effect55.flatMap((outcome) => repository.acceptClientOutcome({
|
|
10976
11048
|
executionId: input.executionId,
|
|
10977
11049
|
callId: input.call.id,
|
|
10978
11050
|
outcome,
|
|
@@ -11137,11 +11209,11 @@ __export(exports_runtime, {
|
|
|
11137
11209
|
});
|
|
11138
11210
|
|
|
11139
11211
|
// ../runtime/src/child/child-fan-out-runtime.ts
|
|
11140
|
-
import { Clock as Clock5, Context as Context44, Effect as Effect58, FiberMap, Layer as Layer48, Schema as
|
|
11212
|
+
import { Clock as Clock5, Context as Context44, Effect as Effect58, FiberMap, Layer as Layer48, Schema as Schema55 } from "effect";
|
|
11141
11213
|
|
|
11142
11214
|
// ../runtime/src/child/child-fan-out-transition-service.ts
|
|
11143
|
-
import { Context as Context43, Effect as Effect57, Layer as Layer47, Option as Option13, Schema as
|
|
11144
|
-
class ChildFanOutTransitionError extends
|
|
11215
|
+
import { Context as Context43, Effect as Effect57, Layer as Layer47, Option as Option13, Schema as Schema54 } from "effect";
|
|
11216
|
+
class ChildFanOutTransitionError extends Schema54.TaggedErrorClass()("ChildFanOutTransitionError", { message: Schema54.String }) {
|
|
11145
11217
|
}
|
|
11146
11218
|
|
|
11147
11219
|
class Service43 extends Context43.Service()("@relayfx/runtime/child/child-fan-out-transition-service/Service") {
|
|
@@ -11208,7 +11280,7 @@ var terminal2 = Effect57.fn("ChildFanOutTransitionService.terminal.call")(functi
|
|
|
11208
11280
|
class HandlerService extends Context44.Service()("@relayfx/runtime/child/child-fan-out-runtime/HandlerService") {
|
|
11209
11281
|
}
|
|
11210
11282
|
|
|
11211
|
-
class ChildFanOutRuntimeError extends
|
|
11283
|
+
class ChildFanOutRuntimeError extends Schema55.TaggedErrorClass()("ChildFanOutRuntimeError", { message: Schema55.String }) {
|
|
11212
11284
|
}
|
|
11213
11285
|
|
|
11214
11286
|
class Service44 extends Context44.Service()("@relayfx/runtime/child/child-fan-out-runtime/Service") {
|
|
@@ -11275,17 +11347,17 @@ var layerFromRuntime = Layer48.effect(Service44, Effect58.gen(function* () {
|
|
|
11275
11347
|
}).pipe(Effect58.mapError(runtimeError)));
|
|
11276
11348
|
|
|
11277
11349
|
// ../runtime/src/state/execution-state-service.ts
|
|
11278
|
-
import { Config as Config2, Context as Context45, Effect as Effect59, Function as Function10, Layer as Layer49, Schema as
|
|
11350
|
+
import { Config as Config2, Context as Context45, Effect as Effect59, Function as Function10, Layer as Layer49, Schema as Schema56 } from "effect";
|
|
11279
11351
|
var StateVersionConflict3 = exports_execution_state_repository.StateVersionConflict;
|
|
11280
11352
|
|
|
11281
|
-
class StateValueInvalid extends
|
|
11282
|
-
key:
|
|
11283
|
-
message:
|
|
11353
|
+
class StateValueInvalid extends Schema56.TaggedErrorClass()("StateValueInvalid", {
|
|
11354
|
+
key: Schema56.String,
|
|
11355
|
+
message: Schema56.String
|
|
11284
11356
|
}) {
|
|
11285
11357
|
}
|
|
11286
11358
|
|
|
11287
|
-
class ExecutionStateError extends
|
|
11288
|
-
message:
|
|
11359
|
+
class ExecutionStateError extends Schema56.TaggedErrorClass()("ExecutionStateError", {
|
|
11360
|
+
message: Schema56.String
|
|
11289
11361
|
}) {
|
|
11290
11362
|
}
|
|
11291
11363
|
var key3 = Function10.dual(2, (name, schema) => ({
|
|
@@ -11305,7 +11377,7 @@ var layer38 = Layer49.effect(Service45, Effect59.gen(function* () {
|
|
|
11305
11377
|
const row = yield* repository.get(executionId, stateKey.name).pipe(Effect59.mapError(stateError));
|
|
11306
11378
|
if (row === undefined)
|
|
11307
11379
|
return;
|
|
11308
|
-
return yield*
|
|
11380
|
+
return yield* Schema56.decodeUnknownEffect(stateKey.schema)(row.value).pipe(Effect59.mapError((cause) => invalid(stateKey.name, cause)));
|
|
11309
11381
|
});
|
|
11310
11382
|
const getRecord = Effect59.fn("ExecutionStateService.getRecord")((executionId, stateKey) => repository.get(executionId, stateKey).pipe(Effect59.mapError(stateError)));
|
|
11311
11383
|
const put4 = Effect59.fn("ExecutionStateService.put")(function* (input) {
|
|
@@ -11314,8 +11386,8 @@ var layer38 = Layer49.effect(Service45, Effect59.gen(function* () {
|
|
|
11314
11386
|
if (replay2 !== undefined && replay2.key === input.key.name && replay2.op === "put" && replay2.record !== undefined)
|
|
11315
11387
|
return replay2.record;
|
|
11316
11388
|
}
|
|
11317
|
-
const value = yield*
|
|
11318
|
-
const encoded = yield*
|
|
11389
|
+
const value = yield* Schema56.encodeUnknownEffect(input.key.schema)(input.value).pipe(Effect59.mapError((cause) => invalid(input.key.name, cause)));
|
|
11390
|
+
const encoded = yield* Schema56.encodeEffect(Schema56.UnknownFromJsonString)(value).pipe(Effect59.mapError((cause) => invalid(input.key.name, cause)));
|
|
11319
11391
|
const bytes = new TextEncoder().encode(encoded);
|
|
11320
11392
|
let eventValue = { value };
|
|
11321
11393
|
if (bytes.byteLength > eventInlineMaxBytes) {
|
|
@@ -11330,9 +11402,9 @@ var layer38 = Layer49.effect(Service45, Effect59.gen(function* () {
|
|
|
11330
11402
|
...input.expectedVersion === undefined ? {} : { expectedVersion: input.expectedVersion },
|
|
11331
11403
|
...input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey },
|
|
11332
11404
|
updatedAt: input.updatedAt
|
|
11333
|
-
}).pipe(Effect59.mapError((cause) =>
|
|
11405
|
+
}).pipe(Effect59.mapError((cause) => Schema56.is(exports_execution_state_repository.StateVersionConflict)(cause) ? cause : stateError(cause)));
|
|
11334
11406
|
});
|
|
11335
|
-
const remove3 = Effect59.fn("ExecutionStateService.remove")((input) => repository.remove(input).pipe(Effect59.mapError((cause) =>
|
|
11407
|
+
const remove3 = Effect59.fn("ExecutionStateService.remove")((input) => repository.remove(input).pipe(Effect59.mapError((cause) => Schema56.is(exports_execution_state_repository.StateVersionConflict)(cause) ? cause : stateError(cause))));
|
|
11336
11408
|
const list12 = Effect59.fn("ExecutionStateService.list")((input) => repository.list(input).pipe(Effect59.mapError(stateError)));
|
|
11337
11409
|
return Service45.of({ getRecord, get: get12, put: put4, remove: remove3, list: list12 });
|
|
11338
11410
|
}));
|
|
@@ -11340,7 +11412,7 @@ var memoryRepositoryDependencies = Layer49.mergeAll(exports_execution_repository
|
|
|
11340
11412
|
var memoryLayer36 = layer38.pipe(Layer49.provide(exports_execution_state_repository.memoryLayer.pipe(Layer49.provide(memoryRepositoryDependencies))));
|
|
11341
11413
|
|
|
11342
11414
|
// ../runtime/src/runner/runner-runtime-service.ts
|
|
11343
|
-
import { Config as Config8, Context as Context70, Crypto as Crypto4, Duration as Duration7, Effect as Effect99, Layer as Layer81, Option as Option26, Schema as
|
|
11415
|
+
import { Config as Config8, Context as Context70, Crypto as Crypto4, Duration as Duration7, Effect as Effect99, Layer as Layer81, Option as Option26, Schema as Schema92, Stream as Stream16 } from "effect";
|
|
11344
11416
|
import {
|
|
11345
11417
|
ClusterWorkflowEngine,
|
|
11346
11418
|
HttpRunner,
|
|
@@ -11361,7 +11433,7 @@ import { WorkflowEngine as WorkflowEngine2 } from "effect/unstable/workflow";
|
|
|
11361
11433
|
import { LanguageModel as LanguageModel2 } from "effect/unstable/ai";
|
|
11362
11434
|
|
|
11363
11435
|
// ../runtime/src/agent/agent-registry-service.ts
|
|
11364
|
-
import { Clock as Clock6, Context as Context46, Crypto as Crypto2, Effect as Effect61, HashSet as HashSet4, Layer as Layer50, Option as Option14, Schema as
|
|
11436
|
+
import { Clock as Clock6, Context as Context46, Crypto as Crypto2, Effect as Effect61, HashSet as HashSet4, Layer as Layer50, Option as Option14, Schema as Schema57 } from "effect";
|
|
11365
11437
|
|
|
11366
11438
|
// ../runtime/src/tool/tool-input-schema-digest.ts
|
|
11367
11439
|
import { Crypto, Effect as Effect60, Encoding } from "effect";
|
|
@@ -11383,13 +11455,13 @@ var digestDefinitions = Effect60.fn("ToolInputSchemaDigest.digestDefinitions")(f
|
|
|
11383
11455
|
});
|
|
11384
11456
|
|
|
11385
11457
|
// ../runtime/src/agent/agent-registry-service.ts
|
|
11386
|
-
class AgentDefinitionInvalid extends
|
|
11387
|
-
message:
|
|
11458
|
+
class AgentDefinitionInvalid extends Schema57.TaggedErrorClass()("AgentDefinitionInvalid", {
|
|
11459
|
+
message: Schema57.String
|
|
11388
11460
|
}) {
|
|
11389
11461
|
}
|
|
11390
11462
|
|
|
11391
|
-
class AgentRegistryError extends
|
|
11392
|
-
message:
|
|
11463
|
+
class AgentRegistryError extends Schema57.TaggedErrorClass()("AgentRegistryError", {
|
|
11464
|
+
message: Schema57.String
|
|
11393
11465
|
}) {
|
|
11394
11466
|
}
|
|
11395
11467
|
|
|
@@ -11431,7 +11503,7 @@ var transferToolName = (name) => `transfer_to_${name.trim().toLowerCase().replac
|
|
|
11431
11503
|
var validateTurnPolicySnapshot = Effect61.fn("AgentRegistry.validateTurnPolicySnapshot")(function* (snapshot) {
|
|
11432
11504
|
if (snapshot === undefined)
|
|
11433
11505
|
return;
|
|
11434
|
-
const decoded = yield*
|
|
11506
|
+
const decoded = yield* Schema57.decodeUnknownEffect(exports_agent_schema.TurnPolicySnapshot)(snapshot).pipe(Effect61.mapError(() => AgentDefinitionInvalid.make({ message: "definition.turn_policy must be a valid turn policy snapshot" })));
|
|
11435
11507
|
let nodes = 0;
|
|
11436
11508
|
const pending = [
|
|
11437
11509
|
{ snapshot: decoded, depth: 1 }
|
|
@@ -11575,35 +11647,35 @@ var listRevisions3 = Effect61.fn("AgentRegistry.listRevisions.call")(function* (
|
|
|
11575
11647
|
});
|
|
11576
11648
|
|
|
11577
11649
|
// ../runtime/src/agent/agent-loop-service.ts
|
|
11578
|
-
import { Cause as Cause2, Config as Config4, Context as Context64, Crypto as Crypto3, Effect as Effect93, HashSet as HashSet7, Layer as Layer75, Option as Option24, Ref as Ref19, Schema as
|
|
11579
|
-
import { AiError as AiError3, Chat, LanguageModel, Prompt as
|
|
11650
|
+
import { Cause as Cause2, Config as Config4, Context as Context64, Crypto as Crypto3, Effect as Effect93, HashSet as HashSet7, Layer as Layer75, Option as Option24, Ref as Ref19, Schema as Schema85, Stream as Stream13 } from "effect";
|
|
11651
|
+
import { AiError as AiError3, Chat, LanguageModel, Prompt as Prompt7, Tokenizer, Tool as AiTool2, Toolkit as Toolkit2 } from "effect/unstable/ai";
|
|
11580
11652
|
|
|
11581
11653
|
// ../runtime/src/child/child-run-service.ts
|
|
11582
|
-
import { Context as Context48, Effect as Effect63, Function as Function12, HashSet as HashSet5, Layer as Layer52, Option as Option15, Result as Result2, Schema as
|
|
11654
|
+
import { Context as Context48, Effect as Effect63, Function as Function12, HashSet as HashSet5, Layer as Layer52, Option as Option15, Result as Result2, Schema as Schema59 } from "effect";
|
|
11583
11655
|
|
|
11584
11656
|
// ../runtime/src/workspace/workspace-provider-service.ts
|
|
11585
|
-
import { Context as Context47, Effect as Effect62, Function as Function11, Layer as Layer51, Ref as Ref13, Schema as
|
|
11657
|
+
import { Context as Context47, Effect as Effect62, Function as Function11, Layer as Layer51, Ref as Ref13, Schema as Schema58 } from "effect";
|
|
11586
11658
|
|
|
11587
|
-
class WorkspaceNotFound extends
|
|
11659
|
+
class WorkspaceNotFound extends Schema58.TaggedErrorClass()("WorkspaceNotFound", {
|
|
11588
11660
|
sandbox_ref: exports_ids_schema.WorkspaceRef
|
|
11589
11661
|
}) {
|
|
11590
11662
|
}
|
|
11591
11663
|
|
|
11592
|
-
class WorkspaceUnavailable extends
|
|
11664
|
+
class WorkspaceUnavailable extends Schema58.TaggedErrorClass()("WorkspaceUnavailable", {
|
|
11593
11665
|
sandbox_ref: exports_ids_schema.WorkspaceRef,
|
|
11594
|
-
message:
|
|
11666
|
+
message: Schema58.String
|
|
11595
11667
|
}) {
|
|
11596
11668
|
}
|
|
11597
11669
|
|
|
11598
|
-
class WorkspaceCapabilityUnsupported extends
|
|
11599
|
-
capability:
|
|
11670
|
+
class WorkspaceCapabilityUnsupported extends Schema58.TaggedErrorClass()("WorkspaceCapabilityUnsupported", {
|
|
11671
|
+
capability: Schema58.Literals(["suspend", "snapshot", "fork"]),
|
|
11600
11672
|
provider_key: exports_workspace_schema.WorkspaceProviderKey
|
|
11601
11673
|
}) {
|
|
11602
11674
|
}
|
|
11603
11675
|
|
|
11604
|
-
class WorkspaceProviderError extends
|
|
11676
|
+
class WorkspaceProviderError extends Schema58.TaggedErrorClass()("WorkspaceProviderError", {
|
|
11605
11677
|
provider_key: exports_workspace_schema.WorkspaceProviderKey,
|
|
11606
|
-
message:
|
|
11678
|
+
message: Schema58.String
|
|
11607
11679
|
}) {
|
|
11608
11680
|
}
|
|
11609
11681
|
|
|
@@ -11656,28 +11728,28 @@ var destroy = Effect62.fn("WorkspaceProvider.destroy.call")(function* (ref) {
|
|
|
11656
11728
|
});
|
|
11657
11729
|
|
|
11658
11730
|
// ../runtime/src/child/child-run-service.ts
|
|
11659
|
-
class StaticChildRunPresetNotFound extends
|
|
11731
|
+
class StaticChildRunPresetNotFound extends Schema59.TaggedErrorClass()("StaticChildRunPresetNotFound", {
|
|
11660
11732
|
preset_name: exports_shared_schema.NonEmptyString
|
|
11661
11733
|
}) {
|
|
11662
11734
|
}
|
|
11663
11735
|
|
|
11664
|
-
class ChildRunScopeBroadened extends
|
|
11665
|
-
field:
|
|
11736
|
+
class ChildRunScopeBroadened extends Schema59.TaggedErrorClass()("ChildRunScopeBroadened", {
|
|
11737
|
+
field: Schema59.Literals(["tool_names", "permissions"]),
|
|
11666
11738
|
value: exports_shared_schema.NonEmptyString
|
|
11667
11739
|
}) {
|
|
11668
11740
|
}
|
|
11669
11741
|
|
|
11670
|
-
class ChildRunServiceError extends
|
|
11671
|
-
message:
|
|
11742
|
+
class ChildRunServiceError extends Schema59.TaggedErrorClass()("ChildRunServiceError", {
|
|
11743
|
+
message: Schema59.String
|
|
11672
11744
|
}) {
|
|
11673
11745
|
}
|
|
11674
11746
|
|
|
11675
|
-
class ChildRunWorkspaceUnavailable extends
|
|
11676
|
-
reason:
|
|
11747
|
+
class ChildRunWorkspaceUnavailable extends Schema59.TaggedErrorClass()("ChildRunWorkspaceUnavailable", {
|
|
11748
|
+
reason: Schema59.String
|
|
11677
11749
|
}) {
|
|
11678
11750
|
}
|
|
11679
11751
|
|
|
11680
|
-
class ChildRunModelMissing extends
|
|
11752
|
+
class ChildRunModelMissing extends Schema59.TaggedErrorClass()("ChildRunModelMissing", {}) {
|
|
11681
11753
|
}
|
|
11682
11754
|
|
|
11683
11755
|
class Service48 extends Context48.Service()("@relayfx/runtime/child/child-run-service/Service") {
|
|
@@ -11913,53 +11985,53 @@ var spawnDynamic = Effect63.fn("ChildRunService.spawnDynamic.call")(function* (i
|
|
|
11913
11985
|
});
|
|
11914
11986
|
|
|
11915
11987
|
// ../runtime/src/child/spawn-child-run-tool.ts
|
|
11916
|
-
import { Effect as Effect64, Schema as
|
|
11988
|
+
import { Effect as Effect64, Schema as Schema60 } from "effect";
|
|
11917
11989
|
var toolName = "spawn_child_run";
|
|
11918
11990
|
var permissionName = "relay.child_run.spawn";
|
|
11919
|
-
var Input =
|
|
11920
|
-
preset_name:
|
|
11921
|
-
instructions:
|
|
11922
|
-
model:
|
|
11923
|
-
compaction_policy:
|
|
11924
|
-
tool_names:
|
|
11925
|
-
permissions:
|
|
11926
|
-
output_schema_ref:
|
|
11927
|
-
metadata:
|
|
11928
|
-
input:
|
|
11991
|
+
var Input = Schema60.Struct({
|
|
11992
|
+
preset_name: Schema60.optionalKey(exports_shared_schema.NonEmptyString),
|
|
11993
|
+
instructions: Schema60.optionalKey(Schema60.String),
|
|
11994
|
+
model: Schema60.optionalKey(exports_agent_schema.ModelSelection),
|
|
11995
|
+
compaction_policy: Schema60.optionalKey(exports_agent_schema.CompactionPolicy),
|
|
11996
|
+
tool_names: Schema60.optionalKey(Schema60.Array(Schema60.String)),
|
|
11997
|
+
permissions: Schema60.optionalKey(Schema60.Array(Schema60.String)),
|
|
11998
|
+
output_schema_ref: Schema60.optionalKey(Schema60.String),
|
|
11999
|
+
metadata: Schema60.optionalKey(exports_shared_schema.Metadata),
|
|
12000
|
+
input: Schema60.optionalKey(Schema60.Array(exports_content_schema.Part))
|
|
11929
12001
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.Input" });
|
|
11930
|
-
var Output =
|
|
12002
|
+
var Output = Schema60.Struct({
|
|
11931
12003
|
child_execution_id: exports_ids_schema.ChildExecutionId,
|
|
11932
|
-
status:
|
|
11933
|
-
output:
|
|
12004
|
+
status: Schema60.Literals(["completed", "failed", "cancelled"]),
|
|
12005
|
+
output: Schema60.Array(exports_content_schema.Part)
|
|
11934
12006
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.Output" });
|
|
11935
|
-
var TransferInput =
|
|
11936
|
-
input:
|
|
12007
|
+
var TransferInput = Schema60.Struct({
|
|
12008
|
+
input: Schema60.optionalKey(Schema60.Array(exports_content_schema.Part))
|
|
11937
12009
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.TransferInput" });
|
|
11938
|
-
var ModelInput =
|
|
11939
|
-
preset_name:
|
|
11940
|
-
instructions:
|
|
11941
|
-
model:
|
|
11942
|
-
provider:
|
|
11943
|
-
model:
|
|
11944
|
-
registration_key:
|
|
12010
|
+
var ModelInput = Schema60.Struct({
|
|
12011
|
+
preset_name: Schema60.optionalKey(Schema60.NullOr(Schema60.String)),
|
|
12012
|
+
instructions: Schema60.optionalKey(Schema60.String),
|
|
12013
|
+
model: Schema60.optionalKey(Schema60.NullOr(Schema60.Struct({
|
|
12014
|
+
provider: Schema60.String,
|
|
12015
|
+
model: Schema60.String,
|
|
12016
|
+
registration_key: Schema60.optionalKey(Schema60.String)
|
|
11945
12017
|
}))),
|
|
11946
|
-
compaction_policy:
|
|
11947
|
-
context_window:
|
|
11948
|
-
reserve_tokens:
|
|
11949
|
-
keep_recent_tokens:
|
|
11950
|
-
summary_model:
|
|
11951
|
-
provider:
|
|
11952
|
-
model:
|
|
11953
|
-
registration_key:
|
|
12018
|
+
compaction_policy: Schema60.optionalKey(Schema60.Struct({
|
|
12019
|
+
context_window: Schema60.Finite,
|
|
12020
|
+
reserve_tokens: Schema60.Finite,
|
|
12021
|
+
keep_recent_tokens: Schema60.Finite,
|
|
12022
|
+
summary_model: Schema60.optionalKey(Schema60.Struct({
|
|
12023
|
+
provider: Schema60.String,
|
|
12024
|
+
model: Schema60.String,
|
|
12025
|
+
registration_key: Schema60.optionalKey(Schema60.String)
|
|
11954
12026
|
}))
|
|
11955
12027
|
})),
|
|
11956
|
-
tool_names:
|
|
11957
|
-
permissions:
|
|
11958
|
-
output_schema_ref:
|
|
11959
|
-
input:
|
|
12028
|
+
tool_names: Schema60.optionalKey(Schema60.Array(Schema60.String)),
|
|
12029
|
+
permissions: Schema60.optionalKey(Schema60.Array(Schema60.String)),
|
|
12030
|
+
output_schema_ref: Schema60.optionalKey(Schema60.NullOr(Schema60.String)),
|
|
12031
|
+
input: Schema60.optionalKey(Schema60.Array(Schema60.Struct({ type: Schema60.Literal("text"), text: Schema60.String })))
|
|
11960
12032
|
});
|
|
11961
|
-
var ModelTransferInput =
|
|
11962
|
-
input:
|
|
12033
|
+
var ModelTransferInput = Schema60.Struct({
|
|
12034
|
+
input: Schema60.optionalKey(Schema60.Array(Schema60.Struct({ type: Schema60.Literal("text"), text: Schema60.String })))
|
|
11963
12035
|
});
|
|
11964
12036
|
var normalizeModelInput = (input) => {
|
|
11965
12037
|
const { preset_name: presetName, model, output_schema_ref: outputSchemaRef2, ...rest } = input;
|
|
@@ -12144,7 +12216,7 @@ var registeredTool = (config) => tool(toolName, {
|
|
|
12144
12216
|
permissions: [{ name: permissionName, value: true }],
|
|
12145
12217
|
requiredPermissions: [permissionName],
|
|
12146
12218
|
metadata: { relay_core_tool: true },
|
|
12147
|
-
run: (input, context) =>
|
|
12219
|
+
run: (input, context) => Schema60.decodeUnknownEffect(Input)(normalizeModelInput(input)).pipe(Effect64.mapError((error5) => ToolExecutionFailed.make({ tool_name: toolName, message: error5.message })), Effect64.flatMap((decoded) => run3(config, toolName, decoded, context, true)))
|
|
12148
12220
|
});
|
|
12149
12221
|
var transferToolName2 = (name) => `transfer_to_${name.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "")}`;
|
|
12150
12222
|
var transferTools = (config) => (config.agent.handoff_targets ?? []).map((target) => {
|
|
@@ -12156,21 +12228,21 @@ var transferTools = (config) => (config.agent.handoff_targets ?? []).map((target
|
|
|
12156
12228
|
permissions: [{ name: permissionName, value: true }],
|
|
12157
12229
|
requiredPermissions: [permissionName],
|
|
12158
12230
|
metadata: { relay_core_tool: true, handoff_target: target.name, preset_name: target.preset_name },
|
|
12159
|
-
run: (input, context) =>
|
|
12231
|
+
run: (input, context) => Schema60.decodeUnknownEffect(TransferInput)(input).pipe(Effect64.mapError((error5) => ToolExecutionFailed.make({ tool_name: name, message: error5.message })), Effect64.flatMap((decoded) => run3(config, name, { preset_name: target.preset_name, input: decoded.input ?? [] }, context, false)))
|
|
12160
12232
|
});
|
|
12161
12233
|
});
|
|
12162
12234
|
|
|
12163
12235
|
// ../runtime/src/memory/memory-service.ts
|
|
12164
|
-
import { Clock as Clock7, Context as Context49, Effect as Effect65, Layer as Layer53, Schema as
|
|
12165
|
-
import { EmbeddingModel as EmbeddingModel2, Prompt as
|
|
12236
|
+
import { Clock as Clock7, Context as Context49, Effect as Effect65, Layer as Layer53, Schema as Schema61 } from "effect";
|
|
12237
|
+
import { EmbeddingModel as EmbeddingModel2, Prompt as Prompt5 } from "effect/unstable/ai";
|
|
12166
12238
|
class Service49 extends Context49.Service()("@relayfx/runtime/memory/memory-service/Service") {
|
|
12167
12239
|
}
|
|
12168
12240
|
var defaultTopK = 5;
|
|
12169
12241
|
var memoryError = (error5) => exports_memory.MemoryError.make({
|
|
12170
12242
|
message: error5 instanceof Error ? `${error5.name}: ${error5.message}` : String(error5)
|
|
12171
12243
|
});
|
|
12172
|
-
var decodeSubject = (subject) =>
|
|
12173
|
-
var textPart = (text) =>
|
|
12244
|
+
var decodeSubject = (subject) => Schema61.decodeUnknownEffect(exports_ids_schema.MemorySubjectId)(subject).pipe(Effect65.mapError(memoryError));
|
|
12245
|
+
var textPart = (text) => Prompt5.makePart("text", { text });
|
|
12174
12246
|
var textFromParts = (parts) => parts.filter((part) => part.type === "text").map((part) => part.text).join(`
|
|
12175
12247
|
`).trim();
|
|
12176
12248
|
var latestUserText = (prompt) => {
|
|
@@ -12332,8 +12404,8 @@ var layer42 = (input) => Layer54.succeed(Service50, Service50.of(make4(input)));
|
|
|
12332
12404
|
var noRetryLayer = layer42({ retrySchedule: Schedule3.recurs(0) });
|
|
12333
12405
|
|
|
12334
12406
|
// ../runtime/src/presence/presence-service.ts
|
|
12335
|
-
import { Clock as Clock8, Config as Config3, Effect as Effect66, Layer as Layer55, Random, Schedule as Schedule4, Schema as
|
|
12336
|
-
var isPresenceError =
|
|
12407
|
+
import { Clock as Clock8, Config as Config3, Effect as Effect66, Layer as Layer55, Random, Schedule as Schedule4, Schema as Schema62, Stream as Stream11 } from "effect";
|
|
12408
|
+
var isPresenceError = Schema62.is(PresenceError);
|
|
12337
12409
|
var readError = (cause) => isPresenceError(cause) ? cause : PresenceError.make({ message: String(cause) });
|
|
12338
12410
|
var warn = (operation) => (cause) => Effect66.logWarning(`Presence ${operation} failed`).pipe(Effect66.annotateLogs({ cause: String(cause) }));
|
|
12339
12411
|
var layerFromRepository2 = Layer55.effect(Service2, Effect66.gen(function* () {
|
|
@@ -12388,11 +12460,11 @@ var list13 = Effect66.fn("Presence.list.call")(function* (scope) {
|
|
|
12388
12460
|
});
|
|
12389
12461
|
|
|
12390
12462
|
// ../runtime/src/presence/presence-tool.ts
|
|
12391
|
-
import { Effect as Effect67, Schema as
|
|
12463
|
+
import { Effect as Effect67, Schema as Schema63 } from "effect";
|
|
12392
12464
|
var toolName2 = "relay_presence";
|
|
12393
12465
|
var permissionName2 = "relay.presence.read";
|
|
12394
|
-
var Input2 =
|
|
12395
|
-
var Output2 =
|
|
12466
|
+
var Input2 = Schema63.Struct({ scope: Schema63.optionalKey(exports_presence_schema.Scope) });
|
|
12467
|
+
var Output2 = Schema63.Struct({ watcher_count: Schema63.Finite, entries: Schema63.Array(exports_presence_schema.Entry) });
|
|
12396
12468
|
var registeredTool2 = (presence) => tool(toolName2, {
|
|
12397
12469
|
description: "List observers currently watching an execution or session.",
|
|
12398
12470
|
input: Input2,
|
|
@@ -12408,24 +12480,24 @@ var registeredTool2 = (presence) => tool(toolName2, {
|
|
|
12408
12480
|
});
|
|
12409
12481
|
|
|
12410
12482
|
// ../runtime/src/state/state-tools.ts
|
|
12411
|
-
import { Effect as Effect68, Schema as
|
|
12412
|
-
var GetInput =
|
|
12413
|
-
var GetOutput =
|
|
12414
|
-
value:
|
|
12415
|
-
version:
|
|
12483
|
+
import { Effect as Effect68, Schema as Schema64 } from "effect";
|
|
12484
|
+
var GetInput = Schema64.Struct({ key: exports_shared_schema.NonEmptyString });
|
|
12485
|
+
var GetOutput = Schema64.Struct({
|
|
12486
|
+
value: Schema64.optionalKey(exports_shared_schema.JsonValue),
|
|
12487
|
+
version: Schema64.optionalKey(Schema64.Int)
|
|
12416
12488
|
});
|
|
12417
|
-
var PutInput =
|
|
12489
|
+
var PutInput = Schema64.Struct({
|
|
12418
12490
|
key: exports_shared_schema.NonEmptyString,
|
|
12419
12491
|
value: exports_shared_schema.JsonValue,
|
|
12420
|
-
expected_version:
|
|
12492
|
+
expected_version: Schema64.optionalKey(Schema64.Int.check(Schema64.isGreaterThanOrEqualTo(0)))
|
|
12421
12493
|
});
|
|
12422
|
-
var DeleteInput =
|
|
12423
|
-
var ListInput =
|
|
12424
|
-
prefix:
|
|
12425
|
-
after_key:
|
|
12426
|
-
limit:
|
|
12494
|
+
var DeleteInput = Schema64.Struct({ key: exports_shared_schema.NonEmptyString, expected_version: Schema64.optionalKey(Schema64.Int) });
|
|
12495
|
+
var ListInput = Schema64.Struct({
|
|
12496
|
+
prefix: Schema64.optionalKey(Schema64.String),
|
|
12497
|
+
after_key: Schema64.optionalKey(Schema64.String),
|
|
12498
|
+
limit: Schema64.optionalKey(Schema64.Int)
|
|
12427
12499
|
});
|
|
12428
|
-
var RecordOutput =
|
|
12500
|
+
var RecordOutput = Schema64.Struct({
|
|
12429
12501
|
execution_id: exports_state_schema.StateRecordView.fields.execution_id,
|
|
12430
12502
|
key: exports_state_schema.StateRecordView.fields.key,
|
|
12431
12503
|
value: exports_state_schema.StateRecordView.fields.value,
|
|
@@ -12433,8 +12505,8 @@ var RecordOutput = Schema63.Struct({
|
|
|
12433
12505
|
created_at: exports_state_schema.StateRecordView.fields.created_at,
|
|
12434
12506
|
updated_at: exports_state_schema.StateRecordView.fields.updated_at
|
|
12435
12507
|
});
|
|
12436
|
-
var PutOutput =
|
|
12437
|
-
var DeleteOutput =
|
|
12508
|
+
var PutOutput = Schema64.Struct({ key: exports_state_schema.StateKey, version: exports_state_schema.StateVersion });
|
|
12509
|
+
var DeleteOutput = Schema64.Struct({ deleted: Schema64.Boolean, version: Schema64.optionalKey(Schema64.Int) });
|
|
12438
12510
|
var enabled2 = (agent) => agent.metadata?.state_enabled === true;
|
|
12439
12511
|
var mapStateError = (toolName3) => (error5) => ToolExecutionFailed.make({ tool_name: toolName3, message: error5._tag });
|
|
12440
12512
|
var registeredTools2 = (state) => [
|
|
@@ -12475,7 +12547,7 @@ var registeredTools2 = (state) => [
|
|
|
12475
12547
|
tool("state_list", {
|
|
12476
12548
|
description: "List durable execution state",
|
|
12477
12549
|
input: ListInput,
|
|
12478
|
-
output:
|
|
12550
|
+
output: Schema64.Array(RecordOutput),
|
|
12479
12551
|
metadata: { relay_core_tool: true },
|
|
12480
12552
|
run: (input, context) => state.list({
|
|
12481
12553
|
executionId: context.executionId,
|
|
@@ -12548,6 +12620,8 @@ var recordAppendInput = (record2) => {
|
|
|
12548
12620
|
_tag: "Compaction",
|
|
12549
12621
|
version: 2,
|
|
12550
12622
|
projectedHistory: record2.projectedHistory,
|
|
12623
|
+
telemetry: record2.telemetry,
|
|
12624
|
+
...record2.compactionCommit === undefined ? {} : { compactionCommit: record2.compactionCommit },
|
|
12551
12625
|
...record2.summary === undefined ? {} : { summary: record2.summary },
|
|
12552
12626
|
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
12553
12627
|
} : {
|
|
@@ -12686,6 +12760,8 @@ var make5 = Effect69.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
12686
12760
|
sessionId,
|
|
12687
12761
|
parentId: checkpoint.parentId === null ? null : entryId(checkpoint.parentId),
|
|
12688
12762
|
projectedHistory: checkpoint.projectedHistory,
|
|
12763
|
+
telemetry: checkpoint.telemetry,
|
|
12764
|
+
...checkpoint.compactionCommit === undefined ? {} : { compactionCommit: checkpoint.compactionCommit },
|
|
12689
12765
|
...checkpoint.summary === undefined ? {} : { summary: checkpoint.summary },
|
|
12690
12766
|
createdAt: now,
|
|
12691
12767
|
...makeOptions?.writer === undefined ? {} : { expectedWriter: makeOptions.writer }
|
|
@@ -12736,43 +12812,43 @@ var layer43 = Function13.dual((args) => typeof args[0] === "string" && String(ar
|
|
|
12736
12812
|
var memoryLayer39 = Function13.dual((args) => typeof args[0] === "string" && String(args[0]).startsWith("session:"), (sessionId, entryScope = "default") => layer43(sessionId, entryScope).pipe(Layer56.provide(exports_session_repository.memoryLayer)));
|
|
12737
12813
|
|
|
12738
12814
|
// ../runtime/src/inbox/inbox-service.ts
|
|
12739
|
-
import { Clock as Clock12, Context as Context61, Effect as Effect81, Layer as Layer67, Schema as
|
|
12815
|
+
import { Clock as Clock12, Context as Context61, Effect as Effect81, Layer as Layer67, Schema as Schema76 } from "effect";
|
|
12740
12816
|
|
|
12741
12817
|
// ../runtime/src/wait/wait-signal.ts
|
|
12742
|
-
import { Effect as Effect80, Schema as
|
|
12818
|
+
import { Effect as Effect80, Schema as Schema75 } from "effect";
|
|
12743
12819
|
|
|
12744
12820
|
// ../runtime/src/workflow/execution-workflow.ts
|
|
12745
12821
|
import { Activity, DurableDeferred, Workflow as Workflow2, WorkflowEngine } from "effect/unstable/workflow";
|
|
12746
|
-
import { Cause, Effect as Effect79, Exit, Function as Function14, Layer as Layer66, Option as Option20, Schema as
|
|
12822
|
+
import { Cause, Effect as Effect79, Exit, Function as Function14, Layer as Layer66, Option as Option20, Schema as Schema74 } from "effect";
|
|
12747
12823
|
|
|
12748
12824
|
// ../runtime/src/address/address-resolution-service.ts
|
|
12749
|
-
import { Context as Context53, Effect as Effect71, Layer as Layer58, Schema as
|
|
12825
|
+
import { Context as Context53, Effect as Effect71, Layer as Layer58, Schema as Schema66 } from "effect";
|
|
12750
12826
|
|
|
12751
12827
|
// ../runtime/src/address/address-book-service.ts
|
|
12752
|
-
import { Context as Context52, Effect as Effect70, Layer as Layer57, Ref as Ref15, Schema as
|
|
12828
|
+
import { Context as Context52, Effect as Effect70, Layer as Layer57, Ref as Ref15, Schema as Schema65 } from "effect";
|
|
12753
12829
|
var RouteKind2 = exports_address_schema.RouteKind;
|
|
12754
12830
|
var Route = exports_address_schema.Route;
|
|
12755
12831
|
var RouteRecord = exports_address_schema.RouteRecord;
|
|
12756
12832
|
|
|
12757
|
-
class AddressNotFound2 extends
|
|
12833
|
+
class AddressNotFound2 extends Schema65.TaggedErrorClass()("AddressNotFound", {
|
|
12758
12834
|
address_id: exports_ids_schema.AddressId
|
|
12759
12835
|
}) {
|
|
12760
12836
|
}
|
|
12761
12837
|
|
|
12762
|
-
class AddressUnavailable extends
|
|
12838
|
+
class AddressUnavailable extends Schema65.TaggedErrorClass()("AddressUnavailable", {
|
|
12763
12839
|
address_id: exports_ids_schema.AddressId,
|
|
12764
|
-
route_key:
|
|
12840
|
+
route_key: Schema65.String
|
|
12765
12841
|
}) {
|
|
12766
12842
|
}
|
|
12767
12843
|
|
|
12768
|
-
class AddressDeferred extends
|
|
12844
|
+
class AddressDeferred extends Schema65.TaggedErrorClass()("AddressDeferred", {
|
|
12769
12845
|
address_id: exports_ids_schema.AddressId,
|
|
12770
|
-
route_key:
|
|
12846
|
+
route_key: Schema65.String
|
|
12771
12847
|
}) {
|
|
12772
12848
|
}
|
|
12773
12849
|
|
|
12774
|
-
class AddressBookServiceError extends
|
|
12775
|
-
message:
|
|
12850
|
+
class AddressBookServiceError extends Schema65.TaggedErrorClass()("AddressBookServiceError", {
|
|
12851
|
+
message: Schema65.String
|
|
12776
12852
|
}) {
|
|
12777
12853
|
}
|
|
12778
12854
|
|
|
@@ -12800,7 +12876,7 @@ var recordFromEntry = (entry) => ({
|
|
|
12800
12876
|
updated_at: entry.updatedAt
|
|
12801
12877
|
});
|
|
12802
12878
|
var entryIdFor = (addressId) => exports_ids_schema.AddressBookEntryId.make(`address-book:${addressId}`);
|
|
12803
|
-
var validateRoute = (route) =>
|
|
12879
|
+
var validateRoute = (route) => Schema65.decodeUnknownEffect(Route)(route).pipe(Effect70.mapError((error5) => AddressBookServiceError.make({ message: String(error5) })));
|
|
12804
12880
|
var mapRepositoryError5 = (error5) => {
|
|
12805
12881
|
if (error5._tag === "AddressNotFound") {
|
|
12806
12882
|
return AddressNotFound2.make({ address_id: error5.address_id });
|
|
@@ -12865,41 +12941,41 @@ var list14 = Effect70.fn("AddressBook.list.call")(function* () {
|
|
|
12865
12941
|
});
|
|
12866
12942
|
|
|
12867
12943
|
// ../runtime/src/address/address-resolution-service.ts
|
|
12868
|
-
class AddressRouteNotFound extends
|
|
12944
|
+
class AddressRouteNotFound extends Schema66.TaggedErrorClass()("AddressRouteNotFound", {
|
|
12869
12945
|
address_id: exports_ids_schema.AddressId
|
|
12870
12946
|
}) {
|
|
12871
12947
|
}
|
|
12872
12948
|
|
|
12873
|
-
class AddressRouteKindMismatch extends
|
|
12949
|
+
class AddressRouteKindMismatch extends Schema66.TaggedErrorClass()("AddressRouteKindMismatch", {
|
|
12874
12950
|
address_id: exports_ids_schema.AddressId,
|
|
12875
|
-
expected:
|
|
12951
|
+
expected: Schema66.Literal("local-agent"),
|
|
12876
12952
|
actual: exports_address_schema.RouteKind,
|
|
12877
|
-
route_key:
|
|
12953
|
+
route_key: Schema66.String
|
|
12878
12954
|
}) {
|
|
12879
12955
|
}
|
|
12880
12956
|
|
|
12881
|
-
class AddressAgentDefinitionNotFound extends
|
|
12957
|
+
class AddressAgentDefinitionNotFound extends Schema66.TaggedErrorClass()("AddressAgentDefinitionNotFound", {
|
|
12882
12958
|
address_id: exports_ids_schema.AddressId,
|
|
12883
12959
|
agent_id: exports_ids_schema.AgentId
|
|
12884
12960
|
}) {
|
|
12885
12961
|
}
|
|
12886
12962
|
|
|
12887
|
-
class AddressResolutionError extends
|
|
12888
|
-
message:
|
|
12963
|
+
class AddressResolutionError extends Schema66.TaggedErrorClass()("AddressResolutionError", {
|
|
12964
|
+
message: Schema66.String
|
|
12889
12965
|
}) {
|
|
12890
12966
|
}
|
|
12891
|
-
var LocalAgentRoute =
|
|
12892
|
-
kind:
|
|
12967
|
+
var LocalAgentRoute = Schema66.Struct({
|
|
12968
|
+
kind: Schema66.Literal("local-agent"),
|
|
12893
12969
|
route_key: exports_shared_schema.NonEmptyString,
|
|
12894
|
-
metadata:
|
|
12970
|
+
metadata: Schema66.optionalKey(exports_shared_schema.Metadata)
|
|
12895
12971
|
}).annotate({ identifier: "Relay.AddressResolution.LocalAgentRoute" });
|
|
12896
|
-
var LocalAgentTarget =
|
|
12972
|
+
var LocalAgentTarget = Schema66.Struct({
|
|
12897
12973
|
address_id: exports_ids_schema.AddressId,
|
|
12898
12974
|
route: LocalAgentRoute,
|
|
12899
12975
|
agent_id: exports_ids_schema.AgentId,
|
|
12900
12976
|
agent_revision: exports_agent_schema.DefinitionRevision,
|
|
12901
12977
|
agent_snapshot: exports_agent_schema.Definition,
|
|
12902
|
-
tool_input_schema_digests:
|
|
12978
|
+
tool_input_schema_digests: Schema66.optionalKey(exports_agent_schema.ToolInputSchemaDigests)
|
|
12903
12979
|
}).annotate({ identifier: "Relay.AddressResolution.LocalAgentTarget" });
|
|
12904
12980
|
|
|
12905
12981
|
class Service53 extends Context53.Service()("@relayfx/runtime/address/address-resolution-service/Service") {
|
|
@@ -12932,7 +13008,7 @@ var layer44 = Layer58.effect(Service53, Effect71.gen(function* () {
|
|
|
12932
13008
|
return yield* AddressRouteNotFound.make({ address_id: addressId });
|
|
12933
13009
|
}
|
|
12934
13010
|
const route = yield* routeToLocalAgent(addressId, record2.route);
|
|
12935
|
-
const agentId = yield*
|
|
13011
|
+
const agentId = yield* Schema66.decodeUnknownEffect(exports_ids_schema.AgentId)(route.route_key).pipe(Effect71.mapError((error5) => AddressResolutionError.make({ message: String(error5) })));
|
|
12936
13012
|
const definition = yield* agentRegistry.get(agentId).pipe(Effect71.mapError(mapAgentRegistryError));
|
|
12937
13013
|
if (definition === undefined) {
|
|
12938
13014
|
return yield* AddressAgentDefinitionNotFound.make({
|
|
@@ -12961,13 +13037,14 @@ var resolveLocalAgent = Effect71.fn("AddressResolution.resolveLocalAgent.call")(
|
|
|
12961
13037
|
});
|
|
12962
13038
|
|
|
12963
13039
|
// ../runtime/src/agent/agent-loop-error.ts
|
|
12964
|
-
import { Schema as
|
|
13040
|
+
import { Schema as Schema67 } from "effect";
|
|
12965
13041
|
import { AiError as AiError2 } from "effect/unstable/ai";
|
|
12966
13042
|
|
|
12967
|
-
class AgentLoopError extends
|
|
12968
|
-
message:
|
|
12969
|
-
failure_classification:
|
|
12970
|
-
baton_failure:
|
|
13043
|
+
class AgentLoopError extends Schema67.TaggedErrorClass()("AgentLoopError", {
|
|
13044
|
+
message: Schema67.String,
|
|
13045
|
+
failure_classification: Schema67.optionalKey(Schema67.Literal("context-overflow")),
|
|
13046
|
+
baton_failure: Schema67.optionalKey(Schema67.Union([
|
|
13047
|
+
exports_model_telemetry.DeliveryFailed,
|
|
12971
13048
|
exports_agent_event.AgentError,
|
|
12972
13049
|
exports_agent_event.ResumeMismatch,
|
|
12973
13050
|
exports_turn_policy.TurnPolicyError,
|
|
@@ -12981,25 +13058,25 @@ class AgentLoopError extends Schema66.TaggedErrorClass()("AgentLoopError", {
|
|
|
12981
13058
|
exports_model_registry.LanguageModelNotRegistered,
|
|
12982
13059
|
exports_tool_executor.FrameworkFailure
|
|
12983
13060
|
])),
|
|
12984
|
-
next_event_sequence:
|
|
13061
|
+
next_event_sequence: Schema67.optionalKey(exports_execution_schema.ExecutionEventSequence)
|
|
12985
13062
|
}) {
|
|
12986
13063
|
}
|
|
12987
13064
|
|
|
12988
|
-
class AgentLoopBudgetExceeded extends
|
|
12989
|
-
tokens_used:
|
|
12990
|
-
token_budget:
|
|
13065
|
+
class AgentLoopBudgetExceeded extends Schema67.TaggedErrorClass()("AgentLoopBudgetExceeded", {
|
|
13066
|
+
tokens_used: Schema67.Int,
|
|
13067
|
+
token_budget: Schema67.Int,
|
|
12991
13068
|
next_event_sequence: exports_execution_schema.ExecutionEventSequence
|
|
12992
13069
|
}) {
|
|
12993
13070
|
}
|
|
12994
|
-
var AgentTerminalFailure =
|
|
13071
|
+
var AgentTerminalFailure = Schema67.Union([AgentLoopError, AgentLoopBudgetExceeded]);
|
|
12995
13072
|
|
|
12996
13073
|
// ../runtime/src/child/parent-notifier-service.ts
|
|
12997
|
-
import { Context as Context54, Effect as Effect72, Layer as Layer59, Option as Option16, Ref as Ref16, Schema as
|
|
12998
|
-
class ParentNotifyError extends
|
|
12999
|
-
message:
|
|
13074
|
+
import { Context as Context54, Effect as Effect72, Layer as Layer59, Option as Option16, Ref as Ref16, Schema as Schema68 } from "effect";
|
|
13075
|
+
class ParentNotifyError extends Schema68.TaggedErrorClass()("ParentNotifyError", {
|
|
13076
|
+
message: Schema68.String
|
|
13000
13077
|
}) {
|
|
13001
13078
|
}
|
|
13002
|
-
var ChildTerminalStatus =
|
|
13079
|
+
var ChildTerminalStatus = Schema68.Literals(["completed", "failed", "cancelled"]).annotate({
|
|
13003
13080
|
identifier: "Relay.ParentNotifier.ChildTerminalStatus"
|
|
13004
13081
|
});
|
|
13005
13082
|
|
|
@@ -13080,15 +13157,15 @@ var notify = Effect72.fn("ParentNotifier.notify.call")(function* (input) {
|
|
|
13080
13157
|
});
|
|
13081
13158
|
|
|
13082
13159
|
// ../runtime/src/skill/skill-registry-service.ts
|
|
13083
|
-
import { Clock as Clock10, Context as Context55, Effect as Effect73, Layer as Layer60, Schema as
|
|
13160
|
+
import { Clock as Clock10, Context as Context55, Effect as Effect73, Layer as Layer60, Schema as Schema69 } from "effect";
|
|
13084
13161
|
|
|
13085
|
-
class SkillDefinitionInvalid extends
|
|
13086
|
-
message:
|
|
13162
|
+
class SkillDefinitionInvalid extends Schema69.TaggedErrorClass()("SkillDefinitionInvalid", {
|
|
13163
|
+
message: Schema69.String
|
|
13087
13164
|
}) {
|
|
13088
13165
|
}
|
|
13089
13166
|
|
|
13090
|
-
class SkillRegistryError extends
|
|
13091
|
-
message:
|
|
13167
|
+
class SkillRegistryError extends Schema69.TaggedErrorClass()("SkillRegistryError", {
|
|
13168
|
+
message: Schema69.String
|
|
13092
13169
|
}) {
|
|
13093
13170
|
}
|
|
13094
13171
|
|
|
@@ -13241,16 +13318,16 @@ var sourceForExecution = Effect73.fn("SkillRegistry.sourceForExecution.call")(fu
|
|
|
13241
13318
|
});
|
|
13242
13319
|
|
|
13243
13320
|
// ../runtime/src/execution/execution-service.ts
|
|
13244
|
-
import { Clock as Clock11, Context as Context56, Effect as Effect74, Layer as Layer61, Option as Option17, Schema as
|
|
13321
|
+
import { Clock as Clock11, Context as Context56, Effect as Effect74, Layer as Layer61, Option as Option17, Schema as Schema70, Stream as Stream12 } from "effect";
|
|
13245
13322
|
import { ShardingConfig } from "effect/unstable/cluster";
|
|
13246
13323
|
var ExecutionServiceErrorDetails = exports_shared_schema.JsonValue.annotate({
|
|
13247
13324
|
identifier: "Relay.ExecutionServiceErrorDetails"
|
|
13248
13325
|
});
|
|
13249
13326
|
|
|
13250
|
-
class ExecutionServiceError extends
|
|
13251
|
-
message:
|
|
13252
|
-
details:
|
|
13253
|
-
next_event_sequence:
|
|
13327
|
+
class ExecutionServiceError extends Schema70.TaggedErrorClass()("ExecutionServiceError", {
|
|
13328
|
+
message: Schema70.String,
|
|
13329
|
+
details: Schema70.optionalKey(ExecutionServiceErrorDetails),
|
|
13330
|
+
next_event_sequence: Schema70.optionalKey(exports_execution_schema.ExecutionEventSequence)
|
|
13254
13331
|
}) {
|
|
13255
13332
|
}
|
|
13256
13333
|
|
|
@@ -13431,7 +13508,7 @@ var existingTerminalExecution = Effect74.fn("ExecutionService.existingTerminalEx
|
|
|
13431
13508
|
execution: undefined,
|
|
13432
13509
|
failure: ExecutionServiceError.make({
|
|
13433
13510
|
message: typeof metadata11.message === "string" ? metadata11.message : "Execution failed",
|
|
13434
|
-
...
|
|
13511
|
+
...Schema70.is(ExecutionServiceErrorDetails)(metadata11.details) ? { details: metadata11.details } : {},
|
|
13435
13512
|
next_event_sequence: event.sequence
|
|
13436
13513
|
})
|
|
13437
13514
|
};
|
|
@@ -13674,13 +13751,13 @@ var coordinate = Effect76.fn("ToolTransitionCoordinator.coordinate")(function* (
|
|
|
13674
13751
|
});
|
|
13675
13752
|
|
|
13676
13753
|
// ../runtime/src/workspace/workspace-planner-service.ts
|
|
13677
|
-
import { Context as Context60, Effect as Effect78, HashSet as HashSet6, Layer as Layer65, Option as Option18, Schema as
|
|
13754
|
+
import { Context as Context60, Effect as Effect78, HashSet as HashSet6, Layer as Layer65, Option as Option18, Schema as Schema72 } from "effect";
|
|
13678
13755
|
|
|
13679
13756
|
// ../runtime/src/workspace/workspace-runtime-service.ts
|
|
13680
|
-
import { Context as Context59, Effect as Effect77, Layer as Layer64, Schema as
|
|
13757
|
+
import { Context as Context59, Effect as Effect77, Layer as Layer64, Schema as Schema71 } from "effect";
|
|
13681
13758
|
|
|
13682
|
-
class WorkspaceRuntimeError extends
|
|
13683
|
-
message:
|
|
13759
|
+
class WorkspaceRuntimeError extends Schema71.TaggedErrorClass()("WorkspaceRuntimeError", {
|
|
13760
|
+
message: Schema71.String
|
|
13684
13761
|
}) {
|
|
13685
13762
|
}
|
|
13686
13763
|
|
|
@@ -13708,18 +13785,18 @@ var exec = Effect77.fn("WorkspaceRuntime.exec.call")(function* (input) {
|
|
|
13708
13785
|
});
|
|
13709
13786
|
|
|
13710
13787
|
// ../runtime/src/workspace/workspace-planner-service.ts
|
|
13711
|
-
class WorkspaceRuntimeMissing extends
|
|
13788
|
+
class WorkspaceRuntimeMissing extends Schema72.TaggedErrorClass()("WorkspaceRuntimeMissing", {
|
|
13712
13789
|
execution_id: exports_ids_schema.ExecutionId
|
|
13713
13790
|
}) {
|
|
13714
13791
|
}
|
|
13715
13792
|
|
|
13716
|
-
class WorkspaceLeaseMissingRef extends
|
|
13793
|
+
class WorkspaceLeaseMissingRef extends Schema72.TaggedErrorClass()("WorkspaceLeaseMissingRef", {
|
|
13717
13794
|
execution_id: exports_ids_schema.ExecutionId
|
|
13718
13795
|
}) {
|
|
13719
13796
|
}
|
|
13720
13797
|
|
|
13721
|
-
class WorkspacePlannerError extends
|
|
13722
|
-
message:
|
|
13798
|
+
class WorkspacePlannerError extends Schema72.TaggedErrorClass()("WorkspacePlannerError", {
|
|
13799
|
+
message: Schema72.String
|
|
13723
13800
|
}) {
|
|
13724
13801
|
}
|
|
13725
13802
|
|
|
@@ -13905,7 +13982,7 @@ var fail = Effect78.fn("WorkspacePlanner.fail.call")(function* (input) {
|
|
|
13905
13982
|
});
|
|
13906
13983
|
|
|
13907
13984
|
// ../runtime/src/workflow/execution-workflow-state.ts
|
|
13908
|
-
import { Option as Option19, Schema as
|
|
13985
|
+
import { Option as Option19, Schema as Schema73 } from "effect";
|
|
13909
13986
|
var toWaitSnapshot = (record2) => ({
|
|
13910
13987
|
id: record2.id,
|
|
13911
13988
|
execution_id: record2.executionId,
|
|
@@ -13973,7 +14050,7 @@ var waitIdFromExecution = (execution) => {
|
|
|
13973
14050
|
};
|
|
13974
14051
|
var pendingSuspensionFromExecution = (execution) => {
|
|
13975
14052
|
const pending = execution.metadata?.pending_agent_suspension;
|
|
13976
|
-
return
|
|
14053
|
+
return Schema73.decodeUnknownOption(exports_agent_event.AgentSuspended)(pending).pipe(Option19.getOrUndefined);
|
|
13977
14054
|
};
|
|
13978
14055
|
var ExecutionWorkflowState = {
|
|
13979
14056
|
agentDefinitionPinCount,
|
|
@@ -14014,74 +14091,74 @@ var {
|
|
|
14014
14091
|
workflowGenerationFromRecord: workflowGenerationFromRecord2
|
|
14015
14092
|
} = ExecutionWorkflowState;
|
|
14016
14093
|
|
|
14017
|
-
class ExecutionWorkflowFailed extends
|
|
14018
|
-
message:
|
|
14019
|
-
terminal_failure:
|
|
14094
|
+
class ExecutionWorkflowFailed extends Schema74.TaggedErrorClass()("ExecutionWorkflowFailed", {
|
|
14095
|
+
message: Schema74.String,
|
|
14096
|
+
terminal_failure: Schema74.optionalKey(AgentTerminalFailure)
|
|
14020
14097
|
}) {
|
|
14021
14098
|
}
|
|
14022
14099
|
|
|
14023
|
-
class AgentCheckpointCompatibilityError extends
|
|
14024
|
-
message:
|
|
14100
|
+
class AgentCheckpointCompatibilityError extends Schema74.TaggedErrorClass()("AgentCheckpointCompatibilityError", {
|
|
14101
|
+
message: Schema74.String
|
|
14025
14102
|
}) {
|
|
14026
14103
|
}
|
|
14027
|
-
var ExecutionWorkflowError =
|
|
14028
|
-
var StartInput =
|
|
14104
|
+
var ExecutionWorkflowError = Schema74.Union([ExecutionWorkflowFailed, AgentCheckpointCompatibilityError]);
|
|
14105
|
+
var StartInput = Schema74.Struct({
|
|
14029
14106
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14030
14107
|
root_address_id: exports_ids_schema.AddressId,
|
|
14031
|
-
session_id:
|
|
14032
|
-
input:
|
|
14108
|
+
session_id: Schema74.optionalKey(exports_ids_schema.SessionId),
|
|
14109
|
+
input: Schema74.optionalKey(Schema74.Array(exports_content_schema.Part)),
|
|
14033
14110
|
event_sequence: exports_execution_schema.ExecutionEventSequence,
|
|
14034
14111
|
started_at: exports_shared_schema.TimestampMillis,
|
|
14035
14112
|
completed_at: exports_shared_schema.TimestampMillis,
|
|
14036
|
-
agent_id:
|
|
14037
|
-
agent_revision:
|
|
14038
|
-
agent_snapshot:
|
|
14039
|
-
agent_tool_input_schema_digests:
|
|
14040
|
-
wait_id:
|
|
14041
|
-
resume_suspension:
|
|
14042
|
-
workflow_generation:
|
|
14043
|
-
metadata:
|
|
14113
|
+
agent_id: Schema74.optionalKey(exports_ids_schema.AgentId),
|
|
14114
|
+
agent_revision: Schema74.optionalKey(exports_agent_schema.DefinitionRevision),
|
|
14115
|
+
agent_snapshot: Schema74.optionalKey(exports_agent_schema.Definition),
|
|
14116
|
+
agent_tool_input_schema_digests: Schema74.optionalKey(exports_agent_schema.ToolInputSchemaDigests),
|
|
14117
|
+
wait_id: Schema74.optionalKey(exports_ids_schema.WaitId),
|
|
14118
|
+
resume_suspension: Schema74.optionalKey(exports_agent_event.AgentSuspended),
|
|
14119
|
+
workflow_generation: Schema74.optionalKey(Schema74.Int.check(Schema74.isGreaterThanOrEqualTo(0))),
|
|
14120
|
+
metadata: Schema74.optionalKey(exports_shared_schema.Metadata)
|
|
14044
14121
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.StartInput" });
|
|
14045
|
-
var WaitSignalState =
|
|
14122
|
+
var WaitSignalState = Schema74.Literals(["resolved", "timed_out", "cancelled"]).annotate({
|
|
14046
14123
|
identifier: "Relay.ExecutionWorkflow.WaitSignalState"
|
|
14047
14124
|
});
|
|
14048
|
-
var WaitSignal =
|
|
14125
|
+
var WaitSignal = Schema74.Struct({
|
|
14049
14126
|
wait_id: exports_ids_schema.WaitId,
|
|
14050
14127
|
state: WaitSignalState,
|
|
14051
14128
|
signaled_at: exports_shared_schema.TimestampMillis
|
|
14052
14129
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.WaitSignal" });
|
|
14053
|
-
var SignalWaitInput =
|
|
14054
|
-
workflow_execution_id:
|
|
14130
|
+
var SignalWaitInput = Schema74.Struct({
|
|
14131
|
+
workflow_execution_id: Schema74.String,
|
|
14055
14132
|
wait_id: exports_ids_schema.WaitId,
|
|
14056
14133
|
state: WaitSignalState,
|
|
14057
14134
|
signaled_at: exports_shared_schema.TimestampMillis
|
|
14058
14135
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.SignalWaitInput" });
|
|
14059
|
-
var CancelExecutionInput =
|
|
14136
|
+
var CancelExecutionInput = Schema74.Struct({
|
|
14060
14137
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14061
14138
|
cancelled_at: exports_shared_schema.TimestampMillis,
|
|
14062
|
-
reason:
|
|
14139
|
+
reason: Schema74.optionalKey(Schema74.String)
|
|
14063
14140
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.CancelExecutionInput" });
|
|
14064
|
-
var CancelExecutionResult =
|
|
14141
|
+
var CancelExecutionResult = Schema74.Struct({
|
|
14065
14142
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14066
14143
|
status: exports_execution_schema.ExecutionStatus
|
|
14067
14144
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.CancelExecutionResult" });
|
|
14068
|
-
var WaitSnapshot =
|
|
14145
|
+
var WaitSnapshot = Schema74.Struct({
|
|
14069
14146
|
id: exports_ids_schema.WaitId,
|
|
14070
14147
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14071
|
-
envelope_id:
|
|
14148
|
+
envelope_id: Schema74.optionalKey(exports_ids_schema.EnvelopeId),
|
|
14072
14149
|
mode: exports_envelope_schema.WaitMode,
|
|
14073
|
-
correlation_key:
|
|
14074
|
-
state:
|
|
14150
|
+
correlation_key: Schema74.optionalKey(Schema74.String),
|
|
14151
|
+
state: Schema74.Literals(["open", "resolved", "timed_out", "cancelled"]),
|
|
14075
14152
|
metadata: exports_shared_schema.Metadata,
|
|
14076
14153
|
created_at: exports_shared_schema.TimestampMillis,
|
|
14077
|
-
resolved_at:
|
|
14154
|
+
resolved_at: Schema74.optionalKey(exports_shared_schema.TimestampMillis)
|
|
14078
14155
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.WaitSnapshot" });
|
|
14079
|
-
var StartResult =
|
|
14156
|
+
var StartResult = Schema74.Struct({
|
|
14080
14157
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14081
14158
|
status: exports_execution_schema.ExecutionStatus,
|
|
14082
|
-
wait_id:
|
|
14083
|
-
wait_state:
|
|
14084
|
-
metadata:
|
|
14159
|
+
wait_id: Schema74.optionalKey(exports_ids_schema.WaitId),
|
|
14160
|
+
wait_state: Schema74.optionalKey(Schema74.Literals(["resolved", "timed_out", "cancelled"])),
|
|
14161
|
+
metadata: Schema74.optionalKey(exports_shared_schema.Metadata)
|
|
14085
14162
|
}).annotate({ identifier: "Relay.ExecutionWorkflow.StartResult" });
|
|
14086
14163
|
var StartExecutionWorkflowName = "Relay/Execution/Start";
|
|
14087
14164
|
var ActivityNames = {
|
|
@@ -14129,12 +14206,12 @@ var StartExecutionWorkflow = Workflow2.make(StartExecutionWorkflowName, {
|
|
|
14129
14206
|
var mapExecutionError = (error5) => {
|
|
14130
14207
|
if (error5.details === undefined)
|
|
14131
14208
|
return ExecutionWorkflowFailed.make({ message: error5.message });
|
|
14132
|
-
const terminalFailure =
|
|
14209
|
+
const terminalFailure = Schema74.decodeUnknownOption(AgentTerminalFailure)(error5.details).pipe(Option20.getOrUndefined);
|
|
14133
14210
|
return terminalFailure === undefined ? ExecutionWorkflowFailed.make({ message: "Malformed durable agent failure details" }) : ExecutionWorkflowFailed.make({ message: error5.message, terminal_failure: terminalFailure });
|
|
14134
14211
|
};
|
|
14135
14212
|
var mapAgentLoopError = (error5) => ExecutionServiceError.make({
|
|
14136
14213
|
message: error5._tag === "AgentLoopBudgetExceeded" ? `AgentLoopBudgetExceeded: used ${error5.tokens_used} of ${error5.token_budget} tokens` : error5.message,
|
|
14137
|
-
details: error5.pipe(
|
|
14214
|
+
details: error5.pipe(Schema74.encodeSync(AgentTerminalFailure), Schema74.decodeUnknownSync(exports_shared_schema.JsonValue)),
|
|
14138
14215
|
...error5.next_event_sequence === undefined ? {} : { next_event_sequence: error5.next_event_sequence }
|
|
14139
14216
|
});
|
|
14140
14217
|
var mapWaitError2 = (error5) => ExecutionWorkflowFailed.make({
|
|
@@ -14283,7 +14360,7 @@ var prepareCancellation = Effect79.fn("ExecutionWorkflow.prepareCancellation")(f
|
|
|
14283
14360
|
signals,
|
|
14284
14361
|
terminalNoop: false
|
|
14285
14362
|
};
|
|
14286
|
-
})).pipe(Effect79.mapError((error5) =>
|
|
14363
|
+
})).pipe(Effect79.mapError((error5) => Schema74.is(ExecutionWorkflowFailed)(error5) ? error5 : ExecutionWorkflowFailed.make({ message: "Tool cancellation transaction failed" })));
|
|
14287
14364
|
});
|
|
14288
14365
|
var signalPreparedCancellation = Effect79.fn("ExecutionWorkflow.signalPreparedCancellation")(function* (prepared, signaledAt) {
|
|
14289
14366
|
for (const pending of prepared.signals) {
|
|
@@ -14360,7 +14437,7 @@ var cancelExecution = (input, turn, reason) => Activity.make({
|
|
|
14360
14437
|
});
|
|
14361
14438
|
var loadCancellationRequested = (input, turn) => Activity.make({
|
|
14362
14439
|
name: ActivityNames.checkCancel(turn),
|
|
14363
|
-
success:
|
|
14440
|
+
success: Schema74.Boolean,
|
|
14364
14441
|
error: ExecutionWorkflowFailed,
|
|
14365
14442
|
execute: Effect79.gen(function* () {
|
|
14366
14443
|
const repository = yield* exports_execution_repository.Service;
|
|
@@ -14370,7 +14447,7 @@ var loadCancellationRequested = (input, turn) => Activity.make({
|
|
|
14370
14447
|
});
|
|
14371
14448
|
var loadWait = (name, waitId2) => Activity.make({
|
|
14372
14449
|
name,
|
|
14373
|
-
success:
|
|
14450
|
+
success: Schema74.UndefinedOr(WaitSnapshot),
|
|
14374
14451
|
error: ExecutionWorkflowFailed,
|
|
14375
14452
|
execute: get11(waitId2).pipe(Effect79.map((record2) => record2 === undefined ? undefined : toWaitSnapshot2(record2)), Effect79.mapError(mapWaitError2))
|
|
14376
14453
|
});
|
|
@@ -14413,7 +14490,7 @@ var decodeOptionalNumberSetting = (value, key4, valid) => {
|
|
|
14413
14490
|
var optionalNumberForStart = (input, key4, valid) => decodeOptionalNumberSetting(metadataSetting2(input, key4), key4, valid).pipe(Effect79.map((value) => value === null ? undefined : value));
|
|
14414
14491
|
var continueAsNewAfterTurnsForStart = (input) => optionalNumberForStart(input, continueAsNewAfterTurnsMetadataKey2, (value) => Number.isInteger(value) && value > 0);
|
|
14415
14492
|
var toolOutputMaxBytesForStart = (input) => decodeOptionalNumberSetting(metadataSetting2(input, toolOutputMaxBytesMetadataKey2), toolOutputMaxBytesMetadataKey2, (value) => value >= 0);
|
|
14416
|
-
var decodeMemorySubject = (value) => typeof value === "string" ?
|
|
14493
|
+
var decodeMemorySubject = (value) => typeof value === "string" ? Schema74.decodeUnknownEffect(exports_ids_schema.MemorySubjectId)(value).pipe(Effect79.mapError(() => ExecutionWorkflowFailed.make({ message: `Invalid memory_subject_id metadata value: ${value}` }))) : Effect79.fail(ExecutionWorkflowFailed.make({ message: "memory_subject_id metadata value must be a string" }));
|
|
14417
14494
|
var memorySubjectForStart = Effect79.fn("ExecutionWorkflow.memorySubjectForStart")(function* (input) {
|
|
14418
14495
|
const executionSubject = memorySubjectFromMetadata2(input.metadata);
|
|
14419
14496
|
if (executionSubject !== undefined)
|
|
@@ -14424,7 +14501,7 @@ var memorySubjectForStart = Effect79.fn("ExecutionWorkflow.memorySubjectForStart
|
|
|
14424
14501
|
var nextEventSequence4 = (eventLog, executionId) => eventLog.maxSequence(executionId).pipe(Effect79.map((max) => max === undefined ? 0 : max + 1), Effect79.mapError(mapEventLogError6));
|
|
14425
14502
|
var ensureWorkspace = (input) => Activity.make({
|
|
14426
14503
|
name: ActivityNames.ensureWorkspace,
|
|
14427
|
-
success:
|
|
14504
|
+
success: Schema74.UndefinedOr(exports_workspace_schema.WorkspaceLeaseRecord),
|
|
14428
14505
|
error: ExecutionWorkflowFailed,
|
|
14429
14506
|
execute: Effect79.gen(function* () {
|
|
14430
14507
|
if (input.agent_snapshot === undefined)
|
|
@@ -14441,19 +14518,19 @@ var ensureWorkspace = (input) => Activity.make({
|
|
|
14441
14518
|
});
|
|
14442
14519
|
var suspendWorkspace = (input, key4) => Activity.make({
|
|
14443
14520
|
name: ActivityNames.suspendWorkspace(key4),
|
|
14444
|
-
success:
|
|
14521
|
+
success: Schema74.UndefinedOr(exports_workspace_schema.WorkspaceLeaseRecord),
|
|
14445
14522
|
error: ExecutionWorkflowFailed,
|
|
14446
14523
|
execute: suspend2({ executionId: input.execution_id, now: input.started_at }).pipe(Effect79.mapError(mapWorkspaceError))
|
|
14447
14524
|
});
|
|
14448
14525
|
var resumeWorkspace = (input, key4) => Activity.make({
|
|
14449
14526
|
name: ActivityNames.resumeWorkspace(key4),
|
|
14450
|
-
success:
|
|
14527
|
+
success: Schema74.UndefinedOr(exports_workspace_schema.WorkspaceLeaseRecord),
|
|
14451
14528
|
error: ExecutionWorkflowFailed,
|
|
14452
14529
|
execute: resume2({ executionId: input.execution_id, now: input.started_at }).pipe(Effect79.map((plan2) => plan2?.lease), Effect79.mapError(mapWorkspaceError))
|
|
14453
14530
|
});
|
|
14454
14531
|
var releaseWorkspace = (input) => Activity.make({
|
|
14455
14532
|
name: ActivityNames.releaseWorkspace,
|
|
14456
|
-
success:
|
|
14533
|
+
success: Schema74.UndefinedOr(exports_workspace_schema.WorkspaceLeaseRecord),
|
|
14457
14534
|
error: ExecutionWorkflowFailed,
|
|
14458
14535
|
execute: release2({ executionId: input.execution_id, now: input.completed_at }).pipe(Effect79.mapError(mapWorkspaceError))
|
|
14459
14536
|
});
|
|
@@ -14529,7 +14606,7 @@ var completeExecution = (input, waitId2, waitState, workspaceRuntimeLayer, turn,
|
|
|
14529
14606
|
...input.metadata,
|
|
14530
14607
|
wait_id: wait.wait_id,
|
|
14531
14608
|
wait_state: "open",
|
|
14532
|
-
pending_agent_suspension: wait.suspension.pipe(
|
|
14609
|
+
pending_agent_suspension: wait.suspension.pipe(Schema74.encodeSync(exports_agent_event.AgentSuspended), Schema74.decodeUnknownSync(exports_shared_schema.JsonValue)),
|
|
14533
14610
|
...generationMetadata2(workflowGenerationForStart2(input))
|
|
14534
14611
|
},
|
|
14535
14612
|
nextEventSequence: wait.next_event_sequence
|
|
@@ -14545,12 +14622,12 @@ var completeExecution = (input, waitId2, waitState, workspaceRuntimeLayer, turn,
|
|
|
14545
14622
|
});
|
|
14546
14623
|
var failIncompatibleCheckpoint = (input, error5) => Activity.make({
|
|
14547
14624
|
name: ActivityNames.failIncompatibleCheckpoint,
|
|
14548
|
-
success:
|
|
14625
|
+
success: Schema74.Void,
|
|
14549
14626
|
error: ExecutionWorkflowFailed,
|
|
14550
14627
|
execute: Effect79.gen(function* () {
|
|
14551
14628
|
const eventLog = yield* Service41;
|
|
14552
14629
|
const eventSequence = yield* nextEventSequence4(eventLog, input.execution_id);
|
|
14553
|
-
const details = yield* error5.pipe(
|
|
14630
|
+
const details = yield* error5.pipe(Schema74.encodeEffect(AgentCheckpointCompatibilityError), Effect79.flatMap(Schema74.decodeUnknownEffect(exports_shared_schema.JsonValue)), Effect79.mapError(() => ExecutionWorkflowFailed.make({ message: "Invalid checkpoint failure details" })));
|
|
14554
14631
|
yield* run4({
|
|
14555
14632
|
executionId: input.execution_id,
|
|
14556
14633
|
eventSequence,
|
|
@@ -14565,7 +14642,7 @@ var failIncompatibleCheckpoint = (input, error5) => Activity.make({
|
|
|
14565
14642
|
});
|
|
14566
14643
|
var loadChildCancellationRequested = (input) => Activity.make({
|
|
14567
14644
|
name: ActivityNames.checkQueuedChildCancellation,
|
|
14568
|
-
success:
|
|
14645
|
+
success: Schema74.Boolean,
|
|
14569
14646
|
error: ExecutionWorkflowFailed,
|
|
14570
14647
|
execute: Effect79.gen(function* () {
|
|
14571
14648
|
const context = childDispatchContext2(input);
|
|
@@ -14577,7 +14654,7 @@ var loadChildCancellationRequested = (input) => Activity.make({
|
|
|
14577
14654
|
});
|
|
14578
14655
|
var notifyParentActivity = (input, context, status, output) => Activity.make({
|
|
14579
14656
|
name: ActivityNames.notifyParent(status),
|
|
14580
|
-
success:
|
|
14657
|
+
success: Schema74.Void,
|
|
14581
14658
|
error: ExecutionWorkflowFailed,
|
|
14582
14659
|
execute: Effect79.gen(function* () {
|
|
14583
14660
|
const notifier = yield* Effect79.serviceOption(Service54);
|
|
@@ -14855,8 +14932,8 @@ var signalWait = Effect79.fn("ExecutionWorkflow.signalWait")(function* (input) {
|
|
|
14855
14932
|
});
|
|
14856
14933
|
|
|
14857
14934
|
// ../runtime/src/wait/wait-signal.ts
|
|
14858
|
-
class WaitSignalError extends
|
|
14859
|
-
message:
|
|
14935
|
+
class WaitSignalError extends Schema75.TaggedErrorClass()("WaitSignalError", {
|
|
14936
|
+
message: Schema75.String
|
|
14860
14937
|
}) {
|
|
14861
14938
|
}
|
|
14862
14939
|
var signalWorkflowWait = Effect80.fn("WaitSignal.signalWorkflowWait")(function* (input) {
|
|
@@ -14875,19 +14952,19 @@ var signalWorkflowWait = Effect80.fn("WaitSignal.signalWorkflowWait")(function*
|
|
|
14875
14952
|
});
|
|
14876
14953
|
|
|
14877
14954
|
// ../runtime/src/inbox/inbox-service.ts
|
|
14878
|
-
class InboxDeliveryError extends
|
|
14955
|
+
class InboxDeliveryError extends Schema76.TaggedErrorClass()("InboxDeliveryError", {
|
|
14879
14956
|
execution_id: exports_ids_schema.ExecutionId,
|
|
14880
|
-
message:
|
|
14957
|
+
message: Schema76.String
|
|
14881
14958
|
}) {
|
|
14882
14959
|
}
|
|
14883
14960
|
|
|
14884
|
-
class InboxReplyTokenInvalid extends
|
|
14885
|
-
reply_token:
|
|
14961
|
+
class InboxReplyTokenInvalid extends Schema76.TaggedErrorClass()("InboxReplyTokenInvalid", {
|
|
14962
|
+
reply_token: Schema76.String
|
|
14886
14963
|
}) {
|
|
14887
14964
|
}
|
|
14888
14965
|
|
|
14889
|
-
class InboxServiceError extends
|
|
14890
|
-
message:
|
|
14966
|
+
class InboxServiceError extends Schema76.TaggedErrorClass()("InboxServiceError", {
|
|
14967
|
+
message: Schema76.String
|
|
14891
14968
|
}) {
|
|
14892
14969
|
}
|
|
14893
14970
|
|
|
@@ -14995,9 +15072,9 @@ var layerWithSignal = (dependencies) => makeLayer2(dependencies);
|
|
|
14995
15072
|
var memoryLayer42 = layer50.pipe(Layer67.provide(exports_inbox_repository.memoryLayer), Layer67.provide(exports_envelope_repository.memoryLayer));
|
|
14996
15073
|
|
|
14997
15074
|
// ../runtime/src/topic/topic-service.ts
|
|
14998
|
-
import { Clock as Clock13, Context as Context62, Effect as Effect82, Layer as Layer68, Random as Random2, Schema as
|
|
14999
|
-
class TopicServiceError extends
|
|
15000
|
-
message:
|
|
15075
|
+
import { Clock as Clock13, Context as Context62, Effect as Effect82, Layer as Layer68, Random as Random2, Schema as Schema77 } from "effect";
|
|
15076
|
+
class TopicServiceError extends Schema77.TaggedErrorClass()("TopicServiceError", {
|
|
15077
|
+
message: Schema77.String
|
|
15001
15078
|
}) {
|
|
15002
15079
|
}
|
|
15003
15080
|
|
|
@@ -15073,17 +15150,17 @@ var layer51 = Layer68.effect(Service63, Effect82.gen(function* () {
|
|
|
15073
15150
|
var memoryLayer43 = layer51.pipe(Layer68.provide(exports_topic_repository.memoryLayer));
|
|
15074
15151
|
|
|
15075
15152
|
// ../runtime/src/topic/publish-to-topic-tool.ts
|
|
15076
|
-
import { Effect as Effect83, Schema as
|
|
15153
|
+
import { Effect as Effect83, Schema as Schema78 } from "effect";
|
|
15077
15154
|
var toolName3 = "publish_to_topic";
|
|
15078
15155
|
var permissionName3 = "relay.topic.publish";
|
|
15079
|
-
var ContentInput =
|
|
15080
|
-
var Input3 =
|
|
15081
|
-
topic:
|
|
15156
|
+
var ContentInput = Schema78.Union([Schema78.String, Schema78.Array(exports_content_schema.TextPart)]);
|
|
15157
|
+
var Input3 = Schema78.Struct({
|
|
15158
|
+
topic: Schema78.String,
|
|
15082
15159
|
content: ContentInput
|
|
15083
15160
|
}).annotate({ identifier: "Relay.PublishToTopicTool.Input" });
|
|
15084
|
-
var Output3 =
|
|
15085
|
-
envelope_id:
|
|
15086
|
-
subscriber_count:
|
|
15161
|
+
var Output3 = Schema78.Struct({
|
|
15162
|
+
envelope_id: Schema78.String,
|
|
15163
|
+
subscriber_count: Schema78.Int
|
|
15087
15164
|
}).annotate({ identifier: "Relay.PublishToTopicTool.Output" });
|
|
15088
15165
|
var registeredTool3 = (config) => tool(toolName3, {
|
|
15089
15166
|
description: "Publish a durable message to every subscriber of a topic.",
|
|
@@ -15105,23 +15182,23 @@ var registeredTool3 = (config) => tool(toolName3, {
|
|
|
15105
15182
|
});
|
|
15106
15183
|
|
|
15107
15184
|
// ../runtime/src/inbox/wait-for-messages-tool.ts
|
|
15108
|
-
import { Effect as Effect84, Schema as
|
|
15185
|
+
import { Effect as Effect84, Schema as Schema79 } from "effect";
|
|
15109
15186
|
var toolName4 = "wait_for_messages";
|
|
15110
15187
|
var permissionName4 = "relay.inbox.wait";
|
|
15111
|
-
var Input4 =
|
|
15188
|
+
var Input4 = Schema79.Struct({ timeout: Schema79.optionalKey(Schema79.String) }).annotate({
|
|
15112
15189
|
identifier: "Relay.WaitForMessagesTool.Input"
|
|
15113
15190
|
});
|
|
15114
|
-
var MessageView =
|
|
15115
|
-
sequence:
|
|
15116
|
-
from:
|
|
15117
|
-
content:
|
|
15118
|
-
reply_token:
|
|
15119
|
-
correlation_key:
|
|
15120
|
-
metadata:
|
|
15191
|
+
var MessageView = Schema79.Struct({
|
|
15192
|
+
sequence: Schema79.Int,
|
|
15193
|
+
from: Schema79.String,
|
|
15194
|
+
content: Schema79.Array(exports_content_schema.TextPart),
|
|
15195
|
+
reply_token: Schema79.optionalKey(Schema79.String),
|
|
15196
|
+
correlation_key: Schema79.optionalKey(Schema79.String),
|
|
15197
|
+
metadata: Schema79.optionalKey(exports_shared_schema.Metadata)
|
|
15121
15198
|
}).annotate({ identifier: "Relay.WaitForMessagesTool.MessageView" });
|
|
15122
|
-
var Output4 =
|
|
15123
|
-
status:
|
|
15124
|
-
messages:
|
|
15199
|
+
var Output4 = Schema79.Struct({
|
|
15200
|
+
status: Schema79.Literals(["messages", "timed_out"]),
|
|
15201
|
+
messages: Schema79.Array(MessageView)
|
|
15125
15202
|
}).annotate({ identifier: "Relay.WaitForMessagesTool.Output" });
|
|
15126
15203
|
var project = (message) => ({
|
|
15127
15204
|
sequence: message.sequence,
|
|
@@ -15178,18 +15255,18 @@ var registeredTool4 = (config) => tool(toolName4, {
|
|
|
15178
15255
|
});
|
|
15179
15256
|
|
|
15180
15257
|
// ../runtime/src/inbox/send-message-tool.ts
|
|
15181
|
-
import { Effect as Effect85, Schema as
|
|
15258
|
+
import { Effect as Effect85, Schema as Schema80 } from "effect";
|
|
15182
15259
|
var toolName5 = "send_message";
|
|
15183
15260
|
var permissionName5 = "relay.inbox.send";
|
|
15184
|
-
var ContentInput2 =
|
|
15185
|
-
var Input5 =
|
|
15186
|
-
to:
|
|
15261
|
+
var ContentInput2 = Schema80.Union([Schema80.String, Schema80.Array(exports_content_schema.TextPart)]);
|
|
15262
|
+
var Input5 = Schema80.Struct({
|
|
15263
|
+
to: Schema80.String,
|
|
15187
15264
|
content: ContentInput2,
|
|
15188
|
-
reply_token:
|
|
15265
|
+
reply_token: Schema80.optionalKey(Schema80.String)
|
|
15189
15266
|
}).annotate({ identifier: "Relay.SendMessageTool.Input" });
|
|
15190
|
-
var Output5 =
|
|
15191
|
-
envelope_id:
|
|
15192
|
-
delivered:
|
|
15267
|
+
var Output5 = Schema80.Struct({
|
|
15268
|
+
envelope_id: Schema80.String,
|
|
15269
|
+
delivered: Schema80.Literals(["inbox", "outbox", "reply"])
|
|
15193
15270
|
}).annotate({ identifier: "Relay.SendMessageTool.Output" });
|
|
15194
15271
|
var registeredTool5 = (config) => tool(toolName5, {
|
|
15195
15272
|
description: "Send a durable message to an address or reply to an inbox message.",
|
|
@@ -15227,26 +15304,26 @@ var registeredTool5 = (config) => tool(toolName5, {
|
|
|
15227
15304
|
});
|
|
15228
15305
|
|
|
15229
15306
|
// ../runtime/src/envelope/envelope-service.ts
|
|
15230
|
-
import { Context as Context63, Effect as Effect86, Layer as Layer69, Schema as
|
|
15231
|
-
class EnvelopeAddressNotFound extends
|
|
15307
|
+
import { Context as Context63, Effect as Effect86, Layer as Layer69, Schema as Schema81 } from "effect";
|
|
15308
|
+
class EnvelopeAddressNotFound extends Schema81.TaggedErrorClass()("EnvelopeAddressNotFound", {
|
|
15232
15309
|
address_id: exports_ids_schema.AddressId
|
|
15233
15310
|
}) {
|
|
15234
15311
|
}
|
|
15235
15312
|
|
|
15236
|
-
class EnvelopeRouteUnavailable extends
|
|
15313
|
+
class EnvelopeRouteUnavailable extends Schema81.TaggedErrorClass()("EnvelopeRouteUnavailable", {
|
|
15237
15314
|
address_id: exports_ids_schema.AddressId,
|
|
15238
|
-
route_key:
|
|
15315
|
+
route_key: Schema81.String
|
|
15239
15316
|
}) {
|
|
15240
15317
|
}
|
|
15241
15318
|
|
|
15242
|
-
class EnvelopeRouteDeferred extends
|
|
15319
|
+
class EnvelopeRouteDeferred extends Schema81.TaggedErrorClass()("EnvelopeRouteDeferred", {
|
|
15243
15320
|
address_id: exports_ids_schema.AddressId,
|
|
15244
|
-
route_key:
|
|
15321
|
+
route_key: Schema81.String
|
|
15245
15322
|
}) {
|
|
15246
15323
|
}
|
|
15247
15324
|
|
|
15248
|
-
class EnvelopeServiceError extends
|
|
15249
|
-
message:
|
|
15325
|
+
class EnvelopeServiceError extends Schema81.TaggedErrorClass()("EnvelopeServiceError", {
|
|
15326
|
+
message: Schema81.String
|
|
15250
15327
|
}) {
|
|
15251
15328
|
}
|
|
15252
15329
|
|
|
@@ -15453,6 +15530,7 @@ var strategy = (config) => {
|
|
|
15453
15530
|
const existing = yield* config.repository.get({ executionId: config.executionId, checkpointId: id }).pipe(Effect87.mapError(mapRepositoryError11));
|
|
15454
15531
|
if (existing !== undefined)
|
|
15455
15532
|
return existing.summary;
|
|
15533
|
+
yield* config.onSummarizeStarted?.({ turn: request.turn, overflow: request.overflow }) ?? Effect87.void;
|
|
15456
15534
|
const summary = yield* config.options?.summaryModel === undefined ? base.summarize(plan2, request) : Effect87.scoped(config.options.summaryModel.pipe(Effect87.flatMap(Layer70.build), Effect87.flatMap((context) => Effect87.provide(base.summarize(plan2, request), context))));
|
|
15457
15535
|
const createdAt = yield* Clock14.currentTimeMillis;
|
|
15458
15536
|
const input = {
|
|
@@ -15478,9 +15556,9 @@ var make8 = (config) => exports_compaction.make(strategy(config), defaultOptions
|
|
|
15478
15556
|
var layerFromEpoch = (epoch) => exports_instructions.layer(epoch.baseline.length === 0 ? [] : [exports_instructions.staticSource("relay:context-epoch", epoch.baseline)]);
|
|
15479
15557
|
|
|
15480
15558
|
// ../runtime/src/agent/relay-permissions.ts
|
|
15481
|
-
import { Clock as Clock15, Effect as Effect88, Layer as Layer71, Option as Option21, Schema as
|
|
15559
|
+
import { Clock as Clock15, Effect as Effect88, Layer as Layer71, Option as Option21, Schema as Schema82 } from "effect";
|
|
15482
15560
|
var permissionTokenPrefix = "wait:permission:";
|
|
15483
|
-
var jsonValue3 = (value) =>
|
|
15561
|
+
var jsonValue3 = (value) => Schema82.decodeUnknownSync(exports_shared_schema.JsonValue)(value === undefined ? null : value);
|
|
15484
15562
|
var waitIdForToolCall = (executionId, toolCallId) => Identifiers.waitId("permission", executionId, toolCallId);
|
|
15485
15563
|
var tokenFor = (executionId, request) => waitIdForToolCall(executionId, request.call.id);
|
|
15486
15564
|
var matchingRule = (rules, tool3, params) => {
|
|
@@ -15642,7 +15720,7 @@ var awaitAnswer = Effect88.fn("RelayPermissions.awaitAnswer")(function* (config,
|
|
|
15642
15720
|
var resolve8 = (config, pending) => pending.token.startsWith(permissionTokenPrefix) ? awaitAnswer(config, pending).pipe(Effect88.orDie) : Effect88.succeed({ _tag: "Approved" });
|
|
15643
15721
|
var rememberRule = Effect88.fn("RelayPermissions.rememberRule")(function* (config, rule) {
|
|
15644
15722
|
const createdAt = yield* Clock15.currentTimeMillis;
|
|
15645
|
-
const decodedRule = yield*
|
|
15723
|
+
const decodedRule = yield* Schema82.decodeUnknownEffect(exports_agent_schema.PermissionRule)(rule).pipe(Effect88.mapError((error5) => permissionError(error5.message)));
|
|
15646
15724
|
yield* config.repository.remember({
|
|
15647
15725
|
agent: config.agentName,
|
|
15648
15726
|
scope: config.scope,
|
|
@@ -15660,9 +15738,9 @@ var layer54 = (config) => Layer71.mergeAll(Layer71.succeed(exports_permissions.P
|
|
|
15660
15738
|
})));
|
|
15661
15739
|
|
|
15662
15740
|
// ../runtime/src/agent/relay-steering.ts
|
|
15663
|
-
import { Clock as Clock16, Effect as Effect89, Layer as Layer72, Schema as
|
|
15664
|
-
import { Prompt as
|
|
15665
|
-
var jsonValue4 = (value) =>
|
|
15741
|
+
import { Clock as Clock16, Effect as Effect89, Layer as Layer72, Schema as Schema83 } from "effect";
|
|
15742
|
+
import { Prompt as Prompt6 } from "effect/unstable/ai";
|
|
15743
|
+
var jsonValue4 = (value) => Schema83.decodeUnknownSync(exports_shared_schema.JsonValue)(value);
|
|
15666
15744
|
var stringifyJson2 = (value) => JSON.stringify(jsonValue4(value));
|
|
15667
15745
|
var createdAtForSequence2 = (config, sequence) => config.startedAt + sequence - config.eventSequence;
|
|
15668
15746
|
var drainId = (config, kind, sequence) => `drain:${config.executionId}:steering:${kind}:sequence:${sequence}`;
|
|
@@ -15680,22 +15758,22 @@ var purePromptPart = (part) => {
|
|
|
15680
15758
|
};
|
|
15681
15759
|
var contentToPromptPart2 = (part) => {
|
|
15682
15760
|
const pure = purePromptPart(part);
|
|
15683
|
-
return pure === undefined ?
|
|
15761
|
+
return pure === undefined ? Prompt6.makePart("text", { text: stringifyJson2(part) }) : contentToPromptPart(pure);
|
|
15684
15762
|
};
|
|
15685
|
-
var promptForContent = (content) =>
|
|
15686
|
-
|
|
15687
|
-
content: content.length === 0 ? [
|
|
15763
|
+
var promptForContent = (content) => Prompt6.fromMessages([
|
|
15764
|
+
Prompt6.makeMessage("user", {
|
|
15765
|
+
content: content.length === 0 ? [Prompt6.makePart("text", { text: "" })] : content.map((part) => contentToPromptPart2(part))
|
|
15688
15766
|
})
|
|
15689
15767
|
]);
|
|
15690
15768
|
var promptTextParts = (prompt) => prompt.content.flatMap((message) => typeof message.content === "string" ? [exports_content_schema.text(message.content)] : message.content.flatMap((part) => part.type === "text" ? [exports_content_schema.text(part.text)] : []));
|
|
15691
15769
|
var contentFromMessage = (message) => {
|
|
15692
15770
|
if (typeof message.prompt === "string")
|
|
15693
15771
|
return [exports_content_schema.text(message.prompt)];
|
|
15694
|
-
const prompt =
|
|
15772
|
+
const prompt = Prompt6.make(message.prompt);
|
|
15695
15773
|
const textParts = promptTextParts(prompt);
|
|
15696
15774
|
if (textParts.length > 0)
|
|
15697
15775
|
return textParts;
|
|
15698
|
-
return [exports_content_schema.text(prompt.pipe(
|
|
15776
|
+
return [exports_content_schema.text(prompt.pipe(Schema83.encodeSync(Prompt6.Prompt), stringifyJson2))];
|
|
15699
15777
|
};
|
|
15700
15778
|
var steeringDeliveredEvent = (config, kind, drain2, messages, sequence) => ({
|
|
15701
15779
|
id: exports_ids_schema.EventId.make(`event:${drain2.drainId}:delivered`),
|
|
@@ -15740,8 +15818,8 @@ var layer55 = (config) => Layer72.succeed(exports_steering.Steering, exports_ste
|
|
|
15740
15818
|
}));
|
|
15741
15819
|
|
|
15742
15820
|
// ../runtime/src/agent/relay-tool-executor.ts
|
|
15743
|
-
import { Deferred as Deferred3, Effect as Effect90, Layer as Layer73, Option as Option22, Schema as
|
|
15744
|
-
var jsonValue5 = (value) =>
|
|
15821
|
+
import { Deferred as Deferred3, Effect as Effect90, Layer as Layer73, Option as Option22, Schema as Schema84 } from "effect";
|
|
15822
|
+
var jsonValue5 = (value) => Schema84.decodeUnknownSync(exports_shared_schema.JsonValue)(value);
|
|
15745
15823
|
var errorDetail = (error5) => {
|
|
15746
15824
|
switch (error5._tag) {
|
|
15747
15825
|
case "ToolNotRegistered":
|
|
@@ -16057,7 +16135,7 @@ var {
|
|
|
16057
16135
|
usageReportedEvent: usageReportedEvent2
|
|
16058
16136
|
} = AgentLoopEvents;
|
|
16059
16137
|
|
|
16060
|
-
class AgentLoopWaitRequested extends
|
|
16138
|
+
class AgentLoopWaitRequested extends Schema85.TaggedErrorClass()("AgentLoopWaitRequested", {
|
|
16061
16139
|
wait_id: exports_ids_schema.WaitId,
|
|
16062
16140
|
tool_call: exports_tool_schema.Call,
|
|
16063
16141
|
suspension: exports_agent_event.AgentSuspended,
|
|
@@ -16067,7 +16145,7 @@ class AgentLoopWaitRequested extends Schema84.TaggedErrorClass()("AgentLoopWaitR
|
|
|
16067
16145
|
|
|
16068
16146
|
class Service61 extends Context64.Service()("@relayfx/runtime/agent/agent-loop-service/Service") {
|
|
16069
16147
|
}
|
|
16070
|
-
var jsonValue6 = (value) =>
|
|
16148
|
+
var jsonValue6 = (value) => Schema85.decodeUnknownSync(exports_shared_schema.JsonValue)(value);
|
|
16071
16149
|
var toolNames = (agent) => HashSet7.fromIterable(agent.tool_names);
|
|
16072
16150
|
var turnPolicyFromSnapshot = (snapshot2) => {
|
|
16073
16151
|
switch (snapshot2.kind) {
|
|
@@ -16159,7 +16237,7 @@ var runStructuredTurn = Effect93.fn("AgentLoop.runStructuredTurn")(function* (la
|
|
|
16159
16237
|
prompt: STRUCTURED_TURN_PROMPT,
|
|
16160
16238
|
schema: registration.schema,
|
|
16161
16239
|
objectName: "output"
|
|
16162
|
-
})).pipe(Effect93.mapError((error5) =>
|
|
16240
|
+
})).pipe(Effect93.mapError((error5) => Schema85.is(AgentLoopError)(error5) ? error5 : loopError(error5, sequence)));
|
|
16163
16241
|
return jsonValue6(response.value);
|
|
16164
16242
|
});
|
|
16165
16243
|
var loopError = (error5, nextEventSequence5) => AgentLoopError.make({
|
|
@@ -16168,6 +16246,23 @@ var loopError = (error5, nextEventSequence5) => AgentLoopError.make({
|
|
|
16168
16246
|
});
|
|
16169
16247
|
var appendEvent = (eventLog, allocator, event, nextEventSequence5) => appendIdempotentTo(eventLog, event).pipe(Effect93.tap((appended) => allocator.advanceTo(appended.sequence + 1)), Effect93.mapError((error5) => loopError(error5, nextEventSequence5)));
|
|
16170
16248
|
var compactionCommittedCursor = (executionId, checkpointId2) => `execution:${executionId}:agent-compaction:${checkpointId2}:committed`;
|
|
16249
|
+
var appendCompactionStartedEvent = Effect93.fn("AgentLoop.appendCompactionStartedEvent")(function* (eventLog, allocator, input, info) {
|
|
16250
|
+
const cursor = `execution:${input.executionId}:agent-compaction:turn:${info.turn}:started`;
|
|
16251
|
+
const existing = yield* eventLog.findByCursor({ executionId: input.executionId, cursor }).pipe(Effect93.mapError((error5) => loopError(error5, input.eventSequence + 1)));
|
|
16252
|
+
if (Option24.isSome(existing))
|
|
16253
|
+
return;
|
|
16254
|
+
const sequence = yield* allocator.allocate(1);
|
|
16255
|
+
const data = { turn: info.turn, overflow: info.overflow };
|
|
16256
|
+
yield* appendEvent(eventLog, allocator, {
|
|
16257
|
+
id: exports_ids_schema.EventId.make(`event:${input.executionId}:agent-compaction:turn:${info.turn}:started`),
|
|
16258
|
+
execution_id: input.executionId,
|
|
16259
|
+
type: "agent.compaction.started",
|
|
16260
|
+
sequence,
|
|
16261
|
+
cursor,
|
|
16262
|
+
data,
|
|
16263
|
+
created_at: input.startedAt + (sequence - input.eventSequence)
|
|
16264
|
+
}, sequence + 1);
|
|
16265
|
+
});
|
|
16171
16266
|
var appendCompactionCommittedEvent = Effect93.fn("AgentLoop.appendCompactionCommittedEvent")(function* (eventLog, allocator, input, checkpoint) {
|
|
16172
16267
|
if (input.sessionId === undefined)
|
|
16173
16268
|
return;
|
|
@@ -16193,8 +16288,8 @@ var appendCompactionCommittedEvent = Effect93.fn("AgentLoop.appendCompactionComm
|
|
|
16193
16288
|
});
|
|
16194
16289
|
var toolFromDefinition = (definition) => AiTool2.dynamic(definition.name, {
|
|
16195
16290
|
description: definition.description,
|
|
16196
|
-
parameters:
|
|
16197
|
-
success:
|
|
16291
|
+
parameters: Schema85.make(exports_tool_schema.parametersSchema(definition.input_schema).ast),
|
|
16292
|
+
success: Schema85.Unknown,
|
|
16198
16293
|
...definition.needs_approval === undefined ? {} : { needsApproval: definition.needs_approval }
|
|
16199
16294
|
});
|
|
16200
16295
|
var toolkitFromRegistered = (registered) => Toolkit2.make(...registered.map((tool3) => toolFromDefinition(tool3.definition)));
|
|
@@ -16224,7 +16319,7 @@ var restoreHistory = Effect93.fn("AgentLoop.restoreHistory")(function* (chats, i
|
|
|
16224
16319
|
}
|
|
16225
16320
|
return history;
|
|
16226
16321
|
});
|
|
16227
|
-
var promptEquivalence =
|
|
16322
|
+
var promptEquivalence = Schema85.toEquivalence(Prompt7.Prompt);
|
|
16228
16323
|
var reconcileCompactionCheckpoint = Effect93.fn("AgentLoop.reconcileCompactionCheckpoint")(function* (sessions, chats, input, restoredHistory, onCheckpointCommitted, failOnMismatch = false) {
|
|
16229
16324
|
if (input.sessionId === undefined)
|
|
16230
16325
|
return restoredHistory;
|
|
@@ -16267,10 +16362,10 @@ var toolCallDecodeMaxRetriesConfig = Config4.int("RELAY_AGENT_TOOL_CALL_DECODE_M
|
|
|
16267
16362
|
var isToolCallDecodeError = (error5) => AiError3.isAiError(error5) && error5.method === "streamText" && error5.reason._tag === "InvalidOutputError";
|
|
16268
16363
|
var toolCallDecodeFeedback = (error5, availableToolNames) => {
|
|
16269
16364
|
const tools = availableToolNames.length === 0 ? "(no tools are available)" : availableToolNames.join(", ");
|
|
16270
|
-
return
|
|
16271
|
-
|
|
16365
|
+
return Prompt7.fromMessages([
|
|
16366
|
+
Prompt7.makeMessage("user", {
|
|
16272
16367
|
content: [
|
|
16273
|
-
|
|
16368
|
+
Prompt7.makePart("text", {
|
|
16274
16369
|
text: `Your previous response contained an invalid tool call: ${error5.reason.message}. Only call these tools with arguments matching their input schemas: ${tools}. Re-issue the intended tool calls.`
|
|
16275
16370
|
})
|
|
16276
16371
|
]
|
|
@@ -16291,7 +16386,7 @@ var withToolCallDecodeResilience = (base, availableToolNames, maxRetries, record
|
|
|
16291
16386
|
if (Cause2.hasInterrupts(cause))
|
|
16292
16387
|
return Stream13.failCause(cause);
|
|
16293
16388
|
const error5 = Cause2.squash(cause);
|
|
16294
|
-
const continuation = !emitted && retriesLeft > 0 && isToolCallDecodeError(error5) ? attempt(
|
|
16389
|
+
const continuation = !emitted && retriesLeft > 0 && isToolCallDecodeError(error5) ? attempt(Prompt7.concat(Prompt7.make(prompt), toolCallDecodeFeedback(error5, availableToolNames)), retriesLeft - 1) : Stream13.failCause(cause);
|
|
16295
16390
|
return Stream13.unwrap(recordFailureClassification(exports_model_registry.classifyFailure(base, error5)).pipe(Effect93.as(continuation)));
|
|
16296
16391
|
}));
|
|
16297
16392
|
}))));
|
|
@@ -16316,7 +16411,7 @@ var restoreContextEpoch = Effect93.fn("AgentLoop.restoreContextEpoch")(function*
|
|
|
16316
16411
|
return { baseline: epoch.baseline, dynamicSourceIds: epoch.dynamicSourceIds };
|
|
16317
16412
|
});
|
|
16318
16413
|
var mapBatonRunError = (error5, current2) => {
|
|
16319
|
-
if (
|
|
16414
|
+
if (Schema85.is(exports_agent_event.AgentSuspended)(error5)) {
|
|
16320
16415
|
return AgentLoopWaitRequested.make({
|
|
16321
16416
|
wait_id: exports_ids_schema.WaitId.make(error5.token),
|
|
16322
16417
|
tool_call: {
|
|
@@ -16329,29 +16424,31 @@ var mapBatonRunError = (error5, current2) => {
|
|
|
16329
16424
|
});
|
|
16330
16425
|
}
|
|
16331
16426
|
let message;
|
|
16332
|
-
if (
|
|
16427
|
+
if (Schema85.is(exports_model_telemetry.DeliveryFailed)(error5))
|
|
16428
|
+
message = `Telemetry delivery failed: ${error5.message}`;
|
|
16429
|
+
else if (Schema85.is(exports_agent_event.AgentError)(error5))
|
|
16333
16430
|
message = error5.message;
|
|
16334
|
-
else if (
|
|
16431
|
+
else if (Schema85.is(exports_agent_event.ResumeMismatch)(error5))
|
|
16335
16432
|
message = `Resume mismatch: ${error5.reason}`;
|
|
16336
|
-
else if (
|
|
16433
|
+
else if (Schema85.is(exports_turn_policy.TurnPolicyError)(error5))
|
|
16337
16434
|
message = error5.message;
|
|
16338
|
-
else if (
|
|
16435
|
+
else if (Schema85.is(exports_agent_event.TurnPolicyStopped)(error5))
|
|
16339
16436
|
message = `Turn policy stopped at turn ${error5.turn}`;
|
|
16340
|
-
else if (
|
|
16437
|
+
else if (Schema85.is(exports_agent_event.TurnLimitExceeded)(error5))
|
|
16341
16438
|
message = "Tool call turn limit exceeded";
|
|
16342
|
-
else if (
|
|
16439
|
+
else if (Schema85.is(exports_agent_event.MiddlewareViolation)(error5))
|
|
16343
16440
|
message = `ModelMiddleware violation at turn ${error5.turn}: ${error5.detail}`;
|
|
16344
|
-
else if (
|
|
16441
|
+
else if (Schema85.is(exports_agent_event.DuplicateToolCallId)(error5))
|
|
16345
16442
|
message = `Duplicate tool call id: ${error5.id}`;
|
|
16346
|
-
else if (
|
|
16443
|
+
else if (Schema85.is(exports_agent_event.ProgressOverflow)(error5))
|
|
16347
16444
|
message = `Tool progress overflow: ${error5.toolCallId}`;
|
|
16348
|
-
else if (
|
|
16445
|
+
else if (Schema85.is(exports_agent_event.ToolNameCollision)(error5))
|
|
16349
16446
|
message = `Tool name collision: ${error5.name}`;
|
|
16350
|
-
else if (
|
|
16447
|
+
else if (Schema85.is(AiError3.AiError)(error5))
|
|
16351
16448
|
message = error5.message;
|
|
16352
|
-
else if (
|
|
16449
|
+
else if (Schema85.is(exports_model_registry.LanguageModelNotRegistered)(error5))
|
|
16353
16450
|
message = `Language model not registered: ${error5.provider}/${error5.model}`;
|
|
16354
|
-
else if (
|
|
16451
|
+
else if (Schema85.is(exports_tool_executor.FrameworkFailure)(error5))
|
|
16355
16452
|
message = error5.message;
|
|
16356
16453
|
else {
|
|
16357
16454
|
const exhaustive = error5;
|
|
@@ -16359,14 +16456,14 @@ var mapBatonRunError = (error5, current2) => {
|
|
|
16359
16456
|
}
|
|
16360
16457
|
return AgentLoopError.make({ message, baton_failure: error5, next_event_sequence: current2 });
|
|
16361
16458
|
};
|
|
16362
|
-
var isBatonRunError = (error5) =>
|
|
16459
|
+
var isBatonRunError = (error5) => Schema85.is(exports_agent_event.AgentSuspended)(error5) || Schema85.is(exports_agent_event.ResumeMismatch)(error5) || Schema85.is(exports_turn_policy.TurnPolicyError)(error5) || Schema85.is(exports_agent_event.TurnPolicyStopped)(error5) || Schema85.is(exports_agent_event.TurnLimitExceeded)(error5) || Schema85.is(exports_agent_event.MiddlewareViolation)(error5) || Schema85.is(exports_agent_event.DuplicateToolCallId)(error5) || Schema85.is(exports_agent_event.ProgressOverflow)(error5) || Schema85.is(exports_agent_event.ToolNameCollision)(error5) || Schema85.is(exports_agent_event.AgentError)(error5) || Schema85.is(AiError3.AiError)(error5) || Schema85.is(exports_model_registry.LanguageModelNotRegistered)(error5) || Schema85.is(exports_tool_executor.FrameworkFailure)(error5);
|
|
16363
16460
|
var mapBoundaryError = (errorOrCurrent, current2, failureClassification) => {
|
|
16364
16461
|
if (current2 === undefined) {
|
|
16365
16462
|
const sequence = errorOrCurrent;
|
|
16366
16463
|
return (error6) => mapBoundaryError(error6, sequence);
|
|
16367
16464
|
}
|
|
16368
16465
|
const error5 = errorOrCurrent;
|
|
16369
|
-
if (
|
|
16466
|
+
if (Schema85.is(AgentLoopError)(error5) || Schema85.is(AgentLoopWaitRequested)(error5) || Schema85.is(AgentLoopBudgetExceeded)(error5))
|
|
16370
16467
|
return error5;
|
|
16371
16468
|
const mapped = isBatonRunError(error5) ? mapBatonRunError(error5, current2) : loopError(error5, current2);
|
|
16372
16469
|
return mapped._tag === "AgentLoopError" && failureClassification === "context-overflow" ? AgentLoopError.make({
|
|
@@ -16384,9 +16481,9 @@ var terminalMemoryTranscript = (prompt, text) => {
|
|
|
16384
16481
|
return;
|
|
16385
16482
|
if (promptHasAssistantText(prompt, text))
|
|
16386
16483
|
return prompt;
|
|
16387
|
-
return
|
|
16484
|
+
return Prompt7.fromMessages([
|
|
16388
16485
|
...prompt.content,
|
|
16389
|
-
|
|
16486
|
+
Prompt7.makeMessage("assistant", { content: [Prompt7.makePart("text", { text })] })
|
|
16390
16487
|
]);
|
|
16391
16488
|
};
|
|
16392
16489
|
var recallOnlyMemory = (memory) => exports_memory.Memory.of({
|
|
@@ -16609,7 +16706,8 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16609
16706
|
const compactionService = activeCompactionOptions === undefined ? undefined : exports_compaction.Compaction.of(make8({
|
|
16610
16707
|
executionId: input.executionId,
|
|
16611
16708
|
repository: activeCompactionRepository,
|
|
16612
|
-
options: activeCompactionOptions
|
|
16709
|
+
options: activeCompactionOptions,
|
|
16710
|
+
onSummarizeStarted: (info) => appendCompactionStartedEvent(eventLog, allocator, input, info).pipe(Effect93.mapError((error5) => exports_compaction.CompactionError.make({ message: error5.message, cause: error5 })))
|
|
16613
16711
|
}));
|
|
16614
16712
|
if (memory !== undefined && Option24.isNone(durableMemory)) {
|
|
16615
16713
|
return yield* AgentLoopError.make({
|
|
@@ -16752,7 +16850,7 @@ var run5 = Effect93.fn("AgentLoop.run.call")(function* (input) {
|
|
|
16752
16850
|
// ../runtime/src/cluster/execution-entity.ts
|
|
16753
16851
|
import { ClusterSchema, Entity } from "effect/unstable/cluster";
|
|
16754
16852
|
import { Rpc } from "effect/unstable/rpc";
|
|
16755
|
-
import { Schema as
|
|
16853
|
+
import { Schema as Schema86 } from "effect";
|
|
16756
16854
|
var Start = Rpc.make("start", {
|
|
16757
16855
|
payload: StartInput,
|
|
16758
16856
|
success: StartResult,
|
|
@@ -16760,12 +16858,12 @@ var Start = Rpc.make("start", {
|
|
|
16760
16858
|
}).annotate(ClusterSchema.Persisted, true).annotate(ClusterSchema.Uninterruptible, "server");
|
|
16761
16859
|
var SignalWait = Rpc.make("signalWait", {
|
|
16762
16860
|
payload: SignalWaitInput,
|
|
16763
|
-
success:
|
|
16861
|
+
success: Schema86.Void,
|
|
16764
16862
|
error: ExecutionWorkflowFailed
|
|
16765
16863
|
}).annotate(ClusterSchema.Persisted, true).annotate(ClusterSchema.Uninterruptible, "server");
|
|
16766
16864
|
var Dispatch = Rpc.make("dispatch", {
|
|
16767
16865
|
payload: StartInput,
|
|
16768
|
-
success:
|
|
16866
|
+
success: Schema86.Void,
|
|
16769
16867
|
error: ExecutionWorkflowError
|
|
16770
16868
|
}).annotate(ClusterSchema.Persisted, true).annotate(ClusterSchema.Uninterruptible, "server");
|
|
16771
16869
|
var Cancel = Rpc.make("cancel", {
|
|
@@ -16788,10 +16886,10 @@ var layer59 = entity.toLayer(entity.of({
|
|
|
16788
16886
|
var client = entity.client;
|
|
16789
16887
|
|
|
16790
16888
|
// ../runtime/src/execution/execution-watch-service.ts
|
|
16791
|
-
import { Config as Config5, Context as Context65, Duration as Duration4, Effect as Effect94, Layer as Layer76, Ref as Ref20, Schema as
|
|
16889
|
+
import { Config as Config5, Context as Context65, Duration as Duration4, Effect as Effect94, Layer as Layer76, Ref as Ref20, Schema as Schema87, Stream as Stream14 } from "effect";
|
|
16792
16890
|
|
|
16793
|
-
class ExecutionWatchError extends
|
|
16794
|
-
message:
|
|
16891
|
+
class ExecutionWatchError extends Schema87.TaggedErrorClass()("ExecutionWatchError", {
|
|
16892
|
+
message: Schema87.String
|
|
16795
16893
|
}) {
|
|
16796
16894
|
}
|
|
16797
16895
|
|
|
@@ -16839,20 +16937,20 @@ var layerFromServices = Layer76.effect(Service65, Effect94.gen(function* () {
|
|
|
16839
16937
|
}));
|
|
16840
16938
|
|
|
16841
16939
|
// ../runtime/src/resident/resident-registry-service.ts
|
|
16842
|
-
import { Context as Context66, Effect as Effect95, Layer as Layer77, Schema as
|
|
16843
|
-
class ResidentKindNotFound extends
|
|
16940
|
+
import { Context as Context66, Effect as Effect95, Layer as Layer77, Schema as Schema88 } from "effect";
|
|
16941
|
+
class ResidentKindNotFound extends Schema88.TaggedErrorClass()("ResidentKindNotFound", {
|
|
16844
16942
|
kind: exports_ids_schema.ResidentKindName
|
|
16845
16943
|
}) {
|
|
16846
16944
|
}
|
|
16847
16945
|
|
|
16848
|
-
class ResidentKindInvalid extends
|
|
16946
|
+
class ResidentKindInvalid extends Schema88.TaggedErrorClass()("ResidentKindInvalid", {
|
|
16849
16947
|
kind: exports_ids_schema.ResidentKindName,
|
|
16850
|
-
message:
|
|
16948
|
+
message: Schema88.String
|
|
16851
16949
|
}) {
|
|
16852
16950
|
}
|
|
16853
16951
|
|
|
16854
|
-
class ResidentRegistryError extends
|
|
16855
|
-
message:
|
|
16952
|
+
class ResidentRegistryError extends Schema88.TaggedErrorClass()("ResidentRegistryError", {
|
|
16953
|
+
message: Schema88.String
|
|
16856
16954
|
}) {
|
|
16857
16955
|
}
|
|
16858
16956
|
|
|
@@ -16884,21 +16982,21 @@ var layer60 = Layer77.effect(Service66, Effect95.gen(function* () {
|
|
|
16884
16982
|
}));
|
|
16885
16983
|
|
|
16886
16984
|
// ../runtime/src/resident/resident-instance-service.ts
|
|
16887
|
-
import { Context as Context67, Effect as Effect96, Function as Function16, Layer as Layer78, Schema as
|
|
16888
|
-
class ResidentDestroyed extends
|
|
16985
|
+
import { Context as Context67, Effect as Effect96, Function as Function16, Layer as Layer78, Schema as Schema89 } from "effect";
|
|
16986
|
+
class ResidentDestroyed extends Schema89.TaggedErrorClass()("ResidentDestroyed", {
|
|
16889
16987
|
kind: exports_ids_schema.ResidentKindName,
|
|
16890
16988
|
key: exports_ids_schema.ResidentKey
|
|
16891
16989
|
}) {
|
|
16892
16990
|
}
|
|
16893
16991
|
|
|
16894
|
-
class ResidentNotFound2 extends
|
|
16992
|
+
class ResidentNotFound2 extends Schema89.TaggedErrorClass()("ResidentNotFound", {
|
|
16895
16993
|
kind: exports_ids_schema.ResidentKindName,
|
|
16896
16994
|
key: exports_ids_schema.ResidentKey
|
|
16897
16995
|
}) {
|
|
16898
16996
|
}
|
|
16899
16997
|
|
|
16900
|
-
class ResidentServiceError extends
|
|
16901
|
-
message:
|
|
16998
|
+
class ResidentServiceError extends Schema89.TaggedErrorClass()("ResidentServiceError", {
|
|
16999
|
+
message: Schema89.String
|
|
16902
17000
|
}) {
|
|
16903
17001
|
}
|
|
16904
17002
|
|
|
@@ -17001,9 +17099,9 @@ var layer61 = Layer78.effect(Service67, Effect96.gen(function* () {
|
|
|
17001
17099
|
}));
|
|
17002
17100
|
|
|
17003
17101
|
// ../runtime/src/execution/session-stream-service.ts
|
|
17004
|
-
import { Config as Config6, Context as Context68, Duration as Duration5, Effect as Effect97, HashSet as HashSet8, Layer as Layer79, Ref as Ref21, Schema as
|
|
17005
|
-
class SessionStreamError extends
|
|
17006
|
-
message:
|
|
17102
|
+
import { Config as Config6, Context as Context68, Duration as Duration5, Effect as Effect97, HashSet as HashSet8, Layer as Layer79, Ref as Ref21, Schema as Schema90, Stream as Stream15 } from "effect";
|
|
17103
|
+
class SessionStreamError extends Schema90.TaggedErrorClass()("SessionStreamError", {
|
|
17104
|
+
message: Schema90.String
|
|
17007
17105
|
}) {
|
|
17008
17106
|
}
|
|
17009
17107
|
|
|
@@ -17036,15 +17134,15 @@ var layerFromServices2 = Layer79.effect(Service68, Effect97.gen(function* () {
|
|
|
17036
17134
|
}));
|
|
17037
17135
|
|
|
17038
17136
|
// ../runtime/src/schedule/scheduler-service.ts
|
|
17039
|
-
import { Clock as Clock17, Config as Config7, Context as Context69, Cron, DateTime as DateTime2, Duration as Duration6, Effect as Effect98, Layer as Layer80, Option as Option25, Random as Random3, Result as Result3, Schema as
|
|
17040
|
-
class SchedulerError extends
|
|
17041
|
-
message:
|
|
17137
|
+
import { Clock as Clock17, Config as Config7, Context as Context69, Cron, DateTime as DateTime2, Duration as Duration6, Effect as Effect98, Layer as Layer80, Option as Option25, Random as Random3, Result as Result3, Schema as Schema91 } from "effect";
|
|
17138
|
+
class SchedulerError extends Schema91.TaggedErrorClass()("SchedulerError", {
|
|
17139
|
+
message: Schema91.String
|
|
17042
17140
|
}) {
|
|
17043
17141
|
}
|
|
17044
17142
|
|
|
17045
|
-
class ScheduleCronInvalid extends
|
|
17046
|
-
cron_expr:
|
|
17047
|
-
message:
|
|
17143
|
+
class ScheduleCronInvalid extends Schema91.TaggedErrorClass()("ScheduleCronInvalid", {
|
|
17144
|
+
cron_expr: Schema91.String,
|
|
17145
|
+
message: Schema91.String
|
|
17048
17146
|
}) {
|
|
17049
17147
|
}
|
|
17050
17148
|
|
|
@@ -17199,25 +17297,25 @@ var runOnce2 = Effect98.fn("SchedulerService.runOnce.call")(function* () {
|
|
|
17199
17297
|
});
|
|
17200
17298
|
|
|
17201
17299
|
// ../runtime/src/runner/runner-runtime-service.ts
|
|
17202
|
-
var DatabaseMode =
|
|
17300
|
+
var DatabaseMode = Schema92.Literals(["sql", "pg", "mysql", "sqlite", "memory"]).annotate({
|
|
17203
17301
|
identifier: "Relay.RunnerRuntime.DatabaseMode"
|
|
17204
17302
|
});
|
|
17205
|
-
var ReadinessStatus =
|
|
17303
|
+
var ReadinessStatus = Schema92.Struct({
|
|
17206
17304
|
database: DatabaseMode,
|
|
17207
|
-
cluster:
|
|
17208
|
-
workflow:
|
|
17209
|
-
executionEntity:
|
|
17305
|
+
cluster: Schema92.Literal("ready"),
|
|
17306
|
+
workflow: Schema92.Literals(["ready", "client"]),
|
|
17307
|
+
executionEntity: Schema92.Literals(["registered", "client"])
|
|
17210
17308
|
}).annotate({ identifier: "Relay.RunnerRuntime.ReadinessStatus" });
|
|
17211
17309
|
|
|
17212
|
-
class RunnerRuntimeError extends
|
|
17213
|
-
message:
|
|
17310
|
+
class RunnerRuntimeError extends Schema92.TaggedErrorClass()("RunnerRuntimeError", {
|
|
17311
|
+
message: Schema92.String
|
|
17214
17312
|
}) {
|
|
17215
17313
|
}
|
|
17216
17314
|
|
|
17217
|
-
class ClusterConfigMismatch extends
|
|
17218
|
-
field:
|
|
17219
|
-
expected:
|
|
17220
|
-
actual:
|
|
17315
|
+
class ClusterConfigMismatch extends Schema92.TaggedErrorClass()("ClusterConfigMismatch", {
|
|
17316
|
+
field: Schema92.String,
|
|
17317
|
+
expected: Schema92.String,
|
|
17318
|
+
actual: Schema92.String
|
|
17221
17319
|
}) {
|
|
17222
17320
|
}
|
|
17223
17321
|
|
|
@@ -17231,7 +17329,7 @@ var memoryClusterLayer = Sharding.layer.pipe(Layer81.provideMerge(Runners.layerN
|
|
|
17231
17329
|
var clusterHost = Config8.string("RELAY_CLUSTER_HOST").pipe(Config8.withDefault("localhost"));
|
|
17232
17330
|
var clusterPort = Config8.int("RELAY_CLUSTER_PORT").pipe(Config8.withDefault(34431));
|
|
17233
17331
|
var clusterShardsPerGroup = Config8.int("RELAY_CLUSTER_SHARDS_PER_GROUP").pipe(Config8.withDefault(300));
|
|
17234
|
-
var clusterShardGroups = Config8.schema(Config8.Array(
|
|
17332
|
+
var clusterShardGroups = Config8.schema(Config8.Array(Schema92.String), "RELAY_CLUSTER_SHARD_GROUPS").pipe(Config8.withDefault(["default", "execution"]));
|
|
17235
17333
|
var runnerAddressKey = (address) => `${address.host}:${address.port}`;
|
|
17236
17334
|
var runnerAddressEquals = (left, right) => left.host === right.host && left.port === right.port;
|
|
17237
17335
|
var shardingConfigFromEnv = Layer81.effect(ShardingConfig2.ShardingConfig, Effect99.gen(function* () {
|
|
@@ -17562,24 +17660,24 @@ var check = Effect99.fn("RunnerRuntime.check.call")(function* () {
|
|
|
17562
17660
|
});
|
|
17563
17661
|
|
|
17564
17662
|
// ../runtime/src/workflow/definition-runtime.ts
|
|
17565
|
-
import { Cause as Cause3, Clock as Clock18, Context as Context71, Effect as Effect100, Exit as Exit2, FiberMap as FiberMap2, Layer as Layer82, Option as Option27, Schema as
|
|
17663
|
+
import { Cause as Cause3, Clock as Clock18, Context as Context71, Effect as Effect100, Exit as Exit2, FiberMap as FiberMap2, Layer as Layer82, Option as Option27, Schema as Schema93 } from "effect";
|
|
17566
17664
|
import { dual as dual2 } from "effect/Function";
|
|
17567
17665
|
|
|
17568
|
-
class UnsupportedOperation extends
|
|
17666
|
+
class UnsupportedOperation extends Schema93.TaggedErrorClass()("UnsupportedWorkflowOperation", { operation_id: exports_ids_schema.WorkflowOperationId, kind: Schema93.String }) {
|
|
17569
17667
|
}
|
|
17570
17668
|
|
|
17571
|
-
class PinnedDefinitionNotFound extends
|
|
17669
|
+
class PinnedDefinitionNotFound extends Schema93.TaggedErrorClass()("PinnedWorkflowDefinitionNotFound", { execution_id: exports_ids_schema.ExecutionId }) {
|
|
17572
17670
|
}
|
|
17573
17671
|
|
|
17574
|
-
class PinnedDefinitionMismatch extends
|
|
17672
|
+
class PinnedDefinitionMismatch extends Schema93.TaggedErrorClass()("PinnedWorkflowDefinitionMismatch", { execution_id: exports_ids_schema.ExecutionId }) {
|
|
17575
17673
|
}
|
|
17576
17674
|
|
|
17577
|
-
class WorkflowRuntimeError extends
|
|
17578
|
-
message:
|
|
17675
|
+
class WorkflowRuntimeError extends Schema93.TaggedErrorClass()("WorkflowRuntimeError", {
|
|
17676
|
+
message: Schema93.String
|
|
17579
17677
|
}) {
|
|
17580
17678
|
}
|
|
17581
17679
|
|
|
17582
|
-
class WorkflowJoinPolicyNotSatisfied extends
|
|
17680
|
+
class WorkflowJoinPolicyNotSatisfied extends Schema93.TaggedErrorClass()("WorkflowJoinPolicyNotSatisfied", { policy: Schema93.String }) {
|
|
17583
17681
|
}
|
|
17584
17682
|
var runtimeError2 = (error5) => WorkflowRuntimeError.make({ message: String(error5) });
|
|
17585
17683
|
var mapRuntimeError2 = Effect100.mapError(runtimeError2);
|
|
@@ -17592,13 +17690,13 @@ class Service71 extends Context71.Service()("@relayfx/runtime/workflow/definitio
|
|
|
17592
17690
|
var fanOutIdFor = dual2(2, (executionId, fanOutKey) => exports_ids_schema.ChildFanOutId.make(`workflow:${executionId}:fan-out:${fanOutKey}`));
|
|
17593
17691
|
var childExecutionIdFor = (fanOutId, operationId2) => exports_ids_schema.ChildExecutionId.make(`${fanOutId}:member:${operationId2}`);
|
|
17594
17692
|
|
|
17595
|
-
class WorkflowCancelled extends
|
|
17693
|
+
class WorkflowCancelled extends Schema93.TaggedErrorClass()("WorkflowCancelled", {}) {
|
|
17596
17694
|
}
|
|
17597
17695
|
|
|
17598
|
-
class WorkflowBudgetExceeded extends
|
|
17696
|
+
class WorkflowBudgetExceeded extends Schema93.TaggedErrorClass()("WorkflowBudgetExceeded", { operation_id: exports_ids_schema.WorkflowOperationId }) {
|
|
17599
17697
|
}
|
|
17600
17698
|
|
|
17601
|
-
class WorkflowJoining extends
|
|
17699
|
+
class WorkflowJoining extends Schema93.TaggedErrorClass()("WorkflowJoining", {
|
|
17602
17700
|
fan_out_id: exports_ids_schema.ChildFanOutId
|
|
17603
17701
|
}) {
|
|
17604
17702
|
}
|
|
@@ -17853,7 +17951,7 @@ var run6 = Effect100.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
17853
17951
|
break;
|
|
17854
17952
|
}
|
|
17855
17953
|
case "cancellation":
|
|
17856
|
-
output2 = yield* execute(operation.operation).pipe(Effect100.catchIf(
|
|
17954
|
+
output2 = yield* execute(operation.operation).pipe(Effect100.catchIf(Schema93.is(WorkflowCancelled), () => operation.on_cancel === undefined ? Effect100.fail(WorkflowCancelled.make()) : execute(operation.on_cancel)));
|
|
17857
17955
|
break;
|
|
17858
17956
|
case "compensation":
|
|
17859
17957
|
output2 = yield* execute(operation.operation);
|
|
@@ -17900,7 +17998,7 @@ var run6 = Effect100.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
17900
17998
|
const result = yield* Effect100.exit(execute(revision.definition.entry_operation_id));
|
|
17901
17999
|
if (Exit2.isFailure(result)) {
|
|
17902
18000
|
const failure2 = Cause3.findErrorOption(result.cause);
|
|
17903
|
-
if (Option27.isSome(failure2) &&
|
|
18001
|
+
if (Option27.isSome(failure2) && Schema93.is(WorkflowJoining)(failure2.value))
|
|
17904
18002
|
return yield* result;
|
|
17905
18003
|
const currentRun = yield* repository.inspect(executionId);
|
|
17906
18004
|
if (currentRun?.status === "cancelled") {
|
|
@@ -17971,12 +18069,12 @@ var layerFromRuntime2 = Layer82.effect(Service71, Effect100.gen(function* () {
|
|
|
17971
18069
|
}));
|
|
17972
18070
|
|
|
17973
18071
|
// src/runtime.ts
|
|
17974
|
-
import { Cause as Cause5, Context as Context74, Effect as Effect112, Layer as Layer86, Option as Option31, Schema as
|
|
18072
|
+
import { Cause as Cause5, Context as Context74, Effect as Effect112, Layer as Layer86, Option as Option31, Schema as Schema101 } from "effect";
|
|
17975
18073
|
import { SqlClient as SqlClient31 } from "effect/unstable/sql/SqlClient";
|
|
17976
18074
|
|
|
17977
18075
|
// src/runtime-acquisition-error.ts
|
|
17978
|
-
import { Cause as Cause4, Function as Function17, Schema as
|
|
17979
|
-
var RuntimeConfigurationCategory =
|
|
18076
|
+
import { Cause as Cause4, Function as Function17, Schema as Schema94 } from "effect";
|
|
18077
|
+
var RuntimeConfigurationCategory = Schema94.Literals([
|
|
17980
18078
|
"missing-http-client",
|
|
17981
18079
|
"provider-config",
|
|
17982
18080
|
"model-registration",
|
|
@@ -17984,31 +18082,31 @@ var RuntimeConfigurationCategory = Schema93.Literals([
|
|
|
17984
18082
|
"database-config",
|
|
17985
18083
|
"unknown-host-layer"
|
|
17986
18084
|
]);
|
|
17987
|
-
var RuntimeConfigurationScope =
|
|
18085
|
+
var RuntimeConfigurationScope = Schema94.Literals(["host-layer", "database-client"]);
|
|
17988
18086
|
|
|
17989
|
-
class RuntimeHostLayerFailure extends
|
|
18087
|
+
class RuntimeHostLayerFailure extends Schema94.TaggedErrorClass()("RuntimeHostLayerFailure", { category: RuntimeConfigurationCategory }) {
|
|
17990
18088
|
}
|
|
17991
|
-
var SafeCauseReason =
|
|
18089
|
+
var SafeCauseReason = Schema94.TaggedUnion({
|
|
17992
18090
|
Fail: {
|
|
17993
18091
|
category: RuntimeConfigurationCategory,
|
|
17994
|
-
errorTag:
|
|
18092
|
+
errorTag: Schema94.Literals(["RuntimeHostLayerFailure", "UnknownTypedFailure"])
|
|
17995
18093
|
},
|
|
17996
|
-
Die: { defectTag:
|
|
18094
|
+
Die: { defectTag: Schema94.Literal("UnknownDefect") },
|
|
17997
18095
|
Interrupt: {}
|
|
17998
18096
|
});
|
|
17999
|
-
var SafeCause =
|
|
18000
|
-
reasons:
|
|
18001
|
-
truncated:
|
|
18097
|
+
var SafeCause = Schema94.Struct({
|
|
18098
|
+
reasons: Schema94.Array(SafeCauseReason).check(Schema94.isMaxLength(16)),
|
|
18099
|
+
truncated: Schema94.Boolean
|
|
18002
18100
|
});
|
|
18003
18101
|
|
|
18004
|
-
class RuntimeConfigurationError extends
|
|
18102
|
+
class RuntimeConfigurationError extends Schema94.TaggedErrorClass()("RuntimeConfigurationError", {
|
|
18005
18103
|
category: RuntimeConfigurationCategory,
|
|
18006
18104
|
scope: RuntimeConfigurationScope,
|
|
18007
18105
|
cause: SafeCause
|
|
18008
18106
|
}) {
|
|
18009
18107
|
}
|
|
18010
18108
|
var typedFailure = (error5) => {
|
|
18011
|
-
if (
|
|
18109
|
+
if (Schema94.is(RuntimeHostLayerFailure)(error5)) {
|
|
18012
18110
|
return { _tag: "Fail", category: error5.category, errorTag: "RuntimeHostLayerFailure" };
|
|
18013
18111
|
}
|
|
18014
18112
|
return { _tag: "Fail", category: "unknown-host-layer", errorTag: "UnknownTypedFailure" };
|
|
@@ -18027,11 +18125,11 @@ var safeCause = (cause) => {
|
|
|
18027
18125
|
var normalizeAcquisitionCauseImpl = (cause, scope, preserve) => {
|
|
18028
18126
|
const summary = safeCause(cause);
|
|
18029
18127
|
return Cause4.map(cause, (error5) => {
|
|
18030
|
-
if (
|
|
18128
|
+
if (Schema94.is(RuntimeConfigurationError)(error5) || preserve !== undefined && preserve(error5))
|
|
18031
18129
|
return error5;
|
|
18032
18130
|
const reason = typedFailure(error5);
|
|
18033
18131
|
return RuntimeConfigurationError.make({
|
|
18034
|
-
category:
|
|
18132
|
+
category: Schema94.is(RuntimeHostLayerFailure)(error5) ? reason.category : scope === "database-client" ? "database-config" : "unknown-host-layer",
|
|
18035
18133
|
scope,
|
|
18036
18134
|
cause: summary
|
|
18037
18135
|
});
|
|
@@ -18053,16 +18151,16 @@ var renderConfigurationError = (error5) => {
|
|
|
18053
18151
|
return `Runtime configuration error [${error5.category}/${error5.scope}]: ${remediation}; causes=${reasons}${error5.cause.truncated ? ",truncated" : ""}`;
|
|
18054
18152
|
};
|
|
18055
18153
|
// src/internal-client.ts
|
|
18056
|
-
import { Clock as Clock19, Effect as Effect109, Layer as Layer84, Option as Option30, Random as Random4, Schema as
|
|
18154
|
+
import { Clock as Clock19, Effect as Effect109, Layer as Layer84, Option as Option30, Random as Random4, Schema as Schema100, Stream as Stream17 } from "effect";
|
|
18057
18155
|
import { EntityId, ShardId, Sharding as Sharding2, ShardingConfig as ShardingConfig3 } from "effect/unstable/cluster";
|
|
18058
18156
|
|
|
18059
18157
|
// src/runtime-capability-policy.ts
|
|
18060
|
-
import { Context as Context72, Effect as Effect101, Function as Function18, Layer as Layer83, Schema as
|
|
18158
|
+
import { Context as Context72, Effect as Effect101, Function as Function18, Layer as Layer83, Schema as Schema95 } from "effect";
|
|
18061
18159
|
|
|
18062
|
-
class RuntimeCapabilityUnavailable extends
|
|
18063
|
-
capability:
|
|
18064
|
-
role:
|
|
18065
|
-
nextAction:
|
|
18160
|
+
class RuntimeCapabilityUnavailable extends Schema95.TaggedErrorClass()("RuntimeCapabilityUnavailable", {
|
|
18161
|
+
capability: Schema95.Literals(["fan-out", "workflow-definition"]),
|
|
18162
|
+
role: Schema95.Literals(["embedded", "runner", "client"]),
|
|
18163
|
+
nextAction: Schema95.Literals(["enable-embedded-capability", "use-embedded-runtime"])
|
|
18066
18164
|
}) {
|
|
18067
18165
|
}
|
|
18068
18166
|
|
|
@@ -18080,7 +18178,7 @@ var layer64 = Function18.dual(2, (role, capabilities) => Layer83.succeed(Service
|
|
|
18080
18178
|
}));
|
|
18081
18179
|
|
|
18082
18180
|
// src/client-baton-agent.ts
|
|
18083
|
-
import { Effect as Effect102, Schema as
|
|
18181
|
+
import { Effect as Effect102, Schema as Schema96 } from "effect";
|
|
18084
18182
|
var isRegisterBatonAgentInput = (input) => ("agent" in input);
|
|
18085
18183
|
var toolRefsFromBatonAgent = (agent) => Object.values(agent.toolkit.tools).map((tool3) => ({ name: tool3.name }));
|
|
18086
18184
|
var modelSelectionFromBatonAgent = (selection) => ({
|
|
@@ -18088,9 +18186,9 @@ var modelSelectionFromBatonAgent = (selection) => ({
|
|
|
18088
18186
|
model: selection.model,
|
|
18089
18187
|
...selection.registrationKey === undefined ? {} : { registration_key: selection.registrationKey }
|
|
18090
18188
|
});
|
|
18091
|
-
var decodeBatonAgentName = (name) =>
|
|
18092
|
-
var decodeBatonAgentMetadata = (metadata11) => metadata11 === undefined ? Effect102.void :
|
|
18093
|
-
var decodeBatonMemorySubject = (subject) =>
|
|
18189
|
+
var decodeBatonAgentName = (name) => Schema96.decodeUnknownEffect(exports_shared_schema.NonEmptyString)(name).pipe(Effect102.mapError(() => ClientError.make({ message: "Baton agent name must not be blank" })));
|
|
18190
|
+
var decodeBatonAgentMetadata = (metadata11) => metadata11 === undefined ? Effect102.void : Schema96.decodeUnknownEffect(exports_shared_schema.Metadata)(metadata11).pipe(Effect102.mapError(() => ClientError.make({ message: "Baton agent metadata must be JSON metadata" })));
|
|
18191
|
+
var decodeBatonMemorySubject = (subject) => Schema96.decodeUnknownEffect(exports_ids_schema.MemorySubjectId)(subject).pipe(Effect102.mapError(() => ClientError.make({ message: "Baton agent memory subject must be a MemorySubjectId" })));
|
|
18094
18192
|
var metadataFromBatonAgent = Effect102.fn("Client.metadataFromBatonAgent")(function* (input) {
|
|
18095
18193
|
const agentMetadata = yield* decodeBatonAgentMetadata(input.agent.metadata);
|
|
18096
18194
|
const memorySubject = input.agent.memory === undefined ? undefined : yield* decodeBatonMemorySubject(input.agent.memory.subject);
|
|
@@ -18199,10 +18297,10 @@ import { Effect as Effect104, Option as Option29 } from "effect";
|
|
|
18199
18297
|
import { Effect as Effect103 } from "effect";
|
|
18200
18298
|
|
|
18201
18299
|
// src/client-error-mapping.ts
|
|
18202
|
-
import { Option as Option28, Schema as
|
|
18300
|
+
import { Option as Option28, Schema as Schema97 } from "effect";
|
|
18203
18301
|
var errorMessage2 = (error5) => error5 instanceof Error ? error5.message : String(error5);
|
|
18204
18302
|
var toClientError = (error5) => ClientError.make({ message: errorMessage2(error5) });
|
|
18205
|
-
var toStreamError = (error5) => Option28.match(
|
|
18303
|
+
var toStreamError = (error5) => Option28.match(Schema97.decodeUnknownOption(EventLogCursorNotFound)(error5), {
|
|
18206
18304
|
onNone: () => toClientError(error5),
|
|
18207
18305
|
onSome: (cursorError) => cursorError
|
|
18208
18306
|
});
|
|
@@ -18333,8 +18431,8 @@ var childStartInput = (input, accepted2, pin, definition, createdAt, parentWaitI
|
|
|
18333
18431
|
var childRunInternals = { childStartInput, internalSpawnChildRunInput };
|
|
18334
18432
|
|
|
18335
18433
|
// src/client-execution-payloads.ts
|
|
18336
|
-
import { Effect as Effect105, Schema as
|
|
18337
|
-
var encodeExecutionCursor = (cursor) =>
|
|
18434
|
+
import { Effect as Effect105, Schema as Schema98 } from "effect";
|
|
18435
|
+
var encodeExecutionCursor = (cursor) => Schema98.encodeEffect(exports_pagination_schema.ExecutionCursorCodec)({ id: cursor.id, at: cursor.updatedAt }).pipe(Effect105.mapError(toClientError));
|
|
18338
18436
|
var executionIdFromIdempotencyKey = (idempotencyKey) => exports_ids_schema.ExecutionId.make(`execution:${idempotencyKey}`);
|
|
18339
18437
|
var metadataWithIdempotencyKey = (metadata11, idempotencyKey) => ({
|
|
18340
18438
|
...metadata11,
|
|
@@ -18451,9 +18549,9 @@ var wakeRuntime = Effect107.fn("Client.waits.wakeRuntime")(function* (waits, eve
|
|
|
18451
18549
|
var runtimeWakeInternals = { wakeRuntime };
|
|
18452
18550
|
|
|
18453
18551
|
// src/client-tool-outcome.ts
|
|
18454
|
-
import { Effect as Effect108, Schema as
|
|
18552
|
+
import { Effect as Effect108, Schema as Schema99 } from "effect";
|
|
18455
18553
|
var toolWaitId = (executionId, callId) => Identifiers.waitId("tool", executionId, callId);
|
|
18456
|
-
var acceptedWaitOutcome = (wait) =>
|
|
18554
|
+
var acceptedWaitOutcome = (wait) => Schema99.decodeUnknownEffect(exports_tool_schema.ExternalOutcome)(wait.metadata.external_outcome).pipe(Effect108.mapError(toClientError));
|
|
18457
18555
|
var resolveToolOutcomeWait = Effect108.fn("Client.resolveToolOutcomeWait")(function* (waits, eventLog, call, outcome, completedAt) {
|
|
18458
18556
|
const waitId2 = call.waitId ?? toolWaitId(call.executionId, call.call.id);
|
|
18459
18557
|
const wait = yield* waits.get(waitId2).pipe(Effect108.mapError(toClientError));
|
|
@@ -18734,7 +18832,7 @@ var replyValueFrom = (content) => {
|
|
|
18734
18832
|
const text = content.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
18735
18833
|
if (text.length === 0)
|
|
18736
18834
|
return Option30.none();
|
|
18737
|
-
return
|
|
18835
|
+
return Schema100.decodeUnknownOption(Schema100.UnknownFromJsonString)(text);
|
|
18738
18836
|
};
|
|
18739
18837
|
var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
18740
18838
|
const makeExecutionClient = yield* client;
|
|
@@ -18814,7 +18912,7 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
18814
18912
|
status: "queued",
|
|
18815
18913
|
metadata: { operation: "envelope-send" },
|
|
18816
18914
|
createdAt
|
|
18817
|
-
}).pipe(Effect109.catchIf(
|
|
18915
|
+
}).pipe(Effect109.catchIf(Schema100.is(exports_execution_repository.DuplicateExecution), () => Effect109.void), Effect109.mapError(toClientError));
|
|
18818
18916
|
}
|
|
18819
18917
|
const maxSequence3 = yield* eventLog.maxSequence(executionId).pipe(Effect109.mapError(toClientError));
|
|
18820
18918
|
return yield* envelopes.send({
|
|
@@ -19060,7 +19158,7 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19060
19158
|
return records.map(toWaitView);
|
|
19061
19159
|
}),
|
|
19062
19160
|
listExecutions: Effect109.fn("Client.runtime.listExecutions")(function* (input) {
|
|
19063
|
-
const cursor = input.cursor === undefined ? undefined : yield*
|
|
19161
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema100.decodeEffect(exports_pagination_schema.ExecutionCursorCodec)(input.cursor).pipe(Effect109.map(({ id, at }) => ({ id, updatedAt: at })));
|
|
19064
19162
|
const result = yield* executionRepository.list({
|
|
19065
19163
|
...input.root_address_id === undefined ? {} : { rootAddressId: input.root_address_id },
|
|
19066
19164
|
...input.status === undefined ? {} : { status: input.status },
|
|
@@ -19110,13 +19208,13 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19110
19208
|
}).pipe(Effect109.mapError(toClientError));
|
|
19111
19209
|
}),
|
|
19112
19210
|
listSessions: Effect109.fn("Client.runtime.listSessions")(function* (input) {
|
|
19113
|
-
const cursor = input.cursor === undefined ? undefined : yield*
|
|
19211
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema100.decodeEffect(exports_pagination_schema.SessionCursorCodec)(input.cursor).pipe(Effect109.map(({ id, at }) => ({ id, updatedAt: at })));
|
|
19114
19212
|
const result = yield* sessionRepository.list({
|
|
19115
19213
|
...input.root_address_id === undefined ? {} : { rootAddressId: input.root_address_id },
|
|
19116
19214
|
...input.limit === undefined ? {} : { limit: input.limit },
|
|
19117
19215
|
...cursor === undefined ? {} : { cursor }
|
|
19118
19216
|
});
|
|
19119
|
-
const nextCursor = result.nextCursor === undefined ? undefined : yield*
|
|
19217
|
+
const nextCursor = result.nextCursor === undefined ? undefined : yield* Schema100.encodeEffect(exports_pagination_schema.SessionCursorCodec)({
|
|
19120
19218
|
id: result.nextCursor.id,
|
|
19121
19219
|
at: result.nextCursor.updatedAt
|
|
19122
19220
|
});
|
|
@@ -19129,7 +19227,7 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19129
19227
|
const session = yield* sessionRepository.get(input.session_id).pipe(Effect109.mapError(toClientError));
|
|
19130
19228
|
if (session === undefined)
|
|
19131
19229
|
return yield* ClientError.make({ message: `Session not found: ${input.session_id}` });
|
|
19132
|
-
const cursor = input.cursor === undefined ? undefined : yield*
|
|
19230
|
+
const cursor = input.cursor === undefined ? undefined : yield* Schema100.decodeEffect(exports_pagination_schema.ExecutionCursorCodec)(input.cursor).pipe(Effect109.map(({ id, at }) => ({ id, updatedAt: at })), Effect109.mapError(toClientError));
|
|
19133
19231
|
const result = yield* executionRepository.list({
|
|
19134
19232
|
sessionId: input.session_id,
|
|
19135
19233
|
...input.limit === undefined ? {} : { limit: input.limit },
|
|
@@ -19200,7 +19298,7 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19200
19298
|
if (instance === undefined || instance.status === "destroyed") {
|
|
19201
19299
|
return yield* ResidentNotFound.make({ kind: input.kind, key: input.key });
|
|
19202
19300
|
}
|
|
19203
|
-
const encoded = yield*
|
|
19301
|
+
const encoded = yield* Schema100.encodeUnknownEffect(input.command.input)(input.input).pipe(Effect109.mapError(toClientError));
|
|
19204
19302
|
const inputRef = inputSchemaRef(input.command.name);
|
|
19205
19303
|
const outputRef = outputSchemaRef(input.command.name);
|
|
19206
19304
|
if (Option30.isSome(schemaRegistry)) {
|
|
@@ -19247,7 +19345,7 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19247
19345
|
message: "reply carried no decodable content"
|
|
19248
19346
|
});
|
|
19249
19347
|
}
|
|
19250
|
-
return yield*
|
|
19348
|
+
return yield* Schema100.decodeUnknownEffect(input.command.output)(replyValue.value).pipe(Effect109.mapError((issue) => CommandReplyInvalid.make({
|
|
19251
19349
|
command: input.command.name,
|
|
19252
19350
|
wait_id: outcome.wait_id,
|
|
19253
19351
|
message: errorMessage2(issue)
|
|
@@ -19288,14 +19386,14 @@ var layerFromRuntime3 = Layer84.effect(Service, Effect109.gen(function* () {
|
|
|
19288
19386
|
...input.expected_version === undefined ? {} : { expectedVersion: input.expected_version },
|
|
19289
19387
|
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key },
|
|
19290
19388
|
updatedAt: input.updated_at
|
|
19291
|
-
}).pipe(Effect109.mapError((error5) =>
|
|
19389
|
+
}).pipe(Effect109.mapError((error5) => Schema100.is(StateVersionConflict3)(error5) ? StateVersionConflict.make(error5) : toClientError(error5)))),
|
|
19292
19390
|
deleteResidentState: Effect109.fn("Client.runtime.deleteResidentState")((input) => executionState.remove({
|
|
19293
19391
|
executionId: input.execution_id,
|
|
19294
19392
|
key: input.key,
|
|
19295
19393
|
...input.expected_version === undefined ? {} : { expectedVersion: input.expected_version },
|
|
19296
19394
|
...input.idempotency_key === undefined ? {} : { idempotencyKey: input.idempotency_key },
|
|
19297
19395
|
removedAt: input.removed_at
|
|
19298
|
-
}).pipe(Effect109.mapError((error5) =>
|
|
19396
|
+
}).pipe(Effect109.mapError((error5) => Schema100.is(StateVersionConflict3)(error5) ? StateVersionConflict.make(error5) : toClientError(error5)))),
|
|
19299
19397
|
listResidentState: Effect109.fn("Client.runtime.listResidentState")((input) => executionState.list({
|
|
19300
19398
|
executionId: input.execution_id,
|
|
19301
19399
|
...input.prefix === undefined ? {} : { prefix: input.prefix },
|
|
@@ -19554,77 +19652,77 @@ import { Effect as Effect111 } from "effect";
|
|
|
19554
19652
|
var recoverPersistedFanOut = (recover) => recover().pipe(Effect111.mapError((error5) => WorkflowRuntimeError.make({ message: error5._tag })), Effect111.asVoid);
|
|
19555
19653
|
|
|
19556
19654
|
// src/runtime.ts
|
|
19557
|
-
var Dialect2 =
|
|
19655
|
+
var Dialect2 = Schema101.Literals(["pg", "mysql", "sqlite"]);
|
|
19558
19656
|
|
|
19559
|
-
class NotificationFailure extends
|
|
19560
|
-
reason:
|
|
19657
|
+
class NotificationFailure extends Schema101.TaggedErrorClass()("NotificationFailure", {
|
|
19658
|
+
reason: Schema101.String
|
|
19561
19659
|
}) {
|
|
19562
19660
|
}
|
|
19563
19661
|
|
|
19564
|
-
class ClusterFailure extends
|
|
19565
|
-
reason:
|
|
19662
|
+
class ClusterFailure extends Schema101.TaggedErrorClass()("ClusterFailure", {
|
|
19663
|
+
reason: Schema101.String
|
|
19566
19664
|
}) {
|
|
19567
19665
|
}
|
|
19568
19666
|
|
|
19569
|
-
class SqlFailure extends
|
|
19570
|
-
category:
|
|
19571
|
-
operation:
|
|
19572
|
-
retryable:
|
|
19667
|
+
class SqlFailure extends Schema101.TaggedErrorClass()("SqlFailure", {
|
|
19668
|
+
category: Schema101.Literals(["connection", "statement", "unknown"]),
|
|
19669
|
+
operation: Schema101.Literals(["acquire", "migrate", "verify", "notify", "readiness"]),
|
|
19670
|
+
retryable: Schema101.Boolean
|
|
19573
19671
|
}) {
|
|
19574
19672
|
}
|
|
19575
|
-
var SqlDialect =
|
|
19673
|
+
var SqlDialect = Schema101.Literals(["sqlite", "pg", "mysql", "mssql", "clickhouse"]);
|
|
19576
19674
|
|
|
19577
|
-
class DatabaseDialectMismatch extends
|
|
19675
|
+
class DatabaseDialectMismatch extends Schema101.TaggedErrorClass()("DatabaseDialectMismatch", { expected: Dialect2, actual: SqlDialect }) {
|
|
19578
19676
|
}
|
|
19579
19677
|
|
|
19580
|
-
class DatabaseAlreadyOwned extends
|
|
19678
|
+
class DatabaseAlreadyOwned extends Schema101.TaggedErrorClass()("DatabaseAlreadyOwned", {
|
|
19581
19679
|
databaseIdentity: DatabaseIdentity
|
|
19582
19680
|
}) {
|
|
19583
19681
|
}
|
|
19584
19682
|
|
|
19585
|
-
class UnsupportedTopology extends
|
|
19586
|
-
reason:
|
|
19683
|
+
class UnsupportedTopology extends Schema101.TaggedErrorClass()("UnsupportedTopology", {
|
|
19684
|
+
reason: Schema101.String
|
|
19587
19685
|
}) {
|
|
19588
19686
|
}
|
|
19589
19687
|
|
|
19590
|
-
class MigratorError extends
|
|
19591
|
-
reason:
|
|
19688
|
+
class MigratorError extends Schema101.TaggedErrorClass()("MigratorError", {
|
|
19689
|
+
reason: Schema101.String
|
|
19592
19690
|
}) {
|
|
19593
19691
|
}
|
|
19594
19692
|
|
|
19595
|
-
class SchemaHeadMismatch extends
|
|
19596
|
-
expected:
|
|
19597
|
-
actual:
|
|
19693
|
+
class SchemaHeadMismatch extends Schema101.TaggedErrorClass()("SchemaHeadMismatch", {
|
|
19694
|
+
expected: Schema101.String,
|
|
19695
|
+
actual: Schema101.String
|
|
19598
19696
|
}) {
|
|
19599
19697
|
}
|
|
19600
19698
|
|
|
19601
|
-
class HostUnavailable extends
|
|
19602
|
-
host:
|
|
19603
|
-
reason:
|
|
19699
|
+
class HostUnavailable extends Schema101.TaggedErrorClass()("HostUnavailable", {
|
|
19700
|
+
host: Schema101.String,
|
|
19701
|
+
reason: Schema101.String
|
|
19604
19702
|
}) {
|
|
19605
19703
|
}
|
|
19606
|
-
var RuntimeTopologyCause =
|
|
19704
|
+
var RuntimeTopologyCause = Schema101.Union([
|
|
19607
19705
|
ClusterFailure,
|
|
19608
19706
|
DatabaseDialectMismatch,
|
|
19609
19707
|
DatabaseAlreadyOwned,
|
|
19610
19708
|
UnsupportedTopology
|
|
19611
19709
|
]);
|
|
19612
|
-
var RuntimeMigrationCause =
|
|
19710
|
+
var RuntimeMigrationCause = Schema101.Union([
|
|
19613
19711
|
SqlFailure,
|
|
19614
19712
|
MigratorError,
|
|
19615
19713
|
SchemaHeadMismatch
|
|
19616
19714
|
]);
|
|
19617
|
-
var RuntimeReadinessCause =
|
|
19715
|
+
var RuntimeReadinessCause = Schema101.Union([
|
|
19618
19716
|
SqlFailure,
|
|
19619
19717
|
NotificationFailure,
|
|
19620
19718
|
ClusterFailure,
|
|
19621
19719
|
HostUnavailable
|
|
19622
19720
|
]);
|
|
19623
19721
|
|
|
19624
|
-
class RuntimeTopologyError extends
|
|
19722
|
+
class RuntimeTopologyError extends Schema101.TaggedErrorClass()("RuntimeTopologyError", {
|
|
19625
19723
|
dialect: Dialect2,
|
|
19626
|
-
role:
|
|
19627
|
-
nextAction:
|
|
19724
|
+
role: Schema101.Literals(["embedded", "runner", "client"]),
|
|
19725
|
+
nextAction: Schema101.Literals([
|
|
19628
19726
|
"use-embedded",
|
|
19629
19727
|
"use-postgres-or-mysql",
|
|
19630
19728
|
"use-client-constructor",
|
|
@@ -19635,39 +19733,39 @@ class RuntimeTopologyError extends Schema100.TaggedErrorClass()("RuntimeTopology
|
|
|
19635
19733
|
}) {
|
|
19636
19734
|
}
|
|
19637
19735
|
|
|
19638
|
-
class RuntimeMigrationError extends
|
|
19736
|
+
class RuntimeMigrationError extends Schema101.TaggedErrorClass()("RuntimeMigrationError", {
|
|
19639
19737
|
dialect: Dialect2,
|
|
19640
|
-
phase:
|
|
19641
|
-
nextAction:
|
|
19738
|
+
phase: Schema101.Literals(["apply", "verify"]),
|
|
19739
|
+
nextAction: Schema101.Literals(["retry", "inspect-schema", "run-compatible-release"]),
|
|
19642
19740
|
cause: RuntimeMigrationCause
|
|
19643
19741
|
}) {
|
|
19644
19742
|
}
|
|
19645
19743
|
|
|
19646
|
-
class RuntimeReadinessError extends
|
|
19647
|
-
phase:
|
|
19744
|
+
class RuntimeReadinessError extends Schema101.TaggedErrorClass()("RuntimeReadinessError", {
|
|
19745
|
+
phase: Schema101.Literals(["database", "notification", "cluster", "hosts"]),
|
|
19648
19746
|
cause: RuntimeReadinessCause
|
|
19649
19747
|
}) {
|
|
19650
19748
|
}
|
|
19651
|
-
var RuntimeCapabilityStatus =
|
|
19652
|
-
|
|
19653
|
-
enabled:
|
|
19654
|
-
source:
|
|
19655
|
-
health:
|
|
19749
|
+
var RuntimeCapabilityStatus = Schema101.Union([
|
|
19750
|
+
Schema101.Struct({
|
|
19751
|
+
enabled: Schema101.Literal(false),
|
|
19752
|
+
source: Schema101.Literals(["local-host", "role-unavailable"]),
|
|
19753
|
+
health: Schema101.Literal("not-applicable")
|
|
19656
19754
|
}),
|
|
19657
|
-
|
|
19658
|
-
enabled:
|
|
19659
|
-
source:
|
|
19660
|
-
health:
|
|
19755
|
+
Schema101.Struct({
|
|
19756
|
+
enabled: Schema101.Literal(true),
|
|
19757
|
+
source: Schema101.Literal("local-host"),
|
|
19758
|
+
health: Schema101.Literals(["healthy", "unhealthy"])
|
|
19661
19759
|
})
|
|
19662
19760
|
]);
|
|
19663
|
-
var ReadinessStatus2 =
|
|
19664
|
-
ready:
|
|
19665
|
-
role:
|
|
19761
|
+
var ReadinessStatus2 = Schema101.Struct({
|
|
19762
|
+
ready: Schema101.Literal(true),
|
|
19763
|
+
role: Schema101.Literals(["embedded", "runner", "client"]),
|
|
19666
19764
|
dialect: Dialect2,
|
|
19667
19765
|
databaseIdentity: DatabaseIdentity,
|
|
19668
|
-
schemaHead:
|
|
19669
|
-
notification:
|
|
19670
|
-
capabilities:
|
|
19766
|
+
schemaHead: Schema101.String,
|
|
19767
|
+
notification: Schema101.Literals(["pg-listen-notify", "polling", "in-process"]),
|
|
19768
|
+
capabilities: Schema101.Struct({
|
|
19671
19769
|
fanOut: RuntimeCapabilityStatus,
|
|
19672
19770
|
workflowDefinition: RuntimeCapabilityStatus
|
|
19673
19771
|
})
|
|
@@ -19681,7 +19779,7 @@ var normalizeHost = (layer65, _role, _dialect) => layer65.pipe(Layer86.catchCaus
|
|
|
19681
19779
|
role: _role,
|
|
19682
19780
|
nextAction: _role === "embedded" ? "use-embedded" : "use-different-database",
|
|
19683
19781
|
cause: ClusterFailure.make({ reason: "cluster configuration is incompatible" })
|
|
19684
|
-
}) : error5), "host-layer", (error5) =>
|
|
19782
|
+
}) : error5), "host-layer", (error5) => Schema101.is(RuntimeConfigurationError)(error5) || Schema101.is(RuntimeTopologyError)(error5) || Schema101.is(RuntimeMigrationError)(error5))))));
|
|
19685
19783
|
var actualDialect = (sql) => sql.onDialectOrElse({
|
|
19686
19784
|
sqlite: () => "sqlite",
|
|
19687
19785
|
pg: () => "pg",
|