@relayfx/sdk 0.7.5 → 0.7.8
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/{index-etc2cnk2.js → index-58425087.js} +93 -79
- package/dist/{index-6rpm95kc.js → index-8dmwyvx7.js} +1 -1
- package/dist/{index-m8bs31hg.js → index-hwfe65v0.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/mysql.js +3 -3
- package/dist/postgres.js +3 -3
- package/dist/sqlite.js +3 -3
- package/package.json +4 -4
package/dist/ai.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export
|
|
4
4
|
} from "./index-nb39b5ae.js";
|
|
5
5
|
|
|
6
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
6
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/turn-policy.js
|
|
7
7
|
var exports_turn_policy = {};
|
|
8
8
|
__export(exports_turn_policy, {
|
|
9
9
|
untilToolCall: () => untilToolCall,
|
|
@@ -72,7 +72,7 @@ var both = dual(2, (first, second) => ({
|
|
|
72
72
|
}));
|
|
73
73
|
var defaultPolicy = forever;
|
|
74
74
|
|
|
75
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
75
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-event.js
|
|
76
76
|
var exports_agent_event = {};
|
|
77
77
|
__export(exports_agent_event, {
|
|
78
78
|
addUsage: () => addUsage,
|
|
@@ -90,7 +90,7 @@ __export(exports_agent_event, {
|
|
|
90
90
|
import { Function, Schema as Schema4 } from "effect";
|
|
91
91
|
import { Prompt as Prompt3, Response as Response3, Tool } from "effect/unstable/ai";
|
|
92
92
|
|
|
93
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
93
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-telemetry.js
|
|
94
94
|
var exports_model_telemetry = {};
|
|
95
95
|
__export(exports_model_telemetry, {
|
|
96
96
|
layerNoop: () => layerNoop,
|
|
@@ -348,8 +348,9 @@ var CurrentSummaryCall = Context.Reference("@batonfx/core/ModelTelemetry/Current
|
|
|
348
348
|
} });
|
|
349
349
|
var generateId = Effect2.flatMap(Effect2.serviceOption(IdGenerator.IdGenerator), (service) => Option.getOrElse(service, () => IdGenerator.defaultIdGenerator).generateId());
|
|
350
350
|
|
|
351
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
352
|
-
import { Schema as Schema3 } from "effect";
|
|
351
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/session-sync.js
|
|
352
|
+
import { Equal, Schema as Schema3 } from "effect";
|
|
353
|
+
import { dual as dual2 } from "effect/Function";
|
|
353
354
|
import { Prompt as Prompt2 } from "effect/unstable/ai";
|
|
354
355
|
var Divergence = Schema3.Struct({
|
|
355
356
|
index: Schema3.Finite,
|
|
@@ -399,19 +400,31 @@ var coalesceAdjacentText = (message) => {
|
|
|
399
400
|
const coalesced = coalesceParts(message.content);
|
|
400
401
|
return coalesced.length === message.content.length ? message : { ...message, content: coalesced };
|
|
401
402
|
};
|
|
403
|
+
var canonicalValue = (value) => {
|
|
404
|
+
if (Object.prototype.toString.call(value) === "[object URL]")
|
|
405
|
+
return String(value);
|
|
406
|
+
if (value instanceof Uint8Array)
|
|
407
|
+
return Array.from(value);
|
|
408
|
+
if (Array.isArray(value))
|
|
409
|
+
return value.map(canonicalValue);
|
|
410
|
+
if (value !== null && typeof value === "object") {
|
|
411
|
+
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, item]) => [key, canonicalValue(item)]));
|
|
412
|
+
}
|
|
413
|
+
return value;
|
|
414
|
+
};
|
|
415
|
+
var equivalentMessages = dual2(2, (left, right) => Equal.equals(canonicalValue(coalesceAdjacentText(left)), canonicalValue(coalesceAdjacentText(right))));
|
|
402
416
|
var messageDigest = (message) => digest(JSON.stringify(message));
|
|
403
417
|
var diagnose = (input) => {
|
|
404
|
-
const equals = Schema3.toEquivalence(Prompt2.Message);
|
|
405
418
|
let alignmentCount = 0;
|
|
406
419
|
if (input.projection.length === 0)
|
|
407
420
|
alignmentCount = 1;
|
|
408
421
|
else
|
|
409
422
|
for (let start = 0;start <= input.transcript.length - input.projection.length; start += 1) {
|
|
410
|
-
if (input.transcript.slice(0, start).every((message) => message.role === "system") && input.projection.every((message, index) =>
|
|
423
|
+
if (input.transcript.slice(0, start).every((message) => message.role === "system") && input.projection.every((message, index) => equivalentMessages(message, input.transcript[start + index])))
|
|
411
424
|
alignmentCount += 1;
|
|
412
425
|
}
|
|
413
426
|
let commonPrefixLength = 0;
|
|
414
|
-
while (commonPrefixLength < input.projection.length && commonPrefixLength < input.transcript.length &&
|
|
427
|
+
while (commonPrefixLength < input.projection.length && commonPrefixLength < input.transcript.length && equivalentMessages(input.projection[commonPrefixLength], input.transcript[commonPrefixLength]))
|
|
415
428
|
commonPrefixLength += 1;
|
|
416
429
|
const durable = input.projection[commonPrefixLength];
|
|
417
430
|
const authoritative = input.transcript[commonPrefixLength];
|
|
@@ -439,7 +452,7 @@ var diagnose = (input) => {
|
|
|
439
452
|
};
|
|
440
453
|
};
|
|
441
454
|
|
|
442
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
455
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-event.js
|
|
443
456
|
var addUsageField = (left, right) => left === undefined && right === undefined ? undefined : (left ?? 0) + (right ?? 0);
|
|
444
457
|
var addUsage = Function.dual(2, (left, right) => Response3.Usage.make({
|
|
445
458
|
inputTokens: {
|
|
@@ -542,7 +555,7 @@ class ResumeMismatch extends Schema4.TaggedErrorClass()("@batonfx/core/ResumeMis
|
|
|
542
555
|
}) {
|
|
543
556
|
}
|
|
544
557
|
|
|
545
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
558
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/memory.js
|
|
546
559
|
var exports_memory = {};
|
|
547
560
|
__export(exports_memory, {
|
|
548
561
|
replaceRecalledMessage: () => replaceRecalledMessage,
|
|
@@ -558,7 +571,7 @@ __export(exports_memory, {
|
|
|
558
571
|
Memory: () => Memory
|
|
559
572
|
});
|
|
560
573
|
import { Context as Context2, Effect as Effect3, Layer as Layer3, Option as Option2, Schema as Schema5 } from "effect";
|
|
561
|
-
import { dual as
|
|
574
|
+
import { dual as dual3 } from "effect/Function";
|
|
562
575
|
import { Prompt as Prompt4 } from "effect/unstable/ai";
|
|
563
576
|
var provenanceOption = "@batonfx/core/memory";
|
|
564
577
|
var recallLineage = new WeakMap;
|
|
@@ -575,7 +588,7 @@ var messageFromRecall = (content) => {
|
|
|
575
588
|
recallLineage.set(message, message);
|
|
576
589
|
return message;
|
|
577
590
|
};
|
|
578
|
-
var replaceRecalledMessage =
|
|
591
|
+
var replaceRecalledMessage = dual3(2, (message, content) => {
|
|
579
592
|
const options = isMessageFromRecall(message) ? { ...message.options, [provenanceOption]: { origin: "memoryRecall" } } : { ...message.options };
|
|
580
593
|
const replacement = Prompt4.makeMessage("user", { content, options });
|
|
581
594
|
if (isMessageFromRecall(message))
|
|
@@ -600,7 +613,7 @@ var noop = {
|
|
|
600
613
|
remember: () => Effect3.void,
|
|
601
614
|
forget: () => Effect3.void
|
|
602
615
|
};
|
|
603
|
-
var merge =
|
|
616
|
+
var merge = dual3(2, (first, second) => ({
|
|
604
617
|
recall: (input) => Effect3.all([first.recall(input), second.recall(input)]).pipe(Effect3.map(([firstItems, secondItems]) => [...firstItems, ...secondItems])),
|
|
605
618
|
remember: (input) => Effect3.all([first.remember(input), second.remember(input)], { discard: true }),
|
|
606
619
|
forget: (input) => Effect3.all([first.forget(input), second.forget(input)], { discard: true })
|
|
@@ -608,7 +621,7 @@ var merge = dual2(2, (first, second) => ({
|
|
|
608
621
|
var layerNoop2 = Layer3.succeed(Memory, Memory.of(noop));
|
|
609
622
|
var layerTest = (implementation) => Layer3.succeed(Memory, Memory.of(implementation));
|
|
610
623
|
|
|
611
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
624
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-registry.js
|
|
612
625
|
var exports_model_registry = {};
|
|
613
626
|
__export(exports_model_registry, {
|
|
614
627
|
stream: () => stream,
|
|
@@ -627,7 +640,7 @@ __export(exports_model_registry, {
|
|
|
627
640
|
import { Context as Context3, Effect as Effect4, Fiber, Function as Function2, HashMap, Layer as Layer4, Option as Option3, Ref, Schema as Schema6, Scope, Semaphore, Stream } from "effect";
|
|
628
641
|
import { LanguageModel as LanguageModel3, Model } from "effect/unstable/ai";
|
|
629
642
|
|
|
630
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
643
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/context-overflow.js
|
|
631
644
|
var exports_context_overflow = {};
|
|
632
645
|
__export(exports_context_overflow, {
|
|
633
646
|
classify: () => classify
|
|
@@ -666,7 +679,7 @@ var evidence = (value, depth) => {
|
|
|
666
679
|
};
|
|
667
680
|
var classify = (error) => overflowEvidence.test(evidence(error, 0)) ? "context-overflow" : "other";
|
|
668
681
|
|
|
669
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
682
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-registry.js
|
|
670
683
|
var FailureClassifierTypeId = Symbol.for("@batonfx/core/model-registry/FailureClassifier");
|
|
671
684
|
var classifyFailure = Function2.dual(2, (model, error) => {
|
|
672
685
|
const classified = model[FailureClassifierTypeId]?.(error);
|
|
@@ -784,7 +797,7 @@ var operate = Function2.dual(2, (selection, effect) => Effect4.gen(function* ()
|
|
|
784
797
|
}));
|
|
785
798
|
var stream = Function2.dual(2, (selection, operation) => Stream.unwrap(ModelRegistry.pipe(Effect4.map((service) => service.stream(selection, operation)))));
|
|
786
799
|
|
|
787
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
800
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-context.js
|
|
788
801
|
var exports_tool_context = {};
|
|
789
802
|
__export(exports_tool_context, {
|
|
790
803
|
layerTest: () => layerTest3,
|
|
@@ -802,7 +815,7 @@ var layerDefault = Layer5.sync(ToolContext, () => ToolContext.of({
|
|
|
802
815
|
}));
|
|
803
816
|
var layerTest3 = (implementation) => Layer5.succeed(ToolContext, ToolContext.of(implementation));
|
|
804
817
|
|
|
805
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
818
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-executor.js
|
|
806
819
|
var exports_tool_executor = {};
|
|
807
820
|
__export(exports_tool_executor, {
|
|
808
821
|
sandbox: () => sandbox,
|
|
@@ -823,11 +836,11 @@ __export(exports_tool_executor, {
|
|
|
823
836
|
import { Context as Context5, Effect as Effect8, Layer as Layer6, Option as Option4, Schema as Schema8, Stream as Stream2 } from "effect";
|
|
824
837
|
import { AiError as AiError4, Response as Response4, Tool as Tool4, Toolkit } from "effect/unstable/ai";
|
|
825
838
|
|
|
826
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
839
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-placement.js
|
|
827
840
|
import { Effect as Effect7, Schedule } from "effect";
|
|
828
841
|
import { Tool as Tool3 } from "effect/unstable/ai";
|
|
829
842
|
|
|
830
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
843
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-result-codec.js
|
|
831
844
|
import { Effect as Effect6, Schema as Schema7 } from "effect";
|
|
832
845
|
import { AiError as AiError3, Tool as Tool2 } from "effect/unstable/ai";
|
|
833
846
|
var resultMessage = (result) => {
|
|
@@ -892,7 +905,7 @@ var toolResultCodec = {
|
|
|
892
905
|
schemaMessage
|
|
893
906
|
};
|
|
894
907
|
|
|
895
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
908
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-placement.js
|
|
896
909
|
var placementOutcomeFromResponse = (placement, tool, response) => {
|
|
897
910
|
if (typeof response !== "object" || response === null || !("_tag" in response)) {
|
|
898
911
|
return Effect7.fail(toolResultCodec.frameworkFailure("placement", tool.name, "Placement returned an invalid response"));
|
|
@@ -910,7 +923,7 @@ var placementOutcomeFromResponse = (placement, tool, response) => {
|
|
|
910
923
|
};
|
|
911
924
|
var placementOutcome = { fromResponse: placementOutcomeFromResponse };
|
|
912
925
|
|
|
913
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
926
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-executor.js
|
|
914
927
|
var FrameworkStage = Schema8.Literals([
|
|
915
928
|
"decode-input",
|
|
916
929
|
"handler",
|
|
@@ -1051,7 +1064,7 @@ function layerRouter(routes) {
|
|
|
1051
1064
|
}
|
|
1052
1065
|
var layerTest4 = (implementation) => Layer6.succeed(ToolExecutor, ToolExecutor.of(implementation));
|
|
1053
1066
|
|
|
1054
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1067
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/approvals.js
|
|
1055
1068
|
var exports_approvals = {};
|
|
1056
1069
|
__export(exports_approvals, {
|
|
1057
1070
|
layerTest: () => layerTest5,
|
|
@@ -1067,7 +1080,7 @@ var layerAutoApprove = Layer7.succeed(Approvals, Approvals.of({ resolve: () => E
|
|
|
1067
1080
|
var layerDenyAll = Layer7.succeed(Approvals, Approvals.of({ resolve: () => Effect9.succeed({ _tag: "Denied" }) }));
|
|
1068
1081
|
var layerTest5 = (implementation) => Layer7.succeed(Approvals, Approvals.of(implementation));
|
|
1069
1082
|
|
|
1070
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1083
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/session.js
|
|
1071
1084
|
var exports_session = {};
|
|
1072
1085
|
__export(exports_session, {
|
|
1073
1086
|
layerTest: () => layerTest6,
|
|
@@ -1080,7 +1093,7 @@ __export(exports_session, {
|
|
|
1080
1093
|
SessionConflict: () => SessionConflict
|
|
1081
1094
|
});
|
|
1082
1095
|
import { Context as Context7, Effect as Effect10, HashMap as HashMap2, Layer as Layer8, Option as Option5, Ref as Ref2, Schema as Schema9 } from "effect";
|
|
1083
|
-
import { dual as
|
|
1096
|
+
import { dual as dual4 } from "effect/Function";
|
|
1084
1097
|
import { Prompt as Prompt5 } from "effect/unstable/ai";
|
|
1085
1098
|
class SessionStoreError extends Schema9.TaggedErrorClass()("@batonfx/core/SessionStoreError", {
|
|
1086
1099
|
message: Schema9.String
|
|
@@ -1191,7 +1204,7 @@ var appendState = (state, input, options) => {
|
|
|
1191
1204
|
var promptEquivalence = Schema9.toEquivalence(Prompt5.Prompt);
|
|
1192
1205
|
var telemetryEquivalence = Schema9.toEquivalence(Schema9.Array(Event));
|
|
1193
1206
|
var commitEquivalence = Schema9.toEquivalence(CompactionCommit);
|
|
1194
|
-
var checkpointMatches =
|
|
1207
|
+
var checkpointMatches = dual4(2, (entry, prepared) => entry.id === prepared.id && entry.parentId === prepared.parentId && entry.summary === prepared.summary && promptEquivalence(entry.projectedHistory, prepared.projectedHistory) && telemetryEquivalence(entry.telemetry, prepared.telemetry) && (entry.compactionCommit === undefined ? prepared.compactionCommit === undefined : prepared.compactionCommit !== undefined && commitEquivalence(entry.compactionCommit, prepared.compactionCommit)));
|
|
1195
1208
|
var appendCheckpointState = (state, prepared) => {
|
|
1196
1209
|
if (prepared.compactionCommit !== undefined && prepared.compactionCommit.checkpointId !== prepared.id) {
|
|
1197
1210
|
return [
|
|
@@ -1359,7 +1372,7 @@ var layerMemory2 = Layer8.effect(SessionStore, Ref2.make(initialState).pipe(Effe
|
|
|
1359
1372
|
}))));
|
|
1360
1373
|
var layerTest6 = (implementation) => Layer8.succeed(SessionStore, SessionStore.of(implementation));
|
|
1361
1374
|
|
|
1362
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1375
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-output.js
|
|
1363
1376
|
var exports_tool_output = {};
|
|
1364
1377
|
__export(exports_tool_output, {
|
|
1365
1378
|
layerTest: () => layerTest7,
|
|
@@ -1435,7 +1448,7 @@ var bound = Function3.dual(2, (result, options) => Effect11.gen(function* () {
|
|
|
1435
1448
|
return boundedFromOriginal(encoded, bytes, options.maxBytes, [path.value]);
|
|
1436
1449
|
}));
|
|
1437
1450
|
|
|
1438
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1451
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/compaction.js
|
|
1439
1452
|
var exports_compaction = {};
|
|
1440
1453
|
__export(exports_compaction, {
|
|
1441
1454
|
withLifecycle: () => withLifecycle,
|
|
@@ -1458,7 +1471,7 @@ __export(exports_compaction, {
|
|
|
1458
1471
|
import { Context as Context10, Effect as Effect14, Function as Function5, Layer as Layer11, Option as Option8, Schema as Schema11 } from "effect";
|
|
1459
1472
|
import { LanguageModel as LanguageModel6, Prompt as Prompt6, Tokenizer, Toolkit as Toolkit2 } from "effect/unstable/ai";
|
|
1460
1473
|
|
|
1461
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1474
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/compaction-telemetry.js
|
|
1462
1475
|
import { Clock, Effect as Effect12, Exit, Function as Function4, Option as Option7 } from "effect";
|
|
1463
1476
|
import { LanguageModel as LanguageModel4 } from "effect/unstable/ai";
|
|
1464
1477
|
var resultKind = (result) => Option7.isNone(result) ? "unchanged" : result.value._tag === "Summarize" ? "summarize" : "microcompact";
|
|
@@ -1494,7 +1507,7 @@ var summaryLanguageModel = Effect12.gen(function* () {
|
|
|
1494
1507
|
return instrumentation === undefined ? model : instrumentation.wrap(model);
|
|
1495
1508
|
});
|
|
1496
1509
|
|
|
1497
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1510
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/summary-model.js
|
|
1498
1511
|
import { Context as Context9, Deferred, Effect as Effect13, Fiber as Fiber2, Layer as Layer10, Scope as Scope2 } from "effect";
|
|
1499
1512
|
import { LanguageModel as LanguageModel5 } from "effect/unstable/ai";
|
|
1500
1513
|
var makeSummaryModelProvider = (model) => {
|
|
@@ -1519,7 +1532,7 @@ var makeSummaryModelProvider = (model) => {
|
|
|
1519
1532
|
});
|
|
1520
1533
|
};
|
|
1521
1534
|
|
|
1522
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1535
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/compaction.js
|
|
1523
1536
|
var DEFAULT_RESERVE_TOKENS = 16384;
|
|
1524
1537
|
var DEFAULT_KEEP_RECENT_TOKENS = 20000;
|
|
1525
1538
|
var SUMMARY_TEMPLATE = `Summarize the conversation so another agent can continue seamlessly.
|
|
@@ -1777,7 +1790,7 @@ var truncate = (maxTokens) => ({
|
|
|
1777
1790
|
});
|
|
1778
1791
|
var layerTest8 = (implementation) => Layer11.succeed(Compaction, Compaction.of(implementation));
|
|
1779
1792
|
|
|
1780
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1793
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/instructions.js
|
|
1781
1794
|
var exports_instructions = {};
|
|
1782
1795
|
__export(exports_instructions, {
|
|
1783
1796
|
staticSource: () => staticSource,
|
|
@@ -1787,14 +1800,14 @@ __export(exports_instructions, {
|
|
|
1787
1800
|
Instructions: () => Instructions
|
|
1788
1801
|
});
|
|
1789
1802
|
import { Context as Context11, Effect as Effect15, Layer as Layer12, Option as Option9 } from "effect";
|
|
1790
|
-
import { dual as
|
|
1803
|
+
import { dual as dual5 } from "effect/Function";
|
|
1791
1804
|
class Instructions extends Context11.Service()("@batonfx/core/Instructions") {
|
|
1792
1805
|
}
|
|
1793
|
-
var staticSource =
|
|
1806
|
+
var staticSource = dual5(2, (id, text) => ({
|
|
1794
1807
|
id,
|
|
1795
1808
|
render: () => Effect15.succeed(text.length === 0 ? Option9.none() : Option9.some(text))
|
|
1796
1809
|
}));
|
|
1797
|
-
var openEpoch =
|
|
1810
|
+
var openEpoch = dual5(2, (instructions, context) => Effect15.gen(function* () {
|
|
1798
1811
|
const baseline = [];
|
|
1799
1812
|
for (const source of instructions.sources) {
|
|
1800
1813
|
const rendered = yield* source.render(context);
|
|
@@ -1808,7 +1821,7 @@ var openEpoch = dual4(2, (instructions, context) => Effect15.gen(function* () {
|
|
|
1808
1821
|
var layer3 = (sources) => Layer12.succeed(Instructions, Instructions.of({ sources: [...sources] }));
|
|
1809
1822
|
var layerTest9 = (implementation) => Layer12.succeed(Instructions, Instructions.of(implementation));
|
|
1810
1823
|
|
|
1811
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1824
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-middleware.js
|
|
1812
1825
|
var exports_model_middleware = {};
|
|
1813
1826
|
__export(exports_model_middleware, {
|
|
1814
1827
|
layerIdentity: () => layerIdentity,
|
|
@@ -1822,7 +1835,7 @@ class ModelMiddleware extends Context12.Service()("@batonfx/core/ModelMiddleware
|
|
|
1822
1835
|
var layerIdentity = Layer13.succeed(ModelMiddleware, []);
|
|
1823
1836
|
var layer4 = (middleware) => Layer13.succeed(ModelMiddleware, middleware);
|
|
1824
1837
|
|
|
1825
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1838
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-resilience.js
|
|
1826
1839
|
var exports_model_resilience = {};
|
|
1827
1840
|
__export(exports_model_resilience, {
|
|
1828
1841
|
none: () => none,
|
|
@@ -1875,7 +1888,7 @@ var apply = Function6.dual(2, (model, resilience) => ({
|
|
|
1875
1888
|
streamText: (options) => retryStream(() => model.streamText(options), (error) => Response6.makePart("error", { error }), resilience)
|
|
1876
1889
|
}));
|
|
1877
1890
|
|
|
1878
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
1891
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/permissions.js
|
|
1879
1892
|
var exports_permissions = {};
|
|
1880
1893
|
__export(exports_permissions, {
|
|
1881
1894
|
matches: () => matches,
|
|
@@ -1892,7 +1905,7 @@ __export(exports_permissions, {
|
|
|
1892
1905
|
PermissionError: () => PermissionError
|
|
1893
1906
|
});
|
|
1894
1907
|
import { Context as Context14, Effect as Effect18, Layer as Layer15, Option as Option11, Ref as Ref4, Schema as Schema13 } from "effect";
|
|
1895
|
-
import { dual as
|
|
1908
|
+
import { dual as dual6 } from "effect/Function";
|
|
1896
1909
|
|
|
1897
1910
|
class PermissionError extends Schema13.TaggedErrorClass()("@batonfx/core/PermissionError", {
|
|
1898
1911
|
message: Schema13.String
|
|
@@ -1965,7 +1978,7 @@ var matchesProjection = (pattern, tool, projection, failClosed) => {
|
|
|
1965
1978
|
const paramsPattern = glob(pattern.slice(separator + 1));
|
|
1966
1979
|
return projection.candidates.some((candidate) => paramsPattern.test(candidate));
|
|
1967
1980
|
};
|
|
1968
|
-
var matches =
|
|
1981
|
+
var matches = dual6(3, (pattern, tool, params) => matchesProjection(pattern, tool, project(params), false));
|
|
1969
1982
|
var matchingRule = (ruleset, tool, params) => {
|
|
1970
1983
|
const projection = project(params);
|
|
1971
1984
|
let matched;
|
|
@@ -1975,8 +1988,8 @@ var matchingRule = (ruleset, tool, params) => {
|
|
|
1975
1988
|
}
|
|
1976
1989
|
return matched;
|
|
1977
1990
|
};
|
|
1978
|
-
var matchRule =
|
|
1979
|
-
var evaluate =
|
|
1991
|
+
var matchRule = dual6(3, (ruleset, tool, params) => Option11.fromNullishOr(matchingRule(ruleset, tool, params)));
|
|
1992
|
+
var evaluate = dual6(3, (ruleset, tool, params) => matchingRule(ruleset, tool, params)?.level ?? ruleset.fallback ?? "ask");
|
|
1980
1993
|
var tokenFor = (request) => `permission:${request.call.id}`;
|
|
1981
1994
|
var decisionFor = (ruleset, request) => {
|
|
1982
1995
|
const rule = matchingRule(ruleset, request.call.name, request.call.params);
|
|
@@ -1990,7 +2003,7 @@ var decisionFor = (ruleset, request) => {
|
|
|
1990
2003
|
return { _tag: "Ask", token: tokenFor(request) };
|
|
1991
2004
|
}
|
|
1992
2005
|
};
|
|
1993
|
-
var evaluateWithRules =
|
|
2006
|
+
var evaluateWithRules = dual6(3, (base, store, request) => Effect18.gen(function* () {
|
|
1994
2007
|
const baseDecision = yield* base.evaluate(request);
|
|
1995
2008
|
if (baseDecision._tag === "Deny")
|
|
1996
2009
|
return baseDecision;
|
|
@@ -2020,7 +2033,7 @@ var layerRuleStoreMemory = (initialRules = []) => Layer15.effect(RuleStore, Ref4
|
|
|
2020
2033
|
var layerRuleStoreTest = (implementation) => Layer15.succeed(RuleStore, RuleStore.of(implementation));
|
|
2021
2034
|
var layerTest11 = (implementation) => Layer15.succeed(Permissions, Permissions.of(implementation));
|
|
2022
2035
|
|
|
2023
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2036
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/skill-source.js
|
|
2024
2037
|
var exports_skill_source = {};
|
|
2025
2038
|
__export(exports_skill_source, {
|
|
2026
2039
|
selectListings: () => selectListings,
|
|
@@ -2110,7 +2123,7 @@ var selectListings = Function7.dual(3, (skills, budgetTokens, recentlyUsed) => {
|
|
|
2110
2123
|
return selected;
|
|
2111
2124
|
});
|
|
2112
2125
|
|
|
2113
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2126
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/steering.js
|
|
2114
2127
|
var exports_steering = {};
|
|
2115
2128
|
__export(exports_steering, {
|
|
2116
2129
|
layerTest: () => layerTest13,
|
|
@@ -2168,7 +2181,7 @@ var layer7 = (options = {}) => Layer17.effect(Steering, Effect20.gen(function* (
|
|
|
2168
2181
|
}));
|
|
2169
2182
|
var layerTest13 = (implementation) => Layer17.succeed(Steering, Steering.of(implementation));
|
|
2170
2183
|
|
|
2171
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2184
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent.js
|
|
2172
2185
|
var exports_agent = {};
|
|
2173
2186
|
__export(exports_agent, {
|
|
2174
2187
|
stream: () => stream2,
|
|
@@ -2179,14 +2192,14 @@ __export(exports_agent, {
|
|
|
2179
2192
|
Runtime: () => Runtime
|
|
2180
2193
|
});
|
|
2181
2194
|
import { Effect as Effect27, Option as Option17, Schema as Schema21, Stream as Stream6, Types } from "effect";
|
|
2182
|
-
import { dual as
|
|
2195
|
+
import { dual as dual8 } from "effect/Function";
|
|
2183
2196
|
import { AiError as AiError8, Chat as Chat3, LanguageModel as LanguageModel10, Prompt as Prompt12, Tool as Tool10, Toolkit as Toolkit5 } from "effect/unstable/ai";
|
|
2184
2197
|
|
|
2185
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2186
|
-
import { Cause as Cause6, Channel, Effect as Effect26, Equal as
|
|
2198
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-run.js
|
|
2199
|
+
import { Cause as Cause6, Channel, Effect as Effect26, Equal as Equal3, Exit as Exit4, Fiber as Fiber3, HashMap as HashMap6, Option as Option16, Queue as Queue2, Ref as Ref5, Schema as Schema20, Semaphore as Semaphore3, Stream as Stream5 } from "effect";
|
|
2187
2200
|
import { AiError as AiError7, Chat as Chat2, LanguageModel as LanguageModel9, Prompt as Prompt11, Response as Response11, Telemetry, Tokenizer as Tokenizer2, Tool as Tool9, Toolkit as Toolkit4 } from "effect/unstable/ai";
|
|
2188
2201
|
|
|
2189
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2202
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/model-instrumentation.js
|
|
2190
2203
|
import { Cause as Cause4, Clock as Clock2, Duration, Effect as Effect21, Exit as Exit3, Function as Function8, Option as Option12, Schedule as Schedule3, Stream as Stream4 } from "effect";
|
|
2191
2204
|
import { AiError as AiError6, LanguageModel as LanguageModel8, Model as Model2, Response as Response7 } from "effect/unstable/ai";
|
|
2192
2205
|
var makeIdentityCell = () => ({ current: undefined });
|
|
@@ -2441,7 +2454,7 @@ var instrument = Function8.dual(2, (model, options) => {
|
|
|
2441
2454
|
};
|
|
2442
2455
|
});
|
|
2443
2456
|
|
|
2444
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2457
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-authorization.js
|
|
2445
2458
|
import { Cause as Cause5, Context as Context17, Effect as Effect22, Layer as Layer18, Schema as Schema16 } from "effect";
|
|
2446
2459
|
import"effect/unstable/ai";
|
|
2447
2460
|
class PermissionDenied extends Schema16.TaggedErrorClass()("@batonfx/core/PermissionDenied", {
|
|
@@ -2515,9 +2528,9 @@ var make4 = (options) => ({
|
|
|
2515
2528
|
})
|
|
2516
2529
|
});
|
|
2517
2530
|
|
|
2518
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2531
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/tool-registry.js
|
|
2519
2532
|
import { Array as Array2, Effect as Effect23, HashMap as HashMap4, Option as Option13 } from "effect";
|
|
2520
|
-
import { dual as
|
|
2533
|
+
import { dual as dual7 } from "effect/Function";
|
|
2521
2534
|
import { Tool as Tool7, Toolkit as Toolkit3 } from "effect/unstable/ai";
|
|
2522
2535
|
var makeToolkit = (entries) => {
|
|
2523
2536
|
const toolkit = Toolkit3.make(...entries.map((candidate) => candidate.tool));
|
|
@@ -2551,8 +2564,8 @@ var assemble = (candidates) => {
|
|
|
2551
2564
|
toolkit: makeToolkit(entries)
|
|
2552
2565
|
});
|
|
2553
2566
|
};
|
|
2554
|
-
var get =
|
|
2555
|
-
var select =
|
|
2567
|
+
var get = dual7(2, (registry, name) => Option13.getOrUndefined(HashMap4.get(registry.byName, name)));
|
|
2568
|
+
var select = dual7(2, (registry, names) => {
|
|
2556
2569
|
const entries = registry.entries.filter((entry) => names.includes(entry.tool.name));
|
|
2557
2570
|
return {
|
|
2558
2571
|
entries,
|
|
@@ -2561,7 +2574,7 @@ var select = dual6(2, (registry, names) => {
|
|
|
2561
2574
|
};
|
|
2562
2575
|
});
|
|
2563
2576
|
|
|
2564
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2577
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-persistence-lock.js
|
|
2565
2578
|
import { Context as Context18, Effect as Effect24, Layer as Layer19, RcMap, Scope as Scope3, Semaphore as Semaphore2 } from "effect";
|
|
2566
2579
|
import { Chat } from "effect/unstable/ai";
|
|
2567
2580
|
|
|
@@ -2579,11 +2592,11 @@ var makeRuntime = Effect24.gen(function* () {
|
|
|
2579
2592
|
});
|
|
2580
2593
|
var layerRuntime = Layer19.effect(Runtime, makeRuntime);
|
|
2581
2594
|
|
|
2582
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2595
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-message.js
|
|
2583
2596
|
import { Effect as Effect25, Option as Option14, Schema as Schema18 } from "effect";
|
|
2584
2597
|
import { Prompt as Prompt9, Response as Response8 } from "effect/unstable/ai";
|
|
2585
2598
|
|
|
2586
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2599
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-skill-tool.js
|
|
2587
2600
|
import { Schema as Schema17 } from "effect";
|
|
2588
2601
|
import { Tool as Tool8 } from "effect/unstable/ai";
|
|
2589
2602
|
var skillListingBudgetTokens = 2048;
|
|
@@ -2606,7 +2619,7 @@ var activateSkillTool = Tool8.make(activateSkillToolName, {
|
|
|
2606
2619
|
failureMode: "return"
|
|
2607
2620
|
});
|
|
2608
2621
|
|
|
2609
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2622
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-message.js
|
|
2610
2623
|
var withSystem = (instructions, prompt) => Prompt9.fromMessages([Prompt9.makeMessage("system", { content: instructions }), ...prompt.content]);
|
|
2611
2624
|
var skillListingsInstructions = (listings) => `Available skills:
|
|
2612
2625
|
${listings}
|
|
@@ -2654,8 +2667,8 @@ var applyPartChain = (chain, part, context) => Effect25.gen(function* () {
|
|
|
2654
2667
|
return current;
|
|
2655
2668
|
});
|
|
2656
2669
|
|
|
2657
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2658
|
-
import { Equal, Option as Option15, Schema as Schema19 } from "effect";
|
|
2670
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-suspension.js
|
|
2671
|
+
import { Equal as Equal2, Option as Option15, Schema as Schema19 } from "effect";
|
|
2659
2672
|
import { Prompt as Prompt10, Response as Response9 } from "effect/unstable/ai";
|
|
2660
2673
|
var suspensionCheckpointOption = "@batonfx/core/suspension";
|
|
2661
2674
|
var suspensionMetadata = Schema19.Struct({
|
|
@@ -2734,7 +2747,7 @@ var suspensionCheckpoint = (messages) => {
|
|
|
2734
2747
|
const metadata = Schema19.decodeUnknownOption(suspensionMetadata)(unresolved.call.options[suspensionCheckpointOption]);
|
|
2735
2748
|
if (Option15.isNone(metadata))
|
|
2736
2749
|
return;
|
|
2737
|
-
if (!
|
|
2750
|
+
if (!Equal2.equals(metadata.value.tool_call_batch_ids, unresolved.toolCallBatch.map((call) => call.id)))
|
|
2738
2751
|
return;
|
|
2739
2752
|
return {
|
|
2740
2753
|
call: unresolved.call,
|
|
@@ -2749,7 +2762,7 @@ var suspensionCheckpoint = (messages) => {
|
|
|
2749
2762
|
})
|
|
2750
2763
|
};
|
|
2751
2764
|
};
|
|
2752
|
-
var sameSuspension = (left, right) => left.token === right.token && left.reason === right.reason && left.tool_call_index === right.tool_call_index &&
|
|
2765
|
+
var sameSuspension = (left, right) => left.token === right.token && left.reason === right.reason && left.tool_call_index === right.tool_call_index && Equal2.equals(left.tool_call_batch, right.tool_call_batch) && left.tool_call_id === right.tool_call_id && left.tool_name === right.tool_name && Equal2.equals(left.tool_params, right.tool_params) && Equal2.equals(left.active_tools, right.active_tools) && Equal2.equals(left.activated_skills, right.activated_skills);
|
|
2753
2766
|
var suspended = (call, toolCallBatch, toolCallIndex, token, reason) => AgentSuspended.make({
|
|
2754
2767
|
token,
|
|
2755
2768
|
reason,
|
|
@@ -2760,7 +2773,7 @@ var suspended = (call, toolCallBatch, toolCallIndex, token, reason) => AgentSusp
|
|
|
2760
2773
|
tool_call_batch: toolCallBatch.calls
|
|
2761
2774
|
});
|
|
2762
2775
|
|
|
2763
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2776
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-tool-result.js
|
|
2764
2777
|
import { HashMap as HashMap5 } from "effect";
|
|
2765
2778
|
import { Response as Response10 } from "effect/unstable/ai";
|
|
2766
2779
|
var successResult = (call, outcome) => Response10.toolResultPart({
|
|
@@ -2782,7 +2795,7 @@ var domainFailureResult = (call, outcome) => Response10.toolResultPart({
|
|
|
2782
2795
|
preliminary: false
|
|
2783
2796
|
});
|
|
2784
2797
|
|
|
2785
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
2798
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-run.js
|
|
2786
2799
|
var classifyOtherFailure = (error) => classify(error);
|
|
2787
2800
|
var defaultProgressOverflowPolicy = { _tag: "Backpressure", capacity: 64 };
|
|
2788
2801
|
var progressCapacitySchema = Schema20.Finite.pipe(Schema20.check(Schema20.isInt(), Schema20.isGreaterThan(0)));
|
|
@@ -3035,7 +3048,7 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3035
3048
|
const checkpointSuspended = (turn, pending, suspension) => Effect26.gen(function* () {
|
|
3036
3049
|
const withPending = yield* appendPending(turn, pending);
|
|
3037
3050
|
const unresolved = unresolvedToolCall(withPending.content, suspension.tool_call_id);
|
|
3038
|
-
if (unresolved === undefined || unresolved.call.id !== suspension.tool_call_id || unresolved.call.name !== suspension.tool_name || !
|
|
3051
|
+
if (unresolved === undefined || unresolved.call.id !== suspension.tool_call_id || unresolved.call.name !== suspension.tool_name || !Equal3.equals(unresolved.call.params, suspension.tool_params)) {
|
|
3039
3052
|
return yield* AgentError.make({
|
|
3040
3053
|
message: "Suspension does not match the unresolved checkpoint call",
|
|
3041
3054
|
turn
|
|
@@ -3156,15 +3169,13 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3156
3169
|
transcript: Option16.isSome(activeSession) ? buildMemoryContext(path) : projectTranscript(transcript),
|
|
3157
3170
|
terminal
|
|
3158
3171
|
}).pipe(Effect26.mapError((error) => memoryError(turn, error)));
|
|
3159
|
-
const messageEquivalence = Schema20.toEquivalence(Prompt11.Message);
|
|
3160
3172
|
const promptEquivalence2 = Schema20.toEquivalence(Prompt11.Prompt);
|
|
3161
|
-
const canonicalEquivalence = (left, right) => messageEquivalence(coalesceAdjacentText(left), coalesceAdjacentText(right));
|
|
3162
3173
|
const sessionTranscriptCursor = (projection, transcript) => {
|
|
3163
3174
|
if (projection.length === 0)
|
|
3164
3175
|
return Option16.some(0);
|
|
3165
3176
|
const matches2 = [];
|
|
3166
3177
|
for (let start = 0;start <= transcript.length - projection.length; start += 1) {
|
|
3167
|
-
if (transcript.slice(0, start).every((message) => message.role === "system") && projection.every((message, index) =>
|
|
3178
|
+
if (transcript.slice(0, start).every((message) => message.role === "system") && projection.every((message, index) => equivalentMessages(message, transcript[start + index]))) {
|
|
3168
3179
|
matches2.push(start + projection.length);
|
|
3169
3180
|
}
|
|
3170
3181
|
}
|
|
@@ -3321,7 +3332,7 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3321
3332
|
})).pipe(Effect26.mapError((error) => compactionError(turn, error)));
|
|
3322
3333
|
if (Option16.isNone(compacted))
|
|
3323
3334
|
return { prompt, changed: false };
|
|
3324
|
-
const changed = !
|
|
3335
|
+
const changed = !Equal3.equals(originalHistory.content, compacted.value.history.content) || !Equal3.equals(originalPrompt.content, compacted.value.prompt.content);
|
|
3325
3336
|
if (!changed)
|
|
3326
3337
|
return { prompt, changed: false };
|
|
3327
3338
|
const allowed = [...historyRecalled, ...promptRecalled];
|
|
@@ -3628,6 +3639,7 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3628
3639
|
})))));
|
|
3629
3640
|
const attempt = (activePrompt, retryOverflow, compactOverflow = false, overflowCause) => {
|
|
3630
3641
|
let emitted = false;
|
|
3642
|
+
let completed = false;
|
|
3631
3643
|
let classifyFailure2 = classifyOtherFailure;
|
|
3632
3644
|
const transformedParts = new Array;
|
|
3633
3645
|
let preparedState;
|
|
@@ -3683,8 +3695,10 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3683
3695
|
accept: validateToolCallId(toolCallIds, part).pipe(Effect26.andThen(Effect26.sync(() => {
|
|
3684
3696
|
transformedParts.push(part);
|
|
3685
3697
|
})))
|
|
3686
|
-
})))
|
|
3687
|
-
|
|
3698
|
+
})), Stream5.concat(Stream5.fromEffect(Effect26.sync(() => {
|
|
3699
|
+
completed = true;
|
|
3700
|
+
})).pipe(Stream5.drain)));
|
|
3701
|
+
})).pipe(Stream5.toChannel), (_, exit) => preparedState === undefined || !completed || Exit4.isFailure(exit) && retryableOverflow(exit.cause, emitted) ? Effect26.void : Ref5.set(chat.history, Prompt11.concat(Prompt11.concat(preparedState.history, preparedState.preparedPrompt), Prompt11.fromResponseParts(transformedParts))).pipe(Effect26.andThen(persisted === undefined ? Effect26.void : persisted.save), Effect26.orDie, Effect26.asVoid))).pipe(Stream5.catchCause((cause) => {
|
|
3688
3702
|
if (Cause6.hasInterrupts(cause) || Cause6.hasDies(cause))
|
|
3689
3703
|
return Stream5.failCause(cause);
|
|
3690
3704
|
if (retryableOverflow(cause, emitted)) {
|
|
@@ -3922,7 +3936,7 @@ var streamInternal = (agent, options, structured) => Stream5.unwrap(Effect26.gen
|
|
|
3922
3936
|
}));
|
|
3923
3937
|
})).pipe(Stream5.withSpan("Baton.Agent.run", { attributes: { "baton.agent.name": agent.name } }));
|
|
3924
3938
|
|
|
3925
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
3939
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent.js
|
|
3926
3940
|
var AgentTypeId = Symbol.for("@batonfx/core/Agent");
|
|
3927
3941
|
function make5(options) {
|
|
3928
3942
|
const declaredTools = "tools" in options && Array.isArray(options.tools) ? options.tools : undefined;
|
|
@@ -3960,7 +3974,7 @@ function make5(options) {
|
|
|
3960
3974
|
};
|
|
3961
3975
|
}
|
|
3962
3976
|
var defaultObjectPrompt = "Return the final structured output for the task above.";
|
|
3963
|
-
var stream2 =
|
|
3977
|
+
var stream2 = dual8(2, (agent, options) => streamInternal(agent, options, options.output === undefined ? undefined : {
|
|
3964
3978
|
schema: options.output.schema,
|
|
3965
3979
|
objectName: options.output.name ?? "output",
|
|
3966
3980
|
objectPrompt: options.output.prompt ?? defaultObjectPrompt
|
|
@@ -3981,13 +3995,13 @@ var generateObjectResult = (agent, options, structured) => Stream6.runFold(strea
|
|
|
3981
3995
|
})
|
|
3982
3996
|
})
|
|
3983
3997
|
})));
|
|
3984
|
-
var generate =
|
|
3998
|
+
var generate = dual8(2, (agent, options) => options.output === undefined ? generateText(agent, options) : generateObjectResult(agent, options, {
|
|
3985
3999
|
schema: options.output.schema,
|
|
3986
4000
|
objectName: options.output.name ?? "output",
|
|
3987
4001
|
objectPrompt: options.output.prompt ?? defaultObjectPrompt
|
|
3988
4002
|
}));
|
|
3989
4003
|
|
|
3990
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
4004
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/agent-tool.js
|
|
3991
4005
|
var exports_agent_tool = {};
|
|
3992
4006
|
__export(exports_agent_tool, {
|
|
3993
4007
|
asTool: () => asTool
|
|
@@ -4058,7 +4072,7 @@ var asTool = Function9.dual((args) => args.length !== 1 || ("name" in args[0]),
|
|
|
4058
4072
|
return lazyHandled(toolkit, name, handler);
|
|
4059
4073
|
});
|
|
4060
4074
|
|
|
4061
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
4075
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/guardrail.js
|
|
4062
4076
|
var exports_guardrail = {};
|
|
4063
4077
|
__export(exports_guardrail, {
|
|
4064
4078
|
validateInput: () => validateInput,
|
|
@@ -4139,7 +4153,7 @@ var filterOutput = (keep) => ({
|
|
|
4139
4153
|
transformPart: (part, context) => Effect29.succeed(part.type === "tool-call" || keep(part, context) ? Option18.some(part) : Option18.none())
|
|
4140
4154
|
});
|
|
4141
4155
|
|
|
4142
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
4156
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/handoff.js
|
|
4143
4157
|
var exports_handoff = {};
|
|
4144
4158
|
__export(exports_handoff, {
|
|
4145
4159
|
transferTool: () => transferTool,
|
|
@@ -4219,7 +4233,7 @@ var supervisor = (options) => {
|
|
|
4219
4233
|
};
|
|
4220
4234
|
};
|
|
4221
4235
|
|
|
4222
|
-
// ../../node_modules/.bun/@batonfx+core@0.11.
|
|
4236
|
+
// ../../node_modules/.bun/@batonfx+core@0.11.6+74997d64abff4185/node_modules/@batonfx/core/dist/index.js
|
|
4223
4237
|
import { AiError as AiError10, Chat as Chat4, EmbeddingModel, IdGenerator as IdGenerator2, LanguageModel as LanguageModel12, Model as Model3, Prompt as Prompt16, Response as Response13, ResponseIdTracker, Telemetry as Telemetry2, Tokenizer as Tokenizer3, Tool as Tool13, Toolkit as Toolkit8 } from "effect/unstable/ai";
|
|
4224
4238
|
|
|
4225
4239
|
export { exports_model_telemetry, exports_turn_policy, exports_agent_event, exports_memory, exports_context_overflow, exports_model_registry, exports_tool_context, exports_tool_executor, exports_approvals, exports_session, exports_tool_output, exports_compaction, exports_instructions, exports_model_middleware, exports_model_resilience, exports_permissions, exports_skill_source, exports_steering, exports_agent, exports_agent_tool, exports_guardrail, exports_handoff, AiError10 as AiError, Chat4 as Chat, EmbeddingModel, IdGenerator2 as IdGenerator, Model3 as Model, Prompt16 as Prompt, Response13 as Response, ResponseIdTracker, Telemetry2 as Telemetry, Tokenizer3 as Tokenizer, Tool13 as Tool, Toolkit8 as Toolkit };
|
package/dist/index.js
CHANGED
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
exports_tool_runtime,
|
|
15
15
|
exports_workflow_definition_host,
|
|
16
16
|
makeDatabaseIdentity
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-8dmwyvx7.js";
|
|
18
18
|
import {
|
|
19
19
|
exports_context_overflow,
|
|
20
20
|
exports_model_registry
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-58425087.js";
|
|
22
22
|
import {
|
|
23
23
|
ClientError,
|
|
24
24
|
EventLogCursorNotFound,
|
|
@@ -179,11 +179,11 @@ import { OpenAiLanguageModel as OpenAiLanguageModel3 } from "@effect/ai-openai";
|
|
|
179
179
|
import { OpenAiLanguageModel as OpenAiCompatibleLanguageModel } from "@effect/ai-openai-compat";
|
|
180
180
|
import { OpenRouterLanguageModel as OpenRouterLanguageModel2 } from "@effect/ai-openrouter";
|
|
181
181
|
|
|
182
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
182
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/anthropic.js
|
|
183
183
|
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
|
|
184
184
|
import { Config, Layer as Layer3, Redacted } from "effect";
|
|
185
185
|
|
|
186
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
186
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/image-source.js
|
|
187
187
|
import { Effect as Effect3, Encoding, Layer as Layer2, Result, Stream } from "effect";
|
|
188
188
|
import { AiError, LanguageModel, Prompt } from "effect/unstable/ai";
|
|
189
189
|
var imageMediaTypes = new Set(["image/gif", "image/jpeg", "image/png", "image/webp"]);
|
|
@@ -252,7 +252,7 @@ var conformImageSourceModel = (model) => {
|
|
|
252
252
|
};
|
|
253
253
|
var layerImageSources = (layer2) => Layer2.effect(LanguageModel.LanguageModel, Effect3.map(LanguageModel.LanguageModel, conformImageSourceModel)).pipe(Layer2.provide(layer2));
|
|
254
254
|
|
|
255
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
255
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/anthropic.js
|
|
256
256
|
var classifyFailure = exports_context_overflow.classify;
|
|
257
257
|
var layer2 = (input) => exports_model_registry.layer([
|
|
258
258
|
exports_model_registry.registration({
|
|
@@ -269,13 +269,13 @@ var layer2 = (input) => exports_model_registry.layer([
|
|
|
269
269
|
]).pipe(Layer3.provide(AnthropicClient.layerConfig({ ...input.clientConfig, apiKey: input.apiKey })));
|
|
270
270
|
var layerConfig = AnthropicClient.layerConfig;
|
|
271
271
|
|
|
272
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
272
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/deterministic.js
|
|
273
273
|
import { OpenAiClient as OpenAiClient2 } from "@effect/ai-openai";
|
|
274
274
|
import { Config as Config3, Effect as Effect5, Layer as Layer5, Option as Option2, Stream as Stream3 } from "effect";
|
|
275
275
|
import { LanguageModel as LanguageModel2, Response as Response2 } from "effect/unstable/ai";
|
|
276
276
|
import { HttpClient as HttpClient2 } from "effect/unstable/http";
|
|
277
277
|
|
|
278
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
278
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/openai.js
|
|
279
279
|
import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai";
|
|
280
280
|
import { Config as Config2, Effect as Effect4, Function, Layer as Layer4, Option, Redacted as Redacted2, Schema, Stream as Stream2 } from "effect";
|
|
281
281
|
import { FetchHttpClient, Headers, HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
|
@@ -445,7 +445,7 @@ var registrationAccount = (input) => exports_model_registry.registration({
|
|
|
445
445
|
});
|
|
446
446
|
var layerAccount = (input) => exports_model_registry.layer([registrationAccount(input)]);
|
|
447
447
|
|
|
448
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
448
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/deterministic.js
|
|
449
449
|
var deterministicModelLayer = Layer5.effect(LanguageModel2.LanguageModel, LanguageModel2.make({
|
|
450
450
|
generateText: () => Effect5.succeed([{ type: "text", text: "deterministic response" }]),
|
|
451
451
|
streamText: () => Stream3.make(Response2.makePart("text-delta", { id: "text", delta: "deterministic response" }))
|
|
@@ -482,7 +482,7 @@ var layerOpenAi = (options) => Layer5.unwrap(Effect5.gen(function* () {
|
|
|
482
482
|
]);
|
|
483
483
|
}));
|
|
484
484
|
|
|
485
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
485
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/openai-compat.js
|
|
486
486
|
import { OpenAiClient as OpenAiClient3, OpenAiLanguageModel as OpenAiLanguageModel2 } from "@effect/ai-openai-compat";
|
|
487
487
|
import { Config as Config4, Layer as Layer6, Redacted as Redacted3 } from "effect";
|
|
488
488
|
var layer5 = (input) => exports_model_registry.layer([
|
|
@@ -504,7 +504,7 @@ var layer5 = (input) => exports_model_registry.layer([
|
|
|
504
504
|
})));
|
|
505
505
|
var layerConfig3 = OpenAiClient3.layerConfig;
|
|
506
506
|
|
|
507
|
-
// ../../node_modules/.bun/@batonfx+providers@0.11.
|
|
507
|
+
// ../../node_modules/.bun/@batonfx+providers@0.11.6+74997d64abff4185/node_modules/@batonfx/providers/dist/openrouter.js
|
|
508
508
|
import { OpenRouterClient, OpenRouterLanguageModel } from "@effect/ai-openrouter";
|
|
509
509
|
import { Config as Config5, Layer as Layer7, Redacted as Redacted4 } from "effect";
|
|
510
510
|
var classifyFailure3 = exports_context_overflow.classify;
|
package/dist/mysql.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-hwfe65v0.js";
|
|
6
6
|
import {
|
|
7
7
|
MigratorError,
|
|
8
8
|
RuntimeMigrationError,
|
|
9
9
|
SqlFailure
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
10
|
+
} from "./index-8dmwyvx7.js";
|
|
11
|
+
import"./index-58425087.js";
|
|
12
12
|
import"./index-nb078xsy.js";
|
|
13
13
|
import"./index-nb39b5ae.js";
|
|
14
14
|
|
package/dist/postgres.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-hwfe65v0.js";
|
|
6
6
|
import {
|
|
7
7
|
Dialect,
|
|
8
8
|
RuntimeMigrationError,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
fromDbTimestamp,
|
|
15
15
|
fromNullableDbTimestamp,
|
|
16
16
|
timestampParam
|
|
17
|
-
} from "./index-
|
|
18
|
-
import"./index-
|
|
17
|
+
} from "./index-8dmwyvx7.js";
|
|
18
|
+
import"./index-58425087.js";
|
|
19
19
|
import {
|
|
20
20
|
exports_ids_schema
|
|
21
21
|
} from "./index-nb078xsy.js";
|
package/dist/sqlite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-hwfe65v0.js";
|
|
6
6
|
import {
|
|
7
7
|
DatabaseAlreadyOwned,
|
|
8
8
|
RuntimeConfigurationError,
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
make,
|
|
13
13
|
makeDatabaseIdentity,
|
|
14
14
|
runtimeLayer
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
15
|
+
} from "./index-8dmwyvx7.js";
|
|
16
|
+
import"./index-58425087.js";
|
|
17
17
|
import"./index-nb078xsy.js";
|
|
18
18
|
import"./index-nb39b5ae.js";
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@relayfx/sdk",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.8",
|
|
5
5
|
"description": "Effect-native durable execution SDK for addressable agents and tools",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"typecheck": "bun tsc --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@batonfx/core": "0.11.
|
|
61
|
-
"@batonfx/providers": "0.11.
|
|
60
|
+
"@batonfx/core": "0.11.6",
|
|
61
|
+
"@batonfx/providers": "0.11.6",
|
|
62
62
|
"@effect/ai-anthropic": "4.0.0-beta.98",
|
|
63
63
|
"@effect/ai-openai": "4.0.0-beta.98",
|
|
64
64
|
"@effect/ai-openai-compat": "4.0.0-beta.98",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@effect/vitest": "4.0.0-beta.98",
|
|
76
76
|
"@relayfx/ai": "0.0.0",
|
|
77
77
|
"@relayfx/runtime": "0.0.0",
|
|
78
|
-
"@relayfx/schema": "0.7.
|
|
78
|
+
"@relayfx/schema": "0.7.8",
|
|
79
79
|
"@relayfx/store-sql": "0.0.0",
|
|
80
80
|
"@types/bun": "1.3.14",
|
|
81
81
|
"typescript": "7.0.2",
|