@kya-os/mcp-i 1.7.13 → 1.10.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/225.js +1 -0
- package/dist/227.js +1 -0
- package/dist/242.js +1 -0
- package/dist/283.js +1 -0
- package/dist/295.js +1 -1
- package/dist/354.js +1 -0
- package/dist/361.js +1 -0
- package/dist/452.js +1 -0
- package/dist/533.js +1 -0
- package/dist/622.js +1 -0
- package/dist/65.js +1 -0
- package/dist/843.js +1 -0
- package/dist/861.js +1 -0
- package/dist/866.js +1 -1
- package/dist/914.js +1 -0
- package/dist/95.js +1 -0
- package/dist/{941.js → 966.js} +1 -1
- package/dist/providers/node-providers.d.ts +1 -1
- package/dist/providers/node-providers.js +2 -2
- package/dist/runtime/adapter-express.js +6 -6
- package/dist/runtime/adapter-nextjs.js +6 -6
- package/dist/runtime/auth-handshake.d.ts +4 -159
- package/dist/runtime/auth-handshake.js +8 -249
- package/dist/runtime/http.js +6 -6
- package/dist/runtime/mcpi-runtime.d.ts +4 -0
- package/dist/runtime/mcpi-runtime.js +58 -43
- package/dist/runtime/outbound-delegation.d.ts +34 -0
- package/dist/runtime/outbound-delegation.js +134 -0
- package/dist/runtime/proof.d.ts +13 -88
- package/dist/runtime/proof.js +11 -225
- package/dist/runtime/request-context.d.ts +41 -0
- package/dist/runtime/request-context.js +48 -0
- package/dist/runtime/session.d.ts +13 -104
- package/dist/runtime/session.js +31 -267
- package/dist/runtime/stdio.js +6 -6
- package/dist/runtime/utils/tools.js +17 -3
- package/dist/runtime/verifier-middleware.js +4 -4
- package/package.json +19 -19
- package/dist/207.js +0 -1
- package/dist/25.js +0 -1
- package/dist/360.js +0 -1
- package/dist/387.js +0 -1
- package/dist/406.js +0 -1
- package/dist/448.js +0 -1
- package/dist/478.js +0 -1
- package/dist/575.js +0 -1
- package/dist/67.js +0 -1
- package/dist/743.js +0 -1
- package/dist/784.js +0 -1
- package/dist/844.js +0 -1
- package/dist/936.js +0 -1
- package/dist/988.js +0 -1
|
@@ -1,162 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Authorization Handshake
|
|
2
|
+
* Authorization Handshake for XMCP-I Runtime â Node.js adapter
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. Verify delegation exists
|
|
7
|
-
* 3. Return needs_authorization error if missing
|
|
8
|
-
*
|
|
9
|
-
* This module implements the "gatekeeper" logic that determines whether
|
|
10
|
-
* an agent should be allowed to execute a tool or needs human authorization.
|
|
11
|
-
*
|
|
12
|
-
* Flow:
|
|
13
|
-
* - If delegation exists + valid → allow (fast path)
|
|
14
|
-
* - If delegation missing → return needs_authorization with hints
|
|
15
|
-
* - If reputation too low (optional) → require authorization
|
|
16
|
-
*
|
|
17
|
-
* Related: PHASE_1_XMCP_I_SERVER.md Epic 2 (Runtime Interceptor)
|
|
18
|
-
*/
|
|
19
|
-
import { NeedsAuthorizationError } from "@kya-os/contracts/runtime";
|
|
20
|
-
import { DelegationVerifier } from "./delegation-verifier";
|
|
21
|
-
import { DelegationRecord } from "@kya-os/contracts/delegation";
|
|
22
|
-
/**
|
|
23
|
-
* Agent reputation data from KTA
|
|
24
|
-
*/
|
|
25
|
-
export interface AgentReputation {
|
|
26
|
-
/** Agent DID */
|
|
27
|
-
agentDid: string;
|
|
28
|
-
/** Reputation score (0-100) */
|
|
29
|
-
score: number;
|
|
30
|
-
/** Total interactions recorded */
|
|
31
|
-
totalInteractions: number;
|
|
32
|
-
/** Success rate (0-1) */
|
|
33
|
-
successRate: number;
|
|
34
|
-
/** Risk level assessment */
|
|
35
|
-
riskLevel: "low" | "medium" | "high" | "unknown";
|
|
36
|
-
/** Last updated timestamp */
|
|
37
|
-
updatedAt: number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Configuration for auth handshake
|
|
41
|
-
*/
|
|
42
|
-
export interface AuthHandshakeConfig {
|
|
43
|
-
/** Delegation verifier instance */
|
|
44
|
-
delegationVerifier: DelegationVerifier;
|
|
45
|
-
/** Resume token store (REQUIRED to persist tokens across calls) */
|
|
46
|
-
resumeTokenStore: ResumeTokenStore;
|
|
47
|
-
/** KTA API configuration (optional, for reputation checks) */
|
|
48
|
-
kta?: {
|
|
49
|
-
apiUrl: string;
|
|
50
|
-
apiKey?: string;
|
|
51
|
-
};
|
|
52
|
-
/** Bouncer configuration */
|
|
53
|
-
bouncer: {
|
|
54
|
-
/** Authorization URL base (e.g., "https://agentshield.example.com/consent") */
|
|
55
|
-
authorizationUrl: string;
|
|
56
|
-
/** Resume token TTL in milliseconds (default: 10 minutes) */
|
|
57
|
-
resumeTokenTtl?: number;
|
|
58
|
-
/** Whether to require authorization for unknown/untrusted agents */
|
|
59
|
-
requireAuthForUnknown?: boolean;
|
|
60
|
-
/** Minimum reputation score to bypass authorization (0-100) */
|
|
61
|
-
minReputationScore?: number;
|
|
62
|
-
};
|
|
63
|
-
/** Enable debug logging */
|
|
64
|
-
debug?: boolean;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Result of auth handshake verification
|
|
68
|
-
*/
|
|
69
|
-
export interface VerifyOrHintsResult {
|
|
70
|
-
/** Whether authorization is granted */
|
|
71
|
-
authorized: boolean;
|
|
72
|
-
/** Delegation record (if authorized) */
|
|
73
|
-
delegation?: DelegationRecord;
|
|
74
|
-
/** Credential from AgentShield API (includes authorization method) */
|
|
75
|
-
credential?: {
|
|
76
|
-
agent_did: string;
|
|
77
|
-
user_did: string;
|
|
78
|
-
scopes: string[];
|
|
79
|
-
authorization: {
|
|
80
|
-
type: "oauth" | "oauth2" | "password" | "credential" | "webauthn" | "siwe" | "none";
|
|
81
|
-
provider?: string;
|
|
82
|
-
credentialType?: string;
|
|
83
|
-
rpId?: string;
|
|
84
|
-
userVerification?: "required" | "preferred" | "discouraged";
|
|
85
|
-
chainId?: number;
|
|
86
|
-
domain?: string;
|
|
87
|
-
};
|
|
88
|
-
[key: string]: unknown;
|
|
89
|
-
};
|
|
90
|
-
/** needs_authorization error (if not authorized) */
|
|
91
|
-
authError?: NeedsAuthorizationError;
|
|
92
|
-
/** Agent reputation data (if available) */
|
|
93
|
-
reputation?: AgentReputation;
|
|
94
|
-
/** Reason for decision */
|
|
95
|
-
reason?: string;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Resume token store interface
|
|
99
|
-
*
|
|
100
|
-
* Stores short-lived tokens for resuming after authorization
|
|
101
|
-
*/
|
|
102
|
-
export interface ResumeTokenStore {
|
|
103
|
-
/**
|
|
104
|
-
* Create resume token
|
|
105
|
-
*
|
|
106
|
-
* @param agentDid - Agent DID
|
|
107
|
-
* @param scopes - Required scopes
|
|
108
|
-
* @param metadata - Optional metadata (user agent, IP, etc.)
|
|
109
|
-
* @returns Resume token string
|
|
110
|
-
*/
|
|
111
|
-
create(agentDid: string, scopes: string[], metadata?: Record<string, any>): Promise<string>;
|
|
112
|
-
/**
|
|
113
|
-
* Get resume token data
|
|
114
|
-
*
|
|
115
|
-
* @param token - Resume token
|
|
116
|
-
* @returns Token data or null if expired/invalid
|
|
117
|
-
*/
|
|
118
|
-
get(token: string): Promise<{
|
|
119
|
-
agentDid: string;
|
|
120
|
-
scopes: string[];
|
|
121
|
-
createdAt: number;
|
|
122
|
-
expiresAt: number;
|
|
123
|
-
metadata?: Record<string, any>;
|
|
124
|
-
} | null>;
|
|
125
|
-
/**
|
|
126
|
-
* Mark token as fulfilled (one-time use)
|
|
127
|
-
*
|
|
128
|
-
* @param token - Resume token
|
|
129
|
-
*/
|
|
130
|
-
fulfill(token: string): Promise<void>;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Simple in-memory resume token store (for testing/development)
|
|
134
|
-
*/
|
|
135
|
-
export declare class MemoryResumeTokenStore implements ResumeTokenStore {
|
|
136
|
-
private tokens;
|
|
137
|
-
private ttl;
|
|
138
|
-
constructor(ttlMs?: number);
|
|
139
|
-
create(agentDid: string, scopes: string[], metadata?: Record<string, any>): Promise<string>;
|
|
140
|
-
get(token: string): Promise<any | null>;
|
|
141
|
-
fulfill(token: string): Promise<void>;
|
|
142
|
-
clear(): void;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Main auth handshake function
|
|
146
|
-
*
|
|
147
|
-
* Verifies agent authorization or returns authorization hints
|
|
148
|
-
*
|
|
149
|
-
* @param agentDid - Agent DID requesting access
|
|
150
|
-
* @param scopes - Required permission scopes
|
|
151
|
-
* @param config - Auth handshake configuration
|
|
152
|
-
* @param resumeToken - Optional resume token from previous authorization
|
|
153
|
-
* @returns Verification result with delegation or auth error
|
|
154
|
-
*/
|
|
155
|
-
export declare function verifyOrHints(agentDid: string, scopes: string[], config: AuthHandshakeConfig, _resumeToken?: string): Promise<VerifyOrHintsResult>;
|
|
156
|
-
/**
|
|
157
|
-
* Helper: Check if scopes are sensitive and require authorization
|
|
158
|
-
*
|
|
159
|
-
* @param scopes - Scopes to check
|
|
160
|
-
* @returns true if scopes are sensitive
|
|
4
|
+
* Re-exports the platform-agnostic auth handshake from @kya-os/mcp-i-core.
|
|
5
|
+
* All existing public exports are maintained for backward compatibility.
|
|
161
6
|
*/
|
|
162
|
-
export
|
|
7
|
+
export { verifyOrHints, hasSensitiveScopes, MemoryResumeTokenStore, type AuthHandshakeConfig, type VerifyOrHintsResult, type AgentReputation, type ResumeTokenStore, type DelegationVerifier, type VerifyDelegationResult, } from "@kya-os/mcp-i-core";
|
|
@@ -1,254 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Authorization Handshake
|
|
3
|
+
* Authorization Handshake for XMCP-I Runtime â Node.js adapter
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 2. Verify delegation exists
|
|
8
|
-
* 3. Return needs_authorization error if missing
|
|
9
|
-
*
|
|
10
|
-
* This module implements the "gatekeeper" logic that determines whether
|
|
11
|
-
* an agent should be allowed to execute a tool or needs human authorization.
|
|
12
|
-
*
|
|
13
|
-
* Flow:
|
|
14
|
-
* - If delegation exists + valid → allow (fast path)
|
|
15
|
-
* - If delegation missing → return needs_authorization with hints
|
|
16
|
-
* - If reputation too low (optional) → require authorization
|
|
17
|
-
*
|
|
18
|
-
* Related: PHASE_1_XMCP_I_SERVER.md Epic 2 (Runtime Interceptor)
|
|
5
|
+
* Re-exports the platform-agnostic auth handshake from @kya-os/mcp-i-core.
|
|
6
|
+
* All existing public exports are maintained for backward compatibility.
|
|
19
7
|
*/
|
|
20
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.MemoryResumeTokenStore = void 0;
|
|
22
|
-
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Simple in-memory resume token store (for testing/development)
|
|
27
|
-
*/
|
|
28
|
-
class MemoryResumeTokenStore {
|
|
29
|
-
tokens = new Map();
|
|
30
|
-
ttl;
|
|
31
|
-
constructor(ttlMs = 600_000) {
|
|
32
|
-
this.ttl = ttlMs;
|
|
33
|
-
}
|
|
34
|
-
async create(agentDid, scopes, metadata) {
|
|
35
|
-
const token = `rt_${Date.now()}_${Math.random().toString(36).substr(2, 16)}`;
|
|
36
|
-
const now = Date.now();
|
|
37
|
-
this.tokens.set(token, {
|
|
38
|
-
agentDid,
|
|
39
|
-
scopes,
|
|
40
|
-
createdAt: now,
|
|
41
|
-
expiresAt: now + this.ttl,
|
|
42
|
-
metadata,
|
|
43
|
-
fulfilled: false,
|
|
44
|
-
});
|
|
45
|
-
return token;
|
|
46
|
-
}
|
|
47
|
-
async get(token) {
|
|
48
|
-
const data = this.tokens.get(token);
|
|
49
|
-
if (!data)
|
|
50
|
-
return null;
|
|
51
|
-
// Check expiration
|
|
52
|
-
if (Date.now() > data.expiresAt) {
|
|
53
|
-
this.tokens.delete(token);
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
// Check if already fulfilled
|
|
57
|
-
if (data.fulfilled) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return data;
|
|
61
|
-
}
|
|
62
|
-
async fulfill(token) {
|
|
63
|
-
const data = this.tokens.get(token);
|
|
64
|
-
if (data) {
|
|
65
|
-
data.fulfilled = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
clear() {
|
|
69
|
-
this.tokens.clear();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.MemoryResumeTokenStore = MemoryResumeTokenStore;
|
|
73
|
-
/**
|
|
74
|
-
* Main auth handshake function
|
|
75
|
-
*
|
|
76
|
-
* Verifies agent authorization or returns authorization hints
|
|
77
|
-
*
|
|
78
|
-
* @param agentDid - Agent DID requesting access
|
|
79
|
-
* @param scopes - Required permission scopes
|
|
80
|
-
* @param config - Auth handshake configuration
|
|
81
|
-
* @param resumeToken - Optional resume token from previous authorization
|
|
82
|
-
* @returns Verification result with delegation or auth error
|
|
83
|
-
*/
|
|
84
|
-
async function verifyOrHints(agentDid, scopes, config, _resumeToken) {
|
|
85
|
-
const startTime = Date.now();
|
|
86
|
-
if (config.debug) {
|
|
87
|
-
console.error(`[AuthHandshake] Verifying ${agentDid} for scopes: ${scopes.join(", ")}`);
|
|
88
|
-
}
|
|
89
|
-
// Step 1: Check reputation (optional, if KTA configured)
|
|
90
|
-
let reputation;
|
|
91
|
-
if (config.kta && config.bouncer.minReputationScore !== undefined) {
|
|
92
|
-
try {
|
|
93
|
-
reputation = await fetchAgentReputation(agentDid, config.kta);
|
|
94
|
-
if (config.debug) {
|
|
95
|
-
console.error(`[AuthHandshake] Reputation score: ${reputation.score}`);
|
|
96
|
-
}
|
|
97
|
-
// If reputation is too low, require authorization
|
|
98
|
-
if (reputation.score < config.bouncer.minReputationScore) {
|
|
99
|
-
if (config.debug) {
|
|
100
|
-
console.error(`[AuthHandshake] Reputation ${reputation.score} < ${config.bouncer.minReputationScore}, requiring authorization`);
|
|
101
|
-
}
|
|
102
|
-
const authError = await buildNeedsAuthorizationError(agentDid, scopes, config, "Agent reputation score below threshold");
|
|
103
|
-
return {
|
|
104
|
-
authorized: false,
|
|
105
|
-
authError,
|
|
106
|
-
reputation,
|
|
107
|
-
reason: "Low reputation score",
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
// Don't fail hard on reputation check failure
|
|
113
|
-
console.warn("[AuthHandshake] Failed to check reputation:", error);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// Step 2: Check for existing delegation
|
|
117
|
-
let delegationResult;
|
|
118
|
-
try {
|
|
119
|
-
delegationResult = await config.delegationVerifier.verify(agentDid, scopes);
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
console.error("[AuthHandshake] Delegation verification failed:", error);
|
|
123
|
-
const errorMessage = `Delegation verification error: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
124
|
-
const authError = await buildNeedsAuthorizationError(agentDid, scopes, config, errorMessage);
|
|
125
|
-
return {
|
|
126
|
-
authorized: false,
|
|
127
|
-
authError,
|
|
128
|
-
reason: errorMessage,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
// Step 3: If delegation exists and valid, authorize immediately
|
|
132
|
-
if (delegationResult.valid && delegationResult.delegation) {
|
|
133
|
-
if (config.debug) {
|
|
134
|
-
console.error(`[AuthHandshake] Delegation valid, authorized (${Date.now() - startTime}ms)`);
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
authorized: true,
|
|
138
|
-
delegation: delegationResult.delegation,
|
|
139
|
-
credential: delegationResult.credential, // Include credential for auth method validation
|
|
140
|
-
reputation,
|
|
141
|
-
reason: "Valid delegation found",
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
// Step 4: No delegation found - return needs_authorization error
|
|
145
|
-
if (config.debug) {
|
|
146
|
-
console.error(`[AuthHandshake] No delegation found, returning needs_authorization (${Date.now() - startTime}ms)`);
|
|
147
|
-
}
|
|
148
|
-
const authError = await buildNeedsAuthorizationError(agentDid, scopes, config, delegationResult.reason || "No valid delegation found");
|
|
149
|
-
return {
|
|
150
|
-
authorized: false,
|
|
151
|
-
authError,
|
|
152
|
-
reputation,
|
|
153
|
-
reason: delegationResult.reason || "No delegation",
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Fetch agent reputation from KTA
|
|
158
|
-
*
|
|
159
|
-
* @param agentDid - Agent DID
|
|
160
|
-
* @param ktaConfig - KTA API configuration
|
|
161
|
-
* @returns Agent reputation data
|
|
162
|
-
*/
|
|
163
|
-
async function fetchAgentReputation(agentDid, ktaConfig) {
|
|
164
|
-
const apiUrl = ktaConfig.apiUrl.replace(/\/$/, "");
|
|
165
|
-
const headers = {
|
|
166
|
-
"Content-Type": "application/json",
|
|
167
|
-
};
|
|
168
|
-
if (ktaConfig.apiKey) {
|
|
169
|
-
headers["X-API-Key"] = ktaConfig.apiKey;
|
|
170
|
-
}
|
|
171
|
-
const response = await fetch(`${apiUrl}/api/v1/reputation/${encodeURIComponent(agentDid)}`, {
|
|
172
|
-
method: "GET",
|
|
173
|
-
headers,
|
|
174
|
-
});
|
|
175
|
-
if (!response.ok) {
|
|
176
|
-
if (response.status === 404) {
|
|
177
|
-
// Agent not registered, return default "unknown" reputation
|
|
178
|
-
return {
|
|
179
|
-
agentDid,
|
|
180
|
-
score: 50, // Neutral score
|
|
181
|
-
totalInteractions: 0,
|
|
182
|
-
successRate: 0,
|
|
183
|
-
riskLevel: "unknown",
|
|
184
|
-
updatedAt: Date.now(),
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
throw new Error(`KTA API error: ${response.status} ${response.statusText}`);
|
|
188
|
-
}
|
|
189
|
-
const data = await response.json();
|
|
190
|
-
return {
|
|
191
|
-
agentDid: data.agentDid || agentDid,
|
|
192
|
-
score: data.score || 50,
|
|
193
|
-
totalInteractions: data.totalInteractions || 0,
|
|
194
|
-
successRate: data.successRate || 0,
|
|
195
|
-
riskLevel: data.riskLevel || "unknown",
|
|
196
|
-
updatedAt: data.updatedAt || Date.now(),
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Build needs_authorization error with hints
|
|
201
|
-
*
|
|
202
|
-
* @param agentDid - Agent DID
|
|
203
|
-
* @param scopes - Required scopes
|
|
204
|
-
* @param config - Auth handshake configuration
|
|
205
|
-
* @param message - Human-readable error message
|
|
206
|
-
* @returns NeedsAuthorizationError
|
|
207
|
-
*/
|
|
208
|
-
async function buildNeedsAuthorizationError(agentDid, scopes, config, message) {
|
|
209
|
-
// Use the persistent resume token store from config
|
|
210
|
-
const resumeToken = await config.resumeTokenStore.create(agentDid, scopes, {
|
|
211
|
-
requestedAt: Date.now(),
|
|
212
|
-
});
|
|
213
|
-
const expiresAt = Date.now() + (config.bouncer.resumeTokenTtl || 600_000);
|
|
214
|
-
// Build authorization URL
|
|
215
|
-
const authUrl = new URL(config.bouncer.authorizationUrl);
|
|
216
|
-
authUrl.searchParams.set("agent_did", agentDid);
|
|
217
|
-
authUrl.searchParams.set("scopes", scopes.join(","));
|
|
218
|
-
authUrl.searchParams.set("resume_token", resumeToken);
|
|
219
|
-
// Generate short authorization code (for display)
|
|
220
|
-
const authCode = resumeToken.substring(0, 8).toUpperCase();
|
|
221
|
-
// Build display hints
|
|
222
|
-
const display = {
|
|
223
|
-
title: "Authorization Required",
|
|
224
|
-
hint: ["link", "qr"],
|
|
225
|
-
authorizationCode: authCode,
|
|
226
|
-
qrUrl: `https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=${encodeURIComponent(authUrl.toString())}`,
|
|
227
|
-
};
|
|
228
|
-
return (0, runtime_1.createNeedsAuthorizationError)({
|
|
229
|
-
message,
|
|
230
|
-
authorizationUrl: authUrl.toString(),
|
|
231
|
-
resumeToken,
|
|
232
|
-
expiresAt,
|
|
233
|
-
scopes,
|
|
234
|
-
display,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Helper: Check if scopes are sensitive and require authorization
|
|
239
|
-
*
|
|
240
|
-
* @param scopes - Scopes to check
|
|
241
|
-
* @returns true if scopes are sensitive
|
|
242
|
-
*/
|
|
243
|
-
function hasSensitiveScopes(scopes) {
|
|
244
|
-
const sensitivePatterns = [
|
|
245
|
-
"write",
|
|
246
|
-
"delete",
|
|
247
|
-
"admin",
|
|
248
|
-
"payment",
|
|
249
|
-
"transfer",
|
|
250
|
-
"execute",
|
|
251
|
-
"modify",
|
|
252
|
-
];
|
|
253
|
-
return scopes.some((scope) => sensitivePatterns.some((pattern) => scope.toLowerCase().includes(pattern)));
|
|
254
|
-
}
|
|
9
|
+
exports.MemoryResumeTokenStore = exports.hasSensitiveScopes = exports.verifyOrHints = void 0;
|
|
10
|
+
var mcp_i_core_1 = require("@kya-os/mcp-i-core");
|
|
11
|
+
Object.defineProperty(exports, "verifyOrHints", { enumerable: true, get: function () { return mcp_i_core_1.verifyOrHints; } });
|
|
12
|
+
Object.defineProperty(exports, "hasSensitiveScopes", { enumerable: true, get: function () { return mcp_i_core_1.hasSensitiveScopes; } });
|
|
13
|
+
Object.defineProperty(exports, "MemoryResumeTokenStore", { enumerable: true, get: function () { return mcp_i_core_1.MemoryResumeTokenStore; } });
|