@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,108 +1,121 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.ConversationFsModerator = exports.ConversationFsFactory = void 0;
4
- var util_1 = require("@proteinjs/util");
4
+ /* eslint-disable no-empty */
5
+ var util_1 = require('@proteinjs/util');
5
6
  var ConversationFsFactory = /** @class */ (function () {
6
- function ConversationFsFactory(params) {
7
- this.params = Object.assign({ maxFiles: 3, logLevel: 'info' }, params);
8
- this.logger = new util_1.Logger(this.constructor.name, this.params.logLevel);
9
- }
10
- ConversationFsFactory.prototype.merge = function (existingFs, updates) {
11
- var _loop_1 = function (filePath) {
12
- // if the file already exists in the fs
13
- if (existingFs.fileContentMap[filePath]) {
14
- this_1.logger.debug("Updating existing file: ".concat(filePath));
15
- existingFs.fileContentMap[filePath] = updates[filePath];
16
- var oldIndex = existingFs.order.findIndex(function (item) { return item == filePath; });
17
- existingFs.order.splice(oldIndex, 1);
18
- existingFs.order.push(filePath);
19
- return "continue";
20
- }
21
- // if we have less than the max number of files in the fs
22
- if (Object.keys(existingFs.fileContentMap).length < this_1.params.maxFiles) {
23
- this_1.logger.debug("Adding new file (under limit): ".concat(filePath));
24
- existingFs.fileContentMap[filePath] = updates[filePath];
25
- existingFs.order.push(filePath);
26
- return "continue";
27
- }
28
- else {
29
- this_1.logger.debug("Adding new file (over limit): ".concat(filePath));
30
- var removedFilePath = existingFs.order.splice(0, 1)[0];
31
- delete existingFs.fileContentMap[removedFilePath];
32
- existingFs.fileContentMap[filePath] = updates[filePath];
33
- existingFs.order.push(filePath);
34
- }
35
- };
36
- var this_1 = this;
37
- for (var _i = 0, _a = Object.keys(updates); _i < _a.length; _i++) {
38
- var filePath = _a[_i];
39
- _loop_1(filePath);
40
- }
41
- return existingFs;
7
+ function ConversationFsFactory(params) {
8
+ this.params = Object.assign({ maxFiles: 3, logLevel: 'info' }, params);
9
+ this.logger = new util_1.Logger(this.constructor.name, this.params.logLevel);
10
+ }
11
+ ConversationFsFactory.prototype.merge = function (existingFs, updates) {
12
+ var _loop_1 = function (filePath) {
13
+ // if the file already exists in the fs
14
+ if (existingFs.fileContentMap[filePath]) {
15
+ this_1.logger.debug('Updating existing file: '.concat(filePath));
16
+ existingFs.fileContentMap[filePath] = updates[filePath];
17
+ var oldIndex = existingFs.order.findIndex(function (item) {
18
+ return item == filePath;
19
+ });
20
+ existingFs.order.splice(oldIndex, 1);
21
+ existingFs.order.push(filePath);
22
+ return 'continue';
23
+ }
24
+ // if we have less than the max number of files in the fs
25
+ if (Object.keys(existingFs.fileContentMap).length < this_1.params.maxFiles) {
26
+ this_1.logger.debug('Adding new file (under limit): '.concat(filePath));
27
+ existingFs.fileContentMap[filePath] = updates[filePath];
28
+ existingFs.order.push(filePath);
29
+ return 'continue';
30
+ } else {
31
+ this_1.logger.debug('Adding new file (over limit): '.concat(filePath));
32
+ var removedFilePath = existingFs.order.splice(0, 1)[0];
33
+ delete existingFs.fileContentMap[removedFilePath];
34
+ existingFs.fileContentMap[filePath] = updates[filePath];
35
+ existingFs.order.push(filePath);
36
+ }
42
37
  };
43
- return ConversationFsFactory;
44
- }());
38
+ var this_1 = this;
39
+ for (var _i = 0, _a = Object.keys(updates); _i < _a.length; _i++) {
40
+ var filePath = _a[_i];
41
+ _loop_1(filePath);
42
+ }
43
+ return existingFs;
44
+ };
45
+ return ConversationFsFactory;
46
+ })();
45
47
  exports.ConversationFsFactory = ConversationFsFactory;
