@maximem/synap-js-sdk 0.5.17 → 0.5.19
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/{chunk-LJ66WCV3.js → chunk-5G3FNDB3.js} +3 -1
- package/dist/chunk-5G3FNDB3.js.map +1 -0
- package/dist/{chunk-QHPVLTQ7.cjs → chunk-CBK3H2LU.cjs} +9 -7
- package/dist/chunk-CBK3H2LU.cjs.map +1 -0
- package/dist/grpc/index.cjs +3 -3
- package/dist/grpc/index.d.cts +2 -0
- package/dist/grpc/index.d.ts +2 -0
- package/dist/grpc/index.js +2 -2
- package/dist/index.cjs +23 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/{stream-client-ZBCKRU7S.js → stream-client-2UMDGCMQ.js} +2 -2
- package/dist/stream-client-FKKCBVCB.cjs +16 -0
- package/dist/{stream-client-5GYUWETN.cjs.map → stream-client-FKKCBVCB.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-LJ66WCV3.js.map +0 -1
- package/dist/chunk-QHPVLTQ7.cjs.map +0 -1
- package/dist/stream-client-5GYUWETN.cjs +0 -16
- /package/dist/{stream-client-ZBCKRU7S.js.map → stream-client-2UMDGCMQ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1309,6 +1309,12 @@ interface SendMessageOptions {
|
|
|
1309
1309
|
searchQueries?: string[];
|
|
1310
1310
|
context_types?: string[];
|
|
1311
1311
|
contextTypes?: string[];
|
|
1312
|
+
/**
|
|
1313
|
+
* The level of your scope ladder this conversation belongs to. Sent as the
|
|
1314
|
+
* event's `scope`; the server keeps the first one it sees. Since 0.5.18.
|
|
1315
|
+
*/
|
|
1316
|
+
scope_path?: Record<string, string>;
|
|
1317
|
+
scopePath?: Record<string, string>;
|
|
1312
1318
|
}
|
|
1313
1319
|
interface RecordThinkingOptions {
|
|
1314
1320
|
content: string;
|
|
@@ -1659,6 +1665,13 @@ interface ConfigureOptions {
|
|
|
1659
1665
|
agentModel?: string;
|
|
1660
1666
|
agent_context_window?: number;
|
|
1661
1667
|
agentContextWindow?: number;
|
|
1668
|
+
/**
|
|
1669
|
+
* The local model for history search and matching a fetch to prefetched
|
|
1670
|
+
* context by meaning: "auto" (default) or a model id, null for keyword
|
|
1671
|
+
* matching only. As Python's SDKConfig.history_search_model. Since 0.5.19.
|
|
1672
|
+
*/
|
|
1673
|
+
history_search_model?: string | null;
|
|
1674
|
+
historySearchModel?: string | null;
|
|
1662
1675
|
/** Replaces the diagnostic sink, same as the constructor option. */
|
|
1663
1676
|
logger?: SynapLogger | undefined;
|
|
1664
1677
|
}
|
|
@@ -1879,7 +1892,7 @@ declare class SynapClient {
|
|
|
1879
1892
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1880
1893
|
* publish safe.
|
|
1881
1894
|
*/
|
|
1882
|
-
declare const SDK_VERSION = "0.5.
|
|
1895
|
+
declare const SDK_VERSION = "0.5.19";
|
|
1883
1896
|
|
|
1884
1897
|
/**
|
|
1885
1898
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.d.ts
CHANGED
|
@@ -1309,6 +1309,12 @@ interface SendMessageOptions {
|
|
|
1309
1309
|
searchQueries?: string[];
|
|
1310
1310
|
context_types?: string[];
|
|
1311
1311
|
contextTypes?: string[];
|
|
1312
|
+
/**
|
|
1313
|
+
* The level of your scope ladder this conversation belongs to. Sent as the
|
|
1314
|
+
* event's `scope`; the server keeps the first one it sees. Since 0.5.18.
|
|
1315
|
+
*/
|
|
1316
|
+
scope_path?: Record<string, string>;
|
|
1317
|
+
scopePath?: Record<string, string>;
|
|
1312
1318
|
}
|
|
1313
1319
|
interface RecordThinkingOptions {
|
|
1314
1320
|
content: string;
|
|
@@ -1659,6 +1665,13 @@ interface ConfigureOptions {
|
|
|
1659
1665
|
agentModel?: string;
|
|
1660
1666
|
agent_context_window?: number;
|
|
1661
1667
|
agentContextWindow?: number;
|
|
1668
|
+
/**
|
|
1669
|
+
* The local model for history search and matching a fetch to prefetched
|
|
1670
|
+
* context by meaning: "auto" (default) or a model id, null for keyword
|
|
1671
|
+
* matching only. As Python's SDKConfig.history_search_model. Since 0.5.19.
|
|
1672
|
+
*/
|
|
1673
|
+
history_search_model?: string | null;
|
|
1674
|
+
historySearchModel?: string | null;
|
|
1662
1675
|
/** Replaces the diagnostic sink, same as the constructor option. */
|
|
1663
1676
|
logger?: SynapLogger | undefined;
|
|
1664
1677
|
}
|
|
@@ -1879,7 +1892,7 @@ declare class SynapClient {
|
|
|
1879
1892
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1880
1893
|
* publish safe.
|
|
1881
1894
|
*/
|
|
1882
|
-
declare const SDK_VERSION = "0.5.
|
|
1895
|
+
declare const SDK_VERSION = "0.5.19";
|
|
1883
1896
|
|
|
1884
1897
|
/**
|
|
1885
1898
|
* `response_shape: "ranked"`: one list in the order the server ranked it.
|
package/dist/index.js
CHANGED
|
@@ -1791,7 +1791,8 @@ function jsonOrText(value) {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
|
-
function createInstanceNamespace(credentials, cache, onTurn, agentModel = () => ({}), onToolResult) {
|
|
1794
|
+
function createInstanceNamespace(credentials, cache, onTurn, agentModel = () => ({}), onToolResult, checkCustomerId3 = async () => {
|
|
1795
|
+
}) {
|
|
1795
1796
|
let client = null;
|
|
1796
1797
|
const openSessions = /* @__PURE__ */ new Map();
|
|
1797
1798
|
let dispatchCompaction = null;
|
|
@@ -1850,7 +1851,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
1850
1851
|
onListen?.();
|
|
1851
1852
|
} catch {
|
|
1852
1853
|
}
|
|
1853
|
-
const { GrpcStreamClient } = await import("./stream-client-
|
|
1854
|
+
const { GrpcStreamClient } = await import("./stream-client-2UMDGCMQ.js");
|
|
1854
1855
|
const onContext = options.on_context ?? options.onContext;
|
|
1855
1856
|
const onDisconnect = options.on_disconnect ?? options.onDisconnect;
|
|
1856
1857
|
const onReconnect = options.on_reconnect ?? options.onReconnect;
|
|
@@ -1914,16 +1915,20 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
1914
1915
|
}
|
|
1915
1916
|
},
|
|
1916
1917
|
async send_message(options) {
|
|
1918
|
+
await checkCustomerId3(
|
|
1919
|
+
options.customer_id ?? options.customerId,
|
|
1920
|
+
"instance.send_message"
|
|
1921
|
+
);
|
|
1917
1922
|
if (client === null) throw new ListeningNotActiveError("Listening is not active");
|
|
1918
|
-
if (options.content === void 0) {
|
|
1919
|
-
throw new ListeningNotActiveError("content is required");
|
|
1920
|
-
}
|
|
1921
1923
|
const eventType = options.event_type ?? options.eventType ?? "user_message";
|
|
1922
1924
|
if (!KNOWN_EVENT_TYPES.has(eventType)) {
|
|
1923
|
-
throw new
|
|
1925
|
+
throw new InvalidInputError(
|
|
1924
1926
|
`unknown event_type '${eventType}'. Expected one of: ` + [...KNOWN_EVENT_TYPES].sort().join(", ")
|
|
1925
1927
|
);
|
|
1926
1928
|
}
|
|
1929
|
+
if (options.content === void 0 || options.content === null) {
|
|
1930
|
+
throw new InvalidInputError("content is required");
|
|
1931
|
+
}
|
|
1927
1932
|
const conversationId = options.conversation_id ?? options.conversationId ?? "";
|
|
1928
1933
|
ensureSession(
|
|
1929
1934
|
conversationId,
|
|
@@ -1956,7 +1961,13 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
1956
1961
|
tool_result_json: toolResultJson(options.tool_result ?? options.toolResult),
|
|
1957
1962
|
tool_call_id: options.tool_call_id ?? options.toolCallId ?? "",
|
|
1958
1963
|
search_queries: options.search_queries ?? options.searchQueries ?? [],
|
|
1959
|
-
context_types: options.context_types ?? options.contextTypes ?? []
|
|
1964
|
+
context_types: options.context_types ?? options.contextTypes ?? [],
|
|
1965
|
+
// The proto's `scope`: the conversation's rung, kept from the first
|
|
1966
|
+
// event that names one. Omitted when absent or empty, as in Python.
|
|
1967
|
+
...(() => {
|
|
1968
|
+
const sp = options.scope_path ?? options.scopePath;
|
|
1969
|
+
return sp && Object.keys(sp).length > 0 ? { scope: sp } : {};
|
|
1970
|
+
})()
|
|
1960
1971
|
});
|
|
1961
1972
|
},
|
|
1962
1973
|
async record_tool_call(options) {
|
|
@@ -2029,7 +2040,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
|
|
|
2029
2040
|
}
|
|
2030
2041
|
|
|
2031
2042
|
// src/version.ts
|
|
2032
|
-
var SDK_VERSION = "0.5.
|
|
2043
|
+
var SDK_VERSION = "0.5.19";
|
|
2033
2044
|
|
|
2034
2045
|
// src/registry.ts
|
|
2035
2046
|
var instances = /* @__PURE__ */ new Map();
|
|
@@ -3944,7 +3955,8 @@ var SynapClient = class _SynapClient {
|
|
|
3944
3955
|
this.#shortTerm.appendTurn(conversationId, role, content);
|
|
3945
3956
|
},
|
|
3946
3957
|
() => this.#agentModel,
|
|
3947
|
-
({ conversationId, result, toolName }) => this.archive_tool_result(conversationId, result, { tool_name: toolName })
|
|
3958
|
+
({ conversationId, result, toolName }) => this.archive_tool_result(conversationId, result, { tool_name: toolName }),
|
|
3959
|
+
(customerId, where) => this.#transport.checkCustomerId(customerId, where)
|
|
3948
3960
|
);
|
|
3949
3961
|
this.instance._internal.setOnListen(() => this.#startLocalModel());
|
|
3950
3962
|
this.instance._internal.setCompactionApplier((bundle) => {
|
|
@@ -4123,6 +4135,8 @@ var SynapClient = class _SynapClient {
|
|
|
4123
4135
|
this.#transport.setRetryPolicy(options.retryPolicy ?? options.retry_policy ?? null);
|
|
4124
4136
|
}
|
|
4125
4137
|
if (options.logger !== void 0) this.#logger = options.logger;
|
|
4138
|
+
const historyModel = options.history_search_model !== void 0 ? options.history_search_model : options.historySearchModel;
|
|
4139
|
+
if (historyModel !== void 0 && !this.#localModelStarted) this.#localModelName = historyModel;
|
|
4126
4140
|
const model = options.agent_model ?? options.agentModel;
|
|
4127
4141
|
const window = options.agent_context_window ?? options.agentContextWindow;
|
|
4128
4142
|
if (model !== void 0 || window !== void 0) {
|