@relayfx/sdk 0.6.0 → 0.6.1

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 CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  exports_tool_executor,
33
33
  exports_tool_output,
34
34
  exports_turn_policy
35
- } from "./index-c6jave5p.js";
35
+ } from "./index-5vjhqzbk.js";
36
36
  import"./index-nb39b5ae.js";
37
37
 
38
38
  // src/ai.ts
@@ -3,7 +3,7 @@ import {
3
3
  __export
4
4
  } from "./index-nb39b5ae.js";
5
5
 
6
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/turn-policy.js
6
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/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.9.0/node_modules/@batonfx/core/dist/agent-event.js
75
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/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 Schema3 } from "effect";
91
91
  import { Prompt as Prompt3, Response as Response2, Tool } from "effect/unstable/ai";
92
92
 
93
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/session-sync.js
93
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/session-sync.js
94
94
  import { Schema as Schema2 } from "effect";
95
95
  import { Prompt as Prompt2 } from "effect/unstable/ai";
96
96
  var Divergence = Schema2.Struct({
@@ -162,7 +162,7 @@ var diagnose = (input) => {
162
162
  };
163
163
  };
164
164
 
165
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-event.js
165
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-event.js
166
166
  var addUsageField = (left, right) => left === undefined && right === undefined ? undefined : (left ?? 0) + (right ?? 0);
167
167
  var addUsage = Function.dual(2, (left, right) => Response2.Usage.make({
168
168
  inputTokens: {
@@ -265,7 +265,7 @@ class ResumeMismatch extends Schema3.TaggedErrorClass()("@batonfx/core/ResumeMis
265
265
  }) {
266
266
  }
267
267
 
268
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/memory.js
268
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/memory.js
269
269
  var exports_memory = {};
270
270
  __export(exports_memory, {
271
271
  replaceRecalledMessage: () => replaceRecalledMessage,
@@ -331,7 +331,7 @@ var merge = dual2(2, (first, second) => ({
331
331
  var layerNoop = Layer2.succeed(Memory, Memory.of(noop));
332
332
  var layerTest = (implementation) => Layer2.succeed(Memory, Memory.of(implementation));
333
333
 
334
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/model-registry.js
334
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/model-registry.js
335
335
  var exports_model_registry = {};
336
336
  __export(exports_model_registry, {
337
337
  stream: () => stream,
@@ -463,7 +463,7 @@ var operate = Function2.dual(2, (selection, effect) => Effect3.gen(function* ()
463
463
  }));
464
464
  var stream = Function2.dual(2, (selection, operation) => Stream.unwrap(ModelRegistry.pipe(Effect3.map((service) => service.stream(selection, operation)))));
465
465
 
466
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-context.js
466
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-context.js
467
467
  var exports_tool_context = {};
468
468
  __export(exports_tool_context, {
469
469
  layerTest: () => layerTest3,
@@ -481,7 +481,7 @@ var layerDefault = Layer4.sync(ToolContext, () => ToolContext.of({
481
481
  }));
482
482
  var layerTest3 = (implementation) => Layer4.succeed(ToolContext, ToolContext.of(implementation));
483
483
 
484
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-executor.js
484
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-executor.js
485
485
  var exports_tool_executor = {};
486
486
  __export(exports_tool_executor, {
487
487
  sandbox: () => sandbox,
@@ -502,11 +502,11 @@ __export(exports_tool_executor, {
502
502
  import { Context as Context4, Effect as Effect7, Layer as Layer5, Option as Option3, Schema as Schema7, Stream as Stream2 } from "effect";
503
503
  import { AiError as AiError2, Response as Response3, Tool as Tool4, Toolkit } from "effect/unstable/ai";
504
504
 
505
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-placement.js
505
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-placement.js
506
506
  import { Effect as Effect6, Schedule } from "effect";
507
507
  import { Tool as Tool3 } from "effect/unstable/ai";
508
508
 
509
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-result-codec.js
509
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-result-codec.js
510
510
  import { Effect as Effect5, Schema as Schema6 } from "effect";
511
511
  import { AiError, Tool as Tool2 } from "effect/unstable/ai";
512
512
  var resultMessage = (result) => {
@@ -571,7 +571,7 @@ var toolResultCodec = {
571
571
  schemaMessage
572
572
  };
573
573
 
574
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-placement.js
574
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-placement.js
575
575
  var placementOutcomeFromResponse = (placement, tool, response) => {
576
576
  if (typeof response !== "object" || response === null || !("_tag" in response)) {
577
577
  return Effect6.fail(toolResultCodec.frameworkFailure("placement", tool.name, "Placement returned an invalid response"));
@@ -589,7 +589,7 @@ var placementOutcomeFromResponse = (placement, tool, response) => {
589
589
  };
590
590
  var placementOutcome = { fromResponse: placementOutcomeFromResponse };
591
591
 
592
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-executor.js
592
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-executor.js
593
593
  var FrameworkStage = Schema7.Literals([
594
594
  "decode-input",
595
595
  "handler",
@@ -730,7 +730,7 @@ function layerRouter(routes) {
730
730
  }
731
731
  var layerTest4 = (implementation) => Layer5.succeed(ToolExecutor, ToolExecutor.of(implementation));
732
732
 
733
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/approvals.js
733
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/approvals.js
734
734
  var exports_approvals = {};
735
735
  __export(exports_approvals, {
736
736
  layerTest: () => layerTest5,
@@ -746,7 +746,7 @@ var layerAutoApprove = Layer6.succeed(Approvals, Approvals.of({ resolve: () => E
746
746
  var layerDenyAll = Layer6.succeed(Approvals, Approvals.of({ resolve: () => Effect8.succeed({ _tag: "Denied" }) }));
747
747
  var layerTest5 = (implementation) => Layer6.succeed(Approvals, Approvals.of(implementation));
748
748
 
749
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/session.js
749
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/session.js
750
750
  var exports_session = {};
751
751
  __export(exports_session, {
752
752
  layerTest: () => layerTest6,
@@ -1023,7 +1023,7 @@ var layerMemory2 = Layer7.effect(SessionStore, Ref2.make(initialState).pipe(Effe
1023
1023
  }))));
1024
1024
  var layerTest6 = (implementation) => Layer7.succeed(SessionStore, SessionStore.of(implementation));
1025
1025
 
1026
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-output.js
1026
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-output.js
1027
1027
  var exports_tool_output = {};
1028
1028
  __export(exports_tool_output, {
1029
1029
  layerTest: () => layerTest7,
@@ -1099,7 +1099,7 @@ var bound = Function3.dual(2, (result, options) => Effect10.gen(function* () {
1099
1099
  return boundedFromOriginal(encoded, bytes, options.maxBytes, [path.value]);
1100
1100
  }));
1101
1101
 
1102
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/compaction.js
1102
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/compaction.js
1103
1103
  var exports_compaction = {};
1104
1104
  __export(exports_compaction, {
1105
1105
  truncate: () => truncate,
@@ -1121,7 +1121,7 @@ __export(exports_compaction, {
1121
1121
  import { Context as Context9, Effect as Effect12, Function as Function4, Layer as Layer10, Option as Option6, Schema as Schema10 } from "effect";
1122
1122
  import { LanguageModel as LanguageModel4, Prompt as Prompt6, Tokenizer, Toolkit as Toolkit2 } from "effect/unstable/ai";
1123
1123
 
1124
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/summary-model.js
1124
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/summary-model.js
1125
1125
  import { Context as Context8, Deferred, Effect as Effect11, Fiber as Fiber2, Layer as Layer9, Scope as Scope2 } from "effect";
1126
1126
  import { LanguageModel as LanguageModel3 } from "effect/unstable/ai";
1127
1127
  var makeSummaryModelProvider = (model) => {
@@ -1146,7 +1146,7 @@ var makeSummaryModelProvider = (model) => {
1146
1146
  });
1147
1147
  };
1148
1148
 
1149
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/compaction.js
1149
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/compaction.js
1150
1150
  var DEFAULT_RESERVE_TOKENS = 16384;
1151
1151
  var DEFAULT_KEEP_RECENT_TOKENS = 20000;
1152
1152
  var SUMMARY_TEMPLATE = `Summarize the conversation so another agent can continue seamlessly.
@@ -1401,7 +1401,7 @@ var truncate = (maxTokens) => ({
1401
1401
  });
1402
1402
  var layerTest8 = (implementation) => Layer10.succeed(Compaction, Compaction.of(implementation));
1403
1403
 
1404
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/instructions.js
1404
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/instructions.js
1405
1405
  var exports_instructions = {};
1406
1406
  __export(exports_instructions, {
1407
1407
  staticSource: () => staticSource,
@@ -1432,7 +1432,7 @@ var openEpoch = dual3(2, (instructions, context) => Effect13.gen(function* () {
1432
1432
  var layer3 = (sources) => Layer11.succeed(Instructions, Instructions.of({ sources: [...sources] }));
1433
1433
  var layerTest9 = (implementation) => Layer11.succeed(Instructions, Instructions.of(implementation));
1434
1434
 
1435
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/model-middleware.js
1435
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/model-middleware.js
1436
1436
  var exports_model_middleware = {};
1437
1437
  __export(exports_model_middleware, {
1438
1438
  layerIdentity: () => layerIdentity,
@@ -1446,7 +1446,7 @@ class ModelMiddleware extends Context11.Service()("@batonfx/core/ModelMiddleware
1446
1446
  var layerIdentity = Layer12.succeed(ModelMiddleware, []);
1447
1447
  var layer4 = (middleware) => Layer12.succeed(ModelMiddleware, middleware);
1448
1448
 
1449
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/model-resilience.js
1449
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/model-resilience.js
1450
1450
  var exports_model_resilience = {};
1451
1451
  __export(exports_model_resilience, {
1452
1452
  none: () => none,
@@ -1499,7 +1499,7 @@ var apply = Function5.dual(2, (model, resilience) => ({
1499
1499
  streamText: (options) => retryStream(() => model.streamText(options), (error) => Response5.makePart("error", { error }), resilience)
1500
1500
  }));
1501
1501
 
1502
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/permissions.js
1502
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/permissions.js
1503
1503
  var exports_permissions = {};
1504
1504
  __export(exports_permissions, {
1505
1505
  matches: () => matches,
@@ -1644,7 +1644,7 @@ var layerRuleStoreMemory = (initialRules = []) => Layer14.effect(RuleStore, Ref4
1644
1644
  var layerRuleStoreTest = (implementation) => Layer14.succeed(RuleStore, RuleStore.of(implementation));
1645
1645
  var layerTest11 = (implementation) => Layer14.succeed(Permissions, Permissions.of(implementation));
1646
1646
 
1647
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/skill-source.js
1647
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/skill-source.js
1648
1648
  var exports_skill_source = {};
1649
1649
  __export(exports_skill_source, {
1650
1650
  selectListings: () => selectListings,
@@ -1734,7 +1734,7 @@ var selectListings = Function6.dual(3, (skills, budgetTokens, recentlyUsed) => {
1734
1734
  return selected;
1735
1735
  });
1736
1736
 
1737
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/steering.js
1737
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/steering.js
1738
1738
  var exports_steering = {};
1739
1739
  __export(exports_steering, {
1740
1740
  layerTest: () => layerTest13,
@@ -1792,7 +1792,7 @@ var layer7 = (options = {}) => Layer16.effect(Steering, Effect18.gen(function* (
1792
1792
  }));
1793
1793
  var layerTest13 = (implementation) => Layer16.succeed(Steering, Steering.of(implementation));
1794
1794
 
1795
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent.js
1795
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent.js
1796
1796
  var exports_agent = {};
1797
1797
  __export(exports_agent, {
1798
1798
  stream: () => stream2,
@@ -1806,11 +1806,11 @@ import { Effect as Effect24, Option as Option14, Schema as Schema20, Stream as S
1806
1806
  import { dual as dual6 } from "effect/Function";
1807
1807
  import { AiError as AiError5, Chat as Chat3, LanguageModel as LanguageModel7, Prompt as Prompt12, Tool as Tool10, Toolkit as Toolkit5 } from "effect/unstable/ai";
1808
1808
 
1809
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-run.js
1809
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-run.js
1810
1810
  import { Cause as Cause4, Channel, Effect as Effect23, Equal as Equal2, Exit as Exit2, Fiber as Fiber3, HashMap as HashMap6, Option as Option13, Queue as Queue2, Ref as Ref5, Schema as Schema19, Semaphore as Semaphore3, Stream as Stream4 } from "effect";
1811
1811
  import { AiError as AiError4, Chat as Chat2, LanguageModel as LanguageModel6, Prompt as Prompt11, Response as Response9, Telemetry, Tokenizer as Tokenizer2, Tool as Tool9, Toolkit as Toolkit4 } from "effect/unstable/ai";
1812
1812
 
1813
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-authorization.js
1813
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-authorization.js
1814
1814
  import { Cause as Cause3, Context as Context16, Effect as Effect19, Layer as Layer17, Schema as Schema15 } from "effect";
1815
1815
  import"effect/unstable/ai";
1816
1816
  class PermissionDenied extends Schema15.TaggedErrorClass()("@batonfx/core/PermissionDenied", {
@@ -1884,7 +1884,7 @@ var make4 = (options) => ({
1884
1884
  })
1885
1885
  });
1886
1886
 
1887
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/tool-registry.js
1887
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/tool-registry.js
1888
1888
  import { Array as Array2, Effect as Effect20, HashMap as HashMap4, Option as Option10 } from "effect";
1889
1889
  import { dual as dual5 } from "effect/Function";
1890
1890
  import { Tool as Tool7, Toolkit as Toolkit3 } from "effect/unstable/ai";
@@ -1930,7 +1930,7 @@ var select = dual5(2, (registry, names) => {
1930
1930
  };
1931
1931
  });
1932
1932
 
1933
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-persistence-lock.js
1933
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-persistence-lock.js
1934
1934
  import { Context as Context17, Effect as Effect21, Layer as Layer18, RcMap, Scope as Scope3, Semaphore as Semaphore2 } from "effect";
1935
1935
  import { Chat } from "effect/unstable/ai";
1936
1936
 
@@ -1948,11 +1948,11 @@ var makeRuntime = Effect21.gen(function* () {
1948
1948
  });
1949
1949
  var layerRuntime = Layer18.effect(Runtime, makeRuntime);
1950
1950
 
1951
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-message.js
1951
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-message.js
1952
1952
  import { Effect as Effect22, Option as Option11, Schema as Schema17 } from "effect";
1953
1953
  import { Prompt as Prompt9, Response as Response6 } from "effect/unstable/ai";
1954
1954
 
1955
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-skill-tool.js
1955
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-skill-tool.js
1956
1956
  import { Schema as Schema16 } from "effect";
1957
1957
  import { Tool as Tool8 } from "effect/unstable/ai";
1958
1958
  var skillListingBudgetTokens = 2048;
@@ -1975,7 +1975,7 @@ var activateSkillTool = Tool8.make(activateSkillToolName, {
1975
1975
  failureMode: "return"
1976
1976
  });
1977
1977
 
1978
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-message.js
1978
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-message.js
1979
1979
  var withSystem = (instructions, prompt) => Prompt9.fromMessages([Prompt9.makeMessage("system", { content: instructions }), ...prompt.content]);
1980
1980
  var skillListingsInstructions = (listings) => `Available skills:
1981
1981
  ${listings}
@@ -2023,7 +2023,7 @@ var applyPartChain = (chain, part, context) => Effect22.gen(function* () {
2023
2023
  return current;
2024
2024
  });
2025
2025
 
2026
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-suspension.js
2026
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-suspension.js
2027
2027
  import { Equal, Option as Option12, Schema as Schema18 } from "effect";
2028
2028
  import { Prompt as Prompt10, Response as Response7 } from "effect/unstable/ai";
2029
2029
  var suspensionCheckpointOption = "@batonfx/core/suspension";
@@ -2129,7 +2129,7 @@ var suspended = (call, toolCallBatch, toolCallIndex, token, reason) => AgentSusp
2129
2129
  tool_call_batch: toolCallBatch.calls
2130
2130
  });
2131
2131
 
2132
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-tool-result.js
2132
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-tool-result.js
2133
2133
  import { HashMap as HashMap5 } from "effect";
2134
2134
  import { Response as Response8 } from "effect/unstable/ai";
2135
2135
  var successResult = (call, outcome) => Response8.toolResultPart({
@@ -2151,7 +2151,7 @@ var domainFailureResult = (call, outcome) => Response8.toolResultPart({
2151
2151
  preliminary: false
2152
2152
  });
2153
2153
 
2154
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-run.js
2154
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-run.js
2155
2155
  var classifyOtherFailure = () => "other";
2156
2156
  var defaultProgressOverflowPolicy = { _tag: "Backpressure", capacity: 64 };
2157
2157
  var progressCapacitySchema = Schema19.Finite.pipe(Schema19.check(Schema19.isInt(), Schema19.isGreaterThan(0)));
@@ -2929,7 +2929,10 @@ var streamInternal = (agent, options, structured) => Stream4.unwrap(Effect23.gen
2929
2929
  };
2930
2930
  const retryableOverflow = (cause, hasEmitted) => {
2931
2931
  const failure2 = singleFailure(cause);
2932
- return retryOverflow && !hasEmitted && Option13.isSome(failure2) && classifyFailure2(failure2.value) === "context-overflow" && Option13.isSome(compactionService);
2932
+ if (Option13.isNone(failure2))
2933
+ return false;
2934
+ const classifiedFailure = Schema19.is(AgentError)(failure2.value) && failure2.value.cause !== undefined ? failure2.value.cause : failure2.value;
2935
+ return retryOverflow && !hasEmitted && Option13.isSome(compactionService) && classifyFailure2(classifiedFailure) === "context-overflow";
2933
2936
  };
2934
2937
  return Stream4.fromChannel(Channel.acquireUseRelease(Ref5.make({
2935
2938
  nextIndex: 0,
@@ -2950,7 +2953,7 @@ var streamInternal = (agent, options, structured) => Stream4.unwrap(Effect23.gen
2950
2953
  prompt: responsePrompt,
2951
2954
  toolkit: activeRegistry.toolkit,
2952
2955
  disableToolCallResolution: true
2953
- }).pipe(Stream4.tap(() => Effect23.sync(() => {
2956
+ }).pipe(Stream4.mapEffect((part) => part.type === "error" ? Effect23.fail(isToolNameCollision(part.error) ? part.error : AgentError.make({ message: errorMessage(part.error), turn, cause: part.error })) : Effect23.succeed(part)), Stream4.tap(() => Effect23.sync(() => {
2954
2957
  emitted = true;
2955
2958
  })), Stream4.catchCause((cause) => {
2956
2959
  if (Cause4.hasInterrupts(cause) || Cause4.hasDies(cause))
@@ -2960,6 +2963,9 @@ var streamInternal = (agent, options, structured) => Stream4.unwrap(Effect23.gen
2960
2963
  const error = singleFailure(cause);
2961
2964
  if (Option13.isNone(error))
2962
2965
  return Stream4.failCause(cause);
2966
+ if (Schema19.is(AgentError)(error.value) || isToolNameCollision(error.value)) {
2967
+ return Stream4.fail(error.value);
2968
+ }
2963
2969
  return Stream4.make(Response9.makePart("error", { error: error.value }));
2964
2970
  }));
2965
2971
  return rawParts.pipe(Stream4.mapEffect((part) => transformPart(turn, part)), Stream4.flatMap(Option13.match({ onNone: () => Stream4.empty, onSome: Stream4.make })), Stream4.map((part) => ({
@@ -3200,7 +3206,7 @@ var streamInternal = (agent, options, structured) => Stream4.unwrap(Effect23.gen
3200
3206
  }));
3201
3207
  })).pipe(Stream4.withSpan("Baton.Agent.run", { attributes: { "baton.agent.name": agent.name } }));
3202
3208
 
3203
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent.js
3209
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent.js
3204
3210
  var AgentTypeId = Symbol.for("@batonfx/core/Agent");
3205
3211
  function make5(options) {
3206
3212
  const declaredTools = "tools" in options && Array.isArray(options.tools) ? options.tools : undefined;
@@ -3265,7 +3271,7 @@ var generate = dual6(2, (agent, options) => options.output === undefined ? gener
3265
3271
  objectPrompt: options.output.prompt ?? defaultObjectPrompt
3266
3272
  }));
3267
3273
 
3268
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/agent-tool.js
3274
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/agent-tool.js
3269
3275
  var exports_agent_tool = {};
3270
3276
  __export(exports_agent_tool, {
3271
3277
  asTool: () => asTool
@@ -3336,7 +3342,7 @@ var asTool = Function7.dual((args) => args.length !== 1 || ("name" in args[0]),
3336
3342
  return lazyHandled(toolkit, name, handler);
3337
3343
  });
3338
3344
 
3339
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/guardrail.js
3345
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/guardrail.js
3340
3346
  var exports_guardrail = {};
3341
3347
  __export(exports_guardrail, {
3342
3348
  validateInput: () => validateInput,
@@ -3417,7 +3423,7 @@ var filterOutput = (keep) => ({
3417
3423
  transformPart: (part, context) => Effect26.succeed(part.type === "tool-call" || keep(part, context) ? Option15.some(part) : Option15.none())
3418
3424
  });
3419
3425
 
3420
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/handoff.js
3426
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/handoff.js
3421
3427
  var exports_handoff = {};
3422
3428
  __export(exports_handoff, {
3423
3429
  transferTool: () => transferTool,
@@ -3497,7 +3503,7 @@ var supervisor = (options) => {
3497
3503
  };
3498
3504
  };
3499
3505
 
3500
- // ../../node_modules/.bun/@batonfx+core@0.9.0/node_modules/@batonfx/core/dist/index.js
3506
+ // ../../node_modules/.bun/@batonfx+core@0.9.1/node_modules/@batonfx/core/dist/index.js
3501
3507
  import { AiError as AiError7, Chat as Chat4, EmbeddingModel, IdGenerator, LanguageModel as LanguageModel9, Model as Model2, Prompt as Prompt16, Response as Response11, ResponseIdTracker, Telemetry as Telemetry2, Tokenizer as Tokenizer3, Tool as Tool13, Toolkit as Toolkit8 } from "effect/unstable/ai";
3502
3508
 
3503
3509
  export { exports_turn_policy, exports_agent_event, exports_memory, 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, AiError7 as AiError, Chat4 as Chat, EmbeddingModel, IdGenerator, Model2 as Model, Prompt16 as Prompt, Response11 as Response, ResponseIdTracker, Telemetry2 as Telemetry, Tokenizer3 as Tokenizer, Tool13 as Tool, Toolkit8 as Toolkit };
@@ -8,7 +8,7 @@ import {
8
8
  SqlFailure,
9
9
  make,
10
10
  normalizeAcquisitionCause
11
- } from "./index-96b7htye.js";
11
+ } from "./index-ftgf8py0.js";
12
12
 
13
13
  // src/migration-errors.ts
14
14
  import { Cause, Effect, Function } from "effect";
@@ -16,7 +16,7 @@ import {
16
16
  exports_tool_executor,
17
17
  exports_tool_output,
18
18
  exports_turn_policy
19
- } from "./index-c6jave5p.js";
19
+ } from "./index-5vjhqzbk.js";
20
20
  import {
21
21
  ClientError,
22
22
  EventLogCursorNotFound,
@@ -6187,6 +6187,7 @@ __export(exports_session_repository, {
6187
6187
  touch: () => touch,
6188
6188
  testLayer: () => testLayer29,
6189
6189
  setLeaf: () => setLeaf,
6190
+ releaseWriter: () => releaseWriter,
6190
6191
  path: () => path,
6191
6192
  memoryLayer: () => memoryLayer26,
6192
6193
  list: () => list10,
@@ -6197,6 +6198,7 @@ __export(exports_session_repository, {
6197
6198
  ensure: () => ensure,
6198
6199
  create: () => create5,
6199
6200
  countEntries: () => countEntries,
6201
+ claimWriter: () => claimWriter,
6200
6202
  appendEntry: () => appendEntry,
6201
6203
  appendCheckpoint: () => appendCheckpoint,
6202
6204
  SessionRow: () => SessionRow,
@@ -7150,6 +7152,14 @@ var ensure = Effect41.fn("SessionRepository.ensure.call")(function* (input) {
7150
7152
  const repository = yield* Service35;
7151
7153
  return yield* repository.ensure(input);
7152
7154
  });
7155
+ var claimWriter = Effect41.fn("SessionRepository.claimWriter.call")(function* (input) {
7156
+ const repository = yield* Service35;
7157
+ return yield* repository.claimWriter(input);
7158
+ });
7159
+ var releaseWriter = Effect41.fn("SessionRepository.releaseWriter.call")(function* (input) {
7160
+ const repository = yield* Service35;
7161
+ return yield* repository.releaseWriter(input);
7162
+ });
7153
7163
  var get9 = Effect41.fn("SessionRepository.get.call")(function* (id) {
7154
7164
  const repository = yield* Service35;
7155
7165
  return yield* repository.get(id);
package/dist/index.js CHANGED
@@ -14,10 +14,10 @@ import {
14
14
  exports_tool_runtime,
15
15
  exports_workflow_definition_host,
16
16
  makeDatabaseIdentity
17
- } from "./index-96b7htye.js";
17
+ } from "./index-ftgf8py0.js";
18
18
  import {
19
19
  exports_model_registry
20
- } from "./index-c6jave5p.js";
20
+ } from "./index-5vjhqzbk.js";
21
21
  import {
22
22
  ClientError,
23
23
  EventLogCursorNotFound,
@@ -178,7 +178,7 @@ import { OpenAiLanguageModel as OpenAiLanguageModel4 } from "@effect/ai-openai";
178
178
  import { OpenAiLanguageModel as OpenAiCompatibleLanguageModel } from "@effect/ai-openai-compat";
179
179
  import { OpenRouterLanguageModel as OpenRouterLanguageModel2 } from "@effect/ai-openrouter";
180
180
 
181
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/anthropic.js
181
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/anthropic.js
182
182
  import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
183
183
  import { Config, Layer as Layer2, Redacted } from "effect";
184
184
  import { AiError } from "effect/unstable/ai";
@@ -203,13 +203,13 @@ var layer2 = (input) => exports_model_registry.layer([
203
203
  ]).pipe(Layer2.provide(AnthropicClient.layerConfig({ ...input.clientConfig, apiKey: input.apiKey })));
204
204
  var layerConfig = AnthropicClient.layerConfig;
205
205
 
206
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/deterministic.js
206
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/deterministic.js
207
207
  import { OpenAiClient as OpenAiClient2, OpenAiLanguageModel as OpenAiLanguageModel2 } from "@effect/ai-openai";
208
208
  import { Config as Config3, Effect as Effect4, Layer as Layer4, Option as Option2, Stream as Stream2 } from "effect";
209
209
  import { LanguageModel, Response as Response2 } from "effect/unstable/ai";
210
210
  import { HttpClient as HttpClient2 } from "effect/unstable/http";
211
211
 
212
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/openai.js
212
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/openai.js
213
213
  import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai";
214
214
  import { Config as Config2, Effect as Effect3, Function, Layer as Layer3, Option, Redacted as Redacted2, Schema, Stream } from "effect";
215
215
  import { AiError as AiError2 } from "effect/unstable/ai";
@@ -218,7 +218,24 @@ var openAiAccountApiUrl = "https://chatgpt.com/backend-api/codex";
218
218
  var openAiAccountResponsesUrl = `${openAiAccountApiUrl}/responses`;
219
219
  var openAiAccountIdHeader = "ChatGPT-Account-ID";
220
220
  var contextOverflowCodes = new Set(["context_length_exceeded", "context_window_exceeded", "input_too_long"]);
221
+ var responseErrorCode = (error) => {
222
+ if (typeof error !== "object" || error === null || Array.isArray(error))
223
+ return;
224
+ const event = error;
225
+ if (event.type !== "error")
226
+ return;
227
+ if (typeof event.code === "string")
228
+ return event.code;
229
+ const details = event.error;
230
+ if (typeof details !== "object" || details === null || Array.isArray(details))
231
+ return;
232
+ const code = details.code;
233
+ return typeof code === "string" ? code : undefined;
234
+ };
221
235
  var classifyFailure2 = (error) => {
236
+ const eventCode = responseErrorCode(error);
237
+ if (eventCode !== undefined && contextOverflowCodes.has(eventCode))
238
+ return "context-overflow";
222
239
  if (!AiError2.isAiError(error))
223
240
  return "other";
224
241
  const reason = error.reason;
@@ -372,7 +389,7 @@ var registrationAccount = (input) => exports_model_registry.registration({
372
389
  });
373
390
  var layerAccount = (input) => exports_model_registry.layer([registrationAccount(input)]);
374
391
 
375
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/deterministic.js
392
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/deterministic.js
376
393
  var deterministicModelLayer = Layer4.effect(LanguageModel.LanguageModel, LanguageModel.make({
377
394
  generateText: () => Effect4.succeed([{ type: "text", text: "deterministic response" }]),
378
395
  streamText: () => Stream2.make(Response2.makePart("text-delta", { id: "text", delta: "deterministic response" }))
@@ -414,7 +431,7 @@ var layerOpenAi = (options) => Layer4.unwrap(Effect4.gen(function* () {
414
431
  ]);
415
432
  }));
416
433
 
417
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/openai-compat.js
434
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/openai-compat.js
418
435
  import { OpenAiClient as OpenAiClient3, OpenAiLanguageModel as OpenAiLanguageModel3 } from "@effect/ai-openai-compat";
419
436
  import { Config as Config4, Layer as Layer5, Redacted as Redacted3 } from "effect";
420
437
  var layer5 = (input) => exports_model_registry.layer([
@@ -436,7 +453,7 @@ var layer5 = (input) => exports_model_registry.layer([
436
453
  })));
437
454
  var layerConfig3 = OpenAiClient3.layerConfig;
438
455
 
439
- // ../../node_modules/.bun/@batonfx+providers@0.9.0/node_modules/@batonfx/providers/dist/openrouter.js
456
+ // ../../node_modules/.bun/@batonfx+providers@0.9.1/node_modules/@batonfx/providers/dist/openrouter.js
440
457
  import { OpenRouterClient, OpenRouterLanguageModel } from "@effect/ai-openrouter";
441
458
  import { Config as Config5, Layer as Layer6, Redacted as Redacted4 } from "effect";
442
459
  import { AiError as AiError3 } from "effect/unstable/ai";
package/dist/mysql.js CHANGED
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-0jx86sx3.js";
5
+ } from "./index-dm4yqr8f.js";
6
6
  import {
7
7
  MigratorError,
8
8
  RuntimeMigrationError,
9
9
  SqlFailure
10
- } from "./index-96b7htye.js";
11
- import"./index-c6jave5p.js";
10
+ } from "./index-ftgf8py0.js";
11
+ import"./index-5vjhqzbk.js";
12
12
  import"./index-fh2ftte9.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-0jx86sx3.js";
5
+ } from "./index-dm4yqr8f.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-96b7htye.js";
18
- import"./index-c6jave5p.js";
17
+ } from "./index-ftgf8py0.js";
18
+ import"./index-5vjhqzbk.js";
19
19
  import {
20
20
  exports_ids_schema
21
21
  } from "./index-fh2ftte9.js";
@@ -748,7 +748,7 @@ var relayIdempotencyKeys = pgTable13("relay_idempotency_keys", {
748
748
  uniqueIndex9("uq_relay_idempotency_scope_operation_key").on(table.tenantId, table.scope, table.operation, table.key)
749
749
  ]);
750
750
  // src/postgres.ts
751
- var schemaHead = "20260721120000_steering_delivered";
751
+ var schemaHead = "20260721170000_session_writer_ownership";
752
752
  var migrationNames = [
753
753
  "20260701002839_sour_cerebro",
754
754
  "20260701041134_acoustic_hulk",
@@ -777,6 +777,7 @@ var migrationNames = [
777
777
  "20260712200000_workflow_runtime",
778
778
  "20260718140000_execution_scoped_tool_calls",
779
779
  "20260719120000_rename_entity_to_resident",
780
+ "20260721120000_steering_delivered",
780
781
  schemaHead
781
782
  ];
782
783
  var migrationsFolderUrl = import.meta.url.endsWith("/src/postgres.ts") ? new URL("../../../migrations/pg", import.meta.url) : new URL("./migrations/pg", import.meta.url);
package/dist/sqlite.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-0jx86sx3.js";
5
+ } from "./index-dm4yqr8f.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-96b7htye.js";
16
- import"./index-c6jave5p.js";
15
+ } from "./index-ftgf8py0.js";
16
+ import"./index-5vjhqzbk.js";
17
17
  import"./index-fh2ftte9.js";
18
18
  import"./index-nb39b5ae.js";
19
19
 
@@ -295,6 +295,8 @@ export declare const memoryLayer: Layer.Layer<Service, never, never>;
295
295
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
296
296
  export declare const create: (input: CreateSessionInput) => Effect.Effect<SessionRecord, DuplicateSession | SessionRepositoryError, Service>;
297
297
  export declare const ensure: (input: EnsureSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError, Service>;
298
+ export declare const claimWriter: (input: ClaimSessionWriterInput) => Effect.Effect<ClaimSessionWriterResult, SessionRepositoryError, Service>;
299
+ export declare const releaseWriter: (input: ReleaseSessionWriterInput) => Effect.Effect<void, SessionRepositoryError, Service>;
298
300
  export declare const get: (id: string & import("effect/Brand").Brand<"Relay.SessionId">) => Effect.Effect<SessionRecord | undefined, SessionRepositoryError, Service>;
299
301
  export declare const list: (input: ListSessionsInput) => Effect.Effect<ListSessionsResult, SessionRepositoryError, Service>;
300
302
  export declare const touch: (input: TouchSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError, Service>;
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.6.0",
4
+ "version": "0.6.1",
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.9.0",
61
- "@batonfx/providers": "0.9.0",
60
+ "@batonfx/core": "0.9.1",
61
+ "@batonfx/providers": "0.9.1",
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",