46
48
  var ConversationFsModerator = /** @class */ (function () {
47
- function ConversationFsModerator(logLevel) {
48
- this.logLevel = 'info';
49
- if (logLevel)
50
- this.logLevel = logLevel;
49
+ function ConversationFsModerator(logLevel) {
50
+ this.logLevel = 'info';
51
+ if (logLevel) {
52
+ this.logLevel = logLevel;
51
53
  }
52
- ConversationFsModerator.prototype.observe = function (messages) {
53
- var conversationFileSystemMessageIndex = -1;
54
- var conversationFileSystem;
55
- var readFilesFunctionCallMessageIndexes = [];
56
- var writeFilesFunctionCallMessageIndexes = [];
57
- var readFilesConsolidatedOutput = {}; // newest version of file wins
58
- for (var i = 0; i < messages.length; i++) {
59
- var message = messages[i];
60
- if (message.role == 'system' && message.content) {
61
- var parsedContent = void 0;
62
- try {
63
- parsedContent = JSON.parse(message.content);
64
- }
65
- catch (error) { }
66
- if (!parsedContent || !parsedContent['fileSystem'])
67
- continue;
68
- conversationFileSystem = parsedContent['fileSystem'];
69
- conversationFileSystemMessageIndex = i;
70
- continue;
71
- }
72
- if (message.role == 'function' && message.name == 'readFiles' && message.content) {
73
- var parsedContent = void 0;
74
- try {
75
- parsedContent = JSON.parse(message.content);
76
- }
77
- catch (error) { }
78
- if (!parsedContent)
79
- continue;
80
- for (var _i = 0, _a = Object.keys(parsedContent); _i < _a.length; _i++) {
81
- var filePath = _a[_i];
82
- readFilesConsolidatedOutput[filePath] = parsedContent[filePath];
83
- }
84
- readFilesFunctionCallMessageIndexes.push(i);
85
- }
86
- if (message.role == 'function' && message.name == 'writeFiles') {
87
- writeFilesFunctionCallMessageIndexes.push(i);
88
- }
54
+ }
55
+ ConversationFsModerator.prototype.observe = function (messages) {
56
+ var conversationFileSystemMessageIndex = -1;
57
+ var conversationFileSystem;
58
+ var readFilesFunctionCallMessageIndexes = [];
59
+ var writeFilesFunctionCallMessageIndexes = [];
60
+ var readFilesConsolidatedOutput = {}; // newest version of file wins
61
+ for (var i = 0; i < messages.length; i++) {
62
+ var message = messages[i];
63
+ if (message.role == 'system' && message.content) {
64
+ var parsedContent = void 0;
65
+ try {
66
+ parsedContent = JSON.parse(message.content);
67
+ } catch (error) {}
68
+ if (!parsedContent || !parsedContent['fileSystem']) {
69
+ continue;
89
70
  }
90
- if (conversationFileSystem) {
91
- conversationFileSystem = new ConversationFsFactory({ logLevel: this.logLevel }).merge(conversationFileSystem, readFilesConsolidatedOutput);
92
- var content = JSON.stringify({ fileSystem: conversationFileSystem });
93
- messages[conversationFileSystemMessageIndex].content = content;
71
+ conversationFileSystem = parsedContent['fileSystem'];
72
+ conversationFileSystemMessageIndex = i;
73
+ continue;
74
+ }
75
+ if (message.role == 'function' && message.name == 'readFiles' && message.content) {
76
+ var parsedContent = void 0;
77
+ try {
78
+ parsedContent = JSON.parse(message.content);
79
+ } catch (error) {}
80
+ if (!parsedContent) {
81
+ continue;
94
82
  }
95
- else {
96
- conversationFileSystem = { fileContentMap: readFilesConsolidatedOutput, order: Object.keys(readFilesConsolidatedOutput) };
97
- messages.push({ role: 'system', content: "Whenever you make a call to readFiles, the file content will be loaded into the { fileSystem } object in the message history. Do not respond with fileSystem's content in a message." });
98
- var content = JSON.stringify({ fileSystem: conversationFileSystem });
99
- messages.push({ role: 'system', content: content });
83
+ for (var _i = 0, _a = Object.keys(parsedContent); _i < _a.length; _i++) {
84
+ var filePath = _a[_i];
85
+ readFilesConsolidatedOutput[filePath] = parsedContent[filePath];
100
86
  }
101
- var moderatedMessages = messages
102
- .filter(function (message, i) { return !readFilesFunctionCallMessageIndexes.includes(i) && !writeFilesFunctionCallMessageIndexes.includes(i); });
103
- return moderatedMessages;
104
- };
105
- return ConversationFsModerator;
106
- }());
87
+ readFilesFunctionCallMessageIndexes.push(i);
88
+ }
89
+ if (message.role == 'function' && message.name == 'writeFiles') {
90
+ writeFilesFunctionCallMessageIndexes.push(i);
91
+ }
92
+ }
93
+ if (conversationFileSystem) {
94
+ conversationFileSystem = new ConversationFsFactory({ logLevel: this.logLevel }).merge(
95
+ conversationFileSystem,
96
+ readFilesConsolidatedOutput
97
+ );
98
+ var content = JSON.stringify({ fileSystem: conversationFileSystem });
99
+ messages[conversationFileSystemMessageIndex].content = content;
100
+ } else {
101
+ conversationFileSystem = {
102
+ fileContentMap: readFilesConsolidatedOutput,
103
+ order: Object.keys(readFilesConsolidatedOutput),
104
+ };
105
+ messages.push({
106
+ role: 'system',
107
+ content:
108
+ "Whenever you make a call to readFiles, the file content will be loaded into the { fileSystem } object in the message history. Do not respond with fileSystem's content in a message.",
109
+ });
110
+ var content = JSON.stringify({ fileSystem: conversationFileSystem });
111
+ messages.push({ role: 'system', content: content });
112
+ }
113
+ var moderatedMessages = messages.filter(function (message, i) {
114
+ return !readFilesFunctionCallMessageIndexes.includes(i) && !writeFilesFunctionCallMessageIndexes.includes(i);
115
+ });
116
+ return moderatedMessages;
117
+ };
118
+ return ConversationFsModerator;
119
+ })();
107
120
  exports.ConversationFsModerator = ConversationFsModerator;
108
- //# sourceMappingURL=ConversationFsModerator.js.map
121
+ //# sourceMappingURL=ConversationFsModerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationFsModerator.js","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/ConversationFsModerator.ts"],"names":[],"mappings":";;;AAAA,wCAAmD;AAenD;IAIE,+BAAY,MAA6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AAC;aAChD,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,sLAAsL;aAChM,CAAC,CAAC;YACH,IAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,sBAAsB,EAAE,CAAC,CAAC;YACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;SAC5C;QAED,IAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CACvC,UAAC,OAAO,EAAE,CAAC;YACT,OAAA,CAAC,mCAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAArG,CAAqG,CACxG,CAAC;QACF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACH,8BAAC;AAAD,CAAC,AA9ED,IA8EC;AA9EY,0DAAuB"}
@@ -2,17 +2,17 @@ import { ConversationModule, ConversationModuleFactory } from '../../Conversatio
2
2
  import { Function } from '../../Function';
3
3
  import { ConversationFsModerator } from './ConversationFsModerator';
4
4
  export declare class ConversationFsModule implements ConversationModule {
5
- private repoPath;
6
- private recentlyAccessedFilePaths;
7
- constructor(repoPath: string);
8
- getName(): string;
9
- getSystemMessages(): string[];
10
- getFunctions(): Function[];
11
- getMessageModerators(): ConversationFsModerator[];
12
- pushRecentlyAccessedFilePath(filePaths: string[]): void;
13
- getRecentlyAccessedFilePaths(): string[];
5
+ private repoPath;
6
+ private recentlyAccessedFilePaths;
7
+ constructor(repoPath: string);
8
+ getName(): string;
9
+ getSystemMessages(): string[];
10
+ getFunctions(): Function[];
11
+ getMessageModerators(): ConversationFsModerator[];
12
+ pushRecentlyAccessedFilePath(filePaths: string[]): void;
13
+ getRecentlyAccessedFilePaths(): string[];
14
14
  }
15
15
  export declare class ConversationFsModuleFactory implements ConversationModuleFactory {
16
- createModule(repoPath: string): Promise<ConversationFsModule>;
16
+ createModule(repoPath: string): Promise<ConversationFsModule>;
17
17
  }
18
- //# sourceMappingURL=ConversationFsModule.d.ts.map
18
+ //# sourceMappingURL=ConversationFsModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationFsModule.d.ts","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/ConversationFsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,yBAAyB,CAAgB;gBAErC,QAAQ,EAAE,MAAM;IAI5B,OAAO,IAAI,MAAM;IAIjB,iBAAiB,IAAI,MAAM,EAAE;IAgB7B,YAAY,IAAI,QAAQ,EAAE;IAS1B,oBAAoB;IAMpB,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE;IAIhD,4BAA4B;CAG7B;AAED,qBAAa,2BAA4B,YAAW,yBAAyB;IACrE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAGpE"}
1
+ {"version":3,"file":"ConversationFsModule.d.ts","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/ConversationFsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAWpE,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,yBAAyB,CAAgB;gBAErC,QAAQ,EAAE,MAAM;IAI5B,OAAO,IAAI,MAAM;IAIjB,iBAAiB,IAAI,MAAM,EAAE;IAgB7B,YAAY,IAAI,QAAQ,EAAE;IAS1B,oBAAoB;IAIpB,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE;IAIhD,4BAA4B;CAG7B;AAED,qBAAa,2BAA4B,YAAW,yBAAyB;IACrE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAGpE"}
@@ -1,111 +1,216 @@
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); }); }
1
+ 'use strict';
2
+ var __awaiter =
3
+ (this && this.__awaiter) ||
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
+ }
4
12
  return new (P || (P = Promise))(function (resolve, reject) {
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());
13
+ function fulfilled(value) {
14
+ try {
15
+ step(generator.next(value));
16
+ } catch (e) {
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());
9
31
  });
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]); }; }
32
+ };
33
+ var __generator =
34
+ (this && this.__generator) ||
35
+ function (thisArg, body) {
36
+ var _ = {
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
+ }
15
62
  function step(op) {
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 };
63
+ if (f) throw new TypeError('Generator is already executing.');
64
+ while ((g && ((g = 0), op[0] && (_ = 0)), _))
65
+ try {
66
+ if (
67
+ ((f = 1),
68
+ y &&
69
+ (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) &&
70
+ !(t = t.call(y, op[1])).done)
71
+ )
72
+ return t;
73
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
74
+ switch (op[0]) {
75
+ case 0:
76
+ case 1:
77
+ t = op;
78
+ break;
79
+ case 4:
80
+ _.label++;
81
+ return { value: op[1], done: false };
82
+ case 5:
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 };
36
123
  }
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++) {
124
+ };
125
+ var __spreadArray =
126
+ (this && this.__spreadArray) ||
127
+ function (to, from, pack) {
128
+ if (pack || arguments.length === 2)
129
+ for (var i = 0, l = from.length, ar; i < l; i++) {
40
130
  if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
131
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
132
+ ar[i] = from[i];
43
133
  }
44
- }
134
+ }
45
135
  return to.concat(ar || Array.prototype.slice.call(from));
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
136
+ };
137
+ Object.defineProperty(exports, '__esModule', { value: true });
48
138
  exports.ConversationFsModuleFactory = exports.ConversationFsModule = void 0;
