import "./subsystem-Ci61Iebe.js";
import "./paths-aMBPuCJR.js";
import "./auth-profiles-CRqdowVc.js";
import "./env-3oW17BWM.js";
import "./exec-B5OgjUV4.js";
import "./agent-scope-CCFV2dzL.js";
import "./github-copilot-token-sMZoP3ZH.js";
import "./reliability-B6TVU4OW.js";
import "./sqlite-CbyDDiup.js";
import "./accounts-TaYXhwSR.js";
import "./dock-BRgbOpqS.js";
import "./normalize-Dz9m5w2g.js";
import "./bindings-jC2ZutIF.js";
import "./plugins-6aUfx6Yt.js";
import "./message-channel-BCPYwYUJ.js";
import "./image-ops-DfgorOBP.js";
import "./config-i4b9k_EZ.js";
import "./manifest-registry-BPLS_vpk.js";
import "./skills-CIrNKatf.js";
import { c as updateSessionStore } from "./sessions-N3tZC0jA.js";
import { t as resolveDefaultSessionStorePath } from "./paths-a4Li8t1f.js";
import "./tool-images-D39TNWEi.js";
import { a as jsonResult, u as readStringParam } from "./common-BkBiFnII.js";
import { l as revokeCredentials } from "./gog-credentials-CmQKyfSF.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 };