@proteinjs/conversation 1.0.5 → 1.0.7

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.
Files changed (152) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.prettierrc +8 -0
  3. package/CHANGELOG.md +7 -4
  4. package/LICENSE +21 -0
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +40 -28
  7. package/dist/src/CodegenConversation.d.ts +11 -11
  8. package/dist/src/CodegenConversation.d.ts.map +1 -1
  9. package/dist/src/CodegenConversation.js +294 -180
  10. package/dist/src/CodegenConversation.js.map +1 -1
  11. package/dist/src/Conversation.d.ts +52 -49
  12. package/dist/src/Conversation.d.ts.map +1 -1
  13. package/dist/src/Conversation.js +480 -274
  14. package/dist/src/Conversation.js.map +1 -1
  15. package/dist/src/ConversationModule.d.ts +6 -6
  16. package/dist/src/ConversationModule.js +3 -3
  17. package/dist/src/Function.d.ts +4 -4
  18. package/dist/src/Function.d.ts.map +1 -1
  19. package/dist/src/Function.js +3 -3
  20. package/dist/src/OpenAi.d.ts +42 -10
  21. package/dist/src/OpenAi.d.ts.map +1 -1
  22. package/dist/src/OpenAi.js +496 -289
  23. package/dist/src/OpenAi.js.map +1 -1
  24. package/dist/src/Paragraph.d.ts +4 -4
  25. package/dist/src/Paragraph.d.ts.map +1 -1
  26. package/dist/src/Paragraph.js +17 -16
  27. package/dist/src/Paragraph.js.map +1 -1
  28. package/dist/src/Sentence.d.ts +4 -4
  29. package/dist/src/Sentence.d.ts.map +1 -1
  30. package/dist/src/Sentence.js +21 -19
  31. package/dist/src/Sentence.js.map +1 -1
  32. package/dist/src/code_template/Code.d.ts +15 -15
  33. package/dist/src/code_template/Code.d.ts.map +1 -1
  34. package/dist/src/code_template/Code.js +167 -69
  35. package/dist/src/code_template/Code.js.map +1 -1
  36. package/dist/src/code_template/CodeTemplate.d.ts +11 -11
  37. package/dist/src/code_template/CodeTemplate.d.ts.map +1 -1
  38. package/dist/src/code_template/CodeTemplate.js +169 -79
  39. package/dist/src/code_template/CodeTemplate.js.map +1 -1
  40. package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
  41. package/dist/src/code_template/CodeTemplateModule.js +28 -26
  42. package/dist/src/code_template/Repo.d.ts +34 -38
  43. package/dist/src/code_template/Repo.d.ts.map +1 -1
  44. package/dist/src/code_template/Repo.js +291 -191
  45. package/dist/src/code_template/Repo.js.map +1 -1
  46. package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
  47. package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts.map +1 -1
  48. package/dist/src/fs/conversation_fs/ConversationFsModerator.js +111 -98
  49. package/dist/src/fs/conversation_fs/ConversationFsModerator.js.map +1 -1
  50. package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
  51. package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts.map +1 -1
  52. package/dist/src/fs/conversation_fs/ConversationFsModule.js +204 -99
  53. package/dist/src/fs/conversation_fs/ConversationFsModule.js.map +1 -1
  54. package/dist/src/fs/conversation_fs/FsFunctions.d.ts +58 -62
  55. package/dist/src/fs/conversation_fs/FsFunctions.d.ts.map +1 -1
  56. package/dist/src/fs/conversation_fs/FsFunctions.js +414 -266
  57. package/dist/src/fs/conversation_fs/FsFunctions.js.map +1 -1
  58. package/dist/src/fs/git/GitModule.d.ts +8 -8
  59. package/dist/src/fs/git/GitModule.d.ts.map +1 -1
  60. package/dist/src/fs/git/GitModule.js +163 -74
  61. package/dist/src/fs/git/GitModule.js.map +1 -1
  62. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +16 -18
  63. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts.map +1 -1
  64. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +158 -58
  65. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js.map +1 -1
  66. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +27 -26
  67. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts.map +1 -1
  68. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +234 -133
  69. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js.map +1 -1
  70. package/dist/src/fs/package/PackageFunctions.d.ts +54 -60
  71. package/dist/src/fs/package/PackageFunctions.d.ts.map +1 -1
  72. package/dist/src/fs/package/PackageFunctions.js +366 -223
  73. package/dist/src/fs/package/PackageFunctions.js.map +1 -1
  74. package/dist/src/fs/package/PackageModule.d.ts +24 -24
  75. package/dist/src/fs/package/PackageModule.d.ts.map +1 -1
  76. package/dist/src/fs/package/PackageModule.js +292 -163
  77. package/dist/src/fs/package/PackageModule.js.map +1 -1
  78. package/dist/src/history/MessageHistory.d.ts +12 -12
  79. package/dist/src/history/MessageHistory.d.ts.map +1 -1
  80. package/dist/src/history/MessageHistory.js +52 -43
  81. package/dist/src/history/MessageHistory.js.map +1 -1
  82. package/dist/src/history/MessageModerator.d.ts +2 -2
  83. package/dist/src/history/MessageModerator.js +3 -3
  84. package/dist/src/template/ConversationTemplate.d.ts +8 -8
  85. package/dist/src/template/ConversationTemplate.d.ts.map +1 -1
  86. package/dist/src/template/ConversationTemplate.js +3 -3
  87. package/dist/src/template/ConversationTemplateFunctions.d.ts +33 -35
  88. package/dist/src/template/ConversationTemplateFunctions.d.ts.map +1 -1
  89. package/dist/src/template/ConversationTemplateFunctions.js +176 -75
  90. package/dist/src/template/ConversationTemplateFunctions.js.map +1 -1
  91. package/dist/src/template/ConversationTemplateModule.d.ts +51 -48
  92. package/dist/src/template/ConversationTemplateModule.d.ts.map +1 -1
  93. package/dist/src/template/ConversationTemplateModule.js +211 -114
  94. package/dist/src/template/ConversationTemplateModule.js.map +1 -1
  95. package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
  96. package/dist/src/template/createApp/CreateAppTemplate.js +151 -59
  97. package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
  98. package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts.map +1 -1
  99. package/dist/src/template/createCode/CreateCodeConversationTemplate.js +183 -74
  100. package/dist/src/template/createCode/CreateCodeConversationTemplate.js.map +1 -1
  101. package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
  102. package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts.map +1 -1
  103. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +174 -84
  104. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js.map +1 -1
  105. package/dist/src/template/createPackage/tsconfig.json +11 -11
  106. package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
  107. package/dist/test/createKeywordFilesIndex.test.js +132 -41
  108. package/dist/test/createKeywordFilesIndex.test.js.map +1 -1
  109. package/dist/test/openai/openai.generateList.test.d.ts +1 -1
  110. package/dist/test/openai/openai.generateList.test.js +136 -47
  111. package/dist/test/openai/openai.generateList.test.js.map +1 -1
  112. package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
  113. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +15 -10
  114. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js.map +1 -1
  115. package/dist/test/repo/repo.test.d.ts +1 -1
  116. package/dist/test/repo/repo.test.js +127 -38
  117. package/dist/test/repo/repo.test.js.map +1 -1
  118. package/jest.config.js +2 -2
  119. package/package.json +11 -5
  120. package/src/CodegenConversation.ts +6 -4
  121. package/src/Conversation.ts +102 -33
  122. package/src/ConversationModule.ts +2 -2
  123. package/src/Function.ts +0 -1
  124. package/src/OpenAi.ts +128 -63
  125. package/src/Paragraph.ts +3 -2
  126. package/src/Sentence.ts +5 -3
  127. package/src/code_template/Code.ts +25 -19
  128. package/src/code_template/CodeTemplate.ts +8 -7
  129. package/src/code_template/CodeTemplateModule.ts +2 -2
  130. package/src/code_template/Repo.ts +25 -19
  131. package/src/fs/conversation_fs/ConversationFsModerator.ts +34 -20
  132. package/src/fs/conversation_fs/ConversationFsModule.ts +13 -7
  133. package/src/fs/conversation_fs/FsFunctions.ts +33 -44
  134. package/src/fs/git/GitModule.ts +2 -4
  135. package/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts +31 -31
  136. package/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts +19 -18
  137. package/src/fs/package/PackageFunctions.ts +34 -41
  138. package/src/fs/package/PackageModule.ts +33 -21
  139. package/src/history/MessageHistory.ts +7 -4
  140. package/src/history/MessageModerator.ts +1 -1
  141. package/src/template/ConversationTemplate.ts +9 -9
  142. package/src/template/ConversationTemplateFunctions.ts +8 -7
  143. package/src/template/ConversationTemplateModule.ts +24 -15
  144. package/src/template/createApp/CreateAppTemplate.ts +1 -1
  145. package/src/template/createCode/CreateCodeConversationTemplate.ts +9 -11
  146. package/src/template/createPackage/CreatePackageConversationTemplate.ts +2 -9
  147. package/src/template/createPackage/jest.config.js +2 -2
  148. package/test/createKeywordFilesIndex.test.ts +3 -3
  149. package/test/openai/openai.generateList.test.ts +5 -3
  150. package/test/openai/openai.parseCodeFromMarkdown.test.ts +10 -5
  151. package/test/repo/repo.test.ts +3 -4
  152. package/tsconfig.json +16 -20
