repoburg 1.0.38 → 1.0.40

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 (218) hide show
  1. package/backend/.env +1 -7
  2. package/backend/coverage/clover.xml +3380 -0
  3. package/backend/coverage/coverage-final.json +117 -0
  4. package/backend/coverage/lcov-report/base.css +224 -0
  5. package/backend/coverage/lcov-report/block-navigation.js +87 -0
  6. package/backend/coverage/lcov-report/favicon.png +0 -0
  7. package/backend/coverage/lcov-report/index.html +686 -0
  8. package/backend/coverage/lcov-report/prettify.css +1 -0
  9. package/backend/coverage/lcov-report/prettify.js +2 -0
  10. package/backend/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/backend/coverage/lcov-report/sorter.js +196 -0
  12. package/backend/coverage/lcov-report/src/action-execution/action-execution.module.ts.html +109 -0
  13. package/backend/coverage/lcov-report/src/action-execution/action-execution.service.ts.html +370 -0
  14. package/backend/coverage/lcov-report/src/action-execution/index.html +131 -0
  15. package/backend/coverage/lcov-report/src/ai-actions/ai-action-batch.service.ts.html +940 -0
  16. package/backend/coverage/lcov-report/src/ai-actions/ai-action-creation.service.ts.html +1195 -0
  17. package/backend/coverage/lcov-report/src/ai-actions/ai-actions.controller.ts.html +664 -0
  18. package/backend/coverage/lcov-report/src/ai-actions/ai-actions.module.ts.html +154 -0
  19. package/backend/coverage/lcov-report/src/ai-actions/ai-actions.service.ts.html +859 -0
  20. package/backend/coverage/lcov-report/src/ai-actions/index.html +176 -0
  21. package/backend/coverage/lcov-report/src/app.controller.ts.html +151 -0
  22. package/backend/coverage/lcov-report/src/app.module.ts.html +370 -0
  23. package/backend/coverage/lcov-report/src/app.service.ts.html +163 -0
  24. package/backend/coverage/lcov-report/src/application-state/application-state.controller.ts.html +265 -0
  25. package/backend/coverage/lcov-report/src/application-state/application-state.module.ts.html +124 -0
  26. package/backend/coverage/lcov-report/src/application-state/application-state.service.ts.html +394 -0
  27. package/backend/coverage/lcov-report/src/application-state/dto/index.html +146 -0
  28. package/backend/coverage/lcov-report/src/application-state/dto/set-auto-context-fetch-enabled.dto.ts.html +103 -0
  29. package/backend/coverage/lcov-report/src/application-state/dto/set-theme.dto.ts.html +106 -0
  30. package/backend/coverage/lcov-report/src/application-state/dto/set-websocket-enabled.dto.ts.html +103 -0
  31. package/backend/coverage/lcov-report/src/application-state/index.html +146 -0
  32. package/backend/coverage/lcov-report/src/context-generation/context-generation.module.ts.html +118 -0
  33. package/backend/coverage/lcov-report/src/context-generation/context-generation.service.ts.html +1348 -0
  34. package/backend/coverage/lcov-report/src/context-generation/index.html +131 -0
  35. package/backend/coverage/lcov-report/src/context-snippets/context-snippets.controller.ts.html +289 -0
  36. package/backend/coverage/lcov-report/src/context-snippets/context-snippets.module.ts.html +136 -0
  37. package/backend/coverage/lcov-report/src/context-snippets/context-snippets.service.ts.html +400 -0
  38. package/backend/coverage/lcov-report/src/context-snippets/dto/context-snippet.dto.ts.html +211 -0
  39. package/backend/coverage/lcov-report/src/context-snippets/dto/index.html +116 -0
  40. package/backend/coverage/lcov-report/src/context-snippets/index.html +146 -0
  41. package/backend/coverage/lcov-report/src/context-templates/context-templates.controller.ts.html +397 -0
  42. package/backend/coverage/lcov-report/src/context-templates/context-templates.module.ts.html +136 -0
  43. package/backend/coverage/lcov-report/src/context-templates/context-templates.service.ts.html +832 -0
  44. package/backend/coverage/lcov-report/src/context-templates/dto/context-template.dto.ts.html +358 -0
  45. package/backend/coverage/lcov-report/src/context-templates/dto/index.html +116 -0
  46. package/backend/coverage/lcov-report/src/context-templates/index.html +146 -0
  47. package/backend/coverage/lcov-report/src/core-entities/ai-action.entity.ts.html +241 -0
  48. package/backend/coverage/lcov-report/src/core-entities/application-state.entity.ts.html +115 -0
  49. package/backend/coverage/lcov-report/src/core-entities/base.entity.ts.html +145 -0
  50. package/backend/coverage/lcov-report/src/core-entities/context-snippet.entity.ts.html +130 -0
  51. package/backend/coverage/lcov-report/src/core-entities/context-template.entity.ts.html +223 -0
  52. package/backend/coverage/lcov-report/src/core-entities/custom-snippet.entity.ts.html +136 -0
  53. package/backend/coverage/lcov-report/src/core-entities/execution-log.entity.ts.html +157 -0
  54. package/backend/coverage/lcov-report/src/core-entities/index.html +281 -0
  55. package/backend/coverage/lcov-report/src/core-entities/index.ts.html +118 -0
  56. package/backend/coverage/lcov-report/src/core-entities/project.entity.ts.html +130 -0
  57. package/backend/coverage/lcov-report/src/core-entities/session-input.entity.ts.html +280 -0
  58. package/backend/coverage/lcov-report/src/core-entities/session.entity.ts.html +280 -0
  59. package/backend/coverage/lcov-report/src/core-entities/system-prompt.entity.ts.html +148 -0
  60. package/backend/coverage/lcov-report/src/custom-snippets/custom-snippets.controller.ts.html +277 -0
  61. package/backend/coverage/lcov-report/src/custom-snippets/custom-snippets.module.ts.html +124 -0
  62. package/backend/coverage/lcov-report/src/custom-snippets/custom-snippets.service.ts.html +304 -0
  63. package/backend/coverage/lcov-report/src/custom-snippets/dto/custom-snippet.dto.ts.html +205 -0
  64. package/backend/coverage/lcov-report/src/custom-snippets/dto/index.html +116 -0
  65. package/backend/coverage/lcov-report/src/custom-snippets/index.html +146 -0
  66. package/backend/coverage/lcov-report/src/events/events.gateway.ts.html +292 -0
  67. package/backend/coverage/lcov-report/src/events/events.module.ts.html +109 -0
  68. package/backend/coverage/lcov-report/src/events/index.html +131 -0
  69. package/backend/coverage/lcov-report/src/execution-logs/dto/execution-log.dto.ts.html +130 -0
  70. package/backend/coverage/lcov-report/src/execution-logs/dto/index.html +116 -0
  71. package/backend/coverage/lcov-report/src/execution-logs/execution-logs.controller.ts.html +130 -0
  72. package/backend/coverage/lcov-report/src/execution-logs/execution-logs.module.ts.html +124 -0
  73. package/backend/coverage/lcov-report/src/execution-logs/execution-logs.service.ts.html +238 -0
  74. package/backend/coverage/lcov-report/src/execution-logs/index.html +146 -0
  75. package/backend/coverage/lcov-report/src/http-exception.filter.ts.html +340 -0
  76. package/backend/coverage/lcov-report/src/index.html +191 -0
  77. package/backend/coverage/lcov-report/src/llm-response-parser/dto/ai-action.dto.ts.html +400 -0
  78. package/backend/coverage/lcov-report/src/llm-response-parser/dto/index.html +116 -0
  79. package/backend/coverage/lcov-report/src/llm-response-parser/errors/index.html +116 -0
  80. package/backend/coverage/lcov-report/src/llm-response-parser/errors/parsing.error.ts.html +118 -0
  81. package/backend/coverage/lcov-report/src/llm-response-parser/index.html +146 -0
  82. package/backend/coverage/lcov-report/src/llm-response-parser/llm-response-parser.module.ts.html +109 -0
  83. package/backend/coverage/lcov-report/src/llm-response-parser/llm-response-parser.service.ts.html +808 -0
  84. package/backend/coverage/lcov-report/src/llm-response-parser/parsing.constants.ts.html +139 -0
  85. package/backend/coverage/lcov-report/src/llm-responses/dto/index.html +116 -0
  86. package/backend/coverage/lcov-report/src/llm-responses/dto/submit-llm-response.dto.ts.html +172 -0
  87. package/backend/coverage/lcov-report/src/llm-responses/index.html +146 -0
  88. package/backend/coverage/lcov-report/src/llm-responses/llm-responses.controller.ts.html +154 -0
  89. package/backend/coverage/lcov-report/src/llm-responses/llm-responses.module.ts.html +163 -0
  90. package/backend/coverage/lcov-report/src/llm-responses/llm-responses.service.ts.html +766 -0
  91. package/backend/coverage/lcov-report/src/main.ts.html +382 -0
  92. package/backend/coverage/lcov-report/src/orchestration/dto/index.html +116 -0
  93. package/backend/coverage/lcov-report/src/orchestration/dto/orchestration.dto.ts.html +184 -0
  94. package/backend/coverage/lcov-report/src/orchestration/index.html +191 -0
  95. package/backend/coverage/lcov-report/src/orchestration/orchestration-fs.service.ts.html +478 -0
  96. package/backend/coverage/lcov-report/src/orchestration/orchestration-parser.service.ts.html +310 -0
  97. package/backend/coverage/lcov-report/src/orchestration/orchestration.controller.ts.html +436 -0
  98. package/backend/coverage/lcov-report/src/orchestration/orchestration.module.ts.html +172 -0
  99. package/backend/coverage/lcov-report/src/orchestration/orchestration.service.ts.html +1201 -0
  100. package/backend/coverage/lcov-report/src/orchestration/orchestration.types.ts.html +169 -0
  101. package/backend/coverage/lcov-report/src/projects/dto/index.html +116 -0
  102. package/backend/coverage/lcov-report/src/projects/dto/project.dto.ts.html +154 -0
  103. package/backend/coverage/lcov-report/src/projects/index.html +146 -0
  104. package/backend/coverage/lcov-report/src/projects/projects.controller.ts.html +232 -0
  105. package/backend/coverage/lcov-report/src/projects/projects.module.ts.html +124 -0
  106. package/backend/coverage/lcov-report/src/projects/projects.service.ts.html +223 -0
  107. package/backend/coverage/lcov-report/src/seeding/context-template-seeding.service.ts.html +355 -0
  108. package/backend/coverage/lcov-report/src/seeding/custom-snippet-seeding.service.ts.html +271 -0
  109. package/backend/coverage/lcov-report/src/seeding/data/context-templates/default-followup_ad-hoc-focused-context.ts.html +136 -0
  110. package/backend/coverage/lcov-report/src/seeding/data/context-templates/default-initial_condensed-project-context.ts.html +148 -0
  111. package/backend/coverage/lcov-report/src/seeding/data/context-templates/default-initial_full-project-context.ts.html +247 -0
  112. package/backend/coverage/lcov-report/src/seeding/data/context-templates/index.html +191 -0
  113. package/backend/coverage/lcov-report/src/seeding/data/context-templates/pm-context.ts.html +250 -0
  114. package/backend/coverage/lcov-report/src/seeding/data/context-templates/pr-description.ts.html +187 -0
  115. package/backend/coverage/lcov-report/src/seeding/data/context-templates/sample_focused-tree.ts.html +124 -0
  116. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/default_rglob.ts.html +94 -0
  117. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/git-diff.ts.html +94 -0
  118. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/index.html +236 -0
  119. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/rg-exclude.ts.html +94 -0
  120. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/rg-search-glob.ts.html +94 -0
  121. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/rg-search.ts.html +94 -0
  122. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/run-command.ts.html +94 -0
  123. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/tree.ts.html +94 -0
  124. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/usr-adhoc-incl.ts.html +100 -0
  125. package/backend/coverage/lcov-report/src/seeding/data/custom-snippets/usr-input-incl.ts.html +94 -0
  126. package/backend/coverage/lcov-report/src/seeding/data/system-prompts/codebase-explorer.ts.html +331 -0
  127. package/backend/coverage/lcov-report/src/seeding/data/system-prompts/default_multi-file-action-generator-with-requester.ts.html +670 -0
  128. package/backend/coverage/lcov-report/src/seeding/data/system-prompts/index.html +161 -0
  129. package/backend/coverage/lcov-report/src/seeding/data/system-prompts/multi-file-action-generator.ts.html +550 -0
  130. package/backend/coverage/lcov-report/src/seeding/data/system-prompts/packup.ts.html +184 -0
  131. package/backend/coverage/lcov-report/src/seeding/index.html +176 -0
  132. package/backend/coverage/lcov-report/src/seeding/seeding.module.ts.html +145 -0
  133. package/backend/coverage/lcov-report/src/seeding/seeding.service.ts.html +151 -0
  134. package/backend/coverage/lcov-report/src/seeding/system-prompt-seeding.service.ts.html +289 -0
  135. package/backend/coverage/lcov-report/src/session-followup/index.html +131 -0
  136. package/backend/coverage/lcov-report/src/session-followup/session-followup.module.ts.html +130 -0
  137. package/backend/coverage/lcov-report/src/session-followup/session-followup.service.ts.html +667 -0
  138. package/backend/coverage/lcov-report/src/session-inputs/dto/index.html +116 -0
  139. package/backend/coverage/lcov-report/src/session-inputs/dto/session-input.dto.ts.html +235 -0
  140. package/backend/coverage/lcov-report/src/session-inputs/index.html +161 -0
  141. package/backend/coverage/lcov-report/src/session-inputs/session-input-context.service.ts.html +751 -0
  142. package/backend/coverage/lcov-report/src/session-inputs/session-inputs.controller.ts.html +337 -0
  143. package/backend/coverage/lcov-report/src/session-inputs/session-inputs.module.ts.html +202 -0
  144. package/backend/coverage/lcov-report/src/session-inputs/session-inputs.service.ts.html +1615 -0
  145. package/backend/coverage/lcov-report/src/session-transfer/index.html +131 -0
  146. package/backend/coverage/lcov-report/src/session-transfer/session-transfer.module.ts.html +172 -0
  147. package/backend/coverage/lcov-report/src/session-transfer/session-transfer.service.ts.html +574 -0
  148. package/backend/coverage/lcov-report/src/sessions/dto/index.html +116 -0
  149. package/backend/coverage/lcov-report/src/sessions/dto/session.dto.ts.html +340 -0
  150. package/backend/coverage/lcov-report/src/sessions/index.html +146 -0
  151. package/backend/coverage/lcov-report/src/sessions/sessions.controller.ts.html +457 -0
  152. package/backend/coverage/lcov-report/src/sessions/sessions.module.ts.html +214 -0
  153. package/backend/coverage/lcov-report/src/sessions/sessions.service.ts.html +844 -0
  154. package/backend/coverage/lcov-report/src/system-prompts/dto/index.html +116 -0
  155. package/backend/coverage/lcov-report/src/system-prompts/dto/system-prompt.dto.ts.html +208 -0
  156. package/backend/coverage/lcov-report/src/system-prompts/index.html +146 -0
  157. package/backend/coverage/lcov-report/src/system-prompts/system-prompts.controller.ts.html +298 -0
  158. package/backend/coverage/lcov-report/src/system-prompts/system-prompts.module.ts.html +127 -0
  159. package/backend/coverage/lcov-report/src/system-prompts/system-prompts.service.ts.html +352 -0
  160. package/backend/coverage/lcov-report/src/timeout.interceptor.ts.html +178 -0
  161. package/backend/coverage/lcov-report/src/workspace/dto/index.html +116 -0
  162. package/backend/coverage/lcov-report/src/workspace/dto/search-workspace.dto.ts.html +193 -0
  163. package/backend/coverage/lcov-report/src/workspace/index.html +146 -0
  164. package/backend/coverage/lcov-report/src/workspace/workspace.controller.ts.html +247 -0
  165. package/backend/coverage/lcov-report/src/workspace/workspace.module.ts.html +121 -0
  166. package/backend/coverage/lcov-report/src/workspace/workspace.service.ts.html +700 -0
  167. package/backend/coverage/lcov.info +5492 -0
  168. package/backend/dist/ai-actions/ai-action-creation.service.d.ts +2 -0
  169. package/backend/dist/ai-actions/ai-action-creation.service.js +65 -0
  170. package/backend/dist/ai-actions/ai-action-creation.service.js.map +1 -1
  171. package/backend/dist/app.module.js +2 -0
  172. package/backend/dist/app.module.js.map +1 -1
  173. package/backend/dist/application-state/application-state.service.d.ts +4 -0
  174. package/backend/dist/application-state/application-state.service.js +25 -0
  175. package/backend/dist/application-state/application-state.service.js.map +1 -1
  176. package/backend/dist/context-templates/context-templates.service.d.ts +1 -0
  177. package/backend/dist/context-templates/context-templates.service.js +3 -0
  178. package/backend/dist/context-templates/context-templates.service.js.map +1 -1
  179. package/backend/dist/llm-responses/llm-responses.module.js +4 -1
  180. package/backend/dist/llm-responses/llm-responses.module.js.map +1 -1
  181. package/backend/dist/llm-responses/llm-responses.service.d.ts +3 -1
  182. package/backend/dist/llm-responses/llm-responses.service.js +29 -2
  183. package/backend/dist/llm-responses/llm-responses.service.js.map +1 -1
  184. package/backend/dist/orchestration/dto/orchestration.dto.d.ts +15 -0
  185. package/backend/dist/orchestration/dto/orchestration.dto.js +58 -0
  186. package/backend/dist/orchestration/dto/orchestration.dto.js.map +1 -0
  187. package/backend/dist/orchestration/orchestration-fs.service.d.ts +18 -0
  188. package/backend/dist/orchestration/orchestration-fs.service.js +124 -0
  189. package/backend/dist/orchestration/orchestration-fs.service.js.map +1 -0
  190. package/backend/dist/orchestration/orchestration-parser.service.d.ts +16 -0
  191. package/backend/dist/orchestration/orchestration-parser.service.js +78 -0
  192. package/backend/dist/orchestration/orchestration-parser.service.js.map +1 -0
  193. package/backend/dist/orchestration/orchestration.controller.d.ts +28 -0
  194. package/backend/dist/orchestration/orchestration.controller.js +158 -0
  195. package/backend/dist/orchestration/orchestration.controller.js.map +1 -0
  196. package/backend/dist/orchestration/orchestration.module.d.ts +2 -0
  197. package/backend/dist/orchestration/orchestration.module.js +43 -0
  198. package/backend/dist/orchestration/orchestration.module.js.map +1 -0
  199. package/backend/dist/orchestration/orchestration.service.d.ts +38 -0
  200. package/backend/dist/orchestration/orchestration.service.js +301 -0
  201. package/backend/dist/orchestration/orchestration.service.js.map +1 -0
  202. package/backend/dist/orchestration/orchestration.types.d.ts +27 -0
  203. package/backend/dist/orchestration/orchestration.types.js +20 -0
  204. package/backend/dist/orchestration/orchestration.types.js.map +1 -0
  205. package/backend/dist/seeding/data/system-prompts/packup.d.ts +2 -0
  206. package/backend/dist/seeding/data/system-prompts/packup.js +37 -0
  207. package/backend/dist/seeding/data/system-prompts/packup.js.map +1 -0
  208. package/backend/dist/session-inputs/session-inputs.module.js +2 -0
  209. package/backend/dist/session-inputs/session-inputs.module.js.map +1 -1
  210. package/backend/dist/session-inputs/session-inputs.service.d.ts +3 -1
  211. package/backend/dist/session-inputs/session-inputs.service.js +13 -2
  212. package/backend/dist/session-inputs/session-inputs.service.js.map +1 -1
  213. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  214. package/backend/orchestration-test-2.txt +1 -0
  215. package/backend/orchestration-test.txt +1 -0
  216. package/backend/package.json +1 -1
  217. package/orchestration-test.txt +3 -0
  218. package/package.json +1 -1
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var OrchestrationFsService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.OrchestrationFsService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const fs = require("fs/promises");
16
+ const path = require("path");
17
+ let OrchestrationFsService = OrchestrationFsService_1 = class OrchestrationFsService {
18
+ constructor() {
19
+ this.logger = new common_1.Logger(OrchestrationFsService_1.name);
20
+ this.projectRoot = process.env.REPOBURG_PROJECT_PATH || process.cwd();
21
+ this.orchestrationsDir = path.join(this.projectRoot, '.repoburg', 'orchestrations');
22
+ this.ensureOrchestrationsDirExists();
23
+ }
24
+ async ensureOrchestrationsDirExists() {
25
+ try {
26
+ await fs.mkdir(this.orchestrationsDir, { recursive: true });
27
+ }
28
+ catch (error) {
29
+ this.logger.error(`Failed to create orchestrations directory at ${this.orchestrationsDir}`, error.stack);
30
+ }
31
+ }
32
+ getScriptPath(name) {
33
+ return path.join(this.orchestrationsDir, `${name}.elf`);
34
+ }
35
+ getTaskFilePath(name) {
36
+ return path.join(this.orchestrationsDir, `${name}.md`);
37
+ }
38
+ async listScripts() {
39
+ const entries = await fs.readdir(this.orchestrationsDir, {
40
+ withFileTypes: true,
41
+ });
42
+ const elfFiles = entries
43
+ .filter((e) => e.isFile() && e.name.endsWith('.elf'))
44
+ .map((e) => e.name.replace(/\.elf$/, ''));
45
+ const scripts = await Promise.all(elfFiles.map(async (name) => {
46
+ const taskFileContent = await this.readTaskFile(name);
47
+ return { name, taskFileContent };
48
+ }));
49
+ return scripts;
50
+ }
51
+ async readScript(name) {
52
+ const scriptPath = this.getScriptPath(name);
53
+ try {
54
+ return await fs.readFile(scriptPath, 'utf-8');
55
+ }
56
+ catch (error) {
57
+ if (error.code === 'ENOENT') {
58
+ this.logger.log(`Script "${name}.elf" not found at path: ${scriptPath}`);
59
+ }
60
+ else {
61
+ this.logger.error(`Failed to read script: ${scriptPath}`, error.stack);
62
+ }
63
+ throw new common_1.NotFoundException(`Script "${name}.elf" not found.`);
64
+ }
65
+ }
66
+ async readTaskFile(name) {
67
+ const taskFilePath = this.getTaskFilePath(name);
68
+ try {
69
+ return await fs.readFile(taskFilePath, 'utf-8');
70
+ }
71
+ catch (error) {
72
+ if (error.code === 'ENOENT') {
73
+ return '';
74
+ }
75
+ this.logger.error(`Failed to read task file: ${taskFilePath}`, error.stack);
76
+ throw error;
77
+ }
78
+ }
79
+ async writeScript(name, scriptContent, taskFileContent) {
80
+ await fs.writeFile(this.getScriptPath(name), scriptContent, 'utf-8');
81
+ await fs.writeFile(this.getTaskFilePath(name), taskFileContent, 'utf-8');
82
+ }
83
+ async deleteScript(name) {
84
+ await fs.unlink(this.getScriptPath(name));
85
+ try {
86
+ await fs.unlink(this.getTaskFilePath(name));
87
+ }
88
+ catch (error) {
89
+ if (error.code !== 'ENOENT')
90
+ throw error;
91
+ }
92
+ }
93
+ async updateTaskStatus(scriptName, taskContent, isDone) {
94
+ const taskFilePath = this.getTaskFilePath(scriptName);
95
+ const content = await this.readTaskFile(scriptName);
96
+ const lines = content.split('\n');
97
+ const normalizedTaskContent = taskContent.replace(/\s+/g, ' ').trim();
98
+ const taskLineIndex = lines.findIndex((line) => {
99
+ const normalizedLine = line
100
+ .replace(/^\[[ x]\]\s*/, '')
101
+ .replace(/\s+/g, ' ')
102
+ .trim();
103
+ return normalizedLine === normalizedTaskContent;
104
+ });
105
+ if (taskLineIndex === -1) {
106
+ this.logger.warn(`Could not find task line for "${taskContent.substring(0, 100)}" in ${taskFilePath}`);
107
+ return;
108
+ }
109
+ const line = lines[taskLineIndex];
110
+ if (isDone) {
111
+ lines[taskLineIndex] = line.replace('[ ]', '[x]');
112
+ }
113
+ else {
114
+ lines[taskLineIndex] = line.replace('[x]', '[ ]');
115
+ }
116
+ await fs.writeFile(taskFilePath, lines.join('\n'), 'utf-8');
117
+ }
118
+ };
119
+ exports.OrchestrationFsService = OrchestrationFsService;
120
+ exports.OrchestrationFsService = OrchestrationFsService = OrchestrationFsService_1 = __decorate([
121
+ (0, common_1.Injectable)(),
122
+ __metadata("design:paramtypes", [])
123
+ ], OrchestrationFsService);
124
+ //# sourceMappingURL=orchestration-fs.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration-fs.service.js","sourceRoot":"","sources":["../../src/orchestration/orchestration-fs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAuE;AACvE,kCAAkC;AAClC,6BAA6B;AAGtB,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAUjC;QATiB,WAAM,GAAG,IAAI,eA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GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI;iBACxB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;iBAC3B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;iBACpB,IAAI,EAAE,CAAC;YACV,OAAO,cAAc,KAAK,qBAAqB,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,iCAAiC,WAAW,CAAC,SAAS,CACpD,CAAC,EACD,GAAG,CACJ,QAAQ,YAAY,EAAE,CACxB,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;QAClC,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA1IY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;;GACA,sBAAsB,CA0IlC"}
@@ -0,0 +1,16 @@
1
+ import { OrchestrationFsService } from './orchestration-fs.service';
2
+ export interface Command {
3
+ type: 'set_initial_context' | 'send_and_wait';
4
+ value: string;
5
+ originalLine: string;
6
+ }
7
+ export declare class OrchestrationParserService {
8
+ private readonly fsService;
9
+ private readonly logger;
10
+ constructor(fsService: OrchestrationFsService);
11
+ parseScript(scriptContent: string): Promise<Command[]>;
12
+ findResumeState(scriptName: string, allCommands: Command[]): Promise<{
13
+ commandIndex: number;
14
+ taskStepCounter: number;
15
+ }>;
16
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var OrchestrationParserService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.OrchestrationParserService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const orchestration_fs_service_1 = require("./orchestration-fs.service");
16
+ let OrchestrationParserService = OrchestrationParserService_1 = class OrchestrationParserService {
17
+ constructor(fsService) {
18
+ this.fsService = fsService;
19
+ this.logger = new common_1.Logger(OrchestrationParserService_1.name);
20
+ }
21
+ async parseScript(scriptContent) {
22
+ const commands = [];
23
+ const contentWithoutComments = scriptContent
24
+ .split('\n')
25
+ .map((line) => line.replace(/#.*$/, ''))
26
+ .join('\n');
27
+ const commandRegex = /(set_initial_context\((['"])(.*?)\2\)|send_and_wait\(([`'"])([\s\S]*?)\4\))/g;
28
+ let match;
29
+ while ((match = commandRegex.exec(contentWithoutComments)) !== null) {
30
+ const fullMatch = match[1];
31
+ const value = (match[3] || match[5]).trim();
32
+ if (fullMatch.startsWith('set_initial_context')) {
33
+ commands.push({
34
+ type: 'set_initial_context',
35
+ value: value,
36
+ originalLine: fullMatch,
37
+ });
38
+ }
39
+ else if (fullMatch.startsWith('send_and_wait')) {
40
+ commands.push({
41
+ type: 'send_and_wait',
42
+ value: value,
43
+ originalLine: fullMatch,
44
+ });
45
+ }
46
+ }
47
+ return commands;
48
+ }
49
+ async findResumeState(scriptName, allCommands) {
50
+ const taskFileContent = await this.fsService.readTaskFile(scriptName);
51
+ const taskLines = taskFileContent
52
+ .split('\n')
53
+ .filter((line) => line.trim().startsWith('['));
54
+ const firstUncheckedIndex = taskLines.findIndex((line) => line.trim().startsWith('[ ]'));
55
+ const resumeTaskIndex = firstUncheckedIndex === -1 ? taskLines.length : firstUncheckedIndex;
56
+ if (resumeTaskIndex === 0) {
57
+ return { commandIndex: 0, taskStepCounter: 0 };
58
+ }
59
+ let commandIndex = 0;
60
+ let sendAndWaitCount = 0;
61
+ for (let i = 0; i < allCommands.length; i++) {
62
+ if (allCommands[i].type === 'send_and_wait') {
63
+ sendAndWaitCount++;
64
+ }
65
+ if (sendAndWaitCount === resumeTaskIndex) {
66
+ commandIndex = i + 1;
67
+ break;
68
+ }
69
+ }
70
+ return { commandIndex, taskStepCounter: resumeTaskIndex };
71
+ }
72
+ };
73
+ exports.OrchestrationParserService = OrchestrationParserService;
74
+ exports.OrchestrationParserService = OrchestrationParserService = OrchestrationParserService_1 = __decorate([
75
+ (0, common_1.Injectable)(),
76
+ __metadata("design:paramtypes", [orchestration_fs_service_1.OrchestrationFsService])
77
+ ], OrchestrationParserService);
78
+ //# sourceMappingURL=orchestration-parser.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration-parser.service.js","sourceRoot":"","sources":["../../src/orchestration/orchestration-parser.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yEAAoE;AAS7D,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAGrC,YAA6B,SAAiC;QAAjC,cAAS,GAAT,SAAS,CAAwB;QAF7C,WAAM,GAAG,IAAI,eAAM,CAAC,4BAA0B,CAAC,IAAI,CAAC,CAAC;IAEL,CAAC;IAElE,KAAK,C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AI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,mBAAmB,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CACvD,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAC9B,CAAC;QACF,MAAM,eAAe,GACnB,mBAAmB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC;QAEtE,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;QACjD,CAAC;QAED,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,gBAAgB,GAAG,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;gBAC5C,gBAAgB,EAAE,CAAC;YACrB,CAAC;YACD,IAAI,gBAAgB,KAAK,eAAe,EAAE,CAAC;gBACzC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC;gBACrB,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;IAC5D,CAAC;CACF,CAAA;AArEY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAI6B,iDAAsB;GAHnD,0BAA0B,CAqEtC"}
@@ -0,0 +1,28 @@
1
+ import { OrchestrationService } from './orchestration.service';
2
+ import { OrchestrationFsService } from './orchestration-fs.service';
3
+ import { CreateOrchestrationScriptDto, StartOrchestrationDto, UpdateOrchestrationScriptDto } from './dto/orchestration.dto';
4
+ import { Response } from 'express';
5
+ export declare class OrchestrationController {
6
+ private readonly orchestrationService;
7
+ private readonly fsService;
8
+ constructor(orchestrationService: OrchestrationService, fsService: OrchestrationFsService);
9
+ listScripts(): Promise<{
10
+ scripts: {
11
+ name: string;
12
+ taskFileContent: string;
13
+ }[];
14
+ }>;
15
+ getScript(scriptName: string): Promise<{
16
+ scriptContent: string;
17
+ taskFileContent: string;
18
+ }>;
19
+ createScript(dto: CreateOrchestrationScriptDto): Promise<void>;
20
+ updateScript(scriptName: string, dto: UpdateOrchestrationScriptDto): Promise<void>;
21
+ deleteScript(scriptName: string): Promise<void>;
22
+ getActiveRun(res: Response): Response<any, Record<string, any>>;
23
+ startRun(dto: StartOrchestrationDto): Promise<void>;
24
+ stopRun(): Promise<void>;
25
+ proceedRun(): Promise<void>;
26
+ emergencyStop(): Promise<void>;
27
+ clearRun(): Promise<void>;
28
+ }
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.OrchestrationController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const orchestration_service_1 = require("./orchestration.service");
18
+ const orchestration_fs_service_1 = require("./orchestration-fs.service");
19
+ const orchestration_dto_1 = require("./dto/orchestration.dto");
20
+ let OrchestrationController = class OrchestrationController {
21
+ constructor(orchestrationService, fsService) {
22
+ this.orchestrationService = orchestrationService;
23
+ this.fsService = fsService;
24
+ }
25
+ async listScripts() {
26
+ const scripts = await this.fsService.listScripts();
27
+ scripts.sort((a, b) => a.name.localeCompare(b.name));
28
+ return { scripts };
29
+ }
30
+ async getScript(scriptName) {
31
+ const [scriptContent, taskFileContent] = await Promise.all([
32
+ this.fsService.readScript(scriptName),
33
+ this.fsService.readTaskFile(scriptName),
34
+ ]);
35
+ return { scriptContent, taskFileContent };
36
+ }
37
+ async createScript(dto) {
38
+ return this.fsService.writeScript(dto.name, dto.scriptContent, dto.taskFileContent);
39
+ }
40
+ async updateScript(scriptName, dto) {
41
+ return this.fsService.writeScript(scriptName, dto.scriptContent, dto.taskFileContent);
42
+ }
43
+ async deleteScript(scriptName) {
44
+ return this.fsService.deleteScript(scriptName);
45
+ }
46
+ getActiveRun(res) {
47
+ const run = this.orchestrationService.getActiveRun();
48
+ if (run) {
49
+ return res.status(common_1.HttpStatus.OK).json(run);
50
+ }
51
+ else {
52
+ return res.status(common_1.HttpStatus.NO_CONTENT).send();
53
+ }
54
+ }
55
+ async startRun(dto) {
56
+ return this.orchestrationService.start(dto);
57
+ }
58
+ async stopRun() {
59
+ return this.orchestrationService.stop();
60
+ }
61
+ async proceedRun() {
62
+ return this.orchestrationService.proceed();
63
+ }
64
+ async emergencyStop() {
65
+ return this.orchestrationService.emergencyStop();
66
+ }
67
+ async clearRun() {
68
+ return this.orchestrationService.clearActiveRun();
69
+ }
70
+ };
71
+ exports.OrchestrationController = OrchestrationController;
72
+ __decorate([
73
+ (0, common_1.Get)(),
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", []),
76
+ __metadata("design:returntype", Promise)
77
+ ], OrchestrationController.prototype, "listScripts", null);
78
+ __decorate([
79
+ (0, common_1.Get)(':scriptName'),
80
+ __param(0, (0, common_1.Param)('scriptName')),
81
+ __metadata("design:type", Function),
82
+ __metadata("design:paramtypes", [String]),
83
+ __metadata("design:returntype", Promise)
84
+ ], OrchestrationController.prototype, "getScript", null);
85
+ __decorate([
86
+ (0, common_1.Post)(),
87
+ (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
88
+ __param(0, (0, common_1.Body)()),
89
+ __metadata("design:type", Function),
90
+ __metadata("design:paramtypes", [orchestration_dto_1.CreateOrchestrationScriptDto]),
91
+ __metadata("design:returntype", Promise)
92
+ ], OrchestrationController.prototype, "createScript", null);
93
+ __decorate([
94
+ (0, common_1.Put)(':scriptName'),
95
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
96
+ __param(0, (0, common_1.Param)('scriptName')),
97
+ __param(1, (0, common_1.Body)()),
98
+ __metadata("design:type", Function),
99
+ __metadata("design:paramtypes", [String, orchestration_dto_1.UpdateOrchestrationScriptDto]),
100
+ __metadata("design:returntype", Promise)
101
+ ], OrchestrationController.prototype, "updateScript", null);
102
+ __decorate([
103
+ (0, common_1.Delete)(':scriptName'),
104
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
105
+ __param(0, (0, common_1.Param)('scriptName')),
106
+ __metadata("design:type", Function),
107
+ __metadata("design:paramtypes", [String]),
108
+ __metadata("design:returntype", Promise)
109
+ ], OrchestrationController.prototype, "deleteScript", null);
110
+ __decorate([
111
+ (0, common_1.Get)('runs/active'),
112
+ __param(0, (0, common_1.Res)()),
113
+ __metadata("design:type", Function),
114
+ __metadata("design:paramtypes", [Object]),
115
+ __metadata("design:returntype", void 0)
116
+ ], OrchestrationController.prototype, "getActiveRun", null);
117
+ __decorate([
118
+ (0, common_1.Post)('runs/start'),
119
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
120
+ __param(0, (0, common_1.Body)()),
121
+ __metadata("design:type", Function),
122
+ __metadata("design:paramtypes", [orchestration_dto_1.StartOrchestrationDto]),
123
+ __metadata("design:returntype", Promise)
124
+ ], OrchestrationController.prototype, "startRun", null);
125
+ __decorate([
126
+ (0, common_1.Post)('runs/active/stop'),
127
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
128
+ __metadata("design:type", Function),
129
+ __metadata("design:paramtypes", []),
130
+ __metadata("design:returntype", Promise)
131
+ ], OrchestrationController.prototype, "stopRun", null);
132
+ __decorate([
133
+ (0, common_1.Post)('runs/active/proceed'),
134
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
135
+ __metadata("design:type", Function),
136
+ __metadata("design:paramtypes", []),
137
+ __metadata("design:returntype", Promise)
138
+ ], OrchestrationController.prototype, "proceedRun", null);
139
+ __decorate([
140
+ (0, common_1.Post)('runs/active/emergency-stop'),
141
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
142
+ __metadata("design:type", Function),
143
+ __metadata("design:paramtypes", []),
144
+ __metadata("design:returntype", Promise)
145
+ ], OrchestrationController.prototype, "emergencyStop", null);
146
+ __decorate([
147
+ (0, common_1.Post)('runs/active/clear'),
148
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
149
+ __metadata("design:type", Function),
150
+ __metadata("design:paramtypes", []),
151
+ __metadata("design:returntype", Promise)
152
+ ], OrchestrationController.prototype, "clearRun", null);
153
+ exports.OrchestrationController = OrchestrationController = __decorate([
154
+ (0, common_1.Controller)('orchestrations'),
155
+ __metadata("design:paramtypes", [orchestration_service_1.OrchestrationService,
156
+ orchestration_fs_service_1.OrchestrationFsService])
157
+ ], OrchestrationController);
158
+ //# sourceMappingURL=orchestration.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration.controller.js","sourceRoot":"","sources":["../../src/orchestration/orchestration.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAWwB;AACxB,mEAA+D;AAC/D,yEAAoE;AACpE,+DAIiC;AAI1B,IAAM,uBAAuB,GAA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arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OrchestrationModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const orchestration_service_1 = require("./orchestration.service");
12
+ const orchestration_controller_1 = require("./orchestration.controller");
13
+ const orchestration_fs_service_1 = require("./orchestration-fs.service");
14
+ const application_state_module_1 = require("../application-state/application-state.module");
15
+ const session_inputs_module_1 = require("../session-inputs/session-inputs.module");
16
+ const llm_responses_module_1 = require("../llm-responses/llm-responses.module");
17
+ const events_module_1 = require("../events/events.module");
18
+ const context_templates_module_1 = require("../context-templates/context-templates.module");
19
+ const sessions_module_1 = require("../sessions/sessions.module");
20
+ const orchestration_parser_service_1 = require("./orchestration-parser.service");
21
+ let OrchestrationModule = class OrchestrationModule {
22
+ };
23
+ exports.OrchestrationModule = OrchestrationModule;
24
+ exports.OrchestrationModule = OrchestrationModule = __decorate([
25
+ (0, common_1.Module)({
26
+ imports: [
27
+ application_state_module_1.ApplicationStateModule,
28
+ events_module_1.EventsModule,
29
+ context_templates_module_1.ContextTemplatesModule,
30
+ sessions_module_1.SessionsModule,
31
+ (0, common_1.forwardRef)(() => session_inputs_module_1.SessionInputsModule),
32
+ (0, common_1.forwardRef)(() => llm_responses_module_1.LlmResponsesModule),
33
+ ],
34
+ providers: [
35
+ orchestration_service_1.OrchestrationService,
36
+ orchestration_fs_service_1.OrchestrationFsService,
37
+ orchestration_parser_service_1.OrchestrationParserService,
38
+ ],
39
+ controllers: [orchestration_controller_1.OrchestrationController],
40
+ exports: [orchestration_service_1.OrchestrationService],
41
+ })
42
+ ], OrchestrationModule);
43
+ //# sourceMappingURL=orchestration.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration.module.js","sourceRoot":"","sources":["../../src/orchestration/orchestration.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,mEAA+D;AAC/D,yEAAqE;AACrE,yEAAoE;AACpE,4FAAuF;AACvF,mFAA8E;AAC9E,gFAA2E;AAC3E,2DAAuD;AACvD,4FAAuF;AACvF,iEAA6D;AAC7D,iFAA4E;AAmBrE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,kDAAmB;8BAAnB,mBAAmB;IAjB/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,iDAAsB;YACtB,4BAAY;YACZ,iDAAsB;YACtB,gCAAc;YACd,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;YACrC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yCAAkB,CAAC;SACrC;QACD,SAAS,EAAE;YACT,4CAAoB;YACpB,iDAAsB;YACtB,yDAA0B;SAC3B;QACD,WAAW,EAAE,CAAC,kDAAuB,CAAC;QACtC,OAAO,EAAE,CAAC,4CAAoB,CAAC;KAChC,CAAC;GACW,mBAAmB,CAAG"}
@@ -0,0 +1,38 @@
1
+ import { OrchestrationFsService } from './orchestration-fs.service';
2
+ import { ApplicationStateService } from '../application-state/application-state.service';
3
+ import { OrchestrationRunState } from './orchestration.types';
4
+ import { StartOrchestrationDto } from './dto/orchestration.dto';
5
+ import { EventsGateway } from '../events/events.gateway';
6
+ import { SessionInputsService } from '../session-inputs/session-inputs.service';
7
+ import { ContextTemplatesService } from '../context-templates/context-templates.service';
8
+ import { SessionsService } from '../sessions/sessions.service';
9
+ import { OrchestrationParserService } from './orchestration-parser.service';
10
+ export declare class OrchestrationService {
11
+ private readonly fsService;
12
+ private readonly appStateService;
13
+ private readonly eventsGateway;
14
+ private readonly parserService;
15
+ private readonly sessionInputsService;
16
+ private readonly contextTemplatesService;
17
+ private readonly sessionsService;
18
+ private readonly logger;
19
+ private activeRun;
20
+ private timeoutTimer;
21
+ private readonly TIMEOUT_MS;
22
+ constructor(fsService: OrchestrationFsService, appStateService: ApplicationStateService, eventsGateway: EventsGateway, parserService: OrchestrationParserService, sessionInputsService: SessionInputsService, contextTemplatesService: ContextTemplatesService, sessionsService: SessionsService);
23
+ private loadStateFromPersistence;
24
+ private setState;
25
+ private persistState;
26
+ private emitStatus;
27
+ private log;
28
+ getActiveRun(): OrchestrationRunState | null;
29
+ start(dto: StartOrchestrationDto): Promise<void>;
30
+ private execute;
31
+ onPromptPrepared(inputId: string): void;
32
+ stop(): Promise<void>;
33
+ proceed(): Promise<void>;
34
+ emergencyStop(): Promise<void>;
35
+ clearActiveRun(): Promise<void>;
36
+ resumeFromInput(inputId: string): Promise<void>;
37
+ fail(error: string): Promise<void>;
38
+ }