@kontext-dev/js-sdk 0.1.0 → 0.3.0

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.js CHANGED
@@ -536,6 +536,7 @@ var KontextMcp = class {
536
536
  config;
537
537
  storage;
538
538
  oauthProvider;
539
+ clientSessionId = typeof globalThis.crypto?.randomUUID === "function" ? globalThis.crypto.randomUUID() : `kontext-sdk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
539
540
  transport = null;
540
541
  client = null;
541
542
  _isConnected = false;
@@ -855,13 +856,14 @@ var KontextMcp = class {
855
856
  if (this.config.onElicitationUrl) {
856
857
  capabilities.elicitation = { url: {} };
857
858
  }
858
- this.client = new Client(
859
- {
860
- name: this.config.clientName ?? "kontext-sdk",
861
- version: this.config.clientVersion ?? "0.0.1"
862
- },
863
- { capabilities }
864
- );
859
+ const clientInfo = {
860
+ name: this.config.clientName ?? "kontext-sdk",
861
+ version: this.config.clientVersion ?? "0.0.1",
862
+ sessionId: this.clientSessionId
863
+ };
864
+ this.client = new Client(clientInfo, {
865
+ capabilities
866
+ });
865
867
  if (this.config.onElicitationUrl) {
866
868
  const onElicitationUrl = this.config.onElicitationUrl;
867
869
  this.client.setRequestHandler(ElicitRequestSchema, async (request) => {
@@ -2115,7 +2117,11 @@ function createKontextOrchestrator(config) {
2115
2117
  }
2116
2118
 
2117
2119
  // src/client/index.ts
2118
- var META_TOOL_NAMES = /* @__PURE__ */ new Set(["SEARCH_TOOLS", "EXECUTE_TOOL"]);
2120
+ var META_TOOL_NAMES = /* @__PURE__ */ new Set([
2121
+ "SEARCH_TOOLS",
2122
+ "EXECUTE_TOOL",
2123
+ "REQUEST_CAPABILITY"
2124
+ ]);
2119
2125
  function hasMetaTools(tools) {
2120
2126
  let hasSearch = false;
2121
2127
  let hasExecute = false;
@@ -3681,6 +3687,7 @@ var Kontext = class _Kontext {
3681
3687
  },
3682
3688
  body: JSON.stringify({
3683
3689
  tokenIdentifier,
3690
+ clientSessionId: mcpSessionId,
3684
3691
  hostname: metadata?.hostname,
3685
3692
  userAgent: metadata?.userAgent,
3686
3693
  clientInfo: metadata?.clientInfo,