@@ -1,191 +1,305 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
1
+ 'use strict';
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ var __setModuleDefault =
23
+ (this && this.__setModuleDefault) ||
24
+ (Object.create
25
+ ? function (o, v) {
26
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
+ }
28
+ : function (o, v) {
29
+ o['default'] = v;
30
+ });
31
+ var __importStar =
32
+ (this && this.__importStar) ||
33
+ function (mod) {
19
34
  if (mod && mod.__esModule) return mod;
20
35
  var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ if (mod != null)
37
+ for (var k in mod)
38
+ if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
39
  __setModuleDefault(result, mod);
23
40
  return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ };
42
+ var __awaiter =
43
+ (this && this.__awaiter) ||
44
+ function (thisArg, _arguments, P, generator) {
45
+ function adopt(value) {
46
+ return value instanceof P
47
+ ? value
48
+ : new P(function (resolve) {
49
+ resolve(value);
50
+ });
51
+ }
27
52
  return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
53
+ function fulfilled(value) {
54
+ try {
55
+ step(generator.next(value));
56
+ } catch (e) {
57
+ reject(e);
58
+ }
59
+ }
60
+ function rejected(value) {
61
+ try {
62
+ step(generator['throw'](value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ }
67
+ function step(result) {
68
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
69
+ }
70
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
71
  });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
72
+ };
73
+ var __generator =
74
+ (this && this.__generator) ||
75
+ function (thisArg, body) {
76
+ var _ = {
77
+ label: 0,
78
+ sent: function () {
79
+ if (t[0] & 1) throw t[1];
80
+ return t[1];
81
+ },
82
+ trys: [],
83
+ ops: [],
84
+ },
85
+ f,
86
+ y,
87
+ t,
88
+ g;
89
+ return (
90
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
91
+ typeof Symbol === 'function' &&
92
+ (g[Symbol.iterator] = function () {
93
+ return this;
94
+ }),
95
+ g
96
+ );
97
+ function verb(n) {
98
+ return function (v) {
99
+ return step([n, v]);
100
+ };
101
+ }
38
102
  function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- 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;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
103
+ if (f) throw new TypeError('Generator is already executing.');
104
+ while ((g && ((g = 0), op[0] && (_ = 0)), _))
105
+ try {
106
+ if (
107
+ ((f = 1),
108
+ y &&
109
+ (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) &&
110
+ !(t = t.call(y, op[1])).done)
111
+ )
112
+ return t;
113
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
114
+ switch (op[0]) {
115
+ case 0:
116
+ case 1:
117
+ t = op;
118
+ break;
119
+ case 4:
120
+ _.label++;
121
+ return { value: op[1], done: false };
122
+ case 5:
123
+ _.label++;
124
+ y = op[1];
125
+ op = [0];
126
+ continue;
127
+ case 7:
128
+ op = _.ops.pop();
129
+ _.trys.pop();
130
+ continue;
131
+ default:
132
+ if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
133
+ _ = 0;
134
+ continue;
135
+ }
136
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
137
+ _.label = op[1];
138
+ break;
139
+ }
140
+ if (op[0] === 6 && _.label < t[1]) {
141
+ _.label = t[1];
142
+ t = op;
143
+ break;
144
+ }
145
+ if (t && _.label < t[2]) {
146
+ _.label = t[2];
147
+ _.ops.push(op);
148
+ break;
149
+ }
150
+ if (t[2]) _.ops.pop();
151
+ _.trys.pop();
152
+ continue;
153
+ }
154
+ op = body.call(thisArg, _);
155
+ } catch (e) {
156
+ op = [6, e];
157
+ y = 0;
158
+ } finally {
159
+ f = t = 0;
160
+ }
161
+ if (op[0] & 5) throw op[1];
162
+ return { value: op[0] ? op[1] : void 0, done: true };
59
163
  }
