@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/grpc/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GrpcStreamClient,
|
|
3
3
|
PROTO_SHA
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5G3FNDB3.js";
|
|
5
5
|
import {
|
|
6
6
|
ListeningNotActiveError
|
|
7
7
|
} from "../chunk-4GE7SORD.js";
|
|
@@ -39,7 +39,7 @@ async function listen(options) {
|
|
|
39
39
|
throw new ListeningNotActiveError(availability.detail);
|
|
40
40
|
}
|
|
41
41
|
const [{ GrpcStreamClient: StreamClient }, { AnticipationCache }, { getEnv }] = await Promise.all([
|
|
42
|
-
import("../stream-client-
|
|
42
|
+
import("../stream-client-2UMDGCMQ.js"),
|
|
43
43
|
import("../anticipation-cache-RWKF55J4.js"),
|
|
44
44
|
import("../env-QCUKKW36.js")
|
|
45
45
|
]);
|
package/dist/index.cjs
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
|
_optionalChain([onListen, 'optionalCall', _60 => _60()]);
|
|
1851
1852
|
} catch (e10) {
|
|
1852
1853
|
}
|
|
1853
|
-
const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-
|
|
1854
|
+
const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-FKKCBVCB.cjs")));
|
|
1854
1855
|
const onContext = _nullishCoalesce(options.on_context, () => ( options.onContext));
|
|
1855
1856
|
const onDisconnect = _nullishCoalesce(options.on_disconnect, () => ( options.onDisconnect));
|
|
1856
1857
|
const onReconnect = _nullishCoalesce(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
|
+
_nullishCoalesce(options.customer_id, () => ( options.customerId)),
|
|
1920
|
+
"instance.send_message"
|
|
1921
|
+
);
|
|
1917
1922
|
if (client === null) throw new (0, _chunkUXNVTP4Dcjs.ListeningNotActiveError)("Listening is not active");
|
|
1918
|
-
if (options.content === void 0) {
|
|
1919
|
-
throw new (0, _chunkUXNVTP4Dcjs.ListeningNotActiveError)("content is required");
|
|
1920
|
-
}
|
|
1921
1923
|
const eventType = _nullishCoalesce(_nullishCoalesce(options.event_type, () => ( options.eventType)), () => ( "user_message"));
|
|
1922
1924
|
if (!KNOWN_EVENT_TYPES.has(eventType)) {
|
|
1923
|
-
throw new (0, _chunkUXNVTP4Dcjs.
|
|
1925
|
+
throw new (0, _chunkUXNVTP4Dcjs.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 (0, _chunkUXNVTP4Dcjs.InvalidInputError)("content is required");
|
|
1931
|
+
}
|
|
1927
1932
|
const conversationId = _nullishCoalesce(_nullishCoalesce(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(_nullishCoalesce(options.tool_result, () => ( options.toolResult))),
|
|
1957
1962
|
tool_call_id: _nullishCoalesce(_nullishCoalesce(options.tool_call_id, () => ( options.toolCallId)), () => ( "")),
|
|
1958
1963
|
search_queries: _nullishCoalesce(_nullishCoalesce(options.search_queries, () => ( options.searchQueries)), () => ( [])),
|
|
1959
|
-
context_types: _nullishCoalesce(_nullishCoalesce(options.context_types, () => ( options.contextTypes)), () => ( []))
|
|
1964
|
+
context_types: _nullishCoalesce(_nullishCoalesce(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 = _nullishCoalesce(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 = (_class4 = 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 = (_class4 = class _SynapClient {
|
|
|
4123
4135
|
this.#transport.setRetryPolicy(_nullishCoalesce(_nullishCoalesce(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 = _nullishCoalesce(options.agent_model, () => ( options.agentModel));
|
|
4127
4141
|
const window = _nullishCoalesce(options.agent_context_window, () => ( options.agentContextWindow));
|
|
4128
4142
|
if (model !== void 0 || window !== void 0) {
|