@relayfx/sdk 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import {
8
8
  SqlFailure,
9
9
  make,
10
10
  normalizeAcquisitionCause
11
- } from "./index-n5sqnw4s.js";
11
+ } from "./index-sp77tb7c.js";
12
12
 
13
13
  // src/migration-errors.ts
14
14
  import { Cause, Effect, Function } from "effect";
@@ -6308,8 +6308,11 @@ var encodeCheckpointPrompt = (prompt) => Schema38.encodeSync(CheckpointPromptWir
6308
6308
  prompt: encodePrompt(prompt)
6309
6309
  });
6310
6310
  var CheckpointTelemetryWire = Schema38.Array(exports_model_telemetry.Event);
6311
- var encodeCheckpointTelemetry = Schema38.encodeSync(CheckpointTelemetryWire);
6312
- var decodeCheckpointTelemetry = Schema38.decodeUnknownSync(CheckpointTelemetryWire);
6311
+ var encodeTelemetryEvents = Schema38.encodeSync(CheckpointTelemetryWire);
6312
+ var jsonRoundTrip = Schema38.encodeSync(Schema38.UnknownFromJsonString);
6313
+ var canonicalJson = (value) => JSON.parse(jsonRoundTrip(value));
6314
+ var encodeCheckpointTelemetry = (telemetry) => canonicalJson(encodeTelemetryEvents(telemetry));
6315
+ var decodeCheckpointTelemetry = (value) => Array.isArray(value) ? value : [];
6313
6316
  var CheckpointCommitWire = exports_model_telemetry.CompactionCommit;
6314
6317
  var encodeCheckpointCommit = Schema38.encodeSync(CheckpointCommitWire);
6315
6318
  var decodeCheckpointCommit = Schema38.decodeUnknownSync(CheckpointCommitWire);
@@ -6517,7 +6520,7 @@ var makeSessionEntryRecords = (errors) => {
6517
6520
  }
6518
6521
  };
6519
6522
  const promptEquivalence = (left, right) => exports_shared_schema.canonicalEquals(encodeCheckpointPrompt(left), encodeCheckpointPrompt(right));
6520
- const telemetryEquivalence = (left, right) => exports_shared_schema.canonicalEquals(encodeCheckpointTelemetry(left), encodeCheckpointTelemetry(right));
6523
+ const telemetryEquivalence = (left, right) => exports_shared_schema.canonicalEquals(canonicalJson(left), canonicalJson(right));
6521
6524
  const commitEquivalence = (left, right) => {
6522
6525
  if (left._tag !== "Compaction" || left.version !== 2 || right._tag !== "Compaction" || right.version !== 2) {
6523
6526
  return false;
@@ -6525,7 +6528,7 @@ var makeSessionEntryRecords = (errors) => {
6525
6528
  if (left.compactionCommit === undefined || right.compactionCommit === undefined) {
6526
6529
  return left.compactionCommit === right.compactionCommit;
6527
6530
  }
6528
- return exports_shared_schema.canonicalEquals(encodeCheckpointCommit(left.compactionCommit), encodeCheckpointCommit(right.compactionCommit));
6531
+ return exports_shared_schema.canonicalEquals(canonicalJson(left.compactionCommit), canonicalJson(right.compactionCommit));
6529
6532
  };
6530
6533
  const sameEntry = (left, right) => {
6531
6534
  if (left._tag === "Compaction" && left.version === 2 && right._tag === "Compaction" && right.version === 2) {
@@ -6899,6 +6902,11 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
6899
6902
  createdAt: input.createdAt
6900
6903
  };
6901
6904
  const desired = appendToRecord2(appendInput);
6905
+ const withRequestedTelemetry = (record2) => ({
6906
+ ...record2,
6907
+ telemetry: input.telemetry,
6908
+ ...input.compactionCommit === undefined ? {} : { compactionCommit: input.compactionCommit }
6909
+ });
6902
6910
  if (existing !== undefined) {
6903
6911
  if (!sameEntry(existing, desired) || existing._tag !== "Compaction" || existing.version !== 2) {
6904
6912
  return yield* conflict4("checkpoint-id-reused", `Session checkpoint id ${input.id} was reused with different content`);
@@ -6909,7 +6917,7 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
6909
6917
  }
6910
6918
  return {
6911
6919
  _tag: "AlreadyPresent",
6912
- checkpoint: existing,
6920
+ checkpoint: withRequestedTelemetry(existing),
6913
6921
  leafId: currentLeaf(session) ?? existing.id
6914
6922
  };
6915
6923
  }
@@ -6922,7 +6930,7 @@ var makeSessionRepository = (errors) => Effect40.gen(function* () {
6922
6930
  return yield* SessionRepositoryError.make({ message: "Session checkpoint insert returned no row" });
6923
6931
  }
6924
6932
  yield* updateLeaf(tenantId, { sessionId: input.sessionId, id: input.id, updatedAt: input.createdAt });
6925
- return { _tag: "Appended", checkpoint: inserted, leafId: inserted.id };
6933
+ return { _tag: "Appended", checkpoint: withRequestedTelemetry(inserted), leafId: inserted.id };
6926
6934
  })));
