mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 06:25:16 -07:00
feat: Google Chat bridge with YOLO mode, text-based approvals, and Add-ons support
- Add normalizeEvent() to convert Workspace Add-ons event format to legacy ChatEvent - Add wrapAddOnsResponse() for Add-ons response wrapping - Mount chat bridge routes BEFORE A2A SDK catch-all handler - Replace card button approvals with text-based approve/reject/always allow - Add /reset, /yolo, /safe slash commands for session control - Add YOLO mode tool approval dedup (filter auto-approved surfaces) - Add extractCommandSummary() for concise tool card display - Delegate auth to Cloud Run IAM when K_SERVICE env var detected - Add JWT debug logging for token claim inspection
This commit is contained in:
@@ -203,6 +203,27 @@ export async function createApp() {
|
||||
requestStorage.run({ req }, next);
|
||||
});
|
||||
|
||||
// Mount Google Chat bridge routes BEFORE A2A SDK routes.
|
||||
// The A2A SDK's setupRoutes registers a catch-all jsonRpcHandler middleware
|
||||
// at baseUrl="" that intercepts ALL POST requests and returns 400 for
|
||||
// non-JSON-RPC payloads. Chat bridge must be registered first.
|
||||
const chatBridgeUrl =
|
||||
process.env['CHAT_BRIDGE_A2A_URL'] || process.env['CODER_AGENT_PORT']
|
||||
? `http://localhost:${process.env['CODER_AGENT_PORT'] || '8080'}`
|
||||
: undefined;
|
||||
if (chatBridgeUrl) {
|
||||
expressApp.use(express.json());
|
||||
const chatRoutes = createChatBridgeRoutes({
|
||||
a2aServerUrl: chatBridgeUrl,
|
||||
projectNumber: process.env['CHAT_PROJECT_NUMBER'],
|
||||
debug: process.env['CHAT_BRIDGE_DEBUG'] === 'true',
|
||||
});
|
||||
expressApp.use(chatRoutes);
|
||||
logger.info(
|
||||
`[CoreAgent] Google Chat bridge enabled at /chat/webhook (A2A: ${chatBridgeUrl})`,
|
||||
);
|
||||
}
|
||||
|
||||
const appBuilder = new A2AExpressApp(requestHandler);
|
||||
expressApp = appBuilder.setupRoutes(expressApp, '');
|
||||
expressApp.use(express.json());
|
||||
@@ -306,23 +327,6 @@ export async function createApp() {
|
||||
}
|
||||
});
|
||||
|
||||
// Mount Google Chat bridge routes if configured
|
||||
const chatBridgeUrl =
|
||||
process.env['CHAT_BRIDGE_A2A_URL'] || process.env['CODER_AGENT_PORT']
|
||||
? `http://localhost:${process.env['CODER_AGENT_PORT'] || '8080'}`
|
||||
: undefined;
|
||||
if (chatBridgeUrl) {
|
||||
const chatRoutes = createChatBridgeRoutes({
|
||||
a2aServerUrl: chatBridgeUrl,
|
||||
projectNumber: process.env['CHAT_PROJECT_NUMBER'],
|
||||
debug: process.env['CHAT_BRIDGE_DEBUG'] === 'true',
|
||||
});
|
||||
expressApp.use(chatRoutes);
|
||||
logger.info(
|
||||
`[CoreAgent] Google Chat bridge enabled at /chat/webhook (A2A: ${chatBridgeUrl})`,
|
||||
);
|
||||
}
|
||||
|
||||
expressApp.get('/tasks/:taskId/metadata', async (req, res) => {
|
||||
const taskId = req.params.taskId;
|
||||
let wrapper = agentExecutor.getTask(taskId);
|
||||
|
||||
Reference in New Issue
Block a user