task-o-matic 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/ai-service/ai-operations.d.ts +3 -2
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/ai-operations.js +13 -7
- package/dist/lib/ai-service/base-operations.d.ts +2 -0
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.js +5 -2
- package/dist/lib/ai-service/documentation-operations.d.ts +2 -2
- package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/documentation-operations.js +14 -10
- package/dist/lib/ai-service/filesystem-tools.d.ts +47 -33
- package/dist/lib/ai-service/filesystem-tools.d.ts.map +1 -1
- package/dist/lib/ai-service/filesystem-tools.js +109 -61
- package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/prd-operations.js +3 -4
- package/dist/lib/ai-service/task-operations.d.ts +1 -1
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/task-operations.js +8 -7
- package/dist/test/lib/ai-service/task-operations.test.js +4 -0
- package/dist/utils/ai-service-factory.d.ts +8 -0
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +9 -3
- package/package.json +1 -6
|
@@ -8,6 +8,7 @@ export declare class AIOperations extends BaseOperations {
|
|
|
8
8
|
private prdOps;
|
|
9
9
|
private taskOps;
|
|
10
10
|
private docOps;
|
|
11
|
+
constructor(tools?: any);
|
|
11
12
|
parsePRD(prdContent: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, workingDirectory?: string, enableFilesystemTools?: boolean): Promise<AIPRDParseResult>;
|
|
12
13
|
breakdownTask(task: Task, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, fullContent?: string, stackInfo?: string, existingSubtasks?: Task[], enableFilesystemTools?: boolean): Promise<Array<{
|
|
13
14
|
title: string;
|
|
@@ -26,8 +27,8 @@ export declare class AIOperations extends BaseOperations {
|
|
|
26
27
|
enhanceTaskWithDocumentation(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: Record<string, Array<{
|
|
27
28
|
query: string;
|
|
28
29
|
doc: string;
|
|
29
|
-
}
|
|
30
|
-
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[]): Promise<DocumentationDetection>;
|
|
30
|
+
}>>, enableFilesystemTools?: boolean): Promise<string>;
|
|
31
|
+
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[], enableFilesystemTools?: boolean): Promise<DocumentationDetection>;
|
|
31
32
|
generateDocumentationRecap(libraries: Array<{
|
|
32
33
|
name: string;
|
|
33
34
|
context7Id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/ai-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"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EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,EACpD,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,sBAAsB,CAAC;IAc5B,0BAA0B,CAC9B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,gBAAgB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IASZ,QAAQ,CACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAWnB"}
|
|
@@ -10,9 +10,15 @@ const documentation_operations_1 = require("./documentation-operations");
|
|
|
10
10
|
* This provides a unified API for all AI operations while keeping the implementation modular.
|
|
11
11
|
*/
|
|
12
12
|
class AIOperations extends base_operations_1.BaseOperations {
|
|
13
|
-
prdOps
|
|
14
|
-
taskOps
|
|
15
|
-
docOps
|
|
13
|
+
prdOps;
|
|
14
|
+
taskOps;
|
|
15
|
+
docOps;
|
|
16
|
+
constructor(tools) {
|
|
17
|
+
super(tools);
|
|
18
|
+
this.prdOps = new prd_operations_1.PRDOperations(tools);
|
|
19
|
+
this.taskOps = new task_operations_1.TaskOperations(tools);
|
|
20
|
+
this.docOps = new documentation_operations_1.DocumentationOperations(tools);
|
|
21
|
+
}
|
|
16
22
|
// PRD Operations - Delegated to PRDOperations
|
|
17
23
|
async parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
18
24
|
return this.prdOps.parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools);
|
|
@@ -40,11 +46,11 @@ class AIOperations extends base_operations_1.BaseOperations {
|
|
|
40
46
|
return this.prdOps.combinePRDs(prds, originalDescription, config, promptOverride, userMessage, streamingOptions, retryConfig);
|
|
41
47
|
}
|
|
42
48
|
// Documentation Operations - Delegated to DocumentationOperations
|
|
43
|
-
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
44
|
-
return this.docOps.enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch);
|
|
49
|
+
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
50
|
+
return this.docOps.enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools);
|
|
45
51
|
}
|
|
46
|
-
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
47
|
-
return this.docOps.analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch);
|
|
52
|
+
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
53
|
+
return this.docOps.analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools);
|
|
48
54
|
}
|
|
49
55
|
async generateDocumentationRecap(libraries, documentContents, streamingOptions, retryConfig) {
|
|
50
56
|
return this.docOps.generateDocumentationRecap(libraries, documentContents, streamingOptions, retryConfig);
|
|
@@ -8,6 +8,8 @@ export declare class BaseOperations {
|
|
|
8
8
|
protected context7Client: Context7Client;
|
|
9
9
|
protected retryHandler: RetryHandler;
|
|
10
10
|
protected modelProvider: ModelProvider;
|
|
11
|
+
protected tools: any;
|
|
12
|
+
constructor(tools?: any);
|
|
11
13
|
/**
|
|
12
14
|
* Merges AI configuration with proper precedence.
|
|
13
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;
|
|
1
|
+
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;IAC9C,SAAS,CAAC,KAAK,EAAE,GAAG,CAAM;gBAEd,KAAK,CAAC,EAAE,GAAG;IAIvB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAQ7D;;;;;;OAMG;IACH,SAAS,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAkB9C,UAAU,CACd,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAgEnB"}
|
|
@@ -11,6 +11,10 @@ class BaseOperations {
|
|
|
11
11
|
context7Client = new mcp_client_1.Context7Client();
|
|
12
12
|
retryHandler = new retry_handler_1.RetryHandler();
|
|
13
13
|
modelProvider = new model_provider_1.ModelProvider();
|
|
14
|
+
tools = {}; // Tools to be injected
|
|
15
|
+
constructor(tools) {
|
|
16
|
+
this.tools = tools || {};
|
|
17
|
+
}
|
|
14
18
|
/**
|
|
15
19
|
* Merges AI configuration with proper precedence.
|
|
16
20
|
*
|
|
@@ -46,8 +50,7 @@ class BaseOperations {
|
|
|
46
50
|
* @protected
|
|
47
51
|
*/
|
|
48
52
|
handleContext7ToolResult(chunk) {
|
|
49
|
-
if (chunk.type === "tool-result" &&
|
|
50
|
-
chunk.toolName === "get-library-docs") {
|
|
53
|
+
if (chunk.type === "tool-result" && chunk.toolName === "get-library-docs") {
|
|
51
54
|
const docs = chunk.output;
|
|
52
55
|
const libraryID = chunk.input?.context7CompatibleLibraryID || "unknown";
|
|
53
56
|
const topic = chunk.input?.topic || "general";
|
|
@@ -4,8 +4,8 @@ export declare class DocumentationOperations extends BaseOperations {
|
|
|
4
4
|
enhanceTaskWithDocumentation(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: Record<string, Array<{
|
|
5
5
|
query: string;
|
|
6
6
|
doc: string;
|
|
7
|
-
}
|
|
8
|
-
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[]): Promise<DocumentationDetection>;
|
|
7
|
+
}>>, enableFilesystemTools?: boolean): Promise<string>;
|
|
8
|
+
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[], enableFilesystemTools?: boolean): Promise<DocumentationDetection>;
|
|
9
9
|
generateDocumentationRecap(libraries: Array<{
|
|
10
10
|
name: string;
|
|
11
11
|
context7Id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentation-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/documentation-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"documentation-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/documentation-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,uBAAwB,SAAQ,cAAc;IACnD,4BAA4B,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,EACxE,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,MAAM,CAAC;IA6JZ,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,EACpD,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,sBAAsB,CAAC;IAkM5B,0BAA0B,CAC9B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,gBAAgB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA8CnB"}
|
|
@@ -5,10 +5,9 @@ const ai_1 = require("ai");
|
|
|
5
5
|
const prompt_builder_1 = require("../prompt-builder");
|
|
6
6
|
const prompts_1 = require("../../prompts");
|
|
7
7
|
const ai_service_factory_1 = require("../../utils/ai-service-factory");
|
|
8
|
-
const filesystem_tools_1 = require("./filesystem-tools");
|
|
9
8
|
const base_operations_1 = require("./base-operations");
|
|
10
9
|
class DocumentationOperations extends base_operations_1.BaseOperations {
|
|
11
|
-
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
10
|
+
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
12
11
|
return this.retryHandler
|
|
13
12
|
.executeWithRetry(async () => {
|
|
14
13
|
const mcpTools = await this.context7Client.getMCPTools();
|
|
@@ -43,25 +42,29 @@ class DocumentationOperations extends base_operations_1.BaseOperations {
|
|
|
43
42
|
const prompt = promptResult.prompt;
|
|
44
43
|
const allTools = {
|
|
45
44
|
...mcpTools,
|
|
46
|
-
...
|
|
45
|
+
...(enableFilesystemTools ? this.tools : {}),
|
|
47
46
|
};
|
|
48
47
|
const result = await (0, ai_1.streamText)({
|
|
49
48
|
model,
|
|
50
49
|
tools: allTools,
|
|
51
50
|
system: prompts_1.TASK_ENHANCEMENT_SYSTEM_PROMPT +
|
|
52
51
|
`
|
|
53
|
-
|
|
54
|
-
You have access to Context7 documentation tools and filesystem tools.
|
|
52
|
+
|
|
53
|
+
You have access to Context7 documentation tools${enableFilesystemTools ? " and filesystem tools" : ""}.
|
|
55
54
|
|
|
56
55
|
## Available Tools:
|
|
57
56
|
- Context7 MCP tools (context7_resolve_library_id, context7_get_library_docs) for library documentation
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
${enableFilesystemTools
|
|
58
|
+
? `- readFile: Read the contents of any file in the project
|
|
59
|
+
- listDirectory: List contents of directories`
|
|
60
|
+
: ""}
|
|
60
61
|
|
|
61
62
|
## Research Strategy:
|
|
62
63
|
1. Use Context7 MCP tools for library documentation research
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
${enableFilesystemTools
|
|
65
|
+
? `2. Use filesystem tools to understand project structure, existing code, and dependencies`
|
|
66
|
+
: ""}
|
|
67
|
+
${enableFilesystemTools ? "3" : "2"}. Synthesize information from all sources to enhance the task
|
|
65
68
|
|
|
66
69
|
Technology stack context: ${stackInfo || "Not specified"}
|
|
67
70
|
|
|
@@ -124,7 +127,7 @@ ${existingResearchContext}`,
|
|
|
124
127
|
await this.context7Client.closeMCPConnection();
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
|
-
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
130
|
+
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
128
131
|
return this.retryHandler
|
|
129
132
|
.executeWithRetry(async () => {
|
|
130
133
|
const mcpTools = await this.context7Client.getMCPTools();
|
|
@@ -158,6 +161,7 @@ ${existingResearchContext}`,
|
|
|
158
161
|
const files = [];
|
|
159
162
|
const allTools = {
|
|
160
163
|
...mcpTools,
|
|
164
|
+
...(enableFilesystemTools ? this.tools : {}),
|
|
161
165
|
};
|
|
162
166
|
const result = await (0, ai_1.streamText)({
|
|
163
167
|
model,
|
|
@@ -1,36 +1,50 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
path: string
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
success: boolean;
|
|
20
|
-
contents: {
|
|
21
|
-
name: string;
|
|
22
|
-
type: string;
|
|
1
|
+
export interface FileSystem {
|
|
2
|
+
readFile(path: string, encoding: string): Promise<string>;
|
|
3
|
+
readdir(path: string, options?: {
|
|
4
|
+
withFileTypes?: boolean;
|
|
5
|
+
}): Promise<any[]>;
|
|
6
|
+
stat(path: string): Promise<{
|
|
7
|
+
size: number;
|
|
8
|
+
isDirectory(): boolean;
|
|
9
|
+
isFile(): boolean;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare const nodeFileSystem: FileSystem;
|
|
13
|
+
export declare const createFilesystemTools: (fs?: FileSystem) => {
|
|
14
|
+
readFile: import("ai").Tool<{
|
|
15
|
+
filePath: string;
|
|
16
|
+
}, {
|
|
17
|
+
success: boolean;
|
|
18
|
+
content: string;
|
|
23
19
|
path: string;
|
|
24
|
-
size: number
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
size: number;
|
|
21
|
+
error?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
success: boolean;
|
|
24
|
+
error: string;
|
|
25
|
+
content?: undefined;
|
|
26
|
+
path?: undefined;
|
|
27
|
+
size?: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
listDirectory: import("ai").Tool<{
|
|
30
|
+
dirPath: string;
|
|
31
|
+
}, {
|
|
32
|
+
success: boolean;
|
|
33
|
+
contents: {
|
|
34
|
+
name: any;
|
|
35
|
+
type: string;
|
|
36
|
+
path: string;
|
|
37
|
+
size: number | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
directory: string;
|
|
40
|
+
error?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
success: boolean;
|
|
43
|
+
error: string;
|
|
44
|
+
contents: never[];
|
|
45
|
+
directory?: undefined;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
34
48
|
export declare const filesystemTools: {
|
|
35
49
|
readFile: import("ai").Tool<{
|
|
36
50
|
filePath: string;
|
|
@@ -52,7 +66,7 @@ export declare const filesystemTools: {
|
|
|
52
66
|
}, {
|
|
53
67
|
success: boolean;
|
|
54
68
|
contents: {
|
|
55
|
-
name:
|
|
69
|
+
name: any;
|
|
56
70
|
type: string;
|
|
57
71
|
path: string;
|
|
58
72
|
size: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-tools.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/filesystem-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filesystem-tools.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/filesystem-tools.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7E,IAAI,CACF,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,IAAI,OAAO,CAAC;QAAC,MAAM,IAAI,OAAO,CAAA;KAAE,CAAC,CAAC;CACzE;AAGD,eAAO,MAAM,cAAc,EAAE,UAO5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,KAAI,UAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGpE,CAAC;AAGF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwC,CAAC"}
|
|
@@ -1,70 +1,118 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filesystemTools = exports.
|
|
3
|
+
exports.filesystemTools = exports.createFilesystemTools = exports.nodeFileSystem = void 0;
|
|
4
4
|
const ai_1 = require("ai");
|
|
5
5
|
const v3_1 = require("zod/v3");
|
|
6
|
-
const promises_1 = require("fs/promises");
|
|
7
6
|
const path_1 = require("path");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const resolvedPath = (0, path_1.resolve)(filePath);
|
|
16
|
-
const content = await (0, promises_1.readFile)(resolvedPath, 'utf-8');
|
|
17
|
-
const stats = await (0, promises_1.stat)(resolvedPath);
|
|
18
|
-
return {
|
|
19
|
-
success: true,
|
|
20
|
-
content,
|
|
21
|
-
path: (0, path_1.relative)(process.cwd(), resolvedPath),
|
|
22
|
-
size: stats.size,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
return {
|
|
27
|
-
success: false,
|
|
28
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
29
|
-
};
|
|
30
|
-
}
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
8
|
+
// Default Node.js implementation
|
|
9
|
+
exports.nodeFileSystem = {
|
|
10
|
+
readFile: (path, encoding) => (0, promises_1.readFile)(path, encoding),
|
|
11
|
+
readdir: async (path, options) => {
|
|
12
|
+
// Cast to any to handle overload matching or explicit return type
|
|
13
|
+
return (0, promises_1.readdir)(path, options);
|
|
31
14
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
stat: (path) => (0, promises_1.stat)(path),
|
|
16
|
+
};
|
|
17
|
+
const createFilesystemTools = (fs = exports.nodeFileSystem) => {
|
|
18
|
+
const readFileTool = (0, ai_1.tool)({
|
|
19
|
+
description: "Read the contents of a file",
|
|
20
|
+
inputSchema: v3_1.z.object({
|
|
21
|
+
filePath: v3_1.z.string().describe("Path to the file to read"),
|
|
22
|
+
}),
|
|
23
|
+
execute: async ({ filePath }) => {
|
|
24
|
+
try {
|
|
25
|
+
// Resolve path relative to current working directory (process.cwd() might need abstraction too later, but for now we assume fs handles absolute paths or we pass resolved paths)
|
|
26
|
+
// Note: For browser, 'resolve' from 'path' works if polyfilled, but process.cwd() might be static '/'
|
|
27
|
+
// We will assume the fs implementation handles the paths provided.
|
|
28
|
+
// However, the original code used resolve(filePath).
|
|
29
|
+
// We should double check if the browser environment has properly polyfilled 'path'.
|
|
30
|
+
// Usually web apps use 'path-browserify'.
|
|
31
|
+
let resolvedPath = filePath;
|
|
32
|
+
// Basic check if it looks relative
|
|
33
|
+
if (!filePath.startsWith("/")) {
|
|
34
|
+
try {
|
|
35
|
+
resolvedPath = (0, path_1.resolve)(filePath);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
// In some browser envs resolve might fail or not exist if process is missing methods
|
|
39
|
+
// Fallback to simple join if needed, but usually path-browserify handles it.
|
|
40
|
+
// For now, let's trust resolve or just use the path if errors.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const content = await fs.readFile(resolvedPath, "utf-8");
|
|
44
|
+
const stats = await fs.stat(resolvedPath);
|
|
45
45
|
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path:
|
|
49
|
-
size:
|
|
46
|
+
success: true,
|
|
47
|
+
content,
|
|
48
|
+
path: resolvedPath, // Return resolved path simplifies things
|
|
49
|
+
size: stats.size,
|
|
50
50
|
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const listDirectoryTool = (0, ai_1.tool)({
|
|
61
|
+
description: "List contents of a directory",
|
|
62
|
+
inputSchema: v3_1.z.object({
|
|
63
|
+
dirPath: v3_1.z.string().describe("Directory path to list"),
|
|
64
|
+
}),
|
|
65
|
+
execute: async ({ dirPath }) => {
|
|
66
|
+
try {
|
|
67
|
+
let resolvedPath = dirPath;
|
|
68
|
+
if (!dirPath.startsWith("/")) {
|
|
69
|
+
try {
|
|
70
|
+
resolvedPath = (0, path_1.resolve)(dirPath);
|
|
71
|
+
}
|
|
72
|
+
catch (e) { }
|
|
73
|
+
}
|
|
74
|
+
const entries = await fs.readdir(resolvedPath, { withFileTypes: true });
|
|
75
|
+
const contents = await Promise.all(entries.map(async (entry) => {
|
|
76
|
+
const entryName = entry.name;
|
|
77
|
+
const fullPath = (0, path_1.join)(resolvedPath, entryName);
|
|
78
|
+
// Check if fs.stat is needed or if entry has type info
|
|
79
|
+
const isDir = entry.isDirectory();
|
|
80
|
+
const isFile = entry.isFile();
|
|
81
|
+
let size = undefined;
|
|
82
|
+
if (isFile) {
|
|
83
|
+
try {
|
|
84
|
+
const stats = await fs.stat(fullPath);
|
|
85
|
+
size = stats.size;
|
|
86
|
+
}
|
|
87
|
+
catch (e) { }
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
name: entryName,
|
|
91
|
+
type: isDir ? "directory" : "file",
|
|
92
|
+
path: fullPath,
|
|
93
|
+
size: size,
|
|
94
|
+
};
|
|
95
|
+
}));
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
contents,
|
|
99
|
+
directory: resolvedPath,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return {
|
|
104
|
+
success: false,
|
|
105
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
106
|
+
contents: [],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
readFile: readFileTool,
|
|
113
|
+
listDirectory: listDirectoryTool,
|
|
114
|
+
};
|
|
70
115
|
};
|
|
116
|
+
exports.createFilesystemTools = createFilesystemTools;
|
|
117
|
+
// Backward compatibility (using Node.js fs)
|
|
118
|
+
exports.filesystemTools = (0, exports.createFilesystemTools)(exports.nodeFileSystem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prd-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/prd-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAIZ,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prd-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/prd-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAIZ,MAAM,aAAa,CAAC;AAWrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,qBAAa,aAAc,SAAQ,cAAc;IACzC,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gB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AAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IAqBZ,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,EACd,mBAAmB,EAAE,MAAM,EAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA0BnB"}
|
|
@@ -37,7 +37,6 @@ exports.PRDOperations = void 0;
|
|
|
37
37
|
const ai_1 = require("ai");
|
|
38
38
|
const prompt_builder_1 = require("../prompt-builder");
|
|
39
39
|
const prompts_1 = require("../../prompts");
|
|
40
|
-
const filesystem_tools_1 = require("./filesystem-tools");
|
|
41
40
|
const base_operations_1 = require("./base-operations");
|
|
42
41
|
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
43
42
|
class PRDOperations extends base_operations_1.BaseOperations {
|
|
@@ -87,7 +86,7 @@ class PRDOperations extends base_operations_1.BaseOperations {
|
|
|
87
86
|
...config,
|
|
88
87
|
});
|
|
89
88
|
const allTools = {
|
|
90
|
-
...
|
|
89
|
+
...this.tools,
|
|
91
90
|
};
|
|
92
91
|
const result = await (0, ai_1.streamText)({
|
|
93
92
|
model,
|
|
@@ -224,7 +223,7 @@ Use these tools to understand the project structure, existing code patterns, and
|
|
|
224
223
|
...config,
|
|
225
224
|
});
|
|
226
225
|
const allTools = {
|
|
227
|
-
...
|
|
226
|
+
...this.tools,
|
|
228
227
|
};
|
|
229
228
|
const result = await (0, ai_1.streamText)({
|
|
230
229
|
model,
|
|
@@ -313,7 +312,7 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
313
312
|
...this.modelProvider.getAIConfig(),
|
|
314
313
|
...config,
|
|
315
314
|
});
|
|
316
|
-
const allTools = { ...
|
|
315
|
+
const allTools = { ...this.tools };
|
|
317
316
|
const result = await (0, ai_1.streamText)({
|
|
318
317
|
model,
|
|
319
318
|
tools: allTools,
|
|
@@ -8,6 +8,6 @@ export declare class TaskOperations extends BaseOperations {
|
|
|
8
8
|
estimatedEffort?: string;
|
|
9
9
|
}>>;
|
|
10
10
|
enhanceTask(title: string, description?: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, taskId?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
11
|
-
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig
|
|
11
|
+
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, enableFilesystemTools?: boolean): Promise<string>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=task-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/task-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"task-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/task-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,aAAa,CAAC;AASrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA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 +5,6 @@ const prompt_builder_1 = require("../prompt-builder");
|
|
|
5
5
|
const stack_formatter_1 = require("../../utils/stack-formatter");
|
|
6
6
|
const prompts_1 = require("../../prompts");
|
|
7
7
|
const ai_service_factory_1 = require("../../utils/ai-service-factory");
|
|
8
|
-
const filesystem_tools_1 = require("./filesystem-tools");
|
|
9
8
|
const base_operations_1 = require("./base-operations");
|
|
10
9
|
const ai_operation_utility_1 = require("../../utils/ai-operation-utility");
|
|
11
10
|
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
@@ -53,9 +52,9 @@ class TaskOperations extends base_operations_1.BaseOperations {
|
|
|
53
52
|
// Execute AI operation with proper error handling
|
|
54
53
|
const result = await this.aiOperationUtility.executeAIOperation("Task breakdown", async () => {
|
|
55
54
|
// Prepare tools if filesystem tools are enabled
|
|
56
|
-
const tools = enableFilesystemTools ?
|
|
55
|
+
const tools = enableFilesystemTools ? this.tools : undefined;
|
|
57
56
|
const response = await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_BREAKDOWN_SYSTEM_PROMPT +
|
|
58
|
-
(enableFilesystemTools
|
|
57
|
+
(enableFilesystemTools && this.tools
|
|
59
58
|
? `
|
|
60
59
|
|
|
61
60
|
You have access to filesystem tools that allow you to:
|
|
@@ -158,7 +157,7 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
158
157
|
// Return the result directly (errors are thrown, not returned)
|
|
159
158
|
return result.result;
|
|
160
159
|
}
|
|
161
|
-
async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig) {
|
|
160
|
+
async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig, enableFilesystemTools) {
|
|
162
161
|
// Build prompt
|
|
163
162
|
let prompt;
|
|
164
163
|
if (promptOverride) {
|
|
@@ -189,16 +188,18 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
189
188
|
const mcpTools = await this.context7Client.getMCPTools();
|
|
190
189
|
const allTools = {
|
|
191
190
|
...mcpTools,
|
|
192
|
-
...
|
|
191
|
+
...(enableFilesystemTools ? this.tools : {}),
|
|
193
192
|
};
|
|
194
193
|
return await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_PLANNING_SYSTEM_PROMPT +
|
|
195
|
-
|
|
194
|
+
(enableFilesystemTools && this.tools
|
|
195
|
+
? `
|
|
196
196
|
|
|
197
197
|
You have access to filesystem tools that allow you to:
|
|
198
198
|
- readFile: Read the contents of any file in the project
|
|
199
199
|
- listDirectory: List contents of directories
|
|
200
200
|
|
|
201
|
-
Use these tools to understand the project structure, existing code, and dependencies when creating implementation plans
|
|
201
|
+
Use these tools to understand the project structure, existing code, and dependencies when creating implementation plans.`
|
|
202
|
+
: ""), userMessage || prompt, config, streamingOptions, allTools);
|
|
202
203
|
}, {
|
|
203
204
|
streamingOptions,
|
|
204
205
|
retryConfig,
|
|
@@ -109,6 +109,10 @@ describe("TaskOperations Integration Tests", () => {
|
|
|
109
109
|
});
|
|
110
110
|
it("should handle filesystem tools when enabled", async () => {
|
|
111
111
|
let toolsPassed = false;
|
|
112
|
+
// Inject mock tools to simulate filesystem tools availability
|
|
113
|
+
taskOps.tools = {
|
|
114
|
+
mockFilesystemTool: {},
|
|
115
|
+
};
|
|
112
116
|
// Override streamTextWithTools to capture tools parameter
|
|
113
117
|
mockAIOperationUtility.streamTextWithTools = async (_systemPrompt, _userMessage, _config, _streamingOptions, tools) => {
|
|
114
118
|
if (tools && Object.keys(tools).length > 0) {
|
|
@@ -10,6 +10,14 @@ export interface ServiceOptions {
|
|
|
10
10
|
contextCallbacks?: ContextCallbacks;
|
|
11
11
|
workingDirectory?: string;
|
|
12
12
|
}
|
|
13
|
+
import { FileSystem } from "../lib/ai-service/filesystem-tools";
|
|
14
|
+
export interface ServiceOptions {
|
|
15
|
+
storageCallbacks?: StorageCallbacks;
|
|
16
|
+
configCallbacks?: ConfigCallbacks;
|
|
17
|
+
contextCallbacks?: ContextCallbacks;
|
|
18
|
+
workingDirectory?: string;
|
|
19
|
+
filesystem?: FileSystem;
|
|
20
|
+
}
|
|
13
21
|
/**
|
|
14
22
|
* Initialize services with optional custom callbacks.
|
|
15
23
|
* This is the entry point for web applications or custom environments.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-service-factory.d.ts","sourceRoot":"","sources":["../../src/utils/ai-service-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAiB,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAMpE,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAOD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ai-service-factory.d.ts","sourceRoot":"","sources":["../../src/utils/ai-service-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAiB,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAMpE,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AACD,OAAO,EACL,UAAU,EAGX,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAOD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,wBAAgB,eAAe,IAAI,YAAY,CAO9C;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD;AAED,wBAAgB,UAAU,IAAI,cAAc,CAsB3C;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAK5C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE;IAC7C,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,IAAI,CAKP"}
|
|
@@ -14,6 +14,7 @@ const config_1 = require("../lib/config");
|
|
|
14
14
|
const ai_operations_1 = require("../lib/ai-service/ai-operations");
|
|
15
15
|
const model_provider_1 = require("../lib/ai-service/model-provider");
|
|
16
16
|
const task_o_matic_error_1 = require("./task-o-matic-error");
|
|
17
|
+
const filesystem_tools_1 = require("../lib/ai-service/filesystem-tools");
|
|
17
18
|
let aiOperations = null;
|
|
18
19
|
let modelProvider = null;
|
|
19
20
|
let storage = null;
|
|
@@ -38,13 +39,18 @@ async function initializeServices(options = {}) {
|
|
|
38
39
|
storage = new file_system_1.FileSystemStorage(options.storageCallbacks);
|
|
39
40
|
// Initialize context builder
|
|
40
41
|
contextBuilder = new context_builder_1.ContextBuilder(storage, options.contextCallbacks);
|
|
41
|
-
//
|
|
42
|
-
|
|
42
|
+
// Initialize AI Operations with specific filesystem if provided
|
|
43
|
+
// If filesystem is provided, we create the tools with it
|
|
44
|
+
const fsImpl = options.filesystem || filesystem_tools_1.nodeFileSystem;
|
|
45
|
+
const tools = (0, filesystem_tools_1.createFilesystemTools)(fsImpl);
|
|
46
|
+
aiOperations = new ai_operations_1.AIOperations(tools);
|
|
43
47
|
modelProvider = null;
|
|
44
48
|
}
|
|
45
49
|
function getAIOperations() {
|
|
46
50
|
if (!aiOperations) {
|
|
47
|
-
|
|
51
|
+
// If accessed before initialize, use defaults
|
|
52
|
+
const tools = (0, filesystem_tools_1.createFilesystemTools)(filesystem_tools_1.nodeFileSystem);
|
|
53
|
+
aiOperations = new ai_operations_1.AIOperations(tools);
|
|
48
54
|
}
|
|
49
55
|
return aiOperations;
|
|
50
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "task-o-matic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "AI-powered task management CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"task-management",
|
|
@@ -34,11 +34,6 @@
|
|
|
34
34
|
"types": "./dist/types/index.d.ts",
|
|
35
35
|
"require": "./dist/types/index.js",
|
|
36
36
|
"default": "./dist/types/index.js"
|
|
37
|
-
},
|
|
38
|
-
"./cli": {
|
|
39
|
-
"types": "./dist/index.d.ts",
|
|
40
|
-
"require": "./dist/index.js",
|
|
41
|
-
"default": "./dist/index.js"
|
|
42
37
|
}
|
|
43
38
|
},
|
|
44
39
|
"files": [
|