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.
- 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 -80
- 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 -225
- package/dist/runtime/api/agent/agent-service.js +0 -904
- 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 -347
- package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
- package/dist/runtime/api/agent/ai-providers/index.js +0 -7
- package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -182
- package/dist/runtime/api/agent/ai-providers/types.js +0 -5
- package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -170
- 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 -449
- package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
- package/dist/runtime/api/agent/prompt-service.test.js +0 -230
- 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 -98
- 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 -165
- package/dist/runtime/api/api/routers/provider-config.js +0 -252
- package/dist/runtime/api/api/routers/settings.d.ts +0 -139
- package/dist/runtime/api/api/routers/settings.js +0 -113
- 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 -245
- package/dist/runtime/api/lib/local-config.js +0 -288
- 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 -59
- package/dist/runtime/api/lib/provider-detection.js +0 -244
- 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/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/client.d.ts +0 -1
- package/dist/runtime/api/lib/trpc/client.js +0 -5
- package/dist/runtime/api/lib/trpc/server.d.ts +0 -935
- 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 -410
- 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 -938
- 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 -661
- 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 -13
- package/dist/runtime/api/tasks/task-file-parser.js +0 -161
- 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/types/index.d.ts +0 -186
- package/dist/runtime/api/types/index.js +0 -1
- package/dist/runtime/api/types/settings.d.ts +0 -94
- 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 -127
- package/dist/runtime/api/vcs/git-service.js +0 -284
- package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
- package/dist/runtime/api/vcs/worktree-service.js +0 -506
- 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 -400
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -318
- package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -1891
- 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 -39
- 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 -147
- 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/217.js +0 -1
- package/dist/runtime/web/.next/server/chunks/383.js +0 -6
- package/dist/runtime/web/.next/server/chunks/458.js +0 -1
- package/dist/runtime/web/.next/server/chunks/576.js +0 -18
- package/dist/runtime/web/.next/server/chunks/635.js +0 -22
- package/dist/runtime/web/.next/server/chunks/761.js +0 -1
- package/dist/runtime/web/.next/server/chunks/777.js +0 -3
- package/dist/runtime/web/.next/server/chunks/825.js +0 -1
- package/dist/runtime/web/.next/server/chunks/838.js +0 -1
- package/dist/runtime/web/.next/server/chunks/973.js +0 -15
- 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/5_15u1WQCxN1_eHZpldCv/_buildManifest.js +0 -1
- package/dist/runtime/web/.next/static/5_15u1WQCxN1_eHZpldCv/_ssgManifest.js +0 -1
- package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
- package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
- package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
- package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
- package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
- package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
- package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
- package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
- package/dist/runtime/web/.next/static/chunks/823-6f371a6e829adbba.js +0 -63
- package/dist/runtime/web/.next/static/chunks/87c73c54-09e1ba5c70e60a51.js +0 -1
- package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
- package/dist/runtime/web/.next/static/chunks/8bb4d8db-3e2aa02b0a2384b9.js +0 -1
- package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/page-9fe7d75095b4ccec.js +0 -1
- package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
- package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
- package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
- package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
- package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +0 -3
- 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,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex CLI Provider
|
|
3
|
-
* Headless wrapper around the Codex CLI `codex exec` command.
|
|
4
|
-
*/
|
|
5
|
-
import { spawn } from 'child_process';
|
|
6
|
-
import { getSettingsService } from '../../settings-service.js';
|
|
7
|
-
import { getProviderDetectionService } from '../../lib/provider-detection.js';
|
|
8
|
-
import { logger } from '../../lib/logger.js';
|
|
9
|
-
export class CodexCliProvider {
|
|
10
|
-
constructor(config = {}) {
|
|
11
|
-
this.config = config;
|
|
12
|
-
this.name = 'codex';
|
|
13
|
-
this.displayName = 'Codex CLI';
|
|
14
|
-
}
|
|
15
|
-
async resolveExecutable() {
|
|
16
|
-
if (this.config.codexBinPath)
|
|
17
|
-
return this.config.codexBinPath;
|
|
18
|
-
// Use enhanced detection service
|
|
19
|
-
const detectionService = getProviderDetectionService();
|
|
20
|
-
const result = await detectionService.detectProvider('codex');
|
|
21
|
-
if (result.found && result.path) {
|
|
22
|
-
return result.path;
|
|
23
|
-
}
|
|
24
|
-
// Fallback: try old settings-based approach for backwards compatibility
|
|
25
|
-
const settingsBinPath = (() => {
|
|
26
|
-
try {
|
|
27
|
-
const svc = getSettingsService();
|
|
28
|
-
const s = svc.getSettings();
|
|
29
|
-
return s?.agents?.providers?.codex?.binPath;
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
})();
|
|
35
|
-
if (settingsBinPath?.trim())
|
|
36
|
-
return settingsBinPath.trim();
|
|
37
|
-
// Default to binary name (resolve via PATH)
|
|
38
|
-
return 'codex';
|
|
39
|
-
}
|
|
40
|
-
normalizeReasoningEffort(value) {
|
|
41
|
-
if (!value)
|
|
42
|
-
return undefined;
|
|
43
|
-
const normalized = value.toLowerCase();
|
|
44
|
-
if (normalized === 'minimal')
|
|
45
|
-
return 'low';
|
|
46
|
-
const allowed = ['low', 'medium', 'high'];
|
|
47
|
-
return allowed.includes(normalized)
|
|
48
|
-
? normalized
|
|
49
|
-
: undefined;
|
|
50
|
-
}
|
|
51
|
-
resolveModelSpec(model, fallbackEffort) {
|
|
52
|
-
const fallback = this.normalizeReasoningEffort(fallbackEffort);
|
|
53
|
-
if (!model) {
|
|
54
|
-
return { reasoning: fallback };
|
|
55
|
-
}
|
|
56
|
-
const trimmed = model.trim();
|
|
57
|
-
const normalized = trimmed.toLowerCase();
|
|
58
|
-
const match = normalized.match(/^(gpt-5(?:-codex)?)(?:-(minimal|low|medium|high))?$/);
|
|
59
|
-
if (!match) {
|
|
60
|
-
return {
|
|
61
|
-
cliModel: trimmed,
|
|
62
|
-
requestedModel: trimmed,
|
|
63
|
-
reasoning: fallback,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const baseModel = match[1];
|
|
67
|
-
const reasoning = this.normalizeReasoningEffort(match[2]);
|
|
68
|
-
return {
|
|
69
|
-
cliModel: baseModel,
|
|
70
|
-
requestedModel: trimmed,
|
|
71
|
-
reasoning: reasoning ?? fallback,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
async *execute(prompt, options) {
|
|
75
|
-
// Effective options
|
|
76
|
-
const cwd = options?.workingDirectory || this.config.defaultWorkingDirectory || process.cwd();
|
|
77
|
-
const resolvedModel = this.resolveModelSpec(options?.model || this.config.defaultModel, options?.effort);
|
|
78
|
-
const model = resolvedModel.cliModel;
|
|
79
|
-
const images = (options?.images || []).filter(Boolean);
|
|
80
|
-
const reasoningEffort = resolvedModel.reasoning;
|
|
81
|
-
const timeoutMs = options?.timeout ?? this.config.defaultTimeoutMs ?? 10 * 60 * 1000; // 10m
|
|
82
|
-
const systemPrompt = options?.systemPrompt?.trim();
|
|
83
|
-
const appendSystemPrompt = options?.appendSystemPrompt?.trim();
|
|
84
|
-
const promptSegments = [];
|
|
85
|
-
if (systemPrompt) {
|
|
86
|
-
promptSegments.push(systemPrompt);
|
|
87
|
-
}
|
|
88
|
-
if (appendSystemPrompt) {
|
|
89
|
-
promptSegments.push(appendSystemPrompt);
|
|
90
|
-
}
|
|
91
|
-
promptSegments.push(prompt);
|
|
92
|
-
const effectivePrompt = promptSegments.join('\n\n');
|
|
93
|
-
// Build argv for `codex exec` (non-interactive automation mode)
|
|
94
|
-
const argv = ['exec', effectivePrompt];
|
|
95
|
-
if (model) {
|
|
96
|
-
argv.push('--model', model);
|
|
97
|
-
}
|
|
98
|
-
if (reasoningEffort) {
|
|
99
|
-
argv.push('-c', `model_reasoning_effort=${reasoningEffort}`);
|
|
100
|
-
}
|
|
101
|
-
// Prefer spawning with cwd, but also set --cd to make Codex aware of root
|
|
102
|
-
if (cwd) {
|
|
103
|
-
argv.push('--cd', cwd);
|
|
104
|
-
}
|
|
105
|
-
if (images.length) {
|
|
106
|
-
argv.push('--image', images.join(','));
|
|
107
|
-
}
|
|
108
|
-
if (options?.dangerouslyBypassApprovalsAndSandbox) {
|
|
109
|
-
argv.push('--dangerously-bypass-approvals-and-sandbox');
|
|
110
|
-
}
|
|
111
|
-
const cmd = await this.resolveExecutable();
|
|
112
|
-
const child = spawn(cmd, argv, {
|
|
113
|
-
cwd,
|
|
114
|
-
env: { ...process.env },
|
|
115
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
116
|
-
});
|
|
117
|
-
// Emit an init/system message with effective command
|
|
118
|
-
const init = {
|
|
119
|
-
type: 'init',
|
|
120
|
-
timestamp: new Date().toISOString(),
|
|
121
|
-
sessionId: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
122
|
-
model: resolvedModel.requestedModel || model || 'default',
|
|
123
|
-
provider: this.name,
|
|
124
|
-
};
|
|
125
|
-
yield init;
|
|
126
|
-
yield {
|
|
127
|
-
type: 'system',
|
|
128
|
-
timestamp: new Date().toISOString(),
|
|
129
|
-
content: `Running: ${cmd} ${argv
|
|
130
|
-
.map((a) => (a.includes(' ') ? '"' + a + '"' : a))
|
|
131
|
-
.join(' ')} (cwd=${cwd})`,
|
|
132
|
-
metadata: {
|
|
133
|
-
provider: this.name,
|
|
134
|
-
images,
|
|
135
|
-
effort: reasoningEffort || options?.effort,
|
|
136
|
-
systemPrompt,
|
|
137
|
-
appendSystemPrompt,
|
|
138
|
-
dangerouslyBypassApprovalsAndSandbox: !!options?.dangerouslyBypassApprovalsAndSandbox,
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
let stdoutBuf = '';
|
|
142
|
-
// let stderrBuf = '';
|
|
143
|
-
let finished = false;
|
|
144
|
-
let lastFlushedIndex = 0;
|
|
145
|
-
let lineCarry = '';
|
|
146
|
-
// Helper to push incremental stdout as assistant log lines
|
|
147
|
-
const flushNewOutput = () => {
|
|
148
|
-
const newChunk = stdoutBuf.slice(lastFlushedIndex);
|
|
149
|
-
if (!newChunk)
|
|
150
|
-
return;
|
|
151
|
-
lastFlushedIndex = stdoutBuf.length;
|
|
152
|
-
// Accumulate and split by line breaks, keep trailing partial
|
|
153
|
-
lineCarry += newChunk;
|
|
154
|
-
const parts = lineCarry.split(/\r?\n/);
|
|
155
|
-
lineCarry = parts.pop() || '';
|
|
156
|
-
return parts.map((l) => l.trimEnd()).filter(Boolean);
|
|
157
|
-
};
|
|
158
|
-
// Provider stays generic: it streams lines and returns raw stdout.
|
|
159
|
-
// Forward parent termination via abortSignal
|
|
160
|
-
// const abortController = new AbortController();
|
|
161
|
-
const onAbort = () => {
|
|
162
|
-
try {
|
|
163
|
-
child.kill('SIGTERM');
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
/* ignore */
|
|
167
|
-
}
|
|
168
|
-
// Fallback kill after short grace
|
|
169
|
-
setTimeout(() => {
|
|
170
|
-
if (!finished) {
|
|
171
|
-
try {
|
|
172
|
-
child.kill('SIGKILL');
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
/* ignore */
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, 3000);
|
|
179
|
-
};
|
|
180
|
-
if (options?.abortSignal) {
|
|
181
|
-
if (options.abortSignal.aborted)
|
|
182
|
-
onAbort();
|
|
183
|
-
else
|
|
184
|
-
options.abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
185
|
-
}
|
|
186
|
-
// Local timeout guard
|
|
187
|
-
const guard = setTimeout(() => {
|
|
188
|
-
onAbort();
|
|
189
|
-
}, timeoutMs);
|
|
190
|
-
// Capture data into buffers
|
|
191
|
-
child.stdout?.on('data', (data) => {
|
|
192
|
-
stdoutBuf += data.toString('utf8');
|
|
193
|
-
});
|
|
194
|
-
// child.stderr?.on('data', (data: Buffer) => {
|
|
195
|
-
// stderrBuf += data.toString('utf8');
|
|
196
|
-
// });
|
|
197
|
-
// Wait for process to finish
|
|
198
|
-
// Stream logs while the process runs by polling for new output
|
|
199
|
-
const exitPromise = new Promise((resolve) => {
|
|
200
|
-
child.on('exit', (code, signal) => resolve({ code, signal }));
|
|
201
|
-
});
|
|
202
|
-
// Poll for output until the process exits
|
|
203
|
-
let exitStatus;
|
|
204
|
-
while (!finished) {
|
|
205
|
-
const tick = new Promise((r) => setTimeout(r, 150));
|
|
206
|
-
const exit = await Promise.race([exitPromise, tick]);
|
|
207
|
-
if (exit && typeof exit.code !== 'undefined') {
|
|
208
|
-
// Process exited; flush any remaining output before breaking
|
|
209
|
-
const lines = flushNewOutput();
|
|
210
|
-
if (lines && lines.length) {
|
|
211
|
-
for (const text of lines) {
|
|
212
|
-
yield {
|
|
213
|
-
type: 'assistant',
|
|
214
|
-
timestamp: new Date().toISOString(),
|
|
215
|
-
content: text,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
finished = true;
|
|
220
|
-
// Record exit info for finalization
|
|
221
|
-
exitStatus = exit;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
// Flush incremental lines during run
|
|
225
|
-
const lines = flushNewOutput();
|
|
226
|
-
if (lines && lines.length) {
|
|
227
|
-
for (const text of lines) {
|
|
228
|
-
yield {
|
|
229
|
-
type: 'assistant',
|
|
230
|
-
timestamp: new Date().toISOString(),
|
|
231
|
-
content: text,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// If loop ended without capturing exit status (unlikely), await it now
|
|
237
|
-
const exit = exitStatus ?? (await exitPromise);
|
|
238
|
-
finished = true;
|
|
239
|
-
clearTimeout(guard);
|
|
240
|
-
// Flush any final carry line as a log
|
|
241
|
-
if (lineCarry.trim()) {
|
|
242
|
-
yield {
|
|
243
|
-
type: 'assistant',
|
|
244
|
-
timestamp: new Date().toISOString(),
|
|
245
|
-
content: lineCarry.trimEnd(),
|
|
246
|
-
};
|
|
247
|
-
lineCarry = '';
|
|
248
|
-
}
|
|
249
|
-
// Compose final message
|
|
250
|
-
const success = (exit.code ?? 1) === 0 && !exit.signal;
|
|
251
|
-
const remainingStdout = stdoutBuf.trim();
|
|
252
|
-
const resultMsg = {
|
|
253
|
-
type: 'result',
|
|
254
|
-
timestamp: new Date().toISOString(),
|
|
255
|
-
success,
|
|
256
|
-
// Return raw stdout as result; higher layers decide how to parse it
|
|
257
|
-
result: success ? (remainingStdout || '').toString() : undefined,
|
|
258
|
-
error: success
|
|
259
|
-
? undefined
|
|
260
|
-
: `codex exited ${exit.signal ? 'by ' + exit.signal : 'with code ' + exit.code}`,
|
|
261
|
-
usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
|
|
262
|
-
};
|
|
263
|
-
yield resultMsg;
|
|
264
|
-
}
|
|
265
|
-
async executeSync(prompt, options) {
|
|
266
|
-
// Convenience: collect from execute()
|
|
267
|
-
let content = '';
|
|
268
|
-
const start = Date.now();
|
|
269
|
-
const resolvedModel = this.resolveModelSpec(options?.model || this.config.defaultModel, options?.effort);
|
|
270
|
-
for await (const msg of this.execute(prompt, options)) {
|
|
271
|
-
if (msg.type === 'assistant' && typeof msg.content === 'string') {
|
|
272
|
-
content += (content ? '\n' : '') + msg.content;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return {
|
|
276
|
-
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
277
|
-
provider: this.name,
|
|
278
|
-
model: resolvedModel.requestedModel || resolvedModel.cliModel || 'default',
|
|
279
|
-
content,
|
|
280
|
-
usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
|
|
281
|
-
duration: Date.now() - start,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
async detectAvailableModels() {
|
|
285
|
-
const capabilities = ['code', 'analysis', 'tools', 'vision', 'image', 'reasoning'];
|
|
286
|
-
const makeModel = (id, displayName) => ({
|
|
287
|
-
id,
|
|
288
|
-
name: id,
|
|
289
|
-
displayName,
|
|
290
|
-
provider: this.name,
|
|
291
|
-
contextWindow: 256000,
|
|
292
|
-
maxOutputTokens: 16384,
|
|
293
|
-
capabilities,
|
|
294
|
-
});
|
|
295
|
-
return [
|
|
296
|
-
makeModel('gpt-5', 'gpt‑5'),
|
|
297
|
-
makeModel('gpt-5-low', 'gpt‑5 · low reasoning'),
|
|
298
|
-
makeModel('gpt-5-medium', 'gpt‑5 · medium reasoning'),
|
|
299
|
-
makeModel('gpt-5-high', 'gpt‑5 · high reasoning'),
|
|
300
|
-
makeModel('gpt-5-codex', 'gpt‑5 Codex'),
|
|
301
|
-
makeModel('gpt-5-codex-low', 'gpt‑5 Codex · low reasoning'),
|
|
302
|
-
makeModel('gpt-5-codex-medium', 'gpt‑5 Codex · medium reasoning'),
|
|
303
|
-
makeModel('gpt-5-codex-high', 'gpt‑5 Codex · high reasoning'),
|
|
304
|
-
];
|
|
305
|
-
}
|
|
306
|
-
async validateSetup() {
|
|
307
|
-
try {
|
|
308
|
-
const detectionService = getProviderDetectionService();
|
|
309
|
-
const result = await detectionService.detectProvider('codex');
|
|
310
|
-
if (!result.found) {
|
|
311
|
-
return {
|
|
312
|
-
available: false,
|
|
313
|
-
error: result.error ||
|
|
314
|
-
'Codex CLI not found. Install from https://github.com/openai/codex (see Getting Started: CLI usage).',
|
|
315
|
-
models: [],
|
|
316
|
-
capabilities: this.getCapabilities(),
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
return {
|
|
320
|
-
available: true,
|
|
321
|
-
models: await this.detectAvailableModels(),
|
|
322
|
-
capabilities: this.getCapabilities(),
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
logger.error(error);
|
|
327
|
-
return {
|
|
328
|
-
available: false,
|
|
329
|
-
error: error instanceof Error ? error.message : String(error),
|
|
330
|
-
models: [],
|
|
331
|
-
capabilities: this.getCapabilities(),
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
// Note: persistence of detected binary paths is handled by onboarding workflow.
|
|
336
|
-
getCapabilities() {
|
|
337
|
-
return {
|
|
338
|
-
streaming: true,
|
|
339
|
-
tools: true,
|
|
340
|
-
functionCalling: false,
|
|
341
|
-
vision: true,
|
|
342
|
-
codeExecution: true,
|
|
343
|
-
maxContextWindow: 128000,
|
|
344
|
-
maxOutputTokens: 8192,
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Providers Module
|
|
3
|
-
* Export all provider types and implementations
|
|
4
|
-
*/
|
|
5
|
-
export * from './types.js';
|
|
6
|
-
export { ClaudeCodeAdapter } from './claude-code-adapter.js';
|
|
7
|
-
export type { ClaudeCodeConfig } from './claude-code-adapter.js';
|
|
8
|
-
export { CodexCliProvider } from './codex-cli-provider.js';
|
|
9
|
-
export type { CodexCliConfig } from './codex-cli-provider.js';
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core AI Provider Abstraction
|
|
3
|
-
* Defines the contract for AI execution providers (Claude, OpenAI, Local LLMs, etc.)
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Model information for available AI models
|
|
7
|
-
*/
|
|
8
|
-
export interface ModelInfo {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
displayName: string;
|
|
12
|
-
provider: string;
|
|
13
|
-
contextWindow?: number;
|
|
14
|
-
maxOutputTokens?: number;
|
|
15
|
-
costPerInputToken?: number;
|
|
16
|
-
costPerOutputToken?: number;
|
|
17
|
-
capabilities?: string[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Tool permissions for AI execution
|
|
21
|
-
* Source: https://docs.anthropic.com/en/docs/claude-code/settings#tools-available-to-claude
|
|
22
|
-
*/
|
|
23
|
-
export type ToolPermission = 'Bash' | 'Edit' | 'Glob' | 'Grep' | 'MultiEdit' | 'NotebookEdit' | 'NotebookRead' | 'Read' | 'Task' | 'TodoWrite' | 'WebSearch' | 'WebFetch' | 'Write';
|
|
24
|
-
/**
|
|
25
|
-
* Execution options for AI providers
|
|
26
|
-
*/
|
|
27
|
-
export interface ExecutionOptions {
|
|
28
|
-
workingDirectory?: string;
|
|
29
|
-
model?: string;
|
|
30
|
-
temperature?: number;
|
|
31
|
-
maxTokens?: number;
|
|
32
|
-
tools?: ToolPermission[];
|
|
33
|
-
timeout?: number;
|
|
34
|
-
abortSignal?: AbortSignal;
|
|
35
|
-
systemPrompt?: string;
|
|
36
|
-
appendSystemPrompt?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Permission mode for Claude Code SDK (provider-specific hint).
|
|
39
|
-
* - default: standard prompts/permissions
|
|
40
|
-
* - acceptEdits: auto-approve file edits and common FS ops
|
|
41
|
-
* - bypassPermissions: auto-approve all tool uses (dangerous; headless automation)
|
|
42
|
-
*/
|
|
43
|
-
permissionMode?: 'default' | 'acceptEdits' | 'bypassPermissions';
|
|
44
|
-
/** Optional list of image file paths to attach (Codex CLI: --image) */
|
|
45
|
-
images?: string[];
|
|
46
|
-
/** Optional effort hint for reasoning presets (e.g., 'minimal'|'low'|'medium'|'high'); informational only */
|
|
47
|
-
effort?: string;
|
|
48
|
-
/** Enable Codex CLI sandbox bypass flag when running automation that must edit files */
|
|
49
|
-
dangerouslyBypassApprovalsAndSandbox?: boolean;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Message types for streaming execution
|
|
53
|
-
*/
|
|
54
|
-
export interface ExecutionMessage {
|
|
55
|
-
type: 'init' | 'assistant' | 'tool_use' | 'result' | 'error' | 'system';
|
|
56
|
-
timestamp: string;
|
|
57
|
-
content?: string | any;
|
|
58
|
-
metadata?: Record<string, any>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Initialization message
|
|
62
|
-
*/
|
|
63
|
-
export interface InitMessage extends ExecutionMessage {
|
|
64
|
-
type: 'init';
|
|
65
|
-
sessionId: string;
|
|
66
|
-
model: string;
|
|
67
|
-
provider: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Assistant message (AI response)
|
|
71
|
-
*/
|
|
72
|
-
export interface AssistantMessage extends ExecutionMessage {
|
|
73
|
-
type: 'assistant';
|
|
74
|
-
content: string;
|
|
75
|
-
toolCalls?: ToolCall[];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Tool call information
|
|
79
|
-
*/
|
|
80
|
-
export interface ToolCall {
|
|
81
|
-
id: string;
|
|
82
|
-
name: string;
|
|
83
|
-
input?: any;
|
|
84
|
-
output?: any;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Tool use message
|
|
88
|
-
*/
|
|
89
|
-
export interface ToolUseMessage extends ExecutionMessage {
|
|
90
|
-
type: 'tool_use';
|
|
91
|
-
tool: string;
|
|
92
|
-
input: any;
|
|
93
|
-
output?: any;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Result message (final output)
|
|
97
|
-
*/
|
|
98
|
-
export interface ResultMessage extends ExecutionMessage {
|
|
99
|
-
type: 'result';
|
|
100
|
-
success: boolean;
|
|
101
|
-
result?: string;
|
|
102
|
-
error?: string;
|
|
103
|
-
usage?: {
|
|
104
|
-
promptTokens: number;
|
|
105
|
-
completionTokens: number;
|
|
106
|
-
totalTokens: number;
|
|
107
|
-
cost?: number;
|
|
108
|
-
};
|
|
109
|
-
duration?: number;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Execution result for synchronous execution
|
|
113
|
-
*/
|
|
114
|
-
export interface ExecutionResult {
|
|
115
|
-
id: string;
|
|
116
|
-
provider: string;
|
|
117
|
-
model: string;
|
|
118
|
-
content: string;
|
|
119
|
-
usage: {
|
|
120
|
-
promptTokens: number;
|
|
121
|
-
completionTokens: number;
|
|
122
|
-
totalTokens: number;
|
|
123
|
-
cost?: number;
|
|
124
|
-
};
|
|
125
|
-
duration: number;
|
|
126
|
-
error?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Provider capabilities
|
|
130
|
-
*/
|
|
131
|
-
export interface ProviderCapabilities {
|
|
132
|
-
streaming: boolean;
|
|
133
|
-
tools: boolean;
|
|
134
|
-
functionCalling: boolean;
|
|
135
|
-
vision: boolean;
|
|
136
|
-
codeExecution: boolean;
|
|
137
|
-
maxContextWindow: number;
|
|
138
|
-
maxOutputTokens: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Provider status
|
|
142
|
-
*/
|
|
143
|
-
export interface ProviderStatus {
|
|
144
|
-
available: boolean;
|
|
145
|
-
error?: string;
|
|
146
|
-
models: ModelInfo[];
|
|
147
|
-
capabilities: ProviderCapabilities;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Core AI Provider interface
|
|
151
|
-
* All AI providers must implement this interface
|
|
152
|
-
*/
|
|
153
|
-
export interface AIProvider {
|
|
154
|
-
/**
|
|
155
|
-
* Provider identifier
|
|
156
|
-
*/
|
|
157
|
-
readonly name: string;
|
|
158
|
-
/**
|
|
159
|
-
* Provider display name
|
|
160
|
-
*/
|
|
161
|
-
readonly displayName: string;
|
|
162
|
-
/**
|
|
163
|
-
* Execute a prompt and return streaming messages
|
|
164
|
-
*/
|
|
165
|
-
execute(prompt: string, options?: ExecutionOptions): AsyncIterableIterator<ExecutionMessage>;
|
|
166
|
-
/**
|
|
167
|
-
* Execute a prompt and return the final result (convenience method)
|
|
168
|
-
*/
|
|
169
|
-
executeSync?(prompt: string, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
170
|
-
/**
|
|
171
|
-
* Detect available models for this provider
|
|
172
|
-
*/
|
|
173
|
-
detectAvailableModels(): Promise<ModelInfo[]>;
|
|
174
|
-
/**
|
|
175
|
-
* Validate provider setup and configuration
|
|
176
|
-
*/
|
|
177
|
-
validateSetup(): Promise<ProviderStatus>;
|
|
178
|
-
/**
|
|
179
|
-
* Get provider capabilities
|
|
180
|
-
*/
|
|
181
|
-
getCapabilities(): ProviderCapabilities;
|
|
182
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|