taskforce-aiagent
Version:
TaskForce is a modular, open-source, production-ready TypeScript agent framework for orchestrating AI agents, LLM-powered autonomous agents, task pipelines, dynamic toolchains, RAG workflows and memory/retrieval systems.
46 lines (45 loc) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Task = void 0;
const enum_js_1 = require("../configs/enum.js");
const helper_js_1 = require("../helpers/helper.js");
class Task {
constructor(task) {
this.name = task.name;
this.description = task.description;
this.outputFormat = task.outputFormat;
this.agent = task.agent;
this.expectedRole = task.expectedRole;
this.id = task.id;
this.inputFromTask = task.inputFromTask;
this.inputMapper = task.inputMapper ?? this.autoDetectMapper();
this.executionContext = task.executionContext ?? {};
// ✅ replan reason flag'ini taşı
this.__replanReasonUsed = task.__replanReasonUsed ?? false;
}
autoDetectMapper() {
if (!this.inputFromTask)
return undefined;
switch (this.outputFormat) {
case enum_js_1.OutputFormat.json:
return (output) => {
try {
const cleaned = (0, helper_js_1.cleanMarkdownJson)(output);
return JSON.parse(cleaned);
}
catch {
return output;
}
};
case enum_js_1.OutputFormat.csv:
return (output) => (0, helper_js_1.parseCSV)(output);
case enum_js_1.OutputFormat.xml:
return (output) => (0, helper_js_1.parseXML)(output);
case enum_js_1.OutputFormat.markdown:
case enum_js_1.OutputFormat.text:
default:
return undefined; // Düz metin olarak bırak
}
}
}
exports.Task = Task;