@proteinjs/conversation 1.0.7 → 1.0.9
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/.eslintrc.js +1 -1
- package/.prettierignore +4 -0
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -40
- package/dist/src/CodegenConversation.d.ts +11 -11
- package/dist/src/CodegenConversation.js +180 -294
- package/dist/src/Conversation.d.ts +49 -52
- package/dist/src/Conversation.js +288 -478
- package/dist/src/ConversationModule.d.ts +6 -6
- package/dist/src/ConversationModule.js +3 -3
- package/dist/src/Function.d.ts +4 -4
- package/dist/src/Function.js +3 -3
- package/dist/src/OpenAi.d.ts +10 -42
- package/dist/src/OpenAi.js +305 -495
- package/dist/src/Paragraph.d.ts +4 -4
- package/dist/src/Paragraph.js +17 -17
- package/dist/src/Sentence.d.ts +4 -4
- package/dist/src/Sentence.js +21 -21
- package/dist/src/code_template/Code.d.ts +15 -15
- package/dist/src/code_template/Code.js +73 -167
- package/dist/src/code_template/CodeTemplate.d.ts +11 -11
- package/dist/src/code_template/CodeTemplate.js +80 -169
- package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
- package/dist/src/code_template/CodeTemplateModule.js +26 -28
- package/dist/src/code_template/Repo.d.ts +38 -34
- package/dist/src/code_template/Repo.js +195 -291
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js +108 -110
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
- package/dist/src/fs/conversation_fs/ConversationFsModule.js +97 -204
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts +62 -58
- package/dist/src/fs/conversation_fs/FsFunctions.js +252 -414
- package/dist/src/fs/git/GitModule.d.ts +8 -8
- package/dist/src/fs/git/GitModule.js +74 -163
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +18 -16
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +58 -158
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +26 -27
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +131 -234
- package/dist/src/fs/package/PackageFunctions.d.ts +60 -54
- package/dist/src/fs/package/PackageFunctions.js +213 -366
- package/dist/src/fs/package/PackageModule.d.ts +24 -24
- package/dist/src/fs/package/PackageModule.js +170 -292
- package/dist/src/history/MessageHistory.d.ts +12 -12
- package/dist/src/history/MessageHistory.js +46 -52
- package/dist/src/history/MessageModerator.d.ts +2 -2
- package/dist/src/history/MessageModerator.js +3 -3
- package/dist/src/template/ConversationTemplate.d.ts +8 -8
- package/dist/src/template/ConversationTemplate.js +3 -3
- package/dist/src/template/ConversationTemplateFunctions.d.ts +35 -33
- package/dist/src/template/ConversationTemplateFunctions.js +75 -176
- package/dist/src/template/ConversationTemplateModule.d.ts +48 -51
- package/dist/src/template/ConversationTemplateModule.js +116 -211
- package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
- package/dist/src/template/createApp/CreateAppTemplate.js +59 -151
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js +67 -183
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +77 -174
- package/dist/src/template/createPackage/tsconfig.json +11 -11
- package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
- package/dist/test/createKeywordFilesIndex.test.js +41 -132
- package/dist/test/openai/openai.generateList.test.d.ts +1 -1
- package/dist/test/openai/openai.generateList.test.js +47 -136
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +12 -13
- package/dist/test/repo/repo.test.d.ts +1 -1
- package/dist/test/repo/repo.test.js +38 -127
- package/package.json +5 -6
- package/LICENSE +0 -21
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
2
|
import { Function } from '../../Function';
|
|
3
3
|
export declare class GitModule implements ConversationModule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
private repoPath;
|
|
5
|
+
constructor(repoPath: string);
|
|
6
|
+
getName(): string;
|
|
7
|
+
getSystemMessages(): string[];
|
|
8
|
+
getFunctions(): Function[];
|
|
9
|
+
getMessageModerators(): never[];
|
|
10
10
|
}
|
|
11
11
|
export declare class GitModuleFactory implements ConversationModuleFactory {
|
|
12
|
-
|
|
12
|
+
createModule(repoPath: string): Promise<GitModule>;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=GitModule.d.ts.map
|
|
14
|
+
//# sourceMappingURL=GitModule.d.ts.map
|
|
@@ -1,175 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
4
|
-
function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) {
|
|
6
|
-
return value instanceof P
|
|
7
|
-
? value
|
|
8
|
-
: new P(function (resolve) {
|
|
9
|
-
resolve(value);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
reject(e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function rejected(value) {
|
|
21
|
-
try {
|
|
22
|
-
step(generator['throw'](value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function step(result) {
|
|
28
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
|
-
}
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
9
|
});
|
|
32
|
-
|
|
33
|
-
var __generator =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: 0,
|
|
38
|
-
sent: function () {
|
|
39
|
-
if (t[0] & 1) throw t[1];
|
|
40
|
-
return t[1];
|
|
41
|
-
},
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: [],
|
|
44
|
-
},
|
|
45
|
-
f,
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
49
|
-
return (
|
|
50
|
-
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
|
51
|
-
typeof Symbol === 'function' &&
|
|
52
|
-
(g[Symbol.iterator] = function () {
|
|
53
|
-
return this;
|
|
54
|
-
}),
|
|
55
|
-
g
|
|
56
|
-
);
|
|
57
|
-
function verb(n) {
|
|
58
|
-
return function (v) {
|
|
59
|
-
return step([n, v]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
62
15
|
function step(op) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_.label++;
|
|
84
|
-
y = op[1];
|
|
85
|
-
op = [0];
|
|
86
|
-
continue;
|
|
87
|
-
case 7:
|
|
88
|
-
op = _.ops.pop();
|
|
89
|
-
_.trys.pop();
|
|
90
|
-
continue;
|
|
91
|
-
default:
|
|
92
|
-
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
-
_ = 0;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
97
|
-
_.label = op[1];
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
-
_.label = t[1];
|
|
102
|
-
t = op;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (t && _.label < t[2]) {
|
|
106
|
-
_.label = t[2];
|
|
107
|
-
_.ops.push(op);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
if (t[2]) _.ops.pop();
|
|
111
|
-
_.trys.pop();
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
op = body.call(thisArg, _);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
op = [6, e];
|
|
117
|
-
y = 0;
|
|
118
|
-
} finally {
|
|
119
|
-
f = t = 0;
|
|
120
|
-
}
|
|
121
|
-
if (op[0] & 5) throw op[1];
|
|
122
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
123
36
|
}
|
|
124
|
-
|
|
125
|
-
var __spreadArray =
|
|
126
|
-
|
|
127
|
-
function (to, from, pack) {
|
|
128
|
-
if (pack || arguments.length === 2)
|
|
129
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
130
40
|
if (ar || !(i in from)) {
|
|
131
|
-
|
|
132
|
-
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
133
43
|
}
|
|
134
|
-
|
|
44
|
+
}
|
|
135
45
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
136
|
-
|
|
137
|
-
Object.defineProperty(exports,
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
138
48
|
exports.GitModuleFactory = exports.GitModule = void 0;
|
|
139
|
-
var util_node_1 = require(
|
|
49
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
140
50
|
var GitModule = /** @class */ (function () {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
51
|
+
function GitModule(repoPath) {
|
|
52
|
+
this.repoPath = repoPath;
|
|
53
|
+
}
|
|
54
|
+
GitModule.prototype.getName = function () {
|
|
55
|
+
return 'Git';
|
|
56
|
+
};
|
|
57
|
+
GitModule.prototype.getSystemMessages = function () {
|
|
58
|
+
return [
|
|
59
|
+
"After we make code changes (write to files), ask the user if they'd like to commit and sync those changes",
|
|
60
|
+
"If they want to commit, offer them 3 generated messages that summarize the changes to choose from, as well as the option to write a custom message",
|
|
61
|
+
"The generated messages should be 1-3 sentences in length, and each generated option should be a different length of summary",
|
|
62
|
+
];
|
|
63
|
+
};
|
|
64
|
+
GitModule.prototype.getFunctions = function () {
|
|
65
|
+
return __spreadArray([], util_node_1.gitFunctions, true);
|
|
66
|
+
};
|
|
67
|
+
GitModule.prototype.getMessageModerators = function () {
|
|
68
|
+
return [];
|
|
69
|
+
};
|
|
70
|
+
return GitModule;
|
|
71
|
+
}());
|
|
162
72
|
exports.GitModule = GitModule;
|
|
163
73
|
var GitModuleFactory = /** @class */ (function () {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
74
|
+
function GitModuleFactory() {
|
|
75
|
+
}
|
|
76
|
+
GitModuleFactory.prototype.createModule = function (repoPath) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
return [2 /*return*/, new GitModule(repoPath)];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return GitModuleFactory;
|
|
84
|
+
}());
|
|
174
85
|
exports.GitModuleFactory = GitModuleFactory;
|
|
175
|
-
//# sourceMappingURL=GitModule.js.map
|
|
86
|
+
//# sourceMappingURL=GitModule.js.map
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { KeywordToFilesIndexModule } from './KeywordToFilesIndexModule';
|
|
2
|
-
export declare const searchFilesFunctionName =
|
|
2
|
+
export declare const searchFilesFunctionName = "searchFiles";
|
|
3
3
|
export declare const searchFilesFunction: (module: KeywordToFilesIndexModule) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
definition: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
parameters: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
keyword: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
13
16
|
};
|
|
14
|
-
};
|
|
15
|
-
required: string[];
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
call: (params: {
|
|
19
|
+
keyword: string;
|
|
20
|
+
}) => Promise<string[]>;
|
|
21
|
+
instructions: string[];
|
|
20
22
|
};
|
|
21
|
-
//# sourceMappingURL=KeywordToFilesIndexFunctions.d.ts.map
|
|
23
|
+
//# sourceMappingURL=KeywordToFilesIndexFunctions.d.ts.map
|
|
@@ -1,168 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
4
|
-
function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) {
|
|
6
|
-
return value instanceof P
|
|
7
|
-
? value
|
|
8
|
-
: new P(function (resolve) {
|
|
9
|
-
resolve(value);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
reject(e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function rejected(value) {
|
|
21
|
-
try {
|
|
22
|
-
step(generator['throw'](value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function step(result) {
|
|
28
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
|
-
}
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
9
|
});
|
|
32
|
-
|
|
33
|
-
var __generator =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: 0,
|
|
38
|
-
sent: function () {
|
|
39
|
-
if (t[0] & 1) throw t[1];
|
|
40
|
-
return t[1];
|
|
41
|
-
},
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: [],
|
|
44
|
-
},
|
|
45
|
-
f,
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
49
|
-
return (
|
|
50
|
-
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
|
51
|
-
typeof Symbol === 'function' &&
|
|
52
|
-
(g[Symbol.iterator] = function () {
|
|
53
|
-
return this;
|
|
54
|
-
}),
|
|
55
|
-
g
|
|
56
|
-
);
|
|
57
|
-
function verb(n) {
|
|
58
|
-
return function (v) {
|
|
59
|
-
return step([n, v]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
62
15
|
function step(op) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_.label++;
|
|
84
|
-
y = op[1];
|
|
85
|
-
op = [0];
|
|
86
|
-
continue;
|
|
87
|
-
case 7:
|
|
88
|
-
op = _.ops.pop();
|
|
89
|
-
_.trys.pop();
|
|
90
|
-
continue;
|
|
91
|
-
default:
|
|
92
|
-
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
-
_ = 0;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
97
|
-
_.label = op[1];
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
-
_.label = t[1];
|
|
102
|
-
t = op;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (t && _.label < t[2]) {
|
|
106
|
-
_.label = t[2];
|
|
107
|
-
_.ops.push(op);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
if (t[2]) _.ops.pop();
|
|
111
|
-
_.trys.pop();
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
op = body.call(thisArg, _);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
op = [6, e];
|
|
117
|
-
y = 0;
|
|
118
|
-
} finally {
|
|
119
|
-
f = t = 0;
|
|
120
|
-
}
|
|
121
|
-
if (op[0] & 5) throw op[1];
|
|
122
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
123
36
|
}
|
|
124
|
-
|
|
125
|
-
Object.defineProperty(exports,
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
126
39
|
exports.searchFilesFunction = exports.searchFilesFunctionName = void 0;
|
|
127
40
|
exports.searchFilesFunctionName = 'searchFiles';
|
|
128
41
|
var searchFilesFunction = function (module) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
42
|
+
return {
|
|
43
|
+
definition: {
|
|
44
|
+
name: exports.searchFilesFunctionName,
|
|
45
|
+
description: 'Get file paths to files that contain keyword',
|
|
46
|
+
parameters: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
keyword: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Search files for this keyword',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['keyword'],
|
|
55
|
+
},
|
|
140
56
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
instructions: [
|
|
152
|
-
'If the user is trying to interact with a file, but does not provide a path, you can find file paths that match a keyword using the '.concat(
|
|
153
|
-
exports.searchFilesFunctionName,
|
|
154
|
-
' function'
|
|
155
|
-
),
|
|
156
|
-
"Only call functions that take in filePaths with valid file paths, if you don't know the valid file path try and search for it by keyword with the ".concat(
|
|
157
|
-
exports.searchFilesFunctionName,
|
|
158
|
-
' function'
|
|
159
|
-
),
|
|
160
|
-
'If the user references a file in a package without providing a path, use the '.concat(
|
|
161
|
-
exports.searchFilesFunctionName,
|
|
162
|
-
' function on the keyword to find potentially relevant files, and choose the one that references the package name in its path'
|
|
163
|
-
),
|
|
164
|
-
],
|
|
165
|
-
};
|
|
57
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
58
|
+
return [2 /*return*/, module.searchFiles(params)];
|
|
59
|
+
}); }); },
|
|
60
|
+
instructions: [
|
|
61
|
+
"If the user is trying to interact with a file, but does not provide a path, you can find file paths that match a keyword using the ".concat(exports.searchFilesFunctionName, " function"),
|
|
62
|
+
"Only call functions that take in filePaths with valid file paths, if you don't know the valid file path try and search for it by keyword with the ".concat(exports.searchFilesFunctionName, " function"),
|
|
63
|
+
"If the user references a file in a package without providing a path, use the ".concat(exports.searchFilesFunctionName, " function on the keyword to find potentially relevant files, and choose the one that references the package name in its path"),
|
|
64
|
+
],
|
|
65
|
+
};
|
|
166
66
|
};
|
|
167
67
|
exports.searchFilesFunction = searchFilesFunction;
|
|
168
68
|
// {
|
|
@@ -192,4 +92,4 @@ exports.searchFilesFunction = searchFilesFunction;
|
|
|
192
92
|
// `Favor calling getDeclarations over readFiles if full file content is not needed`,
|
|
193
93
|
// ],
|
|
194
94
|
// },
|
|
195
|
-
//# sourceMappingURL=KeywordToFilesIndexFunctions.js.map
|
|
95
|
+
//# sourceMappingURL=KeywordToFilesIndexFunctions.js.map
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
2
|
import { Function } from '../../Function';
|
|
3
3
|
export type KeywordToFilesIndexModuleParams = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
dir: string;
|
|
5
|
+
keywordFilesIndex: {
|
|
6
|
+
[keyword: string]: string[]; /** file paths */
|
|
7
|
+
};
|
|
8
8
|
};
|
|
9
9
|
export declare class KeywordToFilesIndexModule implements ConversationModule {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
private logger;
|
|
11
|
+
params: KeywordToFilesIndexModuleParams;
|
|
12
|
+
constructor(params: KeywordToFilesIndexModuleParams);
|
|
13
|
+
getName(): string;
|
|
14
|
+
searchFiles(params: {
|
|
15
|
+
keyword: string;
|
|
16
|
+
}): string[];
|
|
17
|
+
getSystemMessages(): string[];
|
|
18
|
+
getFunctions(): Function[];
|
|
19
|
+
getMessageModerators(): never[];
|
|
18
20
|
}
|
|
19
21
|
export declare class KeywordToFilesIndexModuleFactory implements ConversationModuleFactory {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
): Promise<{
|
|
32
|
-
[keyword: string]: string[];
|
|
33
|
-
}>;
|
|
22
|
+
private logger;
|
|
23
|
+
createModule(repoPath: string): Promise<KeywordToFilesIndexModule>;
|
|
24
|
+
/**
|
|
25
|
+
* Create keyword-files index for the given base directory.
|
|
26
|
+
*
|
|
27
|
+
* @param baseDir - The directory to start the file search from.
|
|
28
|
+
* @returns An index with keywords mapped to file paths.
|
|
29
|
+
*/
|
|
30
|
+
createKeywordFilesIndex(baseDir: string, globIgnorePatterns?: string[]): Promise<{
|
|
31
|
+
[keyword: string]: string[];
|
|
32
|
+
}>;
|
|
34
33
|
}
|
|
35
|
-
//# sourceMappingURL=KeywordToFilesIndexModule.d.ts.map
|
|
34
|
+
//# sourceMappingURL=KeywordToFilesIndexModule.d.ts.map
|