@kya-os/mcp-i-core 1.8.0 → 1.8.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.
- package/dist/conformance/capability-verifier-adapter.d.ts +66 -0
- package/dist/conformance/capability-verifier-adapter.js +61 -0
- package/dist/conformance/index.d.ts +3 -1
- package/dist/conformance/index.js +7 -1
- package/dist/conformance/validate-level2.d.ts +13 -3
- package/dist/conformance/validate-level2.js +15 -5
- package/dist/conformance/vc-jwt-verifier.d.ts +55 -0
- package/dist/conformance/vc-jwt-verifier.js +147 -0
- package/dist/delegation/did-web-resolver.d.ts +60 -0
- package/dist/delegation/did-web-resolver.js +129 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -1
- package/package.json +3 -3
- package/dist/auth/handshake.d.ts +0 -119
- package/dist/auth/handshake.js +0 -250
- package/dist/auth/index.d.ts +0 -6
- package/dist/auth/index.js +0 -11
- package/dist/auth/types.d.ts +0 -46
- package/dist/auth/types.js +0 -10
- package/dist/cache/oauth-config-cache.d.ts +0 -69
- package/dist/cache/oauth-config-cache.js +0 -76
- package/dist/cache/tool-protection-cache.d.ts +0 -89
- package/dist/cache/tool-protection-cache.js +0 -118
- package/dist/compliance/index.d.ts +0 -8
- package/dist/compliance/index.js +0 -24
- package/dist/compliance/schema-registry.d.ts +0 -50
- package/dist/compliance/schema-registry.js +0 -438
- package/dist/compliance/schema-verifier.d.ts +0 -110
- package/dist/compliance/schema-verifier.js +0 -518
- package/dist/config/remote-config.d.ts +0 -173
- package/dist/config/remote-config.js +0 -253
- package/dist/config.d.ts +0 -182
- package/dist/config.js +0 -148
- package/dist/identity/idp-token-resolver.d.ts +0 -69
- package/dist/identity/idp-token-resolver.js +0 -136
- package/dist/identity/idp-token-storage.interface.d.ts +0 -80
- package/dist/identity/idp-token-storage.interface.js +0 -14
- package/dist/identity/user-did-manager.d.ts +0 -228
- package/dist/identity/user-did-manager.js +0 -356
- package/dist/logging/index.d.ts +0 -5
- package/dist/logging/index.js +0 -10
- package/dist/logging/logger.d.ts +0 -33
- package/dist/logging/logger.js +0 -104
- package/dist/proof/generator.d.ts +0 -109
- package/dist/proof/generator.js +0 -236
- package/dist/proof/index.d.ts +0 -5
- package/dist/proof/index.js +0 -11
- package/dist/providers/base.d.ts +0 -95
- package/dist/providers/base.js +0 -47
- package/dist/providers/memory.d.ts +0 -42
- package/dist/providers/memory.js +0 -121
- package/dist/runtime/audit-logger.d.ts +0 -37
- package/dist/runtime/audit-logger.js +0 -9
- package/dist/runtime/base.d.ts +0 -375
- package/dist/runtime/base.js +0 -1491
- package/dist/runtime/ext-apps-constants.d.ts +0 -14
- package/dist/runtime/ext-apps-constants.js +0 -17
- package/dist/services/access-control.service.d.ts +0 -138
- package/dist/services/access-control.service.js +0 -721
- package/dist/services/authorization/authorization-registry.d.ts +0 -29
- package/dist/services/authorization/authorization-registry.js +0 -58
- package/dist/services/authorization/types.d.ts +0 -53
- package/dist/services/authorization/types.js +0 -10
- package/dist/services/batch-delegation.service.d.ts +0 -53
- package/dist/services/batch-delegation.service.js +0 -95
- package/dist/services/crypto.service.d.ts +0 -69
- package/dist/services/crypto.service.js +0 -225
- package/dist/services/delegation-error-formatter.d.ts +0 -124
- package/dist/services/delegation-error-formatter.js +0 -214
- package/dist/services/errors.d.ts +0 -49
- package/dist/services/errors.js +0 -66
- package/dist/services/index.d.ts +0 -9
- package/dist/services/index.js +0 -15
- package/dist/services/oauth-config.service.d.ts +0 -53
- package/dist/services/oauth-config.service.js +0 -141
- package/dist/services/oauth-provider-registry.d.ts +0 -88
- package/dist/services/oauth-provider-registry.js +0 -128
- package/dist/services/oauth-service.d.ts +0 -122
- package/dist/services/oauth-service.js +0 -442
- package/dist/services/oauth-token-retrieval.service.d.ts +0 -49
- package/dist/services/oauth-token-retrieval.service.js +0 -150
- package/dist/services/policy.service.d.ts +0 -130
- package/dist/services/policy.service.js +0 -399
- package/dist/services/proof-verifier.d.ts +0 -98
- package/dist/services/proof-verifier.js +0 -319
- package/dist/services/provider-resolver.d.ts +0 -89
- package/dist/services/provider-resolver.js +0 -196
- package/dist/services/provider-validator.d.ts +0 -55
- package/dist/services/provider-validator.js +0 -135
- package/dist/services/session-registration.service.d.ts +0 -80
- package/dist/services/session-registration.service.js +0 -174
- package/dist/services/storage.service.d.ts +0 -116
- package/dist/services/storage.service.js +0 -411
- package/dist/services/tool-context-builder.d.ts +0 -74
- package/dist/services/tool-context-builder.js +0 -215
- package/dist/services/tool-protection.service.d.ts +0 -193
- package/dist/services/tool-protection.service.js +0 -736
- package/dist/session/index.d.ts +0 -5
- package/dist/session/index.js +0 -11
- package/dist/session/manager.d.ts +0 -113
- package/dist/session/manager.js +0 -273
- package/dist/types/oauth-required-error.d.ts +0 -46
- package/dist/types/oauth-required-error.js +0 -42
- package/dist/types/tool-protection.d.ts +0 -144
- package/dist/types/tool-protection.js +0 -48
- package/dist/utils/cors.d.ts +0 -44
- package/dist/utils/cors.js +0 -71
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.js +0 -24
- package/dist/utils/storage-keys.d.ts +0 -120
- package/dist/utils/storage-keys.js +0 -217
package/dist/runtime/base.d.ts
DELETED
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCPIRuntimeBase - Provider-based runtime
|
|
3
|
-
*
|
|
4
|
-
* Core runtime that accepts providers for all platform-specific operations.
|
|
5
|
-
* This enables the same runtime logic to work across Node.js, Cloudflare Workers,
|
|
6
|
-
* and other platforms.
|
|
7
|
-
*/
|
|
8
|
-
import { CryptoProvider, ClockProvider, FetchProvider, StorageProvider, NonceCacheProvider, IdentityProvider, AgentIdentity } from "../providers/base";
|
|
9
|
-
import { type Ed25519JWK } from "../services/crypto.service.js";
|
|
10
|
-
import { ProofVerifier } from "../services/proof-verifier.js";
|
|
11
|
-
import type { DetachedProof } from "@kya-os/contracts/proof";
|
|
12
|
-
import type { HandshakeRequest } from "@kya-os/contracts/handshake";
|
|
13
|
-
import type { MCPIdentity, WellKnownConfig, WellKnownResponse } from "@kya-os/contracts/well-known";
|
|
14
|
-
import type { AccessControlApiService } from "../services/access-control.service.js";
|
|
15
|
-
import type { ProviderRuntimeConfig } from "../config";
|
|
16
|
-
import { type OAuthIdentity } from "../identity/user-did-manager";
|
|
17
|
-
import type { IAuditLogger } from "./audit-logger.js";
|
|
18
|
-
/**
|
|
19
|
-
* Interface for runtime instances that have AccessControlApiService available
|
|
20
|
-
* This allows type-safe access to the access control service without using `as any`
|
|
21
|
-
*
|
|
22
|
-
* @deprecated AccessControlApiService is now directly available as protected property on MCPIRuntimeBase
|
|
23
|
-
*/
|
|
24
|
-
export interface RuntimeWithAccessControl {
|
|
25
|
-
accessControlService?: AccessControlApiService;
|
|
26
|
-
}
|
|
27
|
-
type RuntimeRecord = Record<string, unknown>;
|
|
28
|
-
type RuntimeHandshakeRequest = Partial<HandshakeRequest> & RuntimeRecord & {
|
|
29
|
-
audience?: string;
|
|
30
|
-
agentDid?: string;
|
|
31
|
-
clientInfo?: RuntimeRecord;
|
|
32
|
-
clientProtocolVersion?: unknown;
|
|
33
|
-
clientCapabilities?: unknown;
|
|
34
|
-
clientDid?: string;
|
|
35
|
-
oauthIdentity?: OAuthIdentity | null;
|
|
36
|
-
};
|
|
37
|
-
interface RuntimeHandshakeResponse {
|
|
38
|
-
sessionId: string;
|
|
39
|
-
agentDid: string;
|
|
40
|
-
timestamp: number;
|
|
41
|
-
capabilities: string[];
|
|
42
|
-
userDid?: string;
|
|
43
|
-
signature: string;
|
|
44
|
-
}
|
|
45
|
-
interface RuntimeSessionContext {
|
|
46
|
-
id?: string;
|
|
47
|
-
audience?: string;
|
|
48
|
-
createdAt?: number;
|
|
49
|
-
expiresAt?: number;
|
|
50
|
-
clientDid?: string;
|
|
51
|
-
userDid?: string;
|
|
52
|
-
agentDid?: string;
|
|
53
|
-
serverDid?: string;
|
|
54
|
-
nonce?: string;
|
|
55
|
-
delegationToken?: string;
|
|
56
|
-
consentProof?: string;
|
|
57
|
-
projectId?: string;
|
|
58
|
-
serverOrigin?: string;
|
|
59
|
-
userAgent?: string;
|
|
60
|
-
clientId?: string;
|
|
61
|
-
agentName?: string;
|
|
62
|
-
clientInfo?: Record<string, unknown>;
|
|
63
|
-
identityState?: "anonymous" | "authenticated";
|
|
64
|
-
oauthIdentity?: OAuthIdentity;
|
|
65
|
-
canonicalPayload?: string;
|
|
66
|
-
[key: string]: unknown;
|
|
67
|
-
}
|
|
68
|
-
interface StoredRuntimeSession extends RuntimeSessionContext {
|
|
69
|
-
id: string;
|
|
70
|
-
createdAt: number;
|
|
71
|
-
expiresAt: number;
|
|
72
|
-
}
|
|
73
|
-
interface LegacyProof {
|
|
74
|
-
timestamp: number;
|
|
75
|
-
nonce: string;
|
|
76
|
-
did: string;
|
|
77
|
-
signature: string;
|
|
78
|
-
algorithm: "Ed25519";
|
|
79
|
-
sessionId?: string;
|
|
80
|
-
audience?: string;
|
|
81
|
-
}
|
|
82
|
-
type RuntimeProof = LegacyProof | DetachedProof;
|
|
83
|
-
type RuntimeAuditLogger = IAuditLogger | {
|
|
84
|
-
log: (event: string, data: unknown) => void;
|
|
85
|
-
};
|
|
86
|
-
export declare class MCPIRuntimeBase {
|
|
87
|
-
protected crypto: CryptoProvider;
|
|
88
|
-
protected clock: ClockProvider;
|
|
89
|
-
protected fetch: FetchProvider;
|
|
90
|
-
protected storage: StorageProvider;
|
|
91
|
-
protected nonceCache: NonceCacheProvider;
|
|
92
|
-
protected identity: IdentityProvider;
|
|
93
|
-
protected config: ProviderRuntimeConfig;
|
|
94
|
-
private cachedIdentity?;
|
|
95
|
-
private sessions;
|
|
96
|
-
private lastProof?;
|
|
97
|
-
private userDidManager?;
|
|
98
|
-
private interceptedCalls;
|
|
99
|
-
private cryptoService?;
|
|
100
|
-
protected proofVerifier?: ProofVerifier;
|
|
101
|
-
protected accessControlService?: AccessControlApiService;
|
|
102
|
-
/**
|
|
103
|
-
* Cached flag indicating whether @modelcontextprotocol/ext-apps is available.
|
|
104
|
-
* Set by subclasses after a successful dynamic import (avoids require() vs ESM issues).
|
|
105
|
-
* When undefined, falls back to synchronous require() probe.
|
|
106
|
-
*/
|
|
107
|
-
private _extAppsAvailable?;
|
|
108
|
-
constructor(config: ProviderRuntimeConfig);
|
|
109
|
-
/**
|
|
110
|
-
* Initialize the runtime
|
|
111
|
-
*/
|
|
112
|
-
initialize(): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Get the current agent identity
|
|
115
|
-
*/
|
|
116
|
-
getIdentity(): Promise<AgentIdentity>;
|
|
117
|
-
/**
|
|
118
|
-
* Handle MCP handshake request
|
|
119
|
-
*
|
|
120
|
-
* Phase 5: Anonymous Sessions Until OAuth
|
|
121
|
-
* - Sessions start anonymous (no userDid) unless OAuth identity provided
|
|
122
|
-
* - User DID is resolved via AgentShield after OAuth completes
|
|
123
|
-
* - Eliminates DID fragmentation (same user = same DID across sessions)
|
|
124
|
-
*
|
|
125
|
-
* @param request - Handshake request object (may include oauthIdentity for persistent user DID lookup)
|
|
126
|
-
* @returns Handshake response with session ID and agent DID
|
|
127
|
-
*/
|
|
128
|
-
handleHandshake(request: RuntimeHandshakeRequest): Promise<RuntimeHandshakeResponse>;
|
|
129
|
-
/**
|
|
130
|
-
* Update session identity after OAuth resolution (Phase 5)
|
|
131
|
-
*
|
|
132
|
-
* Called after AgentShield identity/resolve returns a persistent user DID.
|
|
133
|
-
* Updates the session to authenticated state with the resolved DID.
|
|
134
|
-
*
|
|
135
|
-
* @param sessionId - MCP session ID
|
|
136
|
-
* @param userDid - Persistent user DID from AgentShield
|
|
137
|
-
* @param oauthIdentity - OAuth identity information
|
|
138
|
-
* @throws Error if session not found
|
|
139
|
-
*/
|
|
140
|
-
updateSessionIdentity(sessionId: string, userDid: string, oauthIdentity?: {
|
|
141
|
-
provider: string;
|
|
142
|
-
subject: string;
|
|
143
|
-
email?: string;
|
|
144
|
-
}): Promise<void>;
|
|
145
|
-
/**
|
|
146
|
-
* Get session by ID
|
|
147
|
-
*/
|
|
148
|
-
getSession(sessionId: string): StoredRuntimeSession | undefined;
|
|
149
|
-
/**
|
|
150
|
-
* Extract the correct provider for consent URL from tool protection config
|
|
151
|
-
*
|
|
152
|
-
* For password auth tools, the provider is in authorization.provider.
|
|
153
|
-
* For OAuth auth tools, the provider is in oauthProvider (legacy) or authorization.provider.
|
|
154
|
-
*
|
|
155
|
-
* Note: Not all authorization types have a provider field (e.g., 'none', 'mdl', 'webauthn').
|
|
156
|
-
* Only 'oauth', 'oauth2', 'password', and 'idv' types have provider.
|
|
157
|
-
*
|
|
158
|
-
* @param protection - Tool protection configuration
|
|
159
|
-
* @returns Provider name to use in consent URL, or undefined
|
|
160
|
-
*/
|
|
161
|
-
private getConsentProvider;
|
|
162
|
-
/**
|
|
163
|
-
* Process tool call with automatic proof generation
|
|
164
|
-
* Returns clean result only - proof is stored for out-of-band retrieval
|
|
165
|
-
*
|
|
166
|
-
* @param toolName - Name of the tool being called
|
|
167
|
-
* @param args - Tool arguments
|
|
168
|
-
* @param handler - Tool execution handler
|
|
169
|
-
* @param session - Session context (expected fields: id, audience, nonce?, delegationToken?, consentProof?)
|
|
170
|
-
*/
|
|
171
|
-
processToolCall<TArgs = unknown, TResult = unknown>(toolName: string, args: TArgs, handler: (args: TArgs) => Promise<TResult>, session?: RuntimeSessionContext): Promise<TResult | RuntimeRecord>;
|
|
172
|
-
/**
|
|
173
|
-
* Resume a tool call after authorization
|
|
174
|
-
*
|
|
175
|
-
* @param resumeToken - Token from DelegationRequiredError
|
|
176
|
-
* @param handler - Tool execution handler
|
|
177
|
-
* @param delegationToken - Delegation token from authorization
|
|
178
|
-
* @returns Tool execution result
|
|
179
|
-
*/
|
|
180
|
-
resumeToolCall(resumeToken: string, handler: (args: unknown) => Promise<unknown>, delegationToken?: string): Promise<unknown>;
|
|
181
|
-
/**
|
|
182
|
-
* Generate a resume token for intercepted tool call
|
|
183
|
-
*
|
|
184
|
-
* Uses cryptographically secure random bytes for token generation.
|
|
185
|
-
* The token is used as an opaque lookup key in the interceptedCalls Map.
|
|
186
|
-
*/
|
|
187
|
-
private generateResumeToken;
|
|
188
|
-
/**
|
|
189
|
-
* Clean up expired intercepted calls
|
|
190
|
-
*/
|
|
191
|
-
private cleanupExpiredInterceptedCalls;
|
|
192
|
-
/**
|
|
193
|
-
* Build consent URL for AgentShield delegation flow
|
|
194
|
-
*
|
|
195
|
-
* Note: Parameter names use snake_case for AgentShield API compatibility.
|
|
196
|
-
* This is documented in docs/API_PARITY_GUIDE.md under "Field Naming Conventions".
|
|
197
|
-
*
|
|
198
|
-
* AgentShield API requires snake_case in URL parameters:
|
|
199
|
-
* - session_id (not sessionId)
|
|
200
|
-
* - agent_did (not agentDid)
|
|
201
|
-
* - resume_token (not resumeToken)
|
|
202
|
-
* - agent_name (human-readable agent name for dashboard display)
|
|
203
|
-
*
|
|
204
|
-
* @param toolName - Tool that requires delegation
|
|
205
|
-
* @param scopes - Required scopes for the tool
|
|
206
|
-
* @param session - Current session context
|
|
207
|
-
* @param resumeToken - Token to resume after delegation
|
|
208
|
-
* @param projectId - Project ID for AgentShield API
|
|
209
|
-
* @param provider - Provider name (e.g., "github", "credentials") to select specific auth method
|
|
210
|
-
* @returns Full consent URL with snake_case parameters
|
|
211
|
-
*/
|
|
212
|
-
/**
|
|
213
|
-
* MCP Apps UI consent resource URI.
|
|
214
|
-
* Single shared resource for all consent flows - tool-specific data
|
|
215
|
-
* is passed via structuredContent in the tool result.
|
|
216
|
-
*/
|
|
217
|
-
protected static readonly CONSENT_UI_RESOURCE_URI = "ui://mcpi-consent/authorize";
|
|
218
|
-
/**
|
|
219
|
-
* Check if the connected MCP client supports MCP Apps UI rendering.
|
|
220
|
-
* Returns false if @modelcontextprotocol/ext-apps is not installed
|
|
221
|
-
* or the client didn't advertise the io.modelcontextprotocol/ui capability.
|
|
222
|
-
*
|
|
223
|
-
* Override in subclasses to provide client capabilities from the MCP session.
|
|
224
|
-
*/
|
|
225
|
-
protected hasUICapability(clientCapabilities?: Record<string, unknown>): boolean;
|
|
226
|
-
/**
|
|
227
|
-
* Mark the ext-apps SDK as available.
|
|
228
|
-
* Called by subclasses after a successful dynamic import() of the SDK,
|
|
229
|
-
* which avoids the CJS require() vs ESM incompatibility that causes
|
|
230
|
-
* the synchronous probe to fail in Cloudflare Workers.
|
|
231
|
-
*/
|
|
232
|
-
setExtAppsAvailable(available: boolean): void;
|
|
233
|
-
/**
|
|
234
|
-
* Check if the MCP Apps inline consent UI is enabled.
|
|
235
|
-
* Requires BOTH conditions:
|
|
236
|
-
* 1. The SDK is available (set via setExtAppsAvailable(true) after dynamic import)
|
|
237
|
-
* 2. The config flag is enabled (config.inlineConsent === true OR MCPI_INLINE_CONSENT env var)
|
|
238
|
-
* This allows merging the feature while keeping it off by default.
|
|
239
|
-
*/
|
|
240
|
-
protected isExtAppsAvailable(): boolean;
|
|
241
|
-
/**
|
|
242
|
-
* Build an MCP Apps-compatible tool result that renders an inline consent UI.
|
|
243
|
-
* Returns null when the host doesn't support MCP Apps or the SDK is unavailable,
|
|
244
|
-
* allowing callers to fall back to DelegationRequiredError.
|
|
245
|
-
*
|
|
246
|
-
* @param toolName - Tool requiring delegation
|
|
247
|
-
* @param scopes - Required scopes
|
|
248
|
-
* @param session - Current session context
|
|
249
|
-
* @param resumeToken - Token to resume after delegation
|
|
250
|
-
* @param projectId - AgentShield project ID
|
|
251
|
-
* @param serverUrl - Server URL for consent approval POST
|
|
252
|
-
* @param clientCapabilities - MCP client capabilities from the session
|
|
253
|
-
*/
|
|
254
|
-
buildConsentUIResult(toolName: string, scopes: string[], session?: Record<string, unknown>, resumeToken?: string, projectId?: string, serverUrl?: string, clientCapabilities?: Record<string, unknown>, authMode?: "consent-only" | "credentials", provider?: string): Record<string, unknown> | null;
|
|
255
|
-
protected buildConsentUrl(toolName: string, scopes: string[], session?: RuntimeSessionContext, resumeToken?: string, projectId?: string, provider?: string): string;
|
|
256
|
-
/**
|
|
257
|
-
* Issue a new nonce and register it in the cache
|
|
258
|
-
* Use this to get a nonce for the session context before calling processToolCall
|
|
259
|
-
*/
|
|
260
|
-
issueNonce(sessionId: string): Promise<string>;
|
|
261
|
-
/**
|
|
262
|
-
* Create cryptographic proof for data
|
|
263
|
-
*/
|
|
264
|
-
createProof(data: unknown, session?: RuntimeSessionContext): Promise<RuntimeProof>;
|
|
265
|
-
/**
|
|
266
|
-
* Verify a proof
|
|
267
|
-
*
|
|
268
|
-
* Supports both old format (data, proof) and new DetachedProof format.
|
|
269
|
-
* When DetachedProof format is used, ProofVerifier is used if available.
|
|
270
|
-
*
|
|
271
|
-
* @param dataOrProof - Either raw data (old format) or DetachedProof (new format)
|
|
272
|
-
* @param proofOrSession - Either proof object (old format) or session context (new format)
|
|
273
|
-
* @returns true if proof is valid, false otherwise
|
|
274
|
-
*/
|
|
275
|
-
verifyProof(dataOrProof: unknown, proofOrSession?: unknown): Promise<boolean>;
|
|
276
|
-
/**
|
|
277
|
-
* Legacy proof verification (backward compatibility)
|
|
278
|
-
* @internal
|
|
279
|
-
*/
|
|
280
|
-
private verifyProofLegacy;
|
|
281
|
-
/**
|
|
282
|
-
* Verify a JWS proof (full compact JWS format: header.payload.signature)
|
|
283
|
-
*
|
|
284
|
-
* This method provides full cryptographic signature verification using CryptoService.
|
|
285
|
-
* Use this when you have a DetachedProof with JWS instead of raw signature.
|
|
286
|
-
*
|
|
287
|
-
* @param jws - Full compact JWS string (header.payload.signature)
|
|
288
|
-
* @param publicKeyJwk - Ed25519 public key in JWK format
|
|
289
|
-
* @param detachedPayload - Optional detached payload for detached JWS format
|
|
290
|
-
* @returns true if signature is valid, false otherwise
|
|
291
|
-
*/
|
|
292
|
-
verifyProofJWS(jws: string, publicKeyJwk: Ed25519JWK, detachedPayload?: string | Uint8Array): Promise<boolean>;
|
|
293
|
-
/**
|
|
294
|
-
* Get current session
|
|
295
|
-
*/
|
|
296
|
-
getCurrentSession(): Promise<StoredRuntimeSession | null>;
|
|
297
|
-
/**
|
|
298
|
-
* Get the last generated proof for out-of-band transport
|
|
299
|
-
*/
|
|
300
|
-
getLastProof(): RuntimeProof | undefined;
|
|
301
|
-
/**
|
|
302
|
-
* Create well-known handler for identity verification
|
|
303
|
-
*/
|
|
304
|
-
createWellKnownHandler(config?: WellKnownConfig): (path: string) => Promise<WellKnownResponse | MCPIdentity | null>;
|
|
305
|
-
/**
|
|
306
|
-
* Create debug endpoint (development only)
|
|
307
|
-
*/
|
|
308
|
-
createDebugEndpoint(): (() => Promise<RuntimeRecord>) | null;
|
|
309
|
-
/**
|
|
310
|
-
* Get audit logger
|
|
311
|
-
*/
|
|
312
|
-
getAuditLogger(): RuntimeAuditLogger | undefined;
|
|
313
|
-
/**
|
|
314
|
-
* Rotate keys
|
|
315
|
-
*/
|
|
316
|
-
rotateKeys(): Promise<AgentIdentity>;
|
|
317
|
-
private signData;
|
|
318
|
-
private generateNonce;
|
|
319
|
-
/**
|
|
320
|
-
* Generate a unique session ID
|
|
321
|
-
* Uses mcpi_{uuid} format for MCP protocol compliance and traceability
|
|
322
|
-
*/
|
|
323
|
-
private generateSessionId;
|
|
324
|
-
/**
|
|
325
|
-
* Log structured events in JSON format (NOT frozen audit format).
|
|
326
|
-
*
|
|
327
|
-
* **Important:** This method logs events in JSON format for general runtime events
|
|
328
|
-
* (e.g., "runtime_initialized", "tool_executed", "keys_rotated").
|
|
329
|
-
*
|
|
330
|
-
* **For frozen format audit logs** (MCP-I spec compliance), use `AuditLogger.logAuditRecord()`
|
|
331
|
-
* from `@kya-os/mcp-i/runtime` instead. The frozen format is:
|
|
332
|
-
* ```
|
|
333
|
-
* audit.v1 ts=<unix> session=<id> audience=<host> did=<did> kid=<kid> reqHash=<sha256:..> resHash=<sha256:..> verified=yes|no scope=<scopeId|->
|
|
334
|
-
* ```
|
|
335
|
-
*
|
|
336
|
-
* **Format:** JSON object with `event`, `data`, `timestamp`, and `timestampFormatted` fields.
|
|
337
|
-
*
|
|
338
|
-
* **Privacy:** If `includePayloads` is false (default), the `data` field is omitted.
|
|
339
|
-
*
|
|
340
|
-
* **Use Cases:**
|
|
341
|
-
* - Developer debugging and local logging
|
|
342
|
-
* - Runtime initialization events
|
|
343
|
-
* - Tool execution tracking (non-spec-compliant)
|
|
344
|
-
* - Key rotation events
|
|
345
|
-
*
|
|
346
|
-
* **NOT for:**
|
|
347
|
-
* - MCP-I spec-compliant audit logs (use `AuditLogger`)
|
|
348
|
-
* - Production audit trails (use `AuditLogger`)
|
|
349
|
-
* - Compliance requirements (use `AuditLogger`)
|
|
350
|
-
*
|
|
351
|
-
* @param event - Event name (e.g., "runtime_initialized", "tool_executed")
|
|
352
|
-
* @param data - Event data (only included if `includePayloads` is true)
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* ```typescript
|
|
356
|
-
* // Logs: {"event":"runtime_initialized","timestamp":1234567890,"timestampFormatted":"2024-01-01T00:00:00Z"}
|
|
357
|
-
* this.logAudit("runtime_initialized", { did: "did:key:..." });
|
|
358
|
-
* ```
|
|
359
|
-
*
|
|
360
|
-
* @internal This is a private method for internal runtime events.
|
|
361
|
-
* Use AuditLogger for spec-compliant frozen format audit logs.
|
|
362
|
-
*/
|
|
363
|
-
private logAudit;
|
|
364
|
-
private createDIDDocument;
|
|
365
|
-
private extractPublicKey;
|
|
366
|
-
/**
|
|
367
|
-
* Extract public key JWK from DID document
|
|
368
|
-
*/
|
|
369
|
-
private extractPublicKeyJwk;
|
|
370
|
-
private bytesToBase64;
|
|
371
|
-
private base64ToBytes;
|
|
372
|
-
private bytesToHex;
|
|
373
|
-
}
|
|
374
|
-
export {};
|
|
375
|
-
//# sourceMappingURL=base.d.ts.map
|