60
- };
61
- Object.defineProperty(exports, "__esModule", { value: true });
164
+ };
165
+ Object.defineProperty(exports, '__esModule', { value: true });
62
166
  exports.CodegenConversation = void 0;
63
- var readline = __importStar(require("readline-sync"));
64
- var Conversation_1 = require("./Conversation");
65
- var KeywordToFilesIndexModule_1 = require("./fs/keyword_to_files_index/KeywordToFilesIndexModule");
66
- var ConversationTemplateModule_1 = require("./template/ConversationTemplateModule");
67
- var ConversationFsModule_1 = require("./fs/conversation_fs/ConversationFsModule");
68
- var PackageModule_1 = require("./fs/package/PackageModule");
69
- var util_1 = require("@proteinjs/util");
70
- var GitModule_1 = require("./fs/git/GitModule");
167
+ var readline = __importStar(require('readline-sync'));
168
+ var Conversation_1 = require('./Conversation');
169
+ var KeywordToFilesIndexModule_1 = require('./fs/keyword_to_files_index/KeywordToFilesIndexModule');
170
+ var ConversationTemplateModule_1 = require('./template/ConversationTemplateModule');
171
+ var ConversationFsModule_1 = require('./fs/conversation_fs/ConversationFsModule');
172
+ var PackageModule_1 = require('./fs/package/PackageModule');
173
+ var util_1 = require('@proteinjs/util');
174
+ var GitModule_1 = require('./fs/git/GitModule');
71
175
  var CodegenConversation = /** @class */ (function () {
72
- function CodegenConversation(repoPath) {
73
- this.repoPath = repoPath;
74
- }
75
- CodegenConversation.prototype.start = function () {
76
- return __awaiter(this, void 0, void 0, function () {
77
- var conversation, initialUserInput, response, userInput;
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0: return [4 /*yield*/, this.createConversation()];
81
- case 1:
82
- conversation = _a.sent();
83
- conversation.addAssistantMessagesToHistory([CodegenConversation.INITIAL_QUESTION]);
84
- initialUserInput = this.respondToUser(CodegenConversation.INITIAL_QUESTION);
85
- return [4 /*yield*/, conversation.generateResponse([initialUserInput], CodegenConversation.MODEL)];
86
- case 2:
87
- response = _a.sent();
88
- _a.label = 3;
89
- case 3:
90
- if (!true) return [3 /*break*/, 5];
91
- userInput = this.respondToUser(response);
92
- return [4 /*yield*/, conversation.generateResponse([userInput], CodegenConversation.MODEL)];
93
- case 4:
94
- response = _a.sent();
95
- return [3 /*break*/, 3];
96
- case 5: return [2 /*return*/];
97
- }
98
- });
99
- });
100
- };
101
- CodegenConversation.prototype.createConversation = function () {
102
- return __awaiter(this, void 0, void 0, function () {
103
- var conversation, _a;
104
- var _b;
105
- return __generator(this, function (_c) {
106
- switch (_c.label) {
107
- case 0:
108
- _a = Conversation_1.Conversation.bind;
109
- _b = {
110
- name: this.constructor.name
111
- };
112
- return [4 /*yield*/, this.getModules()];
113
- case 1:
114
- conversation = new (_a.apply(Conversation_1.Conversation, [void 0, (_b.modules = _c.sent(),
115
- _b.logLevel = 'info',
116
- _b)]))();
117
- conversation.addSystemMessagesToHistory(this.getSystemMessages());
118
- return [2 /*return*/, conversation];
119
- }
120
- });
121
- });
122
- };
123
- CodegenConversation.prototype.getModules = function () {
124
- return __awaiter(this, void 0, void 0, function () {
125
- var moduleFactories, modules, _i, moduleFactories_1, moduleFactory, _a, _b;
126
- return __generator(this, function (_c) {
127
- switch (_c.label) {
128
- case 0:
129
- moduleFactories = [
130
- new ConversationFsModule_1.ConversationFsModuleFactory(),
131
- new KeywordToFilesIndexModule_1.KeywordToFilesIndexModuleFactory(),
132
- new PackageModule_1.PackageModuleFactory(),
133
- new ConversationTemplateModule_1.ConversationTemplateModuleFactory(),
134
- new GitModule_1.GitModuleFactory(),
135
- ];
136
- modules = [];
137
- _i = 0, moduleFactories_1 = moduleFactories;
138
- _c.label = 1;
139
- case 1:
140
- if (!(_i < moduleFactories_1.length)) return [3 /*break*/, 4];
141
- moduleFactory = moduleFactories_1[_i];
142
- _b = (_a = modules).push;
143
- return [4 /*yield*/, moduleFactory.createModule(this.repoPath)];
144
- case 2:
145
- _b.apply(_a, [_c.sent()]);
146
- _c.label = 3;
147
- case 3:
148
- _i++;
149
- return [3 /*break*/, 1];
150
- case 4: return [2 /*return*/, modules];
151
- }
152
- });
153
- });
154
- };
155
- CodegenConversation.prototype.getSystemMessages = function () {
156
- return [
157
- "We are going to have a conversation with the user to generate code",
158
- "Await all function calls that return a promise",
159
- "Try to repspond to the user with as few words as possible while still having a conversational tone",
160
- "When generating code, export the objects you create inline; do not use 'export default' syntax",
161
- // `After finding a file to work with, assume the user's following question pertains to that file and use ${readFilesFunctionName} to read the file if needed`,
162
- // `If a conversation summary exists, if you aren't already working with a file, use the most relevant keyword mentioned in the conversation summary to find a file to read (using the ${searchFilesFunctionName} function) and then respond to the user after reading the file`,
163
- // `Use the most relevant keyword mentioned in the conversation summary to find a file to read (using the ${searchFilesFunctionName} function) and then respond to the user after reading the file`,
164
- // `If the conversation summary indicates the user was working with a file get the file path (use the ${searchFilesFunctionName} function if needed) and read the file with the ${readFilesFunctionName} function. Use that file as context to respond to the user.`,
165
- //
166
- // `Use the conversation summary to identify a file as context for the user interaction`,
167
- // `Use the ${searchFilesFunctionName} function to find the file if needed; read the file if needed`,
168
- // `If the user is referring to a function, object, class, or type and you don't have the relevant file content, first inspect the conversation summary in the chat history (if it exists) to find a file name, and call the ${searchFilesFunctionName} function and read the file before responding to the user`,
169
- // `Before calling ${searchFilesFunctionName}, ${searchLibrariesFunctionName} or ${searchPackagesFunctionName}, use the conversation summary in the chat history to identify a file or keyword to search for instead; after reading that file, respond to the user's request`,
170
- //
171
- // `Use the ${getRecentlyAccessedFilePathsFunctionName} function find a file that might pertain to the user's request before searching files, libraries or packages; read that file then respond to the user`,
172
- // `When trying to locate code, use the ${getRecentlyAccessedFilePathsFunctionName} function to search recently accessed files first, then proceed to calling other functions: ${searchLibrariesFunctionName}, ${searchPackagesFunctionName}, ${searchFilesFunctionName}`,
173
- // `The conversation summary indicates files recently worked in as well`,
174
- // `If that doesn't yield results, proceed to calling the ${searchLibrariesFunctionName} function, then fall back to functions: ${searchPackagesFunctionName}, ${searchFilesFunctionName}`,
175
- //
176
- // `To find code, a file, or a library, call ${getRecentlyAccessedFilePathsFunctionName} and read the most recent file, after trying that call ${searchLibrariesFunctionName} then ${searchFilesFunctionName} to find a relevant file`,
177
- // `The file mentioned in the conversation summary should be read if we're not already working in a file`,
178
- // `If there is a conversation summary assistant message, use that to pick a file to read before responding to the user if not already working with a specific file`,
179
- // `Check for a previous conversation summary assistant message in the chat history; if there is one and it mentions a file the user was working with, call ${searchLibrariesFunctionName} to find the file path then call ${readFilesFunctionName} to read the file. Do this to build context before responding to the user`,
180
- ];
181
- };
182
- CodegenConversation.prototype.respondToUser = function (message) {
183
- return readline.question("".concat(util_1.textColorMap.cyan, "[").concat(CodegenConversation.BOT_NAME, "] ").concat(message).concat(util_1.Reset, "\n"));
184
- };
185
- CodegenConversation.INITIAL_QUESTION = 'What would you like to create?';
186
- CodegenConversation.BOT_NAME = 'Alina';
187
- CodegenConversation.MODEL = 'gpt-4'; //'gpt-3.5-turbo-16k';
188
- return CodegenConversation;
189
- }());
176
+ function CodegenConversation(repoPath) {
177
+ this.repoPath = repoPath;
178
+ }
179
+ CodegenConversation.prototype.start = function () {
180
+ return __awaiter(this, void 0, void 0, function () {
181
+ var conversation, initialUserInput, response, userInput;
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0:
185
+ return [4 /*yield*/, this.createConversation()];
186
+ case 1:
187
+ conversation = _a.sent();
188
+ conversation.addAssistantMessagesToHistory([CodegenConversation.INITIAL_QUESTION]);
189
+ initialUserInput = this.respondToUser(CodegenConversation.INITIAL_QUESTION);
190
+ return [4 /*yield*/, conversation.generateResponse([initialUserInput], CodegenConversation.MODEL)];
191
+ case 2:
192
+ response = _a.sent();
193
+ _a.label = 3;
194
+ case 3:
195
+ if (!true) return [3 /*break*/, 5];
196
+ userInput = this.respondToUser(response);
197
+ return [4 /*yield*/, conversation.generateResponse([userInput], CodegenConversation.MODEL)];
198
+ case 4:
199
+ response = _a.sent();
200
+ return [3 /*break*/, 3];
201
+ case 5:
202
+ return [2 /*return*/];
203
+ }
204
+ });
205
+ });
206
+ };
207
+ CodegenConversation.prototype.createConversation = function () {
208
+ return __awaiter(this, void 0, void 0, function () {
209
+ var conversation, _a;
210
+ var _b;
211
+ return __generator(this, function (_c) {
212
+ switch (_c.label) {
213
+ case 0:
214
+ _a = Conversation_1.Conversation.bind;
215
+ _b = {
216
+ name: this.constructor.name,
217
+ };
218
+ return [4 /*yield*/, this.getModules()];
219
+ case 1:
220
+ conversation = new (_a.apply(Conversation_1.Conversation, [
221
+ void 0,
222
+ ((_b.modules = _c.sent()), (_b.logLevel = 'info'), _b),
223
+ ]))();
224
+ conversation.addSystemMessagesToHistory(this.getSystemMessages());
225
+ return [2 /*return*/, conversation];
226
+ }
227
+ });
228
+ });
229
+ };
230
+ CodegenConversation.prototype.getModules = function () {
231
+ return __awaiter(this, void 0, void 0, function () {
232
+ var moduleFactories, modules, _i, moduleFactories_1, moduleFactory, _a, _b;
233
+ return __generator(this, function (_c) {
234
+ switch (_c.label) {
235
+ case 0:
236
+ moduleFactories = [
237
+ new ConversationFsModule_1.ConversationFsModuleFactory(),
238
+ new KeywordToFilesIndexModule_1.KeywordToFilesIndexModuleFactory(),
239
+ new PackageModule_1.PackageModuleFactory(),
240
+ new ConversationTemplateModule_1.ConversationTemplateModuleFactory(),
241
+ new GitModule_1.GitModuleFactory(),
242
+ ];
243
+ modules = [];
244
+ (_i = 0), (moduleFactories_1 = moduleFactories);
245
+ _c.label = 1;
246
+ case 1:
247
+ if (!(_i < moduleFactories_1.length)) return [3 /*break*/, 4];
248
+ moduleFactory = moduleFactories_1[_i];
249
+ _b = (_a = modules).push;
250
+ return [4 /*yield*/, moduleFactory.createModule(this.repoPath)];
251
+ case 2:
252
+ _b.apply(_a, [_c.sent()]);
253
+ _c.label = 3;
254
+ case 3:
255
+ _i++;
256
+ return [3 /*break*/, 1];
257
+ case 4:
258
+ return [2 /*return*/, modules];
259
+ }
260
+ });
261
+ });
262
+ };
263
+ CodegenConversation.prototype.getSystemMessages = function () {
264
+ return [
265
+ 'We are going to have a conversation with the user to generate code',
266
+ 'Await all function calls that return a promise',
267
+ 'Try to repspond to the user with as few words as possible while still having a conversational tone',
268
+ "When generating code, export the objects you create inline; do not use 'export default' syntax",
269
+ // `After finding a file to work with, assume the user's following question pertains to that file and use ${readFilesFunctionName} to read the file if needed`,
270
+ // `If a conversation summary exists, if you aren't already working with a file, use the most relevant keyword mentioned in the conversation summary to find a file to read (using the ${searchFilesFunctionName} function) and then respond to the user after reading the file`,
271
+ // `Use the most relevant keyword mentioned in the conversation summary to find a file to read (using the ${searchFilesFunctionName} function) and then respond to the user after reading the file`,
272
+ // `If the conversation summary indicates the user was working with a file get the file path (use the ${searchFilesFunctionName} function if needed) and read the file with the ${readFilesFunctionName} function. Use that file as context to respond to the user.`,
273
+ //
274
+ // `Use the conversation summary to identify a file as context for the user interaction`,
275
+ // `Use the ${searchFilesFunctionName} function to find the file if needed; read the file if needed`,
276
+ // `If the user is referring to a function, object, class, or type and you don't have the relevant file content, first inspect the conversation summary in the chat history (if it exists) to find a file name, and call the ${searchFilesFunctionName} function and read the file before responding to the user`,
277
+ // `Before calling ${searchFilesFunctionName}, ${searchLibrariesFunctionName} or ${searchPackagesFunctionName}, use the conversation summary in the chat history to identify a file or keyword to search for instead; after reading that file, respond to the user's request`,
278
+ //
279
+ // `Use the ${getRecentlyAccessedFilePathsFunctionName} function find a file that might pertain to the user's request before searching files, libraries or packages; read that file then respond to the user`,
280
+ // `When trying to locate code, use the ${getRecentlyAccessedFilePathsFunctionName} function to search recently accessed files first, then proceed to calling other functions: ${searchLibrariesFunctionName}, ${searchPackagesFunctionName}, ${searchFilesFunctionName}`,
281
+ // `The conversation summary indicates files recently worked in as well`,
282
+ // `If that doesn't yield results, proceed to calling the ${searchLibrariesFunctionName} function, then fall back to functions: ${searchPackagesFunctionName}, ${searchFilesFunctionName}`,
283
+ //
284
+ // `To find code, a file, or a library, call ${getRecentlyAccessedFilePathsFunctionName} and read the most recent file, after trying that call ${searchLibrariesFunctionName} then ${searchFilesFunctionName} to find a relevant file`,
285
+ // `The file mentioned in the conversation summary should be read if we're not already working in a file`,
286
+ // `If there is a conversation summary assistant message, use that to pick a file to read before responding to the user if not already working with a specific file`,
287
+ // `Check for a previous conversation summary assistant message in the chat history; if there is one and it mentions a file the user was working with, call ${searchLibrariesFunctionName} to find the file path then call ${readFilesFunctionName} to read the file. Do this to build context before responding to the user`,
288
+ ];
289
+ };
290
+ CodegenConversation.prototype.respondToUser = function (message) {
291
+ return readline.question(
292
+ ''
293
+ .concat(util_1.textColorMap.cyan, '[')
294
+ .concat(CodegenConversation.BOT_NAME, '] ')
295
+ .concat(message)
296
+ .concat(util_1.Reset, '\n')
297
+ );
298
+ };
299
+ CodegenConversation.INITIAL_QUESTION = 'What would you like to create?';
300
+ CodegenConversation.BOT_NAME = 'Alina';
301
+ CodegenConversation.MODEL = 'gpt-4'; //'gpt-3.5-turbo-16k';
302
+ return CodegenConversation;
303
+ })();
190
304
  exports.CodegenConversation = CodegenConversation;
