@kya-os/mcp-i 1.5.1 → 1.5.2
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.
|
@@ -42,6 +42,8 @@ export interface AgentReputation {
|
|
|
42
42
|
export interface AuthHandshakeConfig {
|
|
43
43
|
/** Delegation verifier instance */
|
|
44
44
|
delegationVerifier: DelegationVerifier;
|
|
45
|
+
/** Resume token store (REQUIRED to persist tokens across calls) */
|
|
46
|
+
resumeTokenStore: ResumeTokenStore;
|
|
45
47
|
/** KTA API configuration (optional, for reputation checks) */
|
|
46
48
|
kta?: {
|
|
47
49
|
apiUrl: string;
|
|
@@ -205,9 +205,8 @@ async function fetchAgentReputation(agentDid, ktaConfig) {
|
|
|
205
205
|
* @returns NeedsAuthorizationError
|
|
206
206
|
*/
|
|
207
207
|
async function buildNeedsAuthorizationError(agentDid, scopes, config, message) {
|
|
208
|
-
//
|
|
209
|
-
const
|
|
210
|
-
const resumeToken = await resumeTokenStore.create(agentDid, scopes, {
|
|
208
|
+
// Use the persistent resume token store from config
|
|
209
|
+
const resumeToken = await config.resumeTokenStore.create(agentDid, scopes, {
|
|
211
210
|
requestedAt: Date.now(),
|
|
212
211
|
});
|
|
213
212
|
const expiresAt = Date.now() + (config.bouncer.resumeTokenTtl || 600_000);
|
|
@@ -28,6 +28,7 @@ class MCPIRuntime {
|
|
|
28
28
|
debugManager;
|
|
29
29
|
demoManager;
|
|
30
30
|
delegationVerifier; // NEW - Phase 1
|
|
31
|
+
resumeTokenStore; // NEW - Phase 1
|
|
31
32
|
config;
|
|
32
33
|
cachedIdentity;
|
|
33
34
|
constructor(config = {}) {
|
|
@@ -41,6 +42,9 @@ class MCPIRuntime {
|
|
|
41
42
|
this.sessionManager = new session_1.SessionManager(config.session);
|
|
42
43
|
// Initialize audit logger
|
|
43
44
|
this.auditLogger = new audit_1.AuditLogger(config.audit);
|
|
45
|
+
// Initialize resume token store (NEW - Phase 1)
|
|
46
|
+
// Use in-memory store by default (sufficient for most use cases)
|
|
47
|
+
this.resumeTokenStore = new auth_handshake_1.MemoryResumeTokenStore(config.delegation?.authorization?.resumeTokenTtl || 600_000);
|
|
44
48
|
// Initialize delegation verifier (NEW - Phase 1)
|
|
45
49
|
if (config.delegation?.enabled && config.delegation?.verifier) {
|
|
46
50
|
this.delegationVerifier = (0, delegation_verifier_1.createDelegationVerifier)(config.delegation.verifier);
|
|
@@ -113,6 +117,7 @@ class MCPIRuntime {
|
|
|
113
117
|
// Build auth handshake config
|
|
114
118
|
const authConfig = {
|
|
115
119
|
delegationVerifier: this.delegationVerifier,
|
|
120
|
+
resumeTokenStore: this.resumeTokenStore,
|
|
116
121
|
kta: this.config.delegation.authorization?.kta,
|
|
117
122
|
bouncer: {
|
|
118
123
|
authorizationUrl: this.config.delegation.authorization?.authorizationUrl ||
|