vibeman 0.0.3 → 0.0.6

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 (231) hide show
  1. package/dist/api.js +49 -0
  2. package/dist/cli.js +135 -0
  3. package/dist/ui/index-gnk6rhxs.js +9 -0
  4. package/dist/ui/index.html +10 -0
  5. package/dist/ui/index.js +2 -0
  6. package/package.json +10 -80
  7. package/README.md +0 -12
  8. package/dist/index.js +0 -114
  9. package/dist/runtime/api/.tsbuildinfo +0 -1
  10. package/dist/runtime/api/agent/agent-service.d.ts +0 -225
  11. package/dist/runtime/api/agent/agent-service.js +0 -904
  12. package/dist/runtime/api/agent/ai-providers/claude-code-adapter.d.ts +0 -61
  13. package/dist/runtime/api/agent/ai-providers/claude-code-adapter.js +0 -362
  14. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +0 -36
  15. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +0 -347
  16. package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
  17. package/dist/runtime/api/agent/ai-providers/index.js +0 -7
  18. package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -182
  19. package/dist/runtime/api/agent/ai-providers/types.js +0 -5
  20. package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
  21. package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -170
  22. package/dist/runtime/api/agent/core-agent-service.d.ts +0 -119
  23. package/dist/runtime/api/agent/core-agent-service.js +0 -267
  24. package/dist/runtime/api/agent/parsers.d.ts +0 -16
  25. package/dist/runtime/api/agent/parsers.js +0 -308
  26. package/dist/runtime/api/agent/prompt-service.d.ts +0 -30
  27. package/dist/runtime/api/agent/prompt-service.js +0 -449
  28. package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
  29. package/dist/runtime/api/agent/prompt-service.test.js +0 -230
  30. package/dist/runtime/api/agent/routing-policy.d.ts +0 -171
  31. package/dist/runtime/api/agent/routing-policy.js +0 -196
  32. package/dist/runtime/api/agent/routing-policy.test.d.ts +0 -1
  33. package/dist/runtime/api/agent/routing-policy.test.js +0 -63
  34. package/dist/runtime/api/api/router-helpers.d.ts +0 -32
  35. package/dist/runtime/api/api/router-helpers.js +0 -31
  36. package/dist/runtime/api/api/routers/ai.d.ts +0 -200
  37. package/dist/runtime/api/api/routers/ai.js +0 -396
  38. package/dist/runtime/api/api/routers/executions.d.ts +0 -98
  39. package/dist/runtime/api/api/routers/executions.js +0 -94
  40. package/dist/runtime/api/api/routers/git.d.ts +0 -45
  41. package/dist/runtime/api/api/routers/git.js +0 -35
  42. package/dist/runtime/api/api/routers/provider-config.d.ts +0 -165
  43. package/dist/runtime/api/api/routers/provider-config.js +0 -252
  44. package/dist/runtime/api/api/routers/settings.d.ts +0 -139
  45. package/dist/runtime/api/api/routers/settings.js +0 -113
  46. package/dist/runtime/api/api/routers/tasks.d.ts +0 -141
  47. package/dist/runtime/api/api/routers/tasks.js +0 -238
  48. package/dist/runtime/api/api/routers/workflows.d.ts +0 -275
  49. package/dist/runtime/api/api/routers/workflows.js +0 -311
  50. package/dist/runtime/api/api/routers/worktrees.d.ts +0 -101
  51. package/dist/runtime/api/api/routers/worktrees.js +0 -80
  52. package/dist/runtime/api/api/trpc.d.ts +0 -118
  53. package/dist/runtime/api/api/trpc.js +0 -34
  54. package/dist/runtime/api/index.d.ts +0 -9
  55. package/dist/runtime/api/index.js +0 -117
  56. package/dist/runtime/api/lib/id-generator.d.ts +0 -70
  57. package/dist/runtime/api/lib/id-generator.js +0 -123
  58. package/dist/runtime/api/lib/local-config.d.ts +0 -245
  59. package/dist/runtime/api/lib/local-config.js +0 -288
  60. package/dist/runtime/api/lib/logger.d.ts +0 -11
  61. package/dist/runtime/api/lib/logger.js +0 -188
  62. package/dist/runtime/api/lib/provider-detection.d.ts +0 -59
  63. package/dist/runtime/api/lib/provider-detection.js +0 -244
  64. package/dist/runtime/api/lib/server/agent-service-singleton.d.ts +0 -6
  65. package/dist/runtime/api/lib/server/agent-service-singleton.js +0 -27
  66. package/dist/runtime/api/lib/server/bootstrap.d.ts +0 -38
  67. package/dist/runtime/api/lib/server/bootstrap.js +0 -197
  68. package/dist/runtime/api/lib/server/git-service-singleton.d.ts +0 -6
  69. package/dist/runtime/api/lib/server/git-service-singleton.js +0 -47
  70. package/dist/runtime/api/lib/server/project-root.d.ts +0 -2
  71. package/dist/runtime/api/lib/server/project-root.js +0 -61
  72. package/dist/runtime/api/lib/server/task-service-singleton.d.ts +0 -7
  73. package/dist/runtime/api/lib/server/task-service-singleton.js +0 -58
  74. package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.d.ts +0 -7
  75. package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.js +0 -57
  76. package/dist/runtime/api/lib/trpc/client.d.ts +0 -1
  77. package/dist/runtime/api/lib/trpc/client.js +0 -5
  78. package/dist/runtime/api/lib/trpc/server.d.ts +0 -935
  79. package/dist/runtime/api/lib/trpc/server.js +0 -11
  80. package/dist/runtime/api/lib/trpc/ws-server.d.ts +0 -8
  81. package/dist/runtime/api/lib/trpc/ws-server.js +0 -33
  82. package/dist/runtime/api/persistence/database-service.d.ts +0 -14
  83. package/dist/runtime/api/persistence/database-service.js +0 -74
  84. package/dist/runtime/api/persistence/execution-log-persistence.d.ts +0 -90
  85. package/dist/runtime/api/persistence/execution-log-persistence.js +0 -410
  86. package/dist/runtime/api/persistence/execution-log-persistence.test.d.ts +0 -1
  87. package/dist/runtime/api/persistence/execution-log-persistence.test.js +0 -170
  88. package/dist/runtime/api/router.d.ts +0 -938
  89. package/dist/runtime/api/router.js +0 -34
  90. package/dist/runtime/api/settings-service.d.ts +0 -110
  91. package/dist/runtime/api/settings-service.js +0 -661
  92. package/dist/runtime/api/tasks/file-watcher.d.ts +0 -23
  93. package/dist/runtime/api/tasks/file-watcher.js +0 -88
  94. package/dist/runtime/api/tasks/task-file-parser.d.ts +0 -13
  95. package/dist/runtime/api/tasks/task-file-parser.js +0 -161
  96. package/dist/runtime/api/tasks/task-service.d.ts +0 -36
  97. package/dist/runtime/api/tasks/task-service.js +0 -173
  98. package/dist/runtime/api/types/index.d.ts +0 -186
  99. package/dist/runtime/api/types/index.js +0 -1
  100. package/dist/runtime/api/types/settings.d.ts +0 -94
  101. package/dist/runtime/api/types/settings.js +0 -2
  102. package/dist/runtime/api/types.d.ts +0 -2
  103. package/dist/runtime/api/types.js +0 -1
  104. package/dist/runtime/api/utils/env.d.ts +0 -6
  105. package/dist/runtime/api/utils/env.js +0 -12
  106. package/dist/runtime/api/utils/stripNextEnv.d.ts +0 -7
  107. package/dist/runtime/api/utils/stripNextEnv.js +0 -22
  108. package/dist/runtime/api/utils/title-slug.d.ts +0 -6
  109. package/dist/runtime/api/utils/title-slug.js +0 -77
  110. package/dist/runtime/api/utils/url.d.ts +0 -2
  111. package/dist/runtime/api/utils/url.js +0 -19
  112. package/dist/runtime/api/vcs/git-history-service.d.ts +0 -57
  113. package/dist/runtime/api/vcs/git-history-service.js +0 -228
  114. package/dist/runtime/api/vcs/git-service.d.ts +0 -127
  115. package/dist/runtime/api/vcs/git-service.js +0 -284
  116. package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
  117. package/dist/runtime/api/vcs/worktree-service.js +0 -506
  118. package/dist/runtime/api/vcs/worktree-service.test.d.ts +0 -1
  119. package/dist/runtime/api/vcs/worktree-service.test.js +0 -20
  120. package/dist/runtime/api/workflows/quality-pipeline.d.ts +0 -58
  121. package/dist/runtime/api/workflows/quality-pipeline.js +0 -400
  122. package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -318
  123. package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -1891
  124. package/dist/runtime/web/.next/BUILD_ID +0 -1
  125. package/dist/runtime/web/.next/app-build-manifest.json +0 -66
  126. package/dist/runtime/web/.next/app-path-routes-manifest.json +0 -8
  127. package/dist/runtime/web/.next/build-manifest.json +0 -33
  128. package/dist/runtime/web/.next/package.json +0 -1
  129. package/dist/runtime/web/.next/prerender-manifest.json +0 -61
  130. package/dist/runtime/web/.next/react-loadable-manifest.json +0 -39
  131. package/dist/runtime/web/.next/required-server-files.json +0 -334
  132. package/dist/runtime/web/.next/routes-manifest.json +0 -70
  133. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +0 -1
  134. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +0 -1
  135. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +0 -1
  136. package/dist/runtime/web/.next/server/app/_not-found/page.js +0 -2
  137. package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +0 -1
  138. package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
  139. package/dist/runtime/web/.next/server/app/_not-found.html +0 -7
  140. package/dist/runtime/web/.next/server/app/_not-found.meta +0 -8
  141. package/dist/runtime/web/.next/server/app/_not-found.rsc +0 -22
  142. package/dist/runtime/web/.next/server/app/api/health/route.js +0 -1
  143. package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +0 -1
  144. package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +0 -1
  145. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +0 -1
  146. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +0 -1
  147. package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +0 -1
  148. package/dist/runtime/web/.next/server/app/api/upload/route.js +0 -1
  149. package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +0 -1
  150. package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +0 -1
  151. package/dist/runtime/web/.next/server/app/index.html +0 -7
  152. package/dist/runtime/web/.next/server/app/index.meta +0 -7
  153. package/dist/runtime/web/.next/server/app/index.rsc +0 -27
  154. package/dist/runtime/web/.next/server/app/page.js +0 -147
  155. package/dist/runtime/web/.next/server/app/page.js.nft.json +0 -1
  156. package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +0 -1
  157. package/dist/runtime/web/.next/server/app-paths-manifest.json +0 -8
  158. package/dist/runtime/web/.next/server/chunks/217.js +0 -1
  159. package/dist/runtime/web/.next/server/chunks/383.js +0 -6
  160. package/dist/runtime/web/.next/server/chunks/458.js +0 -1
  161. package/dist/runtime/web/.next/server/chunks/576.js +0 -18
  162. package/dist/runtime/web/.next/server/chunks/635.js +0 -22
  163. package/dist/runtime/web/.next/server/chunks/761.js +0 -1
  164. package/dist/runtime/web/.next/server/chunks/777.js +0 -3
  165. package/dist/runtime/web/.next/server/chunks/825.js +0 -1
  166. package/dist/runtime/web/.next/server/chunks/838.js +0 -1
  167. package/dist/runtime/web/.next/server/chunks/973.js +0 -15
  168. package/dist/runtime/web/.next/server/functions-config-manifest.json +0 -4
  169. package/dist/runtime/web/.next/server/middleware-build-manifest.js +0 -1
  170. package/dist/runtime/web/.next/server/middleware-manifest.json +0 -6
  171. package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +0 -1
  172. package/dist/runtime/web/.next/server/next-font-manifest.js +0 -1
  173. package/dist/runtime/web/.next/server/next-font-manifest.json +0 -1
  174. package/dist/runtime/web/.next/server/pages/404.html +0 -7
  175. package/dist/runtime/web/.next/server/pages/500.html +0 -1
  176. package/dist/runtime/web/.next/server/pages/_app.js +0 -1
  177. package/dist/runtime/web/.next/server/pages/_app.js.nft.json +0 -1
  178. package/dist/runtime/web/.next/server/pages/_document.js +0 -1
  179. package/dist/runtime/web/.next/server/pages/_document.js.nft.json +0 -1
  180. package/dist/runtime/web/.next/server/pages/_error.js +0 -19
  181. package/dist/runtime/web/.next/server/pages/_error.js.nft.json +0 -1
  182. package/dist/runtime/web/.next/server/pages-manifest.json +0 -6
  183. package/dist/runtime/web/.next/server/server-reference-manifest.js +0 -1
  184. package/dist/runtime/web/.next/server/server-reference-manifest.json +0 -1
  185. package/dist/runtime/web/.next/server/webpack-runtime.js +0 -1
  186. package/dist/runtime/web/.next/static/5_15u1WQCxN1_eHZpldCv/_buildManifest.js +0 -1
  187. package/dist/runtime/web/.next/static/5_15u1WQCxN1_eHZpldCv/_ssgManifest.js +0 -1
  188. package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
  189. package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
  190. package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
  191. package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
  192. package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
  193. package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
  194. package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
  195. package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
  196. package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
  197. package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
  198. package/dist/runtime/web/.next/static/chunks/823-6f371a6e829adbba.js +0 -63
  199. package/dist/runtime/web/.next/static/chunks/87c73c54-09e1ba5c70e60a51.js +0 -1
  200. package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
  201. package/dist/runtime/web/.next/static/chunks/8bb4d8db-3e2aa02b0a2384b9.js +0 -1
  202. package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
  203. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-751c9265a65409e5.js +0 -1
  204. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
  205. package/dist/runtime/web/.next/static/chunks/app/api/health/route-751c9265a65409e5.js +0 -1
  206. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-751c9265a65409e5.js +0 -1
  207. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-751c9265a65409e5.js +0 -1
  208. package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
  209. package/dist/runtime/web/.next/static/chunks/app/page-9fe7d75095b4ccec.js +0 -1
  210. package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
  211. package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
  212. package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
  213. package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
  214. package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
  215. package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
  216. package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  217. package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
  218. package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
  219. package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +0 -3
  220. package/dist/runtime/web/.next/static/css/521bd69cc298cd1a.css +0 -1
  221. package/dist/runtime/web/.next/static/css/537e22821e101b87.css +0 -1
  222. package/dist/runtime/web/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  223. package/dist/runtime/web/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
  224. package/dist/runtime/web/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  225. package/dist/runtime/web/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  226. package/dist/runtime/web/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  227. package/dist/runtime/web/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  228. package/dist/runtime/web/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  229. package/dist/runtime/web/package.json +0 -65
  230. package/dist/runtime/web/server.js +0 -44
  231. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,200 +0,0 @@
