task-o-matic 0.0.18 → 0.0.19
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 +2 -3
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/ai-operations.js +7 -13
- package/dist/lib/ai-service/base-operations.d.ts +0 -2
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.js +0 -4
- package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/documentation-operations.js +10 -8
- package/dist/lib/ai-service/filesystem-tools.d.ts +33 -47
- package/dist/lib/ai-service/filesystem-tools.d.ts.map +1 -1
- package/dist/lib/ai-service/filesystem-tools.js +61 -109
- package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/prd-operations.js +8 -3
- 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 +7 -8
- package/dist/test/lib/ai-service/task-operations.test.js +0 -4
- package/dist/utils/ai-service-factory.d.ts +0 -8
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +3 -9
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ export declare class AIOperations extends BaseOperations {
|
|
|
8
8
|
private prdOps;
|
|
9
9
|
private taskOps;
|
|
10
10
|
private docOps;
|
|
11
|
-
constructor(tools?: any);
|
|
12
11
|
parsePRD(prdContent: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, workingDirectory?: string, enableFilesystemTools?: boolean): Promise<AIPRDParseResult>;
|
|
13
12
|
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<{
|
|
14
13
|
title: string;
|
|
@@ -27,8 +26,8 @@ export declare class AIOperations extends BaseOperations {
|
|
|
27
26
|
enhanceTaskWithDocumentation(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: Record<string, Array<{
|
|
28
27
|
query: string;
|
|
29
28
|
doc: string;
|
|
30
|
-
}
|
|
31
|
-
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[]
|
|
29
|
+
}>>): Promise<string>;
|
|
30
|
+
analyzeDocumentationNeeds(taskId: string, taskTitle: string, taskDescription: string, stackInfo?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, config?: Partial<AIConfig>, existingResearch?: (TaskDocumentation | undefined)[]): Promise<DocumentationDetection>;
|
|
32
31
|
generateDocumentationRecap(libraries: Array<{
|
|
33
32
|
name: string;
|
|
34
33
|
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":"ai-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/ai-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ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AAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,GACnD,OAAO,CAAC,sBAAsB,CAAC;IAa5B,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,15 +10,9 @@ 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;
|
|
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
|
-
}
|
|
13
|
+
prdOps = new prd_operations_1.PRDOperations();
|
|
14
|
+
taskOps = new task_operations_1.TaskOperations();
|
|
15
|
+
docOps = new documentation_operations_1.DocumentationOperations();
|
|
22
16
|
// PRD Operations - Delegated to PRDOperations
|
|
23
17
|
async parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
24
18
|
return this.prdOps.parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools);
|
|
@@ -46,11 +40,11 @@ class AIOperations extends base_operations_1.BaseOperations {
|
|
|
46
40
|
return this.prdOps.combinePRDs(prds, originalDescription, config, promptOverride, userMessage, streamingOptions, retryConfig);
|
|
47
41
|
}
|
|
48
42
|
// Documentation Operations - Delegated to DocumentationOperations
|
|
49
|
-
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch
|
|
50
|
-
return this.docOps.enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch
|
|
43
|
+
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
44
|
+
return this.docOps.enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch);
|
|
51
45
|
}
|
|
52
|
-
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch
|
|
53
|
-
return this.docOps.analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch
|
|
46
|
+
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch) {
|
|
47
|
+
return this.docOps.analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch);
|
|
54
48
|
}
|
|
55
49
|
async generateDocumentationRecap(libraries, documentContents, streamingOptions, retryConfig) {
|
|
56
50
|
return this.docOps.generateDocumentationRecap(libraries, documentContents, streamingOptions, retryConfig);
|
|
@@ -8,8 +8,6 @@ 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);
|
|
13
11
|
/**
|
|
14
12
|
* Merges AI configuration with proper precedence.
|
|
15
13
|
*
|
|
@@ -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;IAE9C;;;;;;;;;;;;;;;;;;;;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,10 +11,6 @@ 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
|
-
}
|
|
18
14
|
/**
|
|
19
15
|
* Merges AI configuration with proper precedence.
|
|
20
16
|
*
|
|
@@ -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":[],"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,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,6 +5,7 @@ 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");
|
|
8
9
|
const base_operations_1 = require("./base-operations");
|
|
9
10
|
class DocumentationOperations extends base_operations_1.BaseOperations {
|
|
10
11
|
async enhanceTaskWithDocumentation(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
@@ -42,14 +43,14 @@ class DocumentationOperations extends base_operations_1.BaseOperations {
|
|
|
42
43
|
const prompt = promptResult.prompt;
|
|
43
44
|
const allTools = {
|
|
44
45
|
...mcpTools,
|
|
45
|
-
...(enableFilesystemTools ?
|
|
46
|
+
...(enableFilesystemTools ? filesystem_tools_1.filesystemTools : {}),
|
|
46
47
|
};
|
|
47
48
|
const result = await (0, ai_1.streamText)({
|
|
48
49
|
model,
|
|
49
50
|
tools: allTools,
|
|
50
51
|
system: prompts_1.TASK_ENHANCEMENT_SYSTEM_PROMPT +
|
|
51
52
|
`
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
You have access to Context7 documentation tools${enableFilesystemTools ? " and filesystem tools" : ""}.
|
|
54
55
|
|
|
55
56
|
## Available Tools:
|
|
@@ -106,12 +107,12 @@ ${existingResearchContext}`,
|
|
|
106
107
|
const toolCalls = await result.toolCalls;
|
|
107
108
|
const toolResults = await result.toolResults;
|
|
108
109
|
if (toolCalls.length > 0) {
|
|
109
|
-
console.log("AI made tool calls:", toolCalls.map((tc) => ({ tool: tc
|
|
110
|
+
console.log("AI made tool calls:", toolCalls.map((tc) => ({ tool: tc?.toolName, input: tc?.input })));
|
|
110
111
|
}
|
|
111
112
|
if (toolResults.length > 0) {
|
|
112
113
|
console.log("Tool results received:", toolResults.map((tr) => ({
|
|
113
|
-
tool: tr
|
|
114
|
-
output: tr
|
|
114
|
+
tool: tr?.toolName,
|
|
115
|
+
output: tr?.output,
|
|
115
116
|
})));
|
|
116
117
|
}
|
|
117
118
|
let fullText = "";
|
|
@@ -128,6 +129,7 @@ ${existingResearchContext}`,
|
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
async analyzeDocumentationNeeds(taskId, taskTitle, taskDescription, stackInfo, streamingOptions, retryConfig, config, existingResearch, enableFilesystemTools) {
|
|
132
|
+
// @ts-expect-error tool result type discrepency i cant be bothered with (that will probably bite me later...)
|
|
131
133
|
return this.retryHandler
|
|
132
134
|
.executeWithRetry(async () => {
|
|
133
135
|
const mcpTools = await this.context7Client.getMCPTools();
|
|
@@ -161,7 +163,7 @@ ${existingResearchContext}`,
|
|
|
161
163
|
const files = [];
|
|
162
164
|
const allTools = {
|
|
163
165
|
...mcpTools,
|
|
164
|
-
...(enableFilesystemTools ?
|
|
166
|
+
...(enableFilesystemTools ? filesystem_tools_1.filesystemTools : {}),
|
|
165
167
|
};
|
|
166
168
|
const result = await (0, ai_1.streamText)({
|
|
167
169
|
model,
|
|
@@ -263,8 +265,8 @@ ${existingResearchContext}`,
|
|
|
263
265
|
libraries,
|
|
264
266
|
confidence: libraries.length > 0 ? 0.8 : 0.3,
|
|
265
267
|
toolResults: toolResults.map((tr) => ({
|
|
266
|
-
toolName: tr
|
|
267
|
-
output: tr
|
|
268
|
+
toolName: tr?.toolName,
|
|
269
|
+
output: tr?.output,
|
|
268
270
|
})),
|
|
269
271
|
files,
|
|
270
272
|
};
|
|
@@ -1,50 +1,36 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
export declare const readFileTool: import("ai").Tool<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
}, {
|
|
4
|
+
success: boolean;
|
|
5
|
+
content: string;
|
|
6
|
+
path: string;
|
|
7
|
+
size: number;
|
|
8
|
+
error?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: string;
|
|
12
|
+
content?: undefined;
|
|
13
|
+
path?: undefined;
|
|
14
|
+
size?: undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const listDirectoryTool: import("ai").Tool<{
|
|
17
|
+
dirPath: string;
|
|
18
|
+
}, {
|
|
19
|
+
success: boolean;
|
|
20
|
+
contents: {
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
19
23
|
path: string;
|
|
20
|
-
size: number;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
};
|
|
24
|
+
size: number | undefined;
|
|
25
|
+
}[];
|
|
26
|
+
directory: string;
|
|
27
|
+
error?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
success: boolean;
|
|
30
|
+
error: string;
|
|
31
|
+
contents: never[];
|
|
32
|
+
directory?: undefined;
|
|
33
|
+
}>;
|
|
48
34
|
export declare const filesystemTools: {
|
|
49
35
|
readFile: import("ai").Tool<{
|
|
50
36
|
filePath: string;
|
|
@@ -66,7 +52,7 @@ export declare const filesystemTools: {
|
|
|
66
52
|
}, {
|
|
67
53
|
success: boolean;
|
|
68
54
|
contents: {
|
|
69
|
-
name:
|
|
55
|
+
name: string;
|
|
70
56
|
type: string;
|
|
71
57
|
path: string;
|
|
72
58
|
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":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;EAwBvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;EAoC5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG3B,CAAC"}
|
|
@@ -1,118 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filesystemTools = exports.
|
|
3
|
+
exports.filesystemTools = exports.listDirectoryTool = exports.readFileTool = void 0;
|
|
4
4
|
const ai_1 = require("ai");
|
|
5
5
|
const v3_1 = require("zod/v3");
|
|
6
|
-
const path_1 = require("path");
|
|
7
6
|
const promises_1 = require("fs/promises");
|
|
8
|
-
|
|
9
|
-
exports.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
exports.readFileTool = (0, ai_1.tool)({
|
|
9
|
+
description: "Read the contents of a file",
|
|
10
|
+
inputSchema: v3_1.z.object({
|
|
11
|
+
filePath: v3_1.z.string().describe("Path to the file to read"),
|
|
12
|
+
}),
|
|
13
|
+
execute: async ({ filePath }) => {
|
|
14
|
+
try {
|
|
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
|
+
}
|
|
14
31
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
return {
|
|
46
|
-
success: true,
|
|
47
|
-
content,
|
|
48
|
-
path: resolvedPath, // Return resolved path simplifies things
|
|
49
|
-
size: stats.size,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
32
|
+
});
|
|
33
|
+
exports.listDirectoryTool = (0, ai_1.tool)({
|
|
34
|
+
description: "List contents of a directory",
|
|
35
|
+
inputSchema: v3_1.z.object({
|
|
36
|
+
dirPath: v3_1.z.string().describe("Directory path to list"),
|
|
37
|
+
}),
|
|
38
|
+
execute: async ({ dirPath }) => {
|
|
39
|
+
try {
|
|
40
|
+
const resolvedPath = (0, path_1.resolve)(dirPath);
|
|
41
|
+
const entries = await (0, promises_1.readdir)(resolvedPath, { withFileTypes: true });
|
|
42
|
+
const contents = await Promise.all(entries.map(async (entry) => {
|
|
43
|
+
const fullPath = (0, path_1.join)(resolvedPath, entry.name);
|
|
44
|
+
const stats = await (0, promises_1.stat)(fullPath);
|
|
53
45
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
name: entry.name,
|
|
47
|
+
type: entry.isDirectory() ? "directory" : "file",
|
|
48
|
+
path: (0, path_1.relative)(process.cwd(), fullPath),
|
|
49
|
+
size: entry.isFile() ? stats.size : undefined,
|
|
56
50
|
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
};
|
|
51
|
+
}));
|
|
52
|
+
return {
|
|
53
|
+
success: true,
|
|
54
|
+
contents,
|
|
55
|
+
directory: (0, path_1.relative)(process.cwd(), resolvedPath),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
success: false,
|
|
61
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
62
|
+
contents: [],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
exports.filesystemTools = {
|
|
68
|
+
readFile: exports.readFileTool,
|
|
69
|
+
listDirectory: exports.listDirectoryTool,
|
|
115
70
|
};
|
|
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":[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gB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,gBAAgB,CAAC,EAAE,MAAM,EACzB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,MAAM,EAAE,CAAC;IA6Hd,kBAAkB,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,WAAW,CAAC,EAAE;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,EACD,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA8F5B,WAAW,CACf,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;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,10 +37,15 @@ 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");
|
|
40
41
|
const base_operations_1 = require("./base-operations");
|
|
41
42
|
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
42
43
|
class PRDOperations extends base_operations_1.BaseOperations {
|
|
43
44
|
async parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
45
|
+
// console.log(
|
|
46
|
+
// `[Library Debug] parsePRD called. Config arg has key: ${!!config?.apiKey} Provider internal key: ${!!this.modelProvider.getAIConfig()
|
|
47
|
+
// ?.apiKey}`
|
|
48
|
+
// );
|
|
44
49
|
return this.retryHandler.executeWithRetry(async () => {
|
|
45
50
|
let stackInfo = "";
|
|
46
51
|
try {
|
|
@@ -86,7 +91,7 @@ class PRDOperations extends base_operations_1.BaseOperations {
|
|
|
86
91
|
...config,
|
|
87
92
|
});
|
|
88
93
|
const allTools = {
|
|
89
|
-
...
|
|
94
|
+
...filesystem_tools_1.filesystemTools,
|
|
90
95
|
};
|
|
91
96
|
const result = await (0, ai_1.streamText)({
|
|
92
97
|
model,
|
|
@@ -223,7 +228,7 @@ Use these tools to understand the project structure, existing code patterns, and
|
|
|
223
228
|
...config,
|
|
224
229
|
});
|
|
225
230
|
const allTools = {
|
|
226
|
-
...
|
|
231
|
+
...filesystem_tools_1.filesystemTools,
|
|
227
232
|
};
|
|
228
233
|
const result = await (0, ai_1.streamText)({
|
|
229
234
|
model,
|
|
@@ -312,7 +317,7 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
312
317
|
...this.modelProvider.getAIConfig(),
|
|
313
318
|
...config,
|
|
314
319
|
});
|
|
315
|
-
const allTools = { ...
|
|
320
|
+
const allTools = { ...filesystem_tools_1.filesystemTools };
|
|
316
321
|
const result = await (0, ai_1.streamText)({
|
|
317
322
|
model,
|
|
318
323
|
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>): 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;AAUrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,kBAAkB,CAA4B;IAChD,aAAa,CACjB,IAAI,EAAE,IAAI,EACV,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,EAClC,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EACzB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CACR,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CACpE;IAmHK,WAAW,CACf,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,EACf,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IA4FZ,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;CAoEnB"}
|
|
@@ -5,6 +5,7 @@ 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");
|
|
8
9
|
const base_operations_1 = require("./base-operations");
|
|
9
10
|
const ai_operation_utility_1 = require("../../utils/ai-operation-utility");
|
|
10
11
|
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
@@ -52,9 +53,9 @@ class TaskOperations extends base_operations_1.BaseOperations {
|
|
|
52
53
|
// Execute AI operation with proper error handling
|
|
53
54
|
const result = await this.aiOperationUtility.executeAIOperation("Task breakdown", async () => {
|
|
54
55
|
// Prepare tools if filesystem tools are enabled
|
|
55
|
-
const tools = enableFilesystemTools ?
|
|
56
|
+
const tools = enableFilesystemTools ? filesystem_tools_1.filesystemTools : undefined;
|
|
56
57
|
const response = await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_BREAKDOWN_SYSTEM_PROMPT +
|
|
57
|
-
(enableFilesystemTools
|
|
58
|
+
(enableFilesystemTools
|
|
58
59
|
? `
|
|
59
60
|
|
|
60
61
|
You have access to filesystem tools that allow you to:
|
|
@@ -157,7 +158,7 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
157
158
|
// Return the result directly (errors are thrown, not returned)
|
|
158
159
|
return result.result;
|
|
159
160
|
}
|
|
160
|
-
async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig
|
|
161
|
+
async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig) {
|
|
161
162
|
// Build prompt
|
|
162
163
|
let prompt;
|
|
163
164
|
if (promptOverride) {
|
|
@@ -188,18 +189,16 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
188
189
|
const mcpTools = await this.context7Client.getMCPTools();
|
|
189
190
|
const allTools = {
|
|
190
191
|
...mcpTools,
|
|
191
|
-
...
|
|
192
|
+
...filesystem_tools_1.filesystemTools,
|
|
192
193
|
};
|
|
193
194
|
return await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_PLANNING_SYSTEM_PROMPT +
|
|
194
|
-
|
|
195
|
-
? `
|
|
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
|
|
202
|
-
: ""), userMessage || prompt, config, streamingOptions, allTools);
|
|
201
|
+
Use these tools to understand the project structure, existing code, and dependencies when creating implementation plans.`, userMessage || prompt, config, streamingOptions, allTools);
|
|
203
202
|
}, {
|
|
204
203
|
streamingOptions,
|
|
205
204
|
retryConfig,
|
|
@@ -109,10 +109,6 @@ 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
|
-
};
|
|
116
112
|
// Override streamTextWithTools to capture tools parameter
|
|
117
113
|
mockAIOperationUtility.streamTextWithTools = async (_systemPrompt, _userMessage, _config, _streamingOptions, tools) => {
|
|
118
114
|
if (tools && Object.keys(tools).length > 0) {
|
|
@@ -10,14 +10,6 @@ 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
|
-
}
|
|
21
13
|
/**
|
|
22
14
|
* Initialize services with optional custom callbacks.
|
|
23
15
|
* 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,e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gB,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,7 +14,6 @@ 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");
|
|
18
17
|
let aiOperations = null;
|
|
19
18
|
let modelProvider = null;
|
|
20
19
|
let storage = null;
|
|
@@ -39,18 +38,13 @@ async function initializeServices(options = {}) {
|
|
|
39
38
|
storage = new file_system_1.FileSystemStorage(options.storageCallbacks);
|
|
40
39
|
// Initialize context builder
|
|
41
40
|
contextBuilder = new context_builder_1.ContextBuilder(storage, options.contextCallbacks);
|
|
42
|
-
//
|
|
43
|
-
|
|
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);
|
|
41
|
+
// Reset other services to ensure they use fresh dependencies if needed
|
|
42
|
+
aiOperations = null;
|
|
47
43
|
modelProvider = null;
|
|
48
44
|
}
|
|
49
45
|
function getAIOperations() {
|
|
50
46
|
if (!aiOperations) {
|
|
51
|
-
|
|
52
|
-
const tools = (0, filesystem_tools_1.createFilesystemTools)(filesystem_tools_1.nodeFileSystem);
|
|
53
|
-
aiOperations = new ai_operations_1.AIOperations(tools);
|
|
47
|
+
aiOperations = new ai_operations_1.AIOperations();
|
|
54
48
|
}
|
|
55
49
|
return aiOperations;
|
|
56
50
|
}
|