diff --git a/src/commands/jobs.ts b/src/commands/jobs.ts index 3651e11..c883654 100644 --- a/src/commands/jobs.ts +++ b/src/commands/jobs.ts @@ -11,7 +11,7 @@ import { import { queryCommand } from './query'; -import { listAgentsFromWorkspace, readConfig } from '../utils/conf'; +import { listAgentsFromWorkspace } from '../utils/conf'; import { unixSourceCommand } from '../utils/shellCommands'; import Logger from '../utils/logger'; @@ -72,7 +72,6 @@ export async function jobSubscriptionCommand(options: { if (options.listen) { try { const workspace = options.workspace || process.cwd(); - const config = readConfig(); const [agent] = listAgentsFromWorkspace(workspace); @@ -83,8 +82,7 @@ export async function jobSubscriptionCommand(options: { logger.start(`Listening for new jobs on ${workspace}`); const response = await axios.get( - `${API_HOST}${API_VERSION}/agents/${agent.id}/jobs?status=todo`, - { headers: { Authorization: `Bearer ${config?.api_key}` } } + `${API_HOST}${API_VERSION}/agents/${agent.id}/jobs?status=todo` ); const jobs = response.data; @@ -98,21 +96,16 @@ export async function jobSubscriptionCommand(options: { logger.stop(`Found ${jobs.length} jobs to execute`); for (const idx in jobs) { - await axios.put( - `${API_HOST}${API_VERSION}/jobs/${jobs[idx].id}`, - { - status: 'in_progress', - host: `${shell_user.trim()}@${localIP.trim()}`, - }, - { headers: { Authorization: `Bearer ${config?.api_key}` } } - ); + await axios.put(`${API_HOST}${API_VERSION}/jobs/${jobs[idx].id}`, { + status: 'in_progress', + host: `${shell_user.trim()}@${localIP.trim()}`, + }); await queryCommand(jobs[idx].brief, { callback: async (response: unknown) => { - await axios.put( - `${API_HOST}${API_VERSION}/jobs/${jobs[idx].id}`, - { status: 'completed', result: response }, - { headers: { Authorization: `Bearer ${config?.api_key}` } } - ); + await axios.put(`${API_HOST}${API_VERSION}/jobs/${jobs[idx].id}`, { + status: 'completed', + result: response, + }); }, }); } diff --git a/src/index.ts b/src/index.ts index 3b13fdd..50cd404 100644 --- a/src/index.ts +++ b/src/index.ts @@ -110,6 +110,7 @@ program 'Unsubscribe to the API for new jobs on the current workspace' ) .option('--listen', 'Listen for new jobs from the API and execute them') + .hook('preAction', authMiddleware) .action(jobSubscriptionCommand); program diff --git a/src/utils/files.ts b/src/utils/files.ts index a0a5ddf..eee6664 100644 --- a/src/utils/files.ts +++ b/src/utils/files.ts @@ -152,7 +152,6 @@ export function getDirectoryMd5Hash({ maxDepth = DEFAULT_MAX_DEPTH, maxDirSize = DEFAULT_MAX_DIR_SIZE, // 10MB }: DirectoryMd5HashOptions) { - Logger.debug('Computing MD5 hash for directory:', directoryPath); // Initialize ignore manager at root level const ignoreManager = IgnoreManager.getInstance(); diff --git a/src/utils/ignore.ts b/src/utils/ignore.ts index 6f1ef91..74d5ba5 100644 --- a/src/utils/ignore.ts +++ b/src/utils/ignore.ts @@ -88,7 +88,6 @@ export class IgnoreManager { } } }); - Logger.debug('Unique ignore patterns:', uniquePatterns); } /**