import "./paths-WcYpcMAY.js";
import "./auth-profiles-CaNK0cUT.js";
import "./exec-CmvuUufz.js";
import "./agent-scope-E2aR3Ci_.js";
import "./github-copilot-token-CKOQDjEZ.js";
import "./emitter-BKo8D7Oj.js";
import "./sqlite-CVrhPija.js";
import "./reliability-BnL75OlZ.js";
import "./frontmatter-C3D7gE4Z.js";
import "./skills-UwTwDeDw.js";
import "./manifest-registry-AgGLF4V7.js";
import "./validation-B00oOkJ3.js";
import "./config-CoCeK5B2.js";
import "./message-channel-DKXbq8GH.js";
import { u as updateSessionStore } from "./sessions-CFJLtXRH.js";
import "./accounts-CNwod9BY.js";
import "./accounts-C3i8BBiA.js";
import "./normalize-CRf-uoB2.js";
import "./bindings-B1hNZin3.js";
import "./logging-BiuZwq5D.js";
import "./plugins-DMpYx7kb.js";
import "./image-ops-D0pBQqKh.js";
import "./dock-BvRrtCWj.js";
import "./accounts-CdYdWklO.js";
import { t as resolveDefaultSessionStorePath } from "./paths-CDTtU20P.js";
import "./tool-images-B4eVOjD0.js";
import { a as jsonResult, u as readStringParam } from "./common-CxpUJZLb.js";
import "./gmail-setup-utils-CqttLGxc.js";
import { l as revokeCredentials } from "./gog-credentials-tQ9F8HpD.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 };