2 Commits

2 changed files with 122 additions and 128 deletions

View File

@@ -3,11 +3,13 @@ import { google, gmail_v1, sheets_v4, calendar_v3 } from "googleapis";
import { OAuth2Client } from "google-auth-library"; import { OAuth2Client } from "google-auth-library";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { fileURLToPath } from "url";
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Paths // Paths
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const __dirname = path.dirname(new URL(import.meta.url).pathname); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const PROJECT_ROOT = path.resolve(__dirname, "..", ".."); export const PROJECT_ROOT = path.resolve(__dirname, "..", "..");
const SECRETS_DIR = path.join(PROJECT_ROOT, "accountsAndCredentials"); const SECRETS_DIR = path.join(PROJECT_ROOT, "accountsAndCredentials");
const CREDENTIALS_PATH = path.join(SECRETS_DIR, "credentials.json"); const CREDENTIALS_PATH = path.join(SECRETS_DIR, "credentials.json");

View File

@@ -6,27 +6,23 @@ import {
} from "../loaders/prompt-config-loaders.js"; } from "../loaders/prompt-config-loaders.js";
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Prompt: review_emails (work account) // Prompt: Classify Emails (Phase 1)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
server.registerPrompt( server.registerPrompt(
"review_emails", "classify-emails",
{ {
description: description: "Phase 1: Organize, prioritize, and summarize incoming recruiter emails.",
`Review WORK inbox (${accounts.work?.label ?? "work"}): classify emails, delete A+C, summarize B+D, log B to spreadsheet, create calendar events.`,
}, },
() => { () => {
const phase1 = loadClassificationPrompt(); const phase1 = loadClassificationPrompt();
const phase2 = loadActionPrompt();
return { return {
messages: [ messages: [
{ {
role: "user" as const, role: "user" as const,
content: { content: {
type: "text" as const, type: "text" as const,
text: text: `ACCOUNT: Use account = "work" for ALL tool calls in this session.\n\n` +
`ACCOUNT: Use account = "work" for ALL tool calls in this session.\n\n` + (phase1 || "Review my new emails and classify them by job application category.")
(phase1 || "Review my new emails and classify them by job application category.") +
(phase2 ? `\n\n${phase2}` : ""),
}, },
}, },
], ],
@@ -35,16 +31,14 @@ server.registerPrompt(
); );
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Prompt: review_secondary_emails (secondary account) // Prompt: Take Action on Emails (Phase 2)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
server.registerPrompt( server.registerPrompt(
"review_secondary_emails", "take-action-on-emails",
{ {
description: description: "Phase 2: Log Category B recruiters to spreadsheet and create calendar events.",
`Review SECONDARY inbox (${accounts.secondary?.label ?? "secondary"}): classify emails, delete A+C, summarize B+D, log B to spreadsheet, create calendar events.`,
}, },
() => { () => {
const phase1 = loadClassificationPrompt();
const phase2 = loadActionPrompt(); const phase2 = loadActionPrompt();
return { return {
messages: [ messages: [
@@ -52,10 +46,8 @@ server.registerPrompt(
role: "user" as const, role: "user" as const,
content: { content: {
type: "text" as const, type: "text" as const,
text: text: `ACCOUNT: Use account = "work" for ALL tool calls in this session.\n\n` +
`ACCOUNT: Use account = "secondary" for ALL tool calls in this session.\n\n` + (phase2 || "Process remaining action items for flagged recruiters.")
(phase1 || "Review my new emails and classify them by job application category.") +
(phase2 ? `\n\n${phase2}` : ""),
}, },
}, },
], ],