@relayfx/sdk 0.0.43 → 0.0.45
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 +270 -38
- package/dist/index.js +270 -38
- package/dist/types/store-sql/session/session-repository.d.ts +77 -1
- package/package.json +3 -3
package/dist/ai.js
CHANGED
|
@@ -5005,6 +5005,38 @@ var payloadFromInput = (input) => {
|
|
|
5005
5005
|
message: input.message,
|
|
5006
5006
|
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5007
5007
|
};
|
|
5008
|
+
case "ToolCall":
|
|
5009
|
+
return {
|
|
5010
|
+
part: input.part,
|
|
5011
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5012
|
+
};
|
|
5013
|
+
case "ToolResult":
|
|
5014
|
+
return {
|
|
5015
|
+
part: input.part,
|
|
5016
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5017
|
+
};
|
|
5018
|
+
case "Memory":
|
|
5019
|
+
return {
|
|
5020
|
+
items: input.items,
|
|
5021
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5022
|
+
};
|
|
5023
|
+
case "Skill":
|
|
5024
|
+
return {
|
|
5025
|
+
name: input.name,
|
|
5026
|
+
body: input.body,
|
|
5027
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5028
|
+
};
|
|
5029
|
+
case "Steering":
|
|
5030
|
+
return {
|
|
5031
|
+
message: input.message,
|
|
5032
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5033
|
+
};
|
|
5034
|
+
case "Handoff":
|
|
5035
|
+
return {
|
|
5036
|
+
target: input.target,
|
|
5037
|
+
summary: input.summary,
|
|
5038
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5039
|
+
};
|
|
5008
5040
|
case "Compaction":
|
|
5009
5041
|
return {
|
|
5010
5042
|
summary: input.summary,
|
|
@@ -5034,6 +5066,44 @@ var toEntryRecord = (row) => {
|
|
|
5034
5066
|
_tag: "Message",
|
|
5035
5067
|
message: payload.message
|
|
5036
5068
|
});
|
|
5069
|
+
case "ToolCall":
|
|
5070
|
+
return Effect18.succeed({
|
|
5071
|
+
...base,
|
|
5072
|
+
_tag: "ToolCall",
|
|
5073
|
+
part: payload.part
|
|
5074
|
+
});
|
|
5075
|
+
case "ToolResult":
|
|
5076
|
+
return Effect18.succeed({
|
|
5077
|
+
...base,
|
|
5078
|
+
_tag: "ToolResult",
|
|
5079
|
+
part: payload.part
|
|
5080
|
+
});
|
|
5081
|
+
case "Memory":
|
|
5082
|
+
return Effect18.succeed({
|
|
5083
|
+
...base,
|
|
5084
|
+
_tag: "Memory",
|
|
5085
|
+
items: Array.isArray(payload.items) ? payload.items.map(String) : []
|
|
5086
|
+
});
|
|
5087
|
+
case "Skill":
|
|
5088
|
+
return Effect18.succeed({
|
|
5089
|
+
...base,
|
|
5090
|
+
_tag: "Skill",
|
|
5091
|
+
name: String(payload.name ?? ""),
|
|
5092
|
+
body: String(payload.body ?? "")
|
|
5093
|
+
});
|
|
5094
|
+
case "Steering":
|
|
5095
|
+
return Effect18.succeed({
|
|
5096
|
+
...base,
|
|
5097
|
+
_tag: "Steering",
|
|
5098
|
+
message: payload.message
|
|
5099
|
+
});
|
|
5100
|
+
case "Handoff":
|
|
5101
|
+
return Effect18.succeed({
|
|
5102
|
+
...base,
|
|
5103
|
+
_tag: "Handoff",
|
|
5104
|
+
target: String(payload.target ?? ""),
|
|
5105
|
+
summary: String(payload.summary ?? "")
|
|
5106
|
+
});
|
|
5037
5107
|
case "Compaction":
|
|
5038
5108
|
return Effect18.succeed({
|
|
5039
5109
|
...base,
|
|
@@ -5081,6 +5151,18 @@ var appendToRecord = (input) => {
|
|
|
5081
5151
|
switch (input.input._tag) {
|
|
5082
5152
|
case "Message":
|
|
5083
5153
|
return { ...base, _tag: "Message", message: input.input.message };
|
|
5154
|
+
case "ToolCall":
|
|
5155
|
+
return { ...base, _tag: "ToolCall", part: input.input.part };
|
|
5156
|
+
case "ToolResult":
|
|
5157
|
+
return { ...base, _tag: "ToolResult", part: input.input.part };
|
|
5158
|
+
case "Memory":
|
|
5159
|
+
return { ...base, _tag: "Memory", items: input.input.items };
|
|
5160
|
+
case "Skill":
|
|
5161
|
+
return { ...base, _tag: "Skill", name: input.input.name, body: input.input.body };
|
|
5162
|
+
case "Steering":
|
|
5163
|
+
return { ...base, _tag: "Steering", message: input.input.message };
|
|
5164
|
+
case "Handoff":
|
|
5165
|
+
return { ...base, _tag: "Handoff", target: input.input.target, summary: input.input.summary };
|
|
5084
5166
|
case "Compaction":
|
|
5085
5167
|
return {
|
|
5086
5168
|
...base,
|
|
@@ -8318,7 +8400,7 @@ __export(exports_agent_loop_service, {
|
|
|
8318
8400
|
AgentLoopBudgetExceeded: () => AgentLoopBudgetExceeded
|
|
8319
8401
|
});
|
|
8320
8402
|
|
|
8321
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8403
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent.ts
|
|
8322
8404
|
var exports_agent = {};
|
|
8323
8405
|
__export(exports_agent, {
|
|
8324
8406
|
streamObject: () => streamObject,
|
|
@@ -8331,7 +8413,7 @@ __export(exports_agent, {
|
|
|
8331
8413
|
import { Cause as Cause3, Effect as Effect45, Fiber, Option as Option15, Queue as Queue2, Ref as Ref10, Schema as Schema47, Stream as Stream7 } from "effect";
|
|
8332
8414
|
import { Chat, LanguageModel as LanguageModel3, Prompt as Prompt4, Response as Response3, Telemetry, Tokenizer as Tokenizer2, Tool as Tool4, Toolkit as Toolkit3 } from "effect/unstable/ai";
|
|
8333
8415
|
|
|
8334
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8416
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent-event.ts
|
|
8335
8417
|
var exports_agent_event = {};
|
|
8336
8418
|
__export(exports_agent_event, {
|
|
8337
8419
|
addUsage: () => addUsage,
|
|
@@ -8388,7 +8470,7 @@ class AgentSuspended extends Schema38.TaggedErrorClass()("@batonfx/core/AgentSus
|
|
|
8388
8470
|
}) {
|
|
8389
8471
|
}
|
|
8390
8472
|
|
|
8391
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8473
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/approvals.ts
|
|
8392
8474
|
var exports_approvals = {};
|
|
8393
8475
|
__export(exports_approvals, {
|
|
8394
8476
|
testLayer: () => testLayer26,
|
|
@@ -8404,7 +8486,7 @@ var autoApprove = Layer29.succeed(Approvals, Approvals.of({ check: () => Effect3
|
|
|
8404
8486
|
var denyAll = Layer29.succeed(Approvals, Approvals.of({ check: () => Effect31.succeed({ _tag: "Denied" }) }));
|
|
8405
8487
|
var testLayer26 = (implementation) => Layer29.succeed(Approvals, Approvals.of(implementation));
|
|
8406
8488
|
|
|
8407
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8489
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/compaction.ts
|
|
8408
8490
|
var exports_compaction = {};
|
|
8409
8491
|
__export(exports_compaction, {
|
|
8410
8492
|
truncate: () => truncate,
|
|
@@ -8422,7 +8504,7 @@ __export(exports_compaction, {
|
|
|
8422
8504
|
import { Context as Context32, Effect as Effect34, Layer as Layer32, Option as Option10, Schema as Schema41 } from "effect";
|
|
8423
8505
|
import { LanguageModel, Prompt as Prompt3, Tokenizer, Toolkit as Toolkit2 } from "effect/unstable/ai";
|
|
8424
8506
|
|
|
8425
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8507
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/session.ts
|
|
8426
8508
|
var exports_session = {};
|
|
8427
8509
|
__export(exports_session, {
|
|
8428
8510
|
testLayer: () => testLayer27,
|
|
@@ -8462,6 +8544,18 @@ var entryFromInput = (input, id2, parentId) => {
|
|
|
8462
8544
|
switch (input._tag) {
|
|
8463
8545
|
case "Message":
|
|
8464
8546
|
return { ...base, _tag: "Message", message: input.message };
|
|
8547
|
+
case "ToolCall":
|
|
8548
|
+
return { ...base, _tag: "ToolCall", part: input.part };
|
|
8549
|
+
case "ToolResult":
|
|
8550
|
+
return { ...base, _tag: "ToolResult", part: input.part };
|
|
8551
|
+
case "Memory":
|
|
8552
|
+
return { ...base, _tag: "Memory", items: input.items };
|
|
8553
|
+
case "Skill":
|
|
8554
|
+
return { ...base, _tag: "Skill", name: input.name, body: input.body };
|
|
8555
|
+
case "Steering":
|
|
8556
|
+
return { ...base, _tag: "Steering", message: input.message };
|
|
8557
|
+
case "Handoff":
|
|
8558
|
+
return { ...base, _tag: "Handoff", target: input.target, summary: input.summary };
|
|
8465
8559
|
case "Compaction":
|
|
8466
8560
|
return { ...base, _tag: "Compaction", summary: input.summary, firstKeptEntryId: input.firstKeptEntryId };
|
|
8467
8561
|
case "BranchSummary":
|
|
@@ -8524,6 +8618,17 @@ ${summary}
|
|
|
8524
8618
|
var branchSummaryMessage = (summary) => messageFromText("system", `<abandoned-branch-summary>
|
|
8525
8619
|
${summary}
|
|
8526
8620
|
</abandoned-branch-summary>`);
|
|
8621
|
+
var attributeValue = (value) => value.replaceAll("&", "&").replaceAll('"', """);
|
|
8622
|
+
var memoryMessage = (items) => messageFromText("system", `<memory>
|
|
8623
|
+
${items.join(`
|
|
8624
|
+
`)}
|
|
8625
|
+
</memory>`);
|
|
8626
|
+
var skillMessage = (entry) => messageFromText("system", `<skill name="${attributeValue(entry.name)}">
|
|
8627
|
+
${entry.body}
|
|
8628
|
+
</skill>`);
|
|
8629
|
+
var handoffMessage = (entry) => messageFromText("system", `<handoff target="${attributeValue(entry.target)}">
|
|
8630
|
+
${entry.summary}
|
|
8631
|
+
</handoff>`);
|
|
8527
8632
|
var projectedMessages = (path2) => {
|
|
8528
8633
|
const compactionIndex = path2.findLastIndex((entry) => entry._tag === "Compaction");
|
|
8529
8634
|
const messages = [];
|
|
@@ -8536,6 +8641,24 @@ var projectedMessages = (path2) => {
|
|
|
8536
8641
|
case "Message":
|
|
8537
8642
|
messages.push(entry.message);
|
|
8538
8643
|
break;
|
|
8644
|
+
case "ToolCall":
|
|
8645
|
+
messages.push(Prompt2.makeMessage("assistant", { content: [entry.part] }));
|
|
8646
|
+
break;
|
|
8647
|
+
case "ToolResult":
|
|
8648
|
+
messages.push(Prompt2.makeMessage("tool", { content: [entry.part] }));
|
|
8649
|
+
break;
|
|
8650
|
+
case "Memory":
|
|
8651
|
+
messages.push(memoryMessage(entry.items));
|
|
8652
|
+
break;
|
|
8653
|
+
case "Skill":
|
|
8654
|
+
messages.push(skillMessage(entry));
|
|
8655
|
+
break;
|
|
8656
|
+
case "Steering":
|
|
8657
|
+
messages.push(entry.message);
|
|
8658
|
+
break;
|
|
8659
|
+
case "Handoff":
|
|
8660
|
+
messages.push(handoffMessage(entry));
|
|
8661
|
+
break;
|
|
8539
8662
|
case "BranchSummary":
|
|
8540
8663
|
messages.push(branchSummaryMessage(entry.summary));
|
|
8541
8664
|
break;
|
|
@@ -8554,7 +8677,7 @@ var memoryLayer24 = Layer30.effect(SessionStore, Ref7.make(initialState).pipe(Ef
|
|
|
8554
8677
|
}))));
|
|
8555
8678
|
var testLayer27 = (implementation) => Layer30.succeed(SessionStore, SessionStore.of(implementation));
|
|
8556
8679
|
|
|
8557
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8680
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-output.ts
|
|
8558
8681
|
var exports_tool_output = {};
|
|
8559
8682
|
__export(exports_tool_output, {
|
|
8560
8683
|
testLayer: () => testLayer28,
|
|
@@ -8614,7 +8737,7 @@ var bound = (result, options) => Effect33.gen(function* () {
|
|
|
8614
8737
|
return { _tag: "Success", result: output, encodedResult: output };
|
|
8615
8738
|
});
|
|
8616
8739
|
|
|
8617
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8740
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/compaction.ts
|
|
8618
8741
|
var DEFAULT_RESERVE_TOKENS = 16384;
|
|
8619
8742
|
var DEFAULT_KEEP_RECENT_TOKENS = 20000;
|
|
8620
8743
|
var SUMMARY_TEMPLATE = `Summarize the conversation so another agent can continue seamlessly.
|
|
@@ -8797,7 +8920,7 @@ var truncate = (maxTokens) => ({
|
|
|
8797
8920
|
var testLayer29 = (implementation) => Layer32.succeed(Compaction, Compaction.of(implementation));
|
|
8798
8921
|
var isContextOverflow = (error) => /context|token|prompt/i.test(error instanceof Error ? `${error.name}: ${error.message}` : String(error)) && /overflow|exceed|exceeded|maximum|too large|too long|length/i.test(error instanceof Error ? `${error.name}: ${error.message}` : String(error));
|
|
8799
8922
|
|
|
8800
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8923
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/instructions.ts
|
|
8801
8924
|
var exports_instructions = {};
|
|
8802
8925
|
__export(exports_instructions, {
|
|
8803
8926
|
testLayer: () => testLayer30,
|
|
@@ -8846,7 +8969,7 @@ var renderUpdate = (epoch, context) => Effect35.gen(function* () {
|
|
|
8846
8969
|
var layer27 = (sources) => Layer33.succeed(Instructions, Instructions.of({ sources: [...sources] }));
|
|
8847
8970
|
var testLayer30 = (implementation) => Layer33.succeed(Instructions, Instructions.of(implementation));
|
|
8848
8971
|
|
|
8849
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8972
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/memory.ts
|
|
8850
8973
|
var exports_memory = {};
|
|
8851
8974
|
__export(exports_memory, {
|
|
8852
8975
|
testLayer: () => testLayer31,
|
|
@@ -8875,7 +8998,7 @@ var merge = (first, second) => ({
|
|
|
8875
8998
|
var noopLayer = Layer34.succeed(Memory, Memory.of(noop));
|
|
8876
8999
|
var testLayer31 = (implementation) => Layer34.succeed(Memory, Memory.of(implementation));
|
|
8877
9000
|
|
|
8878
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9001
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-middleware.ts
|
|
8879
9002
|
var exports_model_middleware = {};
|
|
8880
9003
|
__export(exports_model_middleware, {
|
|
8881
9004
|
layer: () => layer28,
|
|
@@ -8889,7 +9012,7 @@ class ModelMiddleware extends Context35.Service()("@batonfx/core/ModelMiddleware
|
|
|
8889
9012
|
var identityLayer = Layer35.succeed(ModelMiddleware, []);
|
|
8890
9013
|
var layer28 = (middleware) => Layer35.succeed(ModelMiddleware, middleware);
|
|
8891
9014
|
|
|
8892
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9015
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-resilience.ts
|
|
8893
9016
|
var exports_model_resilience = {};
|
|
8894
9017
|
__export(exports_model_resilience, {
|
|
8895
9018
|
testLayer: () => testLayer32,
|
|
@@ -8935,7 +9058,7 @@ var apply = (model, resilience) => ({
|
|
|
8935
9058
|
}).pipe(Stream5.retry(retryStreamSchedule(resilience)))
|
|
8936
9059
|
});
|
|
8937
9060
|
|
|
8938
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9061
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/permissions.ts
|
|
8939
9062
|
var exports_permissions = {};
|
|
8940
9063
|
__export(exports_permissions, {
|
|
8941
9064
|
testLayer: () => testLayer33,
|
|
@@ -9065,7 +9188,7 @@ var ruleStoreMemory = (initialRules = []) => Layer37.effect(RuleStore, Ref9.make
|
|
|
9065
9188
|
var ruleStoreTestLayer = (implementation) => Layer37.succeed(RuleStore, RuleStore.of(implementation));
|
|
9066
9189
|
var testLayer33 = (implementation) => Layer37.succeed(Permissions, Permissions.of(implementation));
|
|
9067
9190
|
|
|
9068
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9191
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/skill-source.ts
|
|
9069
9192
|
var exports_skill_source = {};
|
|
9070
9193
|
__export(exports_skill_source, {
|
|
9071
9194
|
testLayer: () => testLayer34,
|
|
@@ -9123,7 +9246,7 @@ var selectListings = (skills, budgetTokens, recentlyUsed) => {
|
|
|
9123
9246
|
return selected;
|
|
9124
9247
|
};
|
|
9125
9248
|
|
|
9126
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9249
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/steering.ts
|
|
9127
9250
|
var exports_steering = {};
|
|
9128
9251
|
__export(exports_steering, {
|
|
9129
9252
|
testLayer: () => testLayer35,
|
|
@@ -9180,7 +9303,7 @@ var layer30 = (options = {}) => Layer39.effect(Steering, Effect41.gen(function*
|
|
|
9180
9303
|
}));
|
|
9181
9304
|
var testLayer35 = (implementation) => Layer39.succeed(Steering, Steering.of(implementation));
|
|
9182
9305
|
|
|
9183
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9306
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-context.ts
|
|
9184
9307
|
var exports_tool_context = {};
|
|
9185
9308
|
__export(exports_tool_context, {
|
|
9186
9309
|
testLayer: () => testLayer36,
|
|
@@ -9198,7 +9321,7 @@ var layerDefault = Layer40.sync(ToolContext, () => ToolContext.of({
|
|
|
9198
9321
|
}));
|
|
9199
9322
|
var testLayer36 = (implementation) => Layer40.succeed(ToolContext, ToolContext.of(implementation));
|
|
9200
9323
|
|
|
9201
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9324
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-executor.ts
|
|
9202
9325
|
var exports_tool_executor = {};
|
|
9203
9326
|
__export(exports_tool_executor, {
|
|
9204
9327
|
testLayer: () => testLayer37,
|
|
@@ -9324,7 +9447,7 @@ function router(routes) {
|
|
|
9324
9447
|
}
|
|
9325
9448
|
var testLayer37 = (implementation) => Layer41.succeed(ToolExecutor, ToolExecutor.of(implementation));
|
|
9326
9449
|
|
|
9327
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9450
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/turn-policy.ts
|
|
9328
9451
|
var exports_turn_policy = {};
|
|
9329
9452
|
__export(exports_turn_policy, {
|
|
9330
9453
|
untilToolCall: () => untilToolCall,
|
|
@@ -9363,7 +9486,7 @@ var both = (first, second) => make4((info) => Effect44.gen(function* () {
|
|
|
9363
9486
|
}));
|
|
9364
9487
|
var defaultPolicy = recurs(8);
|
|
9365
9488
|
|
|
9366
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9489
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent.ts
|
|
9367
9490
|
function make5(nameOrOptions, options = {}) {
|
|
9368
9491
|
const resolved = typeof nameOrOptions === "string" ? { ...options, name: nameOrOptions } : nameOrOptions;
|
|
9369
9492
|
return {
|
|
@@ -9564,9 +9687,9 @@ var streamInternal = (agent, options, structured) => Stream7.unwrap(Effect45.gen
|
|
|
9564
9687
|
}
|
|
9565
9688
|
userParts.push(part);
|
|
9566
9689
|
}
|
|
9567
|
-
const
|
|
9690
|
+
const memoryMessage2 = Prompt4.makeMessage("user", { content: userParts });
|
|
9568
9691
|
const [first, ...rest] = prompt.content;
|
|
9569
|
-
return first?.role === "system" ? Prompt4.fromMessages([first,
|
|
9692
|
+
return first?.role === "system" ? Prompt4.fromMessages([first, memoryMessage2, ...rest]) : Prompt4.fromMessages([memoryMessage2, ...prompt.content]);
|
|
9570
9693
|
});
|
|
9571
9694
|
const recallInitialPrompt = (prompt) => memoryRuntime === undefined ? Effect45.succeed(prompt) : memoryRuntime.service.recall({ key: memoryRuntime.key, turn: 0, prompt }).pipe(Effect45.mapError((error) => memoryError(0, error)), Effect45.flatMap((items) => insertRecalledItems(0, prompt, items)));
|
|
9572
9695
|
const rememberTurn = (turn, transcript, terminal) => memoryRuntime === undefined ? Effect45.void : memoryRuntime.service.remember({ key: memoryRuntime.key, turn, transcript, terminal }).pipe(Effect45.mapError((error) => memoryError(turn, error)));
|
|
@@ -10046,7 +10169,7 @@ var generateObject = (agent, options) => Stream7.runFold(streamObject(agent, opt
|
|
|
10046
10169
|
})
|
|
10047
10170
|
})
|
|
10048
10171
|
})));
|
|
10049
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10172
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent-tool.ts
|
|
10050
10173
|
var exports_agent_tool = {};
|
|
10051
10174
|
__export(exports_agent_tool, {
|
|
10052
10175
|
asTool: () => asTool
|
|
@@ -10104,7 +10227,7 @@ var asTool = (agent, options = {}) => {
|
|
|
10104
10227
|
});
|
|
10105
10228
|
return lazyHandled(toolkit, name, handler);
|
|
10106
10229
|
};
|
|
10107
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10230
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/guardrail.ts
|
|
10108
10231
|
var exports_guardrail = {};
|
|
10109
10232
|
__export(exports_guardrail, {
|
|
10110
10233
|
validateInput: () => validateInput2,
|
|
@@ -10184,7 +10307,7 @@ var redactOutput = (options) => ({
|
|
|
10184
10307
|
var filterOutput = (keep) => ({
|
|
10185
10308
|
transformPart: (part, context) => Effect47.succeed(part.type === "tool-call" || keep(part, context) ? Option16.some(part) : Option16.none())
|
|
10186
10309
|
});
|
|
10187
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10310
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/handoff.ts
|
|
10188
10311
|
var exports_handoff = {};
|
|
10189
10312
|
__export(exports_handoff, {
|
|
10190
10313
|
transferTool: () => transferTool,
|
|
@@ -10247,7 +10370,7 @@ var supervisor = (options) => {
|
|
|
10247
10370
|
toolkit
|
|
10248
10371
|
};
|
|
10249
10372
|
};
|
|
10250
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10373
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-registry.ts
|
|
10251
10374
|
var exports_model_registry = {};
|
|
10252
10375
|
__export(exports_model_registry, {
|
|
10253
10376
|
testLayer: () => testLayer38,
|
|
@@ -10336,7 +10459,7 @@ var provide = (selection, effect) => Effect49.gen(function* () {
|
|
|
10336
10459
|
return yield* service.provide(selection, effect);
|
|
10337
10460
|
});
|
|
10338
10461
|
|
|
10339
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10462
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/index.ts
|
|
10340
10463
|
import {
|
|
10341
10464
|
AiError as AiError3,
|
|
10342
10465
|
Chat as Chat2,
|
|
@@ -11295,6 +11418,70 @@ class Service37 extends Context50.Service()("@relayfx/runtime/RelaySessionStore"
|
|
|
11295
11418
|
var mapError = (error) => new exports_session.SessionStoreError({ message: error.message });
|
|
11296
11419
|
var entryId = (id2) => exports_ids_schema.SessionEntryId.make(id2);
|
|
11297
11420
|
var metadata10 = (value) => value;
|
|
11421
|
+
var entrySuffix = (entryPrefix, id2) => Number.parseInt(id2.slice(entryPrefix.length), 10);
|
|
11422
|
+
var maxScopedSuffix = (entryPrefix, entries) => Math.max(...entries.map((entry) => entrySuffix(entryPrefix, entry.id)).filter(Number.isFinite));
|
|
11423
|
+
var recordAppendInput = (record2) => {
|
|
11424
|
+
switch (record2._tag) {
|
|
11425
|
+
case "Message":
|
|
11426
|
+
return {
|
|
11427
|
+
_tag: "Message",
|
|
11428
|
+
message: record2.message,
|
|
11429
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11430
|
+
};
|
|
11431
|
+
case "ToolCall":
|
|
11432
|
+
return {
|
|
11433
|
+
_tag: "ToolCall",
|
|
11434
|
+
part: record2.part,
|
|
11435
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11436
|
+
};
|
|
11437
|
+
case "ToolResult":
|
|
11438
|
+
return {
|
|
11439
|
+
_tag: "ToolResult",
|
|
11440
|
+
part: record2.part,
|
|
11441
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11442
|
+
};
|
|
11443
|
+
case "Memory":
|
|
11444
|
+
return {
|
|
11445
|
+
_tag: "Memory",
|
|
11446
|
+
items: record2.items,
|
|
11447
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11448
|
+
};
|
|
11449
|
+
case "Skill":
|
|
11450
|
+
return {
|
|
11451
|
+
_tag: "Skill",
|
|
11452
|
+
name: record2.name,
|
|
11453
|
+
body: record2.body,
|
|
11454
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11455
|
+
};
|
|
11456
|
+
case "Steering":
|
|
11457
|
+
return {
|
|
11458
|
+
_tag: "Steering",
|
|
11459
|
+
message: record2.message,
|
|
11460
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11461
|
+
};
|
|
11462
|
+
case "Handoff":
|
|
11463
|
+
return {
|
|
11464
|
+
_tag: "Handoff",
|
|
11465
|
+
target: record2.target,
|
|
11466
|
+
summary: record2.summary,
|
|
11467
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11468
|
+
};
|
|
11469
|
+
case "Compaction":
|
|
11470
|
+
return {
|
|
11471
|
+
_tag: "Compaction",
|
|
11472
|
+
summary: record2.summary,
|
|
11473
|
+
firstKeptEntryId: record2.firstKeptEntryId,
|
|
11474
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11475
|
+
};
|
|
11476
|
+
case "BranchSummary":
|
|
11477
|
+
return {
|
|
11478
|
+
_tag: "BranchSummary",
|
|
11479
|
+
summary: record2.summary,
|
|
11480
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11481
|
+
};
|
|
11482
|
+
}
|
|
11483
|
+
};
|
|
11484
|
+
var appendInputMatchesRecord = (input, record2) => exports_shared_schema.canonicalString(input) === exports_shared_schema.canonicalString(recordAppendInput(record2));
|
|
11298
11485
|
var toAppendInput = (input) => {
|
|
11299
11486
|
switch (input._tag) {
|
|
11300
11487
|
case "Message":
|
|
@@ -11303,6 +11490,44 @@ var toAppendInput = (input) => {
|
|
|
11303
11490
|
message: input.message,
|
|
11304
11491
|
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11305
11492
|
};
|
|
11493
|
+
case "ToolCall":
|
|
11494
|
+
return {
|
|
11495
|
+
_tag: "ToolCall",
|
|
11496
|
+
part: input.part,
|
|
11497
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11498
|
+
};
|
|
11499
|
+
case "ToolResult":
|
|
11500
|
+
return {
|
|
11501
|
+
_tag: "ToolResult",
|
|
11502
|
+
part: input.part,
|
|
11503
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11504
|
+
};
|
|
11505
|
+
case "Memory":
|
|
11506
|
+
return {
|
|
11507
|
+
_tag: "Memory",
|
|
11508
|
+
items: input.items,
|
|
11509
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11510
|
+
};
|
|
11511
|
+
case "Skill":
|
|
11512
|
+
return {
|
|
11513
|
+
_tag: "Skill",
|
|
11514
|
+
name: input.name,
|
|
11515
|
+
body: input.body,
|
|
11516
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11517
|
+
};
|
|
11518
|
+
case "Steering":
|
|
11519
|
+
return {
|
|
11520
|
+
_tag: "Steering",
|
|
11521
|
+
message: input.message,
|
|
11522
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11523
|
+
};
|
|
11524
|
+
case "Handoff":
|
|
11525
|
+
return {
|
|
11526
|
+
_tag: "Handoff",
|
|
11527
|
+
target: input.target,
|
|
11528
|
+
summary: input.summary,
|
|
11529
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11530
|
+
};
|
|
11306
11531
|
case "Compaction":
|
|
11307
11532
|
return {
|
|
11308
11533
|
_tag: "Compaction",
|
|
@@ -11322,20 +11547,21 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11322
11547
|
const repository = yield* exports_session_repository.Service;
|
|
11323
11548
|
const state = yield* Ref15.make(undefined);
|
|
11324
11549
|
const entryPrefix = `${sessionId}:entry:${entryScope}:`;
|
|
11325
|
-
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* () {
|
|
11550
|
+
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* (input) {
|
|
11326
11551
|
const current2 = yield* Ref15.get(state);
|
|
11327
11552
|
if (current2 !== undefined)
|
|
11328
11553
|
return current2;
|
|
11329
11554
|
const currentPath = yield* repository.path({ sessionId }).pipe(Effect57.mapError(mapError));
|
|
11330
|
-
const
|
|
11331
|
-
const
|
|
11332
|
-
const initialized = { leaf:
|
|
11555
|
+
const scopedEntries = currentPath.filter((entry) => entry.id.startsWith(entryPrefix));
|
|
11556
|
+
const firstScopedEntry = scopedEntries[0];
|
|
11557
|
+
const initialized = firstScopedEntry === undefined ? { leaf: currentPath.at(-1)?.id ?? null, next: 0 } : appendInputMatchesRecord(input, firstScopedEntry) ? { leaf: firstScopedEntry.parentId, next: entrySuffix(entryPrefix, firstScopedEntry.id) } : {
|
|
11558
|
+
leaf: scopedEntries.at(-1)?.id ?? firstScopedEntry.id,
|
|
11559
|
+
next: maxScopedSuffix(entryPrefix, scopedEntries) + 1
|
|
11560
|
+
};
|
|
11333
11561
|
yield* Ref15.set(state, initialized);
|
|
11334
11562
|
return initialized;
|
|
11335
11563
|
});
|
|
11336
|
-
const
|
|
11337
|
-
const current2 = yield* initialState2();
|
|
11338
|
-
const now = yield* Clock4.currentTimeMillis;
|
|
11564
|
+
const appendFromState = Effect57.fn("RelaySessionStore.appendFromState")(function* (input, current2, now) {
|
|
11339
11565
|
const entry = yield* repository.appendEntry({
|
|
11340
11566
|
id: exports_ids_schema.SessionEntryId.make(`${entryPrefix}${current2.next}`),
|
|
11341
11567
|
sessionId,
|
|
@@ -11346,6 +11572,12 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11346
11572
|
yield* Ref15.set(state, { leaf: entry.id, next: current2.next + 1 });
|
|
11347
11573
|
return entry;
|
|
11348
11574
|
});
|
|
11575
|
+
const append4 = Effect57.fn("RelaySessionStore.append")(function* (input) {
|
|
11576
|
+
const appendInput = toAppendInput(input);
|
|
11577
|
+
const current2 = yield* initialState2(appendInput);
|
|
11578
|
+
const now = yield* Clock4.currentTimeMillis;
|
|
11579
|
+
return yield* appendFromState(input, current2, now);
|
|
11580
|
+
});
|
|
11349
11581
|
const path2 = Effect57.fn("RelaySessionStore.path")((leaf2) => repository.path({
|
|
11350
11582
|
sessionId,
|
|
11351
11583
|
...leaf2 === undefined ? {} : { leafId: entryId(leaf2) }
|
|
@@ -15351,7 +15583,7 @@ __export(exports_language_model_registration, {
|
|
|
15351
15583
|
anthropic: () => anthropic
|
|
15352
15584
|
});
|
|
15353
15585
|
|
|
15354
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15586
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/anthropic.ts
|
|
15355
15587
|
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
|
|
15356
15588
|
import { Layer as Layer70 } from "effect";
|
|
15357
15589
|
import { FetchHttpClient as FetchHttpClient2 } from "effect/unstable/http";
|
|
@@ -15367,13 +15599,13 @@ var anthropic = (input) => exports_model_registry.registrationFromLayer({
|
|
|
15367
15599
|
});
|
|
15368
15600
|
var anthropicClientLayerConfig = AnthropicClient.layerConfig;
|
|
15369
15601
|
var withAnthropic = (options) => exports_model_registry.layerFromRegistrationEffects([anthropic(options)]).pipe(Layer70.provide(AnthropicClient.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer70.provide(FetchHttpClient2.layer));
|
|
15370
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15602
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/deterministic.ts
|
|
15371
15603
|
import { OpenAiClient as OpenAiClient3 } from "@effect/ai-openai";
|
|
15372
15604
|
import { Effect as Effect79, Layer as Layer72, Option as Option28, Stream as Stream11 } from "effect";
|
|
15373
15605
|
import { LanguageModel as LanguageModel8, Response as Response7 } from "effect/unstable/ai";
|
|
15374
15606
|
import { FetchHttpClient as FetchHttpClient4 } from "effect/unstable/http";
|
|
15375
15607
|
|
|
15376
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15608
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openai.ts
|
|
15377
15609
|
import { OpenAiClient as OpenAiClient2, OpenAiLanguageModel } from "@effect/ai-openai";
|
|
15378
15610
|
import { Layer as Layer71 } from "effect";
|
|
15379
15611
|
import { FetchHttpClient as FetchHttpClient3 } from "effect/unstable/http";
|
|
@@ -15390,7 +15622,7 @@ var openAi = (input) => exports_model_registry.registrationFromLayer({
|
|
|
15390
15622
|
var openAiClientLayerConfig2 = OpenAiClient2.layerConfig;
|
|
15391
15623
|
var withOpenAi = (options) => exports_model_registry.layerFromRegistrationEffects([openAi(options)]).pipe(Layer71.provide(OpenAiClient2.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer71.provide(FetchHttpClient3.layer));
|
|
15392
15624
|
|
|
15393
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15625
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/deterministic.ts
|
|
15394
15626
|
var deterministicModelLayer = Layer72.effect(LanguageModel8.LanguageModel, LanguageModel8.make({
|
|
15395
15627
|
generateText: () => Effect79.succeed([{ type: "text", text: "deterministic response" }]),
|
|
15396
15628
|
streamText: () => Stream11.make(Response7.makePart("text-delta", { id: "text", delta: "deterministic response" }))
|
|
@@ -15414,7 +15646,7 @@ var withOpenAiOrDeterministic = (options) => Layer72.unwrap(Effect79.gen(functio
|
|
|
15414
15646
|
...Option28.isSome(openAiRegistration) ? [openAiRegistration.value] : []
|
|
15415
15647
|
]);
|
|
15416
15648
|
}));
|
|
15417
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15649
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openai-compat.ts
|
|
15418
15650
|
import { OpenAiClient as OpenAiClient4, OpenAiLanguageModel as OpenAiLanguageModel2 } from "@effect/ai-openai-compat";
|
|
15419
15651
|
import { Config as Config8, Layer as Layer73 } from "effect";
|
|
15420
15652
|
import { FetchHttpClient as FetchHttpClient5 } from "effect/unstable/http";
|
|
@@ -15435,7 +15667,7 @@ var clientLayerConfig = (options) => OpenAiClient4.layerConfig({
|
|
|
15435
15667
|
...options.baseUrl === undefined ? {} : { apiUrl: Config8.succeed(options.baseUrl) }
|
|
15436
15668
|
});
|
|
15437
15669
|
var withOpenAiCompatible = (options) => exports_model_registry.layerFromRegistrationEffects([openAiCompatible(options)]).pipe(Layer73.provide(clientLayerConfig(options)), Layer73.provide(FetchHttpClient5.layer));
|
|
15438
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
15670
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openrouter.ts
|
|
15439
15671
|
import { OpenRouterClient, OpenRouterLanguageModel } from "@effect/ai-openrouter";
|
|
15440
15672
|
import { Layer as Layer74 } from "effect";
|
|
15441
15673
|
import { FetchHttpClient as FetchHttpClient6 } from "effect/unstable/http";
|
package/dist/index.js
CHANGED
|
@@ -5058,6 +5058,38 @@ var payloadFromInput = (input) => {
|
|
|
5058
5058
|
message: input.message,
|
|
5059
5059
|
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5060
5060
|
};
|
|
5061
|
+
case "ToolCall":
|
|
5062
|
+
return {
|
|
5063
|
+
part: input.part,
|
|
5064
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5065
|
+
};
|
|
5066
|
+
case "ToolResult":
|
|
5067
|
+
return {
|
|
5068
|
+
part: input.part,
|
|
5069
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5070
|
+
};
|
|
5071
|
+
case "Memory":
|
|
5072
|
+
return {
|
|
5073
|
+
items: input.items,
|
|
5074
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5075
|
+
};
|
|
5076
|
+
case "Skill":
|
|
5077
|
+
return {
|
|
5078
|
+
name: input.name,
|
|
5079
|
+
body: input.body,
|
|
5080
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5081
|
+
};
|
|
5082
|
+
case "Steering":
|
|
5083
|
+
return {
|
|
5084
|
+
message: input.message,
|
|
5085
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5086
|
+
};
|
|
5087
|
+
case "Handoff":
|
|
5088
|
+
return {
|
|
5089
|
+
target: input.target,
|
|
5090
|
+
summary: input.summary,
|
|
5091
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
5092
|
+
};
|
|
5061
5093
|
case "Compaction":
|
|
5062
5094
|
return {
|
|
5063
5095
|
summary: input.summary,
|
|
@@ -5087,6 +5119,44 @@ var toEntryRecord = (row) => {
|
|
|
5087
5119
|
_tag: "Message",
|
|
5088
5120
|
message: payload.message
|
|
5089
5121
|
});
|
|
5122
|
+
case "ToolCall":
|
|
5123
|
+
return Effect18.succeed({
|
|
5124
|
+
...base,
|
|
5125
|
+
_tag: "ToolCall",
|
|
5126
|
+
part: payload.part
|
|
5127
|
+
});
|
|
5128
|
+
case "ToolResult":
|
|
5129
|
+
return Effect18.succeed({
|
|
5130
|
+
...base,
|
|
5131
|
+
_tag: "ToolResult",
|
|
5132
|
+
part: payload.part
|
|
5133
|
+
});
|
|
5134
|
+
case "Memory":
|
|
5135
|
+
return Effect18.succeed({
|
|
5136
|
+
...base,
|
|
5137
|
+
_tag: "Memory",
|
|
5138
|
+
items: Array.isArray(payload.items) ? payload.items.map(String) : []
|
|
5139
|
+
});
|
|
5140
|
+
case "Skill":
|
|
5141
|
+
return Effect18.succeed({
|
|
5142
|
+
...base,
|
|
5143
|
+
_tag: "Skill",
|
|
5144
|
+
name: String(payload.name ?? ""),
|
|
5145
|
+
body: String(payload.body ?? "")
|
|
5146
|
+
});
|
|
5147
|
+
case "Steering":
|
|
5148
|
+
return Effect18.succeed({
|
|
5149
|
+
...base,
|
|
5150
|
+
_tag: "Steering",
|
|
5151
|
+
message: payload.message
|
|
5152
|
+
});
|
|
5153
|
+
case "Handoff":
|
|
5154
|
+
return Effect18.succeed({
|
|
5155
|
+
...base,
|
|
5156
|
+
_tag: "Handoff",
|
|
5157
|
+
target: String(payload.target ?? ""),
|
|
5158
|
+
summary: String(payload.summary ?? "")
|
|
5159
|
+
});
|
|
5090
5160
|
case "Compaction":
|
|
5091
5161
|
return Effect18.succeed({
|
|
5092
5162
|
...base,
|
|
@@ -5134,6 +5204,18 @@ var appendToRecord = (input) => {
|
|
|
5134
5204
|
switch (input.input._tag) {
|
|
5135
5205
|
case "Message":
|
|
5136
5206
|
return { ...base, _tag: "Message", message: input.input.message };
|
|
5207
|
+
case "ToolCall":
|
|
5208
|
+
return { ...base, _tag: "ToolCall", part: input.input.part };
|
|
5209
|
+
case "ToolResult":
|
|
5210
|
+
return { ...base, _tag: "ToolResult", part: input.input.part };
|
|
5211
|
+
case "Memory":
|
|
5212
|
+
return { ...base, _tag: "Memory", items: input.input.items };
|
|
5213
|
+
case "Skill":
|
|
5214
|
+
return { ...base, _tag: "Skill", name: input.input.name, body: input.input.body };
|
|
5215
|
+
case "Steering":
|
|
5216
|
+
return { ...base, _tag: "Steering", message: input.input.message };
|
|
5217
|
+
case "Handoff":
|
|
5218
|
+
return { ...base, _tag: "Handoff", target: input.input.target, summary: input.input.summary };
|
|
5137
5219
|
case "Compaction":
|
|
5138
5220
|
return {
|
|
5139
5221
|
...base,
|
|
@@ -8371,7 +8453,7 @@ __export(exports_agent_loop_service, {
|
|
|
8371
8453
|
AgentLoopBudgetExceeded: () => AgentLoopBudgetExceeded
|
|
8372
8454
|
});
|
|
8373
8455
|
|
|
8374
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8456
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent.ts
|
|
8375
8457
|
var exports_agent = {};
|
|
8376
8458
|
__export(exports_agent, {
|
|
8377
8459
|
streamObject: () => streamObject,
|
|
@@ -8384,7 +8466,7 @@ __export(exports_agent, {
|
|
|
8384
8466
|
import { Cause as Cause3, Effect as Effect45, Fiber, Option as Option15, Queue as Queue2, Ref as Ref10, Schema as Schema47, Stream as Stream7 } from "effect";
|
|
8385
8467
|
import { Chat, LanguageModel as LanguageModel3, Prompt as Prompt4, Response as Response3, Telemetry, Tokenizer as Tokenizer2, Tool as Tool4, Toolkit as Toolkit3 } from "effect/unstable/ai";
|
|
8386
8468
|
|
|
8387
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8469
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent-event.ts
|
|
8388
8470
|
var exports_agent_event = {};
|
|
8389
8471
|
__export(exports_agent_event, {
|
|
8390
8472
|
addUsage: () => addUsage,
|
|
@@ -8441,7 +8523,7 @@ class AgentSuspended extends Schema38.TaggedErrorClass()("@batonfx/core/AgentSus
|
|
|
8441
8523
|
}) {
|
|
8442
8524
|
}
|
|
8443
8525
|
|
|
8444
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8526
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/approvals.ts
|
|
8445
8527
|
var exports_approvals = {};
|
|
8446
8528
|
__export(exports_approvals, {
|
|
8447
8529
|
testLayer: () => testLayer26,
|
|
@@ -8457,7 +8539,7 @@ var autoApprove = Layer29.succeed(Approvals, Approvals.of({ check: () => Effect3
|
|
|
8457
8539
|
var denyAll = Layer29.succeed(Approvals, Approvals.of({ check: () => Effect31.succeed({ _tag: "Denied" }) }));
|
|
8458
8540
|
var testLayer26 = (implementation) => Layer29.succeed(Approvals, Approvals.of(implementation));
|
|
8459
8541
|
|
|
8460
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8542
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/compaction.ts
|
|
8461
8543
|
var exports_compaction = {};
|
|
8462
8544
|
__export(exports_compaction, {
|
|
8463
8545
|
truncate: () => truncate,
|
|
@@ -8475,7 +8557,7 @@ __export(exports_compaction, {
|
|
|
8475
8557
|
import { Context as Context32, Effect as Effect34, Layer as Layer32, Option as Option10, Schema as Schema41 } from "effect";
|
|
8476
8558
|
import { LanguageModel, Prompt as Prompt3, Tokenizer, Toolkit as Toolkit2 } from "effect/unstable/ai";
|
|
8477
8559
|
|
|
8478
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8560
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/session.ts
|
|
8479
8561
|
var exports_session = {};
|
|
8480
8562
|
__export(exports_session, {
|
|
8481
8563
|
testLayer: () => testLayer27,
|
|
@@ -8515,6 +8597,18 @@ var entryFromInput = (input, id2, parentId) => {
|
|
|
8515
8597
|
switch (input._tag) {
|
|
8516
8598
|
case "Message":
|
|
8517
8599
|
return { ...base, _tag: "Message", message: input.message };
|
|
8600
|
+
case "ToolCall":
|
|
8601
|
+
return { ...base, _tag: "ToolCall", part: input.part };
|
|
8602
|
+
case "ToolResult":
|
|
8603
|
+
return { ...base, _tag: "ToolResult", part: input.part };
|
|
8604
|
+
case "Memory":
|
|
8605
|
+
return { ...base, _tag: "Memory", items: input.items };
|
|
8606
|
+
case "Skill":
|
|
8607
|
+
return { ...base, _tag: "Skill", name: input.name, body: input.body };
|
|
8608
|
+
case "Steering":
|
|
8609
|
+
return { ...base, _tag: "Steering", message: input.message };
|
|
8610
|
+
case "Handoff":
|
|
8611
|
+
return { ...base, _tag: "Handoff", target: input.target, summary: input.summary };
|
|
8518
8612
|
case "Compaction":
|
|
8519
8613
|
return { ...base, _tag: "Compaction", summary: input.summary, firstKeptEntryId: input.firstKeptEntryId };
|
|
8520
8614
|
case "BranchSummary":
|
|
@@ -8577,6 +8671,17 @@ ${summary}
|
|
|
8577
8671
|
var branchSummaryMessage = (summary) => messageFromText("system", `<abandoned-branch-summary>
|
|
8578
8672
|
${summary}
|
|
8579
8673
|
</abandoned-branch-summary>`);
|
|
8674
|
+
var attributeValue = (value) => value.replaceAll("&", "&").replaceAll('"', """);
|
|
8675
|
+
var memoryMessage = (items) => messageFromText("system", `<memory>
|
|
8676
|
+
${items.join(`
|
|
8677
|
+
`)}
|
|
8678
|
+
</memory>`);
|
|
8679
|
+
var skillMessage = (entry) => messageFromText("system", `<skill name="${attributeValue(entry.name)}">
|
|
8680
|
+
${entry.body}
|
|
8681
|
+
</skill>`);
|
|
8682
|
+
var handoffMessage = (entry) => messageFromText("system", `<handoff target="${attributeValue(entry.target)}">
|
|
8683
|
+
${entry.summary}
|
|
8684
|
+
</handoff>`);
|
|
8580
8685
|
var projectedMessages = (path2) => {
|
|
8581
8686
|
const compactionIndex = path2.findLastIndex((entry) => entry._tag === "Compaction");
|
|
8582
8687
|
const messages = [];
|
|
@@ -8589,6 +8694,24 @@ var projectedMessages = (path2) => {
|
|
|
8589
8694
|
case "Message":
|
|
8590
8695
|
messages.push(entry.message);
|
|
8591
8696
|
break;
|
|
8697
|
+
case "ToolCall":
|
|
8698
|
+
messages.push(Prompt2.makeMessage("assistant", { content: [entry.part] }));
|
|
8699
|
+
break;
|
|
8700
|
+
case "ToolResult":
|
|
8701
|
+
messages.push(Prompt2.makeMessage("tool", { content: [entry.part] }));
|
|
8702
|
+
break;
|
|
8703
|
+
case "Memory":
|
|
8704
|
+
messages.push(memoryMessage(entry.items));
|
|
8705
|
+
break;
|
|
8706
|
+
case "Skill":
|
|
8707
|
+
messages.push(skillMessage(entry));
|
|
8708
|
+
break;
|
|
8709
|
+
case "Steering":
|
|
8710
|
+
messages.push(entry.message);
|
|
8711
|
+
break;
|
|
8712
|
+
case "Handoff":
|
|
8713
|
+
messages.push(handoffMessage(entry));
|
|
8714
|
+
break;
|
|
8592
8715
|
case "BranchSummary":
|
|
8593
8716
|
messages.push(branchSummaryMessage(entry.summary));
|
|
8594
8717
|
break;
|
|
@@ -8607,7 +8730,7 @@ var memoryLayer24 = Layer30.effect(SessionStore, Ref7.make(initialState).pipe(Ef
|
|
|
8607
8730
|
}))));
|
|
8608
8731
|
var testLayer27 = (implementation) => Layer30.succeed(SessionStore, SessionStore.of(implementation));
|
|
8609
8732
|
|
|
8610
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8733
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-output.ts
|
|
8611
8734
|
var exports_tool_output = {};
|
|
8612
8735
|
__export(exports_tool_output, {
|
|
8613
8736
|
testLayer: () => testLayer28,
|
|
@@ -8667,7 +8790,7 @@ var bound = (result, options) => Effect33.gen(function* () {
|
|
|
8667
8790
|
return { _tag: "Success", result: output, encodedResult: output };
|
|
8668
8791
|
});
|
|
8669
8792
|
|
|
8670
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8793
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/compaction.ts
|
|
8671
8794
|
var DEFAULT_RESERVE_TOKENS = 16384;
|
|
8672
8795
|
var DEFAULT_KEEP_RECENT_TOKENS = 20000;
|
|
8673
8796
|
var SUMMARY_TEMPLATE = `Summarize the conversation so another agent can continue seamlessly.
|
|
@@ -8850,7 +8973,7 @@ var truncate = (maxTokens) => ({
|
|
|
8850
8973
|
var testLayer29 = (implementation) => Layer32.succeed(Compaction, Compaction.of(implementation));
|
|
8851
8974
|
var isContextOverflow = (error) => /context|token|prompt/i.test(error instanceof Error ? `${error.name}: ${error.message}` : String(error)) && /overflow|exceed|exceeded|maximum|too large|too long|length/i.test(error instanceof Error ? `${error.name}: ${error.message}` : String(error));
|
|
8852
8975
|
|
|
8853
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
8976
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/instructions.ts
|
|
8854
8977
|
var exports_instructions = {};
|
|
8855
8978
|
__export(exports_instructions, {
|
|
8856
8979
|
testLayer: () => testLayer30,
|
|
@@ -8899,7 +9022,7 @@ var renderUpdate = (epoch, context) => Effect35.gen(function* () {
|
|
|
8899
9022
|
var layer27 = (sources) => Layer33.succeed(Instructions, Instructions.of({ sources: [...sources] }));
|
|
8900
9023
|
var testLayer30 = (implementation) => Layer33.succeed(Instructions, Instructions.of(implementation));
|
|
8901
9024
|
|
|
8902
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9025
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/memory.ts
|
|
8903
9026
|
var exports_memory = {};
|
|
8904
9027
|
__export(exports_memory, {
|
|
8905
9028
|
testLayer: () => testLayer31,
|
|
@@ -8928,7 +9051,7 @@ var merge = (first, second) => ({
|
|
|
8928
9051
|
var noopLayer = Layer34.succeed(Memory, Memory.of(noop));
|
|
8929
9052
|
var testLayer31 = (implementation) => Layer34.succeed(Memory, Memory.of(implementation));
|
|
8930
9053
|
|
|
8931
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9054
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-middleware.ts
|
|
8932
9055
|
var exports_model_middleware = {};
|
|
8933
9056
|
__export(exports_model_middleware, {
|
|
8934
9057
|
layer: () => layer28,
|
|
@@ -8942,7 +9065,7 @@ class ModelMiddleware extends Context35.Service()("@batonfx/core/ModelMiddleware
|
|
|
8942
9065
|
var identityLayer = Layer35.succeed(ModelMiddleware, []);
|
|
8943
9066
|
var layer28 = (middleware) => Layer35.succeed(ModelMiddleware, middleware);
|
|
8944
9067
|
|
|
8945
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9068
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-resilience.ts
|
|
8946
9069
|
var exports_model_resilience = {};
|
|
8947
9070
|
__export(exports_model_resilience, {
|
|
8948
9071
|
testLayer: () => testLayer32,
|
|
@@ -8988,7 +9111,7 @@ var apply = (model, resilience) => ({
|
|
|
8988
9111
|
}).pipe(Stream5.retry(retryStreamSchedule(resilience)))
|
|
8989
9112
|
});
|
|
8990
9113
|
|
|
8991
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9114
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/permissions.ts
|
|
8992
9115
|
var exports_permissions = {};
|
|
8993
9116
|
__export(exports_permissions, {
|
|
8994
9117
|
testLayer: () => testLayer33,
|
|
@@ -9118,7 +9241,7 @@ var ruleStoreMemory = (initialRules = []) => Layer37.effect(RuleStore, Ref9.make
|
|
|
9118
9241
|
var ruleStoreTestLayer = (implementation) => Layer37.succeed(RuleStore, RuleStore.of(implementation));
|
|
9119
9242
|
var testLayer33 = (implementation) => Layer37.succeed(Permissions, Permissions.of(implementation));
|
|
9120
9243
|
|
|
9121
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9244
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/skill-source.ts
|
|
9122
9245
|
var exports_skill_source = {};
|
|
9123
9246
|
__export(exports_skill_source, {
|
|
9124
9247
|
testLayer: () => testLayer34,
|
|
@@ -9176,7 +9299,7 @@ var selectListings = (skills, budgetTokens, recentlyUsed) => {
|
|
|
9176
9299
|
return selected;
|
|
9177
9300
|
};
|
|
9178
9301
|
|
|
9179
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9302
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/steering.ts
|
|
9180
9303
|
var exports_steering = {};
|
|
9181
9304
|
__export(exports_steering, {
|
|
9182
9305
|
testLayer: () => testLayer35,
|
|
@@ -9233,7 +9356,7 @@ var layer30 = (options = {}) => Layer39.effect(Steering, Effect41.gen(function*
|
|
|
9233
9356
|
}));
|
|
9234
9357
|
var testLayer35 = (implementation) => Layer39.succeed(Steering, Steering.of(implementation));
|
|
9235
9358
|
|
|
9236
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9359
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-context.ts
|
|
9237
9360
|
var exports_tool_context = {};
|
|
9238
9361
|
__export(exports_tool_context, {
|
|
9239
9362
|
testLayer: () => testLayer36,
|
|
@@ -9251,7 +9374,7 @@ var layerDefault = Layer40.sync(ToolContext, () => ToolContext.of({
|
|
|
9251
9374
|
}));
|
|
9252
9375
|
var testLayer36 = (implementation) => Layer40.succeed(ToolContext, ToolContext.of(implementation));
|
|
9253
9376
|
|
|
9254
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9377
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/tool-executor.ts
|
|
9255
9378
|
var exports_tool_executor = {};
|
|
9256
9379
|
__export(exports_tool_executor, {
|
|
9257
9380
|
testLayer: () => testLayer37,
|
|
@@ -9377,7 +9500,7 @@ function router(routes) {
|
|
|
9377
9500
|
}
|
|
9378
9501
|
var testLayer37 = (implementation) => Layer41.succeed(ToolExecutor, ToolExecutor.of(implementation));
|
|
9379
9502
|
|
|
9380
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9503
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/turn-policy.ts
|
|
9381
9504
|
var exports_turn_policy = {};
|
|
9382
9505
|
__export(exports_turn_policy, {
|
|
9383
9506
|
untilToolCall: () => untilToolCall,
|
|
@@ -9416,7 +9539,7 @@ var both = (first, second) => make4((info) => Effect44.gen(function* () {
|
|
|
9416
9539
|
}));
|
|
9417
9540
|
var defaultPolicy = recurs(8);
|
|
9418
9541
|
|
|
9419
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
9542
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent.ts
|
|
9420
9543
|
function make5(nameOrOptions, options = {}) {
|
|
9421
9544
|
const resolved = typeof nameOrOptions === "string" ? { ...options, name: nameOrOptions } : nameOrOptions;
|
|
9422
9545
|
return {
|
|
@@ -9617,9 +9740,9 @@ var streamInternal = (agent, options, structured) => Stream7.unwrap(Effect45.gen
|
|
|
9617
9740
|
}
|
|
9618
9741
|
userParts.push(part);
|
|
9619
9742
|
}
|
|
9620
|
-
const
|
|
9743
|
+
const memoryMessage2 = Prompt4.makeMessage("user", { content: userParts });
|
|
9621
9744
|
const [first, ...rest] = prompt.content;
|
|
9622
|
-
return first?.role === "system" ? Prompt4.fromMessages([first,
|
|
9745
|
+
return first?.role === "system" ? Prompt4.fromMessages([first, memoryMessage2, ...rest]) : Prompt4.fromMessages([memoryMessage2, ...prompt.content]);
|
|
9623
9746
|
});
|
|
9624
9747
|
const recallInitialPrompt = (prompt) => memoryRuntime === undefined ? Effect45.succeed(prompt) : memoryRuntime.service.recall({ key: memoryRuntime.key, turn: 0, prompt }).pipe(Effect45.mapError((error) => memoryError(0, error)), Effect45.flatMap((items) => insertRecalledItems(0, prompt, items)));
|
|
9625
9748
|
const rememberTurn = (turn, transcript, terminal) => memoryRuntime === undefined ? Effect45.void : memoryRuntime.service.remember({ key: memoryRuntime.key, turn, transcript, terminal }).pipe(Effect45.mapError((error) => memoryError(turn, error)));
|
|
@@ -10099,7 +10222,7 @@ var generateObject = (agent, options) => Stream7.runFold(streamObject(agent, opt
|
|
|
10099
10222
|
})
|
|
10100
10223
|
})
|
|
10101
10224
|
})));
|
|
10102
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10225
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/agent-tool.ts
|
|
10103
10226
|
var exports_agent_tool = {};
|
|
10104
10227
|
__export(exports_agent_tool, {
|
|
10105
10228
|
asTool: () => asTool
|
|
@@ -10157,7 +10280,7 @@ var asTool = (agent, options = {}) => {
|
|
|
10157
10280
|
});
|
|
10158
10281
|
return lazyHandled(toolkit, name, handler);
|
|
10159
10282
|
};
|
|
10160
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10283
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/guardrail.ts
|
|
10161
10284
|
var exports_guardrail = {};
|
|
10162
10285
|
__export(exports_guardrail, {
|
|
10163
10286
|
validateInput: () => validateInput2,
|
|
@@ -10237,7 +10360,7 @@ var redactOutput = (options) => ({
|
|
|
10237
10360
|
var filterOutput = (keep) => ({
|
|
10238
10361
|
transformPart: (part, context) => Effect47.succeed(part.type === "tool-call" || keep(part, context) ? Option16.some(part) : Option16.none())
|
|
10239
10362
|
});
|
|
10240
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10363
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/handoff.ts
|
|
10241
10364
|
var exports_handoff = {};
|
|
10242
10365
|
__export(exports_handoff, {
|
|
10243
10366
|
transferTool: () => transferTool,
|
|
@@ -10300,7 +10423,7 @@ var supervisor = (options) => {
|
|
|
10300
10423
|
toolkit
|
|
10301
10424
|
};
|
|
10302
10425
|
};
|
|
10303
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10426
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/model-registry.ts
|
|
10304
10427
|
var exports_model_registry = {};
|
|
10305
10428
|
__export(exports_model_registry, {
|
|
10306
10429
|
testLayer: () => testLayer38,
|
|
@@ -10389,7 +10512,7 @@ var provide = (selection, effect) => Effect49.gen(function* () {
|
|
|
10389
10512
|
return yield* service.provide(selection, effect);
|
|
10390
10513
|
});
|
|
10391
10514
|
|
|
10392
|
-
// ../../node_modules/.bun/@batonfx+core@0.3.
|
|
10515
|
+
// ../../node_modules/.bun/@batonfx+core@0.3.3/node_modules/@batonfx/core/src/index.ts
|
|
10393
10516
|
import {
|
|
10394
10517
|
AiError as AiError3,
|
|
10395
10518
|
Chat as Chat2,
|
|
@@ -11348,6 +11471,70 @@ class Service37 extends Context50.Service()("@relayfx/runtime/RelaySessionStore"
|
|
|
11348
11471
|
var mapError = (error) => new exports_session.SessionStoreError({ message: error.message });
|
|
11349
11472
|
var entryId = (id2) => exports_ids_schema.SessionEntryId.make(id2);
|
|
11350
11473
|
var metadata10 = (value) => value;
|
|
11474
|
+
var entrySuffix = (entryPrefix, id2) => Number.parseInt(id2.slice(entryPrefix.length), 10);
|
|
11475
|
+
var maxScopedSuffix = (entryPrefix, entries) => Math.max(...entries.map((entry) => entrySuffix(entryPrefix, entry.id)).filter(Number.isFinite));
|
|
11476
|
+
var recordAppendInput = (record2) => {
|
|
11477
|
+
switch (record2._tag) {
|
|
11478
|
+
case "Message":
|
|
11479
|
+
return {
|
|
11480
|
+
_tag: "Message",
|
|
11481
|
+
message: record2.message,
|
|
11482
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11483
|
+
};
|
|
11484
|
+
case "ToolCall":
|
|
11485
|
+
return {
|
|
11486
|
+
_tag: "ToolCall",
|
|
11487
|
+
part: record2.part,
|
|
11488
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11489
|
+
};
|
|
11490
|
+
case "ToolResult":
|
|
11491
|
+
return {
|
|
11492
|
+
_tag: "ToolResult",
|
|
11493
|
+
part: record2.part,
|
|
11494
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11495
|
+
};
|
|
11496
|
+
case "Memory":
|
|
11497
|
+
return {
|
|
11498
|
+
_tag: "Memory",
|
|
11499
|
+
items: record2.items,
|
|
11500
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11501
|
+
};
|
|
11502
|
+
case "Skill":
|
|
11503
|
+
return {
|
|
11504
|
+
_tag: "Skill",
|
|
11505
|
+
name: record2.name,
|
|
11506
|
+
body: record2.body,
|
|
11507
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11508
|
+
};
|
|
11509
|
+
case "Steering":
|
|
11510
|
+
return {
|
|
11511
|
+
_tag: "Steering",
|
|
11512
|
+
message: record2.message,
|
|
11513
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11514
|
+
};
|
|
11515
|
+
case "Handoff":
|
|
11516
|
+
return {
|
|
11517
|
+
_tag: "Handoff",
|
|
11518
|
+
target: record2.target,
|
|
11519
|
+
summary: record2.summary,
|
|
11520
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11521
|
+
};
|
|
11522
|
+
case "Compaction":
|
|
11523
|
+
return {
|
|
11524
|
+
_tag: "Compaction",
|
|
11525
|
+
summary: record2.summary,
|
|
11526
|
+
firstKeptEntryId: record2.firstKeptEntryId,
|
|
11527
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11528
|
+
};
|
|
11529
|
+
case "BranchSummary":
|
|
11530
|
+
return {
|
|
11531
|
+
_tag: "BranchSummary",
|
|
11532
|
+
summary: record2.summary,
|
|
11533
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11534
|
+
};
|
|
11535
|
+
}
|
|
11536
|
+
};
|
|
11537
|
+
var appendInputMatchesRecord = (input, record2) => exports_shared_schema.canonicalString(input) === exports_shared_schema.canonicalString(recordAppendInput(record2));
|
|
11351
11538
|
var toAppendInput = (input) => {
|
|
11352
11539
|
switch (input._tag) {
|
|
11353
11540
|
case "Message":
|
|
@@ -11356,6 +11543,44 @@ var toAppendInput = (input) => {
|
|
|
11356
11543
|
message: input.message,
|
|
11357
11544
|
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11358
11545
|
};
|
|
11546
|
+
case "ToolCall":
|
|
11547
|
+
return {
|
|
11548
|
+
_tag: "ToolCall",
|
|
11549
|
+
part: input.part,
|
|
11550
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11551
|
+
};
|
|
11552
|
+
case "ToolResult":
|
|
11553
|
+
return {
|
|
11554
|
+
_tag: "ToolResult",
|
|
11555
|
+
part: input.part,
|
|
11556
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11557
|
+
};
|
|
11558
|
+
case "Memory":
|
|
11559
|
+
return {
|
|
11560
|
+
_tag: "Memory",
|
|
11561
|
+
items: input.items,
|
|
11562
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11563
|
+
};
|
|
11564
|
+
case "Skill":
|
|
11565
|
+
return {
|
|
11566
|
+
_tag: "Skill",
|
|
11567
|
+
name: input.name,
|
|
11568
|
+
body: input.body,
|
|
11569
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11570
|
+
};
|
|
11571
|
+
case "Steering":
|
|
11572
|
+
return {
|
|
11573
|
+
_tag: "Steering",
|
|
11574
|
+
message: input.message,
|
|
11575
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11576
|
+
};
|
|
11577
|
+
case "Handoff":
|
|
11578
|
+
return {
|
|
11579
|
+
_tag: "Handoff",
|
|
11580
|
+
target: input.target,
|
|
11581
|
+
summary: input.summary,
|
|
11582
|
+
...input.metadata === undefined ? {} : { metadata: metadata10(input.metadata) }
|
|
11583
|
+
};
|
|
11359
11584
|
case "Compaction":
|
|
11360
11585
|
return {
|
|
11361
11586
|
_tag: "Compaction",
|
|
@@ -11375,20 +11600,21 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11375
11600
|
const repository = yield* exports_session_repository.Service;
|
|
11376
11601
|
const state = yield* Ref15.make(undefined);
|
|
11377
11602
|
const entryPrefix = `${sessionId}:entry:${entryScope}:`;
|
|
11378
|
-
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* () {
|
|
11603
|
+
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* (input) {
|
|
11379
11604
|
const current2 = yield* Ref15.get(state);
|
|
11380
11605
|
if (current2 !== undefined)
|
|
11381
11606
|
return current2;
|
|
11382
11607
|
const currentPath = yield* repository.path({ sessionId }).pipe(Effect57.mapError(mapError));
|
|
11383
|
-
const
|
|
11384
|
-
const
|
|
11385
|
-
const initialized = { leaf:
|
|
11608
|
+
const scopedEntries = currentPath.filter((entry) => entry.id.startsWith(entryPrefix));
|
|
11609
|
+
const firstScopedEntry = scopedEntries[0];
|
|
11610
|
+
const initialized = firstScopedEntry === undefined ? { leaf: currentPath.at(-1)?.id ?? null, next: 0 } : appendInputMatchesRecord(input, firstScopedEntry) ? { leaf: firstScopedEntry.parentId, next: entrySuffix(entryPrefix, firstScopedEntry.id) } : {
|
|
11611
|
+
leaf: scopedEntries.at(-1)?.id ?? firstScopedEntry.id,
|
|
11612
|
+
next: maxScopedSuffix(entryPrefix, scopedEntries) + 1
|
|
11613
|
+
};
|
|
11386
11614
|
yield* Ref15.set(state, initialized);
|
|
11387
11615
|
return initialized;
|
|
11388
11616
|
});
|
|
11389
|
-
const
|
|
11390
|
-
const current2 = yield* initialState2();
|
|
11391
|
-
const now = yield* Clock4.currentTimeMillis;
|
|
11617
|
+
const appendFromState = Effect57.fn("RelaySessionStore.appendFromState")(function* (input, current2, now) {
|
|
11392
11618
|
const entry = yield* repository.appendEntry({
|
|
11393
11619
|
id: exports_ids_schema.SessionEntryId.make(`${entryPrefix}${current2.next}`),
|
|
11394
11620
|
sessionId,
|
|
@@ -11399,6 +11625,12 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11399
11625
|
yield* Ref15.set(state, { leaf: entry.id, next: current2.next + 1 });
|
|
11400
11626
|
return entry;
|
|
11401
11627
|
});
|
|
11628
|
+
const append4 = Effect57.fn("RelaySessionStore.append")(function* (input) {
|
|
11629
|
+
const appendInput = toAppendInput(input);
|
|
11630
|
+
const current2 = yield* initialState2(appendInput);
|
|
11631
|
+
const now = yield* Clock4.currentTimeMillis;
|
|
11632
|
+
return yield* appendFromState(input, current2, now);
|
|
11633
|
+
});
|
|
11402
11634
|
const path2 = Effect57.fn("RelaySessionStore.path")((leaf2) => repository.path({
|
|
11403
11635
|
sessionId,
|
|
11404
11636
|
...leaf2 === undefined ? {} : { leafId: entryId(leaf2) }
|
|
@@ -16488,7 +16720,7 @@ __export(exports_language_model_registration, {
|
|
|
16488
16720
|
anthropic: () => anthropic
|
|
16489
16721
|
});
|
|
16490
16722
|
|
|
16491
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16723
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/anthropic.ts
|
|
16492
16724
|
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
|
|
16493
16725
|
import { Layer as Layer72 } from "effect";
|
|
16494
16726
|
import { FetchHttpClient as FetchHttpClient2 } from "effect/unstable/http";
|
|
@@ -16504,13 +16736,13 @@ var anthropic = (input) => exports_model_registry.registrationFromLayer({
|
|
|
16504
16736
|
});
|
|
16505
16737
|
var anthropicClientLayerConfig = AnthropicClient.layerConfig;
|
|
16506
16738
|
var withAnthropic = (options) => exports_model_registry.layerFromRegistrationEffects([anthropic(options)]).pipe(Layer72.provide(AnthropicClient.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer72.provide(FetchHttpClient2.layer));
|
|
16507
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16739
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/deterministic.ts
|
|
16508
16740
|
import { OpenAiClient as OpenAiClient3 } from "@effect/ai-openai";
|
|
16509
16741
|
import { Effect as Effect81, Layer as Layer74, Option as Option29, Stream as Stream12 } from "effect";
|
|
16510
16742
|
import { LanguageModel as LanguageModel8, Response as Response7 } from "effect/unstable/ai";
|
|
16511
16743
|
import { FetchHttpClient as FetchHttpClient4 } from "effect/unstable/http";
|
|
16512
16744
|
|
|
16513
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16745
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openai.ts
|
|
16514
16746
|
import { OpenAiClient as OpenAiClient2, OpenAiLanguageModel } from "@effect/ai-openai";
|
|
16515
16747
|
import { Layer as Layer73 } from "effect";
|
|
16516
16748
|
import { FetchHttpClient as FetchHttpClient3 } from "effect/unstable/http";
|
|
@@ -16527,7 +16759,7 @@ var openAi = (input) => exports_model_registry.registrationFromLayer({
|
|
|
16527
16759
|
var openAiClientLayerConfig2 = OpenAiClient2.layerConfig;
|
|
16528
16760
|
var withOpenAi = (options) => exports_model_registry.layerFromRegistrationEffects([openAi(options)]).pipe(Layer73.provide(OpenAiClient2.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer73.provide(FetchHttpClient3.layer));
|
|
16529
16761
|
|
|
16530
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16762
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/deterministic.ts
|
|
16531
16763
|
var deterministicModelLayer = Layer74.effect(LanguageModel8.LanguageModel, LanguageModel8.make({
|
|
16532
16764
|
generateText: () => Effect81.succeed([{ type: "text", text: "deterministic response" }]),
|
|
16533
16765
|
streamText: () => Stream12.make(Response7.makePart("text-delta", { id: "text", delta: "deterministic response" }))
|
|
@@ -16551,7 +16783,7 @@ var withOpenAiOrDeterministic = (options) => Layer74.unwrap(Effect81.gen(functio
|
|
|
16551
16783
|
...Option29.isSome(openAiRegistration) ? [openAiRegistration.value] : []
|
|
16552
16784
|
]);
|
|
16553
16785
|
}));
|
|
16554
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16786
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openai-compat.ts
|
|
16555
16787
|
import { OpenAiClient as OpenAiClient4, OpenAiLanguageModel as OpenAiLanguageModel2 } from "@effect/ai-openai-compat";
|
|
16556
16788
|
import { Config as Config8, Layer as Layer75 } from "effect";
|
|
16557
16789
|
import { FetchHttpClient as FetchHttpClient5 } from "effect/unstable/http";
|
|
@@ -16572,7 +16804,7 @@ var clientLayerConfig = (options) => OpenAiClient4.layerConfig({
|
|
|
16572
16804
|
...options.baseUrl === undefined ? {} : { apiUrl: Config8.succeed(options.baseUrl) }
|
|
16573
16805
|
});
|
|
16574
16806
|
var withOpenAiCompatible = (options) => exports_model_registry.layerFromRegistrationEffects([openAiCompatible(options)]).pipe(Layer75.provide(clientLayerConfig(options)), Layer75.provide(FetchHttpClient5.layer));
|
|
16575
|
-
// ../../node_modules/.bun/@batonfx+providers@0.3.
|
|
16807
|
+
// ../../node_modules/.bun/@batonfx+providers@0.3.3/node_modules/@batonfx/providers/src/openrouter.ts
|
|
16576
16808
|
import { OpenRouterClient, OpenRouterLanguageModel } from "@effect/ai-openrouter";
|
|
16577
16809
|
import { Layer as Layer76 } from "effect";
|
|
16578
16810
|
import { FetchHttpClient as FetchHttpClient6 } from "effect/unstable/http";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ids, Shared } from "../../schema/index";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
-
import type { Message } from "effect/unstable/ai/Prompt";
|
|
3
|
+
import type { Message, ToolCallPart, ToolResultPart } from "effect/unstable/ai/Prompt";
|
|
4
4
|
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
5
5
|
declare const SessionRepositoryError_base: Schema.Class<SessionRepositoryError, Schema.TaggedStruct<"SessionRepositoryError", {
|
|
6
6
|
readonly message: Schema.String;
|
|
@@ -55,6 +55,32 @@ export type AppendSessionEntryInput = {
|
|
|
55
55
|
readonly _tag: "Message";
|
|
56
56
|
readonly message: Message;
|
|
57
57
|
readonly metadata?: Shared.Metadata;
|
|
58
|
+
} | {
|
|
59
|
+
readonly _tag: "ToolCall";
|
|
60
|
+
readonly part: ToolCallPart;
|
|
61
|
+
readonly metadata?: Shared.Metadata;
|
|
62
|
+
} | {
|
|
63
|
+
readonly _tag: "ToolResult";
|
|
64
|
+
readonly part: ToolResultPart;
|
|
65
|
+
readonly metadata?: Shared.Metadata;
|
|
66
|
+
} | {
|
|
67
|
+
readonly _tag: "Memory";
|
|
68
|
+
readonly items: ReadonlyArray<string>;
|
|
69
|
+
readonly metadata?: Shared.Metadata;
|
|
70
|
+
} | {
|
|
71
|
+
readonly _tag: "Skill";
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly body: string;
|
|
74
|
+
readonly metadata?: Shared.Metadata;
|
|
75
|
+
} | {
|
|
76
|
+
readonly _tag: "Steering";
|
|
77
|
+
readonly message: Message;
|
|
78
|
+
readonly metadata?: Shared.Metadata;
|
|
79
|
+
} | {
|
|
80
|
+
readonly _tag: "Handoff";
|
|
81
|
+
readonly target: string;
|
|
82
|
+
readonly summary: string;
|
|
83
|
+
readonly metadata?: Shared.Metadata;
|
|
58
84
|
} | {
|
|
59
85
|
readonly _tag: "Compaction";
|
|
60
86
|
readonly summary: string;
|
|
@@ -73,6 +99,56 @@ export type SessionEntryRecord = {
|
|
|
73
99
|
readonly message: Message;
|
|
74
100
|
readonly metadata?: Shared.Metadata;
|
|
75
101
|
readonly createdAt: number;
|
|
102
|
+
} | {
|
|
103
|
+
readonly id: Ids.SessionEntryId;
|
|
104
|
+
readonly sessionId: Ids.SessionId;
|
|
105
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
106
|
+
readonly _tag: "ToolCall";
|
|
107
|
+
readonly part: ToolCallPart;
|
|
108
|
+
readonly metadata?: Shared.Metadata;
|
|
109
|
+
readonly createdAt: number;
|
|
110
|
+
} | {
|
|
111
|
+
readonly id: Ids.SessionEntryId;
|
|
112
|
+
readonly sessionId: Ids.SessionId;
|
|
113
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
114
|
+
readonly _tag: "ToolResult";
|
|
115
|
+
readonly part: ToolResultPart;
|
|
116
|
+
readonly metadata?: Shared.Metadata;
|
|
117
|
+
readonly createdAt: number;
|
|
118
|
+
} | {
|
|
119
|
+
readonly id: Ids.SessionEntryId;
|
|
120
|
+
readonly sessionId: Ids.SessionId;
|
|
121
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
122
|
+
readonly _tag: "Memory";
|
|
123
|
+
readonly items: ReadonlyArray<string>;
|
|
124
|
+
readonly metadata?: Shared.Metadata;
|
|
125
|
+
readonly createdAt: number;
|
|
126
|
+
} | {
|
|
127
|
+
readonly id: Ids.SessionEntryId;
|
|
128
|
+
readonly sessionId: Ids.SessionId;
|
|
129
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
130
|
+
readonly _tag: "Skill";
|
|
131
|
+
readonly name: string;
|
|
132
|
+
readonly body: string;
|
|
133
|
+
readonly metadata?: Shared.Metadata;
|
|
134
|
+
readonly createdAt: number;
|
|
135
|
+
} | {
|
|
136
|
+
readonly id: Ids.SessionEntryId;
|
|
137
|
+
readonly sessionId: Ids.SessionId;
|
|
138
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
139
|
+
readonly _tag: "Steering";
|
|
140
|
+
readonly message: Message;
|
|
141
|
+
readonly metadata?: Shared.Metadata;
|
|
142
|
+
readonly createdAt: number;
|
|
143
|
+
} | {
|
|
144
|
+
readonly id: Ids.SessionEntryId;
|
|
145
|
+
readonly sessionId: Ids.SessionId;
|
|
146
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
147
|
+
readonly _tag: "Handoff";
|
|
148
|
+
readonly target: string;
|
|
149
|
+
readonly summary: string;
|
|
150
|
+
readonly metadata?: Shared.Metadata;
|
|
151
|
+
readonly createdAt: number;
|
|
76
152
|
} | {
|
|
77
153
|
readonly id: Ids.SessionEntryId;
|
|
78
154
|
readonly sessionId: Ids.SessionId;
|
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.0.
|
|
4
|
+
"version": "0.0.45",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"typecheck": "bun tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@batonfx/core": "0.3.
|
|
29
|
-
"@batonfx/providers": "0.3.
|
|
28
|
+
"@batonfx/core": "0.3.3",
|
|
29
|
+
"@batonfx/providers": "0.3.3",
|
|
30
30
|
"@effect/ai-anthropic": "4.0.0-beta.93",
|
|
31
31
|
"@effect/ai-openai": "4.0.0-beta.93",
|
|
32
32
|
"@effect/ai-openai-compat": "4.0.0-beta.93",
|