@maximem/synap-js-sdk 0.5.15 → 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/anticipation-cache-LPNKMRBH.cjs.map +1 -1
- package/dist/chunk-ICUFS3B5.cjs.map +1 -1
- package/dist/chunk-QHPVLTQ7.cjs.map +1 -1
- package/dist/chunk-UXNVTP4D.cjs.map +1 -1
- package/dist/chunk-ZKOJDUN4.cjs.map +1 -1
- package/dist/env-55ULHNJZ.cjs.map +1 -1
- package/dist/grpc/index.cjs.map +1 -1
- package/dist/index.cjs +42 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/onnx-encoder-4RSL6ID4.cjs.map +1 -1
- package/dist/stream-client-5GYUWETN.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1067,6 +1067,12 @@ interface TranscriptIngestResult {
|
|
|
1067
1067
|
status: 'queued' | 'duplicate';
|
|
1068
1068
|
turns_recorded: number;
|
|
1069
1069
|
summary_status: 'in_progress' | 'already_compacted' | 'skipped';
|
|
1070
|
+
/**
|
|
1071
|
+
* What the server could not do with this push: no event time supplied
|
|
1072
|
+
* (recency ranking cannot order these memories), or existing turns kept.
|
|
1073
|
+
* Always a list. Since 0.5.16.
|
|
1074
|
+
*/
|
|
1075
|
+
warnings: string[];
|
|
1070
1076
|
/** ISO-8601. */
|
|
1071
1077
|
queued_at: string;
|
|
1072
1078
|
[key: string]: unknown;
|
|
@@ -1873,7 +1879,7 @@ declare class SynapClient {
|
|
|
1873
1879
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1874
1880
|
* publish safe.
|
|
1875
1881
|
*/
|
|
1876
|
-
declare const SDK_VERSION = "0.5.
|
|
1882
|
+
declare const SDK_VERSION = "0.5.17";
|
|
1877
1883
|
|
|
1878
1884
|
/**
|
|
1879
1885
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.d.ts
CHANGED
|
@@ -1067,6 +1067,12 @@ interface TranscriptIngestResult {
|
|
|
1067
1067
|
status: 'queued' | 'duplicate';
|
|
1068
1068
|
turns_recorded: number;
|
|
1069
1069
|
summary_status: 'in_progress' | 'already_compacted' | 'skipped';
|
|
1070
|
+
/**
|
|
1071
|
+
* What the server could not do with this push: no event time supplied
|
|
1072
|
+
* (recency ranking cannot order these memories), or existing turns kept.
|
|
1073
|
+
* Always a list. Since 0.5.16.
|
|
1074
|
+
*/
|
|
1075
|
+
warnings: string[];
|
|
1070
1076
|
/** ISO-8601. */
|
|
1071
1077
|
queued_at: string;
|
|
1072
1078
|
[key: string]: unknown;
|
|
@@ -1873,7 +1879,7 @@ declare class SynapClient {
|
|
|
1873
1879
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1874
1880
|
* publish safe.
|
|
1875
1881
|
*/
|
|
1876
|
-
declare const SDK_VERSION = "0.5.
|
|
1882
|
+
declare const SDK_VERSION = "0.5.17";
|
|
1877
1883
|
|
|
1878
1884
|
/**
|
|
1879
1885
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.js
CHANGED
|
@@ -1332,6 +1332,9 @@ function buildRecordMessageBody(options) {
|
|
|
1332
1332
|
if (!conversationId) throw new InvalidInputError("conversation_id is required");
|
|
1333
1333
|
validateConversationId(conversationId);
|
|
1334
1334
|
if (!options.role) throw new InvalidInputError("role is required");
|
|
1335
|
+
if (!MESSAGE_ROLES.includes(options.role)) {
|
|
1336
|
+
throw new 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 InvalidInputError("content is required");
|
|
1337
1340
|
}
|
|
@@ -1346,9 +1349,11 @@ function buildRecordMessageBody(options) {
|
|
|
1346
1349
|
metadata: options.metadata ?? {}
|
|
1347
1350
|
};
|
|
1348
1351
|
const sessionId = either2(o2, "session_id", "sessionId");
|
|
1349
|
-
if (sessionId
|
|
1352
|
+
if (sessionId) body["session_id"] = sessionId;
|
|
1350
1353
|
const scopePath = either2(o2, "scope_path", "scopePath");
|
|
1351
|
-
if (scopePath !== void 0)
|
|
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) {
|
|
@@ -1376,7 +1381,9 @@ function buildIngestTranscriptBody(options) {
|
|
|
1376
1381
|
if (startedAt !== void 0) body["started_at"] = startedAt;
|
|
1377
1382
|
if (endedAt !== void 0) body["ended_at"] = endedAt;
|
|
1378
1383
|
const scopePath = either2(o2, "scope_path", "scopePath");
|
|
1379
|
-
if (scopePath !== void 0)
|
|
1384
|
+
if (scopePath !== void 0 && scopePath !== null && Object.keys(scopePath).length > 0) {
|
|
1385
|
+
body["scope"] = scopePath;
|
|
1386
|
+
}
|
|
1380
1387
|
return body;
|
|
1381
1388
|
}
|
|
1382
1389
|
function buildCompactBody(options) {
|
|
@@ -1446,6 +1453,7 @@ function storedBatchRows(bodies, result) {
|
|
|
1446
1453
|
});
|
|
1447
1454
|
return pairs;
|
|
1448
1455
|
}
|
|
1456
|
+
var MESSAGE_ROLES = ["user", "assistant"];
|
|
1449
1457
|
var PROMPT_STYLES = ["structured", "narrative", "bullet_points"];
|
|
1450
1458
|
function createConversationNamespace(transport, subscribers = new CompactionSubscribers(), onWrite = () => {
|
|
1451
1459
|
}, onTurn = () => {
|
|
@@ -1545,8 +1553,17 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1545
1553
|
return result;
|
|
1546
1554
|
},
|
|
1547
1555
|
async ingest_transcript(options) {
|
|
1556
|
+
const o2 = options;
|
|
1557
|
+
await transport.checkCustomerId(
|
|
1558
|
+
o2["customer_id"] ?? o2["customerId"],
|
|
1559
|
+
"conversation.ingest_transcript"
|
|
1560
|
+
);
|
|
1548
1561
|
const body = buildIngestTranscriptBody(options);
|
|
1549
|
-
const
|
|
1562
|
+
const raw = await transport.request("conversations_ingest", { body });
|
|
1563
|
+
const result = {
|
|
1564
|
+
...raw,
|
|
1565
|
+
warnings: Array.isArray(raw?.warnings) ? raw.warnings.map(String) : []
|
|
1566
|
+
};
|
|
1550
1567
|
onWrite({
|
|
1551
1568
|
userId: body["user_id"],
|
|
1552
1569
|
customerId: body["customer_id"]
|
|
@@ -2012,7 +2029,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
2012
2029
|
}
|
|
2013
2030
|
|
|
2014
2031
|
// src/version.ts
|
|
2015
|
-
var SDK_VERSION = "0.5.
|
|
2032
|
+
var SDK_VERSION = "0.5.17";
|
|
2016
2033
|
|
|
2017
2034
|
// src/registry.ts
|
|
2018
2035
|
var instances = /* @__PURE__ */ new Map();
|