import "./subsystem-B57zAnh3.js";
import "./paths-aMBPuCJR.js";
import "./auth-profiles-vy16iW9a.js";
import "./env-DFfOiqpV.js";
import "./exec-rVpUMUjU.js";
import "./agent-scope-C3vq_G9s.js";
import "./github-copilot-token-5G6j3BB0.js";
import "./reliability-CU83NHOD.js";
import "./sqlite-CbyDDiup.js";
import "./accounts-Diz2TIQa.js";
import "./dock-YZOG_yQS.js";
import "./normalize-C804TuMz.js";
import "./bindings-DLG2Bod-.js";
import "./plugins-DqFdJSNb.js";
import "./message-channel-Cw5DRkgR.js";
import "./image-ops-D6in9bm7.js";
import "./config-BWfcFg-o.js";
import "./manifest-registry-DOrMVNcS.js";
import "./skills-WWjjkPNZ.js";
import { c as updateSessionStore } from "./sessions-Bge3YYgW.js";
import { t as resolveDefaultSessionStorePath } from "./paths-a4Li8t1f.js";
import "./tool-images-DTeIBF5l.js";
import { a as jsonResult, u as readStringParam } from "./common-CBZ0Olph.js";
import { l as revokeCredentials } from "./gog-credentials-CcFdYjtv.js";
import { Type } from "@sinclair/typebox";

//#region src/agents/tools/auth/gog-auth-revoke-tool.ts
/**
* gog_auth_revoke tool - Revoke Google OAuth credentials
*/
const GogAuthRevokeSchema = Type.Object({ email: Type.Optional(Type.String({ description: "Specific Google account email to revoke (optional, defaults to session credentials)" })) });
function createGogAuthRevokeTool(opts) {
	return {
		label: "Google Auth Revoke",
		name: "gog_auth_revoke",
		description: "Revoke Google OAuth credentials for this session. This will delete local credentials and revoke access with Google.",
		parameters: GogAuthRevokeSchema,
		execute: async (_toolCallId, args) => {
			const email = readStringParam(args, "email");
			if (!opts?.agentId || !opts?.agentDir || !opts?.sessionKey) return jsonResult({ error: "Missing agent context (agentId, agentDir, or sessionKey)" });
			try {
				await revokeCredentials(opts.agentId, opts.sessionKey, email);
				await updateSessionStore(resolveDefaultSessionStorePath(opts.agentId), (store) => {
					const session = store[opts.sessionKey];
					if (session) {
						delete session.gogCredentialsFile;
						delete session.gogAuthEmail;
						delete session.gogAuthPending;
						session.updatedAt = Date.now();
					}
				});
				return jsonResult({ success: true });
			} catch (error) {
				return jsonResult({
					success: false,
					error: error instanceof Error ? error.message : "Unknown error occurred"
				});
			}
		}
	};
}

//#endregion
export { createGogAuthRevokeTool };