@relayfx/sdk 0.0.49 → 0.0.50
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 +8 -4
- package/dist/index.js +8 -4
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -6576,6 +6576,7 @@ __export(exports_tool_call_repository, {
|
|
|
6576
6576
|
});
|
|
6577
6577
|
import { Context as Context21, Effect as Effect21, Layer as Layer21, Schema as Schema30 } from "effect";
|
|
6578
6578
|
import { SqlClient as SqlClient20 } from "effect/unstable/sql/SqlClient";
|
|
6579
|
+
import { isSqlError as isSqlError2 } from "effect/unstable/sql/SqlError";
|
|
6579
6580
|
class ToolCallRepositoryError extends Schema30.TaggedErrorClass()("ToolCallRepositoryError", {
|
|
6580
6581
|
message: Schema30.String
|
|
6581
6582
|
}) {
|
|
@@ -6920,9 +6921,12 @@ var layer20 = Layer21.effect(Service21, Effect21.gen(function* () {
|
|
|
6920
6921
|
});
|
|
6921
6922
|
const ensureCall = Effect21.fn("ToolCallRepository.ensureCall")(function* (input) {
|
|
6922
6923
|
const tenantId2 = yield* current();
|
|
6923
|
-
return yield*
|
|
6924
|
-
yield* insertCallIgnore(tenantId2, input, input.definition, input.placement)
|
|
6925
|
-
const
|
|
6924
|
+
return yield* sql3.withTransaction(Effect21.gen(function* () {
|
|
6925
|
+
yield* insertCallIgnore(tenantId2, input, input.definition, input.placement);
|
|
6926
|
+
const rows = yield* lockedCallRows(tenantId2, input.call.id);
|
|
6927
|
+
if (rows[0] === undefined)
|
|
6928
|
+
return yield* Effect21.fail(new ToolCallNotFound({ id: input.call.id }));
|
|
6929
|
+
const existing = yield* decodeCall(rows[0]);
|
|
6926
6930
|
if (existing.executionId !== input.executionId || !sameCallIdentity(existing.call, input.call) || exports_shared_schema.canonicalString(existing.definition) !== exports_shared_schema.canonicalString(input.definition) || exports_shared_schema.canonicalString(existing.placement) !== exports_shared_schema.canonicalString(input.placement)) {
|
|
6927
6931
|
return yield* Effect21.fail(new ToolCallConflict({ id: input.call.id }));
|
|
6928
6932
|
}
|
|
@@ -6930,7 +6934,7 @@ var layer20 = Layer21.effect(Service21, Effect21.gen(function* () {
|
|
|
6930
6934
|
return yield* Effect21.fail(new ToolCallRepositoryError({ message: "Tool call insert returned no row" }));
|
|
6931
6935
|
}
|
|
6932
6936
|
return existing;
|
|
6933
|
-
}));
|
|
6937
|
+
})).pipe(Effect21.retry({ times: 3, while: (error) => isSqlError2(error) && error.isRetryable }), Effect21.catchTag("SqlError", (error) => Effect21.fail(toRepositoryError17(error))));
|
|
6934
6938
|
});
|
|
6935
6939
|
const prepareExternalWait = Effect21.fn("ToolCallRepository.prepareExternalWait")(function* (input) {
|
|
6936
6940
|
const tenantId2 = yield* current();
|
package/dist/index.js
CHANGED
|
@@ -6637,6 +6637,7 @@ __export(exports_tool_call_repository, {
|
|
|
6637
6637
|
});
|
|
6638
6638
|
import { Context as Context21, Effect as Effect21, Layer as Layer21, Schema as Schema30 } from "effect";
|
|
6639
6639
|
import { SqlClient as SqlClient20 } from "effect/unstable/sql/SqlClient";
|
|
6640
|
+
import { isSqlError as isSqlError2 } from "effect/unstable/sql/SqlError";
|
|
6640
6641
|
class ToolCallRepositoryError extends Schema30.TaggedErrorClass()("ToolCallRepositoryError", {
|
|
6641
6642
|
message: Schema30.String
|
|
6642
6643
|
}) {
|
|
@@ -6981,9 +6982,12 @@ var layer20 = Layer21.effect(Service21, Effect21.gen(function* () {
|
|
|
6981
6982
|
});
|
|
6982
6983
|
const ensureCall = Effect21.fn("ToolCallRepository.ensureCall")(function* (input) {
|
|
6983
6984
|
const tenantId2 = yield* current();
|
|
6984
|
-
return yield*
|
|
6985
|
-
yield* insertCallIgnore(tenantId2, input, input.definition, input.placement)
|
|
6986
|
-
const
|
|
6985
|
+
return yield* sql3.withTransaction(Effect21.gen(function* () {
|
|
6986
|
+
yield* insertCallIgnore(tenantId2, input, input.definition, input.placement);
|
|
6987
|
+
const rows = yield* lockedCallRows(tenantId2, input.call.id);
|
|
6988
|
+
if (rows[0] === undefined)
|
|
6989
|
+
return yield* Effect21.fail(new ToolCallNotFound({ id: input.call.id }));
|
|
6990
|
+
const existing = yield* decodeCall(rows[0]);
|
|
6987
6991
|
if (existing.executionId !== input.executionId || !sameCallIdentity(existing.call, input.call) || exports_shared_schema.canonicalString(existing.definition) !== exports_shared_schema.canonicalString(input.definition) || exports_shared_schema.canonicalString(existing.placement) !== exports_shared_schema.canonicalString(input.placement)) {
|
|
6988
6992
|
return yield* Effect21.fail(new ToolCallConflict({ id: input.call.id }));
|
|
6989
6993
|
}
|
|
@@ -6991,7 +6995,7 @@ var layer20 = Layer21.effect(Service21, Effect21.gen(function* () {
|
|
|
6991
6995
|
return yield* Effect21.fail(new ToolCallRepositoryError({ message: "Tool call insert returned no row" }));
|
|
6992
6996
|
}
|
|
6993
6997
|
return existing;
|
|
6994
|
-
}));
|
|
6998
|
+
})).pipe(Effect21.retry({ times: 3, while: (error) => isSqlError2(error) && error.isRetryable }), Effect21.catchTag("SqlError", (error) => Effect21.fail(toRepositoryError17(error))));
|
|
6995
6999
|
});
|
|
6996
7000
|
const prepareExternalWait = Effect21.fn("ToolCallRepository.prepareExternalWait")(function* (input) {
|
|
6997
7001
|
const tenantId2 = yield* current();
|