@kya-os/mcp-i-runtime 1.2.6 → 1.3.1
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/.turbo/turbo-build.log +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/config/remote-config.js +2 -2
- package/dist/config/remote-config.js.map +1 -1
- package/dist/runtime/base.js +4 -4
- package/dist/runtime/base.js.map +1 -1
- package/dist/runtime/verified-delegation.d.ts +1 -1
- package/dist/runtime/verified-delegation.d.ts.map +1 -1
- package/dist/services/access-control.service.d.ts +2 -2
- package/dist/services/access-control.service.d.ts.map +1 -1
- package/dist/services/access-control.service.js +30 -30
- package/dist/services/access-control.service.js.map +1 -1
- package/dist/services/oauth-provider-registry.d.ts +3 -1
- package/dist/services/oauth-provider-registry.d.ts.map +1 -1
- package/dist/services/oauth-provider-registry.js +5 -1
- package/dist/services/oauth-provider-registry.js.map +1 -1
- package/dist/services/oauth-service.d.ts +9 -2
- package/dist/services/oauth-service.d.ts.map +1 -1
- package/dist/services/oauth-service.js +6 -6
- package/dist/services/oauth-service.js.map +1 -1
- package/dist/services/provider-resolver.js +3 -3
- package/dist/services/provider-resolver.js.map +1 -1
- package/dist/services/session-registration.service.d.ts +1 -1
- package/dist/services/session-registration.service.d.ts.map +1 -1
- package/dist/services/session-registration.service.js +4 -4
- package/dist/services/session-registration.service.js.map +1 -1
- package/dist/services/tool-protection.service.d.ts +2 -2
- package/dist/services/tool-protection.service.js +2 -2
- package/package.json +3 -2
- package/src/__tests__/config/provider-runtime-config.test.ts +1 -1
- package/src/__tests__/config.test.ts +3 -3
- package/src/__tests__/integration/full-flow.test.ts +1 -1
- package/src/__tests__/regression/phase2-regression.test.ts +2 -2
- package/src/__tests__/runtime/process-tool-call-security.test.ts +3 -3
- package/src/__tests__/runtime/tool-protection-enforcement.test.ts +4 -4
- package/src/__tests__/runtime/verified-delegation.test.ts +1 -1
- package/src/__tests__/services/access-control-retry.test.ts +2 -2
- package/src/__tests__/services/cache-busting.test.ts +1 -1
- package/src/__tests__/services/former-names.test.ts +114 -0
- package/src/__tests__/services/oauth-service-errors.test.ts +5 -5
- package/src/__tests__/services/oauth-service-pkce.test.ts +2 -2
- package/src/__tests__/services/oauth-service-secret-resolution.test.ts +14 -14
- package/src/__tests__/services/provider-resolver-edge-cases.test.ts +9 -9
- package/src/auth/types.ts +1 -1
- package/src/config/remote-config.ts +2 -2
- package/src/runtime/base.ts +5 -5
- package/src/runtime/verified-delegation.ts +1 -1
- package/src/services/__tests__/access-control.integration.test.ts +3 -3
- package/src/services/__tests__/access-control.proof-response-validation.test.ts +7 -7
- package/src/services/__tests__/access-control.service.test.ts +14 -14
- package/src/services/__tests__/oauth-provider-registry.test.ts +10 -10
- package/src/services/__tests__/provider-resolution.integration.test.ts +6 -6
- package/src/services/__tests__/provider-resolver.test.ts +1 -1
- package/src/services/__tests__/session-registration.service.test.ts +1 -1
- package/src/services/access-control.service.ts +27 -27
- package/src/services/oauth-provider-registry.d.ts +2 -0
- package/src/services/oauth-provider-registry.ts +6 -1
- package/src/services/oauth-service.ts +20 -9
- package/src/services/provider-resolver.ts +3 -3
- package/src/services/session-registration.service.ts +4 -4
- package/src/services/tool-protection.service.ts +2 -2
- package/vitest.config.mts +1 -1
- /package/src/__tests__/services/{agentshield-integration.test.ts → checkpoint-integration.test.ts} +0 -0
|
@@ -57,7 +57,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
57
57
|
|
|
58
58
|
describe("End-to-end provider resolution", () => {
|
|
59
59
|
it("should resolve provider for tool with oauthProvider field", async () => {
|
|
60
|
-
await providerRegistry.
|
|
60
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
61
61
|
|
|
62
62
|
const toolProtection: ToolProtection = {
|
|
63
63
|
requiresDelegation: true,
|
|
@@ -74,7 +74,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
it("should resolve provider via scope inference when oauthProvider not specified", async () => {
|
|
77
|
-
await providerRegistry.
|
|
77
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
78
78
|
|
|
79
79
|
const toolProtection: ToolProtection = {
|
|
80
80
|
requiresDelegation: true,
|
|
@@ -98,7 +98,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
it("should fall back to configuredProvider for Phase 1 compatibility", async () => {
|
|
101
|
-
await providerRegistry.
|
|
101
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
102
102
|
|
|
103
103
|
const toolProtection: ToolProtection = {
|
|
104
104
|
requiresDelegation: true,
|
|
@@ -125,7 +125,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
125
125
|
|
|
126
126
|
describe("Backward compatibility", () => {
|
|
127
127
|
it("should work with Phase 1 tools (no oauthProvider field)", async () => {
|
|
128
|
-
await providerRegistry.
|
|
128
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
129
129
|
|
|
130
130
|
const toolProtection: ToolProtection = {
|
|
131
131
|
requiresDelegation: true,
|
|
@@ -144,7 +144,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
it("should handle tools with empty requiredScopes", async () => {
|
|
147
|
-
await providerRegistry.
|
|
147
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
148
148
|
|
|
149
149
|
const toolProtection: ToolProtection = {
|
|
150
150
|
requiresDelegation: true,
|
|
@@ -171,7 +171,7 @@ describe("Provider Resolution Integration", () => {
|
|
|
171
171
|
|
|
172
172
|
describe("Multi-provider scenarios", () => {
|
|
173
173
|
it("should resolve different providers for different tools", async () => {
|
|
174
|
-
await providerRegistry.
|
|
174
|
+
await providerRegistry.loadFromCheckpoint("test-project");
|
|
175
175
|
|
|
176
176
|
const githubTool: ToolProtection = {
|
|
177
177
|
requiresDelegation: true,
|
|
@@ -44,7 +44,7 @@ describe("ProviderResolver", () => {
|
|
|
44
44
|
hasProvider: vi.fn(),
|
|
45
45
|
getAllProviders: vi.fn().mockReturnValue([]),
|
|
46
46
|
getProviderNames: vi.fn().mockReturnValue([]),
|
|
47
|
-
|
|
47
|
+
loadFromCheckpoint: vi.fn().mockResolvedValue(undefined),
|
|
48
48
|
getConfiguredProvider: vi.fn().mockReturnValue(null), // New method for configuredProvider
|
|
49
49
|
} as any;
|
|
50
50
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
createSessionRegistrationService,
|
|
15
15
|
} from "../session-registration.service";
|
|
16
16
|
import type { FetchProvider } from "../../providers/base";
|
|
17
|
-
import type { RegisterSessionRequest } from "@kya-os/contracts/
|
|
17
|
+
import type { RegisterSessionRequest } from "@kya-os/contracts/checkpoint-api";
|
|
18
18
|
|
|
19
19
|
describe("SessionRegistrationService", () => {
|
|
20
20
|
let mockFetchProvider: FetchProvider;
|
|
@@ -18,19 +18,19 @@ import type {
|
|
|
18
18
|
ToolProtectionConfigAPIResponse,
|
|
19
19
|
ProofSubmissionRequest,
|
|
20
20
|
ProofSubmissionResponse,
|
|
21
|
-
} from "@kya-os/contracts/
|
|
21
|
+
} from "@kya-os/contracts/checkpoint-api";
|
|
22
22
|
import {
|
|
23
23
|
verifyDelegationRequestSchema,
|
|
24
24
|
verifyDelegationAPIResponseSchema,
|
|
25
25
|
toolProtectionConfigAPIResponseSchema,
|
|
26
26
|
proofSubmissionRequestSchema,
|
|
27
27
|
proofSubmissionResponseSchema,
|
|
28
|
-
} from "@kya-os/contracts/
|
|
29
|
-
import {
|
|
28
|
+
} from "@kya-os/contracts/checkpoint-api";
|
|
29
|
+
import { CheckpointAPIError } from "@kya-os/contracts/checkpoint-api";
|
|
30
30
|
import type { FetchProvider } from "../providers/base";
|
|
31
31
|
|
|
32
32
|
// Type for error response
|
|
33
|
-
type
|
|
33
|
+
type CheckpointAPIErrorResponse = {
|
|
34
34
|
code: string;
|
|
35
35
|
message: string;
|
|
36
36
|
details?: Record<string, unknown>;
|
|
@@ -170,7 +170,7 @@ export class AccessControlApiService {
|
|
|
170
170
|
const parsed =
|
|
171
171
|
toolProtectionConfigAPIResponseSchema.safeParse(responseData);
|
|
172
172
|
if (!parsed.success) {
|
|
173
|
-
throw new
|
|
173
|
+
throw new CheckpointAPIError(
|
|
174
174
|
"invalid_response",
|
|
175
175
|
"Response validation failed",
|
|
176
176
|
{ zodErrors: parsed.error.errors }
|
|
@@ -249,7 +249,7 @@ export class AccessControlApiService {
|
|
|
249
249
|
|
|
250
250
|
// Validate the cleaned request body
|
|
251
251
|
// Note: Workaround for Zod schema issue where .optional() doesn't properly handle omitted fields
|
|
252
|
-
// See
|
|
252
|
+
// See CHECKPOINT_MCPI_COMPLIANCE_REVIEW.md for details
|
|
253
253
|
const validationResult =
|
|
254
254
|
verifyDelegationRequestSchema.safeParse(cleanedRequestBody);
|
|
255
255
|
if (!validationResult.success) {
|
|
@@ -266,7 +266,7 @@ export class AccessControlApiService {
|
|
|
266
266
|
errors: validationResult.error.errors,
|
|
267
267
|
requestBody: requestBody,
|
|
268
268
|
});
|
|
269
|
-
throw new
|
|
269
|
+
throw new CheckpointAPIError(
|
|
270
270
|
"validation_error",
|
|
271
271
|
"Request validation failed",
|
|
272
272
|
{ zodErrors: validationResult.error.errors }
|
|
@@ -306,7 +306,7 @@ export class AccessControlApiService {
|
|
|
306
306
|
// Validate and parse success response
|
|
307
307
|
const parsed = verifyDelegationAPIResponseSchema.safeParse(responseData);
|
|
308
308
|
if (!parsed.success) {
|
|
309
|
-
throw new
|
|
309
|
+
throw new CheckpointAPIError(
|
|
310
310
|
"invalid_response",
|
|
311
311
|
"Response validation failed",
|
|
312
312
|
{ zodErrors: parsed.error.errors }
|
|
@@ -348,7 +348,7 @@ export class AccessControlApiService {
|
|
|
348
348
|
request: JSON.stringify(request, null, 2),
|
|
349
349
|
}
|
|
350
350
|
);
|
|
351
|
-
throw new
|
|
351
|
+
throw new CheckpointAPIError(
|
|
352
352
|
"validation_error",
|
|
353
353
|
`Request validation failed: ${errorDetails}`,
|
|
354
354
|
{ zodErrors: validationResult.error.errors }
|
|
@@ -412,7 +412,7 @@ export class AccessControlApiService {
|
|
|
412
412
|
if (!httpResponse.ok) {
|
|
413
413
|
const errorData = responseData as {
|
|
414
414
|
success?: boolean;
|
|
415
|
-
error?:
|
|
415
|
+
error?: CheckpointAPIErrorResponse;
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
if (errorData.error) {
|
|
@@ -450,7 +450,7 @@ export class AccessControlApiService {
|
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
// If validation fails, log and throw error
|
|
453
|
-
throw new
|
|
453
|
+
throw new CheckpointAPIError(
|
|
454
454
|
"invalid_response",
|
|
455
455
|
"Error response validation failed",
|
|
456
456
|
{ zodErrors: validated.error.errors }
|
|
@@ -462,7 +462,7 @@ export class AccessControlApiService {
|
|
|
462
462
|
...(errorData.error.details || {}),
|
|
463
463
|
status: httpResponse.status,
|
|
464
464
|
};
|
|
465
|
-
throw new
|
|
465
|
+
throw new CheckpointAPIError(
|
|
466
466
|
errorCode,
|
|
467
467
|
errorData.error.message || `API error: ${httpResponse.status}`,
|
|
468
468
|
errorDetails
|
|
@@ -479,7 +479,7 @@ export class AccessControlApiService {
|
|
|
479
479
|
: "session_not_found";
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
throw new
|
|
482
|
+
throw new CheckpointAPIError(
|
|
483
483
|
errorCode,
|
|
484
484
|
`API request failed: ${httpResponse.status} ${httpResponse.statusText}`,
|
|
485
485
|
{ status: httpResponse.status, responseData }
|
|
@@ -529,7 +529,7 @@ export class AccessControlApiService {
|
|
|
529
529
|
const clonedData = JSON.parse(JSON.stringify(rawData));
|
|
530
530
|
|
|
531
531
|
if (typeof clonedData !== "object" || clonedData === null) {
|
|
532
|
-
throw new
|
|
532
|
+
throw new CheckpointAPIError(
|
|
533
533
|
"invalid_response",
|
|
534
534
|
"Response data is not an object after cloning",
|
|
535
535
|
{
|
|
@@ -542,10 +542,10 @@ export class AccessControlApiService {
|
|
|
542
542
|
|
|
543
543
|
dataToValidate = clonedData as Record<string, unknown>;
|
|
544
544
|
} catch (cloneError) {
|
|
545
|
-
if (cloneError instanceof
|
|
545
|
+
if (cloneError instanceof CheckpointAPIError) {
|
|
546
546
|
throw cloneError;
|
|
547
547
|
}
|
|
548
|
-
throw new
|
|
548
|
+
throw new CheckpointAPIError(
|
|
549
549
|
"invalid_response",
|
|
550
550
|
"Failed to clone response data",
|
|
551
551
|
{
|
|
@@ -634,7 +634,7 @@ export class AccessControlApiService {
|
|
|
634
634
|
originalResponseData: JSON.stringify(responseData, null, 2),
|
|
635
635
|
}
|
|
636
636
|
);
|
|
637
|
-
throw new
|
|
637
|
+
throw new CheckpointAPIError(
|
|
638
638
|
"invalid_response",
|
|
639
639
|
"Response data missing required fields (accepted/rejected)",
|
|
640
640
|
{
|
|
@@ -717,7 +717,7 @@ export class AccessControlApiService {
|
|
|
717
717
|
);
|
|
718
718
|
// CRITICAL: Throw error instead of falling through to direct parsing
|
|
719
719
|
// The response is wrapped, so direct parsing will also fail
|
|
720
|
-
throw new
|
|
720
|
+
throw new CheckpointAPIError(
|
|
721
721
|
"invalid_response",
|
|
722
722
|
"Response validation failed",
|
|
723
723
|
{ zodErrors: dataParsed.error.errors, responseData }
|
|
@@ -782,7 +782,7 @@ export class AccessControlApiService {
|
|
|
782
782
|
`[AccessControl] ❌ ACTUAL RESPONSE DATA:`,
|
|
783
783
|
JSON.stringify(responseData, null, 2)
|
|
784
784
|
);
|
|
785
|
-
throw new
|
|
785
|
+
throw new CheckpointAPIError(
|
|
786
786
|
"invalid_response",
|
|
787
787
|
"Response validation failed",
|
|
788
788
|
{ zodErrors: parsed.error.errors, responseData }
|
|
@@ -867,8 +867,8 @@ export class AccessControlApiService {
|
|
|
867
867
|
return true;
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
-
//
|
|
871
|
-
if (error instanceof
|
|
870
|
+
// CheckpointAPIError with 5xx status codes are retryable
|
|
871
|
+
if (error instanceof CheckpointAPIError) {
|
|
872
872
|
// Check error code for server errors
|
|
873
873
|
if (error.code === "server_error") {
|
|
874
874
|
return true;
|
|
@@ -918,7 +918,7 @@ export class AccessControlApiService {
|
|
|
918
918
|
// Handle non-JSON error responses (e.g., plain text "Internal Server Error")
|
|
919
919
|
if (!response.ok) {
|
|
920
920
|
const errorCode = this.mapStatusToErrorCode(response.status);
|
|
921
|
-
throw new
|
|
921
|
+
throw new CheckpointAPIError(
|
|
922
922
|
errorCode,
|
|
923
923
|
`API request failed: ${response.status} ${response.statusText}`,
|
|
924
924
|
{
|
|
@@ -928,7 +928,7 @@ export class AccessControlApiService {
|
|
|
928
928
|
);
|
|
929
929
|
}
|
|
930
930
|
// For success responses that aren't JSON, throw invalid_response error
|
|
931
|
-
throw new
|
|
931
|
+
throw new CheckpointAPIError(
|
|
932
932
|
"invalid_response",
|
|
933
933
|
`Failed to parse response: ${error instanceof Error ? error.message : String(error)}`,
|
|
934
934
|
{ responseText: responseText.substring(0, 500) }
|
|
@@ -955,7 +955,7 @@ export class AccessControlApiService {
|
|
|
955
955
|
}
|
|
956
956
|
|
|
957
957
|
/**
|
|
958
|
-
* Handle error responses and throw appropriate
|
|
958
|
+
* Handle error responses and throw appropriate CheckpointAPIError
|
|
959
959
|
*
|
|
960
960
|
* @internal
|
|
961
961
|
*/
|
|
@@ -965,7 +965,7 @@ export class AccessControlApiService {
|
|
|
965
965
|
): never {
|
|
966
966
|
const errorData = responseData as {
|
|
967
967
|
success?: boolean;
|
|
968
|
-
error?:
|
|
968
|
+
error?: CheckpointAPIErrorResponse;
|
|
969
969
|
};
|
|
970
970
|
|
|
971
971
|
if (errorData.error) {
|
|
@@ -975,7 +975,7 @@ export class AccessControlApiService {
|
|
|
975
975
|
...(errorData.error.details || {}),
|
|
976
976
|
status: response.status,
|
|
977
977
|
};
|
|
978
|
-
throw new
|
|
978
|
+
throw new CheckpointAPIError(
|
|
979
979
|
errorCode,
|
|
980
980
|
errorData.error.message || `API error: ${response.status}`,
|
|
981
981
|
errorDetails
|
|
@@ -987,7 +987,7 @@ export class AccessControlApiService {
|
|
|
987
987
|
response.status,
|
|
988
988
|
response.statusText
|
|
989
989
|
);
|
|
990
|
-
throw new
|
|
990
|
+
throw new CheckpointAPIError(
|
|
991
991
|
errorCode,
|
|
992
992
|
`API request failed: ${response.status} ${response.statusText}`,
|
|
993
993
|
{ status: response.status, responseData }
|
|
@@ -26,6 +26,8 @@ export declare class OAuthProviderRegistry {
|
|
|
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
|
|
@@ -26,6 +26,11 @@ 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
35
|
* Load providers from Checkpoint API
|
|
31
36
|
*
|
|
@@ -35,7 +40,7 @@ export class OAuthProviderRegistry {
|
|
|
35
40
|
*
|
|
36
41
|
* @param projectId - Project ID to load providers for
|
|
37
42
|
*/
|
|
38
|
-
async
|
|
43
|
+
async loadFromCheckpoint(projectId: string): Promise<void> {
|
|
39
44
|
const config = await this.configService.getOAuthConfig(projectId);
|
|
40
45
|
|
|
41
46
|
// Clear existing providers
|
|
@@ -57,10 +57,19 @@ export interface OAuthServiceConfig {
|
|
|
57
57
|
fetchProvider: FetchProvider;
|
|
58
58
|
|
|
59
59
|
/** Checkpoint API URL (for proxy mode) */
|
|
60
|
-
|
|
60
|
+
checkpointApiUrl: string;
|
|
61
61
|
|
|
62
62
|
/** Checkpoint API key (for proxy mode) */
|
|
63
|
-
|
|
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<
|
|
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
|
-
|
|
93
|
-
|
|
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,
|
|
@@ -351,7 +362,7 @@ export class OAuthService {
|
|
|
351
362
|
redirectUri?: string
|
|
352
363
|
): Promise<IdpTokens> {
|
|
353
364
|
// Exchange via Checkpoint proxy endpoint
|
|
354
|
-
const proxyUrl = `${this.config.
|
|
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.
|
|
392
|
+
Authorization: `Bearer ${this.config.checkpointApiKey}`,
|
|
382
393
|
},
|
|
383
394
|
body: JSON.stringify(requestBody),
|
|
384
395
|
});
|
|
@@ -570,7 +581,7 @@ export class OAuthService {
|
|
|
570
581
|
providerConfig: OAuthProvider,
|
|
571
582
|
refreshToken: string
|
|
572
583
|
): Promise<IdpTokens | null> {
|
|
573
|
-
const proxyUrl = `${this.config.
|
|
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.
|
|
596
|
+
Authorization: `Bearer ${this.config.checkpointApiKey}`,
|
|
586
597
|
},
|
|
587
598
|
body: JSON.stringify({
|
|
588
599
|
grant_type: "refresh_token",
|
|
@@ -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.
|
|
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.
|
|
154
|
+
await this.registry.loadFromCheckpoint(projectId);
|
|
155
155
|
}
|
|
156
156
|
if (this.registry.hasProvider(inferredProvider)) {
|
|
157
157
|
console.error(
|
|
@@ -163,7 +163,7 @@ export class ProviderResolver {
|
|
|
163
163
|
|
|
164
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.
|
|
166
|
+
await this.registry.loadFromCheckpoint(projectId);
|
|
167
167
|
const configuredProvider = this.registry.getConfiguredProvider();
|
|
168
168
|
|
|
169
169
|
if (configuredProvider && this.registry.hasProvider(configuredProvider)) {
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
import type {
|
|
14
14
|
RegisterSessionRequest,
|
|
15
15
|
RegisterSessionResponse,
|
|
16
|
-
} from "@kya-os/contracts/
|
|
16
|
+
} from "@kya-os/contracts/checkpoint-api";
|
|
17
17
|
import {
|
|
18
18
|
registerSessionRequestSchema,
|
|
19
19
|
registerSessionResponseSchema,
|
|
20
|
-
|
|
21
|
-
} from "@kya-os/contracts/
|
|
20
|
+
CHECKPOINT_ENDPOINTS,
|
|
21
|
+
} from "@kya-os/contracts/checkpoint-api";
|
|
22
22
|
import type { FetchProvider } from "../providers/base.js";
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -103,7 +103,7 @@ export class SessionRegistrationService {
|
|
|
103
103
|
return { success: false, sessionId, error: errorMsg };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const url = `${this.config.baseUrl}${
|
|
106
|
+
const url = `${this.config.baseUrl}${CHECKPOINT_ENDPOINTS.SESSIONS}`;
|
|
107
107
|
|
|
108
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)
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* 3. Caches responses with configurable TTL (default 5 minutes)
|
|
40
40
|
* 4. Provides delegation requirement checking before tool execution
|
|
41
41
|
*
|
|
42
|
-
* SYNCHRONIZATION WITH
|
|
42
|
+
* SYNCHRONIZATION WITH CHECKPOINT:
|
|
43
43
|
* ----------------------------------
|
|
44
44
|
* When you update tool protection settings in the Checkpoint dashboard:
|
|
45
45
|
*
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
* Cause: Long cache TTL and cache clear failed
|
|
103
103
|
* Solution: Configure MCP server URL in Checkpoint for auto cache clear
|
|
104
104
|
*
|
|
105
|
-
* @see https://github.com/modelcontextprotocol-identity/
|
|
105
|
+
* @see https://github.com/modelcontextprotocol-identity/checkpoint/docs/bouncer/tool-protection-sync.md
|
|
106
106
|
* @package @kya-os/mcp-i-core
|
|
107
107
|
*/
|
|
108
108
|
|
package/vitest.config.mts
CHANGED
|
@@ -8,7 +8,7 @@ export default defineConfig({
|
|
|
8
8
|
// These aliases work for both source files and bundled code in node_modules
|
|
9
9
|
"@kya-os/contracts/proof": path.resolve(__dirname, "../contracts/dist/proof/index.js"),
|
|
10
10
|
"@kya-os/contracts/delegation": path.resolve(__dirname, "../contracts/dist/delegation/index.js"),
|
|
11
|
-
"@kya-os/contracts/
|
|
11
|
+
"@kya-os/contracts/checkpoint-api": path.resolve(__dirname, "../contracts/dist/checkpoint-api/index.js"),
|
|
12
12
|
"@kya-os/contracts/config": path.resolve(__dirname, "../contracts/dist/config/index.js"),
|
|
13
13
|
"@kya-os/contracts/tool-protection": path.resolve(__dirname, "../contracts/dist/tool-protection/index.js"),
|
|
14
14
|
"@kya-os/contracts/well-known": path.resolve(__dirname, "../contracts/dist/well-known/index.js"),
|
/package/src/__tests__/services/{agentshield-integration.test.ts → checkpoint-integration.test.ts}
RENAMED
|
File without changes
|