@sudocode-ai/local-server 0.1.0
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 +19 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +105 -0
- package/dist/cli.js.map +7 -0
- package/dist/execution/engine/engine.d.ts +103 -0
- package/dist/execution/engine/engine.d.ts.map +1 -0
- package/dist/execution/engine/simple-engine.d.ts +190 -0
- package/dist/execution/engine/simple-engine.d.ts.map +1 -0
- package/dist/execution/engine/types.d.ts +116 -0
- package/dist/execution/engine/types.d.ts.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +176 -0
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/ag-ui-integration.d.ts +96 -0
- package/dist/execution/output/ag-ui-integration.d.ts.map +1 -0
- package/dist/execution/output/claude-code-output-processor.d.ts +321 -0
- package/dist/execution/output/claude-code-output-processor.d.ts.map +1 -0
- package/dist/execution/output/index.d.ts +18 -0
- package/dist/execution/output/index.d.ts.map +1 -0
- package/dist/execution/output/types.d.ts +421 -0
- package/dist/execution/output/types.d.ts.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +86 -0
- package/dist/execution/process/builders/claude.d.ts.map +1 -0
- package/dist/execution/process/index.d.ts +15 -0
- package/dist/execution/process/index.d.ts.map +1 -0
- package/dist/execution/process/manager.d.ts +133 -0
- package/dist/execution/process/manager.d.ts.map +1 -0
- package/dist/execution/process/simple-manager.d.ts +102 -0
- package/dist/execution/process/simple-manager.d.ts.map +1 -0
- package/dist/execution/process/types.d.ts +105 -0
- package/dist/execution/process/types.d.ts.map +1 -0
- package/dist/execution/process/utils.d.ts +53 -0
- package/dist/execution/process/utils.d.ts.map +1 -0
- package/dist/execution/resilience/circuit-breaker.d.ts +170 -0
- package/dist/execution/resilience/circuit-breaker.d.ts.map +1 -0
- package/dist/execution/resilience/executor.d.ts +109 -0
- package/dist/execution/resilience/executor.d.ts.map +1 -0
- package/dist/execution/resilience/index.d.ts +14 -0
- package/dist/execution/resilience/index.d.ts.map +1 -0
- package/dist/execution/resilience/resilient-executor.d.ts +86 -0
- package/dist/execution/resilience/resilient-executor.d.ts.map +1 -0
- package/dist/execution/resilience/retry.d.ts +161 -0
- package/dist/execution/resilience/retry.d.ts.map +1 -0
- package/dist/execution/resilience/types.d.ts +226 -0
- package/dist/execution/resilience/types.d.ts.map +1 -0
- package/dist/execution/transport/event-buffer.d.ts +119 -0
- package/dist/execution/transport/event-buffer.d.ts.map +1 -0
- package/dist/execution/transport/index.d.ts +10 -0
- package/dist/execution/transport/index.d.ts.map +1 -0
- package/dist/execution/transport/sse-transport.d.ts +146 -0
- package/dist/execution/transport/sse-transport.d.ts.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts +176 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -0
- package/dist/execution/workflow/index.d.ts +13 -0
- package/dist/execution/workflow/index.d.ts.map +1 -0
- package/dist/execution/workflow/linear-orchestrator.d.ts +216 -0
- package/dist/execution/workflow/linear-orchestrator.d.ts.map +1 -0
- package/dist/execution/workflow/memory-storage.d.ts +54 -0
- package/dist/execution/workflow/memory-storage.d.ts.map +1 -0
- package/dist/execution/workflow/orchestrator.d.ts +158 -0
- package/dist/execution/workflow/orchestrator.d.ts.map +1 -0
- package/dist/execution/workflow/types.d.ts +172 -0
- package/dist/execution/workflow/types.d.ts.map +1 -0
- package/dist/execution/workflow/utils.d.ts +89 -0
- package/dist/execution/workflow/utils.d.ts.map +1 -0
- package/dist/execution/worktree/config.d.ts +74 -0
- package/dist/execution/worktree/config.d.ts.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +151 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -0
- package/dist/execution/worktree/index.d.ts +16 -0
- package/dist/execution/worktree/index.d.ts.map +1 -0
- package/dist/execution/worktree/manager.d.ts +184 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -0
- package/dist/execution/worktree/types.d.ts +90 -0
- package/dist/execution/worktree/types.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +7 -0
- package/dist/public/assets/index-C4SmlXoo.js +568 -0
- package/dist/public/assets/index-C4SmlXoo.js.map +1 -0
- package/dist/public/assets/index-DE59j7ti.css +1 -0
- package/dist/public/assets/react-vendor-LX0UoTxg.js +60 -0
- package/dist/public/assets/react-vendor-LX0UoTxg.js.map +1 -0
- package/dist/public/assets/ui-vendor-_cxVHaqZ.js +54 -0
- package/dist/public/assets/ui-vendor-_cxVHaqZ.js.map +1 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/index.html +16 -0
- package/dist/public/logo.png +0 -0
- package/dist/routes/executions-stream.d.ts +24 -0
- package/dist/routes/executions-stream.d.ts.map +1 -0
- package/dist/routes/executions.d.ts +19 -0
- package/dist/routes/executions.d.ts.map +1 -0
- package/dist/routes/feedback.d.ts +7 -0
- package/dist/routes/feedback.d.ts.map +1 -0
- package/dist/routes/issues.d.ts +7 -0
- package/dist/routes/issues.d.ts.map +1 -0
- package/dist/routes/relationships.d.ts +7 -0
- package/dist/routes/relationships.d.ts.map +1 -0
- package/dist/routes/specs.d.ts +7 -0
- package/dist/routes/specs.d.ts.map +1 -0
- package/dist/services/db.d.ts +33 -0
- package/dist/services/db.d.ts.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +108 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -0
- package/dist/services/execution-service.d.ts +185 -0
- package/dist/services/execution-service.d.ts.map +1 -0
- package/dist/services/executions.d.ts +59 -0
- package/dist/services/executions.d.ts.map +1 -0
- package/dist/services/export.d.ts +24 -0
- package/dist/services/export.d.ts.map +1 -0
- package/dist/services/feedback.d.ts +40 -0
- package/dist/services/feedback.d.ts.map +1 -0
- package/dist/services/issues.d.ts +27 -0
- package/dist/services/issues.d.ts.map +1 -0
- package/dist/services/prompt-template-engine.d.ts +108 -0
- package/dist/services/prompt-template-engine.d.ts.map +1 -0
- package/dist/services/prompt-templates.d.ts +97 -0
- package/dist/services/prompt-templates.d.ts.map +1 -0
- package/dist/services/relationships.d.ts +35 -0
- package/dist/services/relationships.d.ts.map +1 -0
- package/dist/services/specs.d.ts +27 -0
- package/dist/services/specs.d.ts.map +1 -0
- package/dist/services/watcher.d.ts +50 -0
- package/dist/services/watcher.d.ts.map +1 -0
- package/dist/services/websocket.d.ts +127 -0
- package/dist/services/websocket.d.ts.map +1 -0
- package/dist/utils/sudocode-dir.d.ts +6 -0
- package/dist/utils/sudocode-dir.d.ts.map +1 -0
- package/package.json +74 -0
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Sudocode</title>
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-C4SmlXoo.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/react-vendor-LX0UoTxg.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/ui-vendor-_cxVHaqZ.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DE59j7ti.css">
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Stream Routes
|
|
3
|
+
*
|
|
4
|
+
* SSE endpoint for streaming execution events to clients.
|
|
5
|
+
* Integrates with TransportManager to broadcast AG-UI events.
|
|
6
|
+
*
|
|
7
|
+
* @module routes/executions-stream
|
|
8
|
+
*/
|
|
9
|
+
import { Router } from "express";
|
|
10
|
+
import type { TransportManager } from "../execution/transport/transport-manager.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create execution stream routes
|
|
13
|
+
*
|
|
14
|
+
* @param transportManager - Transport manager for SSE connections
|
|
15
|
+
* @returns Express router with SSE endpoints
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const router = createExecutionStreamRoutes(transportManager);
|
|
20
|
+
* app.use('/api/executions', router);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function createExecutionStreamRoutes(transportManager: TransportManager): Router;
|
|
24
|
+
//# sourceMappingURL=executions-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions-stream.d.ts","sourceRoot":"","sources":["../../src/routes/executions-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAEpF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,gBAAgB,GACjC,MAAM,CAqCR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executions API routes (mapped to /api)
|
|
3
|
+
*
|
|
4
|
+
* Provides REST API for managing issue executions.
|
|
5
|
+
*/
|
|
6
|
+
import { Router } from "express";
|
|
7
|
+
import type Database from "better-sqlite3";
|
|
8
|
+
import { ExecutionService } from "../services/execution-service.js";
|
|
9
|
+
import type { TransportManager } from "../execution/transport/transport-manager.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create executions router
|
|
12
|
+
*
|
|
13
|
+
* @param db - Database instance
|
|
14
|
+
* @param repoPath - Path to git repository
|
|
15
|
+
* @param transportManager - Optional transport manager for SSE streaming
|
|
16
|
+
* @returns Express router with execution endpoints
|
|
17
|
+
*/
|
|
18
|
+
export declare function createExecutionsRouter(db: Database.Database, repoPath: string, transportManager?: TransportManager, executionService?: ExecutionService): Router;
|
|
19
|
+
//# sourceMappingURL=executions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions.d.ts","sourceRoot":"","sources":["../../src/routes/executions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,MAAM,CAqTR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/routes/feedback.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAW3C,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAwWlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/routes/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAa3C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAgThE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relationships API routes (mapped to /api/relationships)
|
|
3
|
+
*/
|
|
4
|
+
import { Router } from "express";
|
|
5
|
+
import type Database from "better-sqlite3";
|
|
6
|
+
export declare function createRelationshipsRouter(db: Database.Database): Router;
|
|
7
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/routes/relationships.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAY3C,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CA6WvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../src/routes/specs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAc3C,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CA+R/D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database service for sudocode server
|
|
3
|
+
* Uses shared schema from @sudocode-ai/types
|
|
4
|
+
*/
|
|
5
|
+
import Database from "better-sqlite3";
|
|
6
|
+
/**
|
|
7
|
+
* Database configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface DatabaseConfig {
|
|
10
|
+
path: string;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Initialize database with CLI schema + server extensions
|
|
15
|
+
*/
|
|
16
|
+
export declare function initDatabase(config: DatabaseConfig): Database.Database;
|
|
17
|
+
/**
|
|
18
|
+
* Check if database has CLI tables
|
|
19
|
+
*/
|
|
20
|
+
export declare function hasCliTables(db: Database.Database): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Get database info
|
|
23
|
+
*/
|
|
24
|
+
export declare function getDatabaseInfo(db: Database.Database): {
|
|
25
|
+
tables: string[];
|
|
26
|
+
version: number;
|
|
27
|
+
hasCliTables: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Close database connection
|
|
31
|
+
*/
|
|
32
|
+
export declare function closeDatabase(db: Database.Database): void;
|
|
33
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/services/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAatC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAwCtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAa3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ;;;;EAqBpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAEzD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Lifecycle Service
|
|
3
|
+
*
|
|
4
|
+
* Centralized service for managing execution lifecycle with worktree integration.
|
|
5
|
+
* Coordinates between WorktreeManager and execution database services.
|
|
6
|
+
*
|
|
7
|
+
* @module services/execution-lifecycle
|
|
8
|
+
*/
|
|
9
|
+
import type Database from "better-sqlite3";
|
|
10
|
+
import type { AgentType, Execution } from "@sudocode-ai/types";
|
|
11
|
+
import { type IWorktreeManager } from "../execution/worktree/manager.js";
|
|
12
|
+
/**
|
|
13
|
+
* Parameters for creating an execution with worktree
|
|
14
|
+
*/
|
|
15
|
+
export interface CreateExecutionWithWorktreeParams {
|
|
16
|
+
issueId: string;
|
|
17
|
+
issueTitle: string;
|
|
18
|
+
agentType: AgentType;
|
|
19
|
+
targetBranch: string;
|
|
20
|
+
repoPath: string;
|
|
21
|
+
mode?: string;
|
|
22
|
+
prompt?: string;
|
|
23
|
+
config?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result of creating an execution with worktree
|
|
27
|
+
*/
|
|
28
|
+
export interface CreateExecutionWithWorktreeResult {
|
|
29
|
+
execution: Execution;
|
|
30
|
+
worktreePath: string;
|
|
31
|
+
branchName: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ExecutionLifecycleService
|
|
35
|
+
*
|
|
36
|
+
* Manages the full lifecycle of executions with worktree support:
|
|
37
|
+
* - Creating executions with isolated worktrees
|
|
38
|
+
* - Cleaning up executions and associated worktrees
|
|
39
|
+
* - Handling orphaned worktrees
|
|
40
|
+
*/
|
|
41
|
+
export declare class ExecutionLifecycleService {
|
|
42
|
+
private worktreeManager;
|
|
43
|
+
private db;
|
|
44
|
+
private repoPath;
|
|
45
|
+
/**
|
|
46
|
+
* Create a new ExecutionLifecycleService
|
|
47
|
+
*
|
|
48
|
+
* @param db - Database instance
|
|
49
|
+
* @param repoPath - Path to the git repository
|
|
50
|
+
* @param worktreeManager - Optional worktree manager (defaults to new instance)
|
|
51
|
+
*/
|
|
52
|
+
constructor(db: Database.Database, repoPath: string, worktreeManager?: IWorktreeManager);
|
|
53
|
+
/**
|
|
54
|
+
* Create an execution with an isolated worktree
|
|
55
|
+
*
|
|
56
|
+
* Creates a worktree first, then creates the execution record.
|
|
57
|
+
* If worktree creation fails, no execution is created.
|
|
58
|
+
* If execution creation fails, the worktree is cleaned up.
|
|
59
|
+
*
|
|
60
|
+
* @param params - Execution creation parameters
|
|
61
|
+
* @returns Execution with worktree information
|
|
62
|
+
* @throws Error if creation fails
|
|
63
|
+
*/
|
|
64
|
+
createExecutionWithWorktree(params: CreateExecutionWithWorktreeParams): Promise<CreateExecutionWithWorktreeResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Check if an execution should be cleaned up based on its config
|
|
67
|
+
*
|
|
68
|
+
* @param executionId - ID of execution to check
|
|
69
|
+
* @returns true if should cleanup, false otherwise
|
|
70
|
+
*/
|
|
71
|
+
shouldCleanupExecution(executionId: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Clean up an execution and its associated worktree
|
|
74
|
+
*
|
|
75
|
+
* Removes the worktree from filesystem and git metadata.
|
|
76
|
+
* Branch deletion is controlled by autoDeleteBranches config.
|
|
77
|
+
* Respects the cleanupMode configuration from execution config.
|
|
78
|
+
*
|
|
79
|
+
* IMPORTANT: The worktree_path is NEVER cleared from the database.
|
|
80
|
+
* This allows follow-up executions to find and reuse the same worktree path.
|
|
81
|
+
* The filesystem worktree is deleted, but the path remains in the DB as a historical record.
|
|
82
|
+
*
|
|
83
|
+
* @param executionId - ID of execution to cleanup
|
|
84
|
+
* @throws Error if cleanup fails
|
|
85
|
+
*/
|
|
86
|
+
cleanupExecution(executionId: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Clean up orphaned worktrees
|
|
89
|
+
*
|
|
90
|
+
* Finds worktrees that are registered in git but don't have
|
|
91
|
+
* corresponding execution records, or vice versa.
|
|
92
|
+
* Also cleans up worktrees for finished executions (completed/failed/stopped).
|
|
93
|
+
*/
|
|
94
|
+
cleanupOrphanedWorktrees(): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sanitize a string to be safe for use in git branch names
|
|
98
|
+
*
|
|
99
|
+
* - Converts to lowercase
|
|
100
|
+
* - Replaces spaces and slashes with hyphens
|
|
101
|
+
* - Removes special characters
|
|
102
|
+
* - Limits length to 50 characters
|
|
103
|
+
*
|
|
104
|
+
* @param str - String to sanitize
|
|
105
|
+
* @returns Sanitized string safe for branch names
|
|
106
|
+
*/
|
|
107
|
+
export declare function sanitizeForBranchName(str: string): string;
|
|
108
|
+
//# sourceMappingURL=execution-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-lifecycle.d.ts","sourceRoot":"","sources":["../../src/services/execution-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;;;OAMG;gBAED,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,gBAAgB;IAcpC;;;;;;;;;;OAUG;IACG,2BAA2B,CAC/B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAyG7C;;;;;OAKG;IACH,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IA0BpD;;;;;;;;;;;;;OAaG;IACG,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC1D;;;;;;OAMG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;CAwEhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAezD"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Service
|
|
3
|
+
*
|
|
4
|
+
* High-level service for managing issue-to-execution transformations.
|
|
5
|
+
* Coordinates between template rendering, worktree management, and workflow execution.
|
|
6
|
+
*
|
|
7
|
+
* @module services/execution-service
|
|
8
|
+
*/
|
|
9
|
+
import type Database from "better-sqlite3";
|
|
10
|
+
import type { Execution } from "@sudocode-ai/types";
|
|
11
|
+
import { ExecutionLifecycleService } from "./execution-lifecycle.js";
|
|
12
|
+
import type { TransportManager } from "../execution/transport/transport-manager.js";
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for creating an execution
|
|
15
|
+
*/
|
|
16
|
+
export interface ExecutionConfig {
|
|
17
|
+
mode?: "worktree" | "local";
|
|
18
|
+
model?: string;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
baseBranch?: string;
|
|
21
|
+
branchName?: string;
|
|
22
|
+
checkpointInterval?: number;
|
|
23
|
+
continueOnStepFailure?: boolean;
|
|
24
|
+
captureFileChanges?: boolean;
|
|
25
|
+
captureToolCalls?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Template variable context for rendering
|
|
29
|
+
*/
|
|
30
|
+
export interface TemplateContext {
|
|
31
|
+
issueId: string;
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
relatedSpecs?: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
}>;
|
|
38
|
+
feedback?: Array<{
|
|
39
|
+
issueId: string;
|
|
40
|
+
content: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result from prepareExecution - preview before starting
|
|
45
|
+
*/
|
|
46
|
+
export interface ExecutionPrepareResult {
|
|
47
|
+
renderedPrompt: string;
|
|
48
|
+
issue: {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
content: string;
|
|
52
|
+
};
|
|
53
|
+
relatedSpecs: Array<{
|
|
54
|
+
id: string;
|
|
55
|
+
title: string;
|
|
56
|
+
}>;
|
|
57
|
+
defaultConfig: ExecutionConfig;
|
|
58
|
+
warnings?: string[];
|
|
59
|
+
errors?: string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* ExecutionService
|
|
63
|
+
*
|
|
64
|
+
* Manages the full lifecycle of issue-based executions:
|
|
65
|
+
* - Preparing execution with template rendering
|
|
66
|
+
* - Creating and starting executions with worktree isolation
|
|
67
|
+
* - Creating follow-up executions that reuse worktrees
|
|
68
|
+
* - Canceling and cleaning up executions
|
|
69
|
+
*/
|
|
70
|
+
export declare class ExecutionService {
|
|
71
|
+
private db;
|
|
72
|
+
private templateEngine;
|
|
73
|
+
private lifecycleService;
|
|
74
|
+
private repoPath;
|
|
75
|
+
private transportManager?;
|
|
76
|
+
private activeOrchestrators;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new ExecutionService
|
|
79
|
+
*
|
|
80
|
+
* @param db - Database instance
|
|
81
|
+
* @param repoPath - Path to the git repository
|
|
82
|
+
* @param lifecycleService - Optional execution lifecycle service (creates one if not provided)
|
|
83
|
+
* @param transportManager - Optional transport manager for SSE streaming
|
|
84
|
+
*/
|
|
85
|
+
constructor(db: Database.Database, repoPath: string, lifecycleService?: ExecutionLifecycleService, transportManager?: TransportManager);
|
|
86
|
+
/**
|
|
87
|
+
* Prepare execution - load issue, render template, return preview
|
|
88
|
+
*
|
|
89
|
+
* This method loads the issue and related context, renders the template,
|
|
90
|
+
* and returns a preview for the user to review before starting execution.
|
|
91
|
+
*
|
|
92
|
+
* @param issueId - ID of issue to prepare execution for
|
|
93
|
+
* @param options - Optional template and config overrides
|
|
94
|
+
* @returns Execution prepare result with rendered prompt and context
|
|
95
|
+
*/
|
|
96
|
+
prepareExecution(issueId: string, options?: {
|
|
97
|
+
templateId?: string;
|
|
98
|
+
config?: Partial<ExecutionConfig>;
|
|
99
|
+
}): Promise<ExecutionPrepareResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Create and start execution
|
|
102
|
+
*
|
|
103
|
+
* Creates an execution record, sets up worktree (if needed), and starts
|
|
104
|
+
* workflow execution. Returns the execution record immediately while
|
|
105
|
+
* workflow runs in the background.
|
|
106
|
+
*
|
|
107
|
+
* @param issueId - ID of issue to execute
|
|
108
|
+
* @param config - Execution configuration
|
|
109
|
+
* @param prompt - Rendered prompt to execute
|
|
110
|
+
* @returns Created execution record
|
|
111
|
+
*/
|
|
112
|
+
createExecution(issueId: string, config: ExecutionConfig, prompt: string): Promise<Execution>;
|
|
113
|
+
/**
|
|
114
|
+
* Create follow-up execution - reuse worktree from previous execution
|
|
115
|
+
*
|
|
116
|
+
* Creates a new execution that reuses the worktree from a previous execution,
|
|
117
|
+
* appending feedback or additional context to the prompt.
|
|
118
|
+
*
|
|
119
|
+
* @param executionId - ID of previous execution to follow up on
|
|
120
|
+
* @param feedback - Additional feedback/context to append to prompt
|
|
121
|
+
* @returns Created follow-up execution record
|
|
122
|
+
*/
|
|
123
|
+
createFollowUp(executionId: string, feedback: string): Promise<Execution>;
|
|
124
|
+
/**
|
|
125
|
+
* Cancel a running execution
|
|
126
|
+
*
|
|
127
|
+
* Stops the workflow execution and marks the execution as cancelled.
|
|
128
|
+
* Optionally cleans up the worktree based on config.
|
|
129
|
+
*
|
|
130
|
+
* @param executionId - ID of execution to cancel
|
|
131
|
+
*/
|
|
132
|
+
cancelExecution(executionId: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Clean up execution resources
|
|
135
|
+
*
|
|
136
|
+
* Removes the worktree and associated files. This is called automatically
|
|
137
|
+
* on workflow completion, or can be called manually.
|
|
138
|
+
*
|
|
139
|
+
* @param executionId - ID of execution to clean up
|
|
140
|
+
*/
|
|
141
|
+
cleanupExecution(executionId: string): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Check if worktree exists in filesystem for an execution
|
|
144
|
+
*
|
|
145
|
+
* @param executionId - ID of execution to check
|
|
146
|
+
* @returns true if worktree exists, false otherwise
|
|
147
|
+
*/
|
|
148
|
+
worktreeExists(executionId: string): Promise<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Delete worktree for an execution
|
|
151
|
+
*
|
|
152
|
+
* Manually deletes the worktree for a specific execution, regardless of
|
|
153
|
+
* cleanupMode configuration. This allows users to manually cleanup worktrees
|
|
154
|
+
* when they're configured for manual cleanup.
|
|
155
|
+
*
|
|
156
|
+
* @param executionId - ID of execution whose worktree to delete
|
|
157
|
+
* @throws Error if execution not found, has no worktree, or worktree doesn't exist
|
|
158
|
+
*/
|
|
159
|
+
deleteWorktree(executionId: string): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Shutdown execution service - cancel all active executions
|
|
162
|
+
*
|
|
163
|
+
* This is called during server shutdown to gracefully terminate
|
|
164
|
+
* all running executions before the server exits.
|
|
165
|
+
*/
|
|
166
|
+
shutdown(): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* List all executions for an issue
|
|
169
|
+
*
|
|
170
|
+
* Returns all executions associated with a specific issue,
|
|
171
|
+
* ordered by creation time (most recent first).
|
|
172
|
+
*
|
|
173
|
+
* @param issueId - ID of issue to list executions for
|
|
174
|
+
* @returns Array of executions for the issue
|
|
175
|
+
*/
|
|
176
|
+
listExecutions(issueId: string): Execution[];
|
|
177
|
+
/**
|
|
178
|
+
* Get a single execution by ID
|
|
179
|
+
*
|
|
180
|
+
* @param executionId - ID of execution to retrieve
|
|
181
|
+
* @returns Execution or null if not found
|
|
182
|
+
*/
|
|
183
|
+
getExecution(executionId: string): Execution | null;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=execution-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-service.d.ts","sourceRoot":"","sources":["../../src/services/execution-service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executions service - database operations for agent executions
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { Execution, AgentType, ExecutionStatus } from "@sudocode-ai/types";
|
|
6
|
+
/**
|
|
7
|
+
* Input for creating a new execution
|
|
8
|
+
*/
|
|
9
|
+
export interface CreateExecutionInput {
|
|
10
|
+
id?: string;
|
|
11
|
+
issue_id: string | null;
|
|
12
|
+
agent_type: AgentType;
|
|
13
|
+
mode?: string;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
config?: string;
|
|
16
|
+
before_commit?: string;
|
|
17
|
+
target_branch: string;
|
|
18
|
+
branch_name: string;
|
|
19
|
+
worktree_path?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Input for updating an execution
|
|
23
|
+
*/
|
|
24
|
+
export interface UpdateExecutionInput {
|
|
25
|
+
status?: ExecutionStatus;
|
|
26
|
+
completed_at?: string | null;
|
|
27
|
+
exit_code?: number | null;
|
|
28
|
+
error_message?: string | null;
|
|
29
|
+
after_commit?: string | null;
|
|
30
|
+
target_branch?: string | null;
|
|
31
|
+
worktree_path?: string | null;
|
|
32
|
+
session_id?: string | null;
|
|
33
|
+
summary?: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a new execution
|
|
37
|
+
*/
|
|
38
|
+
export declare function createExecution(db: Database.Database, input: CreateExecutionInput): Execution;
|
|
39
|
+
/**
|
|
40
|
+
* Get an execution by ID
|
|
41
|
+
*/
|
|
42
|
+
export declare function getExecution(db: Database.Database, id: string): Execution | null;
|
|
43
|
+
/**
|
|
44
|
+
* Get all executions for an issue
|
|
45
|
+
*/
|
|
46
|
+
export declare function getExecutionsByIssueId(db: Database.Database, issue_id: string): Execution[];
|
|
47
|
+
/**
|
|
48
|
+
* Update an execution
|
|
49
|
+
*/
|
|
50
|
+
export declare function updateExecution(db: Database.Database, id: string, input: UpdateExecutionInput): Execution;
|
|
51
|
+
/**
|
|
52
|
+
* Delete an execution
|
|
53
|
+
*/
|
|
54
|
+
export declare function deleteExecution(db: Database.Database, id: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Get all executions with optional status filter
|
|
57
|
+
*/
|
|
58
|
+
export declare function getAllExecutions(db: Database.Database, status?: ExecutionStatus): Execution[];
|
|
59
|
+
//# sourceMappingURL=executions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions.d.ts","sourceRoot":"","sources":["../../src/services/executions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGhF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,oBAAoB,GAC1B,SAAS,CA2DX;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,GACT,SAAS,GAAG,IAAI,CAOlB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,GACf,SAAS,EAAE,CAQb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,oBAAoB,GAC1B,SAAS,CA+EX;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAO1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,MAAM,CAAC,EAAE,eAAe,GACvB,SAAS,EAAE,CAeb"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export service - handles syncing database to JSONL and Markdown files
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
/**
|
|
6
|
+
* Sync a single entity to its markdown file
|
|
7
|
+
*/
|
|
8
|
+
export declare function syncEntityToMarkdown(db: Database.Database, entityId: string, entityType: "spec" | "issue"): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Trigger an export to JSONL and Markdown files (debounced)
|
|
11
|
+
* This should be called after any database modifications
|
|
12
|
+
*/
|
|
13
|
+
export declare function triggerExport(db: Database.Database): void;
|
|
14
|
+
/**
|
|
15
|
+
* Execute export immediately (bypass debouncing)
|
|
16
|
+
* Exports to both JSONL and Markdown files
|
|
17
|
+
*/
|
|
18
|
+
export declare function executeExportNow(db: Database.Database): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Cleanup the export debouncer (cancel pending exports and reset)
|
|
21
|
+
* Should be called when closing the database or during test cleanup
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanupExport(): void;
|
|
24
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/services/export.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AA8C3C;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAAG,OAAO,GAC3B,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAmBzD;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAOpC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service layer for Feedback API
|
|
3
|
+
* Wraps CLI operations for managing issue feedback on specs
|
|
4
|
+
*/
|
|
5
|
+
import type Database from "better-sqlite3";
|
|
6
|
+
import type { IssueFeedback } from "@sudocode-ai/types";
|
|
7
|
+
import { type CreateFeedbackInput, type UpdateFeedbackInput, type ListFeedbackOptions } from "@sudocode-ai/cli/dist/operations/feedback.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a new feedback entry
|
|
10
|
+
*/
|
|
11
|
+
export declare function createNewFeedback(db: Database.Database, input: CreateFeedbackInput): IssueFeedback;
|
|
12
|
+
/**
|
|
13
|
+
* Get a specific feedback by ID
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFeedbackById(db: Database.Database, id: string): IssueFeedback | null;
|
|
16
|
+
/**
|
|
17
|
+
* Update an existing feedback entry
|
|
18
|
+
*/
|
|
19
|
+
export declare function updateExistingFeedback(db: Database.Database, id: string, input: UpdateFeedbackInput): IssueFeedback;
|
|
20
|
+
/**
|
|
21
|
+
* Delete a feedback entry
|
|
22
|
+
*/
|
|
23
|
+
export declare function deleteExistingFeedback(db: Database.Database, id: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* List feedback entries with optional filters
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAllFeedback(db: Database.Database, options?: ListFeedbackOptions): IssueFeedback[];
|
|
28
|
+
/**
|
|
29
|
+
* Get all feedback for a specific spec
|
|
30
|
+
*/
|
|
31
|
+
export declare function getSpecFeedback(db: Database.Database, spec_id: string): IssueFeedback[];
|
|
32
|
+
/**
|
|
33
|
+
* Get all feedback for a specific issue
|
|
34
|
+
*/
|
|
35
|
+
export declare function getIssueFeedback(db: Database.Database, issue_id: string): IssueFeedback[];
|
|
36
|
+
/**
|
|
37
|
+
* Dismiss a feedback entry
|
|
38
|
+
*/
|
|
39
|
+
export declare function dismissExistingFeedback(db: Database.Database, id: string): IssueFeedback;
|
|
40
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/services/feedback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EASL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,8CAA8C,CAAC;AAEtD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,mBAAmB,GACzB,aAAa,CAEf;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,GACT,aAAa,GAAG,IAAI,CAEtB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,mBAAmB,GACzB,aAAa,CAEf;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,GACT,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,aAAa,EAAE,CAEjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,EAAE,MAAM,GACd,aAAa,EAAE,CAEjB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,GACf,aAAa,EAAE,CAEjB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,GACT,aAAa,CAEf"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issues service - wraps CLI operations for API use
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import { type CreateIssueInput, type UpdateIssueInput, type ListIssuesOptions } from "@sudocode-ai/cli/dist/operations/index.js";
|
|
6
|
+
import type { Issue } from "@sudocode-ai/types";
|
|
7
|
+
/**
|
|
8
|
+
* Get all issues with optional filtering
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAllIssues(db: Database.Database, options?: ListIssuesOptions): Issue[];
|
|
11
|
+
/**
|
|
12
|
+
* Get a single issue by ID
|
|
13
|
+
*/
|
|
14
|
+
export declare function getIssueById(db: Database.Database, id: string): Issue | null;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new issue
|
|
17
|
+
*/
|
|
18
|
+
export declare function createNewIssue(db: Database.Database, input: CreateIssueInput): Issue;
|
|
19
|
+
/**
|
|
20
|
+
* Update an existing issue
|
|
21
|
+
*/
|
|
22
|
+
export declare function updateExistingIssue(db: Database.Database, id: string, input: UpdateIssueInput): Issue;
|
|
23
|
+
/**
|
|
24
|
+
* Delete an issue
|
|
25
|
+
*/
|
|
26
|
+
export declare function deleteExistingIssue(db: Database.Database, id: string): boolean;
|
|
27
|
+
//# sourceMappingURL=issues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/services/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,KAAK,EAAE,CAET;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAE5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,gBAAgB,GACtB,KAAK,CAEP;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,gBAAgB,GACtB,KAAK,CAEP;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,EAAE,EAAE,MAAM,GACT,OAAO,CAET"}
|