@maximem/synap-js-sdk 0.5.13 → 0.5.15
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 +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -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
|
@@ -1873,7 +1873,7 @@ declare class SynapClient {
|
|
|
1873
1873
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1874
1874
|
* publish safe.
|
|
1875
1875
|
*/
|
|
1876
|
-
declare const SDK_VERSION = "0.5.
|
|
1876
|
+
declare const SDK_VERSION = "0.5.15";
|
|
1877
1877
|
|
|
1878
1878
|
/**
|
|
1879
1879
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.d.ts
CHANGED
|
@@ -1873,7 +1873,7 @@ declare class SynapClient {
|
|
|
1873
1873
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1874
1874
|
* publish safe.
|
|
1875
1875
|
*/
|
|
1876
|
-
declare const SDK_VERSION = "0.5.
|
|
1876
|
+
declare const SDK_VERSION = "0.5.15";
|
|
1877
1877
|
|
|
1878
1878
|
/**
|
|
1879
1879
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.js
CHANGED
|
@@ -511,6 +511,7 @@ async function toHttpError(response, correlationId) {
|
|
|
511
511
|
return new AgentUnavailableError(message, opts);
|
|
512
512
|
default:
|
|
513
513
|
if (response.status >= 500) return new ServiceUnavailableError(message, opts);
|
|
514
|
+
if (response.status >= 400) return new SynapPermanentError(message, opts);
|
|
514
515
|
return new SynapError(message, opts);
|
|
515
516
|
}
|
|
516
517
|
}
|
|
@@ -1118,7 +1119,7 @@ function buildForgetBody(options) {
|
|
|
1118
1119
|
mode
|
|
1119
1120
|
};
|
|
1120
1121
|
}
|
|
1121
|
-
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "error", "cancelled"]);
|
|
1122
|
+
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "partial_success", "error", "cancelled"]);
|
|
1122
1123
|
function createMemoriesInterface(transport, onForgotten) {
|
|
1123
1124
|
return {
|
|
1124
1125
|
async create(options) {
|
|
@@ -1153,7 +1154,9 @@ function createMemoriesInterface(transport, onForgotten) {
|
|
|
1153
1154
|
}
|
|
1154
1155
|
const form = new FormData();
|
|
1155
1156
|
form.set("user_id", userId);
|
|
1156
|
-
|
|
1157
|
+
if (typeof customerId === "string" && customerId !== "") {
|
|
1158
|
+
form.set("customer_id", customerId);
|
|
1159
|
+
}
|
|
1157
1160
|
form.set("relationship_type", options.relationship_type ?? options.relationshipType ?? "b2c");
|
|
1158
1161
|
form.set("mode", String(options.mode ?? DEFAULT_INGEST_MODE));
|
|
1159
1162
|
const documentType = options.document_type ?? options.documentType;
|
|
@@ -1161,6 +1164,9 @@ function createMemoriesInterface(transport, onForgotten) {
|
|
|
1161
1164
|
if (options.metadata !== void 0 && Object.keys(options.metadata).length > 0) {
|
|
1162
1165
|
form.set("metadata", JSON.stringify(options.metadata));
|
|
1163
1166
|
}
|
|
1167
|
+
if (options.scope && Object.keys(options.scope).length > 0) {
|
|
1168
|
+
form.set("scope", JSON.stringify(options.scope));
|
|
1169
|
+
}
|
|
1164
1170
|
if (filePath !== void 0) {
|
|
1165
1171
|
const { readFile } = await import("fs/promises");
|
|
1166
1172
|
const { basename } = await import("path");
|
|
@@ -1440,6 +1446,7 @@ function storedBatchRows(bodies, result) {
|
|
|
1440
1446
|
});
|
|
1441
1447
|
return pairs;
|
|
1442
1448
|
}
|
|
1449
|
+
var PROMPT_STYLES = ["structured", "narrative", "bullet_points"];
|
|
1443
1450
|
function createConversationNamespace(transport, subscribers = new CompactionSubscribers(), onWrite = () => {
|
|
1444
1451
|
}, onTurn = () => {
|
|
1445
1452
|
}, onFetched = () => {
|
|
@@ -1561,6 +1568,12 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1561
1568
|
},
|
|
1562
1569
|
get_context_for_prompt: async (options = {}) => {
|
|
1563
1570
|
const id = convId(options);
|
|
1571
|
+
const style = options.style ?? "structured";
|
|
1572
|
+
if (!PROMPT_STYLES.includes(style)) {
|
|
1573
|
+
throw new InvalidInputError(
|
|
1574
|
+
`Invalid style '${style}'. Must be one of: ${PROMPT_STYLES.join(", ")}`
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1564
1577
|
const search = (options.search_history ?? options.searchHistory ?? true) && localShortTerm.historyExcerpts;
|
|
1565
1578
|
const withHistory = async (response2) => {
|
|
1566
1579
|
if (!search) return response2;
|
|
@@ -1570,11 +1583,11 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1570
1583
|
return response2;
|
|
1571
1584
|
}
|
|
1572
1585
|
};
|
|
1573
|
-
const local = localShortTerm.prompt(id,
|
|
1586
|
+
const local = localShortTerm.prompt(id, style);
|
|
1574
1587
|
if (local !== null) return withHistory(local);
|
|
1575
1588
|
const result = await transport.request("context_for_prompt", {
|
|
1576
1589
|
pathParams: { conversation_id: id },
|
|
1577
|
-
query: { style
|
|
1590
|
+
query: { style }
|
|
1578
1591
|
});
|
|
1579
1592
|
const response = result?.["context_for_prompt"] ?? result ?? {};
|
|
1580
1593
|
localShortTerm.reseed?.(id, response);
|
|
@@ -1999,7 +2012,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
1999
2012
|
}
|
|
2000
2013
|
|
|
2001
2014
|
// src/version.ts
|
|
2002
|
-
var SDK_VERSION = "0.5.
|
|
2015
|
+
var SDK_VERSION = "0.5.15";
|
|
2003
2016
|
|
|
2004
2017
|
// src/registry.ts
|
|
2005
2018
|
var instances = /* @__PURE__ */ new Map();
|