@maximem/synap-js-sdk 0.5.16 → 0.5.17

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/index.cjs CHANGED
@@ -1332,6 +1332,9 @@ function buildRecordMessageBody(options) {
1332
1332
  if (!conversationId) throw new (0, _chunkUXNVTP4Dcjs.InvalidInputError)("conversation_id is required");
1333
1333
  validateConversationId(conversationId);
1334
1334
  if (!options.role) throw new (0, _chunkUXNVTP4Dcjs.InvalidInputError)("role is required");
1335
+ if (!MESSAGE_ROLES.includes(options.role)) {
1336
+ throw new (0, _chunkUXNVTP4Dcjs.InvalidInputError)(`Invalid role '${options.role}'. Must be 'user' or 'assistant'.`);
1337
+ }
1335
1338
  if (options.content === void 0 || options.content === null) {
1336
1339
  throw new (0, _chunkUXNVTP4Dcjs.InvalidInputError)("content is required");
1337
1340
  }
@@ -1346,9 +1349,11 @@ function buildRecordMessageBody(options) {
1346
1349
  metadata: _nullishCoalesce(options.metadata, () => ( {}))
1347
1350
  };
1348
1351
  const sessionId = either2(o2, "session_id", "sessionId");
1349
- if (sessionId !== void 0) body["session_id"] = sessionId;
1352
+ if (sessionId) body["session_id"] = sessionId;
1350
1353
  const scopePath = either2(o2, "scope_path", "scopePath");
1351
- if (scopePath !== void 0) body["scope"] = scopePath;
1354
+ if (scopePath !== void 0 && scopePath !== null && Object.keys(scopePath).length > 0) {
1355
+ body["scope"] = scopePath;
1356
+ }
1352
1357
  return body;
1353
1358
  }
1354
1359
  function buildIngestTranscriptBody(options) {
@@ -1448,6 +1453,7 @@ function storedBatchRows(bodies, result) {
1448
1453
  });
1449
1454
  return pairs;
1450
1455
  }
1456
+ var MESSAGE_ROLES = ["user", "assistant"];
1451
1457
  var PROMPT_STYLES = ["structured", "narrative", "bullet_points"];
1452
1458
  function createConversationNamespace(transport, subscribers = new CompactionSubscribers(), onWrite = () => {
1453
1459
  }, onTurn = () => {
@@ -2023,7 +2029,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
2023
2029
  }
2024
2030
 
2025
2031
  // src/version.ts
2026
- var SDK_VERSION = "0.5.16";
2032
+ var SDK_VERSION = "0.5.17";
2027
2033
 
2028
2034
  // src/registry.ts
2029
2035
  var instances = /* @__PURE__ */ new Map();