@relayfx/sdk 0.7.4 → 0.7.5

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.
@@ -1066,6 +1066,16 @@ var encodePrompt = (prompt) => {
1066
1066
  content: encoded.content.map((message, messageIndex) => encodeMessage(prompt, message, messageIndex))
1067
1067
  });
1068
1068
  };
1069
+ var encodePromptMessage = (message) => {
1070
+ const encoded = encodePrompt(Prompt2.fromMessages([message]));
1071
+ if (typeof encoded !== "object" || encoded === null || !("content" in encoded) || !Array.isArray(encoded.content)) {
1072
+ throw new TypeError("Encoded prompt did not contain a message");
1073
+ }
1074
+ const value = encoded.content[0];
1075
+ if (value === undefined)
1076
+ throw new TypeError("Encoded prompt did not contain a message");
1077
+ return value;
1078
+ };
1069
1079
  var decodePrompt = (value) => {
1070
1080
  const content = typeof value === "object" && value !== null && !Array.isArray(value) && "content" in value ? value.content : undefined;
1071
1081
  const decodedContent = Array.isArray(content) ? content.map((message) => {
@@ -1078,6 +1088,8 @@ var decodePrompt = (value) => {
1078
1088
  if (typeof part !== "object" || part === null || Array.isArray(part) || part.type !== "file") {
1079
1089
  return part;
1080
1090
  }
1091
+ if (typeof part.data === "string")
1092
+ return part;
1081
1093
  const data = Schema14.decodeUnknownSync(FileDataWire)(part.data);
1082
1094
  return {
1083
1095
  ...part,
@@ -1088,6 +1100,12 @@ var decodePrompt = (value) => {
1088
1100
  }) : content;
1089
1101
  return Schema14.decodeUnknownSync(Prompt2.Prompt)({ content: decodedContent });
1090
1102
  };
1103
+ var decodePromptMessage = (value) => {
1104
+ const message = decodePrompt({ content: [value] }).content[0];
1105
+ if (message === undefined)
1106
+ throw new TypeError("Decoded prompt did not contain a message");
1107
+ return message;
1108
+ };
1091
1109
 
1092
1110
  // ../store-sql/src/chat/agent-chat-repository.ts
1093
1111
  class AgentChatRepositoryError extends Schema15.TaggedErrorClass()("AgentChatRepositoryError", {
@@ -6393,7 +6411,7 @@ var makeSessionEntryRecords = (errors) => {
6393
6411
  switch (input._tag) {
6394
6412
  case "Message":
6395
6413
  return {
6396
- message: input.message,
6414
+ message: encodePromptMessage(input.message),
6397
6415
  ...input.metadata === undefined ? {} : { metadata: input.metadata }
6398
6416
  };
6399
6417
  case "ToolCall":
@@ -6419,7 +6437,7 @@ var makeSessionEntryRecords = (errors) => {
6419
6437
  };
6420
6438
  case "Steering":
6421
6439
  return {
6422
- message: input.message,
6440
+ message: encodePromptMessage(input.message),
6423
6441
  ...input.metadata === undefined ? {} : { metadata: input.metadata }
6424
6442
  };
6425
6443
  case "Handoff":
@@ -6459,10 +6477,13 @@ var makeSessionEntryRecords = (errors) => {
6459
6477
  };
6460
6478
  switch (row.tag) {
6461
6479
  case "Message":
6462
- return Effect39.succeed({
6463
- ...base,
6464
- _tag: "Message",
6465
- message: payload.message
6480
+ return Effect39.try({
6481
+ try: () => ({
6482
+ ...base,
6483
+ _tag: "Message",
6484
+ message: decodePromptMessage(payload.message)
6485
+ }),
6486
+ catch: (error5) => SessionRepositoryError.make({ message: `Invalid Session message: ${String(error5)}` })
6466
6487
  });
6467
6488
  case "ToolCall":
6468
6489
  return Effect39.succeed({
@@ -6490,10 +6511,13 @@ var makeSessionEntryRecords = (errors) => {
6490
6511
  body: String(payload.body ?? "")
6491
6512
  });
6492
6513
  case "Steering":
6493
- return Effect39.succeed({
6494
- ...base,
6495
- _tag: "Steering",
6496
- message: payload.message
6514
+ return Effect39.try({
6515
+ try: () => ({
6516
+ ...base,
6517
+ _tag: "Steering",
6518
+ message: decodePromptMessage(payload.message)
6519
+ }),
6520
+ catch: (error5) => SessionRepositoryError.make({ message: `Invalid Session steering message: ${String(error5)}` })
6497
6521
  });
6498
6522
  case "Handoff":
6499
6523
  return Effect39.succeed({
@@ -8,7 +8,7 @@ import {
8
8
  SqlFailure,
9
9
  make,
10
10
  normalizeAcquisitionCause
11
- } from "./index-8jjqgjhf.js";
11
+ } from "./index-6rpm95kc.js";
12
12
 
13
13
  // src/migration-errors.ts
14
14
  import { Cause, Effect, Function } from "effect";
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-8jjqgjhf.js";
17
+ } from "./index-6rpm95kc.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-ex8w3c48.js";
5
+ } from "./index-m8bs31hg.js";
6
6
  import {
7
7
  MigratorError,
8
8
  RuntimeMigrationError,
9
9
  SqlFailure
10
- } from "./index-8jjqgjhf.js";
10
+ } from "./index-6rpm95kc.js";
11
11
  import"./index-etc2cnk2.js";
12
12
  import"./index-nb078xsy.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-ex8w3c48.js";
5
+ } from "./index-m8bs31hg.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-8jjqgjhf.js";
17
+ } from "./index-6rpm95kc.js";
18
18
  import"./index-etc2cnk2.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-ex8w3c48.js";
5
+ } from "./index-m8bs31hg.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-8jjqgjhf.js";
15
+ } from "./index-6rpm95kc.js";
16
16
  import"./index-etc2cnk2.js";
17
17
  import"./index-nb078xsy.js";
18
18
  import"./index-nb39b5ae.js";
@@ -1,4 +1,6 @@
1
1
  import { Shared } from "../schema/index";
2
2
  import { Prompt } from "effect/unstable/ai";
3
3
  export declare const encodePrompt: (prompt: Prompt.Prompt) => Shared.JsonValue;
4
+ export declare const encodePromptMessage: (message: Prompt.Message) => Shared.JsonValue;
4
5
  export declare const decodePrompt: (value: Shared.JsonValue) => Prompt.Prompt;
6
+ export declare const decodePromptMessage: (value: Shared.JsonValue) => Prompt.Message;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@relayfx/sdk",
4
- "version": "0.7.4",
4
+ "version": "0.7.5",
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.4",
78
+ "@relayfx/schema": "0.7.5",
79
79
  "@relayfx/store-sql": "0.0.0",
80
80
  "@types/bun": "1.3.14",
81
81
  "typescript": "7.0.2",