6927
6935
  });
6928
6936
  const countEntries = Effect40.fn("SessionRepository.countEntries")(function* (sessionId) {
@@ -13044,7 +13052,6 @@ class AgentLoopError extends Schema67.TaggedErrorClass()("AgentLoopError", {
13044
13052
  message: Schema67.String,
13045
13053
  failure_classification: Schema67.optionalKey(Schema67.Literal("context-overflow")),
13046
13054
  baton_failure: Schema67.optionalKey(Schema67.Union([
13047
- exports_model_telemetry.DeliveryFailed,
13048
13055
  exports_agent_event.AgentError,
13049
13056
  exports_agent_event.ResumeMismatch,
13050
13057
  exports_turn_policy.TurnPolicyError,
@@ -16423,10 +16430,14 @@ var mapBatonRunError = (error5, current2) => {
16423
16430
  next_event_sequence: current2
16424
16431
  });
16425
16432
  }
16433
+ if (Schema85.is(exports_model_telemetry.DeliveryFailed)(error5)) {
16434
+ return AgentLoopError.make({
16435
+ message: `Telemetry delivery failed: ${error5.message}`,
16436
+ next_event_sequence: current2
16437
+ });
16438
+ }
16426
16439
  let message;
16427
- if (Schema85.is(exports_model_telemetry.DeliveryFailed)(error5))
16428
- message = `Telemetry delivery failed: ${error5.message}`;
16429
- else if (Schema85.is(exports_agent_event.AgentError)(error5))
16440
+ if (Schema85.is(exports_agent_event.AgentError)(error5))
16430
16441
  message = error5.message;
16431
16442
  else if (Schema85.is(exports_agent_event.ResumeMismatch)(error5))
16432
16443
  message = `Resume mismatch: ${error5.reason}`;
@@ -16456,7 +16467,7 @@ var mapBatonRunError = (error5, current2) => {
16456
16467
  }
16457
16468
  return AgentLoopError.make({ message, baton_failure: error5, next_event_sequence: current2 });
16458
16469
  };
16459
- var isBatonRunError = (error5) => Schema85.is(exports_agent_event.AgentSuspended)(error5) || Schema85.is(exports_agent_event.ResumeMismatch)(error5) || Schema85.is(exports_turn_policy.TurnPolicyError)(error5) || Schema85.is(exports_agent_event.TurnPolicyStopped)(error5) || Schema85.is(exports_agent_event.TurnLimitExceeded)(error5) || Schema85.is(exports_agent_event.MiddlewareViolation)(error5) || Schema85.is(exports_agent_event.DuplicateToolCallId)(error5) || Schema85.is(exports_agent_event.ProgressOverflow)(error5) || Schema85.is(exports_agent_event.ToolNameCollision)(error5) || Schema85.is(exports_agent_event.AgentError)(error5) || Schema85.is(AiError3.AiError)(error5) || Schema85.is(exports_model_registry.LanguageModelNotRegistered)(error5) || Schema85.is(exports_tool_executor.FrameworkFailure)(error5);
16470
+ var isBatonRunError = (error5) => Schema85.is(exports_model_telemetry.DeliveryFailed)(error5) || Schema85.is(exports_agent_event.AgentSuspended)(error5) || Schema85.is(exports_agent_event.ResumeMismatch)(error5) || Schema85.is(exports_turn_policy.TurnPolicyError)(error5) || Schema85.is(exports_agent_event.TurnPolicyStopped)(error5) || Schema85.is(exports_agent_event.TurnLimitExceeded)(error5) || Schema85.is(exports_agent_event.MiddlewareViolation)(error5) || Schema85.is(exports_agent_event.DuplicateToolCallId)(error5) || Schema85.is(exports_agent_event.ProgressOverflow)(error5) || Schema85.is(exports_agent_event.ToolNameCollision)(error5) || Schema85.is(exports_agent_event.AgentError)(error5) || Schema85.is(AiError3.AiError)(error5) || Schema85.is(exports_model_registry.LanguageModelNotRegistered)(error5) || Schema85.is(exports_tool_executor.FrameworkFailure)(error5);
16460
16471
  var mapBoundaryError = (errorOrCurrent, current2, failureClassification) => {
16461
16472
  if (current2 === undefined) {
16462
16473
  const sequence = errorOrCurrent;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  exports_tool_runtime,
15
15
  exports_workflow_definition_host,
16
16
  makeDatabaseIdentity
17
- } from "./index-n5sqnw4s.js";
17
+ } from "./index-sp77tb7c.js";
18
18
  import {
19
19
  exports_context_overflow,
20
20
  exports_model_registry
package/dist/mysql.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-7mmmxqw7.js";
5
+ } from "./index-75gb7ftn.js";
6
6
  import {
7
7
  MigratorError,
8
8
  RuntimeMigrationError,
9
9
  SqlFailure
10
- } from "./index-n5sqnw4s.js";
10
+ } from "./index-sp77tb7c.js";
11
11
  import"./index-qa93yf6j.js";
12
12
  import"./index-q7xzf506.js";
13
13
  import"./index-nb39b5ae.js";
package/dist/postgres.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-7mmmxqw7.js";
5
+ } from "./index-75gb7ftn.js";
6
6
  import {
7
7
  Dialect,
8
8
  RuntimeMigrationError,
@@ -14,7 +14,7 @@ import {
14
14
  fromDbTimestamp,
15
15
  fromNullableDbTimestamp,
16
16
  timestampParam
17
- } from "./index-n5sqnw4s.js";
17
+ } from "./index-sp77tb7c.js";
18
18
  import"./index-qa93yf6j.js";
19
19
  import {
20
20
  exports_ids_schema
package/dist/sqlite.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-7mmmxqw7.js";
5
+ } from "./index-75gb7ftn.js";
6
6
  import {
7
7
  DatabaseAlreadyOwned,
8
8
  RuntimeConfigurationError,
@@ -12,7 +12,7 @@ import {
12
12
  make,
13
13
  makeDatabaseIdentity,
14
14
  runtimeLayer
15
- } from "./index-n5sqnw4s.js";
15
+ } from "./index-sp77tb7c.js";
16
16
  import"./index-qa93yf6j.js";
17
17
  import"./index-q7xzf506.js";
18
18
  import"./index-nb39b5ae.js";
@@ -1,10 +1,10 @@
1
- import { AgentEvent, ModelRegistry, ModelTelemetry, ToolExecutor, TurnPolicy } from "@batonfx/core";
1
+ import { AgentEvent, ModelRegistry, ToolExecutor, TurnPolicy } from "@batonfx/core";
2
2
  import { Schema } from "effect";
3
3
  import { AiError } from "effect/unstable/ai";
4
4
  declare const AgentLoopError_base: Schema.Class<AgentLoopError, Schema.TaggedStruct<"AgentLoopError", {
5
5
  readonly message: Schema.String;
6
6
  readonly failure_classification: Schema.optionalKey<Schema.Literal<"context-overflow">>;
7
- readonly baton_failure: Schema.optionalKey<Schema.Union<readonly [typeof ModelTelemetry.DeliveryFailed, typeof AgentEvent.AgentError, typeof AgentEvent.ResumeMismatch, typeof TurnPolicy.TurnPolicyError, typeof AgentEvent.TurnPolicyStopped, typeof AgentEvent.TurnLimitExceeded, typeof AgentEvent.MiddlewareViolation, typeof AgentEvent.DuplicateToolCallId, typeof AgentEvent.ProgressOverflow, typeof AgentEvent.ToolNameCollision, typeof AiError.AiError, typeof ModelRegistry.LanguageModelNotRegistered, typeof ToolExecutor.FrameworkFailure]>>;
7
+ readonly baton_failure: Schema.optionalKey<Schema.Union<readonly [typeof AgentEvent.AgentError, typeof AgentEvent.ResumeMismatch, typeof TurnPolicy.TurnPolicyError, typeof AgentEvent.TurnPolicyStopped, typeof AgentEvent.TurnLimitExceeded, typeof AgentEvent.MiddlewareViolation, typeof AgentEvent.DuplicateToolCallId, typeof AgentEvent.ProgressOverflow, typeof AgentEvent.ToolNameCollision, typeof AiError.AiError, typeof ModelRegistry.LanguageModelNotRegistered, typeof ToolExecutor.FrameworkFailure]>>;
8
8
  readonly next_event_sequence: Schema.optionalKey<Schema.Int>;
9
9
  }>, import("effect/Cause").YieldableError>;
10
10
  export declare class AgentLoopError extends AgentLoopError_base {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@relayfx/sdk",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "description": "Effect-native durable execution SDK for addressable agents and tools",
6
6
  "type": "module",
7
7
  "exports": {
@@ -75,7 +75,7 @@
75
75
  "@effect/vitest": "4.0.0-beta.98",
76
76
  "@relayfx/ai": "0.0.0",
77
77
  "@relayfx/runtime": "0.0.0",
78
- "@relayfx/schema": "0.7.0",
78
+ "@relayfx/schema": "0.7.2",
79
79
  "@relayfx/store-sql": "0.0.0",
80
80
  "@types/bun": "1.3.14",
81
81
  "typescript": "7.0.2",