49
- var KeywordToFilesIndexFunctions_1 = require("../keyword_to_files_index/KeywordToFilesIndexFunctions");
50
- var PackageFunctions_1 = require("../package/PackageFunctions");
51
- var ConversationFsModerator_1 = require("./ConversationFsModerator");
52
- var FsFunctions_1 = require("./FsFunctions");
139
+ var KeywordToFilesIndexFunctions_1 = require('../keyword_to_files_index/KeywordToFilesIndexFunctions');
140
+ var PackageFunctions_1 = require('../package/PackageFunctions');
141
+ var ConversationFsModerator_1 = require('./ConversationFsModerator');
142
+ var FsFunctions_1 = require('./FsFunctions');
53
143
  var ConversationFsModule = /** @class */ (function () {
54
- function ConversationFsModule(repoPath) {
55
- this.recentlyAccessedFilePaths = [];
56
- this.repoPath = repoPath;
57
- }
58
- ConversationFsModule.prototype.getName = function () {
59
- return 'Conversation Fs';
60
- };
61
- ConversationFsModule.prototype.getSystemMessages = function () {
62
- return [
63
- "Assume the current working directory is: ".concat(this.repoPath, " unless specified by the user"),
64
- "Pre-pend the current working directory as the base path to file paths when performing file operations, unless specified otherwise by the user",
65
- "If the user asks to change the cwd, do not create a new folder, just fail if it's not a valid path",
66
- "If the user wants to work in a package, use the ".concat(PackageFunctions_1.searchPackagesFunctionName, " function and take the directory from the package.json file path and make that the cwd"),
67
- "You have access to code in a local repo, you can read and write code to and from the file system with the ".concat(FsFunctions_1.readFilesFunctionName, " function and the ").concat(FsFunctions_1.writeFilesFunctionName, " function"),
68
- "Before writing to a file that already exists, read the file first and make your changes to its contents",
69
- "When reading/writing a file in a specified package, join the package directory with the relative path to form the file path",
70
- "When searching for source files, do not look in the dist or node_modules directories",
71
- "If you don't know a file path, don't try to guess it, use the ".concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName, " function to find it"),
72
- "When searching for something (ie. a file to work with/in), unless more context is specified, use the ".concat(PackageFunctions_1.searchLibrariesFunctionName, " function first, then fall back to functions: ").concat(PackageFunctions_1.searchPackagesFunctionName, ", ").concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName),
73
- "After finding a file to work with, assume the user's following question pertains to that file and use ".concat(FsFunctions_1.readFilesFunctionName, " to read the file if needed"),
74
- ];
75
- };
76
- ConversationFsModule.prototype.getFunctions = function () {
77
- return __spreadArray([
78
- (0, FsFunctions_1.readFilesFunction)(this),
79
- (0, FsFunctions_1.writeFilesFunction)(this),
80
- (0, FsFunctions_1.getRecentlyAccessedFilePathsFunction)(this)
81
- ], FsFunctions_1.fsFunctions, true);
82
- };
83
- ConversationFsModule.prototype.getMessageModerators = function () {
84
- return [
85
- new ConversationFsModerator_1.ConversationFsModerator(),
86
- ];
87
- };
88
- ConversationFsModule.prototype.pushRecentlyAccessedFilePath = function (filePaths) {
89
- var _a;
90
- (_a = this.recentlyAccessedFilePaths).push.apply(_a, filePaths);
91
- };
92
- ConversationFsModule.prototype.getRecentlyAccessedFilePaths = function () {
93
- return this.recentlyAccessedFilePaths;
94
- };
95
- return ConversationFsModule;
96
- }());
144
+ function ConversationFsModule(repoPath) {
145
+ this.recentlyAccessedFilePaths = [];
146
+ this.repoPath = repoPath;
147
+ }
148
+ ConversationFsModule.prototype.getName = function () {
149
+ return 'Conversation Fs';
150
+ };
151
+ ConversationFsModule.prototype.getSystemMessages = function () {
152
+ return [
153
+ 'Assume the current working directory is: '.concat(this.repoPath, ' unless specified by the user'),
154
+ 'Pre-pend the current working directory as the base path to file paths when performing file operations, unless specified otherwise by the user',
155
+ "If the user asks to change the cwd, do not create a new folder, just fail if it's not a valid path",
156
+ 'If the user wants to work in a package, use the '.concat(
157
+ PackageFunctions_1.searchPackagesFunctionName,
158
+ ' function and take the directory from the package.json file path and make that the cwd'
159
+ ),
160
+ 'You have access to code in a local repo, you can read and write code to and from the file system with the '
161
+ .concat(FsFunctions_1.readFilesFunctionName, ' function and the ')
162
+ .concat(FsFunctions_1.writeFilesFunctionName, ' function'),
163
+ 'Before writing to a file that already exists, read the file first and make your changes to its contents',
164
+ 'When reading/writing a file in a specified package, join the package directory with the relative path to form the file path',
165
+ 'When searching for source files, do not look in the dist or node_modules directories',
166
+ "If you don't know a file path, don't try to guess it, use the ".concat(
167
+ KeywordToFilesIndexFunctions_1.searchFilesFunctionName,
168
+ ' function to find it'
169
+ ),
170
+ 'When searching for something (ie. a file to work with/in), unless more context is specified, use the '
171
+ .concat(PackageFunctions_1.searchLibrariesFunctionName, ' function first, then fall back to functions: ')
172
+ .concat(PackageFunctions_1.searchPackagesFunctionName, ', ')
173
+ .concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName),
174
+ "After finding a file to work with, assume the user's following question pertains to that file and use ".concat(
175
+ FsFunctions_1.readFilesFunctionName,
176
+ ' to read the file if needed'
177
+ ),
178
+ ];
179
+ };
180
+ ConversationFsModule.prototype.getFunctions = function () {
181
+ return __spreadArray(
182
+ [
183
+ (0, FsFunctions_1.readFilesFunction)(this),
184
+ (0, FsFunctions_1.writeFilesFunction)(this),
185
+ (0, FsFunctions_1.getRecentlyAccessedFilePathsFunction)(this),
186
+ ],
187
+ FsFunctions_1.fsFunctions,
188
+ true
189
+ );
190
+ };
191
+ ConversationFsModule.prototype.getMessageModerators = function () {
192
+ return [new ConversationFsModerator_1.ConversationFsModerator()];
193
+ };
194
+ ConversationFsModule.prototype.pushRecentlyAccessedFilePath = function (filePaths) {
195
+ var _a;
196
+ (_a = this.recentlyAccessedFilePaths).push.apply(_a, filePaths);
197
+ };
198
+ ConversationFsModule.prototype.getRecentlyAccessedFilePaths = function () {
199
+ return this.recentlyAccessedFilePaths;
200
+ };
201
+ return ConversationFsModule;
202
+ })();
97
203
  exports.ConversationFsModule = ConversationFsModule;
