vibeman 0.0.5 → 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.
- package/dist/api.js +49 -0
- package/dist/cli.js +135 -0
- package/dist/ui/index-gnk6rhxs.js +9 -0
- package/dist/ui/index.html +10 -0
- package/dist/ui/index.js +2 -0
- package/package.json +10 -46
- package/README.md +0 -12
- package/dist/index.js +0 -114
- package/dist/runtime/api/.tsbuildinfo +0 -1
- package/dist/runtime/api/agent/agent-service.d.ts +0 -229
- package/dist/runtime/api/agent/agent-service.js +0 -963
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +0 -38
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +0 -268
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.d.ts +0 -61
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.js +0 -362
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +0 -36
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +0 -375
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +0 -24
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +0 -291
- package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
- package/dist/runtime/api/agent/ai-providers/index.js +0 -9
- package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -185
- package/dist/runtime/api/agent/ai-providers/types.js +0 -5
- package/dist/runtime/api/agent/amp-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/amp-cli-provider.test.js +0 -99
- package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -172
- package/dist/runtime/api/agent/core-agent-service.d.ts +0 -119
- package/dist/runtime/api/agent/core-agent-service.js +0 -267
- package/dist/runtime/api/agent/parsers.d.ts +0 -16
- package/dist/runtime/api/agent/parsers.js +0 -308
- package/dist/runtime/api/agent/prompt-service.d.ts +0 -30
- package/dist/runtime/api/agent/prompt-service.js +0 -452
- package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
- package/dist/runtime/api/agent/prompt-service.test.js +0 -265
- package/dist/runtime/api/agent/routing-policy.d.ts +0 -171
- package/dist/runtime/api/agent/routing-policy.js +0 -196
- package/dist/runtime/api/agent/routing-policy.test.d.ts +0 -1
- package/dist/runtime/api/agent/routing-policy.test.js +0 -63
- package/dist/runtime/api/api/router-helpers.d.ts +0 -32
- package/dist/runtime/api/api/router-helpers.js +0 -31
- package/dist/runtime/api/api/routers/ai.d.ts +0 -200
- package/dist/runtime/api/api/routers/ai.js +0 -396
- package/dist/runtime/api/api/routers/executions.d.ts +0 -93
- package/dist/runtime/api/api/routers/executions.js +0 -94
- package/dist/runtime/api/api/routers/git.d.ts +0 -45
- package/dist/runtime/api/api/routers/git.js +0 -35
- package/dist/runtime/api/api/routers/provider-config.d.ts +0 -199
- package/dist/runtime/api/api/routers/provider-config.js +0 -252
- package/dist/runtime/api/api/routers/settings.d.ts +0 -158
- package/dist/runtime/api/api/routers/settings.js +0 -129
- package/dist/runtime/api/api/routers/tasks.d.ts +0 -141
- package/dist/runtime/api/api/routers/tasks.js +0 -238
- package/dist/runtime/api/api/routers/workflows.d.ts +0 -275
- package/dist/runtime/api/api/routers/workflows.js +0 -311
- package/dist/runtime/api/api/routers/worktrees.d.ts +0 -101
- package/dist/runtime/api/api/routers/worktrees.js +0 -80
- package/dist/runtime/api/api/trpc.d.ts +0 -118
- package/dist/runtime/api/api/trpc.js +0 -34
- package/dist/runtime/api/index.d.ts +0 -9
- package/dist/runtime/api/index.js +0 -117
- package/dist/runtime/api/lib/id-generator.d.ts +0 -70
- package/dist/runtime/api/lib/id-generator.js +0 -123
- package/dist/runtime/api/lib/local-config.d.ts +0 -335
- package/dist/runtime/api/lib/local-config.js +0 -304
- package/dist/runtime/api/lib/logger.d.ts +0 -11
- package/dist/runtime/api/lib/logger.js +0 -188
- package/dist/runtime/api/lib/provider-detection.d.ts +0 -61
- package/dist/runtime/api/lib/provider-detection.js +0 -326
- package/dist/runtime/api/lib/server/agent-service-singleton.d.ts +0 -6
- package/dist/runtime/api/lib/server/agent-service-singleton.js +0 -27
- package/dist/runtime/api/lib/server/bootstrap.d.ts +0 -38
- package/dist/runtime/api/lib/server/bootstrap.js +0 -197
- package/dist/runtime/api/lib/server/git-service-singleton.d.ts +0 -6
- package/dist/runtime/api/lib/server/git-service-singleton.js +0 -47
- package/dist/runtime/api/lib/server/project-root.d.ts +0 -2
- package/dist/runtime/api/lib/server/project-root.js +0 -61
- package/dist/runtime/api/lib/server/task-service-singleton.d.ts +0 -7
- package/dist/runtime/api/lib/server/task-service-singleton.js +0 -58
- package/dist/runtime/api/lib/server/vibeman-info.d.ts +0 -5
- package/dist/runtime/api/lib/server/vibeman-info.js +0 -85
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.d.ts +0 -7
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.js +0 -57
- package/dist/runtime/api/lib/trpc/server.d.ts +0 -965
- package/dist/runtime/api/lib/trpc/server.js +0 -11
- package/dist/runtime/api/lib/trpc/ws-server.d.ts +0 -8
- package/dist/runtime/api/lib/trpc/ws-server.js +0 -33
- package/dist/runtime/api/persistence/database-service.d.ts +0 -14
- package/dist/runtime/api/persistence/database-service.js +0 -74
- package/dist/runtime/api/persistence/execution-log-persistence.d.ts +0 -90
- package/dist/runtime/api/persistence/execution-log-persistence.js +0 -426
- package/dist/runtime/api/persistence/execution-log-persistence.test.d.ts +0 -1
- package/dist/runtime/api/persistence/execution-log-persistence.test.js +0 -170
- package/dist/runtime/api/router.d.ts +0 -968
- package/dist/runtime/api/router.js +0 -34
- package/dist/runtime/api/settings-service.d.ts +0 -110
- package/dist/runtime/api/settings-service.js +0 -678
- package/dist/runtime/api/tasks/file-watcher.d.ts +0 -23
- package/dist/runtime/api/tasks/file-watcher.js +0 -88
- package/dist/runtime/api/tasks/task-file-parser.d.ts +0 -14
- package/dist/runtime/api/tasks/task-file-parser.js +0 -180
- package/dist/runtime/api/tasks/task-service.d.ts +0 -36
- package/dist/runtime/api/tasks/task-service.js +0 -173
- package/dist/runtime/api/tasks/task-updater.d.ts +0 -62
- package/dist/runtime/api/tasks/task-updater.js +0 -260
- package/dist/runtime/api/tasks/task-updater.test.d.ts +0 -1
- package/dist/runtime/api/tasks/task-updater.test.js +0 -303
- package/dist/runtime/api/types/index.d.ts +0 -186
- package/dist/runtime/api/types/index.js +0 -1
- package/dist/runtime/api/types/settings.d.ts +0 -105
- package/dist/runtime/api/types/settings.js +0 -2
- package/dist/runtime/api/types.d.ts +0 -2
- package/dist/runtime/api/types.js +0 -1
- package/dist/runtime/api/utils/env.d.ts +0 -6
- package/dist/runtime/api/utils/env.js +0 -12
- package/dist/runtime/api/utils/stripNextEnv.d.ts +0 -7
- package/dist/runtime/api/utils/stripNextEnv.js +0 -22
- package/dist/runtime/api/utils/title-slug.d.ts +0 -6
- package/dist/runtime/api/utils/title-slug.js +0 -77
- package/dist/runtime/api/utils/url.d.ts +0 -2
- package/dist/runtime/api/utils/url.js +0 -19
- package/dist/runtime/api/vcs/git-history-service.d.ts +0 -57
- package/dist/runtime/api/vcs/git-history-service.js +0 -228
- package/dist/runtime/api/vcs/git-service.d.ts +0 -136
- package/dist/runtime/api/vcs/git-service.js +0 -307
- package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
- package/dist/runtime/api/vcs/worktree-service.js +0 -518
- package/dist/runtime/api/vcs/worktree-service.test.d.ts +0 -1
- package/dist/runtime/api/vcs/worktree-service.test.js +0 -20
- package/dist/runtime/api/workflows/quality-pipeline.d.ts +0 -58
- package/dist/runtime/api/workflows/quality-pipeline.js +0 -401
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -406
- package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -2462
- package/dist/runtime/api/workflows/workflow-effects.d.ts +0 -45
- package/dist/runtime/api/workflows/workflow-effects.js +0 -49
- package/dist/runtime/api/workflows/workflow-reconciler.d.ts +0 -65
- package/dist/runtime/api/workflows/workflow-reconciler.js +0 -226
- package/dist/runtime/api/workflows/workflow-reducer.d.ts +0 -26
- package/dist/runtime/api/workflows/workflow-reducer.js +0 -288
- package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +0 -1
- package/dist/runtime/api/workflows/workflow-reducer.test.js +0 -247
- package/dist/runtime/api/workflows/workflow-schema.d.ts +0 -546
- package/dist/runtime/api/workflows/workflow-schema.js +0 -256
- package/dist/runtime/web/.next/BUILD_ID +0 -1
- package/dist/runtime/web/.next/app-build-manifest.json +0 -66
- package/dist/runtime/web/.next/app-path-routes-manifest.json +0 -8
- package/dist/runtime/web/.next/build-manifest.json +0 -33
- package/dist/runtime/web/.next/package.json +0 -1
- package/dist/runtime/web/.next/prerender-manifest.json +0 -61
- package/dist/runtime/web/.next/react-loadable-manifest.json +0 -8
- package/dist/runtime/web/.next/required-server-files.json +0 -334
- package/dist/runtime/web/.next/routes-manifest.json +0 -70
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +0 -1
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/_not-found/page.js +0 -2
- package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/_not-found.html +0 -7
- package/dist/runtime/web/.next/server/app/_not-found.meta +0 -8
- package/dist/runtime/web/.next/server/app/_not-found.rsc +0 -22
- package/dist/runtime/web/.next/server/app/api/health/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/index.html +0 -7
- package/dist/runtime/web/.next/server/app/index.meta +0 -7
- package/dist/runtime/web/.next/server/app/index.rsc +0 -27
- package/dist/runtime/web/.next/server/app/page.js +0 -112
- package/dist/runtime/web/.next/server/app/page.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app-paths-manifest.json +0 -8
- package/dist/runtime/web/.next/server/chunks/210.js +0 -1
- package/dist/runtime/web/.next/server/chunks/291.js +0 -18
- package/dist/runtime/web/.next/server/chunks/552.js +0 -22
- package/dist/runtime/web/.next/server/chunks/780.js +0 -1
- package/dist/runtime/web/.next/server/chunks/905.js +0 -6
- package/dist/runtime/web/.next/server/chunks/98.js +0 -1
- package/dist/runtime/web/.next/server/functions-config-manifest.json +0 -4
- package/dist/runtime/web/.next/server/middleware-build-manifest.js +0 -1
- package/dist/runtime/web/.next/server/middleware-manifest.json +0 -6
- package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/dist/runtime/web/.next/server/next-font-manifest.js +0 -1
- package/dist/runtime/web/.next/server/next-font-manifest.json +0 -1
- package/dist/runtime/web/.next/server/pages/404.html +0 -7
- package/dist/runtime/web/.next/server/pages/500.html +0 -1
- package/dist/runtime/web/.next/server/pages/_app.js +0 -1
- package/dist/runtime/web/.next/server/pages/_app.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages/_document.js +0 -1
- package/dist/runtime/web/.next/server/pages/_document.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages/_error.js +0 -19
- package/dist/runtime/web/.next/server/pages/_error.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages-manifest.json +0 -6
- package/dist/runtime/web/.next/server/server-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/server-reference-manifest.json +0 -1
- package/dist/runtime/web/.next/server/webpack-runtime.js +0 -1
- package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_buildManifest.js +0 -1
- package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_ssgManifest.js +0 -1
- package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +0 -1
- package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +0 -1
- package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +0 -1
- package/dist/runtime/web/.next/static/chunks/7ab4dc20-239138e0ae7af24a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +0 -20
- package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +0 -79
- package/dist/runtime/web/.next/static/chunks/ad74d572-4c1b162e2c15acaa.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +0 -1
- package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +0 -1
- package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +0 -3
- package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +0 -1
- package/dist/runtime/web/.next/static/css/521bd69cc298cd1a.css +0 -1
- package/dist/runtime/web/.next/static/css/537e22821e101b87.css +0 -1
- package/dist/runtime/web/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dist/runtime/web/package.json +0 -65
- package/dist/runtime/web/server.js +0 -44
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -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
|
-
}
|