read.js
1 import { cli, Strategy } from '@jackwener/opencli/registry'; 2 import { DOUBAO_DOMAIN, getDoubaoVisibleTurns } from './utils.js'; 3 export const readCommand = cli({ 4 site: 'doubao', 5 name: 'read', 6 description: 'Read the current Doubao conversation history', 7 domain: DOUBAO_DOMAIN, 8 strategy: Strategy.COOKIE, 9 browser: true, 10 navigateBefore: false, 11 args: [], 12 columns: ['Role', 'Text'], 13 func: async (page) => { 14 const turns = await getDoubaoVisibleTurns(page); 15 if (turns.length > 0) 16 return turns; 17 return [{ Role: 'System', Text: 'No visible Doubao messages were found.' }]; 18 }, 19 });