@kya-os/mcp-i-runtime 1.2.5 → 1.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.
Files changed (116) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/auth/types.d.ts +2 -2
  3. package/dist/auth/types.d.ts.map +1 -1
  4. package/dist/config/remote-config.d.ts +3 -3
  5. package/dist/config/remote-config.js +6 -6
  6. package/dist/config/remote-config.js.map +1 -1
  7. package/dist/identity/user-did-manager.d.ts +4 -4
  8. package/dist/identity/user-did-manager.js +5 -5
  9. package/dist/identity/user-did-manager.js.map +1 -1
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +11 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/runtime/audit.d.ts.map +1 -1
  15. package/dist/runtime/audit.js +22 -0
  16. package/dist/runtime/audit.js.map +1 -1
  17. package/dist/runtime/base.d.ts +14 -11
  18. package/dist/runtime/base.d.ts.map +1 -1
  19. package/dist/runtime/base.js +51 -29
  20. package/dist/runtime/base.js.map +1 -1
  21. package/dist/runtime/delegation-denial.d.ts +43 -0
  22. package/dist/runtime/delegation-denial.d.ts.map +1 -0
  23. package/dist/runtime/delegation-denial.js +83 -0
  24. package/dist/runtime/delegation-denial.js.map +1 -0
  25. package/dist/runtime/verified-delegation.d.ts +30 -0
  26. package/dist/runtime/verified-delegation.d.ts.map +1 -0
  27. package/dist/runtime/verified-delegation.js +62 -0
  28. package/dist/runtime/verified-delegation.js.map +1 -0
  29. package/dist/services/access-control.service.d.ts +4 -4
  30. package/dist/services/access-control.service.d.ts.map +1 -1
  31. package/dist/services/access-control.service.js +34 -34
  32. package/dist/services/access-control.service.js.map +1 -1
  33. package/dist/services/delegation-error-formatter.d.ts +15 -0
  34. package/dist/services/delegation-error-formatter.d.ts.map +1 -1
  35. package/dist/services/delegation-error-formatter.js +27 -1
  36. package/dist/services/delegation-error-formatter.js.map +1 -1
  37. package/dist/services/oauth-config.service.d.ts +4 -4
  38. package/dist/services/oauth-config.service.d.ts.map +1 -1
  39. package/dist/services/oauth-config.service.js +8 -8
  40. package/dist/services/oauth-config.service.js.map +1 -1
  41. package/dist/services/oauth-provider-registry.d.ts +6 -4
  42. package/dist/services/oauth-provider-registry.d.ts.map +1 -1
  43. package/dist/services/oauth-provider-registry.js +9 -5
  44. package/dist/services/oauth-provider-registry.js.map +1 -1
  45. package/dist/services/oauth-service.d.ts +17 -10
  46. package/dist/services/oauth-service.d.ts.map +1 -1
  47. package/dist/services/oauth-service.js +14 -14
  48. package/dist/services/oauth-service.js.map +1 -1
  49. package/dist/services/oauth-token-retrieval.service.d.ts +6 -6
  50. package/dist/services/oauth-token-retrieval.service.d.ts.map +1 -1
  51. package/dist/services/oauth-token-retrieval.service.js +5 -5
  52. package/dist/services/provider-resolver.d.ts +1 -1
  53. package/dist/services/provider-resolver.js +7 -7
  54. package/dist/services/provider-resolver.js.map +1 -1
  55. package/dist/services/session-registration.service.d.ts +5 -5
  56. package/dist/services/session-registration.service.d.ts.map +1 -1
  57. package/dist/services/session-registration.service.js +9 -9
  58. package/dist/services/session-registration.service.js.map +1 -1
  59. package/dist/services/tool-protection.service.d.ts +15 -15
  60. package/dist/services/tool-protection.service.js +18 -18
  61. package/dist/services/tool-protection.service.js.map +1 -1
  62. package/dist/types/tool-protection.d.ts +11 -4
  63. package/dist/types/tool-protection.d.ts.map +1 -1
  64. package/dist/types/tool-protection.js +8 -1
  65. package/dist/types/tool-protection.js.map +1 -1
  66. package/package.json +3 -3
  67. package/src/__tests__/config/provider-runtime-config.test.ts +1 -1
  68. package/src/__tests__/config.test.ts +3 -3
  69. package/src/__tests__/index.test.ts +12 -0
  70. package/src/__tests__/integration/full-flow.test.ts +4 -4
  71. package/src/__tests__/regression/phase2-regression.test.ts +2 -2
  72. package/src/__tests__/runtime/audit-contracts-compat.test.ts +54 -0
  73. package/src/__tests__/runtime/audit.test.ts +172 -0
  74. package/src/__tests__/runtime/delegation-denial.test.ts +115 -0
  75. package/src/__tests__/runtime/process-tool-call-security.test.ts +326 -9
  76. package/src/__tests__/runtime/tool-protection-enforcement.test.ts +25 -10
  77. package/src/__tests__/runtime/verified-delegation.test.ts +129 -0
  78. package/src/__tests__/services/access-control-retry.test.ts +2 -2
  79. package/src/__tests__/services/cache-busting.test.ts +1 -1
  80. package/src/__tests__/services/{agentshield-integration.test.ts → checkpoint-integration.test.ts} +3 -3
  81. package/src/__tests__/services/former-names.test.ts +114 -0
  82. package/src/__tests__/services/oauth-service-errors.test.ts +5 -5
  83. package/src/__tests__/services/oauth-service-pkce.test.ts +2 -2
  84. package/src/__tests__/services/oauth-service-secret-resolution.test.ts +15 -15
  85. package/src/__tests__/services/provider-resolver-edge-cases.test.ts +11 -11
  86. package/src/__tests__/services/tool-protection.service.test.ts +1 -1
  87. package/src/auth/types.ts +2 -2
  88. package/src/config/remote-config.ts +6 -6
  89. package/src/identity/user-did-manager.ts +5 -5
  90. package/src/index.ts +15 -0
  91. package/src/runtime/audit.ts +26 -0
  92. package/src/runtime/base.ts +63 -32
  93. package/src/runtime/delegation-denial.ts +107 -0
  94. package/src/runtime/verified-delegation.ts +66 -0
  95. package/src/services/__tests__/access-control.integration.test.ts +3 -3
  96. package/src/services/__tests__/access-control.proof-response-validation.test.ts +15 -15
  97. package/src/services/__tests__/access-control.service.test.ts +14 -14
  98. package/src/services/__tests__/delegation-error-formatter.test.ts +156 -0
  99. package/src/services/__tests__/oauth-config.service.test.ts +2 -2
  100. package/src/services/__tests__/oauth-provider-registry.test.ts +11 -11
  101. package/src/services/__tests__/provider-resolution.integration.test.ts +6 -6
  102. package/src/services/__tests__/provider-resolver.test.ts +1 -1
  103. package/src/services/__tests__/session-registration.service.test.ts +1 -1
  104. package/src/services/access-control.service.ts +31 -31
  105. package/src/services/delegation-error-formatter.ts +42 -1
  106. package/src/services/oauth-config.service.d.ts +4 -4
  107. package/src/services/oauth-config.service.ts +9 -9
  108. package/src/services/oauth-provider-registry.d.ts +4 -2
  109. package/src/services/oauth-provider-registry.ts +10 -5
  110. package/src/services/oauth-service.ts +30 -19
  111. package/src/services/oauth-token-retrieval.service.ts +8 -8
  112. package/src/services/provider-resolver.ts +7 -7
  113. package/src/services/session-registration.service.ts +10 -10
  114. package/src/services/tool-protection.service.ts +19 -19
  115. package/src/types/tool-protection.ts +13 -4
  116. package/vitest.config.mts +1 -1
@@ -17,6 +17,8 @@ import type {
17
17
  ClientMessagesConfig,
18
18
  } from "@kya-os/contracts/config";
19
19
 
20
+ import type { DelegationDenial } from "../runtime/delegation-denial.js";
21
+
20
22
  // Re-export types for convenience
21
23
  export type { ClientMessageTemplate, ClientMessagesConfig };
22
24
 
@@ -32,6 +34,11 @@ export interface DelegationErrorFormatOptions {
32
34
  scopes?: string[];
33
35
  /** Client ID (e.g., "claude", "chatgpt", "cursor") - used for client-specific messages */
34
36
  clientId?: string;
37
+ /**
38
+ * Why the verifier refused a presented delegation. Changes the message
39
+ * only when a `denialMessages` entry is configured for its code.
40
+ */
41
+ denial?: DelegationDenial;
35
42
  }
36
43
 
37
44
  /**
@@ -132,7 +139,7 @@ export class DelegationErrorFormatter {
132
139
  * @returns Formatted message and potentially modified consent URL
133
140
  */
134
141
  format(options: DelegationErrorFormatOptions): DelegationErrorResult {
135
- const { toolName, consentUrl, scopes, clientId } = options;
142
+ const { toolName, consentUrl, scopes, clientId, denial } = options;
136
143
 
137
144
  // Get the appropriate template for this client
138
145
  const template = this.getTemplate(clientId);
@@ -163,9 +170,43 @@ export class DelegationErrorFormatter {
163
170
  });
