@maximem/synap-js-sdk 0.5.14 → 0.5.16
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 +41 -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 +21 -5
- package/dist/index.js.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.16";
|
|
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.16";
|
|
1877
1883
|
|
|
1878
1884
|
/**
|
|
1879
1885
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.js
CHANGED
|
@@ -1119,7 +1119,7 @@ function buildForgetBody(options) {
|
|
|
1119
1119
|
mode
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
-
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "error", "cancelled"]);
|
|
1122
|
+
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "partial_success", "error", "cancelled"]);
|
|
1123
1123
|
function createMemoriesInterface(transport, onForgotten) {
|
|
1124
1124
|
return {
|
|
1125
1125
|
async create(options) {
|
|
@@ -1154,7 +1154,9 @@ function createMemoriesInterface(transport, onForgotten) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
const form = new FormData();
|
|
1156
1156
|
form.set("user_id", userId);
|
|
1157
|
-
|
|
1157
|
+
if (typeof customerId === "string" && customerId !== "") {
|
|
1158
|
+
form.set("customer_id", customerId);
|
|
1159
|
+
}
|
|
1158
1160
|
form.set("relationship_type", options.relationship_type ?? options.relationshipType ?? "b2c");
|
|
1159
1161
|
form.set("mode", String(options.mode ?? DEFAULT_INGEST_MODE));
|
|
1160
1162
|
const documentType = options.document_type ?? options.documentType;
|
|
@@ -1162,6 +1164,9 @@ function createMemoriesInterface(transport, onForgotten) {
|
|
|
1162
1164
|
if (options.metadata !== void 0 && Object.keys(options.metadata).length > 0) {
|
|
1163
1165
|
form.set("metadata", JSON.stringify(options.metadata));
|
|
1164
1166
|
}
|
|
1167
|
+
if (options.scope && Object.keys(options.scope).length > 0) {
|
|
1168
|
+
form.set("scope", JSON.stringify(options.scope));
|
|
1169
|
+
}
|
|
1165
1170
|
if (filePath !== void 0) {
|
|
1166
1171
|
const { readFile } = await import("fs/promises");
|
|
1167
1172
|
const { basename } = await import("path");
|
|
@@ -1371,7 +1376,9 @@ function buildIngestTranscriptBody(options) {
|
|
|
1371
1376
|
if (startedAt !== void 0) body["started_at"] = startedAt;
|
|
1372
1377
|
if (endedAt !== void 0) body["ended_at"] = endedAt;
|
|
1373
1378
|
const scopePath = either2(o2, "scope_path", "scopePath");
|
|
1374
|
-
if (scopePath !== void 0)
|
|
1379
|
+
if (scopePath !== void 0 && scopePath !== null && Object.keys(scopePath).length > 0) {
|
|
1380
|
+
body["scope"] = scopePath;
|
|
1381
|
+
}
|
|
1375
1382
|
return body;
|
|
1376
1383
|
}
|
|
1377
1384
|
function buildCompactBody(options) {
|
|
@@ -1540,8 +1547,17 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1540
1547
|
return result;
|
|
1541
1548
|
},
|
|
1542
1549
|
async ingest_transcript(options) {
|
|
1550
|
+
const o2 = options;
|
|
1551
|
+
await transport.checkCustomerId(
|
|
1552
|
+
o2["customer_id"] ?? o2["customerId"],
|
|
1553
|
+
"conversation.ingest_transcript"
|
|
1554
|
+
);
|
|
1543
1555
|
const body = buildIngestTranscriptBody(options);
|
|
1544
|
-
const
|
|
1556
|
+
const raw = await transport.request("conversations_ingest", { body });
|
|
1557
|
+
const result = {
|
|
1558
|
+
...raw,
|
|
1559
|
+
warnings: Array.isArray(raw?.warnings) ? raw.warnings.map(String) : []
|
|
1560
|
+
};
|
|
1545
1561
|
onWrite({
|
|
1546
1562
|
userId: body["user_id"],
|
|
1547
1563
|
customerId: body["customer_id"]
|
|
@@ -2007,7 +2023,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
2007
2023
|
}
|
|
2008
2024
|
|
|
2009
2025
|
// src/version.ts
|
|
2010
|
-
var SDK_VERSION = "0.5.
|
|
2026
|
+
var SDK_VERSION = "0.5.16";
|
|
2011
2027
|
|
|
2012
2028
|
// src/registry.ts
|
|
2013
2029
|
var instances = /* @__PURE__ */ new Map();
|