rhachet 1.1.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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/dist/__nonpublished_modules__/file-fns/src/getFile.d.ts +6 -0
  3. package/dist/__nonpublished_modules__/file-fns/src/getFile.js +14 -0
  4. package/dist/__nonpublished_modules__/file-fns/src/getFile.js.map +1 -0
  5. package/dist/__test_assets__/directory.d.ts +1 -0
  6. package/dist/__test_assets__/directory.js +5 -0
  7. package/dist/__test_assets__/directory.js.map +1 -0
  8. package/dist/__test_assets__/genContextLogTrail.d.ts +2 -0
  9. package/dist/__test_assets__/genContextLogTrail.js +12 -0
  10. package/dist/__test_assets__/genContextLogTrail.js.map +1 -0
  11. package/dist/__test_assets__/genContextStitchTrail.d.ts +2 -0
  12. package/dist/__test_assets__/genContextStitchTrail.js +8 -0
  13. package/dist/__test_assets__/genContextStitchTrail.js.map +1 -0
  14. package/dist/__test_assets__/getContextOpenAI.d.ts +2 -0
  15. package/dist/__test_assets__/getContextOpenAI.js +18 -0
  16. package/dist/__test_assets__/getContextOpenAI.js.map +1 -0
  17. package/dist/__test_assets__/stitchers/genStitcherCodeFileRead.d.ts +14 -0
  18. package/dist/__test_assets__/stitchers/genStitcherCodeFileRead.js +23 -0
  19. package/dist/__test_assets__/stitchers/genStitcherCodeFileRead.js.map +1 -0
  20. package/dist/__test_assets__/stitchers/genStitcherCodeFileWrite.d.ts +16 -0
  21. package/dist/__test_assets__/stitchers/genStitcherCodeFileWrite.js +29 -0
  22. package/dist/__test_assets__/stitchers/genStitcherCodeFileWrite.js.map +1 -0
  23. package/dist/__test_assets__/stitchers/genStitcherCodeReviewImagine.d.ts +15 -0
  24. package/dist/__test_assets__/stitchers/genStitcherCodeReviewImagine.js +97 -0
  25. package/dist/__test_assets__/stitchers/genStitcherCodeReviewImagine.js.map +1 -0
  26. package/dist/__test_assets__/stitchers/stitcherCodeDiffImagine.d.ts +13 -0
  27. package/dist/__test_assets__/stitchers/stitcherCodeDiffImagine.js +33 -0
  28. package/dist/__test_assets__/stitchers/stitcherCodeDiffImagine.js.map +1 -0
  29. package/dist/__test_assets__/stitchers/stitcherFanoutRandomSum.d.ts +13 -0
  30. package/dist/__test_assets__/stitchers/stitcherFanoutRandomSum.js +45 -0
  31. package/dist/__test_assets__/stitchers/stitcherFanoutRandomSum.js.map +1 -0
  32. package/dist/__test_assets__/stitchers/stitcherFanoutSubroutes.d.ts +29 -0
  33. package/dist/__test_assets__/stitchers/stitcherFanoutSubroutes.js +76 -0
  34. package/dist/__test_assets__/stitchers/stitcherFanoutSubroutes.js.map +1 -0
  35. package/dist/__test_assets__/threads/codeArtist.d.ts +6 -0
  36. package/dist/__test_assets__/threads/codeArtist.js +26 -0
  37. package/dist/__test_assets__/threads/codeArtist.js.map +1 -0
  38. package/dist/__test_assets__/threads/codeCritic.d.ts +6 -0
  39. package/dist/__test_assets__/threads/codeCritic.js +21 -0
  40. package/dist/__test_assets__/threads/codeCritic.js.map +1 -0
  41. package/dist/__test_assets__/threads/director.d.ts +6 -0
  42. package/dist/__test_assets__/threads/director.js +14 -0
  43. package/dist/__test_assets__/threads/director.js.map +1 -0
  44. package/dist/contract/sdk.d.ts +8 -0
  45. package/dist/contract/sdk.js +33 -0
  46. package/dist/contract/sdk.js.map +1 -0
  47. package/dist/domain/objects/Stitch.d.ts +42 -0
  48. package/dist/domain/objects/Stitch.js +9 -0
  49. package/dist/domain/objects/Stitch.js.map +1 -0
  50. package/dist/domain/objects/StitchChoice.d.ts +30 -0
  51. package/dist/domain/objects/StitchChoice.js +8 -0
  52. package/dist/domain/objects/StitchChoice.js.map +1 -0
  53. package/dist/domain/objects/StitchCycle.d.ts +44 -0
  54. package/dist/domain/objects/StitchCycle.js +8 -0
  55. package/dist/domain/objects/StitchCycle.js.map +1 -0
  56. package/dist/domain/objects/StitchFanout.d.ts +35 -0
  57. package/dist/domain/objects/StitchFanout.js +8 -0
  58. package/dist/domain/objects/StitchFanout.js.map +1 -0
  59. package/dist/domain/objects/StitchRoute.d.ts +22 -0
  60. package/dist/domain/objects/StitchRoute.js +8 -0
  61. package/dist/domain/objects/StitchRoute.js.map +1 -0
  62. package/dist/domain/objects/StitchSetEvent.d.ts +23 -0
  63. package/dist/domain/objects/StitchSetEvent.js +8 -0
  64. package/dist/domain/objects/StitchSetEvent.js.map +1 -0
  65. package/dist/domain/objects/StitchStep.d.ts +55 -0
  66. package/dist/domain/objects/StitchStep.js +11 -0
  67. package/dist/domain/objects/StitchStep.js.map +1 -0
  68. package/dist/domain/objects/StitchTrail.d.ts +26 -0
  69. package/dist/domain/objects/StitchTrail.js +19 -0
  70. package/dist/domain/objects/StitchTrail.js.map +1 -0
  71. package/dist/domain/objects/Stitcher.d.ts +105 -0
  72. package/dist/domain/objects/Stitcher.js +49 -0
  73. package/dist/domain/objects/Stitcher.js.map +1 -0
  74. package/dist/domain/objects/Stitcher.test.d.ts +1 -0
  75. package/dist/domain/objects/Stitcher.test.js +78 -0
  76. package/dist/domain/objects/Stitcher.test.js.map +1 -0
  77. package/dist/domain/objects/Thread.d.ts +31 -0
  78. package/dist/domain/objects/Thread.js +11 -0
  79. package/dist/domain/objects/Thread.js.map +1 -0
  80. package/dist/domain/objects/Threads.d.ts +56 -0
  81. package/dist/domain/objects/Threads.js +26 -0
  82. package/dist/domain/objects/Threads.js.map +1 -0
  83. package/dist/domain/objects/Weave.d.ts +0 -0
  84. package/dist/domain/objects/Weave.js +2 -0
  85. package/dist/domain/objects/Weave.js.map +1 -0
  86. package/dist/domain/objects/Weaver.d.ts +5 -0
  87. package/dist/domain/objects/Weaver.js +7 -0
  88. package/dist/domain/objects/Weaver.js.map +1 -0
  89. package/dist/domain/objects/index.d.ts +11 -0
  90. package/dist/domain/objects/index.js +30 -0
  91. package/dist/domain/objects/index.js.map +1 -0
  92. package/dist/index.d.ts +1 -0
  93. package/dist/index.js +18 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/logic/stitch/adapters/imagineViaOpenAI.d.ts +13 -0
  96. package/dist/logic/stitch/adapters/imagineViaOpenAI.js +36 -0
  97. package/dist/logic/stitch/adapters/imagineViaOpenAI.js.map +1 -0
  98. package/dist/logic/stitch/enstitch.d.ts +27 -0
  99. package/dist/logic/stitch/enstitch.js +97 -0
  100. package/dist/logic/stitch/enstitch.js.map +1 -0
  101. package/dist/logic/stitch/enstitch.test.d.ts +1 -0
  102. package/dist/logic/stitch/enstitch.test.js +87 -0
  103. package/dist/logic/stitch/enstitch.test.js.map +1 -0
  104. package/dist/logic/stitch/invokeImagineStitcher.d.ts +10 -0
  105. package/dist/logic/stitch/invokeImagineStitcher.integration.test.d.ts +1 -0
  106. package/dist/logic/stitch/invokeImagineStitcher.integration.test.js +193 -0
  107. package/dist/logic/stitch/invokeImagineStitcher.integration.test.js.map +1 -0
  108. package/dist/logic/stitch/invokeImagineStitcher.js +23 -0
  109. package/dist/logic/stitch/invokeImagineStitcher.js.map +1 -0
  110. package/dist/logic/stitch/withStitchTrail.d.ts +16 -0
  111. package/dist/logic/stitch/withStitchTrail.js +40 -0
  112. package/dist/logic/stitch/withStitchTrail.js.map +1 -0
  113. package/dist/logic/thread/enroleThread.d.ts +4 -0
  114. package/dist/logic/thread/enroleThread.js +6 -0
  115. package/dist/logic/thread/enroleThread.js.map +1 -0
  116. package/dist/logic/thread/genThread.d.ts +7 -0
  117. package/dist/logic/thread/genThread.js +10 -0
  118. package/dist/logic/thread/genThread.js.map +1 -0
  119. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.d.ts +17 -0
  120. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.js +3 -0
  121. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.js.map +1 -0
  122. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.test.d.ts +1 -0
  123. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.test.js +67 -0
  124. package/dist/logic/weave/compose/GStitcherInferredFromChoice.generic.test.js.map +1 -0
  125. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.d.ts +18 -0
  126. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.js +3 -0
  127. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.js.map +1 -0
  128. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.test.d.ts +1 -0
  129. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.test.js +132 -0
  130. package/dist/logic/weave/compose/GStitcherInferredFromCycle.generic.test.js.map +1 -0
  131. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.d.ts +23 -0
  132. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.js +3 -0
  133. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.js.map +1 -0
  134. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.test.d.ts +1 -0
  135. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.test.js +74 -0
  136. package/dist/logic/weave/compose/GStitcherInferredFromFanout.generic.test.js.map +1 -0
  137. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.d.ts +24 -0
  138. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.js +3 -0
  139. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.js.map +1 -0
  140. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.test.d.ts +1 -0
  141. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.test.js +190 -0
  142. package/dist/logic/weave/compose/GStitcherInferredFromRoute.generic.test.js.map +1 -0
  143. package/dist/logic/weave/compose/ProcedureContextMerged.generic.d.ts +36 -0
  144. package/dist/logic/weave/compose/ProcedureContextMerged.generic.js +3 -0
  145. package/dist/logic/weave/compose/ProcedureContextMerged.generic.js.map +1 -0
  146. package/dist/logic/weave/compose/ProcedureContextMerged.generic.test.d.ts +1 -0
  147. package/dist/logic/weave/compose/ProcedureContextMerged.generic.test.js +29 -0
  148. package/dist/logic/weave/compose/ProcedureContextMerged.generic.test.js.map +1 -0
  149. package/dist/logic/weave/compose/ThreadsMerged.generic.d.ts +65 -0
  150. package/dist/logic/weave/compose/ThreadsMerged.generic.js +3 -0
  151. package/dist/logic/weave/compose/ThreadsMerged.generic.js.map +1 -0
  152. package/dist/logic/weave/compose/ThreadsMerged.generic.test.d.ts +1 -0
  153. package/dist/logic/weave/compose/ThreadsMerged.generic.test.js +420 -0
  154. package/dist/logic/weave/compose/ThreadsMerged.generic.test.js.map +1 -0
  155. package/dist/logic/weave/compose/asStitcher.d.ts +12 -0
  156. package/dist/logic/weave/compose/asStitcher.js +15 -0
  157. package/dist/logic/weave/compose/asStitcher.js.map +1 -0
  158. package/dist/logic/weave/compose/asStitcher.test.d.ts +1 -0
  159. package/dist/logic/weave/compose/asStitcher.test.js +95 -0
  160. package/dist/logic/weave/compose/asStitcher.test.js.map +1 -0
  161. package/dist/logic/weave/compose/asStitcherFlat.d.ts +10 -0
  162. package/dist/logic/weave/compose/asStitcherFlat.js +13 -0
  163. package/dist/logic/weave/compose/asStitcherFlat.js.map +1 -0
  164. package/dist/logic/weave/compose/asStitcherFlat.test.d.ts +1 -0
  165. package/dist/logic/weave/compose/asStitcherFlat.test.js +96 -0
  166. package/dist/logic/weave/compose/asStitcherFlat.test.js.map +1 -0
  167. package/dist/logic/weave/compose/genStitchChoice.d.ts +22 -0
  168. package/dist/logic/weave/compose/genStitchChoice.js +23 -0
  169. package/dist/logic/weave/compose/genStitchChoice.js.map +1 -0
  170. package/dist/logic/weave/compose/genStitchChoice.test.d.ts +1 -0
  171. package/dist/logic/weave/compose/genStitchChoice.test.js +200 -0
  172. package/dist/logic/weave/compose/genStitchChoice.test.js.map +1 -0
  173. package/dist/logic/weave/compose/genStitchCycle.d.ts +28 -0
  174. package/dist/logic/weave/compose/genStitchCycle.js +30 -0
  175. package/dist/logic/weave/compose/genStitchCycle.js.map +1 -0
  176. package/dist/logic/weave/compose/genStitchCycle.test.d.ts +1 -0
  177. package/dist/logic/weave/compose/genStitchCycle.test.js +152 -0
  178. package/dist/logic/weave/compose/genStitchCycle.test.js.map +1 -0
  179. package/dist/logic/weave/compose/genStitchFanout.d.ts +17 -0
  180. package/dist/logic/weave/compose/genStitchFanout.js +21 -0
  181. package/dist/logic/weave/compose/genStitchFanout.js.map +1 -0
  182. package/dist/logic/weave/compose/genStitchFanout.test.d.ts +1 -0
  183. package/dist/logic/weave/compose/genStitchFanout.test.js +79 -0
  184. package/dist/logic/weave/compose/genStitchFanout.test.js.map +1 -0
  185. package/dist/logic/weave/compose/genStitchRoute.d.ts +15 -0
  186. package/dist/logic/weave/compose/genStitchRoute.js +20 -0
  187. package/dist/logic/weave/compose/genStitchRoute.js.map +1 -0
  188. package/dist/logic/weave/compose/genStitchRoute.test.d.ts +1 -0
  189. package/dist/logic/weave/compose/genStitchRoute.test.js +120 -0
  190. package/dist/logic/weave/compose/genStitchRoute.test.js.map +1 -0
  191. package/dist/logic/weave/enweave.d.ts +0 -0
  192. package/dist/logic/weave/enweave.js +2 -0
  193. package/dist/logic/weave/enweave.js.map +1 -0
  194. package/dist/logic/weave/enweaveAllStitchers.d.ts +0 -0
  195. package/dist/logic/weave/enweaveAllStitchers.js +2 -0
  196. package/dist/logic/weave/enweaveAllStitchers.js.map +1 -0
  197. package/dist/logic/weave/enweaveOneChoice.d.ts +14 -0
  198. package/dist/logic/weave/enweaveOneChoice.js +48 -0
  199. package/dist/logic/weave/enweaveOneChoice.js.map +1 -0
  200. package/dist/logic/weave/enweaveOneChoice.test.d.ts +1 -0
  201. package/dist/logic/weave/enweaveOneChoice.test.js +181 -0
  202. package/dist/logic/weave/enweaveOneChoice.test.js.map +1 -0
  203. package/dist/logic/weave/enweaveOneCycle.d.ts +19 -0
  204. package/dist/logic/weave/enweaveOneCycle.js +98 -0
  205. package/dist/logic/weave/enweaveOneCycle.js.map +1 -0
  206. package/dist/logic/weave/enweaveOneCycle.test.d.ts +1 -0
  207. package/dist/logic/weave/enweaveOneCycle.test.js +180 -0
  208. package/dist/logic/weave/enweaveOneCycle.test.js.map +1 -0
  209. package/dist/logic/weave/enweaveOneFanout.d.ts +12 -0
  210. package/dist/logic/weave/enweaveOneFanout.integration.test.d.ts +1 -0
  211. package/dist/logic/weave/enweaveOneFanout.integration.test.js +166 -0
  212. package/dist/logic/weave/enweaveOneFanout.integration.test.js.map +1 -0
  213. package/dist/logic/weave/enweaveOneFanout.js +37 -0
  214. package/dist/logic/weave/enweaveOneFanout.js.map +1 -0
  215. package/dist/logic/weave/enweaveOneRoute.d.ts +12 -0
  216. package/dist/logic/weave/enweaveOneRoute.integration.test.d.ts +1 -0
  217. package/dist/logic/weave/enweaveOneRoute.integration.test.js +159 -0
  218. package/dist/logic/weave/enweaveOneRoute.integration.test.js.map +1 -0
  219. package/dist/logic/weave/enweaveOneRoute.js +33 -0
  220. package/dist/logic/weave/enweaveOneRoute.js.map +1 -0
  221. package/dist/logic/weave/enweaveOneStitcher.d.ts +11 -0
  222. package/dist/logic/weave/enweaveOneStitcher.integration.test.d.ts +2 -0
  223. package/dist/logic/weave/enweaveOneStitcher.integration.test.js +258 -0
  224. package/dist/logic/weave/enweaveOneStitcher.integration.test.js.map +1 -0
  225. package/dist/logic/weave/enweaveOneStitcher.js +42 -0
  226. package/dist/logic/weave/enweaveOneStitcher.js.map +1 -0
  227. package/package.json +88 -0
  228. package/readme.md +61 -0