191
- //# sourceMappingURL=CodegenConversation.js.map
305
+ //# sourceMappingURL=CodegenConversation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodegenConversation.js","sourceRoot":"","sources":["../../src/CodegenConversation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA0C;AAC1C,+CAA8C;AAC9C,mGAAyG;AACzG,oFAA0F;AAC1F,kFAAwF;AACxF,4DAAkE;AAElE,wCAAsD;AACtD,gDA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ConversationModule } from './ConversationModule';
3
3
  import { TiktokenModel } from 'tiktoken';
4
4
  export type ConversationParams = {
5
- name: string;
6
- modules?: ConversationModule[];
7
- logLevel?: LogLevel;
8
- limits?: {
9
- enforceLimits?: boolean;
10
- maxMessagesInHistory?: number;
11
- tokenLimit?: number;
12
- };
5
+ name: string;
6
+ modules?: ConversationModule[];
7
+ logLevel?: LogLevel;
8
+ limits?: {
9
+ enforceLimits?: boolean;
10
+ maxMessagesInHistory?: number;
11
+ tokenLimit?: number;
12
+ };
13
13
  };
14
14
  export declare class Conversation {
15
- private tokenLimit;
16
- private history;
17
- private systemMessages;
18
- private functions;
19
- private messageModerators;
20
- private generatedCode;
21
- private generatedList;
22
- private logger;
23
- private params;
24
- constructor(params: ConversationParams);
25
- private addModules;
26
- private addFunctions;
27
- private addMessageModerators;
28
- private enforceTokenLimit;
29
- summarizeConversationHistory(summary: string): void;
30
- private clearHistory;
31
- addSystemMessagesToHistory(messages: string[], unshift?: boolean): void;
32
- addAssistantMessagesToHistory(messages: string[], unshift?: boolean): void;
33
- addUserMessagesToHistory(messages: string[], unshift?: boolean): void;
34
- generateResponse(messages: string[], model?: TiktokenModel): Promise<string>;
35
- generateCode(description: string[], model?: TiktokenModel): Promise<string>;
36
- updateCodeFromFile(codeToUpdateFilePath: string, dependencyCodeFilePaths: string[], description: string, model?: TiktokenModel): Promise<string>;
37
- updateCode(code: string, description: string, model?: TiktokenModel): Promise<string>;
38
- generateList(description: string[], model?: TiktokenModel): Promise<string[]>;
15
+ private tokenLimit;
16
+ private history;
17
+ private systemMessages;
18
+ private functions;
19
+ private messageModerators;
20
+ private generatedCode;
21
+ private generatedList;
22
+ private logger;
23
+ private params;
24
+ constructor(params: ConversationParams);
25
+ private addModules;
26
+ private addFunctions;
27
+ private addMessageModerators;
28
+ private enforceTokenLimit;
29
+ summarizeConversationHistory(summary: string): void;
30
+ private clearHistory;
31
+ addSystemMessagesToHistory(messages: string[], unshift?: boolean): void;
32
+ addAssistantMessagesToHistory(messages: string[], unshift?: boolean): void;
33
+ addUserMessagesToHistory(messages: string[], unshift?: boolean): void;
34
+ generateResponse(messages: string[], model?: TiktokenModel): Promise<string>;
35
+ generateCode(description: string[], model?: TiktokenModel): Promise<string>;
36
+ updateCodeFromFile(
37
+ codeToUpdateFilePath: string,
38
+ dependencyCodeFilePaths: string[],
39
+ description: string,
40
+ model?: TiktokenModel
41
+ ): Promise<string>;
42
+ updateCode(code: string, description: string, model?: TiktokenModel): Promise<string>;
43
+ generateList(description: string[], model?: TiktokenModel): Promise<string[]>;
39
44
  }
40
- export declare const summarizeConversationHistoryFunctionName = "summarizeConversationHistory";
45
+ export declare const summarizeConversationHistoryFunctionName = 'summarizeConversationHistory';
41
46
  export declare const summarizeConversationHistoryFunction: (conversation: Conversation) => {
42
- definition: {
43
- name: string;
44
- description: string;
45
- parameters: {
46
- type: string;
47
- properties: {
48
- summary: {
49
- type: string;
50
- description: string;
51
- };
52
- };
53
- required: string[];
47
+ definition: {
48
+ name: string;
49
+ description: string;
50
+ parameters: {
51
+ type: string;
52
+ properties: {
53
+ summary: {
54
+ type: string;
55
+ description: string;
54
56
  };
57
+ };
58
+ required: string[];
55
59
  };
56
- call: (params: {
57
- summary: string;
58
- }) => Promise<void>;
60
+ };
61
+ call: (params: { summary: string }) => Promise<void>;
59
62
  };
60
- //# sourceMappingURL=Conversation.d.ts.map
63
+ //# sourceMappingURL=Conversation.d.ts.map