@maximem/synap-js-sdk 0.5.13 → 0.5.14
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 +11 -3
- 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 +11 -3
- package/dist/index.js.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.14";
|
|
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.14";
|
|
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
|
}
|
|
@@ -1440,6 +1441,7 @@ function storedBatchRows(bodies, result) {
|
|
|
1440
1441
|
});
|
|
1441
1442
|
return pairs;
|
|
1442
1443
|
}
|
|
1444
|
+
var PROMPT_STYLES = ["structured", "narrative", "bullet_points"];
|
|
1443
1445
|
function createConversationNamespace(transport, subscribers = new CompactionSubscribers(), onWrite = () => {
|
|
1444
1446
|
}, onTurn = () => {
|
|
1445
1447
|
}, onFetched = () => {
|
|
@@ -1561,6 +1563,12 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1561
1563
|
},
|
|
1562
1564
|
get_context_for_prompt: async (options = {}) => {
|
|
1563
1565
|
const id = convId(options);
|
|
1566
|
+
const style = options.style ?? "structured";
|
|
1567
|
+
if (!PROMPT_STYLES.includes(style)) {
|
|
1568
|
+
throw new InvalidInputError(
|
|
1569
|
+
`Invalid style '${style}'. Must be one of: ${PROMPT_STYLES.join(", ")}`
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1564
1572
|
const search = (options.search_history ?? options.searchHistory ?? true) && localShortTerm.historyExcerpts;
|
|
1565
1573
|
const withHistory = async (response2) => {
|
|
1566
1574
|
if (!search) return response2;
|
|
@@ -1570,11 +1578,11 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
|
|
|
1570
1578
|
return response2;
|
|
1571
1579
|
}
|
|
1572
1580
|
};
|
|
1573
|
-
const local = localShortTerm.prompt(id,
|
|
1581
|
+
const local = localShortTerm.prompt(id, style);
|
|
1574
1582
|
if (local !== null) return withHistory(local);
|
|
1575
1583
|
const result = await transport.request("context_for_prompt", {
|
|
1576
1584
|
pathParams: { conversation_id: id },
|
|
1577
|
-
query: { style
|
|
1585
|
+
query: { style }
|
|
1578
1586
|
});
|
|
1579
1587
|
const response = result?.["context_for_prompt"] ?? result ?? {};
|
|
1580
1588
|
localShortTerm.reseed?.(id, response);
|
|
@@ -1999,7 +2007,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
1999
2007
|
}
|
|
2000
2008
|
|
|
2001
2009
|
// src/version.ts
|
|
2002
|
-
var SDK_VERSION = "0.5.
|
|
2010
|
+
var SDK_VERSION = "0.5.14";
|
|
2003
2011
|
|
|
2004
2012
|
// src/registry.ts
|
|
2005
2013
|
var instances = /* @__PURE__ */ new Map();
|