mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-31 19:15:17 +02:00
add lookback period and note strictness dropdowns to onboarding
Add two preference dropdowns to the Connected Accounts step: - Lookback period (1 week / 1 month / 3 months) for Gmail and Fireflies sync - Note strictness (Auto / High / Medium / Low) with inline descriptions Replaces hardcoded LOOKBACK_DAYS in sync_gmail and sync_fireflies with configurable value from ~/.rowboat/config/lookback.json. Adds IPC channels for reading/writing both configs. SelectItem now supports a description prop rendered only in the dropdown, not the trigger. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b238089e2d
commit
0185433986
8 changed files with 233 additions and 8 deletions
44
apps/x/packages/core/src/config/lookback_config.ts
Normal file
44
apps/x/packages/core/src/config/lookback_config.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { WorkDir } from './config.js';
|
||||
|
||||
export type LookbackDays = 7 | 30 | 90;
|
||||
|
||||
interface LookbackConfig {
|
||||
days: LookbackDays;
|
||||
}
|
||||
|
||||
const CONFIG_FILE = path.join(WorkDir, 'config', 'lookback.json');
|
||||
const DEFAULT_DAYS: LookbackDays = 30;
|
||||
const VALID_VALUES: LookbackDays[] = [7, 30, 90];
|
||||
|
||||
function readConfig(): LookbackConfig {
|
||||
try {
|
||||
if (!fs.existsSync(CONFIG_FILE)) {
|
||||
return { days: DEFAULT_DAYS };
|
||||
}
|
||||
const raw = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
||||
const config = JSON.parse(raw);
|
||||
return {
|
||||
days: VALID_VALUES.includes(config.days) ? config.days : DEFAULT_DAYS,
|
||||
};
|
||||
} catch {
|
||||
return { days: DEFAULT_DAYS };
|
||||
}
|
||||
}
|
||||
|
||||
function writeConfig(config: LookbackConfig): void {
|
||||
const configDir = path.dirname(CONFIG_FILE);
|
||||
if (!fs.existsSync(configDir)) {
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
}
|
||||
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
||||
}
|
||||
|
||||
export function getLookbackDays(): LookbackDays {
|
||||
return readConfig().days;
|
||||
}
|
||||
|
||||
export function setLookbackDays(days: LookbackDays): void {
|
||||
writeConfig({ days });
|
||||
}
|
||||
|
|
@ -90,6 +90,17 @@ export function setStrictnessAndMarkConfigured(strictness: NoteCreationStrictnes
|
|||
writeConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset strictness to default and mark as not configured,
|
||||
* allowing auto-analysis to run again.
|
||||
*/
|
||||
export function resetStrictnessToAuto(): void {
|
||||
const config = readConfig();
|
||||
config.strictness = DEFAULT_STRICTNESS;
|
||||
config.configured = false;
|
||||
writeConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the agent file name suffix based on strictness.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { WorkDir } from '../config/config.js';
|
||||
import { getLookbackDays } from '../config/lookback_config.js';
|
||||
import { FirefliesClientFactory } from './fireflies-client-factory.js';
|
||||
import { serviceLogger, type ServiceRunContext } from '../services/service_logger.js';
|
||||
import { limitEventItems } from './limit_event_items.js';
|
||||
|
|
@ -9,7 +10,6 @@ import { limitEventItems } from './limit_event_items.js';
|
|||
const SYNC_DIR = path.join(WorkDir, 'fireflies_transcripts');
|
||||
const SYNC_INTERVAL_MS = 30 * 60 * 1000; // Check every 30 minutes (reduced from 1 minute)
|
||||
const STATE_FILE = path.join(SYNC_DIR, 'sync_state.json');
|
||||
const LOOKBACK_DAYS = 30; // Last 1 month
|
||||
const API_DELAY_MS = 2000; // 2 second delay between API calls
|
||||
const RATE_LIMIT_RETRY_DELAY_MS = 60 * 1000; // Wait 1 minute on rate limit
|
||||
const MAX_RETRIES = 3; // Maximum retries for rate-limited requests
|
||||
|
|
@ -406,10 +406,11 @@ async function syncMeetings() {
|
|||
}
|
||||
}
|
||||
|
||||
// Calculate date range (last 30 days)
|
||||
// Calculate date range based on configured lookback
|
||||
const lookbackDays = getLookbackDays();
|
||||
const toDate = new Date();
|
||||
const fromDate = new Date();
|
||||
fromDate.setDate(fromDate.getDate() - LOOKBACK_DAYS);
|
||||
fromDate.setDate(fromDate.getDate() - lookbackDays);
|
||||
|
||||
const fromDateStr = fromDate.toISOString().split('T')[0]; // YYYY-MM-DD
|
||||
const toDateStr = toDate.toISOString().split('T')[0];
|
||||
|
|
@ -637,7 +638,7 @@ async function syncMeetings() {
|
|||
export async function init() {
|
||||
console.log('[Fireflies] Starting Fireflies Sync...');
|
||||
console.log(`[Fireflies] Will sync every ${SYNC_INTERVAL_MS / 1000} seconds.`);
|
||||
console.log(`[Fireflies] Syncing transcripts from the last ${LOOKBACK_DAYS} days.`);
|
||||
console.log(`[Fireflies] Syncing transcripts from the last ${getLookbackDays()} days.`);
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { google, gmail_v1 as gmail } from 'googleapis';
|
|||
import { NodeHtmlMarkdown } from 'node-html-markdown'
|
||||
import { OAuth2Client } from 'google-auth-library';
|
||||
import { WorkDir } from '../config/config.js';
|
||||
import { getLookbackDays } from '../config/lookback_config.js';
|
||||
import { GoogleClientFactory } from './google-client-factory.js';
|
||||
import { serviceLogger, type ServiceRunContext } from '../services/service_logger.js';
|
||||
import { limitEventItems } from './limit_event_items.js';
|
||||
|
|
@ -408,7 +409,7 @@ async function partialSync(auth: OAuth2Client, startHistoryId: string, syncDir:
|
|||
}
|
||||
|
||||
async function performSync() {
|
||||
const LOOKBACK_DAYS = 30; // Default to 1 month
|
||||
const LOOKBACK_DAYS = getLookbackDays();
|
||||
const ATTACHMENTS_DIR = path.join(SYNC_DIR, 'attachments');
|
||||
const STATE_FILE = path.join(SYNC_DIR, 'sync_state.json');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue