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,61 +0,0 @@
1
- /**
2
- * Claude Code Adapter
3
- * Implements AIProvider interface for Claude Code SDK
4
- */
5
- import { AIProvider, ExecutionOptions, ExecutionMessage, ExecutionResult, ModelInfo, ProviderStatus, ProviderCapabilities } from './types.js';
6
- /**
7
- * Configuration for Claude Code Adapter
8
- */
9
- export interface ClaudeCodeConfig {
10
- /**
11
- * Path to Claude CLI executable
12
- * If not provided, will use default resolution
13
- */
14
- claudeBinPath?: string;
15
- /**
16
- * Default working directory
17
- */
18
- defaultWorkingDirectory?: string;
19
- /**
20
- * Default model to use
21
- */
22
- defaultModel?: string;
23
- }
24
- /**
25
- * Claude Code Adapter
26
- * Wraps the Claude Code SDK to implement the AIProvider interface
27
- */
28
- export declare class ClaudeCodeAdapter implements AIProvider {
29
- readonly name = "claude-code";
30
- readonly displayName = "Claude Code";
31
- private config;
32
- constructor(config?: ClaudeCodeConfig);
33
- /**
34
- * Execute a prompt using Claude Code SDK
35
- */
36
- execute(prompt: string, options?: ExecutionOptions): AsyncIterableIterator<ExecutionMessage>;
37
- /**
38
- * Execute synchronously and return the final result
39
- */
40
- executeSync(prompt: string, options?: ExecutionOptions): Promise<ExecutionResult>;
41
- /**
42
- * Detect available Claude models
43
- */
44
- detectAvailableModels(): Promise<ModelInfo[]>;
45
- /**
46
- * Validate Claude Code setup using enhanced detection
47
- */
48
- validateSetup(): Promise<ProviderStatus>;
49
- /**
50
- * Get provider capabilities
51
- */
52
- getCapabilities(): ProviderCapabilities;
53
- /**
54
- * Map ExecutionOptions to Claude Code Options
55
- */
56
- private mapToClaudeOptions;
57
- /**
58
- * Resolve Claude CLI executable path using enhanced detection
59
- */
60
- private getClaudeExecutablePath;
61
- }
@@ -1,362 +0,0 @@
1
- /**
2
- * Claude Code Adapter
3
- * Implements AIProvider interface for Claude Code SDK
4
- */
5
- import { query } from '@anthropic-ai/claude-code';
6
- import { generateId } from '../../lib/id-generator.js';
7
- import { getSettingsService } from '../../settings-service.js';
8
- import { getProviderDetectionService } from '../../lib/provider-detection.js';
9
- /**
10
- * Claude Code Adapter
11
- * Wraps the Claude Code SDK to implement the AIProvider interface
12
- */
13
- export class ClaudeCodeAdapter {
14
- constructor(config = {}) {
15
- this.name = 'claude-code';
16
- this.displayName = 'Claude Code';
17
- this.config = config;
18
- }
19
- /**
20
- * Execute a prompt using Claude Code SDK
21
- */
22
- async *execute(prompt, options) {
23
- const claudeOptions = await this.mapToClaudeOptions(options);
24
- const co = claudeOptions;
25
- const startTime = Date.now();
26
- let sessionId;
27
- // let totalCost = 0;
28
- let promptTokens = 0;
29
- let completionTokens = 0;
30
- try {
31
- // Emit a synthetic system message with the effective prompt we send to the provider
32
- const sysParts = [];
33
- if (co.systemPrompt) {
34
- sysParts.push('--- System Prompt ---');
35
- sysParts.push(String(co.systemPrompt));
36
- sysParts.push('--- End System Prompt ---');
37
- }
38
- if (co.appendSystemPrompt) {
39
- sysParts.push('--- Append System Prompt ---');
40
- sysParts.push(String(co.appendSystemPrompt));
41
- sysParts.push('--- End Append System Prompt ---');
42
- }
43
- sysParts.push('--- User Prompt ---');
44
- sysParts.push(String(prompt));
45
- sysParts.push('--- End User Prompt ---');
46
- yield {
47
- type: 'system',
48
- timestamp: new Date().toISOString(),
49
- content: `Effective prompt sent to ${this.displayName} (model: ${co.model || this.config.defaultModel || 'claude-sonnet-4-20250514'}):\n${sysParts.join('\n')}`,
50
- metadata: {
51
- provider: this.name,
52
- model: co.model || this.config.defaultModel || 'claude-sonnet-4-20250514',
53
- workingDirectory: co?.cwd || this.config.defaultWorkingDirectory || process.cwd(),
54
- tools: co?.allowedTools,
55
- },
56
- };
57
- for await (const message of query({ prompt, options: claudeOptions })) {
58
- // Handle init message
59
- if (message.type === 'system' && message.subtype === 'init') {
60
- sessionId = message.session_id;
61
- const initMsg = {
62
- type: 'init',
63
- timestamp: new Date().toISOString(),
64
- sessionId,
65
- model: claudeOptions.model ||
66
- this.config.defaultModel ||
67
- 'claude-sonnet-4-20250514',
68
- provider: this.name,
69
- };
70
- yield initMsg;
71
- }
72
- // Handle assistant messages
73
- else if (message.type === 'assistant') {
74
- const content = message.message.content;
75
- if (typeof content === 'string') {
76
- const assistantMsg = {
77
- type: 'assistant',
78
- timestamp: new Date().toISOString(),
79
- content,
80
- metadata: { sessionId },
81
- };
82
- yield assistantMsg;
83
- }
84
- else if (Array.isArray(content)) {
85
- for (const block of content) {
86
- if (block.type === 'text') {
87
- const assistantMsg = {
88
- type: 'assistant',
89
- timestamp: new Date().toISOString(),
90
- content: block.text,
91
- metadata: { sessionId },
92
- };
93
- yield assistantMsg;
94
- }
95
- else if (block.type === 'tool_use') {
96
- const toolMsg = {
97
- type: 'tool_use',
98
- timestamp: new Date().toISOString(),
99
- tool: block.name,
100
- input: block.input,
101
- metadata: { sessionId, toolId: block.id },
102
- };
103
- yield toolMsg;
104
- }
105
- }
106
- }
107
- }
108
- // Handle result message
109
- else if (message.type === 'result') {
110
- const resultMsg = {
111
- type: 'result',
112
- timestamp: new Date().toISOString(),
113
- success: message.subtype === 'success',
114
- result: message.subtype === 'success' ? message.result : undefined,
115
- error: message.subtype !== 'success' ? message.subtype : undefined,
116
- usage: {
117
- promptTokens: message.usage?.input_tokens || promptTokens,
118
- completionTokens: message.usage?.output_tokens || completionTokens,
119
- totalTokens: (message.usage?.input_tokens || 0) + (message.usage?.output_tokens || 0),
120
- cost: message.total_cost_usd,
121
- },
122
- duration: Date.now() - startTime,
123
- metadata: { sessionId },
124
- };
125
- yield resultMsg;
126
- // Track metrics
127
- // if (message.total_cost_usd) totalCost = message.total_cost_usd;
128
- if (message.usage?.input_tokens)
129
- promptTokens = message.usage.input_tokens;
130
- if (message.usage?.output_tokens)
131
- completionTokens = message.usage.output_tokens;
132
- }
133
- // Handle other message types (errors, etc.)
134
- else {
135
- // Check if this is an error message
136
- const msgType = message.type;
137
- if (msgType === 'error') {
138
- const errorMsg = {
139
- type: 'error',
140
- timestamp: new Date().toISOString(),
141
- content: message.message || 'Unknown error',
142
- metadata: { sessionId, errorType: message.subtype },
143
- };
144
- yield errorMsg;
145
- }
146
- }
147
- }
148
- }
149
- catch (error) {
150
- // Yield error message
151
- yield {
152
- type: 'error',
153
- timestamp: new Date().toISOString(),
154
- content: error instanceof Error ? error.message : String(error),
155
- metadata: { sessionId },
156
- };
157
- throw error;
158
- }
159
- }
160
- /**
161
- * Execute synchronously and return the final result
162
- */
163
- async executeSync(prompt, options) {
164
- const executionId = generateId('claude');
165
- const result = {
166
- id: executionId,
167
- provider: this.name,
168
- model: options?.model || this.config.defaultModel || 'claude-sonnet-4-20250514',
169
- content: '',
170
- usage: {
171
- promptTokens: 0,
172
- completionTokens: 0,
173
- totalTokens: 0,
174
- cost: 0,
175
- },
176
- duration: 0,
177
- };
178
- const startTime = Date.now();
179
- const messages = [];
180
- try {
181
- for await (const message of this.execute(prompt, options)) {
182
- if (message.type === 'assistant') {
183
- const assistantMsg = message;
184
- messages.push(assistantMsg.content);
185
- }
186
- else if (message.type === 'result') {
187
- const resultMsg = message;
188
- if (resultMsg.success) {
189
- result.content = resultMsg.result || messages.join('\n');
190
- result.usage = resultMsg.usage || result.usage;
191
- result.duration = Date.now() - startTime;
192
- }
193
- else {
194
- result.error = resultMsg.error;
195
- throw new Error(resultMsg.error || 'Execution failed');
196
- }
197
- }
198
- }
199
- }
200
- catch (error) {
201
- result.error = error instanceof Error ? error.message : String(error);
202
- result.duration = Date.now() - startTime;
203
- throw error;
204
- }
205
- return result;
206
- }
207
- /**
208
- * Detect available Claude models
209
- */
210
- async detectAvailableModels() {
211
- // For now, return known Claude models
212
- // In the future, could query the API for available models
213
- return [
214
- {
215
- id: 'claude-sonnet-4-20250514',
216
- name: 'claude-sonnet-4-20250514',
217
- displayName: 'Claude Sonnet 4',
218
- provider: this.name,
219
- contextWindow: 200000,
220
- maxOutputTokens: 64000,
221
- capabilities: ['code', 'analysis', 'tools', 'vision', 'extended-thinking'],
222
- },
223
- {
224
- id: 'claude-opus-4-1-20250805',
225
- name: 'claude-opus-4-1-20250805',
226
- displayName: 'Claude Opus 4.1',
227
- provider: this.name,
228
- contextWindow: 200000,
229
- maxOutputTokens: 32000,
230
- capabilities: [
231
- 'code',
232
- 'analysis',
233
- 'tools',
234
- 'deep-reasoning',
235
- 'vision',
236
- 'extended-thinking',
237
- ],
238
- },
239
- {
240
- id: 'claude-3-5-haiku-20241022',
241
- name: 'claude-3-5-haiku-20241022',
242
- displayName: 'Claude 3.5 Haiku',
243
- provider: this.name,
244
- contextWindow: 200000,
245
- maxOutputTokens: 8000,
246
- capabilities: ['code', 'analysis', 'tools', 'vision'],
247
- },
248
- ];
249
- }
250
- /**
251
- * Validate Claude Code setup using enhanced detection
252
- */
253
- async validateSetup() {
254
- try {
255
- const detectionService = getProviderDetectionService();
256
- const result = await detectionService.detectProvider('claude-code');
257
- if (!result.found) {
258
- return {
259
- available: false,
260
- error: result.error || 'Claude CLI not found. Please install Claude Code CLI.',
261
- models: [],
262
- capabilities: this.getCapabilities(),
263
- };
264
- }
265
- const models = await this.detectAvailableModels();
266
- return {
267
- available: true,
268
- models,
269
- capabilities: this.getCapabilities(),
270
- };
271
- }
272
- catch (error) {
273
- return {
274
- available: false,
275
- error: error instanceof Error ? error.message : String(error),
276
- models: [],
277
- capabilities: this.getCapabilities(),
278
- };
279
- }
280
- }
281
- /**
282
- * Get provider capabilities
283
- */
284
- getCapabilities() {
285
- return {
286
- streaming: true,
287
- tools: true,
288
- functionCalling: false, // Claude Code uses tool format
289
- vision: true,
290
- codeExecution: true,
291
- maxContextWindow: 200000,
292
- maxOutputTokens: 8192,
293
- };
294
- }
295
- /**
296
- * Map ExecutionOptions to Claude Code Options
297
- */
298
- async mapToClaudeOptions(options) {
299
- const claudeOptions = {
300
- cwd: options?.workingDirectory || this.config.defaultWorkingDirectory || process.cwd(),
301
- model: options?.model || this.config.defaultModel,
302
- pathToClaudeCodeExecutable: await this.getClaudeExecutablePath(),
303
- };
304
- // Map temperature
305
- if (options?.temperature !== undefined) {
306
- claudeOptions.temperature = options.temperature;
307
- }
308
- // Map max tokens
309
- if (options?.maxTokens !== undefined) {
310
- claudeOptions.maxTokens = options.maxTokens;
311
- }
312
- // Map abort signal
313
- if (options?.abortSignal) {
314
- claudeOptions.abortController = new AbortController();
315
- options.abortSignal.addEventListener('abort', () => {
316
- claudeOptions.abortController?.abort();
317
- });
318
- }
319
- // Map system prompt
320
- if (options?.systemPrompt) {
321
- claudeOptions.systemPrompt = options.systemPrompt;
322
- }
323
- if (options?.appendSystemPrompt) {
324
- claudeOptions.appendSystemPrompt = options.appendSystemPrompt;
325
- }
326
- // Map tools
327
- if (options?.tools) {
328
- claudeOptions.allowedTools = options.tools;
329
- }
330
- return claudeOptions;
331
- }
332
- /**
333
- * Resolve Claude CLI executable path using enhanced detection
334
- */
335
- async getClaudeExecutablePath() {
336
- // Highest precedence: explicit config option
337
- if (this.config.claudeBinPath) {
338
- return this.config.claudeBinPath;
339
- }
340
- // Use enhanced detection service
341
- const detectionService = getProviderDetectionService();
342
- const result = await detectionService.detectProvider('claude-code');
343
- if (result.found && result.path) {
344
- return result.path;
345
- }
346
- // Fallback: try old settings-based approach for backwards compatibility
347
- const settingsBinPath = (() => {
348
- try {
349
- const svc = getSettingsService();
350
- const s = svc.getSettings();
351
- return s?.agents?.providers?.claudeCode?.binPath;
352
- }
353
- catch {
354
- return undefined;
355
- }
356
- })();
357
- if (settingsBinPath?.trim()) {
358
- return settingsBinPath.trim();
359
- }
360
- return 'claude';
361
- }
362
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Codex CLI Provider
3
- * Headless wrapper around the Codex CLI `codex exec` command.
4
- */
5
- import { AIProvider, ExecutionMessage, ExecutionOptions, ModelInfo, ProviderCapabilities, ProviderStatus } from './types.js';
6
- export interface CodexCliConfig {
7
- codexBinPath?: string;
8
- defaultWorkingDirectory?: string;
9
- defaultModel?: string;
10
- defaultTimeoutMs?: number;
11
- }
12
- export declare class CodexCliProvider implements AIProvider {
13
- private config;
14
- readonly name = "codex";
15
- readonly displayName = "Codex CLI";
16
- constructor(config?: CodexCliConfig);
17
- private resolveExecutable;
18
- private normalizeReasoningEffort;
19
- private resolveModelSpec;
20
- execute(prompt: string, options?: ExecutionOptions): AsyncIterableIterator<ExecutionMessage>;
21
- executeSync(prompt: string, options?: ExecutionOptions): Promise<{
22
- id: string;
23
- provider: string;
24
- model: string;
25
- content: string;
26
- usage: {
27
- promptTokens: number;
28
- completionTokens: number;
29
- totalTokens: number;
30
- };
31
- duration: number;
32
- }>;
33
- detectAvailableModels(): Promise<ModelInfo[]>;
34
- validateSetup(): Promise<ProviderStatus>;
35
- getCapabilities(): ProviderCapabilities;
36
- }