1
- /**
2
- * AI Router - Multi-Model Orchestration API
3
- * Provides tRPC endpoints for managing AI providers and routing policies
4
- */
5
- import type { AgentService } from '../../agent/agent-service.js';
6
- import { type RoutingPolicy, type RoutableOperation } from '../../agent/routing-policy.js';
7
- /**
8
- * Build AI router with required dependencies
9
- */
10
- export declare function buildAIRoutes(options: {
11
- agentService: AgentService;
12
- }): {
13
- /**
14
- * List all registered AI providers with health status
15
- */
16
- listProviders: import("@trpc/server").TRPCQueryProcedure<{
17
- input: void;
18
- output: {
19
- name: string;
20
- displayName: string;
21
- available: boolean;
22
- error: string | undefined;
23
- capabilities: import("../../agent/ai-providers/types.js").ProviderCapabilities;
24
- models: import("../../agent/ai-providers/types.js").ModelInfo[];
25
- }[];
26
- meta: object;
27
- }>;
28
- /**
29
- * List available models from providers
30
- */
31
- listModels: import("@trpc/server").TRPCQueryProcedure<{
32
- input: {
33
- provider?: string | undefined;
34
- } | undefined;
35
- output: import("../../agent/ai-providers/types.js").ModelInfo[];
36
- meta: object;
37
- }>;
38
- /**
39
- * Get current routing policy
40
- */
41
- getRoutingPolicy: import("@trpc/server").TRPCQueryProcedure<{
42
- input: void;
43
- output: {
44
- defaultProvider: string;
45
- operations?: Partial<Record<"execute_task" | "quality_checks" | "improve_task" | "ai_merge" | "ai_codereview", {
46
- provider: string;
47
- options?: {
48
- temperature?: number | undefined;
49
- maxTokens?: number | undefined;
50
- tools?: string[] | undefined;
51
- } | undefined;
52
- model?: string | undefined;
53
- fallback?: string[] | undefined;
54
- }>> | undefined;
55
- };
56
- meta: object;
57
- }>;
58
- /**
59
- * Update routing policy
60
- */
61
- updateRoutingPolicy: import("@trpc/server").TRPCMutationProcedure<{
62
- input: {
63
- policy: {
64
- defaultProvider?: string | undefined;
65
- operations?: Partial<Record<"execute_task" | "quality_checks" | "improve_task" | "ai_merge" | "ai_codereview", {
66
- provider: string;
67
- options?: {
68
- temperature?: number | undefined;
69
- maxTokens?: number | undefined;
70
- tools?: string[] | undefined;
71
- } | undefined;
72
- model?: string | undefined;
73
- fallback?: string[] | undefined;
74
- }>> | undefined;
75
- };
76
- };
77
- output: {
78
- success: boolean;
79
- policy: any;
80
- };
81
- meta: object;
82
- }>;
83
- /**
84
- * Set default provider
85
- */
86
- setDefaultProvider: import("@trpc/server").TRPCMutationProcedure<{
87
- input: {
88
- provider: string;
89
- };
90
- output: {
91
- success: boolean;
92
- provider: string;
93
- };
94
- meta: object;
95
- }>;
96
- /**
97
- * Set operation-specific configuration
98
- */
99
- setOperationConfig: import("@trpc/server").TRPCMutationProcedure<{
100
- input: {
101
- operation: "execute_task" | "quality_checks" | "improve_task" | "ai_merge" | "ai_codereview";
102
- config: {
103
- provider: string;
104
- options?: {
105
- temperature?: number | undefined;
106
- maxTokens?: number | undefined;
107
- tools?: string[] | undefined;
108
- } | undefined;
109
- model?: string | undefined;
110
- fallback?: string[] | undefined;
111
- };
112
- };
113
- output: {
114
- success: boolean;
115
- };
116
- meta: object;
117
- }>;
118
- /**
119
- * Validate provider setup and refresh health status
120
- */
121
- validateProviders: import("@trpc/server").TRPCMutationProcedure<{
122
- input: {
123
- force?: boolean | undefined;
124
- } | undefined;
125
- output: {
126
- success: boolean;
127
- results: {
128
- provider: string;
129
- available: boolean;
130
- error: string | undefined;
131
- modelCount: number;
132
- capabilities: import("../../agent/ai-providers/types.js").ProviderCapabilities;
133
- }[];
134
- totalProviders: number;
135
- availableProviders: number;
136
- };
137
- meta: object;
138
- }>;
139
- };
140
- /**
141
- * Test-friendly plain handlers mirroring the AI routes, without tRPC wrappers.
142
- * Useful for unit tests that call functions directly.
143
- */
144
- export declare function buildAIRouteHandlers(options: {
145
- agentService: AgentService;
146
- }): {
147
- readonly listProviders: () => Promise<{
148
- name: string;
149
- displayName: any;
150
- available: boolean;
151
- error: string | undefined;
152
- capabilities: any;
153
- models: import("../../agent/ai-providers/types.js").ModelInfo[];
154
- }[]>;
155
- readonly listModels: (input?: {
156
- provider?: string;
157
- }) => Promise<any>;
158
- readonly getRoutingPolicy: () => Promise<any>;
159
- readonly updateRoutingPolicy: (input: {
160
- policy: Partial<RoutingPolicy>;
161
- }) => Promise<{
162
- readonly success: true;
163
- readonly policy: any;
164
- }>;
165
- readonly setDefaultProvider: (input: {
166
- provider: string;
167
- }) => Promise<{
168
- readonly success: true;
169
- readonly provider: string;
170
- }>;
171
- readonly setOperationConfig: (input: {
172
- operation: RoutableOperation;
173
- config: any;
174
- }) => Promise<{
175
- readonly success: true;
176
- }>;
177
- readonly validateProviders: () => Promise<{
178
- success: true;
179
- results: {
180
- provider: string;
181
- available: boolean;
182
- error: string | undefined;
183
- modelCount: number;
184
- capabilities: import("../../agent/ai-providers/types.js").ProviderCapabilities;
185
- }[];
186
- totalProviders: number;
187
- availableProviders: number;
188
- }>;
189
- readonly getProviderHealth: () => Promise<{
190
- totalProviders: number;
191
- availableProviders: number;
192
- unavailableProviders: number;
193
- providers: Array<{
194
- name: string;
195
- available: boolean;
196
- error?: string;
197
- modelCount: number;
198
- }>;
199
- }>;
200
- };
@@ -1,396 +0,0 @@
1
- /**
2
- * AI Router - Multi-Model Orchestration API
3
- * Provides tRPC endpoints for managing AI providers and routing policies
4
- */
5
- import { z } from 'zod';
6
- import { publicProcedure } from '../trpc.js';
7
- import { RoutingPolicySchema, OperationConfigSchema, } from '../../agent/routing-policy.js';
8
- import { log } from '../../lib/logger.js';
9
- import { getSettingsService } from '../../settings-service.js';
10
- /**
11
- * Input schemas for API endpoints
12
- */
13
- const ListModelsInputSchema = z.object({
14
- provider: z.string().optional(),
15
- });
16
- const UpdateRoutingPolicyInputSchema = z.object({
17
- policy: RoutingPolicySchema.partial(),
18
- });
19
- const SetDefaultProviderInputSchema = z.object({
20
- provider: z.string(),
21
- });
22
- const SetOperationConfigInputSchema = z.object({
23
- operation: z.enum(['execute_task', 'quality_checks', 'ai_codereview', 'ai_merge', 'improve_task']),
24
- config: OperationConfigSchema,
25
- });
26
- const ValidateProvidersInputSchema = z.object({
27
- force: z.boolean().optional(),
28
- });
29
- /**
30
- * Build AI router with required dependencies
31
- */
32
- export function buildAIRoutes(options) {
33
- const { agentService } = options;
34
- return {
35
- /**
36
- * List all registered AI providers with health status
37
- */
38
- listProviders: publicProcedure.query(async () => {
39
- try {
40
- const providers = agentService.getAvailableProviders();
41
- const providerStatuses = await agentService.validateProviders();
42
- const result = Array.from(providers.entries()).map(([name, provider]) => {
43
- const status = providerStatuses.get(name);
44
- return {
45
- name,
46
- displayName: provider.displayName,
47
- available: status?.available || false,
48
- error: status?.error,
49
- capabilities: status?.capabilities || provider.getCapabilities(),
50
- models: status?.models || [],
51
- };
52
- });
53
- log.debug('Listed AI providers', { count: result.length }, 'ai-router');
54
- return result;
55
- }
56
- catch (error) {
57
- const msg = `Failed to list providers: ${error instanceof Error ? error.message : String(error)}`;
58
- log.error(msg, error, 'ai-router');
59
- throw new Error(msg);
60
- }
61
- }),
62
- /**
63
- * List available models from providers
64
- */
65
- listModels: publicProcedure.input(ListModelsInputSchema.optional()).query(async ({ input }) => {
66
- try {
67
- if (input?.provider) {
68
- // Get models from specific provider
69
- const provider = agentService.getAvailableProviders().get(input.provider);
70
- if (!provider) {
71
- throw new Error(`Provider ${input.provider} not found`);
72
- }
73
- const models = await provider.detectAvailableModels();
74
- log.debug('Listed models for provider', { provider: input.provider, count: models.length }, 'ai-router');
75
- return models;
76
- }
77
- else {
78
- // Get models from all providers
79
- const models = await agentService.getAvailableModels();
80
- log.debug('Listed all available models', { count: models.length }, 'ai-router');
81
- return models;
82
- }
83
- }
84
- catch (error) {
85
- const msg = `Failed to list models: ${error instanceof Error ? error.message : String(error)}`;
86
- log.error(msg, error, 'ai-router');
87
- throw new Error(msg);
88
- }
89
- }),
90
- /**
91
- * Get current routing policy
92
- */
93
- getRoutingPolicy: publicProcedure.query(async () => {
94
- try {
95
- const rpm = agentService.getRoutingPolicyManager?.();
96
- if (!rpm) {
97
- const settings = getSettingsService().getSettings();
98
- return {
99
- defaultProvider: settings.agents.defaultProvider || 'claude-code',
100
- operations: {},
101
- };
102
- }
103
- const policy = (rpm.getEffectivePolicy
104
- ? await rpm.getEffectivePolicy()
105
- : await rpm.getPolicy());
106
- log.debug('Retrieved routing policy', { policy }, 'ai-router');
107
- return policy;
108
- }
109
- catch (error) {
110
- const msg = `Failed to get routing policy: ${error instanceof Error ? error.message : String(error)}`;
111
- log.error(msg, error, 'ai-router');
112
- throw new Error(msg);
113
- }
114
- }),
115
- /**
116
- * Update routing policy
117
- */
118
- updateRoutingPolicy: publicProcedure
119
- .input(UpdateRoutingPolicyInputSchema)
120
- .mutation(async ({ input }) => {
121
- try {
122
- const routingManager = agentService.getRoutingPolicyManager();
123
- if (!routingManager) {
124
- throw new Error('Routing policy manager not available');
125
- }
126
- await routingManager.updatePolicy(input.policy);
127
- const updatedPolicy = await routingManager.getPolicy();
128
- log.info('Updated routing policy', { updates: input.policy }, 'ai-router');
129
- return { success: true, policy: updatedPolicy };
130
- }
131
- catch (error) {
132
- const msg = `Failed to update routing policy: ${error instanceof Error ? error.message : String(error)}`;
133
- log.error(msg, error, 'ai-router');
134
- throw new Error(msg);
135
- }
136
- }),
137
- /**
138
- * Set default provider
139
- */
140
- setDefaultProvider: publicProcedure
141
- .input(SetDefaultProviderInputSchema)
142
- .mutation(async ({ input }) => {
143
- try {
144
- const routingManager = agentService.getRoutingPolicyManager();
145
- if (!routingManager) {
146
- throw new Error('Routing policy manager not available');
147
- }
148
- // Validate provider exists
149
- const providers = agentService.getAvailableProviders();
150
- if (!providers.has(input.provider)) {
151
- throw new Error(`Provider ${input.provider} not found`);
152
- }
153
- await routingManager.setDefaultProvider(input.provider);
154
- log.info('Set default provider', { provider: input.provider }, 'ai-router');
155
- return { success: true, provider: input.provider };
156
- }
157
- catch (error) {
158
- const msg = `Failed to set default provider: ${error instanceof Error ? error.message : String(error)}`;
159
- log.error(msg, error, 'ai-router');
160
- throw new Error(msg);
161
- }
162
- }),
163
- /**
164
- * Set operation-specific configuration
165
- */
166
- setOperationConfig: publicProcedure
167
- .input(SetOperationConfigInputSchema)
168
- .mutation(async ({ input }) => {
169
- try {
170
- const routingManager = agentService.getRoutingPolicyManager();
171
- if (!routingManager) {
172
- throw new Error('Routing policy manager not available');
173
- }
174
- // Validate provider exists
175
- const providers = agentService.getAvailableProviders();
176
- if (!providers.has(input.config.provider)) {
177
- throw new Error(`Provider ${input.config.provider} not found`);
178
- }
179
- // Validate fallback providers if specified
180
- if (input.config.fallback) {
181
- for (const fallbackProvider of input.config.fallback) {
182
- if (!providers.has(fallbackProvider)) {
183
- throw new Error(`Fallback provider ${fallbackProvider} not found`);
184
- }
185
- }
186
- }
187
- await routingManager.setOperationConfig(input.operation, input.config);
188
- log.info('Set operation config', { operation: input.operation, config: input.config }, 'ai-router');
189
- return { success: true };
190
- }
191
- catch (error) {
192
- const msg = `Failed to set operation config: ${error instanceof Error ? error.message : String(error)}`;
193
- log.error(msg, error, 'ai-router');
194
- throw new Error(msg);
195
- }
196
- }),
197
- /**
198
- * Validate provider setup and refresh health status
199
- */
200
- validateProviders: publicProcedure
201
- .input(ValidateProvidersInputSchema.optional())
202
- .mutation(async ({ input }) => {
203
- try {
204
- const results = await agentService.validateProviders();
205
- const validation = Array.from(results.entries()).map(([name, status]) => ({
206
- provider: name,
207
- available: status.available,
208
- error: status.error,
209
- modelCount: status.models.length,
210
- capabilities: status.capabilities,
211
- }));
212
- log.info('Validated providers', {
213
- force: input?.force || false,
214
- results: validation,
215
- }, 'ai-router');
216
- return {
217
- success: true,
218
- results: validation,
219
- totalProviders: validation.length,
220
- availableProviders: validation.filter((p) => p.available).length,
221
- };
222
- }
223
- catch (error) {
224
- const msg = `Failed to validate providers: ${error instanceof Error ? error.message : String(error)}`;
225
- log.error(msg, error, 'ai-router');
226
- throw new Error(msg);
227
- }
228
- }),
229
- };
230
- }
231
- /**
232
- * Test-friendly plain handlers mirroring the AI routes, without tRPC wrappers.
233
- * Useful for unit tests that call functions directly.
234
- */
235
- export function buildAIRouteHandlers(options) {
236
- const { agentService } = options;
237
- return {
238
- async listProviders() {
239
- try {
240
- const providers = agentService.getAvailableProviders();
241
- const providerStatuses = await agentService.validateProviders();
242
- return Array.from(providers.entries()).map(([name, provider]) => {
243
- const status = providerStatuses.get(name);
244
- return {
245
- name,
246
- displayName: provider.displayName,
247
- available: status?.available || false,
248
- error: status?.error,
249
- capabilities: status?.capabilities || provider.getCapabilities?.(),
250
- models: status?.models || [],
251
- };
252
- });
253
- }
254
- catch (error) {
255
- throw new Error(`Failed to list providers: ${error instanceof Error ? error.message : String(error)}`);
256
- }
257
- },
258
- async listModels(input) {
259
- try {
260
- if (input?.provider) {
261
- const provider = agentService.getAvailableProviders().get(input.provider);
262
- if (!provider)
263
- throw new Error(`Provider ${input.provider} not found`);
264
- return await provider.detectAvailableModels();
265
- }
266
- return await agentService.getAvailableModels();
267
- }
268
- catch (error) {
269
- throw new Error(`Failed to list models: ${error instanceof Error ? error.message : String(error)}`);
270
- }
271
- },
272
- async getRoutingPolicy() {
273
- try {
274
- const rpm = agentService.getRoutingPolicyManager?.() ||
275
- agentService.routingPolicyManager;
276
- const policy = await rpm?.getPolicy();
277
- if (!policy) {
278
- const settings = getSettingsService().getSettings();
279
- return {
280
- defaultProvider: settings.agents.defaultProvider || 'claude-code',
281
- operations: {},
282
- };
283
- }
284
- return policy;
285
- }
286
- catch (error) {
287
- throw new Error(`Failed to get routing policy: ${error instanceof Error ? error.message : String(error)}`);
288
- }
289
- },
290
- async updateRoutingPolicy(input) {
291
- try {
292
- const routingManager = agentService.getRoutingPolicyManager?.() ||
293
- agentService.routingPolicyManager;
294
- if (!routingManager)
295
- throw new Error('Routing policy manager not available');
296
- await routingManager.updatePolicy(input.policy);
297
- const updatedPolicy = await routingManager.getPolicy();
298
- return { success: true, policy: updatedPolicy };
299
- }
300
- catch (error) {
301
- throw new Error(`Failed to update routing policy: ${error instanceof Error ? error.message : String(error)}`);
302
- }
303
- },
304
- async setDefaultProvider(input) {
305
- try {
306
- const routingManager = agentService.getRoutingPolicyManager?.() ||
307
- agentService.routingPolicyManager;
308
- if (!routingManager)
309
- throw new Error('Routing policy manager not available');
310
- const providers = agentService.getAvailableProviders();
311
- if (!providers.has(input.provider))
312
- throw new Error(`Provider ${input.provider} not found`);
313
- await routingManager.setDefaultProvider(input.provider);
314
- return { success: true, provider: input.provider };
315
- }
316
- catch (error) {
317
- throw new Error(`Failed to set default provider: ${error instanceof Error ? error.message : String(error)}`);
318
- }
319
- },
320
- async setOperationConfig(input) {
321
- try {
322
- const routingManager = agentService.getRoutingPolicyManager?.() ||
323
- agentService.routingPolicyManager;
324
- if (!routingManager)
325
- throw new Error('Routing policy manager not available');
326
- const providers = agentService.getAvailableProviders();
327
- if (!providers.has(input.config.provider)) {
328
- throw new Error(`Provider ${input.config.provider} not found`);
329
- }
330
- if (input.config.fallback) {
331
- for (const fallbackProvider of input.config.fallback) {
332
- if (!providers.has(fallbackProvider)) {
333
- throw new Error(`Fallback provider ${fallbackProvider} not found`);
334
- }
335
- }
336
- }
337
- await routingManager.setOperationConfig(input.operation, input.config);
338
- return { success: true };
339
- }
340
- catch (error) {
341
- throw new Error(`Failed to set operation config: ${error instanceof Error ? error.message : String(error)}`);
342
- }
343
- },
344
- async validateProviders() {
345
- try {
346
- const results = await agentService.validateProviders();
347
- const validation = Array.from(results.entries()).map(([name, status]) => ({
348
- provider: name,
349
- available: status.available,
350
- error: status.error,
351
- modelCount: status.models.length,
352
- capabilities: status.capabilities,
353
- }));
354
- return {
355
- success: true,
356
- results: validation,
357
- totalProviders: validation.length,
358
- availableProviders: validation.filter((p) => p.available).length,
359
- };
360
- }
361
- catch (error) {
362
- throw new Error(`Failed to validate providers: ${error instanceof Error ? error.message : String(error)}`);
363
- }
364
- },
365
- async getProviderHealth() {
366
- try {
367
- const providers = agentService.getAvailableProviders();
368
- const statuses = await agentService.validateProviders();
369
- const health = {
370
- totalProviders: providers.size,
371
- availableProviders: 0,
372
- unavailableProviders: 0,
373
- providers: [],
374
- };
375
- for (const [name] of providers) {
376
- const status = statuses.get(name);
377
- const isAvailable = status?.available || false;
378
- if (isAvailable)
379
- health.availableProviders++;
380
- else
381
- health.unavailableProviders++;
382
- health.providers.push({
383
- name,
384
- available: isAvailable,
385
- error: status?.error,
386
- modelCount: status?.models.length || 0,
387
- });
388
- }
389
- return health;
390
- }
391
- catch (error) {
392
- throw new Error(`Failed to get provider health: ${error instanceof Error ? error.message : String(error)}`);
393
- }
394
- },
395
- };
396
- }
@@ -1,98 +0,0 @@
1
- import type { TaskService } from '../../tasks/task-service.js';
2
- import type { VibingOrchestrator } from '../../workflows/vibing-orchestrator.js';
3
- type Deps = {
4
- taskService: TaskService;
5
- vibingOrchestrator: VibingOrchestrator;
6
- };
7
- export declare function buildExecutionRoutes({ taskService, vibingOrchestrator }: Deps): {
8
- readonly executeTask: import("@trpc/server").TRPCMutationProcedure<{
9
- input: {
10
- taskId: string;
11
- };
12
- output: {
13
- readonly executionId: string;
14
- };
15
- meta: object;
16
- }>;
17
- readonly stopTaskExecution: import("@trpc/server").TRPCMutationProcedure<{
18
- input: {
19
- executionId: string;
20
- };
21
- output: {
22
- readonly success: true;
23
- };
24
- meta: object;
25
- }>;
26
- readonly getTaskExecutionStatus: import("@trpc/server").TRPCQueryProcedure<{
27
- input: {
28
- executionId: string;
29
- };
30
- output: import("../../types/index.js").AgentExecution | null;
31
- meta: object;
32
- }>;
33
- readonly getTaskExecutionLogs: import("@trpc/server").TRPCQueryProcedure<{
34
- input: {
35
- executionId: string;
36
- };
37
- output: {
38
- logs: any[];
39
- };
40
- meta: object;
41
- }>;
42
- readonly getTaskExecutions: import("@trpc/server").TRPCQueryProcedure<{
43
- input: {
44
- taskId: string;
45
- };
46
- output: import("../../types/index.js").AgentExecution[];
47
- meta: object;
48
- }>;
49
- readonly getTaskExecutionStats: import("@trpc/server").TRPCQueryProcedure<{
50
- input: void;
51
- output: {
52
- total: number;
53
- pending: number;
54
- running: number;
55
- completed: number;
56
- failed: number;
57
- cancelled: number;
58
- worktrees: {
59
- active: number;
60
- total: number;
61
- enabled: boolean;
62
- };
63
- };
64
- meta: object;
65
- }>;
66
- readonly improveTask: import("@trpc/server").TRPCMutationProcedure<{
67
- input: {
68
- title: string;
69
- type: "feature" | "bug" | "chore" | "refactor" | "test" | "doc";
70
- priority: "low" | "medium" | "high";
71
- content: string;
72
- taskId: string;
73
- executionId?: string | undefined;
74
- };
75
- output: {
76
- type: string;
77
- priority: string;
78
- content: string;
79
- title?: string;
80
- executionId: string;
81
- selectedModel?: string;
82
- };
83
- meta: object;
84
- }>;
85
- readonly onExecutionUpdate: import("@trpc/server").TRPCSubscriptionProcedure<{
86
- input: {
87
- executionId: string;
88
- };
89
- output: AsyncIterable<{
90
- executionId: string;
91
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
92
- logs: string[];
93
- error?: string;
94
- }, void, any>;
95
- meta: object;
96
- }>;
97
- };
98
- export {};