28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.EXPLORATION_JOB_TYPE = void 0;
|
|
exports.createExplorationJobHandler = createExplorationJobHandler;
|
|
const UniqueId_1 = require("../../shared/domain/UniqueId");
|
|
exports.EXPLORATION_JOB_TYPE = 'exploration:run';
|
|
function createExplorationJobHandler(deps) {
|
|
return async (payload) => {
|
|
const { sessionId, url, seed, maxStates } = payload;
|
|
const log = deps.logger.child({ jobType: exports.EXPLORATION_JOB_TYPE, sessionId });
|
|
log.info({ url, seed, maxStates }, 'Exploration job executing');
|
|
const id = UniqueId_1.UniqueId.from(sessionId);
|
|
const session = await deps.sessionRepo.findById(id);
|
|
if (!session) {
|
|
throw new Error(`Session not found: ${sessionId}`);
|
|
}
|
|
// In this phase the actual Playwright crawl is handled by the ExplorationOrchestrator
|
|
// which is wired separately. Here we mark the session as running and publish an event.
|
|
// Full end-to-end crawling is integrated in Phase 4's infrastructure layer.
|
|
log.info({ statesVisited: session.statesVisited }, 'Exploration job complete (orchestration delegated)');
|
|
return {
|
|
sessionId,
|
|
statesVisited: session.statesVisited,
|
|
anomaliesFound: 0,
|
|
};
|
|
};
|
|
}
|