164
171
  }
165
172
 
173
+ const denialLine = this.formatDenialLine(denial, clientId, toolName, template);
174
+ if (denialLine !== undefined) {
175
+ message = `${denialLine}\n\n${message}`;
176
+ }
177
+
166
178
  return { message, consentUrl: finalUrl };
167
179
  }
168
180
 
181
+ /**
182
+ * The configured line for a verifier denial, or undefined when none is
183
+ * configured for its code (the message then stays exactly as today).
184
+ *
185
+ * Resolved per code rather than through getTemplate's shallow merge, so a
186
+ * client template that configures other codes does not hide the default
187
+ * template's line for this one.
188
+ */
189
+ private formatDenialLine(
190
+ denial: DelegationDenial | undefined,
191
+ clientId: string | undefined,
192
+ toolName: string,
193
+ template: ClientMessageTemplate
194
+ ): string | undefined {
195
+ if (!denial) return undefined;
196
+
197
+ const clientLine = clientId
198
+ ? this.config?.clients?.[clientId]?.denialMessages?.[denial.code]
199
+ : undefined;
200
+ const configuredLine =
201
+ clientLine ?? this.config?.default?.denialMessages?.[denial.code];
202
+ if (configuredLine === undefined) return undefined;
203
+
204
+ const line = this.interpolate(configuredLine, { toolName });
205
+ return template.supportsMarkdown === false
206
+ ? this.stripMarkdownLinks(line)
207
+ : line;
208
+ }
209
+
169
210
  /**
170
211
  * Format an OAuth error message
171
212
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OAuth Config Service
3
3
  *
4
- * Fetches and caches OAuth provider configurations from AgentShield API.
4
+ * Fetches and caches OAuth provider configurations from Checkpoint API.
5
5
  * Provides caching with TTL to reduce API calls.
6
6
  *
7
7
  * @package @kya-os/mcp-i-core
@@ -10,7 +10,7 @@ import type { FetchProvider } from "../providers/base.js";
10
10
  import type { OAuthConfig } from "@kya-os/contracts/config";
11
11
  import type { OAuthConfigCache } from "../cache/oauth-config-cache.js";
12
12
  export interface OAuthConfigServiceConfig {
13
- /** Base URL for AgentShield API (e.g., "https://kya.vouched.id") */
13
+ /** Base URL for Checkpoint API (e.g., "https://kya.vouched.id") */
14
14
  baseUrl: string;
15
15
  /** API key for authentication */
16
16
  apiKey: string;
@@ -24,7 +24,7 @@ export interface OAuthConfigServiceConfig {
24
24
  logger?: (message: string, data?: unknown) => void;
25
25
  }
26
26
  /**
27
- * Service for fetching OAuth provider configurations from AgentShield API
27
+ * Service for fetching OAuth provider configurations from Checkpoint API
28
28
  */
