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