@specforge/mcp 2.6.0 → 3.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 (237) hide show
  1. package/README.md +73 -0
  2. package/bin/{specforge-mcp → specforge} +0 -5
  3. package/dist/ai-provider/circuit-breaker.d.ts +63 -0
  4. package/dist/ai-provider/circuit-breaker.d.ts.map +1 -0
  5. package/dist/ai-provider/circuit-breaker.js +160 -0
  6. package/dist/ai-provider/circuit-breaker.js.map +1 -0
  7. package/dist/ai-provider/cli-version.d.ts +50 -0
  8. package/dist/ai-provider/cli-version.d.ts.map +1 -0
  9. package/dist/ai-provider/cli-version.js +141 -0
  10. package/dist/ai-provider/cli-version.js.map +1 -0
  11. package/dist/ai-provider/config-loader.d.ts +45 -0
  12. package/dist/ai-provider/config-loader.d.ts.map +1 -0
  13. package/dist/ai-provider/config-loader.js +106 -0
  14. package/dist/ai-provider/config-loader.js.map +1 -0
  15. package/dist/ai-provider/errors.d.ts +48 -0
  16. package/dist/ai-provider/errors.d.ts.map +1 -0
  17. package/dist/ai-provider/errors.js +102 -0
  18. package/dist/ai-provider/errors.js.map +1 -0
  19. package/dist/ai-provider/events.d.ts +73 -0
  20. package/dist/ai-provider/events.d.ts.map +1 -0
  21. package/dist/ai-provider/events.js +75 -0
  22. package/dist/ai-provider/events.js.map +1 -0
  23. package/dist/ai-provider/factory.d.ts +31 -0
  24. package/dist/ai-provider/factory.d.ts.map +1 -0
  25. package/dist/ai-provider/factory.js +100 -0
  26. package/dist/ai-provider/factory.js.map +1 -0
  27. package/dist/ai-provider/index.d.ts +24 -0
  28. package/dist/ai-provider/index.d.ts.map +1 -0
  29. package/dist/ai-provider/index.js +46 -0
  30. package/dist/ai-provider/index.js.map +1 -0
  31. package/dist/ai-provider/instance-coordinator.d.ts +54 -0
  32. package/dist/ai-provider/instance-coordinator.d.ts.map +1 -0
  33. package/dist/ai-provider/instance-coordinator.js +199 -0
  34. package/dist/ai-provider/instance-coordinator.js.map +1 -0
  35. package/dist/ai-provider/jsonl-parser.d.ts +43 -0
  36. package/dist/ai-provider/jsonl-parser.d.ts.map +1 -0
  37. package/dist/ai-provider/jsonl-parser.js +107 -0
  38. package/dist/ai-provider/jsonl-parser.js.map +1 -0
  39. package/dist/ai-provider/lifecycle.d.ts +50 -0
  40. package/dist/ai-provider/lifecycle.d.ts.map +1 -0
  41. package/dist/ai-provider/lifecycle.js +145 -0
  42. package/dist/ai-provider/lifecycle.js.map +1 -0
  43. package/dist/ai-provider/logger.d.ts +69 -0
  44. package/dist/ai-provider/logger.d.ts.map +1 -0
  45. package/dist/ai-provider/logger.js +161 -0
  46. package/dist/ai-provider/logger.js.map +1 -0
  47. package/dist/ai-provider/metrics.d.ts +91 -0
  48. package/dist/ai-provider/metrics.d.ts.map +1 -0
  49. package/dist/ai-provider/metrics.js +187 -0
  50. package/dist/ai-provider/metrics.js.map +1 -0
  51. package/dist/ai-provider/process-manager.d.ts +97 -0
  52. package/dist/ai-provider/process-manager.d.ts.map +1 -0
  53. package/dist/ai-provider/process-manager.js +477 -0
  54. package/dist/ai-provider/process-manager.js.map +1 -0
  55. package/dist/ai-provider/providers/claude-code.d.ts +64 -0
  56. package/dist/ai-provider/providers/claude-code.d.ts.map +1 -0
  57. package/dist/ai-provider/providers/claude-code.js +205 -0
  58. package/dist/ai-provider/providers/claude-code.js.map +1 -0
  59. package/dist/ai-provider/retry-executor.d.ts +52 -0
  60. package/dist/ai-provider/retry-executor.d.ts.map +1 -0
  61. package/dist/ai-provider/retry-executor.js +138 -0
  62. package/dist/ai-provider/retry-executor.js.map +1 -0
  63. package/dist/ai-provider/safe-args.d.ts +58 -0
  64. package/dist/ai-provider/safe-args.d.ts.map +1 -0
  65. package/dist/ai-provider/safe-args.js +176 -0
  66. package/dist/ai-provider/safe-args.js.map +1 -0
  67. package/dist/ai-provider/semaphore.d.ts +50 -0
  68. package/dist/ai-provider/semaphore.d.ts.map +1 -0
  69. package/dist/ai-provider/semaphore.js +97 -0
  70. package/dist/ai-provider/semaphore.js.map +1 -0
  71. package/dist/ai-provider/tracer.d.ts +67 -0
  72. package/dist/ai-provider/tracer.d.ts.map +1 -0
  73. package/dist/ai-provider/tracer.js +209 -0
  74. package/dist/ai-provider/tracer.js.map +1 -0
  75. package/dist/ai-provider/types.d.ts +181 -0
  76. package/dist/ai-provider/types.d.ts.map +1 -0
  77. package/dist/ai-provider/types.js +8 -0
  78. package/dist/ai-provider/types.js.map +1 -0
  79. package/dist/autopilot/agents/agent-runner.d.ts +109 -0
  80. package/dist/autopilot/agents/agent-runner.d.ts.map +1 -0
  81. package/dist/autopilot/agents/agent-runner.js +731 -0
  82. package/dist/autopilot/agents/agent-runner.js.map +1 -0
  83. package/dist/autopilot/agents/agent-selector.d.ts +59 -0
  84. package/dist/autopilot/agents/agent-selector.d.ts.map +1 -0
  85. package/dist/autopilot/agents/agent-selector.js +234 -0
  86. package/dist/autopilot/agents/agent-selector.js.map +1 -0
  87. package/dist/autopilot/agents/model-selector.d.ts +49 -0
  88. package/dist/autopilot/agents/model-selector.d.ts.map +1 -0
  89. package/dist/autopilot/agents/model-selector.js +62 -0
  90. package/dist/autopilot/agents/model-selector.js.map +1 -0
  91. package/dist/autopilot/agents/profiles/builtin.d.ts +55 -0
  92. package/dist/autopilot/agents/profiles/builtin.d.ts.map +1 -0
  93. package/dist/autopilot/agents/profiles/builtin.js +323 -0
  94. package/dist/autopilot/agents/profiles/builtin.js.map +1 -0
  95. package/dist/autopilot/agents/profiles/types.d.ts +98 -0
  96. package/dist/autopilot/agents/profiles/types.d.ts.map +1 -0
  97. package/dist/autopilot/agents/profiles/types.js +17 -0
  98. package/dist/autopilot/agents/profiles/types.js.map +1 -0
  99. package/dist/autopilot/api/autopilot-api-client.d.ts +217 -0
  100. package/dist/autopilot/api/autopilot-api-client.d.ts.map +1 -0
  101. package/dist/autopilot/api/autopilot-api-client.js +402 -0
  102. package/dist/autopilot/api/autopilot-api-client.js.map +1 -0
  103. package/dist/autopilot/cli/abort.d.ts +20 -0
  104. package/dist/autopilot/cli/abort.d.ts.map +1 -0
  105. package/dist/autopilot/cli/abort.js +201 -0
  106. package/dist/autopilot/cli/abort.js.map +1 -0
  107. package/dist/autopilot/cli/display.d.ts +63 -0
  108. package/dist/autopilot/cli/display.d.ts.map +1 -0
  109. package/dist/autopilot/cli/display.js +260 -0
  110. package/dist/autopilot/cli/display.js.map +1 -0
  111. package/dist/autopilot/cli/index.d.ts +24 -0
  112. package/dist/autopilot/cli/index.d.ts.map +1 -0
  113. package/dist/autopilot/cli/index.js +79 -0
  114. package/dist/autopilot/cli/index.js.map +1 -0
  115. package/dist/autopilot/cli/pause.d.ts +18 -0
  116. package/dist/autopilot/cli/pause.d.ts.map +1 -0
  117. package/dist/autopilot/cli/pause.js +110 -0
  118. package/dist/autopilot/cli/pause.js.map +1 -0
  119. package/dist/autopilot/cli/resume.d.ts +22 -0
  120. package/dist/autopilot/cli/resume.d.ts.map +1 -0
  121. package/dist/autopilot/cli/resume.js +172 -0
  122. package/dist/autopilot/cli/resume.js.map +1 -0
  123. package/dist/autopilot/cli/run.d.ts +25 -0
  124. package/dist/autopilot/cli/run.d.ts.map +1 -0
  125. package/dist/autopilot/cli/run.js +220 -0
  126. package/dist/autopilot/cli/run.js.map +1 -0
  127. package/dist/autopilot/cli/status.d.ts +20 -0
  128. package/dist/autopilot/cli/status.d.ts.map +1 -0
  129. package/dist/autopilot/cli/status.js +217 -0
  130. package/dist/autopilot/cli/status.js.map +1 -0
  131. package/dist/autopilot/config.d.ts +45 -0
  132. package/dist/autopilot/config.d.ts.map +1 -0
  133. package/dist/autopilot/config.js +269 -0
  134. package/dist/autopilot/config.js.map +1 -0
  135. package/dist/autopilot/core/dependency-resolver.d.ts +108 -0
  136. package/dist/autopilot/core/dependency-resolver.d.ts.map +1 -0
  137. package/dist/autopilot/core/dependency-resolver.js +394 -0
  138. package/dist/autopilot/core/dependency-resolver.js.map +1 -0
  139. package/dist/autopilot/core/dispatcher.d.ts +215 -0
  140. package/dist/autopilot/core/dispatcher.d.ts.map +1 -0
  141. package/dist/autopilot/core/dispatcher.js +594 -0
  142. package/dist/autopilot/core/dispatcher.js.map +1 -0
  143. package/dist/autopilot/core/failure-handler.d.ts +145 -0
  144. package/dist/autopilot/core/failure-handler.d.ts.map +1 -0
  145. package/dist/autopilot/core/failure-handler.js +308 -0
  146. package/dist/autopilot/core/failure-handler.js.map +1 -0
  147. package/dist/autopilot/core/rate-limit-handler.d.ts +108 -0
  148. package/dist/autopilot/core/rate-limit-handler.d.ts.map +1 -0
  149. package/dist/autopilot/core/rate-limit-handler.js +195 -0
  150. package/dist/autopilot/core/rate-limit-handler.js.map +1 -0
  151. package/dist/autopilot/core/state-manager.d.ts +160 -0
  152. package/dist/autopilot/core/state-manager.d.ts.map +1 -0
  153. package/dist/autopilot/core/state-manager.js +393 -0
  154. package/dist/autopilot/core/state-manager.js.map +1 -0
  155. package/dist/autopilot/core/timeout-manager.d.ts +95 -0
  156. package/dist/autopilot/core/timeout-manager.d.ts.map +1 -0
  157. package/dist/autopilot/core/timeout-manager.js +188 -0
  158. package/dist/autopilot/core/timeout-manager.js.map +1 -0
  159. package/dist/autopilot/git/branch-manager.d.ts +117 -0
  160. package/dist/autopilot/git/branch-manager.d.ts.map +1 -0
  161. package/dist/autopilot/git/branch-manager.js +238 -0
  162. package/dist/autopilot/git/branch-manager.js.map +1 -0
  163. package/dist/autopilot/git/index.d.ts +9 -0
  164. package/dist/autopilot/git/index.d.ts.map +1 -0
  165. package/dist/autopilot/git/index.js +9 -0
  166. package/dist/autopilot/git/index.js.map +1 -0
  167. package/dist/autopilot/git/merge-manager.d.ts +118 -0
  168. package/dist/autopilot/git/merge-manager.d.ts.map +1 -0
  169. package/dist/autopilot/git/merge-manager.js +304 -0
  170. package/dist/autopilot/git/merge-manager.js.map +1 -0
  171. package/dist/autopilot/git/worktree-manager.d.ts +128 -0
  172. package/dist/autopilot/git/worktree-manager.d.ts.map +1 -0
  173. package/dist/autopilot/git/worktree-manager.js +298 -0
  174. package/dist/autopilot/git/worktree-manager.js.map +1 -0
  175. package/dist/autopilot/index.d.ts +30 -0
  176. package/dist/autopilot/index.d.ts.map +1 -0
  177. package/dist/autopilot/index.js +55 -0
  178. package/dist/autopilot/index.js.map +1 -0
  179. package/dist/autopilot/sync/index.d.ts +7 -0
  180. package/dist/autopilot/sync/index.d.ts.map +1 -0
  181. package/dist/autopilot/sync/index.js +7 -0
  182. package/dist/autopilot/sync/index.js.map +1 -0
  183. package/dist/autopilot/sync/sync-manager.d.ts +168 -0
  184. package/dist/autopilot/sync/sync-manager.d.ts.map +1 -0
  185. package/dist/autopilot/sync/sync-manager.js +303 -0
  186. package/dist/autopilot/sync/sync-manager.js.map +1 -0
  187. package/dist/autopilot/types.d.ts +454 -0
  188. package/dist/autopilot/types.d.ts.map +1 -0
  189. package/dist/autopilot/types.js +26 -0
  190. package/dist/autopilot/types.js.map +1 -0
  191. package/dist/autopilot/utils/audit-logger.d.ts +176 -0
  192. package/dist/autopilot/utils/audit-logger.d.ts.map +1 -0
  193. package/dist/autopilot/utils/audit-logger.js +308 -0
  194. package/dist/autopilot/utils/audit-logger.js.map +1 -0
  195. package/dist/autopilot/utils/cost-tracker.d.ts +162 -0
  196. package/dist/autopilot/utils/cost-tracker.d.ts.map +1 -0
  197. package/dist/autopilot/utils/cost-tracker.js +269 -0
  198. package/dist/autopilot/utils/cost-tracker.js.map +1 -0
  199. package/dist/autopilot/utils/index.d.ts +9 -0
  200. package/dist/autopilot/utils/index.d.ts.map +1 -0
  201. package/dist/autopilot/utils/index.js +9 -0
  202. package/dist/autopilot/utils/index.js.map +1 -0
  203. package/dist/autopilot/utils/progress-reporter.d.ts +132 -0
  204. package/dist/autopilot/utils/progress-reporter.d.ts.map +1 -0
  205. package/dist/autopilot/utils/progress-reporter.js +290 -0
  206. package/dist/autopilot/utils/progress-reporter.js.map +1 -0
  207. package/dist/autopilot/worker/worker-pool.d.ts +179 -0
  208. package/dist/autopilot/worker/worker-pool.d.ts.map +1 -0
  209. package/dist/autopilot/worker/worker-pool.js +331 -0
  210. package/dist/autopilot/worker/worker-pool.js.map +1 -0
  211. package/dist/autopilot/worker/worker-session.d.ts +171 -0
  212. package/dist/autopilot/worker/worker-session.d.ts.map +1 -0
  213. package/dist/autopilot/worker/worker-session.js +295 -0
  214. package/dist/autopilot/worker/worker-session.js.map +1 -0
  215. package/dist/cli/index.d.ts +1 -1
  216. package/dist/cli/index.d.ts.map +1 -1
  217. package/dist/cli/index.js +4 -1
  218. package/dist/cli/index.js.map +1 -1
  219. package/dist/index.js +0 -1
  220. package/dist/index.js.map +1 -1
  221. package/dist/tools/core/epic.js +1 -1
  222. package/dist/tools/core/epic.js.map +1 -1
  223. package/dist/tools/core/lookup.d.ts.map +1 -1
  224. package/dist/tools/core/lookup.js +3 -2
  225. package/dist/tools/core/lookup.js.map +1 -1
  226. package/dist/tools/core/specification.js +1 -1
  227. package/dist/tools/core/specification.js.map +1 -1
  228. package/dist/tools/core/ticket.d.ts.map +1 -1
  229. package/dist/tools/core/ticket.js +4 -6
  230. package/dist/tools/core/ticket.js.map +1 -1
  231. package/dist/tools/index.d.ts.map +1 -1
  232. package/dist/tools/index.js +60 -0
  233. package/dist/tools/index.js.map +1 -1
  234. package/dist/validation/index.d.ts.map +1 -1
  235. package/dist/validation/index.js +4 -1
  236. package/dist/validation/index.js.map +1 -1
  237. package/package.json +8 -4
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Semaphore for Concurrency Control
3
+ *
4
+ * Controls maximum number of parallel processes.
5
+ */
6
+ export declare class Semaphore {
7
+ private maxPermits;
8
+ private permits;
9
+ private waiting;
10
+ constructor(maxPermits: number);
11
+ /**
12
+ * Acquire a permit. Returns a release function.
13
+ */
14
+ acquire(): Promise<() => void>;
15
+ /**
16
+ * Try to acquire a permit without waiting.
17
+ * Returns null if no permits available.
18
+ */
19
+ tryAcquire(): (() => void) | null;
20
+ /**
21
+ * Release a permit back to the pool.
22
+ */
23
+ private release;
24
+ /**
25
+ * Get number of available permits.
26
+ */
27
+ getAvailablePermits(): number;
28
+ /**
29
+ * Get maximum permits configured.
30
+ */
31
+ getMaxPermits(): number;
32
+ /**
33
+ * Get number of waiting requests.
34
+ */
35
+ getQueueLength(): number;
36
+ /**
37
+ * Check if any permits are available.
38
+ */
39
+ hasAvailablePermits(): boolean;
40
+ /**
41
+ * Update the maximum number of permits.
42
+ * Can be used to dynamically adjust concurrency.
43
+ */
44
+ setMaxPermits(maxPermits: number): void;
45
+ /**
46
+ * Clear all waiting requests (e.g., during shutdown).
47
+ */
48
+ clearWaiting(): void;
49
+ }
50
+ //# sourceMappingURL=semaphore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../src/ai-provider/semaphore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,SAAS;IAIR,OAAO,CAAC,UAAU;IAH9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAyB;gBAEpB,UAAU,EAAE,MAAM;IAItC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IAcpC;;;OAGG;IACH,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAQjC;;OAEG;IACH,OAAO,CAAC,OAAO;IAQf;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAcvC;;OAEG;IACH,YAAY,IAAI,IAAI;CAGrB"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Semaphore for Concurrency Control
3
+ *
4
+ * Controls maximum number of parallel processes.
5
+ */
6
+ export class Semaphore {
7
+ maxPermits;
8
+ permits;
9
+ waiting = [];
10
+ constructor(maxPermits) {
11
+ this.maxPermits = maxPermits;
12
+ this.permits = maxPermits;
13
+ }
14
+ /**
15
+ * Acquire a permit. Returns a release function.
16
+ */
17
+ async acquire() {
18
+ if (this.permits > 0) {
19
+ this.permits--;
20
+ return () => this.release();
21
+ }
22
+ return new Promise((resolve) => {
23
+ this.waiting.push(() => {
24
+ this.permits--;
25
+ resolve(() => this.release());
26
+ });
27
+ });
28
+ }
29
+ /**
30
+ * Try to acquire a permit without waiting.
31
+ * Returns null if no permits available.
32
+ */
33
+ tryAcquire() {
34
+ if (this.permits > 0) {
35
+ this.permits--;
36
+ return () => this.release();
37
+ }
38
+ return null;
39
+ }
40
+ /**
41
+ * Release a permit back to the pool.
42
+ */
43
+ release() {
44
+ this.permits++;
45
+ const next = this.waiting.shift();
46
+ if (next) {
47
+ next();
48
+ }
49
+ }
50
+ /**
51
+ * Get number of available permits.
52
+ */
53
+ getAvailablePermits() {
54
+ return this.permits;
55
+ }
56
+ /**
57
+ * Get maximum permits configured.
58
+ */
59
+ getMaxPermits() {
60
+ return this.maxPermits;
61
+ }
62
+ /**
63
+ * Get number of waiting requests.
64
+ */
65
+ getQueueLength() {
66
+ return this.waiting.length;
67
+ }
68
+ /**
69
+ * Check if any permits are available.
70
+ */
71
+ hasAvailablePermits() {
72
+ return this.permits > 0;
73
+ }
74
+ /**
75
+ * Update the maximum number of permits.
76
+ * Can be used to dynamically adjust concurrency.
77
+ */
78
+ setMaxPermits(maxPermits) {
79
+ const diff = maxPermits - this.maxPermits;
80
+ this.maxPermits = maxPermits;
81
+ this.permits = Math.max(0, this.permits + diff);
82
+ // Wake up waiting requests if we increased permits
83
+ while (this.permits > 0 && this.waiting.length > 0) {
84
+ const next = this.waiting.shift();
85
+ if (next) {
86
+ next();
87
+ }
88
+ }
89
+ }
90
+ /**
91
+ * Clear all waiting requests (e.g., during shutdown).
92
+ */
93
+ clearWaiting() {
94
+ this.waiting = [];
95
+ }
96
+ }
97
+ //# sourceMappingUR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AAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,UAAkB;QAC9B,MAAM,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QAEhD,mDAAmD;QACnD,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAClC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Request Tracing
3
+ *
4
+ * Distributed tracing with span support.
5
+ */
6
+ import type { Span } from './types.js';
7
+ /**
8
+ * Tracer for creating and managing spans.
9
+ */
10
+ export declare class Tracer {
11
+ private currentTraceId?;
12
+ private currentSpan?;
13
+ private spans;
14
+ /**
15
+ * Generate a unique request ID.
16
+ */
17
+ generateRequestId(): string;
18
+ /**
19
+ * Start a new span.
20
+ */
21
+ startSpan(name: string, attributes?: Record<string, unknown>): Span;
22
+ /**
23
+ * Start a new trace (top-level span).
24
+ */
25
+ startTrace(name: string, attributes?: Record<string, unknown>): Span;
26
+ /**
27
+ * Get current trace ID.
28
+ */
29
+ getTraceId(): string | undefined;
30
+ /**
31
+ * Set trace ID for correlation with external systems.
32
+ */
33
+ setTraceId(traceId: string): void;
34
+ /**
35
+ * Get current span.
36
+ */
37
+ getCurrentSpan(): Span | undefined;
38
+ /**
39
+ * Get all recorded spans.
40
+ */
41
+ getSpans(): Span[];
42
+ /**
43
+ * Clear recorded spans.
44
+ */
45
+ clearSpans(): void;
46
+ /**
47
+ * Clear current context.
48
+ */
49
+ clearContext(): void;
50
+ /**
51
+ * Execute a function within a span.
52
+ */
53
+ withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Record<string, unknown>): Promise<T>;
54
+ /**
55
+ * Export spans as JSON.
56
+ */
57
+ exportSpans(): Record<string, unknown>[];
58
+ }
59
+ /**
60
+ * Get or create global tracer.
61
+ */
62
+ export declare function getTracer(): Tracer;
63
+ /**
64
+ * Create a new tracer instance.
65
+ */
66
+ export declare function createTracer(): Tracer;
67
+ //# sourceMappingURL=tracer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/ai-provider/tracer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAkGvC;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,WAAW,CAAC,CAAW;IAC/B,OAAO,CAAC,KAAK,CAAkB;IAE/B;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAmBnE;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMpE;;OAEG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;IAIhC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,cAAc,IAAI,IAAI,GAAG,SAAS;IAIlC;;OAEG;IACH,QAAQ,IAAI,IAAI,EAAE;IAIlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,YAAY,IAAI,IAAI;IAKpB;;OAEG;IACG,QAAQ,CAAC,CAAC,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC;IAeb;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;CAGzC;AAOD;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Request Tracing
3
+ *
4
+ * Distributed tracing with span support.
5
+ */
6
+ import { randomUUID } from 'crypto';
7
+ import { createLogger } from './logger.js';
8
+ const logger = createLogger('Tracer');
9
+ /**
10
+ * Span implementation.
11
+ */
12
+ class SpanImpl {
13
+ traceId;
14
+ spanId;
15
+ name;
16
+ startTime;
17
+ endTime;
18
+ status;
19
+ attributes;
20
+ parentSpanId;
21
+ constructor(name, traceId, attributes, parentSpanId) {
22
+ this.traceId = traceId;
23
+ this.spanId = randomUUID();
24
+ this.name = name;
25
+ this.startTime = Date.now();
26
+ this.attributes = attributes || {};
27
+ this.parentSpanId = parentSpanId;
28
+ }
29
+ setStatus(status, error) {
30
+ this.status = status;
31
+ if (error) {
32
+ this.attributes.error = String(error);
33
+ if (error instanceof Error) {
34
+ this.attributes.errorName = error.name;
35
+ this.attributes.errorMessage = error.message;
36
+ this.attributes.errorStack = error.stack;
37
+ }
38
+ }
39
+ }
40
+ end() {
41
+ this.endTime = Date.now();
42
+ // Log span completion
43
+ logger.debug('Span ended', {
44
+ traceId: this.traceId,
45
+ spanId: this.spanId,
46
+ name: this.name,
47
+ durationMs: this.endTime - this.startTime,
48
+ status: this.status,
49
+ attributes: this.attributes,
50
+ });
51
+ }
52
+ /**
53
+ * Add an attribute to the span.
54
+ */
55
+ setAttribute(key, value) {
56
+ this.attributes[key] = value;
57
+ }
58
+ /**
59
+ * Add multiple attributes.
60
+ */
61
+ setAttributes(attributes) {
62
+ Object.assign(this.attributes, attributes);
63
+ }
64
+ /**
65
+ * Get span duration (returns 0 if not ended).
66
+ */
67
+ getDuration() {
68
+ if (!this.endTime)
69
+ return 0;
70
+ return this.endTime - this.startTime;
71
+ }
72
+ /**
73
+ * Convert to JSON for serialization.
74
+ */
75
+ toJSON() {
76
+ return {
77
+ traceId: this.traceId,
78
+ spanId: this.spanId,
79
+ parentSpanId: this.parentSpanId,
80
+ name: this.name,
81
+ startTime: this.startTime,
82
+ endTime: this.endTime,
83
+ durationMs: this.getDuration(),
84
+ status: this.status,
85
+ attributes: this.attributes,
86
+ };
87
+ }
88
+ }
89
+ /**
90
+ * Tracer for creating and managing spans.
91
+ */
92
+ export class Tracer {
93
+ currentTraceId;
94
+ currentSpan;
95
+ spans = [];
96
+ /**
97
+ * Generate a unique request ID.
98
+ */
99
+ generateRequestId() {
100
+ return randomUUID();
101
+ }
102
+ /**
103
+ * Start a new span.
104
+ */
105
+ startSpan(name, attributes) {
106
+ const traceId = this.currentTraceId || this.generateRequestId();
107
+ const parentSpanId = this.currentSpan?.spanId;
108
+ const span = new SpanImpl(name, traceId, attributes, parentSpanId);
109
+ this.spans.push(span);
110
+ this.currentTraceId = traceId;
111
+ this.currentSpan = span;
112
+ logger.debug('Span started', {
113
+ traceId: span.traceId,
114
+ spanId: span.spanId,
115
+ name: span.name,
116
+ parentSpanId,
117
+ });
118
+ return span;
119
+ }
120
+ /**
121
+ * Start a new trace (top-level span).
122
+ */
123
+ startTrace(name, attributes) {
124
+ this.currentTraceId = this.generateRequestId();
125
+ this.currentSpan = undefined;
126
+ return this.startSpan(name, attributes);
127
+ }
128
+ /**
129
+ * Get current trace ID.
130
+ */
131
+ getTraceId() {
132
+ return this.currentTraceId;
133
+ }
134
+ /**
135
+ * Set trace ID for correlation with external systems.
136
+ */
137
+ setTraceId(traceId) {
138
+ this.currentTraceId = traceId;
139
+ }
140
+ /**
141
+ * Get current span.
142
+ */
143
+ getCurrentSpan() {
144
+ return this.currentSpan;
145
+ }
146
+ /**
147
+ * Get all recorded spans.
148
+ */
149
+ getSpans() {
150
+ return [...this.spans];
151
+ }
152
+ /**
153
+ * Clear recorded spans.
154
+ */
155
+ clearSpans() {
156
+ this.spans = [];
157
+ }
158
+ /**
159
+ * Clear current context.
160
+ */
161
+ clearContext() {
162
+ this.currentTraceId = undefined;
163
+ this.currentSpan = undefined;
164
+ }
165
+ /**
166
+ * Execute a function within a span.
167
+ */
168
+ async withSpan(name, fn, attributes) {
169
+ const span = this.startSpan(name, attributes);
170
+ try {
171
+ const result = await fn(span);
172
+ span.setStatus('success');
173
+ return result;
174
+ }
175
+ catch (error) {
176
+ span.setStatus('error', error);
177
+ throw error;
178
+ }
179
+ finally {
180
+ span.end();
181
+ }
182
+ }
183
+ /**
184
+ * Export spans as JSON.
185
+ */
186
+ exportSpans() {
187
+ return this.spans.map(span => span.toJSON());
188
+ }
189
+ }
190
+ /**
191
+ * Global tracer instance.
192
+ */
193
+ let globalTracer = null;
194
+ /**
195
+ * Get or create global tracer.
196
+ */
197
+ export function getTracer() {
198
+ if (!globalTracer) {
199
+ globalTracer = new Tracer();
200
+ }
201
+ return globalTracer;
202
+ }
203
+ /**
204
+ * Create a new tracer instance.
205
+ */
206
+ export function createTracer() {
207
+ return new Tracer();
208
+ }
209
+ //# s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AAM,UAAU,YAAY;IAC1B,OAAO,IAAI,MAAM,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * AI Provider Type Definitions
3
+ *
4
+ * TypeScript interfaces for the AI Provider module.
5
+ * Supports Claude Code mode for spawning CLI processes.
6
+ */
7
+ export type ProviderMode = 'claude_code';
8
+ export interface AIProvider {
9
+ run(prompt: string, options?: RunOptions): Promise<AIResponse>;
10
+ test(options?: TestOptions): Promise<TestResult>;
11
+ getStatus(): Promise<ProviderStatus>;
12
+ getMode(): ProviderMode;
13
+ shutdown(): Promise<void>;
14
+ }
15
+ export interface AIResponse {
16
+ success: boolean;
17
+ output: string;
18
+ model?: string;
19
+ durationMs?: number;
20
+ /** Session ID for linking to JSONL logs (used for token tracking) */
21
+ sessionId?: string;
22
+ error?: string;
23
+ errorType?: ErrorType;
24
+ suggestion?: string;
25
+ }
26
+ export interface ProviderStatus {
27
+ mode: ProviderMode;
28
+ isConfigured: boolean;
29
+ isAuthenticated: boolean;
30
+ isRateLimited: boolean;
31
+ rateLimitMessage?: string;
32
+ suggestion?: string;
33
+ cliVersion?: string;
34
+ activeProcesses?: number;
35
+ maxParallelProcesses?: number;
36
+ }
37
+ export interface RunOptions {
38
+ timeout?: number;
39
+ workingDirectory?: string;
40
+ /** Model to use: 'sonnet' (default) or 'opus' */
41
+ model?: 'sonnet' | 'opus';
42
+ /** Session ID for linking to JSONL logs (used for token tracking) */
43
+ sessionId?: string;
44
+ onProgress?: (message: string) => void;
45
+ }
46
+ export interface TestOptions {
47
+ prompt?: string;
48
+ }
49
+ export interface TestResult {
50
+ success: boolean;
51
+ mode: ProviderMode;
52
+ model?: string;
53
+ durationMs?: number;
54
+ response?: string;
55
+ error?: string;
56
+ suggestion?: string;
57
+ }
58
+ export interface AIProviderConfig {
59
+ mode: ProviderMode;
60
+ maxParallelProcesses: number;
61
+ requestTimeoutSeconds: number;
62
+ maxRetries: number;
63
+ workingDirectory?: string;
64
+ circuitBreakerThreshold?: number;
65
+ /** Enable file operations by skipping permission prompts. Required for autopilot. Default: true */
66
+ dangerouslySkipPermissions?: boolean;
67
+ }
68
+ export interface AIProviderConfigInput {
69
+ mode?: ProviderMode;
70
+ maxParallelProcesses?: number;
71
+ requestTimeoutSeconds?: number;
72
+ maxRetries?: number;
73
+ }
74
+ export interface ProcessManagerConfig {
75
+ maxParallel: number;
76
+ timeoutMs: number;
77
+ workingDirectory: string;
78
+ maxRetries: number;
79
+ circuitBreakerThreshold: number;
80
+ /** Enable file operations by skipping permission prompts. Required for autopilot. */
81
+ dangerouslySkipPermissions?: boolean;
82
+ }
83
+ export interface ProcessResult {
84
+ success: boolean;
85
+ output?: string;
86
+ error?: string;
87
+ errorType?: ErrorType;
88
+ suggestion?: string;
89
+ durationMs?: number;
90
+ model?: string;
91
+ }
92
+ export interface ProcessStatus {
93
+ isAuthenticated: boolean;
94
+ accountEmail?: string;
95
+ activeProcesses: number;
96
+ isRateLimited: boolean;
97
+ rateLimitMessage?: string;
98
+ cliVersion?: string;
99
+ suggestion?: string;
100
+ }
101
+ export interface SpawnResult {
102
+ code: number | null;
103
+ stdout: string;
104
+ stderr: string;
105
+ durationMs: number;
106
+ }
107
+ export type ErrorType = 'auth' | 'rate_limit' | 'timeout' | 'network' | 'cli_not_found' | 'unknown';
108
+ export type CircuitState = 'closed' | 'open' | 'half-open';
109
+ export interface CircuitBreakerConfig {
110
+ failureThreshold: number;
111
+ recoveryTimeMs: number;
112
+ halfOpenRequests: number;
113
+ }
114
+ export interface RetryConfig {
115
+ maxRetries: number;
116
+ baseDelayMs: number;
117
+ maxDelayMs: number;
118
+ jitterFactor?: number;
119
+ }
120
+ export interface CLIVersionInfo {
121
+ version: string;
122
+ supportsOutputFormat: boolean;
123
+ supportsPrintMode: boolean;
124
+ supportsWorkingDirectory: boolean;
125
+ }
126
+ export interface MetricStats {
127
+ count: number;
128
+ min: number;
129
+ max: number;
130
+ avg: number;
131
+ p50: number;
132
+ p95: number;
133
+ p99: number;
134
+ }
135
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
136
+ export interface LogEntry {
137
+ timestamp: string;
138
+ level: LogLevel;
139
+ component: string;
140
+ message: string;
141
+ context?: Record<string, unknown>;
142
+ requestId?: string;
143
+ }
144
+ export interface Span {
145
+ traceId: string;
146
+ spanId: string;
147
+ name: string;
148
+ startTime: number;
149
+ endTime?: number;
150
+ status?: string;
151
+ attributes: Record<string, unknown>;
152
+ setStatus(status: string, error?: unknown): void;
153
+ end(): void;
154
+ }
155
+ export interface InstanceState {
156
+ instances: InstanceInfo[];
157
+ }
158
+ export interface InstanceInfo {
159
+ instanceId: string;
160
+ processCount: number;
161
+ timestamp: number;
162
+ }
163
+ export interface AIProviderAPIResponse<T = unknown> {
164
+ success: boolean;
165
+ data?: T;
166
+ error?: string;
167
+ suggestion?: string;
168
+ }
169
+ export interface GetConfigResponse {
170
+ config: AIProviderConfig | null;
171
+ }
172
+ export interface GetStatusResponse {
173
+ status: ProviderStatus;
174
+ }
175
+ export interface UpdateConfigResponse {
176
+ config: AIProviderConfig;
177
+ }
178
+ export interface TestProviderResponse {
179
+ result: TestResult;
180
+ }
181
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ai-provider/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAMzC,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACrC,OAAO,IAAI,YAAY,CAAC;IACxB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC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pB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AI Provider Type Definitions
3
+ *
4
+ * TypeScript interfaces for the AI Provider module.
5
+ * Supports Claude Code mode for spawning CLI processes.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ai-provider/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}