rhachet-roles-ehmpathy 1.0.0

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 (165) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.test/genContextLogTrail.d.ts +2 -0
  3. package/dist/.test/genContextLogTrail.js +12 -0
  4. package/dist/.test/genContextLogTrail.js.map +1 -0
  5. package/dist/.test/genContextStitchTrail.d.ts +2 -0
  6. package/dist/.test/genContextStitchTrail.js +8 -0
  7. package/dist/.test/genContextStitchTrail.js.map +1 -0
  8. package/dist/.test/getContextOpenAI.d.ts +2 -0
  9. package/dist/.test/getContextOpenAI.js +18 -0
  10. package/dist/.test/getContextOpenAI.js.map +1 -0
  11. package/dist/contract/cases/mechanicGoalStubout.integration.test.d.ts +0 -0
  12. package/dist/contract/cases/mechanicGoalStubout.integration.test.js +2 -0
  13. package/dist/contract/cases/mechanicGoalStubout.integration.test.js.map +1 -0
  14. package/dist/contract/cases/mechanicStubFillout.integration.test.d.ts +0 -0
  15. package/dist/contract/cases/mechanicStubFillout.integration.test.js +2 -0
  16. package/dist/contract/cases/mechanicStubFillout.integration.test.js.map +1 -0
  17. package/dist/contract/commands/codegenBriefOptions.d.ts +1 -0
  18. package/dist/contract/commands/codegenBriefOptions.js +57 -0
  19. package/dist/contract/commands/codegenBriefOptions.js.map +1 -0
  20. package/dist/data/sdk/sdkOpenAi.d.ts +16 -0
  21. package/dist/data/sdk/sdkOpenAi.js +38 -0
  22. package/dist/data/sdk/sdkOpenAi.js.map +1 -0
  23. package/dist/index.d.ts +0 -0
  24. package/dist/index.js +2 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/logic/artifact/genStepArtSet.d.ts +13 -0
  27. package/dist/logic/artifact/genStepArtSet.integration.test.d.ts +1 -0
  28. package/dist/logic/artifact/genStepArtSet.integration.test.js +142 -0
  29. package/dist/logic/artifact/genStepArtSet.integration.test.js.map +1 -0
  30. package/dist/logic/artifact/genStepArtSet.js +29 -0
  31. package/dist/logic/artifact/genStepArtSet.js.map +1 -0
  32. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.d.ts +19 -0
  33. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.integration.test.d.ts +1 -0
  34. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.integration.test.js +97 -0
  35. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.integration.test.js.map +1 -0
  36. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.js +84 -0
  37. package/dist/logic/artifact/genStepGrabCallerFeedbackToArtifact.js.map +1 -0
  38. package/dist/logic/roles/designer/getDesignerBrief.Options.codegen.d.ts +10 -0
  39. package/dist/logic/roles/designer/getDesignerBrief.Options.codegen.js +14 -0
  40. package/dist/logic/roles/designer/getDesignerBrief.Options.codegen.js.map +1 -0
  41. package/dist/logic/roles/designer/getDesignerBrief.d.ts +13 -0
  42. package/dist/logic/roles/designer/getDesignerBrief.js +21 -0
  43. package/dist/logic/roles/designer/getDesignerBrief.js.map +1 -0
  44. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.d.ts +26 -0
  45. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.integration.test.d.ts +1 -0
  46. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.integration.test.js +77 -0
  47. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.integration.test.js.map +1 -0
  48. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.js +53 -0
  49. package/dist/logic/roles/designer/outlineDistilisys/loopOutlineDistilisys.js.map +1 -0
  50. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.d.ts +22 -0
  51. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.integration.test.d.ts +1 -0
  52. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.integration.test.js +142 -0
  53. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.integration.test.js.map +1 -0
  54. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.js +55 -0
  55. package/dist/logic/roles/designer/outlineDistilisys/stepOutlineDistilisys.js.map +1 -0
  56. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.d.ts +26 -0
  57. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.integration.test.d.ts +1 -0
  58. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.integration.test.js +71 -0
  59. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.integration.test.js.map +1 -0
  60. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.js +53 -0
  61. package/dist/logic/roles/designer/outlineRoadmap/loopOutlineRoadmap.js.map +1 -0
  62. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.d.ts +22 -0
  63. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.integration.test.d.ts +1 -0
  64. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.integration.test.js +130 -0
  65. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.integration.test.js.map +1 -0
  66. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.js +48 -0
  67. package/dist/logic/roles/designer/outlineRoadmap/stepOutlineRoadmap.js.map +1 -0
  68. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.d.ts +17 -0
  69. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.integration.test.d.ts +1 -0
  70. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.integration.test.js +107 -0
  71. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.integration.test.js.map +1 -0
  72. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.js +76 -0
  73. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.expand.ResourcesAndMechanisms.js.map +1 -0
  74. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.imagine.ResourcesAndMechanisms.d.ts +17 -0
  75. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.imagine.ResourcesAndMechanisms.js +73 -0
  76. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.imagine.ResourcesAndMechanisms.js.map +1 -0
  77. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.d.ts +18 -0
  78. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.integration.test.d.ts +1 -0
  79. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.integration.test.js +73 -0
  80. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.integration.test.js.map +1 -0
  81. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.js +62 -0
  82. package/dist/logic/roles/ecologist/distill/.deprecate/distillDomain.refine.ResourcesAndMechanisms.js.map +1 -0
  83. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.d.ts +16 -0
  84. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.integration.test.d.ts +1 -0
  85. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.integration.test.js +120 -0
  86. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.integration.test.js.map +1 -0
  87. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.js +69 -0
  88. package/dist/logic/roles/ecologist/distill/distillDomain.ActionsAndActors.js.map +1 -0
  89. package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.d.ts +10 -0
  90. package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.js +39 -0
  91. package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.js.map +1 -0
  92. package/dist/logic/roles/ecologist/getEcologistBrief.d.ts +13 -0
  93. package/dist/logic/roles/ecologist/getEcologistBrief.js +21 -0
  94. package/dist/logic/roles/ecologist/getEcologistBrief.js.map +1 -0
  95. package/dist/logic/roles/getRoleRegistry.d.ts +8 -0
  96. package/dist/logic/roles/getRoleRegistry.js +19 -0
  97. package/dist/logic/roles/getRoleRegistry.js.map +1 -0
  98. package/dist/logic/roles/getRoleRegistry.readme.d.ts +5 -0
  99. package/dist/logic/roles/getRoleRegistry.readme.js +75 -0
  100. package/dist/logic/roles/getRoleRegistry.readme.js.map +1 -0
  101. package/dist/logic/roles/mechanic/codediff/getRefOrgPatterns.d.ts +5 -0
  102. package/dist/logic/roles/mechanic/codediff/getRefOrgPatterns.js +22 -0
  103. package/dist/logic/roles/mechanic/codediff/getRefOrgPatterns.js.map +1 -0
  104. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.d.ts +34 -0
  105. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.integration.test.d.ts +1 -0
  106. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.integration.test.js +246 -0
  107. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.integration.test.js.map +1 -0
  108. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.js +56 -0
  109. package/dist/logic/roles/mechanic/codediff/routeArtistCodeDiff.js.map +1 -0
  110. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.d.ts +34 -0
  111. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.integration.test.d.ts +1 -0
  112. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.integration.test.js +144 -0
  113. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.integration.test.js.map +1 -0
  114. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.js +33 -0
  115. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReview.js.map +1 -0
  116. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.d.ts +34 -0
  117. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.integration.test.d.ts +1 -0
  118. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.integration.test.js +138 -0
  119. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.integration.test.js.map +1 -0
  120. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.js +49 -0
  121. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewArchitecture.js.map +1 -0
  122. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewBehavior.d.ts +28 -0
  123. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewBehavior.js +35 -0
  124. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewBehavior.js.map +1 -0
  125. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.d.ts +28 -0
  126. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.integration.test.d.ts +1 -0
  127. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.integration.test.js +294 -0
  128. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.integration.test.js.map +1 -0
  129. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.js +44 -0
  130. package/dist/logic/roles/mechanic/codediff/routeCriticCodeReviewCodestyle.js.map +1 -0
  131. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.d.ts +38 -0
  132. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.integration.test.d.ts +1 -0
  133. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.integration.test.js +162 -0
  134. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.integration.test.js.map +1 -0
  135. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.js +32 -0
  136. package/dist/logic/roles/mechanic/codediff/routeJudgeReleasable.js.map +1 -0
  137. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.d.ts +56 -0
  138. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.integration.test.d.ts +1 -0
  139. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.integration.test.js +169 -0
  140. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.integration.test.js.map +1 -0
  141. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.js +30 -0
  142. package/dist/logic/roles/mechanic/codediff/routeMechanicCodeIterate.js.map +1 -0
  143. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.d.ts +53 -0
  144. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.integration.test.d.ts +1 -0
  145. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.integration.test.js +203 -0
  146. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.integration.test.js.map +1 -0
  147. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.js +72 -0
  148. package/dist/logic/roles/mechanic/codediff/routeMechanicCodePropose.js.map +1 -0
  149. package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.d.ts +10 -0
  150. package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.js +35 -0
  151. package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.js.map +1 -0
  152. package/dist/logic/roles/mechanic/getMechanicBrief.d.ts +13 -0
  153. package/dist/logic/roles/mechanic/getMechanicBrief.js +21 -0
  154. package/dist/logic/roles/mechanic/getMechanicBrief.js.map +1 -0
  155. package/dist/logic/roles/mechanic/getMechanicRole.d.ts +2 -0
  156. package/dist/logic/roles/mechanic/getMechanicRole.js +157 -0
  157. package/dist/logic/roles/mechanic/getMechanicRole.js.map +1 -0
  158. package/dist/logic/roles/mechanic/study/routeStudyAsk.d.ts +19 -0
  159. package/dist/logic/roles/mechanic/study/routeStudyAsk.integration.test.d.ts +1 -0
  160. package/dist/logic/roles/mechanic/study/routeStudyAsk.integration.test.js +98 -0
  161. package/dist/logic/roles/mechanic/study/routeStudyAsk.integration.test.js.map +1 -0
  162. package/dist/logic/roles/mechanic/study/routeStudyAsk.js +30 -0
  163. package/dist/logic/roles/mechanic/study/routeStudyAsk.js.map +1 -0
  164. package/package.json +95 -0
  165. package/readme.md +110 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Uladzimir Kasacheuski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ import { ContextLogTrail } from 'as-procedure';