98
204
  var ConversationFsModuleFactory = /** @class */ (function () {
99
- function ConversationFsModuleFactory() {
100
- }
101
- ConversationFsModuleFactory.prototype.createModule = function (repoPath) {
102
- return __awaiter(this, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- return [2 /*return*/, new ConversationFsModule(repoPath)];
105
- });
106
- });
107
- };
108
- return ConversationFsModuleFactory;
109
- }());
205
+ function ConversationFsModuleFactory() {}
206
+ ConversationFsModuleFactory.prototype.createModule = function (repoPath) {
207
+ return __awaiter(this, void 0, void 0, function () {
208
+ return __generator(this, function (_a) {
209
+ return [2 /*return*/, new ConversationFsModule(repoPath)];
210
+ });
211
+ });
212
+ };
213
+ return ConversationFsModuleFactory;
214
+ })();
110
215
  exports.ConversationFsModuleFactory = ConversationFsModuleFactory;
111
- //# sourceMappingURL=ConversationFsModule.js.map
216
+ //# sourceMappingURL=ConversationFsModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationFsModule.js","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/ConversationFsModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uGAAiG;AACjG,gEAAsG;AACtG,qEAAoE;AACpE,6CAAkN;AAElN;IAIE,8BAAY,QAAgB;QAFpB,8BAAyB,GAAa,EAAE,CAAC;QAG/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,sCAAO,GAAP;QACE,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,gDAAiB,GAAjB;QACE,OAAO;YACL,mDAA4C,IAAI,CAAC,QAAQ,kCAA+B;YACxF,+IAA+I;YAC/I,oGAAoG;YACpG,0DAAmD,6CAA0B,2FAAwF;YACrK,oHAA6G,mCAAqB,+BAAqB,oCAAsB,cAAW;YACxL,yGAAyG;YACzG,6HAA6H;YAC7H,sFAAsF;YACtF,wEAAiE,sDAAuB,yBAAsB;YAC9G,+GAAwG,8CAA2B,2DAAiD,6CAA0B,eAAK,sDAAuB,CAAE;YAC5O,gHAAyG,mCAAqB,gCAA6B;SAC5J,CAAC;IACJ,CAAC;IAED,2CAAY,GAAZ;QACE;YACE,IAAA,+BAAiB,EAAC,IAAI,CAAC;YACvB,IAAA,gCAAkB,EAAC,IAAI,CAAC;YACxB,IAAA,kDAAoC,EAAC,IAAI,CAAC;WACvC,yBAAW,QACd;IACJ,CAAC;IAED,mDAAoB,GAApB;QACE,OAAO;YACL,IAAI,iDAAuB,EAAE;SAC9B,CAAC;IACJ,CAAC;IAED,2DAA4B,GAA5B,UAA6B,SAAmB;;QAC9C,CAAA,KAAA,IAAI,CAAC,yBAAyB,CAAA,CAAC,IAAI,WAAI,SAAS,EAAE;IACpD,CAAC;IAED,2DAA4B,GAA5B;QACE,OAAO,IAAI,CAAC,yBAAyB,CAAC;IACxC,CAAC;IACH,2BAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,oDAAoB;AAoDjC;IAAA;IAIA,CAAC;IAHO,kDAAY,GAAlB,UAAmB,QAAgB;;;gBACjC,sBAAO,IAAI,oBAAoB,CAAC,QAAQ,CAAC,EAAC;;;KAC3C;IACH,kCAAC;AAAD,CAAC,AAJD,IAIC;AAJY,kEAA2B"}
1
+ {"version":3,"file":"ConversationFsModule.js","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/ConversationFsModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uGAAiG;AACjG,gEAAsG;AACtG,qEAAoE;AACpE,6CAQuB;AAEvB;IAIE,8BAAY,QAAgB;QAFpB,8BAAyB,GAAa,EAAE,CAAC;QAG/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,sCAAO,GAAP;QACE,OAAO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