mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
refactor: remove agent_card_requires_auth config flag (#21914)
This commit is contained in:
@@ -557,26 +557,6 @@ auth:
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse auth with agent_card_requires_auth flag', async () => {
|
|
||||||
const filePath = await writeAgentMarkdown(`---
|
|
||||||
kind: remote
|
|
||||||
name: protected-card-agent
|
|
||||||
agent_card_url: https://example.com/card
|
|
||||||
auth:
|
|
||||||
type: apiKey
|
|
||||||
key: $MY_API_KEY
|
|
||||||
agent_card_requires_auth: true
|
|
||||||
---
|
|
||||||
`);
|
|
||||||
const result = await parseAgentMarkdown(filePath);
|
|
||||||
expect(result[0]).toMatchObject({
|
|
||||||
auth: {
|
|
||||||
type: 'apiKey',
|
|
||||||
agent_card_requires_auth: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse remote agent with oauth2 auth', async () => {
|
it('should parse remote agent with oauth2 auth', async () => {
|
||||||
const filePath = await writeAgentMarkdown(`---
|
const filePath = await writeAgentMarkdown(`---
|
||||||
kind: remote
|
kind: remote
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ interface FrontmatterLocalAgentDefinition
|
|||||||
*/
|
*/
|
||||||
interface FrontmatterAuthConfig {
|
interface FrontmatterAuthConfig {
|
||||||
type: 'apiKey' | 'http' | 'oauth2';
|
type: 'apiKey' | 'http' | 'oauth2';
|
||||||
agent_card_requires_auth?: boolean;
|
|
||||||
// API Key
|
// API Key
|
||||||
key?: string;
|
key?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -123,9 +122,7 @@ const localAgentSchema = z
|
|||||||
/**
|
/**
|
||||||
* Base fields shared by all auth configs.
|
* Base fields shared by all auth configs.
|
||||||
*/
|
*/
|
||||||
const baseAuthFields = {
|
const baseAuthFields = {};
|
||||||
agent_card_requires_auth: z.boolean().optional(),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API Key auth schema.
|
* API Key auth schema.
|
||||||
@@ -356,9 +353,7 @@ export async function parseAgentMarkdown(
|
|||||||
function convertFrontmatterAuthToConfig(
|
function convertFrontmatterAuthToConfig(
|
||||||
frontmatter: FrontmatterAuthConfig,
|
frontmatter: FrontmatterAuthConfig,
|
||||||
): A2AAuthConfig {
|
): A2AAuthConfig {
|
||||||
const base = {
|
const base = {};
|
||||||
agent_card_requires_auth: frontmatter.agent_card_requires_auth,
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (frontmatter.type) {
|
switch (frontmatter.type) {
|
||||||
case 'apiKey':
|
case 'apiKey':
|
||||||
|
|||||||
@@ -24,9 +24,8 @@ export interface A2AAuthProvider extends AuthenticationHandler {
|
|||||||
initialize?(): Promise<void>;
|
initialize?(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BaseAuthConfig {
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||||
agent_card_requires_auth?: boolean;
|
export interface BaseAuthConfig {}
|
||||||
}
|
|
||||||
|
|
||||||
/** Client config for google-credentials (not in A2A spec, Gemini-specific). */
|
/** Client config for google-credentials (not in A2A spec, Gemini-specific). */
|
||||||
export interface GoogleCredentialsAuthConfig extends BaseAuthConfig {
|
export interface GoogleCredentialsAuthConfig extends BaseAuthConfig {
|
||||||
|
|||||||
Reference in New Issue
Block a user