2
+ export declare const genContextLogTrail: () => ContextLogTrail;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genContextLogTrail = void 0;
4
+ const type_fns_1 = require("type-fns");
5
+ const genContextLogTrail = () => ({
6
+ log: {
7
+ ...(0, type_fns_1.pick)(console, ['debug', 'log', 'info', 'warn', 'error']),
8
+ trail: [],
9
+ },
10
+ });
11
+ exports.genContextLogTrail = genContextLogTrail;
12
+ //# sourceMappingURL=genContextLogTrail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genContextLogTrail.js","sourceRoot":"","sources":["../../src/.test/genContextLogTrail.ts"],"names":[],"mappings":";;;AACA,uCAAgC;AAEzB,MAAM,kBAAkB,GAAG,GAAoB,EAAE,CAAC,CAAC;IACxD,GAAG,EAAE;QACH,GAAG,IAAA,eAAI,EAAC,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC3D,KAAK,EAAE,EAAE;KACV;CACF,CAAC,CAAC;AALU,QAAA,kBAAkB,sBAK5B"}
@@ -0,0 +1,2 @@
1
+ import { ContextStitchTrail } from 'rhachet';
2
+ export declare const genContextStitchTrail: () => ContextStitchTrail;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genContextStitchTrail = void 0;
4
+ const genContextStitchTrail = () => ({
5
+ stitch: { trail: [] },
6
+ });
7
+ exports.genContextStitchTrail = genContextStitchTrail;
8
+ //# sourceMappingURL=genContextStitchTrail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genContextStitchTrail.js","sourceRoot":"","sources":["../../src/.test/genContextStitchTrail.ts"],"names":[],"mappings":";;;AAEO,MAAM,qBAAqB,GAAG,GAAuB,EAAE,CAAC,CAAC;IAC9D,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;CACtB,CAAC,CAAC;AAFU,QAAA,qBAAqB,yBAE/B"}
@@ -0,0 +1,2 @@
1
+ import { ContextOpenAI } from '../data/sdk/sdkOpenAi';
2
+ export declare const getContextOpenAI: () => ContextOpenAI;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContextOpenAI = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const getContextOpenAI = () => ({
6
+ openai: {
7
+ auth: {
8
+ key: process.env.PREP_OPENAI_KEY ??
9
+ helpful_errors_1.UnexpectedCodePathError.throw('prep openai key not declared in env'),
10
+ },
11
+ llm: {
12
+ model: 'gpt-4-turbo-2024-04-09',
13
+ output: 'words',
14
+ },
15
+ },
16
+ });
17
+ exports.getContextOpenAI = getContextOpenAI;
18
+ //# sourceMappingURL=getContextOpenAI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getContextOpenAI.js","sourceRoot":"","sources":["../../src/.test/getContextOpenAI.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AAIlD,MAAM,gBAAgB,GAAG,GAAkB,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,GAAG,EACD,OAAO,CAAC,GAAG,CAAC,eAAe;gBAC3B,wCAAuB,CAAC,KAAK,CAAC,qCAAqC,CAAC;SACvE;QACD,GAAG,EAAE;YACH,KAAK,EAAE,wBAAwB;YAC/B,MAAM,EAAE,OAAO;SAChB;KACF;CACF,CAAC,CAAC;AAZU,QAAA,gBAAgB,oBAY1B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=mechanicGoalStubout.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mechanicGoalStubout.integration.test.js","sourceRoot":"","sources":["../../../src/contract/cases/mechanicGoalStubout.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=mechanicStubFillout.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mechanicStubFillout.integration.test.js","sourceRoot":"","sources":["../../../src/contract/cases/mechanicStubFillout.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const as_command_1 = require("@ehmpathy/as-command");
7
+ const fast_glob_1 = __importDefault(require("fast-glob"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
11
+ const command = (0, as_command_1.asCommand)({
12
+ name: path_1.default.basename(__filename),
13
+ stage: 'prep',
14
+ dir: __dirname + '/.temp',
15
+ log: console,
16
+ }, async (input) => {
17
+ // lookup the briefs available in the expected dir
18
+ const briefsDir = path_1.default.join((await (0, rhachet_artifact_git_1.getGitRepoRoot)({ from: __dirname })) +
19
+ `/src/logic/roles/${input.role.toLowerCase()}/.briefs`);
20
+ const patterns = [
21
+ path_1.default.join(briefsDir, '**/*'), // include all
22
+ '!' + path_1.default.join(briefsDir, '**/*.stub.*'), // exclude .stub.* files, since those were the stubs that the full briefs were expanded from
23
+ ];
24
+ const filePaths = await (0, fast_glob_1.default)(patterns, { onlyFiles: true });
25
+ // declare each path as a key
26
+ const keys = filePaths
27
+ .filter((file) => !path_1.default.basename(file).startsWith('.'))
28
+ .map((file) => path_1.default.relative(briefsDir, file).replace(/\\/g, '/'));
29
+ const asConstLines = keys.map((k) => ` '${k}',`).join('\n');
30
+ const fileContents = `
31
+ /**
32
+ * .what = the options for the briefs available to role ${input.role}
33
+ * .note = codegened via:
34
+ * \`\`\`sh
35
+ * npx tsx src/contract/commands/${path_1.default.basename(__filename)}
36
+ * \`\`\`
37
+ */
38
+ const options = [
39
+ ${asConstLines}
40
+ ] as const;
41
+
42
+ export type BriefOption${input.role} = typeof options[number];
43
+ `;
44
+ // persist the output
45
+ const outputFile = path_1.default.join(briefsDir, `../get${input.role}Brief.Options.codegen.ts`);
46
+ fs_1.default.writeFileSync(outputFile, fileContents.trimStart());
47
+ console.info(`✅ wrote ${outputFile}`);
48
+ return { outputFile, fileContents };
49
+ });
50
+ // npx tsx src/contract/commands/codegenBriefOptions.ts
51
+ if (require.main === module) {
52
+ void command({ role: 'Ecologist' });
53
+ // void command({ role: 'Architect' });
54
+ void command({ role: 'Designer' });
55
+ void command({ role: 'Mechanic' });
56
+ }
57
+ //# sourceMappingURL=codegenBriefOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegenBriefOptions.js","sourceRoot":"","sources":["../../../src/contract/commands/codegenBriefOptions.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,0DAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AACxB,+DAAsD;AAEtD,MAAM,OAAO,GAAG,IAAA,sBAAS,EACvB;IACE,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC/B,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,SAAS,GAAG,QAAQ;IACzB,GAAG,EAAE,OAAO;CACb,EACD,KAAK,EAAE,KAEN,EAAE,EAAE;IACH,kDAAkD;IAClD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CACzB,CAAC,MAAM,IAAA,qCAAc,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACzC,oBAAoB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CACzD,CAAC;IACF,MAAM,QAAQ,GAAG;QACf,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,cAAc;QAC5C,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,4FAA4F;KACxI,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,IAAA,mBAAI,EAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5D,6BAA6B;IAC7B,MAAM,IAAI,GAAG,SAAS;SACnB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACtD,GAAG,CACF,CAAC,IAAI,EAAE,EAAE,CAAC,cAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAC7D,CAAC;IACJ,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG;;0DAEiC,KAAK,CAAC,IAAI;;;oCAGhC,cAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;;;;EAI3D,YAAY;;;yBAGW,KAAK,CAAC,IAAI;CAClC,CAAC;IAEE,qBAAqB;IACrB,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAC1B,SAAS,EACT,SAAS,KAAK,CAAC,IAAI,0BAA0B,CAC9C,CAAC;IACF,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,WAAW,UAAU,EAAE,CAAC,CAAC;IACtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtC,CAAC,CACF,CAAC;AAEF,uDAAuD;AACvD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,KAAK,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACpC,uCAAuC;IACvC,KAAK,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACnC,KAAK,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ContextLogTrail } from 'as-procedure';
2
+ import { ChatModel } from 'openai/resources/index';
3
+ export interface ContextOpenAI {
4
+ openai: {
5
+ auth: {
6
+ key: string;
7
+ };
8
+ llm: {
9
+ model: ChatModel;
10
+ output: 'words' | 'json';
11
+ };
12
+ };
13
+ }
14
+ export declare const sdkOpenAi: {
15
+ imagine: (input: string, context: ContextOpenAI & ContextLogTrail) => Promise<string>;
16
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sdkOpenAi = void 0;
7
+ const helpful_errors_1 = require("helpful-errors");
8
+ const openai_1 = __importDefault(require("openai"));
9
+ const imagine = async (input, context) => {
10
+ const openai = new openai_1.default({
11
+ apiKey: context.openai.auth.key,
12
+ });
13
+ const response = await openai.chat.completions.create({
14
+ response_format: context.openai.llm.output === 'json'
15
+ ? { type: 'json_object' }
16
+ : undefined,
17
+ messages: [
18
+ {
19
+ role: 'user',
20
+ content: input,
21
+ },
22
+ ],
23
+ model: context.openai.llm.model,
24
+ });
25
+ if (!response.choices[0])
26
+ throw new helpful_errors_1.UnexpectedCodePathError('at least one response choice should be provided', { response });
27
+ if (response.choices.length > 1)
28
+ throw new helpful_errors_1.UnexpectedCodePathError('more than one response.choice provided', { response });
29
+ if (!response.choices[0].message.content)
30
+ throw new helpful_errors_1.UnexpectedCodePathError('no content provided in response', {
31
+ response,
32
+ });
33
+ return response.choices[0].message.content;
34
+ };
35
+ exports.sdkOpenAi = {
36
+ imagine,
37
+ };
38
+ //# sourceMappingURL=sdkOpenAi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdkOpenAi.js","sourceRoot":"","sources":["../../../src/data/sdk/sdkOpenAi.ts"],"names":[],"mappings":";;;;;;AACA,mDAAyD;AACzD,oDAA4B;AAa5B,MAAM,OAAO,GAAG,KAAK,EACnB,KAAa,EACb,OAAwC,EACvB,EAAE;IACnB,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;KAChC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QACpD,eAAe,EACb,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM;YAClC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE;YACzB,CAAC,CAAC,SAAS;QACf,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,KAAK;aACf;SACF;QACD,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK;KAChC,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACtB,MAAM,IAAI,wCAAuB,CAC/B,iDAAiD,EACjD,EAAE,QAAQ,EAAE,CACb,CAAC;IACJ,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7B,MAAM,IAAI,wCAAuB,CAC/B,wCAAwC,EACxC,EAAE,QAAQ,EAAE,CACb,CAAC;IACJ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO;QACtC,MAAM,IAAI,wCAAuB,CAAC,iCAAiC,EAAE;YACnE,QAAQ;SACT,CAAC,CAAC;IACL,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AAC7C,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,OAAO;CACR,CAAC"}
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { GStitcher, StitchStepCompute, Threads, RoleContext } from 'rhachet';
2
+ import { Artifact } from 'rhachet-artifact';
3
+ import { GitFile } from 'rhachet-artifact-git';
4
+ /**
5
+ * .what = creates a compute step that sets content onto a thread's stashed artifact
6
+ * .why = allows downstream steps to persist imagined or computed content into code artifacts
7
+ */
8
+ export declare const genStepArtSet: <TStitchee extends string, TArtee extends string, TThreads extends Threads<{ [K in TStitchee]: RoleContext<K, {
9
+ art: { [P in TArtee]: Artifact<typeof GitFile, string>; };
10
+ }>; }>>({ stitchee, artee, }: {
11
+ stitchee: TStitchee;
12
+ artee: TArtee;
13
+ }) => StitchStepCompute<GStitcher<TThreads, import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, GitFile>>;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const promises_1 = require("fs/promises");
4
+ const rhachet_1 = require("rhachet");
5
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
6
+ const test_fns_1 = require("test-fns");
7
+ const genContextLogTrail_1 = require("../../.test/genContextLogTrail");
8
+ const genContextStitchTrail_1 = require("../../.test/genContextStitchTrail");
9
+ const genStepArtSet_1 = require("./genStepArtSet");
10
+ describe('genStepArtSet (integration)', () => {
11
+ const stitchedContent = 'Generated content for artifact';
12
+ const context = {
13
+ ...(0, genContextLogTrail_1.genContextLogTrail)(),
14
+ ...(0, genContextStitchTrail_1.genContextStitchTrail)(),
15
+ };
16
+ (0, test_fns_1.given)('a coder thread with net-new GitFile artifact', () => {
17
+ const claimsArt = (0, rhachet_artifact_git_1.genArtifactGitFile)({
18
+ uri: __dirname + '/.temp/summary-new.md',
19
+ });
20
+ const route = (0, genStepArtSet_1.genStepArtSet)({ stitchee: 'coder', artee: 'summary' });
21
+ (0, test_fns_1.then)('it should infer threads with stash.art.summary correctly', () => {
22
+ // ✅ correct
23
+ const valid = {
24
+ coder: {
25
+ context: {
26
+ role: 'coder',
27
+ inherit: { traits: [], skills: [] },
28
+ stash: {
29
+ art: {
30
+ summary: claimsArt,
31
+ },
32
+ },
33
+ },
34
+ stitches: [],
35
+ },
36
+ };
37
+ expect(valid);
38
+ });
39
+ (0, test_fns_1.then)('it should error if stash is missing', () => {
40
+ const missingstash = {
41
+ coder: {
42
+ // @ts-expect-error: stash is missing
43
+ context: { role: 'coder' },
44
+ stitches: [],
45
+ },
46
+ };
47
+ expect(missingstash);
48
+ });
49
+ (0, test_fns_1.then)('it should error if art is missing', () => {
50
+ const missingArt = {
51
+ coder: {
52
+ context: {
53
+ role: 'coder',
54
+ // @ts-expect-error: art is missing
55
+ stash: {},
56
+ },
57
+ stitches: [],
58
+ },
59
+ };
60
+ expect(missingArt);
61
+ });
62
+ (0, test_fns_1.then)('it should error if summary is not an artifact', () => {
63
+ const badSummary = {
64
+ coder: {
65
+ role: 'coder',
66
+ context: {
67
+ stash: {
68
+ art: {
69
+ // @ts-expect-error: content dne on artifact
70
+ summary: { content: 'not an artifact' },
71
+ },
72
+ },
73
+ },
74
+ stitches: [],
75
+ },
76
+ };
77
+ expect(badSummary);
78
+ });
79
+ const threads = (0, test_fns_1.usePrep)(async () => {
80
+ const inflight = {
81
+ coder: await (0, rhachet_1.enrollThread)({
82
+ role: 'coder',
83
+ stash: {
84
+ art: { summary: claimsArt },
85
+ },
86
+ }),
87
+ };
88
+ threads.coder.stitches.push({
89
+ output: { content: stitchedContent },
90
+ });
91
+ return inflight;
92
+ });
93
+ // afterAll(async () => {
94
+ // await claimsArt.del();
95
+ // });
96
+ (0, test_fns_1.when)('executed via enweaveOneStitcher', () => {
97
+ (0, test_fns_1.then)('writes the content to a new file', async () => {
98
+ const outcome = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: route, threads }, context);
99
+ const result = outcome.stitch.output;
100
+ expect(result.content).toBe(stitchedContent);
101
+ const raw = await (0, promises_1.readFile)(result.uri, 'utf-8');
102
+ expect(raw).toBe(stitchedContent);
103
+ });
104
+ });
105
+ });
106
+ (0, test_fns_1.given)('a coder thread with existing GitFile artifact to overwrite', () => {
107
+ const claimsArt = (0, rhachet_artifact_git_1.genArtifactGitFile)({
108
+ uri: __dirname + '/.temp/summary-old.md',
109
+ });
110
+ const route = (0, genStepArtSet_1.genStepArtSet)({ stitchee: 'coder', artee: 'summary' });
111
+ beforeAll(async () => {
112
+ await claimsArt.set({ content: 'old-content' });
113
+ });
114
+ const threads = (0, test_fns_1.usePrep)(async () => {
115
+ const inflight = {
116
+ coder: await (0, rhachet_1.enrollThread)({
117
+ role: 'coder',
118
+ stash: {
119
+ art: { summary: claimsArt },
120
+ },
121
+ }),
122
+ };
123
+ threads.coder.stitches.push({
124
+ output: { content: stitchedContent },
125
+ });
126
+ return inflight;
127
+ });
128
+ // afterAll(async () => {
129
+ // await claimsArt.del();
130
+ // });
131
+ (0, test_fns_1.when)('executed via enweaveOneStitcher', () => {
132
+ (0, test_fns_1.then)('overwrites the file content', async () => {
133
+ const outcome = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: route, threads }, context);
134
+ const result = outcome.stitch.output;
135
+ expect(result.content).toBe(stitchedContent);
136
+ const raw = await (0, promises_1.readFile)(result.uri, 'utf-8');
137
+ expect(raw).toBe(stitchedContent);
138
+ });
139
+ });
140
+ });
141
+ });
142
+ //# sourceMappingURL=genStepArtSet.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genStepArtSet.integration.test.js","sourceRoot":"","sources":["../../../src/logic/artifact/genStepArtSet.integration.test.ts"],"names":[],"mappings":";;AAAA,0CAAuC;AACvC,qCAAgF;AAChF,+DAA0D;AAC1D,uCAAsD;AAEtD,uEAAoE;AACpE,6EAA0E;AAC1E,mDAAgD;AAEhD,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,eAAe,GAAG,gCAAgC,CAAC;IACzD,MAAM,OAAO,GAAG;QACd,GAAG,IAAA,uCAAkB,GAAE;QACvB,GAAG,IAAA,6CAAqB,GAAE;KAC3B,CAAC;IAEF,IAAA,gBAAK,EAAC,8CAA8C,EAAE,GAAG,EAAE;QACzD,MAAM,SAAS,GAAG,IAAA,yCAAkB,EAAC;YACnC,GAAG,EAAE,SAAS,GAAG,uBAAuB;SACzC,CAAC,CAAC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C,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAChD,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genStepArtSet = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const rhachet_1 = require("rhachet");
6
+ /**
7
+ * .what = creates a compute step that sets content onto a thread's stashed artifact
8
+ * .why = allows downstream steps to persist imagined or computed content into code artifacts
9
+ */
10
+ const genStepArtSet = ({ stitchee, artee, }) => new rhachet_1.StitchStepCompute({
11
+ form: 'COMPUTE',
12
+ readme: null,
13
+ slug: `[${stitchee}]<artifact:set>[${artee}]`,
14
+ stitchee,
15
+ invoke: async ({ threads }) => {
16
+ const thread = threads[stitchee];
17
+ const artifact = thread.context.stash.art[artee];
18
+ const content = (0, rhachet_1.getStitch)({
19
+ from: thread.stitches,
20
+ where: (stitch) => 'content' in stitch.output &&
21
+ typeof stitch.output.content === 'string',
22
+ })?.output.content ??
23
+ helpful_errors_1.UnexpectedCodePathError.throw('could not find stitch with output.content', { thread });
24
+ const output = await artifact.set({ content });
25
+ return { input: { artifact, content }, output };
26
+ },
27
+ });
28
+ exports.genStepArtSet = genStepArtSet;
29
+ //# sourceMappingURL=genStepArtSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genStepArtSet.js","sourceRoot":"","sources":["../../../src/logic/artifact/genStepArtSet.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AACzD,qCAQiB;AAIjB;;;GAGG;AACI,MAAM,aAAa,GAAG,CAa3B,EACA,QAAQ,EACR,KAAK,GAIN,EAAE,EAAE,CACH,IAAI,2BAAiB,CAAqD;IACxE,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI,QAAQ,mBAAmB,KAAK,GAAG;IAC7C,QAAQ;IACR,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAS9B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEjD,MAAM,OAAO,GACX,IAAA,mBAAS,EAAC;YACR,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,KAAK,EAAE,CAAC,MAAM,EAAyC,EAAE,CACvD,SAAS,IAAI,MAAM,CAAC,MAAM;gBAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,QAAQ;SAC5C,CAAC,EAAE,MAAM,CAAC,OAAO;YAClB,wCAAuB,CAAC,KAAK,CAC3B,2CAA2C,EAC3C,EAAE,MAAM,EAAE,CACX,CAAC;QAEJ,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC;IAClD,CAAC;CACF,CAAC,CAAC;AArDQ,QAAA,aAAa,iBAqDrB"}
@@ -0,0 +1,19 @@
1
+ import { StitchStepCompute, GStitcher, Threads, RoleContext } from 'rhachet';
2
+ import { Artifact } from 'rhachet-artifact';
3
+ import { GitFile } from 'rhachet-artifact-git';
4
+ /**
5
+ * .what = creates a compute step where the static 'caller' gives feedback on another role's artifact
6
+ * .why = enables human review or annotation flow to be dynamically targeted, but statically sourced
7
+ */
8
+ export declare const genStepGrabCallerFeedbackToArtifact: <TStitchee extends string, TArtee extends string, TThreads extends Threads<{ [K in TStitchee | "caller"]: RoleContext<K, K extends "caller" ? {
9
+ art: {
10
+ feedback: Artifact<typeof GitFile>;
11
+ };
12
+ } : {
13
+ art: { [P in TArtee]: Artifact<typeof GitFile, string>; };
14
+ }>; }>>({ stitchee, artee, }: {
15
+ stitchee: TStitchee;
16
+ artee: TArtee;
17
+ }) => StitchStepCompute<GStitcher<TThreads, import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, {
18
+ feedback: GitFile | null;
19
+ }>>;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const inquirer_1 = __importDefault(require("inquirer"));
7
+ const rhachet_1 = require("rhachet");
8
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
9
+ const test_fns_1 = require("test-fns");
10
+ const genContextLogTrail_1 = require("../../.test/genContextLogTrail");
11
+ const genContextStitchTrail_1 = require("../../.test/genContextStitchTrail");
12
+ const getContextOpenAI_1 = require("../../.test/getContextOpenAI");
13
+ const genStepGrabCallerFeedbackToArtifact_1 = require("./genStepGrabCallerFeedbackToArtifact");
14
+ describe('genStepGrabCallerFeedbackToArtifact', () => {
15
+ const context = {
16
+ ...(0, genContextLogTrail_1.genContextLogTrail)(),
17
+ ...(0, genContextStitchTrail_1.genContextStitchTrail)(),
18
+ ...(0, getContextOpenAI_1.getContextOpenAI)(),
19
+ };
20
+ const feedbackArt = (0, rhachet_artifact_git_1.genArtifactGitFile)({
21
+ uri: __dirname + '/.temp/test.feedback.md',
22
+ });
23
+ const claimsArt = (0, rhachet_artifact_git_1.genArtifactGitFile)({
24
+ uri: __dirname + '/.temp/test.claims.md',
25
+ });
26
+ beforeEach(async () => {
27
+ await feedbackArt.del();
28
+ await claimsArt.set({ content: 'original claim' });
29
+ });
30
+ /**
31
+ * .what = mocks inquirer.prompt unless INQUIRE=true
32
+ * .why = to allow automated testing of CLI steps, but optionally permit real prompts
33
+ */
34
+ const usePromptMockResponse = (mocked) => {
35
+ if (process.env.INQUIRE === 'true')
36
+ return;
37
+ jest
38
+ .spyOn(inquirer_1.default, 'prompt')
39
+ .mockImplementation(() => Promise.resolve(mocked));
40
+ };
41
+ (0, test_fns_1.given)('the caller has feedback for the student claims', () => {
42
+ const askText = 'please summarize multiplication';
43
+ const step = (0, genStepGrabCallerFeedbackToArtifact_1.genStepGrabCallerFeedbackToArtifact)({
44
+ stitchee: 'student',
45
+ artee: 'claims',
46
+ });
47
+ (0, test_fns_1.when)('the step is run', () => {
48
+ const threadsPrep = async () => ({
49
+ caller: await (0, rhachet_1.enrollThread)({
50
+ role: 'caller',
51
+ stash: { art: { feedback: feedbackArt } },
52
+ }),
53
+ student: await (0, rhachet_1.enrollThread)({
54
+ role: 'student',
55
+ stash: { ask: askText, art: { claims: claimsArt } },
56
+ }),
57
+ });
58
+ (0, test_fns_1.then)('writes the feedback artifact if input is provided', async () => {
59
+ usePromptMockResponse({
60
+ hasNotes: 'yes notes',
61
+ feedback: 'this is mock feedback',
62
+ });
63
+ const threads = await threadsPrep();
64
+ const result = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: step, threads }, context);
65
+ const updated = await feedbackArt.get();
66
+ expect(updated?.content).toContain('mock feedback');
67
+ expect(result.stitch.output.feedback).toBeDefined();
68
+ });
69
+ (0, test_fns_1.then)('skips writing if hasNotes is "no notes"', async () => {
70
+ usePromptMockResponse({
71
+ hasNotes: 'no notes',
72
+ });
73
+ const threads = await threadsPrep();
74
+ const result = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: step, threads }, context);
75
+ expect(result.stitch.output.feedback).toBeNull();
76
+ const updated = await feedbackArt.get();
77
+ expect(updated).toBeNull();
78
+ });
79
+ (0, test_fns_1.then)('deletes existing feedback file if hasNotes is "no notes"', async () => {
80
+ // seed the feedback file with prior content
81
+ await feedbackArt.set({
82
+ content: 'old feedback that should be removed',
83
+ });
84
+ usePromptMockResponse({
85
+ hasNotes: 'no notes',
86
+ });
87
+ const threads = await threadsPrep();
88
+ const result = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: step, threads }, context);
89
+ expect(result.stitch.output.feedback).toBeNull();
90
+ // confirm file was removed
91
+ const updated = await feedbackArt.get();
92
+ expect(updated).toBeNull();
93
+ });
94
+ });
95
+ });
96
+ });
97
+ //# sourceMappingURL=genStepGrabCallerFeedbackToArtifact.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genStepGrabCallerFeedbackToArtifact.integration.test.js","sourceRoot":"","sources":["../../../src/logic/artifact/genStepGrabCallerFeedbackToArtifact.integration.test.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAChC,qCAA2D;AAC3D,+DAA0D;AAC1D,uCAA6C;AAE7C,uEAAoE;AACpE,6EAA0E;AAC1E,mEAAgE;AAChE,+FAA4F;AAE5F,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,MAAM,OAAO,GAAG;QACd,GAAG,IAAA,uCAAkB,GAAE;QACvB,GAAG,IAAA,6CAAqB,GAAE;QAC1B,GAAG,IAAA,mCAAgB,GAAE;KACtB,CAAC;IAEF,MAAM,WAAW,GAAG,IAAA,yCAAkB,EAAC;QACrC,GAAG,EAAE,SAAS,GAAG,yBAAyB;KAC3C,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAA,yCAAkB,EAAC;QACnC,GAAG,EAAE,SAAS,GAAG,uBAAuB;KACzC,CAAC,CAAC;IAEH,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH;;;OAGG;IACH,MAAM,qBAAqB,GAAG,CAAC,MAA2B,EAAE,EAAE;QAC5D,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,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