@@ -0,0 +1,6 @@
1
+ import { Thread } from '../../domain/objects/Thread';
2
+ import { ThreadContextRole } from '../../domain/objects/Threads';
3
+ export declare const getExampleThreadCodeCritic: () => Promise<Thread<ThreadContextRole<'critic'> & {
4
+ tools: string[];
5
+ facts: string[];
6
+ }>>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExampleThreadCodeCritic = void 0;
4
+ const getFile_1 = require("../../__nonpublished_modules__/file-fns/src/getFile");
5
+ const Thread_1 = require("../../domain/objects/Thread");
6
+ const directory_1 = require("../directory");
7
+ // todo: use enroleThread to add role context & apply role tools
8
+ const getExampleThreadCodeCritic = async () => new Thread_1.Thread({
9
+ context: {
10
+ role: 'critic',
11
+ tools: [],
12
+ facts: [
13
+ await (0, getFile_1.getFile)({
14
+ path: directory_1.directoryTestAssets + '/context/facts/codeEnvTypescript.scene.md',
15
+ }),
16
+ ],
17
+ },
18
+ stitches: [], // no history yet, by default
19
+ });
20
+ exports.getExampleThreadCodeCritic = getExampleThreadCodeCritic;
21
+ //# sourceMappingURL=codeCritic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeCritic.js","sourceRoot":"","sources":["../../../src/__test_assets__/threads/codeCritic.ts"],"names":[],"mappings":";;;AAAA,iFAA8E;AAC9E,wDAAqD;AAErD,4CAAmD;AAEnD,gEAAgE;AACzD,MAAM,0BAA0B,GAAG,KAAK,IAE7C,EAAE,CACF,IAAI,eAAM,CAER;IACA,OAAO,EAAE;QACP,IAAI,EAAE,QAAiB;QACvB,KAAK,EAAE,EAAE;QACT,KAAK,EAAE;YACL,MAAM,IAAA,iBAAO,EAAC;gBACZ,IAAI,EACF,+BAAmB,GAAG,2CAA2C;aACpE,CAAC;SACH;KACF;IACD,QAAQ,EAAE,EAAE,EAAE,6BAA6B;CAC5C,CAAC,CAAC;AAjBQ,QAAA,0BAA0B,8BAiBlC"}
@@ -0,0 +1,6 @@
1
+ import { Thread } from '../../domain/objects/Thread';
2
+ import { ThreadContextRole } from '../../domain/objects/Threads';
3
+ export declare const exampleThreadDirector: import("domain-objects/dist/manipulation/immute/withImmute").WithImmute<Thread<ThreadContextRole<"director"> & {
4
+ tools: string[];
5
+ facts: string[];
6
+ }>>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exampleThreadDirector = void 0;
4
+ const Thread_1 = require("../../domain/objects/Thread");
5
+ // todo: use enroleThread to add role context & apply role tools
6
+ exports.exampleThreadDirector = Thread_1.Thread.build({
7
+ context: {
8
+ role: 'director',
9
+ tools: [],
10
+ facts: [],
11
+ },
12
+ stitches: [], // no history yet, by default
13
+ });
14
+ //# sourceMappingURL=director.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"director.js","sourceRoot":"","sources":["../../../src/__test_assets__/threads/director.ts"],"names":[],"mappings":";;;AAAA,wDAAqD;AAGrD,gEAAgE;AACnD,QAAA,qBAAqB,GAAG,eAAM,CAAC,KAAK,CAE/C;IACA,OAAO,EAAE;QACP,IAAI,EAAE,UAAmB;QACzB,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;KACV;IACD,QAAQ,EAAE,EAAE,EAAE,6BAA6B;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { genStitchChoice } from '../logic/weave/compose/genStitchChoice';
2
+ export { genStitchCycle } from '../logic/weave/compose/genStitchCycle';
3
+ export { genStitchFanout } from '../logic/weave/compose/genStitchFanout';
4
+ export { genStitchRoute } from '../logic/weave/compose/genStitchRoute';
5
+ export { enweaveOneStitcher } from '../logic/weave/enweaveOneStitcher';
6
+ export { asStitcher } from '../logic/weave/compose/asStitcher';
7
+ export { asStitcherFlat } from '../logic/weave/compose/asStitcherFlat';
8
+ export * from '../domain/objects';
@@ -0,0 +1,33 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.asStitcherFlat = exports.asStitcher = exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = void 0;
18
+ var genStitchChoice_1 = require("../logic/weave/compose/genStitchChoice");
19
+ Object.defineProperty(exports, "genStitchChoice", { enumerable: true, get: function () { return genStitchChoice_1.genStitchChoice; } });
20
+ var genStitchCycle_1 = require("../logic/weave/compose/genStitchCycle");
21
+ Object.defineProperty(exports, "genStitchCycle", { enumerable: true, get: function () { return genStitchCycle_1.genStitchCycle; } });
22
+ var genStitchFanout_1 = require("../logic/weave/compose/genStitchFanout");
23
+ Object.defineProperty(exports, "genStitchFanout", { enumerable: true, get: function () { return genStitchFanout_1.genStitchFanout; } });
24
+ var genStitchRoute_1 = require("../logic/weave/compose/genStitchRoute");
25
+ Object.defineProperty(exports, "genStitchRoute", { enumerable: true, get: function () { return genStitchRoute_1.genStitchRoute; } });
26
+ var enweaveOneStitcher_1 = require("../logic/weave/enweaveOneStitcher");
27
+ Object.defineProperty(exports, "enweaveOneStitcher", { enumerable: true, get: function () { return enweaveOneStitcher_1.enweaveOneStitcher; } });
28
+ var asStitcher_1 = require("../logic/weave/compose/asStitcher");
29
+ Object.defineProperty(exports, "asStitcher", { enumerable: true, get: function () { return asStitcher_1.asStitcher; } });
30
+ var asStitcherFlat_1 = require("../logic/weave/compose/asStitcherFlat");
31
+ Object.defineProperty(exports, "asStitcherFlat", { enumerable: true, get: function () { return asStitcherFlat_1.asStitcherFlat; } });
32
+ __exportStar(require("../domain/objects"), exports);
33
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AACvB,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAE3B,gEAA+D;AAAtD,wGAAA,UAAU,OAAA;AACnB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,oDAAkC"}
@@ -0,0 +1,42 @@
1
+ import { UniDateTime } from '@ehmpathy/uni-time';
2
+ import { DomainEntity } from 'domain-objects';
3
+ import { Uuid } from 'uuid-fns';
4
+ import { StitchTrail, StitchTrailDesc } from './StitchTrail';
5
+ import { StitcherDesc } from './Stitcher';
6
+ export interface Stitch<TOutput> {
7
+ /**
8
+ * .what = a unique identifier for the stitch
9
+ */
10
+ uuid: Uuid;
11
+ /**
12
+ * .what = when the stitch was set
13
+ */
14
+ createdAt: UniDateTime;
15
+ /**
16
+ * .what = the stitcher that set it
17
+ * .note =
18
+ * - may be null if it was a manually created stitch
19
+ */
20
+ stitcher: StitcherDesc<any> | null;
21
+ /**
22
+ * .what = the trail from which the stitch came
23
+ * .note =
24
+ * - the markers may not always be present today // todo: hide them on output, instead of on input, longterm
25
+ * - the trail itself may not be declared, e.g., if it was a manually created stitch
26
+ */
27
+ trail: {
28
+ desc: StitchTrailDesc;
29
+ markers?: StitchTrail;
30
+ } | null;
31
+ /**
32
+ * .what = the prompt input which caused the output
33
+ */
34
+ input: any;
35
+ /**
36
+ * .what = the output of the stitch
37
+ */
38
+ output: TOutput;
39
+ }
40
+ export declare class Stitch<TOutput> extends DomainEntity<Stitch<TOutput>> implements Stitch<TOutput> {
41
+ static primary: readonly ["uuid"];
42
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stitch = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class Stitch extends domain_objects_1.DomainEntity {
6
+ }
7
+ exports.Stitch = Stitch;
8
+ Stitch.primary = ['uuid'];
9
+ //# sourceMappingURL=Stitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stitch.js","sourceRoot":"","sources":["../../../src/domain/objects/Stitch.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AA6C7D,MAAa,MACX,SAAQ,6BAA6B;;AADvC,wBAKC;AADe,cAAO,GAAG,CAAC,MAAM,CAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ import { GStitcher, Stitcher, StitcherBase, StitcherForm } from './Stitcher';
3
+ import { Threads } from './Threads';
4
+ /**
5
+ * .what = fork+choose composite stitcher
6
+ * .how =
7
+ * - declare the stitcher options to choose from
8
+ * - declare a stitcher to choose one
9
+ * .note =
10
+ * - choose multiple can be composed via choice of a fanout route
11
+ */
12
+ export interface StitchChoice<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends StitcherBase<StitcherForm.CHOICE> {
13
+ /**
14
+ * .what = the stitcher which decides the choice
15
+ */
16
+ decider: Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], {
17
+ choice: {
18
+ slug: string;
19
+ };
20
+ }>>;
21
+ /**
22
+ * .what = the set of stitchers to choose one from
23
+ */
24
+ options: [
25
+ Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>,
26
+ ...Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>[]
27
+ ];
28
+ }
29
+ export declare class StitchChoice<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends DomainLiteral<StitchChoice<TStitcher>> implements StitchChoice<TStitcher> {
30
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchChoice = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchChoice extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchChoice = StitchChoice;
8
+ //# sourceMappingURL=StitchChoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchChoice.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchChoice.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAmC/C,MAAa,YAGX,SAAQ,8BAAsC;CACT;AAJvC,oCAIuC"}
@@ -0,0 +1,44 @@
1
+ import { UniDuration } from '@ehmpathy/uni-time';
2
+ import { DomainLiteral } from 'domain-objects';
3
+ import { PickAny } from 'type-fns';
4
+ import { GStitcher, Stitcher, StitcherBase, StitcherForm } from './Stitcher';
5
+ import { Threads } from './Threads';
6
+ /**
7
+ * .what = repeater composite stitcher
8
+ * .how =
9
+ * - declare the repeatee, which will be repeated while decider chooses 'repeat'
10
+ * - declare the decider, which selects 'repeat', 'release', or 'halt'
11
+ * .note =
12
+ * - by default, will halt if 100cycles or 1hrs have been reached
13
+ * - fails fast; you can always resume a weave from the event stream after fix of error
14
+ */
15
+ export interface StitchCycle<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends StitcherBase<StitcherForm.CYCLE> {
16
+ /**
17
+ * .what = the stitcher to repeat
18
+ */
19
+ repeatee: Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>;
20
+ /**
21
+ * .what = the stitcher which decides whether to repeat, release, or halt
22
+ * .output = { choice: 'repeat' | 'release' | 'halt' }
23
+ */
24
+ decider: Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], {
25
+ choice: 'repeat' | 'release' | 'halt';
26
+ }>>;
27
+ /**
28
+ * .what = the configuration of when to halt the cycler, to prevent infiloop
29
+ */
30
+ halter: {
31
+ threshold: PickAny<{
32
+ /**
33
+ * the number of repetitions of the cycle
34
+ */
35
+ repetitions: number;
36
+ /**
37
+ * the amount of time spent in the cycle
38
+ */
39
+ duration: UniDuration;
40
+ }>;
41
+ };
42
+ }
43
+ export declare class StitchCycle<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends DomainLiteral<StitchCycle<TStitcher>> implements StitchCycle<TStitcher> {
44
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchCycle = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchCycle extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchCycle = StitchCycle;
8
+ //# sourceMappingURL=StitchCycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchCycle.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchCycle.ts"],"names":[],"mappings":";;;AACA,mDAA+C;AAuD/C,MAAa,WAGX,SAAQ,8BAAqC;CACT;AAJtC,kCAIsC"}
@@ -0,0 +1,35 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ import { StitchStep } from './StitchStep';
3
+ import { GStitcher, Stitcher, StitcherBase, StitcherForm } from './Stitcher';
4
+ import { Thread } from './Thread';
5
+ import { Threads } from './Threads';
6
+ /**
7
+ * .what = parallel composite stitcher
8
+ * .how =
9
+ * - fanout pattern to run substitchers in parallel
10
+ * - fanin to merge via a conclusion
11
+ * .note = a StitchFanout is a composite Stitcher, similar to StitchRoute, but runs multiple branches in parallel
12
+ */
13
+ export interface StitchFanout<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends StitcherBase<StitcherForm.FANOUT> {
14
+ /**
15
+ * .what = the set of stitchers to run in parallel
16
+ */
17
+ parallels: [
18
+ Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>,
19
+ ...Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>[]
20
+ ];
21
+ /**
22
+ * .what = a final stitcher that merges the parallel outputs
23
+ * .why = synthesizes the results into one final output
24
+ * .note = input threads contain arrays per role, due to parallel fanout
25
+ */
26
+ concluder: StitchStep<GStitcher<ThreadsFromFanout<TStitcher>, TStitcher['context'], TStitcher['output']>>;
27
+ }
28
+ export declare class StitchFanout<TStitcher extends GStitcher<Threads<any, 'single'>, any, any>> extends DomainLiteral<StitchFanout<TStitcher>> implements StitchFanout<TStitcher> {
29
+ }
30
+ /**
31
+ * .what = transforms threads to an array-of-each-thread for fanouts
32
+ */
33
+ export type ThreadsFromFanout<T extends GStitcher<Threads<any, 'single'>, any, any>> = Threads<{
34
+ [K in keyof T['threads'] & string]: T['threads'][K] extends Thread<infer C> ? C extends object ? C : never : never;
35
+ }, 'multiple'>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchFanout = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchFanout extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchFanout = StitchFanout;
8
+ //# sourceMappingURL=StitchFanout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchFanout.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchFanout.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAsC/C,MAAa,YAGX,SAAQ,8BAAsC;CACT;AAJvC,oCAIuC"}
@@ -0,0 +1,22 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ import { GStitcher, Stitcher, StitcherBase, StitcherForm } from './Stitcher';
3
+ /**
4
+ * .what = a route of stitchers to enstich in sequence; a composed tactic
5
+ * .note = a StitchRoute is really just a composite Stitcher
6
+ * - e.g., see the generic parameter input
7
+ */
8
+ export interface StitchRoute<
9
+ /**
10
+ * .note = a StitchRoute is really just a composite Stitcher
11
+ */
12
+ TStitcher extends GStitcher> extends StitcherBase<StitcherForm.ROUTE> {
13
+ /**
14
+ * .what = the route of stitchers to execute in sequence
15
+ */
16
+ sequence: [
17
+ ...Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], any>>[],
18
+ Stitcher<GStitcher<TStitcher['threads'], TStitcher['context'], TStitcher['output']>>
19
+ ];
20
+ }
21
+ export declare class StitchRoute<TStitcher extends GStitcher> extends DomainLiteral<StitchRoute<TStitcher>> implements StitchRoute<TStitcher> {
22
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchRoute = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchRoute extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchRoute = StitchRoute;
8
+ //# sourceMappingURL=StitchRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchRoute.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchRoute.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAoC/C,MAAa,WACX,SAAQ,8BAAqC;CACT;AAFtC,kCAEsC"}
@@ -0,0 +1,23 @@
1
+ import { UniDateTime } from '@ehmpathy/uni-time';
2
+ import { DomainLiteral } from 'domain-objects';
3
+ import { Stitch } from './Stitch';
4
+ import { Threads } from './Threads';
5
+ /**
6
+ * .what = an event that describes the occurrence of a stich being set
7
+ */
8
+ export interface StitchSetEvent<TThreads extends Threads<any, 'single'>, TOutput> {
9
+ /**
10
+ * .what = when the stitch was set
11
+ */
12
+ occurredAt: UniDateTime;
13
+ /**
14
+ * .what = the stitch which was set
15
+ */
16
+ stitch: Stitch<TOutput>;
17
+ /**
18
+ * .what = the threads it was set with
19
+ */
20
+ threads: TThreads;
21
+ }
22
+ export declare class StitchSetEvent<TThreads extends Threads<any, 'single'>, TOutput> extends DomainLiteral<StitchSetEvent<TThreads, TOutput>> implements StitchSetEvent<TThreads, TOutput> {
23
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchSetEvent = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchSetEvent extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchSetEvent = StitchSetEvent;
8
+ //# sourceMappingURL=StitchSetEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchSetEvent.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchSetEvent.ts"],"names":[],"mappings":";;;AACA,mDAA+C;AA2B/C,MAAa,cACX,SAAQ,8BAAgD;CACT;AAFjD,wCAEiD"}
@@ -0,0 +1,55 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ import { Stitch } from './Stitch';
3
+ import { GStitcher, StitcherBase, StitcherForm } from './Stitcher';
4
+ import { Threads } from './Threads';
5
+ /**
6
+ * .what = a step by which to stitch, via computation
7
+ */
8
+ export interface StitchStepCompute<TStitcher extends GStitcher<Threads<any, any>, any, any>> extends StitcherBase<StitcherForm.COMPUTE> {
9
+ /**
10
+ * .what = the procedure which will compute the stitch upon invocation
11
+ */
12
+ invoke: (input: {
13
+ threads: TStitcher['threads'];
14
+ }, context: TStitcher['context']) => Promise<Pick<Stitch<TStitcher['output']>, 'input' | 'output'>> | Pick<Stitch<TStitcher['output']>, 'input' | 'output'>;
15
+ /**
16
+ * .what = which thread will receive the stitch
17
+ */
18
+ stitchee: keyof TStitcher['threads'];
19
+ }
20
+ export declare class StitchStepCompute<TStitcher extends GStitcher<Threads<any, any>, any, any>> extends DomainLiteral<StitchStepCompute<TStitcher>> implements StitchStepCompute<TStitcher> {
21
+ }
22
+ /**
23
+ * .what = a step by which to stitch, via imagination
24
+ */
25
+ export interface StitchStepImagine<TStitcher extends GStitcher<Threads<any, any>, any, any>> extends StitcherBase<StitcherForm.IMAGINE> {
26
+ /**
27
+ * .what = which thread will receive the stitch
28
+ */
29
+ stitchee: keyof TStitcher['threads'];
30
+ /**
31
+ * .what = encodes threads into a prompt
32
+ */
33
+ enprompt: (input: {
34
+ threads: TStitcher['threads'];
35
+ }) => string;
36
+ /**
37
+ * .what = invokes an llm to imagine based on a prompt
38
+ */
39
+ imagine: (input: string, context: TStitcher['context']) => Promise<string>;
40
+ /**
41
+ * .what = decodes the imagined prompt into a stitch
42
+ */
43
+ deprompt: (input: {
44
+ threads: TStitcher['threads'];
45
+ promptOut: string;
46
+ promptIn: string;
47
+ }) => Pick<Stitch<TStitcher['output']>, 'input' | 'output'>;
48
+ }
49
+ export declare class StitchStepImagine<TStitcher extends GStitcher<Threads<any, any>, any, any>> extends DomainLiteral<StitchStepImagine<TStitcher>> implements StitchStepImagine<TStitcher> {
50
+ }
51
+ /**
52
+ * .what = a single step that can be stitched
53
+ * .note = may be computed or imagined
54
+ */
55
+ export type StitchStep<TStitcher extends GStitcher<Threads<any, any>, any, any>> = StitchStepCompute<TStitcher> | StitchStepImagine<TStitcher>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StitchStepImagine = exports.StitchStepCompute = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchStepCompute extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchStepCompute = StitchStepCompute;
8
+ class StitchStepImagine extends domain_objects_1.DomainLiteral {
9
+ }
10
+ exports.StitchStepImagine = StitchStepImagine;
11
+ //# sourceMappingURL=StitchStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchStep.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchStep.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AA4B/C,MAAa,iBAGX,SAAQ,8BAA2C;CACT;AAJ5C,8CAI4C;AAiC5C,MAAa,iBAGX,SAAQ,8BAA2C;CACT;AAJ5C,8CAI4C"}
@@ -0,0 +1,26 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ /**
3
+ * .what = a trail marker of a stitch
4
+ */
5
+ export interface StitchTrailMarker {
6
+ stitchUuid: string;
7
+ stitcherSlug: string;
8
+ }
9
+ export declare class StitchTrailMarker extends DomainLiteral<StitchTrailMarker> implements StitchTrailMarker {
10
+ }
11
+ /**
12
+ * .what = a trail of references to stitches that were set
13
+ */
14
+ export type StitchTrail = StitchTrailMarker[];
15
+ /**
16
+ * .what = a grokable description of the trail
17
+ */
18
+ export type StitchTrailDesc = string;
19
+ /**
20
+ * .what = converts a stitch trail into a human-readable description
21
+ * .why = used for logging and debugging
22
+ * .format = joined list of stitcher slugs, e.g., "@root(3126498) > @pick-color(1234567) > @match-paint(7351395)"
23
+ */
24
+ export declare const asStitchTrailDesc: (input: {
25
+ trail: StitchTrail;
26
+ }) => StitchTrailDesc;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asStitchTrailDesc = exports.StitchTrailMarker = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class StitchTrailMarker extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.StitchTrailMarker = StitchTrailMarker;
8
+ /**
9
+ * .what = converts a stitch trail into a human-readable description
10
+ * .why = used for logging and debugging
11
+ * .format = joined list of stitcher slugs, e.g., "@root(3126498) > @pick-color(1234567) > @match-paint(7351395)"
12
+ */
13
+ const asStitchTrailDesc = (input) => {
14
+ return input.trail
15
+ .map((marker) => `@${marker.stitcherSlug}(${marker.stitchUuid.slice(0, 7)})`)
16
+ .join(' > ');
17
+ };
18
+ exports.asStitchTrailDesc = asStitchTrailDesc;
19
+ //# sourceMappingURL=StitchTrail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StitchTrail.js","sourceRoot":"","sources":["../../../src/domain/objects/StitchTrail.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAS/C,MAAa,iBACX,SAAQ,8BAAgC;CACT;AAFjC,8CAEiC;AAYjC;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAEjC,EAAmB,EAAE;IACpB,OAAO,KAAK,CAAC,KAAK;SACf,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CACxE;SACA,IAAI,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
@@ -0,0 +1,105 @@
1
+ import { ContextLogTrail } from 'as-procedure';
2
+ import { Literalize } from 'type-fns';
3
+ import { ContextStitchTrail } from '../../logic/stitch/withStitchTrail';
4
+ import { StitchChoice } from './StitchChoice';
5
+ import { StitchCycle } from './StitchCycle';
6
+ import { StitchFanout } from './StitchFanout';
7
+ import { StitchRoute } from './StitchRoute';
8
+ import { StitchStep } from './StitchStep';
9
+ import { Threads } from './Threads';
10
+ /**
11
+ * .what = the common generics of a stitcher
12
+ */
13
+ export type GStitcher<TThreads extends Threads<any, any> = Threads<any, 'single'>, TContext extends ContextLogTrail & ContextStitchTrail = ContextLogTrail & ContextStitchTrail, TOutput = any> = {
14
+ threads: TThreads;
15
+ context: TContext;
16
+ output: TOutput;
17
+ };
18
+ /**
19
+ * .what = the canonical set of stitcher forms
20
+ */
21
+ export declare enum StitcherForm {
22
+ /**
23
+ * .what = a stitch step executed via computation of procedural logic
24
+ */
25
+ COMPUTE = "COMPUTE",
26
+ /**
27
+ * .what = a stitch step executed via imagination of an llm
28
+ */
29
+ IMAGINE = "IMAGINE",
30
+ /**
31
+ * .what = a stitch combo via linear sequence
32
+ */
33
+ ROUTE = "ROUTE",
34
+ /**
35
+ * .what = a stitch combo via parallel fanout + fanin
36
+ */
37
+ FANOUT = "FANOUT",
38
+ /**
39
+ * .what = a stitch combo via conditional stitcher selection
40
+ */
41
+ CHOICE = "CHOICE",
42
+ /**
43
+ * .what = a stitch combo via repetition of stitchers
44
+ */
45
+ CYCLE = "CYCLE",
46
+ /**
47
+ * .what = a stitch combo which gracefully awaits some condition to be satisfied
48
+ */
49
+ AWAIT = "AWAIT"
50
+ }
51
+ export declare const isOfStitcherForm: import("type-fns").AssessWithAssure<string | number | symbol, StitcherForm>;
52
+ /**
53
+ * .what = a generic stitcher which can be executed
54
+ * .why =
55
+ * - generalizes references to atomic StitchSteps or composite StitchRoutes, StitchFanouts, etc
56
+ * - enables universal, recursive operations against both atomic and composite stitchers, since their contracts are the same
57
+ * - guarantees `.form` is defined for all stitcher types to enable disambiguation via runtime narrowage
58
+ */
59
+ export type Stitcher<T extends GStitcher<Threads<any, 'single'>, any, any> = GStitcher<Threads<any, 'single'>, any, any>> = StitcherBase<StitcherForm> & (StitchStep<T> | StitchRoute<T> | StitchFanout<T> | StitchChoice<T> | StitchCycle<T>);
60
+ /**
61
+ * .what = an extensible base declaration of a stitcher
62
+ * .why =
63
+ * - ensures all stitchers will conform to desired standards
64
+ */
65
+ export interface StitcherBase<TForm extends StitcherForm> {
66
+ /**
67
+ * .what = used to disambiguate and narrow which shape of stitcher it is
68
+ */
69
+ form: Literalize<TForm>;
70
+ /**
71
+ * .what = a unique identifier for this particular stitcher
72
+ * .why =
73
+ * - enables traces via trail markers
74
+ * - enables unique key references and equality comparisons
75
+ */
76
+ slug: string;
77
+ /**
78
+ * .what = a human readable description of the step
79
+ */
80
+ readme: string | null;
81
+ }
82
+ /**
83
+ * .what = an observable description of a stitcher
84
+ * .why =
85
+ * - used to summarize a stitcher
86
+ * .note =
87
+ * - the readme will often be truncated to top 210 char. goal = max(signal to noise)!
88
+ */
89
+ export type StitcherDesc<TForm extends StitcherForm> = Pick<StitcherBase<TForm>, 'slug' | 'readme' | 'form'>;
90
+ /**
91
+ * .what = converts a full stitcher into a StitcherDesc
92
+ * .why = used for observability and trail markers
93
+ */
94
+ export declare const asStitcherDesc: <TStitcher extends StitcherBase<any>>(input: {
95
+ stitcher: TStitcher;
96
+ }) => StitcherDesc<TStitcher['form']>;
97
+ /**
98
+ * .what = extracts the GStitcher generic from a Stitcher
99
+ * .why = enables typed access to threads, context, and output shape of a Stitcher instance
100
+ */
101
+ export type GStitcherOf<T> = [T] extends [Stitcher<infer G>] ? G : never;
102
+ /**
103
+ * .what = flattens a gstitcher's type declaration
104
+ */
105
+ export type GStitcherFlat<T> = T extends GStitcher<infer Threads, infer Context, infer Output> ? GStitcher<Threads, Context, Output> : never;