@relayfx/sdk 0.4.1 → 0.4.2
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/{index-vthtj624.js → index-4y9111jh.js} +1 -1
- package/dist/{index-p2d0xyat.js → index-y9ncz0zd.js} +7 -54
- package/dist/index.js +1 -1
- package/dist/mysql.js +2 -2
- package/dist/postgres.js +2 -2
- package/dist/sqlite.js +2 -2
- package/dist/types/runtime/agent/relay-tool-executor.d.ts +0 -1
- package/dist/types/runtime/tool/tool-runtime-contract.d.ts +0 -1
- package/package.json +1 -1
|
@@ -10887,12 +10887,6 @@ var makeService = (initialTools) => Effect55.gen(function* () {
|
|
|
10887
10887
|
yield* input.onRequested;
|
|
10888
10888
|
}),
|
|
10889
10889
|
run: Effect55.fn("ToolRuntime.run")(function* (input) {
|
|
10890
|
-
let settlementSequence;
|
|
10891
|
-
const beginSettlement = Effect55.suspend(() => {
|
|
10892
|
-
if (settlementSequence !== undefined)
|
|
10893
|
-
return Effect55.succeed(settlementSequence);
|
|
10894
|
-
return (input.beforeSettlement ?? Effect55.succeed(input.eventSequence)).pipe(Effect55.tap((sequence) => Effect55.sync(() => settlementSequence = sequence)));
|
|
10895
|
-
});
|
|
10896
10890
|
const stored = yield* Ref12.get(tools);
|
|
10897
10891
|
const registry = (input.extraTools ?? []).reduce(upsertTool, stored);
|
|
10898
10892
|
const registeredTool = Chunk.findFirst(registry, sameToolName(input.call.name)).pipe(Option12.getOrUndefined);
|
|
@@ -10907,7 +10901,6 @@ var makeService = (initialTools) => Effect55.gen(function* () {
|
|
|
10907
10901
|
yield* input.onRequested;
|
|
10908
10902
|
const existingResult = yield* repository.getResult(input.executionId, input.call.id).pipe(Effect55.mapError(mapRepositoryError2));
|
|
10909
10903
|
if (existingResult !== undefined) {
|
|
10910
|
-
yield* beginSettlement;
|
|
10911
10904
|
yield* repairResultEvent(eventLog, input, existingResult);
|
|
10912
10905
|
return existingResult.result;
|
|
10913
10906
|
}
|
|
@@ -10915,17 +10908,11 @@ var makeService = (initialTools) => Effect55.gen(function* () {
|
|
|
10915
10908
|
if (registeredTool.definition.needs_approval === true) {
|
|
10916
10909
|
const bypass = yield* hasPermissionApprovalBypass(waits, input);
|
|
10917
10910
|
if (!bypass) {
|
|
10918
|
-
const
|
|
10911
|
+
const decision = yield* resolveApproval(waits, eventLog, input);
|
|
10919
10912
|
effectiveInput = {
|
|
10920
10913
|
...input,
|
|
10921
|
-
eventSequence:
|
|
10922
|
-
createdAt: input.createdAt +
|
|
10923
|
-
};
|
|
10924
|
-
const decision = yield* resolveApproval(waits, eventLog, effectiveInput);
|
|
10925
|
-
effectiveInput = {
|
|
10926
|
-
...effectiveInput,
|
|
10927
|
-
eventSequence: effectiveInput.eventSequence + 1,
|
|
10928
|
-
createdAt: effectiveInput.createdAt + 1
|
|
10914
|
+
eventSequence: input.eventSequence + 1,
|
|
10915
|
+
createdAt: input.createdAt + 1
|
|
10929
10916
|
};
|
|
10930
10917
|
if (decision._tag === "denied") {
|
|
10931
10918
|
const deniedRecord = yield* persistReceived(repository, effectiveInput, {
|
|
@@ -10944,18 +10931,8 @@ var makeService = (initialTools) => Effect55.gen(function* () {
|
|
|
10944
10931
|
callId: input.call.id,
|
|
10945
10932
|
startedAt: effectiveInput.createdAt
|
|
10946
10933
|
}).pipe(Effect55.mapError(mapRepositoryError2), Effect55.flatMap(() => finalToolResult(registeredTool, effectiveInput, call.idempotencyKey)), Effect55.catchTag("ToolExecutionFailed", (error5) => Effect55.succeed(placementFailureResult(input, error5.message))));
|
|
10947
|
-
const
|
|
10948
|
-
|
|
10949
|
-
if (effectiveInput === input) {
|
|
10950
|
-
const sequence = yield* beginSettlement;
|
|
10951
|
-
effectiveInput = {
|
|
10952
|
-
...input,
|
|
10953
|
-
eventSequence: sequence,
|
|
10954
|
-
createdAt: input.createdAt + sequence - input.eventSequence
|
|
10955
|
-
};
|
|
10956
|
-
}
|
|
10957
|
-
const received = yield* recordReceived(eventLog, effectiveInput, record2);
|
|
10958
|
-
yield* recordToolCall(input.call.name, result.error === undefined ? "success" : "failure");
|
|
10934
|
+
const received = yield* Effect55.uninterruptibleMask((restore) => restore(executeHandler).pipe(Effect55.flatMap((rawResult) => input.transformResult === undefined || rawResult.error !== undefined ? Effect55.succeed(rawResult) : input.transformResult(rawResult)), Effect55.flatMap((result) => persistReceived(repository, effectiveInput, result)), Effect55.flatMap((record2) => recordReceived(eventLog, effectiveInput, record2))));
|
|
10935
|
+
yield* recordToolCall(input.call.name, received.error === undefined ? "success" : "failure");
|
|
10959
10936
|
return received;
|
|
10960
10937
|
}).pipe(Effect55.tapError((error5) => recordToolCall(input.call.name, error5._tag === "ToolExecutionWaitRequested" ? "wait" : error5._tag === "ToolPermissionDenied" ? "denied" : "failure")));
|
|
10961
10938
|
})
|
|
@@ -15616,15 +15593,6 @@ var boundResult = (config, result) => {
|
|
|
15616
15593
|
return exports_tool_output.bound({ _tag: "Success", result: result.output, encodedResult: result.output }, { toolCallId: result.call_id, maxBytes: config.toolOutputMaxBytes }).pipe(Effect90.map((bounded) => ({ ...result, output: jsonValue5(bounded.encodedResult) })));
|
|
15617
15594
|
};
|
|
15618
15595
|
var batchKey = (request) => `${request.turn}:${request.toolCallBatch.calls.map((call) => call.id).join(":")}`;
|
|
15619
|
-
var gateKey = (turn, toolCallIndex) => `${turn}:${toolCallIndex}`;
|
|
15620
|
-
var gateFor = (gates, key4) => {
|
|
15621
|
-
const existing = gates.get(key4);
|
|
15622
|
-
if (existing !== undefined)
|
|
15623
|
-
return existing;
|
|
15624
|
-
const created = Deferred3.makeUnsafe();
|
|
15625
|
-
gates.set(key4, created);
|
|
15626
|
-
return created;
|
|
15627
|
-
};
|
|
15628
15596
|
var callFrom = (call) => ({
|
|
15629
15597
|
id: exports_ids_schema.ToolCallId.make(call.id),
|
|
15630
15598
|
name: call.name,
|
|
@@ -15640,13 +15608,6 @@ var frameworkFailure = (call, error5) => {
|
|
|
15640
15608
|
};
|
|
15641
15609
|
var make9 = (config) => Effect90.sync(() => {
|
|
15642
15610
|
const prepared = new Map;
|
|
15643
|
-
const settled = new Map;
|
|
15644
|
-
const awaitPrevious = (gates, request) => {
|
|
15645
|
-
if (request.toolCallIndex === 0 || config.resumedToolCallId === request.call.id)
|
|
15646
|
-
return Effect90.void;
|
|
15647
|
-
return Deferred3.await(gateFor(gates, gateKey(request.turn, request.toolCallIndex - 1)));
|
|
15648
|
-
};
|
|
15649
|
-
const completeSettlement = (request) => Deferred3.succeed(gateFor(settled, gateKey(request.turn, request.toolCallIndex)), undefined).pipe(Effect90.asVoid);
|
|
15650
15611
|
return exports_tool_executor.ToolExecutor.of({
|
|
15651
15612
|
execute: (request) => {
|
|
15652
15613
|
const key4 = batchKey(request);
|
|
@@ -15674,12 +15635,6 @@ var make9 = (config) => Effect90.sync(() => {
|
|
|
15674
15635
|
}).pipe(Effect90.exit, Effect90.flatMap((exit) => Deferred3.done(preparation, exit)), Effect90.andThen(Deferred3.await(preparation)), Effect90.uninterruptible) : Deferred3.await(preparation);
|
|
15675
15636
|
return Effect90.gen(function* () {
|
|
15676
15637
|
yield* prepareBatch;
|
|
15677
|
-
let settlementSequence;
|
|
15678
|
-
const beginSettlement = Effect90.suspend(() => {
|
|
15679
|
-
if (settlementSequence !== undefined)
|
|
15680
|
-
return Effect90.succeed(settlementSequence);
|
|
15681
|
-
return awaitPrevious(settled, request).pipe(Effect90.andThen(config.allocator.current), Effect90.map((sequence) => sequence - 1), Effect90.tap((sequence) => Effect90.sync(() => settlementSequence = sequence)));
|
|
15682
|
-
});
|
|
15683
15638
|
const first = yield* config.allocator.current;
|
|
15684
15639
|
const call = callFrom(request.call);
|
|
15685
15640
|
const existingRequest = yield* hasRequestedEvent(config, call.id);
|
|
@@ -15691,13 +15646,12 @@ var make9 = (config) => Effect90.sync(() => {
|
|
|
15691
15646
|
eventSequence,
|
|
15692
15647
|
createdAt: config.startedAt + eventSequence - config.eventSequence,
|
|
15693
15648
|
...config.extraTools === undefined ? {} : { extraTools: config.extraTools },
|
|
15694
|
-
beforeSettlement: beginSettlement,
|
|
15695
15649
|
transformResult: (result) => boundResult(config, result)
|
|
15696
15650
|
}).pipe(Effect90.flatMap((result) => nextLoggedSequence2(config.eventLog, config.executionId, existingRequest ? first + 1 : first + 2).pipe(Effect90.flatMap(config.allocator.advanceTo), Effect90.as(result.error === undefined ? { _tag: "Success", result: result.output, encodedResult: result.output } : {
|
|
15697
15651
|
_tag: "DomainFailure",
|
|
15698
15652
|
failure: result.error,
|
|
15699
15653
|
encodedFailure: result.error
|
|
15700
|
-
}))), Effect90.catch((error5) =>
|
|
15654
|
+
}))), Effect90.catch((error5) => nextLoggedSequence2(config.eventLog, config.executionId, first).pipe(Effect90.flatMap(config.allocator.advanceTo), Effect90.flatMap(() => {
|
|
15701
15655
|
if (error5._tag === "ToolExecutionWaitRequested") {
|
|
15702
15656
|
return Effect90.succeed({ _tag: "Suspend", token: error5.wait_id });
|
|
15703
15657
|
}
|
|
@@ -15706,7 +15660,7 @@ var make9 = (config) => Effect90.sync(() => {
|
|
|
15706
15660
|
return Effect90.succeed({ _tag: "DomainFailure", failure: failure2, encodedFailure: failure2 });
|
|
15707
15661
|
}
|
|
15708
15662
|
return Effect90.fail(frameworkFailure(call, error5));
|
|
15709
|
-
})))
|
|
15663
|
+
}))));
|
|
15710
15664
|
});
|
|
15711
15665
|
}
|
|
15712
15666
|
});
|
|
@@ -16466,7 +16420,6 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16466
16420
|
startedAt: input.startedAt,
|
|
16467
16421
|
eventSequence: input.eventSequence,
|
|
16468
16422
|
...toolOutputMaxBytes === undefined ? {} : { toolOutputMaxBytes },
|
|
16469
|
-
...resumeToolCall === undefined ? {} : { resumedToolCallId: resumeToolCall.id },
|
|
16470
16423
|
...allCoreTools.length === 0 ? {} : { extraTools: allCoreTools }
|
|
16471
16424
|
});
|
|
16472
16425
|
const activeBlobStore = toolOutputMaxBytes === undefined || Option24.isNone(blobStore) ? undefined : blobStore.value;
|
package/dist/index.js
CHANGED
package/dist/mysql.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-4y9111jh.js";
|
|
6
6
|
import {
|
|
7
7
|
MigratorError,
|
|
8
8
|
RuntimeMigrationError,
|
|
9
9
|
SqlFailure
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-y9ncz0zd.js";
|
|
11
11
|
import"./index-x32kbvxv.js";
|
|
12
12
|
import"./index-3w6txjtg.js";
|
|
13
13
|
import"./index-nb39b5ae.js";
|
package/dist/postgres.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-4y9111jh.js";
|
|
6
6
|
import {
|
|
7
7
|
Dialect,
|
|
8
8
|
RuntimeMigrationError,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
fromDbTimestamp,
|
|
15
15
|
fromNullableDbTimestamp,
|
|
16
16
|
timestampParam
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-y9ncz0zd.js";
|
|
18
18
|
import"./index-x32kbvxv.js";
|
|
19
19
|
import {
|
|
20
20
|
exports_ids_schema
|
package/dist/sqlite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-4y9111jh.js";
|
|
6
6
|
import {
|
|
7
7
|
DatabaseAlreadyOwned,
|
|
8
8
|
RuntimeConfigurationError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
make,
|
|
13
13
|
makeDatabaseIdentity,
|
|
14
14
|
runtimeLayer
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-y9ncz0zd.js";
|
|
16
16
|
import"./index-x32kbvxv.js";
|
|
17
17
|
import"./index-3w6txjtg.js";
|
|
18
18
|
import"./index-nb39b5ae.js";
|
|
@@ -15,7 +15,6 @@ export interface Config {
|
|
|
15
15
|
readonly startedAt: number;
|
|
16
16
|
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
17
17
|
readonly toolOutputMaxBytes?: number;
|
|
18
|
-
readonly resumedToolCallId?: Ids.ToolCallId;
|
|
19
18
|
readonly extraTools?: ReadonlyArray<RegisteredTool>;
|
|
20
19
|
}
|
|
21
20
|
export declare const make: (config: Config) => Effect.Effect<ToolExecutor.Interface>;
|
|
@@ -106,7 +106,6 @@ export interface RunInput {
|
|
|
106
106
|
readonly createdAt: number;
|
|
107
107
|
readonly extraTools?: ReadonlyArray<RegisteredTool>;
|
|
108
108
|
readonly onRequested?: Effect.Effect<void>;
|
|
109
|
-
readonly beforeSettlement?: Effect.Effect<Execution.ExecutionEventSequence>;
|
|
110
109
|
readonly transformResult?: (result: Tool.Result) => Effect.Effect<Tool.Result, ToolRuntimeError>;
|
|
111
110
|
}
|
|
112
111
|
export type RunError = ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError;
|
package/package.json
CHANGED