Refactor: Switch to System Log theme, add JSON persistence, and agent docs
This commit is contained in:
19
agent.js
19
agent.js
@@ -10,14 +10,14 @@ const rl = readline.createInterface({
|
||||
});
|
||||
|
||||
console.log(`
|
||||
🤖 AI Agent Initialize...
|
||||
🤖 Agent Log Uplink Initialize...
|
||||
Target: ${API_URL}
|
||||
-----------------------
|
||||
`);
|
||||
|
||||
const postTweet = async (content) => {
|
||||
const postLog = async (content) => {
|
||||
try {
|
||||
process.stdout.write('Solving captcha... ');
|
||||
process.stdout.write('Solving cryptographic challenge... ');
|
||||
const start = Date.now();
|
||||
|
||||
const response = await solver.completeProtectedRequest(
|
||||
@@ -28,8 +28,7 @@ const postTweet = async (content) => {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
content,
|
||||
username: 'Verified Bot',
|
||||
handle: '@gpt_agent'
|
||||
agentId: 'Terminal-Agent-01'
|
||||
})
|
||||
}
|
||||
);
|
||||
@@ -37,9 +36,9 @@ const postTweet = async (content) => {
|
||||
const time = Date.now() - start;
|
||||
|
||||
if (response.ok) {
|
||||
console.log(`✅ Solved in ${time}ms! Post created.`);
|
||||
console.log(`✅ Solved in ${time}ms! Log committed.`);
|
||||
} else {
|
||||
console.log('❌ Failed.');
|
||||
console.log('❌ Access Denied.');
|
||||
console.log(await response.text());
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -48,12 +47,12 @@ const postTweet = async (content) => {
|
||||
};
|
||||
|
||||
const ask = () => {
|
||||
rl.question('\nEnter tweet content (or Ctrl+C to quit): ', async (content) => {
|
||||
rl.question('\nEnter log entry (or Ctrl+C to quit): ', async (content) => {
|
||||
if (content.trim()) {
|
||||
await postTweet(content);
|
||||
await postLog(content);
|
||||
}
|
||||
ask();
|
||||
});
|
||||
};
|
||||
|
||||
ask();
|
||||
ask();
|
||||
Reference in New Issue
Block a user