@kontext-dev/js-sdk 0.3.0 → 1.0.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/client/index.cjs +19 -1
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.js +19 -1
- package/dist/client/index.js.map +1 -1
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +2 -2
- package/dist/management/index.d.ts +2 -2
- package/dist/management/index.js.map +1 -1
- package/dist/mcp/index.cjs +19 -1
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.cts +4 -1
- package/dist/mcp/index.d.ts +4 -1
- package/dist/mcp/index.js +19 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/oauth/index.cjs.map +1 -1
- package/dist/oauth/index.d.cts +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/index.js.map +1 -1
- package/dist/server/index.cjs +8 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +8 -0
- package/dist/server/index.js.map +1 -1
- package/dist/{types-CzhnlJHW.d.cts → types-C6ep5fVw.d.cts} +2 -0
- package/dist/{types-CzhnlJHW.d.ts → types-C6ep5fVw.d.ts} +2 -0
- package/package.json +1 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as IntegrationCredential, a as IntegrationName, b as IntegrationResolvedCredentials, K as KnownIntegration, c as Kontext, d as KontextOptions, M as McpServerFactory, e as McpServerOrFactory, f as MiddlewareOptions } from '../kontext-CgIBANFo.cjs';
|
|
2
2
|
export { K as KontextTokenVerifier } from '../verifier-CoJmYiw3.cjs';
|
|
3
3
|
export { IntegrationConnectionRequiredError } from '../errors.cjs';
|
|
4
|
-
export { T as TokenExchangeRequest, a as TokenExchangeResponse } from '../types-
|
|
4
|
+
export { T as TokenExchangeRequest, a as TokenExchangeResponse } from '../types-C6ep5fVw.cjs';
|
|
5
5
|
export { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
6
6
|
export { OAuthTokenVerifier } from '@modelcontextprotocol/sdk/server/auth/provider.js';
|
|
7
7
|
import 'express';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as IntegrationCredential, a as IntegrationName, b as IntegrationResolvedCredentials, K as KnownIntegration, c as Kontext, d as KontextOptions, M as McpServerFactory, e as McpServerOrFactory, f as MiddlewareOptions } from '../kontext-CgIBANFo.js';
|
|
2
2
|
export { K as KontextTokenVerifier } from '../verifier-CoJmYiw3.js';
|
|
3
3
|
export { IntegrationConnectionRequiredError } from '../errors.js';
|
|
4
|
-
export { T as TokenExchangeRequest, a as TokenExchangeResponse } from '../types-
|
|
4
|
+
export { T as TokenExchangeRequest, a as TokenExchangeResponse } from '../types-C6ep5fVw.js';
|
|
5
5
|
export { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
6
6
|
export { OAuthTokenVerifier } from '@modelcontextprotocol/sdk/server/auth/provider.js';
|
|
7
7
|
import 'express';
|
package/dist/server/index.js
CHANGED
|
@@ -1271,6 +1271,12 @@ var Kontext = class _Kontext {
|
|
|
1271
1271
|
// ===========================================================================
|
|
1272
1272
|
createAgentSession(userToken, mcpSessionId, metadata) {
|
|
1273
1273
|
if (!this.clientSecret || !userToken) return;
|
|
1274
|
+
if (!metadata?.authenticatedUserId) {
|
|
1275
|
+
console.warn(
|
|
1276
|
+
"[kontext:sessions] create skipped: missing authenticated user id"
|
|
1277
|
+
);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1274
1280
|
const tokenIdentifier = createHash("sha256").update(userToken).digest("hex");
|
|
1275
1281
|
this.getServiceToken().then(
|
|
1276
1282
|
(token) => fetch(`${this.apiUrl}/api/v1/agent-sessions`, {
|
|
@@ -1281,6 +1287,7 @@ var Kontext = class _Kontext {
|
|
|
1281
1287
|
},
|
|
1282
1288
|
body: JSON.stringify({
|
|
1283
1289
|
tokenIdentifier,
|
|
1290
|
+
authenticatedUserId: metadata.authenticatedUserId,
|
|
1284
1291
|
clientSessionId: mcpSessionId,
|
|
1285
1292
|
hostname: metadata?.hostname,
|
|
1286
1293
|
userAgent: metadata?.userAgent,
|
|
@@ -1502,6 +1509,7 @@ var Kontext = class _Kontext {
|
|
|
1502
1509
|
status: "ok"
|
|
1503
1510
|
});
|
|
1504
1511
|
this.createAgentSession(authInfo?.token, sid, {
|
|
1512
|
+
authenticatedUserId: typeof authInfo?.extra?.sub === "string" ? authInfo.extra.sub : void 0,
|
|
1505
1513
|
hostname: req.headers["x-forwarded-for"],
|
|
1506
1514
|
userAgent: req.headers["user-agent"],
|
|
1507
1515
|
tokenExpiresAt: authInfo?.expiresAt
|