29
29
  export declare class OAuthConfigService {
30
30
  private config;
@@ -32,7 +32,7 @@ export declare class OAuthConfigService {
32
32
  /**
33
33
  * Get OAuth configuration for a project
34
34
  *
35
- * Fetches from AgentShield API: GET /api/v1/bouncer/projects/{projectId}/providers
35
+ * Fetches from Checkpoint API: GET /api/v1/bouncer/projects/{projectId}/providers
36
36
  * Caches responses with TTL to reduce API calls.
37
37
  *
38
38
  * @param projectId - Project ID to fetch config for
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OAuth Config Service
3
3
  *
4
- * Fetches and caches OAuth provider configurations from AgentShield API.
4
+ * Fetches and caches OAuth provider configurations from Checkpoint API.
5
5
  * Provides caching with TTL to reduce API calls.
6
6
  *
7
7
  * @package @kya-os/mcp-i-core
@@ -17,7 +17,7 @@ import type { OAuthConfigCache } from "../cache/oauth-config-cache.js";
17
17
  import { InMemoryOAuthConfigCache } from "../cache/oauth-config-cache.js";
18
18
 
19
19
  /**
20
- * Normalize a provider's secret-reference metadata from the AgentShield
20
+ * Normalize a provider's secret-reference metadata from the Checkpoint
21
21
  * `/providers` response into the OAuthProvider `metadata` shape.
22
22
  *
23
23
  * The response may use camelCase or snake_case; only the secret-*name*
@@ -47,7 +47,7 @@ function mapProviderSecretMetadata(
47
47
  }
48
48
 
49
49
  export interface OAuthConfigServiceConfig {
50
- /** Base URL for AgentShield API (e.g., "https://kya.vouched.id") */
50
+ /** Base URL for Checkpoint API (e.g., "https://kya.vouched.id") */
51
51
  baseUrl: string;
52
52
 
53
53
  /** API key for authentication */
@@ -67,7 +67,7 @@ export interface OAuthConfigServiceConfig {
67
67
  }
68
68
 
69
69
  /**
70
- * Service for fetching OAuth provider configurations from AgentShield API
70
+ * Service for fetching OAuth provider configurations from Checkpoint API
71
71
  */
72
72
  export class OAuthConfigService {
73
73
  private config: Required<Omit<OAuthConfigServiceConfig, "logger" | "cache">> & {
@@ -89,7 +89,7 @@ export class OAuthConfigService {
89
89
  /**
90
90
  * Get OAuth configuration for a project
91
91
  *
92
- * Fetches from AgentShield API: GET /api/v1/bouncer/projects/{projectId}/providers
92
+ * Fetches from Checkpoint API: GET /api/v1/bouncer/projects/{projectId}/providers
93
93
  * Caches responses with TTL to reduce API calls.
94
94
  *
95
95
  * @param projectId - Project ID to fetch config for
@@ -105,7 +105,7 @@ export class OAuthConfigService {
105
105
  return cached;
106
106
  }
107
107
 
108
- // Fetch from AgentShield API
108
+ // Fetch from Checkpoint API
109
109
  const url = `${this.config.baseUrl}/api/v1/bouncer/projects/${encodeURIComponent(projectId)}/providers`;
110
110
 
111
111
  this.config.logger("[OAuthConfigService] Fetching config from API", {
@@ -143,7 +143,7 @@ export class OAuthConfigService {
143
143
  }
144
144
 
145
145
  // Parse providers object with snake_case → camelCase mapping
146
- // AgentShield API may return snake_case fields, but OAuthProvider interface uses camelCase
146
+ // Checkpoint API may return snake_case fields, but OAuthProvider interface uses camelCase
147
147
  const rawProviders = result.data.providers || {};
148
148
  if (typeof rawProviders !== "object" || Array.isArray(rawProviders)) {
149
149
  throw new Error(
@@ -173,7 +173,7 @@ export class OAuthConfigService {
173
173
  // Provider-registry secret metadata (clientSecretName etc.). REQUIRED:
174
174
  // OAuthService.resolveClientSecret resolves a confidential provider's
175
175
  // client secret from secure storage via `metadata.clientSecretName`
176
- // (the AgentShield /providers response intentionally omits the plaintext
176
+ // (the Checkpoint /providers response intentionally omits the plaintext
177
177
  // `clientSecret`). Without mapping this field here, `metadata` is
178
178
  // undefined, resolveClientSecret falls back to the (absent) inline
179
179
  // clientSecret, and the worker sends an empty secret — token exchange
@@ -184,7 +184,7 @@ export class OAuthConfigService {
184
184
 
185
185
  // Build OAuthConfig object
186
186
  // Extract configuredProvider from API response - this indicates which provider
187
- // the user has actually configured in AgentShield dashboard
187
+ // the user has actually configured in Checkpoint dashboard
188
188
  const configuredProvider = result.data.configuredProvider ?? (result.data as any).configured_provider ?? null;
189
189
  const config: OAuthConfig = {
190
190
  providers,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OAuth Provider Registry
3
3
  *
4
- * Manages OAuth provider configurations loaded from AgentShield API.
4
+ * Manages OAuth provider configurations loaded from Checkpoint API.
5
5
  * Provides efficient lookup and caching of provider configurations.
6
6
  *
7
7
  * @package @kya-os/mcp-i-core
@@ -19,13 +19,15 @@ export declare class OAuthProviderRegistry {
19
19
  private providers;
20
20
  constructor(configService: OAuthConfigService);
21
21
  /**
22
- * Load providers from AgentShield API
22
+ * Load providers from Checkpoint API
23
23
  *
24
24
  * Fetches OAuth configuration and caches providers in memory.
25
25
  * Clears existing providers before loading new ones.
26
26
  *
27
27
  * @param projectId - Project ID to load providers for
28
28
  */
29
+ loadFromCheckpoint(projectId: string): Promise<void>;
30
+ /** @deprecated Use `loadFromCheckpoint`. */
29
31
  loadFromAgentShield(projectId: string): Promise<void>;
30
32
  /**
31
33
  * Get provider by name
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OAuth Provider Registry
3
3
  *
4
- * Manages OAuth provider configurations loaded from AgentShield API.
4
+ * Manages OAuth provider configurations loaded from Checkpoint API.
5
5
  * Provides efficient lookup and caching of provider configurations.
6
6
  *
7
7
  * @package @kya-os/mcp-i-core
@@ -26,8 +26,13 @@ export class OAuthProviderRegistry {
26
26
  private validator?: ProviderValidator
27
27
  ) {}
28
28
 
29
+ /** @deprecated Use `loadFromCheckpoint`. */
30
+ async loadFromAgentShield(projectId: string): Promise<void> {
31
+ return this.loadFromCheckpoint(projectId);
32
+ }
33
+
29
34
  /**
30
- * Load providers from AgentShield API
35
+ * Load providers from Checkpoint API
31
36
  *
32
37
  * Fetches OAuth configuration and caches providers in memory.
33
38
  * Clears existing providers before loading new ones.
@@ -35,14 +40,14 @@ export class OAuthProviderRegistry {
35
40
  *
36
41
  * @param projectId - Project ID to load providers for
37
42
  */
38
- async loadFromAgentShield(projectId: string): Promise<void> {
43
+ async loadFromCheckpoint(projectId: string): Promise<void> {
39
44
  const config = await this.configService.getOAuthConfig(projectId);
40
45
 
41
46
  // Clear existing providers
42
47
  this.providers.clear();
43
48
 
44
49
  // Store the configured provider from API response
45
- // This is the provider the user has explicitly configured in AgentShield dashboard
50
+ // This is the provider the user has explicitly configured in Checkpoint dashboard
46
51
  this._configuredProvider = config.configuredProvider || null;
47
52
 
48
53
  // Register all providers from config
@@ -54,7 +59,7 @@ export class OAuthProviderRegistry {
54
59
  /**
55
60
  * Get the explicitly configured provider for this project
56
61
  *
57
- * Returns the provider that the user has configured in AgentShield dashboard.
62
+ * Returns the provider that the user has configured in Checkpoint dashboard.
58
63
  * Used by ProviderResolver as fallback when tool doesn't specify oauthProvider.
59
64
  *
60
65
  * @returns Configured provider name, or null if no provider is configured
@@ -2,11 +2,11 @@
2
2
  * OAuth Service
3
3
  *
4
4
  * Handles OAuth token exchange and refresh using PKCE (Proof Key for Code Exchange).
5
- * Supports both direct PKCE exchange with OAuth providers and proxy mode via AgentShield.
5
+ * Supports both direct PKCE exchange with OAuth providers and proxy mode via Checkpoint.
6
6
  *
7
7
  * MCP-I Provider Registry Model:
8
8
  * - Client secrets are NOT sent via the API response
9
- * - Agents receive metadata.clientSecretName from AgentShield
9
+ * - Agents receive metadata.clientSecretName from Checkpoint
10
10
  * - Secrets are resolved at runtime from secure storage (Cloudflare Worker env)
11
11
  * - The SecretResolver interface enables platform-specific secret resolution
12
12
  *
@@ -56,11 +56,20 @@ export interface OAuthServiceConfig {
56
56
  /** Fetch provider for making HTTP requests */
57
57
  fetchProvider: FetchProvider;
58
58
 
59
- /** AgentShield API URL (for proxy mode) */
60
- agentShieldApiUrl: string;
59
+ /** Checkpoint API URL (for proxy mode) */
60
+ checkpointApiUrl: string;
61
61
 
62
- /** AgentShield API key (for proxy mode) */
63
- agentShieldApiKey: string;
62
+ /** Checkpoint API key (for proxy mode) */
63
+ checkpointApiKey: string;
64
+
65
+ /**
66
+ * @deprecated Use `checkpointApiUrl`. Read only when `checkpointApiUrl` is
67
+ * absent, so a caller built before the rename keeps its proxy URL.
68
+ */
69
+ agentShieldApiUrl?: string;
70
+
71
+ /** @deprecated Use `checkpointApiKey`; read the same way. */
72
+ agentShieldApiKey?: string;
64
73
 
65
74
  /** Project ID for fetching OAuth config */
66
75
  projectId: string;
@@ -80,7 +89,9 @@ export interface OAuthServiceConfig {
80
89
  * Service for OAuth token exchange and refresh
81
90
  */
82
91
  export class OAuthService {
83
- private config: Required<Omit<OAuthServiceConfig, "logger" | "secretResolver">> & {
92
+ private config: Required<
93
+ Omit<OAuthServiceConfig, "logger" | "secretResolver" | "agentShieldApiUrl" | "agentShieldApiKey">
94
+ > & {
84
95
  logger: (message: string, data?: unknown) => void;
85
96
  secretResolver: SecretResolver;
86
97
  };
@@ -89,8 +100,8 @@ export class OAuthService {
89
100
  this.config = {
90
101
  configService: config.configService,
91
102
  fetchProvider: config.fetchProvider,
92
- agentShieldApiUrl: config.agentShieldApiUrl,
93
- agentShieldApiKey: config.agentShieldApiKey,
103
+ checkpointApiUrl: config.checkpointApiUrl ?? config.agentShieldApiUrl ?? "",
104
+ checkpointApiKey: config.checkpointApiKey ?? config.agentShieldApiKey ?? "",
94
105
  projectId: config.projectId,
95
106
  logger: config.logger || (() => {}),
96
107
  secretResolver: config.secretResolver || defaultSecretResolver,
@@ -158,7 +169,7 @@ export class OAuthService {
158
169
  * Exchange authorization code for IDP tokens using PKCE
159
170
  *
160
171
  * For PKCE providers: Exchanges code directly with OAuth provider (no client secret)
161
- * For proxy mode: Exchanges code via AgentShield API
172
+ * For proxy mode: Exchanges code via Checkpoint API
162
173
  *
163
174
  * @param provider - OAuth provider name (e.g., "github", "google")
164
175
  * @param code - Authorization code from OAuth callback
@@ -338,7 +349,7 @@ export class OAuthService {
338
349
  }
339
350
 
340
351
  /**
341
- * Exchange token via AgentShield proxy (for providers that require proxy mode)
352
+ * Exchange token via Checkpoint proxy (for providers that require proxy mode)
342
353
  *
343
354
  * Note: For Phase 3 two-step flow, OAuth tokens are retrieved separately via
344
355
  * OAuthTokenRetrievalService in the callback handler. This method maintains
@@ -350,8 +361,8 @@ export class OAuthService {
350
361
  codeVerifier?: string,
351
362
  redirectUri?: string
352
363
  ): Promise<IdpTokens> {
353
- // Exchange via AgentShield proxy endpoint
354
- const proxyUrl = `${this.config.agentShieldApiUrl}/api/v1/oauth/token`;
364
+ // Exchange via Checkpoint proxy endpoint
365
+ const proxyUrl = `${this.config.checkpointApiUrl}/api/v1/oauth/token`;
355
366
 
356
367
  this.config.logger("[OAuthService] Exchanging token via proxy", {
357
368
  proxyUrl,
@@ -378,7 +389,7 @@ export class OAuthService {
378
389
  method: "POST",
379
390
  headers: {
380
391
  "Content-Type": "application/json",
381
- Authorization: `Bearer ${this.config.agentShieldApiKey}`,
392
+ Authorization: `Bearer ${this.config.checkpointApiKey}`,
382
393
  },
383
394
  body: JSON.stringify(requestBody),
384
395
  });
@@ -453,7 +464,7 @@ export class OAuthService {
453
464
  * Refresh IDP access token using refresh token
454
465
  *
455
466
  * For PKCE providers: Refreshes directly with OAuth provider
456
- * For proxy mode: Refreshes via AgentShield API
467
+ * For proxy mode: Refreshes via Checkpoint API
457
468
  *
458
469
  * @param provider - OAuth provider name
459
470
  * @param refreshToken - Refresh token from previous token exchange
@@ -481,7 +492,7 @@ export class OAuthService {
481
492
  return this.refreshTokenPKCE(providerConfig, refreshToken);
482
493
  }
483
494
 
484
- // For proxy mode, refresh via AgentShield
495
+ // For proxy mode, refresh via Checkpoint
485
496
  if (providerConfig.proxyMode) {
486
497
  return this.refreshTokenProxy(providerConfig, refreshToken);
487
498
  }
@@ -564,13 +575,13 @@ export class OAuthService {
564
575
  }
565
576
 
566
577
  /**
567
- * Refresh token via AgentShield proxy
578
+ * Refresh token via Checkpoint proxy
568
579
  */
569
580
  private async refreshTokenProxy(
570
581
  providerConfig: OAuthProvider,
571
582
  refreshToken: string
572
583
  ): Promise<IdpTokens | null> {
573
- const proxyUrl = `${this.config.agentShieldApiUrl}/api/v1/oauth/token`;
584
+ const proxyUrl = `${this.config.checkpointApiUrl}/api/v1/oauth/token`;
574
585
 
575
586
  this.config.logger("[OAuthService] Refreshing token via proxy", {
576
587
  proxyUrl,
@@ -582,7 +593,7 @@ export class OAuthService {
582
593
  method: "POST",
583
594
  headers: {
584
595
  "Content-Type": "application/json",
585
- Authorization: `Bearer ${this.config.agentShieldApiKey}`,
596
+ Authorization: `Bearer ${this.config.checkpointApiKey}`,
586
597
  },
587
598
  body: JSON.stringify({
588
599
  grant_type: "refresh_token",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OAuth Token Retrieval Service
3
3
  *
4
- * Retrieves OAuth tokens from AgentShield after receiving delegation token.
4
+ * Retrieves OAuth tokens from Checkpoint after receiving delegation token.
5
5
  * Implements the two-step token flow for Phase 3 custom IDP support.
6
6
  *
7
7
  * @package @kya-os/mcp-i-core
@@ -13,7 +13,7 @@ import type { IdpTokens } from "@kya-os/contracts/config";
13
13
  * Configuration for OAuthTokenRetrievalService
14
14
  */
15
15
  export interface OAuthTokenRetrievalServiceConfig {
16
- /** AgentShield API base URL */
16
+ /** Checkpoint API base URL */
17
17
  baseUrl: string;
18
18
  /** Fetch implementation */
19
19
  fetchProvider: typeof fetch;
@@ -28,7 +28,7 @@ export interface OAuthTokenRetrievalServiceConfig {
28
28
  }
29
29
 
30
30
  /**
31
- * Response from AgentShield token retrieval endpoint
31
+ * Response from Checkpoint token retrieval endpoint
32
32
  */
33
33
  interface OAuthTokenRetrievalResponse {
34
34
  success: true;
@@ -47,7 +47,7 @@ interface OAuthTokenRetrievalResponse {
47
47
  }
48
48
 
49
49
  /**
50
- * Error response from AgentShield
50
+ * Error response from Checkpoint
51
51
  */
52
52
  interface OAuthTokenRetrievalErrorResponse {
53
53
  success: false;
@@ -59,7 +59,7 @@ interface OAuthTokenRetrievalErrorResponse {
59
59
  }
60
60
 
61
61
  /**
62
- * Service for retrieving OAuth tokens from AgentShield
62
+ * Service for retrieving OAuth tokens from Checkpoint
63
63
  */
64
64
  export class OAuthTokenRetrievalService {
65
65
  private config: Required<OAuthTokenRetrievalServiceConfig> & {
@@ -86,7 +86,7 @@ export class OAuthTokenRetrievalService {
86
86
  }
87
87
 
88
88
  /**
89
- * Retrieve OAuth tokens from AgentShield
89
+ * Retrieve OAuth tokens from Checkpoint
90
90
  *
91
91
  * @param delegationId - Delegation ID from token exchange response
92
92
  * @param delegationToken - Delegation token (JWT) for authorization
@@ -213,9 +213,9 @@ export class OAuthTokenRetrievalService {
213
213
  }
214
214
 
215
215
  /**
216
- * Map AgentShield response to IdpTokens format
216
+ * Map Checkpoint response to IdpTokens format
217
217
  *
218
- * @param data - Response data from AgentShield
218
+ * @param data - Response data from Checkpoint
219
219
  * @returns IdpTokens object
220
220
  */
221
221
  private mapToIdpTokens(
@@ -52,7 +52,7 @@ export class CredentialAuthModeError extends Error {
52
52
  * 0. Check for consent-only mode (authorization.type === 'none') - skip OAuth
53
53
  * 1. Tool-specific oauthProvider field (Phase 2+ preferred)
54
54
  * 2. Scope prefix inference (fallback)
55
- * 3. Project-configured provider from AgentShield dashboard
55
+ * 3. Project-configured provider from Checkpoint dashboard
56
56
  * 4. Error if no provider can be resolved
57
57
  */
58
58
  export class ProviderResolver {
@@ -133,7 +133,7 @@ export class ProviderResolver {
133
133
  if (toolProtection.oauthProvider) {
134
134
  // Ensure registry is loaded before checking
135
135
  if (this.registry.getProviderNames().length === 0) {
136
- await this.registry.loadFromAgentShield(projectId);
136
+ await this.registry.loadFromCheckpoint(projectId);
137
137
  }
138
138
  if (!this.registry.hasProvider(toolProtection.oauthProvider)) {
139
139
  throw new Error(
@@ -151,7 +151,7 @@ export class ProviderResolver {
151
151
  if (inferredProvider) {
152
152
  // Ensure registry is loaded before checking
153
153
  if (this.registry.getProviderNames().length === 0) {
154
- await this.registry.loadFromAgentShield(projectId);
154
+ await this.registry.loadFromCheckpoint(projectId);
155
155
  }
156
156
  if (this.registry.hasProvider(inferredProvider)) {
157
157
  console.error(
@@ -161,9 +161,9 @@ export class ProviderResolver {
161
161
  }
162
162
  }
163
163
 
164
- // Priority 3: Use explicitly configured provider from AgentShield dashboard
164
+ // Priority 3: Use explicitly configured provider from Checkpoint dashboard
165
165
  // This is the provider the user has actually configured, not just any available provider
166
- await this.registry.loadFromAgentShield(projectId);
166
+ await this.registry.loadFromCheckpoint(projectId);
167
167
  const configuredProvider = this.registry.getConfiguredProvider();
168
168
 
169
169
  if (configuredProvider && this.registry.hasProvider(configuredProvider)) {
@@ -177,11 +177,11 @@ export class ProviderResolver {
177
177
 
178
178
  // Priority 4: Error if no provider is configured
179
179
  // NOTE: We intentionally do NOT fall back to "first available provider" anymore
180
- // because AgentShield returns ALL providers (even unconfigured ones).
180
+ // because Checkpoint returns ALL providers (even unconfigured ones).
181
181
  // Only use providers explicitly configured by the user.
182
182
  throw new Error(
183
183
  `Tool requires OAuth but no provider is configured for project "${projectId}". ` +
184
- `Configure an OAuth provider in AgentShield dashboard.`
184
+ `Configure an OAuth provider in Checkpoint dashboard.`
185
185
  );
186
186
  }
187
187
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Session Registration Service
3
3
  *
4
- * Registers MCP sessions with the AgentShield dashboard, enabling
4
+ * Registers MCP sessions with the Checkpoint dashboard, enabling
5
5
  * visibility into which MCP clients are connecting to agents.
6
6
  *
7
7
  * This is a fire-and-forget service - session registration should not
@@ -13,19 +13,19 @@
13
13
  import type {
14
14
  RegisterSessionRequest,
15
15
  RegisterSessionResponse,
16
- } from "@kya-os/contracts/agentshield-api";
16
+ } from "@kya-os/contracts/checkpoint-api";
17
17
  import {
18
18
  registerSessionRequestSchema,
19
19
  registerSessionResponseSchema,
20
- AGENTSHIELD_ENDPOINTS,
21
- } from "@kya-os/contracts/agentshield-api";
20
+ CHECKPOINT_ENDPOINTS,
21
+ } from "@kya-os/contracts/checkpoint-api";
22
22
  import type { FetchProvider } from "../providers/base.js";
23
23
 
24
24
  /**
25
25
  * Configuration for the session registration service
26
26
  */
27
27
  export interface SessionRegistrationServiceConfig {
28
- /** Base URL for the AgentShield API (e.g., "https://kya.vouched.id") */
28
+ /** Base URL for the Checkpoint API (e.g., "https://kya.vouched.id") */
29
29
  baseUrl: string;
30
30
 
31
31
  /** API key for authentication */
@@ -56,7 +56,7 @@ export interface SessionRegistrationResult {
56
56
  /**
57
57
  * Session Registration Service
58
58
  *
59
- * Registers MCP sessions with AgentShield for dashboard visibility.
59
+ * Registers MCP sessions with Checkpoint for dashboard visibility.
60
60
  * Designed to be non-blocking - failures are logged but don't throw.
61
61
  */
62
62
  export class SessionRegistrationService {
@@ -78,7 +78,7 @@ export class SessionRegistrationService {
78
78
  }
79
79
 
80
80
  /**
81
- * Register a session with AgentShield
81
+ * Register a session with Checkpoint
82
82
  *
83
83
  * This is a fire-and-forget operation. Failures are logged but don't throw.
84
84
  * The method returns quickly and doesn't block the caller.
@@ -103,9 +103,9 @@ export class SessionRegistrationService {
103
103
  return { success: false, sessionId, error: errorMsg };
104
104
  }
105
105
 
106
- const url = `${this.config.baseUrl}${AGENTSHIELD_ENDPOINTS.SESSIONS}`;
106
+ const url = `${this.config.baseUrl}${CHECKPOINT_ENDPOINTS.SESSIONS}`;
107
107
 
108
- // NOTE: This registers the SESSION with AgentShield for dashboard visibility
108
+ // NOTE: This registers the SESSION with Checkpoint for dashboard visibility
109
109
  // This is NOT the same as agent registration with Know That AI (which happens during deploy)
110
110
  this.config.logger(
111
111
  "[SessionRegistration] Registering session for dashboard visibility",
@@ -173,7 +173,7 @@ export class SessionRegistrationService {
173
173
  }
174
174
 
175
175
  this.config.logger(
176
- "[SessionRegistration] Session now visible in AgentShield dashboard",
176
+ "[SessionRegistration] Session now visible in Checkpoint dashboard",
177
177
  {
178
178
  sessionId,
179
179
  registered: parseResult.data.registered,