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,171 +0,0 @@
1
- /**
2
- * AI Routing Policy Management
3
- * Handles provider selection per operation with fallbacks and configuration
4
- */
5
- import { z } from 'zod';
6
- /**
7
- * Operation types that support AI routing
8
- */
9
- declare const ROUTABLE_OPERATIONS: readonly ["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"];
10
- export type RoutableOperation = (typeof ROUTABLE_OPERATIONS)[number];
11
- /**
12
- * Generation options for AI execution
13
- */
14
- export declare const GenerationOptionsSchema: z.ZodObject<{
15
- temperature: z.ZodOptional<z.ZodNumber>;
16
- maxTokens: z.ZodOptional<z.ZodNumber>;
17
- tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
- }, "strip", z.ZodTypeAny, {
19
- temperature?: number | undefined;
20
- maxTokens?: number | undefined;
21
- tools?: string[] | undefined;
22
- }, {
23
- temperature?: number | undefined;
24
- maxTokens?: number | undefined;
25
- tools?: string[] | undefined;
26
- }>;
27
- export type GenerationOptions = z.infer<typeof GenerationOptionsSchema>;
28
- /**
29
- * Per-operation routing configuration
30
- */
31
- export declare const OperationConfigSchema: z.ZodObject<{
32
- provider: z.ZodString;
33
- model: z.ZodOptional<z.ZodString>;
34
- options: z.ZodOptional<z.ZodObject<{
35
- temperature: z.ZodOptional<z.ZodNumber>;
36
- maxTokens: z.ZodOptional<z.ZodNumber>;
37
- tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
- }, "strip", z.ZodTypeAny, {
39
- temperature?: number | undefined;
40
- maxTokens?: number | undefined;
41
- tools?: string[] | undefined;
42
- }, {
43
- temperature?: number | undefined;
44
- maxTokens?: number | undefined;
45
- tools?: string[] | undefined;
46
- }>>;
47
- fallback: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
- }, "strip", z.ZodTypeAny, {
49
- provider: string;
50
- options?: {
51
- temperature?: number | undefined;
52
- maxTokens?: number | undefined;
53
- tools?: string[] | undefined;
54
- } | undefined;
55
- model?: string | undefined;
56
- fallback?: string[] | undefined;
57
- }, {
58
- provider: string;
59
- options?: {
60
- temperature?: number | undefined;
61
- maxTokens?: number | undefined;
62
- tools?: string[] | undefined;
63
- } | undefined;
64
- model?: string | undefined;
65
- fallback?: string[] | undefined;
66
- }>;
67
- export type OperationConfig = z.infer<typeof OperationConfigSchema>;
68
- /**
69
- * Complete routing policy schema
70
- */
71
- export declare const RoutingPolicySchema: z.ZodObject<{
72
- defaultProvider: z.ZodString;
73
- operations: z.ZodOptional<z.ZodRecord<z.ZodEnum<["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"]>, z.ZodObject<{
74
- provider: z.ZodString;
75
- model: z.ZodOptional<z.ZodString>;
76
- options: z.ZodOptional<z.ZodObject<{
77
- temperature: z.ZodOptional<z.ZodNumber>;
78
- maxTokens: z.ZodOptional<z.ZodNumber>;
79
- tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
80
- }, "strip", z.ZodTypeAny, {
81
- temperature?: number | undefined;
82
- maxTokens?: number | undefined;
83
- tools?: string[] | undefined;
84
- }, {
85
- temperature?: number | undefined;
86
- maxTokens?: number | undefined;
87
- tools?: string[] | undefined;
88
- }>>;
89
- fallback: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
90
- }, "strip", z.ZodTypeAny, {
91
- provider: string;
92
- options?: {
93
- temperature?: number | undefined;
94
- maxTokens?: number | undefined;
95
- tools?: string[] | undefined;
96
- } | undefined;
97
- model?: string | undefined;
98
- fallback?: string[] | undefined;
99
- }, {
100
- provider: string;
101
- options?: {
102
- temperature?: number | undefined;
103
- maxTokens?: number | undefined;
104
- tools?: string[] | undefined;
105
- } | undefined;
106
- model?: string | undefined;
107
- fallback?: string[] | undefined;
108
- }>>>;
109
- }, "strip", z.ZodTypeAny, {
110
- defaultProvider: string;
111
- operations?: Partial<Record<"execute_task" | "quality_checks" | "improve_task" | "ai_merge" | "ai_codereview", {
112
- provider: string;
113
- options?: {
114
- temperature?: number | undefined;
115
- maxTokens?: number | undefined;
116
- tools?: string[] | undefined;
117
- } | undefined;
118
- model?: string | undefined;
119
- fallback?: string[] | undefined;
120
- }>> | undefined;
121
- }, {
122
- defaultProvider: string;
123
- operations?: Partial<Record<"execute_task" | "quality_checks" | "improve_task" | "ai_merge" | "ai_codereview", {
124
- provider: string;
125
- options?: {
126
- temperature?: number | undefined;
127
- maxTokens?: number | undefined;
128
- tools?: string[] | undefined;
129
- } | undefined;
130
- model?: string | undefined;
131
- fallback?: string[] | undefined;
132
- }>> | undefined;
133
- }>;
134
- export type RoutingPolicy = z.infer<typeof RoutingPolicySchema>;
135
- export declare const ROUTABLE_OPERATION_LIST: readonly ["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"];
136
- /**
137
- * Resolved provider configuration for execution
138
- */
139
- export interface ResolvedProvider {
140
- provider: string;
141
- model?: string;
142
- options?: GenerationOptions;
143
- fallbacks?: string[];
144
- }
145
- /**
146
- * Routing Policy Manager
147
- * Manages AI provider routing policies stored inside settings.json
148
- */
149
- export declare class RoutingPolicyManager {
150
- private policy;
151
- private readonly settingsService;
152
- constructor();
153
- /**
154
- * Get current effective policy (lazy loads from settings)
155
- */
156
- getPolicy(): Promise<RoutingPolicy>;
157
- /**
158
- * Update routing policy and persist via settings service
159
- */
160
- updatePolicy(updates: Partial<RoutingPolicy>): Promise<void>;
161
- /**
162
- * Resolve provider for a specific operation
163
- */
164
- getEffectivePolicy(): Promise<RoutingPolicy>;
165
- resolveProviderForOperation(operation: RoutableOperation, overrides?: Partial<ResolvedProvider>): Promise<ResolvedProvider>;
166
- setDefaultProvider(provider: string): Promise<void>;
167
- setOperationConfig(operation: RoutableOperation, config: OperationConfig): Promise<void>;
168
- validatePolicy(policy: RoutingPolicy, availableProviders: Set<string>): string[];
169
- private buildPolicyFromSettings;
170
- }
171
- export {};
@@ -1,196 +0,0 @@
1
- /**
2
- * AI Routing Policy Management
3
- * Handles provider selection per operation with fallbacks and configuration
4
- */
5
- import { z } from 'zod';
6
- import { log } from '../lib/logger.js';
7
- import { getSettingsService } from '../settings-service.js';
8
- /**
9
- * Operation types that support AI routing
10
- */
11
- const ROUTABLE_OPERATIONS = [
12
- 'execute_task',
13
- 'quality_checks',
14
- 'ai_codereview',
15
- 'ai_merge',
16
- 'improve_task',
17
- ];
18
- /**
19
- * Generation options for AI execution
20
- */
21
- export const GenerationOptionsSchema = z.object({
22
- temperature: z.number().min(0).max(2).optional(),
23
- maxTokens: z.number().positive().optional(),
24
- tools: z.array(z.string()).optional(),
25
- });
26
- /**
27
- * Per-operation routing configuration
28
- */
29
- export const OperationConfigSchema = z.object({
30
- provider: z.string(),
31
- model: z.string().optional(),
32
- options: GenerationOptionsSchema.optional(),
33
- fallback: z.array(z.string()).optional(),
34
- });
35
- /**
36
- * Complete routing policy schema
37
- */
38
- export const RoutingPolicySchema = z.object({
39
- defaultProvider: z.string(),
40
- operations: z.record(z.enum(ROUTABLE_OPERATIONS), OperationConfigSchema).optional(),
41
- });
42
- export const ROUTABLE_OPERATION_LIST = ROUTABLE_OPERATIONS;
43
- /**
44
- * Routing Policy Manager
45
- * Manages AI provider routing policies stored inside settings.json
46
- */
47
- export class RoutingPolicyManager {
48
- constructor() {
49
- this.policy = null;
50
- this.settingsService = getSettingsService();
51
- // Invalidate cached policy when settings change
52
- this.settingsService.on('settingsUpdated', () => {
53
- this.policy = null;
54
- });
55
- }
56
- /**
57
- * Get current effective policy (lazy loads from settings)
58
- */
59
- async getPolicy() {
60
- if (!this.policy) {
61
- this.policy = this.buildPolicyFromSettings();
62
- }
63
- return this.policy;
64
- }
65
- /**
66
- * Update routing policy and persist via settings service
67
- */
68
- async updatePolicy(updates) {
69
- const currentPolicy = await this.getPolicy();
70
- const mergedOperations = {
71
- ...(currentPolicy.operations ?? {}),
72
- ...(updates.operations ?? {}),
73
- };
74
- const operationsKeys = Object.keys(mergedOperations);
75
- const nextPolicy = {
76
- defaultProvider: updates.defaultProvider ?? currentPolicy.defaultProvider,
77
- ...(operationsKeys.length > 0 ? { operations: mergedOperations } : {}),
78
- };
79
- const validated = RoutingPolicySchema.parse(nextPolicy);
80
- await this.settingsService.updateSettings([
81
- { path: ['agents', 'routingPolicy'], value: validated },
82
- ]);
83
- this.policy = validated;
84
- log.info('Updated AI routing policy', { policy: validated }, 'routing-policy');
85
- }
86
- /**
87
- * Resolve provider for a specific operation
88
- */
89
- async getEffectivePolicy() {
90
- const base = await this.getPolicy();
91
- const operations = {
92
- ...base.operations,
93
- };
94
- for (const op of ROUTABLE_OPERATIONS) {
95
- if (!operations[op]) {
96
- const resolved = await this.resolveProviderForOperation(op);
97
- operations[op] = {
98
- provider: resolved.provider,
99
- ...(resolved.model ? { model: resolved.model } : {}),
100
- ...(resolved.options ? { options: resolved.options } : {}),
101
- ...(resolved.fallbacks && resolved.fallbacks.length
102
- ? { fallback: resolved.fallbacks }
103
- : {}),
104
- };
105
- }
106
- }
107
- return {
108
- defaultProvider: base.defaultProvider,
109
- operations,
110
- };
111
- }
112
- async resolveProviderForOperation(operation, overrides) {
113
- const policy = await this.getPolicy();
114
- const operationConfig = policy.operations?.[operation];
115
- // Pull provider/model defaults from settings per operation
116
- const settings = this.settingsService.getSettings();
117
- const coding = settings.agents?.codingAgent;
118
- const judge = settings.agents?.judgeAgent;
119
- const settingsProviderModel = (() => {
120
- switch (operation) {
121
- case 'ai_codereview':
122
- return { provider: judge?.provider, model: judge?.model };
123
- case 'execute_task':
124
- case 'quality_checks':
125
- case 'ai_merge':
126
- case 'improve_task':
127
- default:
128
- return { provider: coding?.provider, model: coding?.model };
129
- }
130
- })();
131
- // Start with operation-specific config or fall back to settings, then default policy
132
- const baseProvider = operationConfig?.provider || settingsProviderModel.provider || policy.defaultProvider;
133
- const baseModel = operationConfig?.model
134
- ? operationConfig.model
135
- : operationConfig?.provider
136
- ? undefined
137
- : settingsProviderModel.model;
138
- const baseOptions = operationConfig?.options;
139
- const baseFallbacks = operationConfig?.fallback || [];
140
- // Apply overrides
141
- const overrideProviderOnly = overrides?.provider && overrides.model === undefined;
142
- const resolved = {
143
- provider: overrides?.provider || baseProvider,
144
- model: overrideProviderOnly ? undefined : overrides?.model || baseModel,
145
- options: overrides?.options || baseOptions,
146
- fallbacks: overrides?.fallbacks || baseFallbacks,
147
- };
148
- log.debug(`Resolved provider for ${operation}`, { operation, resolved }, 'routing-policy');
149
- return resolved;
150
- }
151
- async setDefaultProvider(provider) {
152
- await this.updatePolicy({ defaultProvider: provider });
153
- }
154
- async setOperationConfig(operation, config) {
155
- const currentPolicy = await this.getPolicy();
156
- const operations = {
157
- ...(currentPolicy.operations ?? {}),
158
- [operation]: config,
159
- };
160
- await this.updatePolicy({ operations });
161
- }
162
- validatePolicy(policy, availableProviders) {
163
- const errors = [];
164
- if (!availableProviders.has(policy.defaultProvider)) {
165
- errors.push(`Default provider '${policy.defaultProvider}' is not available`);
166
- }
167
- if (policy.operations) {
168
- for (const [operation, config] of Object.entries(policy.operations)) {
169
- if (!availableProviders.has(config.provider)) {
170
- errors.push(`Provider '${config.provider}' for operation '${operation}' is not available`);
171
- }
172
- if (config.fallback) {
173
- for (const fallbackProvider of config.fallback) {
174
- if (!availableProviders.has(fallbackProvider)) {
175
- errors.push(`Fallback provider '${fallbackProvider}' for operation '${operation}' is not available`);
176
- }
177
- }
178
- }
179
- }
180
- }
181
- return errors;
182
- }
183
- buildPolicyFromSettings() {
184
- const settings = this.settingsService.getSettings();
185
- const settingsPolicy = settings.agents?.routingPolicy;
186
- const defaultProvider = settingsPolicy?.defaultProvider || settings.agents.defaultProvider || 'claude-code';
187
- const operations = settingsPolicy?.operations
188
- ? { ...settingsPolicy.operations }
189
- : undefined;
190
- const policy = {
191
- defaultProvider,
192
- ...(operations ? { operations } : {}),
193
- };
194
- return RoutingPolicySchema.parse(policy);
195
- }
196
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,63 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll, afterEach } from 'vitest';
2
- import { RoutingPolicyManager, } from './routing-policy.js';
3
- import { getSettingsService } from '../settings-service.js';
4
- const settingsService = getSettingsService();
5
- const BASE_POLICY = {
6
- defaultProvider: 'claude-code',
7
- operations: {},
8
- };
9
- let originalRoutingPolicy;
10
- async function setRoutingPolicy(value) {
11
- const result = await settingsService.updateSettings([
12
- { path: ['agents', 'routingPolicy'], value },
13
- ]);
14
- if (!result.success) {
15
- throw new Error(`Failed to set routing policy: ${JSON.stringify(result.errors)}`);
16
- }
17
- }
18
- describe('RoutingPolicyManager resolve precedence', () => {
19
- beforeAll(async () => {
20
- await settingsService.initialize();
21
- const manager = new RoutingPolicyManager();
22
- originalRoutingPolicy = await manager.getPolicy();
23
- await setRoutingPolicy(BASE_POLICY);
24
- });
25
- afterEach(async () => {
26
- await setRoutingPolicy(BASE_POLICY);
27
- });
28
- afterAll(async () => {
29
- await setRoutingPolicy(originalRoutingPolicy);
30
- });
31
- it('falls back to settings when no operation config or overrides', async () => {
32
- const rpm = new RoutingPolicyManager();
33
- const resolved = await rpm.resolveProviderForOperation('execute_task');
34
- expect(resolved.provider).toBe('claude-code');
35
- expect(resolved.model).toBe('claude-sonnet-4-20250514');
36
- });
37
- it('uses operation-specific policy when provided', async () => {
38
- const rpm = new RoutingPolicyManager();
39
- await rpm.updatePolicy({
40
- operations: {
41
- ai_merge: { provider: 'codex', model: 'gpt-5' },
42
- },
43
- });
44
- const resolved = await rpm.resolveProviderForOperation('ai_merge');
45
- expect(resolved.provider).toBe('codex');
46
- expect(resolved.model).toBe('gpt-5');
47
- });
48
- it('when override sets provider without model, does not inherit mismatched model', async () => {
49
- const rpm = new RoutingPolicyManager();
50
- await rpm.updatePolicy({ operations: {} });
51
- const override = { provider: 'codex' };
52
- const resolved = await rpm.resolveProviderForOperation('execute_task', override);
53
- expect(resolved.provider).toBe('codex');
54
- expect(resolved.model).toBeUndefined();
55
- });
56
- it('override with provider+model takes full precedence', async () => {
57
- const rpm = new RoutingPolicyManager();
58
- const override = { provider: 'codex', model: 'gpt-5' };
59
- const resolved = await rpm.resolveProviderForOperation('execute_task', override);
60
- expect(resolved.provider).toBe('codex');
61
- expect(resolved.model).toBe('gpt-5');
62
- });
63
- });
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- import type { TaskService } from '../tasks/task-service.js';
3
- export declare const TaskIdSchema: z.ZodObject<{
4
- taskId: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- taskId: string;
7
- }, {
8
- taskId: string;
9
- }>;
10
- export declare const ExecutionIdSchema: z.ZodObject<{
11
- executionId: z.ZodString;
12
- }, "strip", z.ZodTypeAny, {
13
- executionId: string;
14
- }, {
15
- executionId: string;
16
- }>;
17
- export declare const WorkflowIdSchema: z.ZodObject<{
18
- workflowId: z.ZodString;
19
- }, "strip", z.ZodTypeAny, {
20
- workflowId: string;
21
- }, {
22
- workflowId: string;
23
- }>;
24
- export declare const WorktreePathSchema: z.ZodObject<{
25
- worktreePath: z.ZodString;
26
- }, "strip", z.ZodTypeAny, {
27
- worktreePath: string;
28
- }, {
29
- worktreePath: string;
30
- }>;
31
- export declare const withErrors: <TArgs extends any[], TRes>(action: string, tag: string, fn: (...args: TArgs) => Promise<TRes>) => (...args: TArgs) => Promise<TRes>;
32
- export declare function makeAssertTaskActive(taskService: TaskService): (id: string) => import("../types/index.js").Task;
@@ -1,31 +0,0 @@
1
- import { z } from 'zod';
2
- import { log } from '../lib/logger.js';
3
- // Shared input schemas
4
- export const TaskIdSchema = z.object({ taskId: z.string() });
5
- export const ExecutionIdSchema = z.object({ executionId: z.string() });
6
- export const WorkflowIdSchema = z.object({ workflowId: z.string() });
7
- export const WorktreePathSchema = z.object({ worktreePath: z.string() });
8
- // Centralized error formatter for consistent messages
9
- export const withErrors = (action, tag, fn) => {
10
- return async (...args) => {
11
- try {
12
- return await fn(...args);
13
- }
14
- catch (error) {
15
- log.error(`Error in ${action}`, error, tag);
16
- const msg = error instanceof Error ? error.message : String(error);
17
- throw new Error(`Failed to ${action}: ${msg}`);
18
- }
19
- };
20
- };
21
- // Factory for active-task assertion to avoid repeating checks
22
- export function makeAssertTaskActive(taskService) {
23
- return (id) => {
24
- const t = taskService.getTask(id);
25
- if (!t)
26
- throw new Error(`Task ${id} not found`);
27
- if (t.deleted_at)
28
- throw new Error(`Task ${id} is deleted`);
29
- return t;
30
- };
31
- }