@sudocode-ai/local-server 0.1.7 → 0.1.8
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 +6 -0
- package/dist/errors/agent-errors.d.ts +43 -0
- package/dist/errors/agent-errors.d.ts.map +1 -0
- package/dist/errors/agent-errors.js +69 -0
- package/dist/errors/agent-errors.js.map +1 -0
- package/dist/execution/adapters/claude-adapter.d.ts +63 -0
- package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/claude-adapter.js +82 -0
- package/dist/execution/adapters/claude-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-adapter.d.ts +67 -0
- package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/codex-adapter.js +183 -0
- package/dist/execution/adapters/codex-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
- package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/codex-config-builder.js +110 -0
- package/dist/execution/adapters/codex-config-builder.js.map +1 -0
- package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
- package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-adapter.js +163 -0
- package/dist/execution/adapters/copilot-adapter.js.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.js +125 -0
- package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
- package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
- package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-adapter.js +121 -0
- package/dist/execution/adapters/cursor-adapter.js.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.js +49 -0
- package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
- package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
- package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-presets.js +205 -0
- package/dist/execution/adapters/shared/config-presets.js.map +1 -0
- package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
- package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-utils.js +163 -0
- package/dist/execution/adapters/shared/config-utils.js.map +1 -0
- package/dist/execution/adapters/shared/index.d.ts +8 -0
- package/dist/execution/adapters/shared/index.d.ts.map +1 -0
- package/dist/execution/adapters/shared/index.js +8 -0
- package/dist/execution/adapters/shared/index.js.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.js +652 -0
- package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
- package/dist/execution/executors/executor-factory.d.ts +95 -0
- package/dist/execution/executors/executor-factory.d.ts.map +1 -0
- package/dist/execution/executors/executor-factory.js +120 -0
- package/dist/execution/executors/executor-factory.js.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
- package/dist/execution/output/ag-ui-adapter.js +0 -2
- package/dist/execution/output/ag-ui-adapter.js.map +1 -1
- package/dist/execution/output/index.d.ts +0 -3
- package/dist/execution/output/index.d.ts.map +1 -1
- package/dist/execution/output/index.js +0 -2
- package/dist/execution/output/index.js.map +1 -1
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +24 -57
- package/dist/execution/process/builders/claude.d.ts.map +1 -1
- package/dist/execution/process/builders/claude.js +153 -19
- package/dist/execution/process/builders/claude.js.map +1 -1
- package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
- package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
- package/dist/execution/transport/ipc-transport-manager.js +104 -0
- package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -1
- package/dist/execution/transport/transport-manager.js +3 -0
- package/dist/execution/transport/transport-manager.js.map +1 -1
- package/dist/execution/worktree/conflict-detector.d.ts +85 -0
- package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
- package/dist/execution/worktree/conflict-detector.js +129 -0
- package/dist/execution/worktree/conflict-detector.js.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +9 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -1
- package/dist/execution/worktree/git-cli.js +10 -0
- package/dist/execution/worktree/git-cli.js.map +1 -1
- package/dist/execution/worktree/git-sync-cli.d.ts +187 -0
- package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
- package/dist/execution/worktree/git-sync-cli.js +350 -0
- package/dist/execution/worktree/git-sync-cli.js.map +1 -0
- package/dist/execution/worktree/manager.d.ts +18 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -1
- package/dist/execution/worktree/manager.js +9 -3
- package/dist/execution/worktree/manager.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +132 -211
- package/dist/index.js.map +1 -1
- package/dist/middleware/project-context.d.ts +37 -0
- package/dist/middleware/project-context.d.ts.map +1 -0
- package/dist/middleware/project-context.js +91 -0
- package/dist/middleware/project-context.js.map +1 -0
- package/dist/public/assets/index-Bb_W5bUr.css +1 -0
- package/dist/public/assets/index-CFKL113G.js +710 -0
- package/dist/public/assets/index-CFKL113G.js.map +1 -0
- package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
- package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
- package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
- package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
- package/dist/public/index.html +4 -4
- package/dist/routes/agents.d.ts +3 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +62 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +25 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/editors.d.ts +15 -0
- package/dist/routes/editors.d.ts.map +1 -0
- package/dist/routes/editors.js +98 -0
- package/dist/routes/editors.js.map +1 -0
- package/dist/routes/executions-stream.d.ts +8 -5
- package/dist/routes/executions-stream.d.ts.map +1 -1
- package/dist/routes/executions-stream.js +10 -6
- package/dist/routes/executions-stream.js.map +1 -1
- package/dist/routes/executions.d.ts +6 -10
- package/dist/routes/executions.d.ts.map +1 -1
- package/dist/routes/executions.js +506 -54
- package/dist/routes/executions.js.map +1 -1
- package/dist/routes/feedback.d.ts +3 -2
- package/dist/routes/feedback.d.ts.map +1 -1
- package/dist/routes/feedback.js +12 -10
- package/dist/routes/feedback.js.map +1 -1
- package/dist/routes/files.d.ts +18 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +89 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/issues.d.ts +3 -2
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +19 -18
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/projects.d.ts +11 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +447 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/relationships.d.ts +3 -2
- package/dist/routes/relationships.d.ts.map +1 -1
- package/dist/routes/relationships.js +12 -10
- package/dist/routes/relationships.js.map +1 -1
- package/dist/routes/repo-info.d.ts +3 -0
- package/dist/routes/repo-info.d.ts.map +1 -0
- package/dist/routes/repo-info.js +126 -0
- package/dist/routes/repo-info.js.map +1 -0
- package/dist/routes/specs.d.ts +3 -2
- package/dist/routes/specs.d.ts.map +1 -1
- package/dist/routes/specs.js +19 -18
- package/dist/routes/specs.js.map +1 -1
- package/dist/services/agent-registry.d.ts +140 -0
- package/dist/services/agent-registry.d.ts.map +1 -0
- package/dist/services/agent-registry.js +272 -0
- package/dist/services/agent-registry.js.map +1 -0
- package/dist/services/editor-service.d.ts +57 -0
- package/dist/services/editor-service.d.ts.map +1 -0
- package/dist/services/editor-service.js +204 -0
- package/dist/services/editor-service.js.map +1 -0
- package/dist/services/execution-changes-service.d.ts +92 -0
- package/dist/services/execution-changes-service.d.ts.map +1 -0
- package/dist/services/execution-changes-service.js +546 -0
- package/dist/services/execution-changes-service.js.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +1 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -1
- package/dist/services/execution-lifecycle.js +37 -7
- package/dist/services/execution-lifecycle.js.map +1 -1
- package/dist/services/execution-logs-store.d.ts +75 -0
- package/dist/services/execution-logs-store.d.ts.map +1 -1
- package/dist/services/execution-logs-store.js +142 -2
- package/dist/services/execution-logs-store.js.map +1 -1
- package/dist/services/execution-service.d.ts +50 -58
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +433 -469
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/execution-worker-pool.d.ts +116 -0
- package/dist/services/execution-worker-pool.d.ts.map +1 -0
- package/dist/services/execution-worker-pool.js +326 -0
- package/dist/services/execution-worker-pool.js.map +1 -0
- package/dist/services/executions.d.ts +3 -0
- package/dist/services/executions.d.ts.map +1 -1
- package/dist/services/executions.js +11 -17
- package/dist/services/executions.js.map +1 -1
- package/dist/services/export.d.ts +8 -2
- package/dist/services/export.d.ts.map +1 -1
- package/dist/services/export.js +29 -23
- package/dist/services/export.js.map +1 -1
- package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
- package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
- package/dist/services/file-search/git-ls-files-strategy.js +176 -0
- package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
- package/dist/services/file-search/index.d.ts +9 -0
- package/dist/services/file-search/index.d.ts.map +1 -0
- package/dist/services/file-search/index.js +10 -0
- package/dist/services/file-search/index.js.map +1 -0
- package/dist/services/file-search/registry.d.ts +97 -0
- package/dist/services/file-search/registry.d.ts.map +1 -0
- package/dist/services/file-search/registry.js +140 -0
- package/dist/services/file-search/registry.js.map +1 -0
- package/dist/services/file-search/strategy.d.ts +58 -0
- package/dist/services/file-search/strategy.d.ts.map +1 -0
- package/dist/services/file-search/strategy.js +8 -0
- package/dist/services/file-search/strategy.js.map +1 -0
- package/dist/services/project-context.d.ts +69 -0
- package/dist/services/project-context.d.ts.map +1 -0
- package/dist/services/project-context.js +113 -0
- package/dist/services/project-context.js.map +1 -0
- package/dist/services/project-manager.d.ts +95 -0
- package/dist/services/project-manager.d.ts.map +1 -0
- package/dist/services/project-manager.js +388 -0
- package/dist/services/project-manager.js.map +1 -0
- package/dist/services/project-registry.d.ts +98 -0
- package/dist/services/project-registry.d.ts.map +1 -0
- package/dist/services/project-registry.js +289 -0
- package/dist/services/project-registry.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +97 -0
- package/dist/services/prompt-resolver.d.ts.map +1 -0
- package/dist/services/prompt-resolver.js +377 -0
- package/dist/services/prompt-resolver.js.map +1 -0
- package/dist/services/repo-info.d.ts +12 -0
- package/dist/services/repo-info.d.ts.map +1 -1
- package/dist/services/repo-info.js +46 -0
- package/dist/services/repo-info.js.map +1 -1
- package/dist/services/watcher.d.ts +3 -4
- package/dist/services/watcher.d.ts.map +1 -1
- package/dist/services/watcher.js +18 -35
- package/dist/services/watcher.js.map +1 -1
- package/dist/services/websocket.d.ts +30 -16
- package/dist/services/websocket.d.ts.map +1 -1
- package/dist/services/websocket.js +102 -37
- package/dist/services/websocket.js.map +1 -1
- package/dist/services/worktree-sync-service.d.ts +228 -0
- package/dist/services/worktree-sync-service.d.ts.map +1 -0
- package/dist/services/worktree-sync-service.js +563 -0
- package/dist/services/worktree-sync-service.js.map +1 -0
- package/dist/types/editor.d.ts +49 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/editor.js +50 -0
- package/dist/types/editor.js.map +1 -0
- package/dist/types/project.d.ts +58 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +10 -0
- package/dist/types/project.js.map +1 -0
- package/dist/utils/executable-check.d.ts +36 -0
- package/dist/utils/executable-check.d.ts.map +1 -0
- package/dist/utils/executable-check.js +79 -0
- package/dist/utils/executable-check.js.map +1 -0
- package/dist/workers/execution-worker.d.ts +18 -0
- package/dist/workers/execution-worker.d.ts.map +1 -0
- package/dist/workers/execution-worker.js +340 -0
- package/dist/workers/execution-worker.js.map +1 -0
- package/dist/workers/worker-ipc.d.ts +84 -0
- package/dist/workers/worker-ipc.d.ts.map +1 -0
- package/dist/workers/worker-ipc.js +29 -0
- package/dist/workers/worker-ipc.js.map +1 -0
- package/package.json +6 -5
- package/dist/execution/output/ag-ui-integration.d.ts +0 -96
- package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
- package/dist/execution/output/ag-ui-integration.js +0 -96
- package/dist/execution/output/ag-ui-integration.js.map +0 -1
- package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
- package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
- package/dist/execution/output/claude-code-output-processor.js +0 -769
- package/dist/execution/output/claude-code-output-processor.js.map +0 -1
- package/dist/public/assets/index-B3SEMufD.js +0 -580
- package/dist/public/assets/index-B3SEMufD.js.map +0 -1
- package/dist/public/assets/index-D2YGL3gX.css +0 -1
- package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
- package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module services/execution-lifecycle
|
|
8
8
|
*/
|
|
9
9
|
import path from "path";
|
|
10
|
+
import { execSync } from "child_process";
|
|
10
11
|
import { WorktreeManager, } from "../execution/worktree/manager.js";
|
|
11
12
|
import { getWorktreeConfig } from "../execution/worktree/config.js";
|
|
12
13
|
import { createExecution, getExecution } from "./executions.js";
|
|
@@ -54,7 +55,7 @@ export class ExecutionLifecycleService {
|
|
|
54
55
|
* @throws Error if creation fails
|
|
55
56
|
*/
|
|
56
57
|
async createExecutionWithWorktree(params) {
|
|
57
|
-
const { issueId, issueTitle, agentType, targetBranch, repoPath } = params;
|
|
58
|
+
const { issueId, issueTitle, agentType, targetBranch, repoPath, createTargetBranch, } = params;
|
|
58
59
|
// Validation 1: Check for existing active execution for this issue
|
|
59
60
|
const existingExecution = this.db
|
|
60
61
|
.prepare(`SELECT id FROM executions
|
|
@@ -70,10 +71,18 @@ export class ExecutionLifecycleService {
|
|
|
70
71
|
if (!isValidRepo) {
|
|
71
72
|
throw new Error(`Not a git repository: ${repoPath}`);
|
|
72
73
|
}
|
|
73
|
-
// Validation 3: Validate target branch exists
|
|
74
|
+
// Validation 3: Validate target branch exists (or create it if requested)
|
|
74
75
|
const branches = await this.worktreeManager.listBranches(repoPath);
|
|
75
76
|
if (!branches.includes(targetBranch)) {
|
|
76
|
-
|
|
77
|
+
if (createTargetBranch) {
|
|
78
|
+
// Create the branch from current HEAD
|
|
79
|
+
const currentBranch = await this.worktreeManager.getCurrentBranch(repoPath);
|
|
80
|
+
await this.worktreeManager.createBranch(repoPath, targetBranch, currentBranch);
|
|
81
|
+
console.log(`[ExecutionLifecycle] Created new branch '${targetBranch}' from '${currentBranch}'`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
throw new Error(`Target branch does not exist: ${targetBranch}`);
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
const config = this.worktreeManager.getConfig();
|
|
79
88
|
// Generate execution ID
|
|
@@ -93,7 +102,20 @@ export class ExecutionLifecycleService {
|
|
|
93
102
|
const worktreePath = path.join(repoPath, config.worktreeStoragePath, executionId);
|
|
94
103
|
let worktreeCreated = false;
|
|
95
104
|
try {
|
|
96
|
-
// Step 1:
|
|
105
|
+
// Step 1: Capture current commit before creating worktree
|
|
106
|
+
let beforeCommit;
|
|
107
|
+
try {
|
|
108
|
+
beforeCommit = execSync("git rev-parse HEAD", {
|
|
109
|
+
cwd: repoPath,
|
|
110
|
+
encoding: "utf-8",
|
|
111
|
+
}).trim();
|
|
112
|
+
console.log(`[ExecutionLifecycle] Captured before_commit: ${beforeCommit}`);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.warn("[ExecutionLifecycle] Failed to capture before_commit:", error instanceof Error ? error.message : String(error));
|
|
116
|
+
// Continue - this is supplementary data
|
|
117
|
+
}
|
|
118
|
+
// Step 2: Create worktree
|
|
97
119
|
await this.worktreeManager.createWorktree({
|
|
98
120
|
repoPath,
|
|
99
121
|
branchName,
|
|
@@ -102,7 +124,7 @@ export class ExecutionLifecycleService {
|
|
|
102
124
|
createBranch: config.autoCreateBranches,
|
|
103
125
|
});
|
|
104
126
|
worktreeCreated = true;
|
|
105
|
-
// Step
|
|
127
|
+
// Step 3: Create execution record in database
|
|
106
128
|
const execution = createExecution(this.db, {
|
|
107
129
|
id: executionId,
|
|
108
130
|
issue_id: issueId,
|
|
@@ -110,6 +132,7 @@ export class ExecutionLifecycleService {
|
|
|
110
132
|
mode: params.mode,
|
|
111
133
|
prompt: params.prompt,
|
|
112
134
|
config: params.config,
|
|
135
|
+
before_commit: beforeCommit,
|
|
113
136
|
target_branch: targetBranch,
|
|
114
137
|
branch_name: branchName,
|
|
115
138
|
worktree_path: worktreePath,
|
|
@@ -191,12 +214,19 @@ export class ExecutionLifecycleService {
|
|
|
191
214
|
if (execution.worktree_path) {
|
|
192
215
|
try {
|
|
193
216
|
await this.worktreeManager.cleanupWorktree(execution.worktree_path, this.repoPath);
|
|
217
|
+
console.log(`Successfully cleaned up worktree for execution ${executionId}`);
|
|
194
218
|
// NOTE: We do NOT set worktree_path to null in the database
|
|
195
219
|
// Follow-up executions need this path to recreate the worktree
|
|
196
220
|
}
|
|
197
221
|
catch (error) {
|
|
198
|
-
//
|
|
199
|
-
|
|
222
|
+
// Check if error is due to worktree already being deleted
|
|
223
|
+
if (error.code === "ENOENT" || error.message?.includes("does not exist")) {
|
|
224
|
+
console.log(`Worktree already deleted for execution ${executionId}, skipping cleanup`);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// Log other errors but don't fail - cleanup is best-effort
|
|
228
|
+
console.error(`Failed to cleanup worktree for execution ${executionId}:`, error);
|
|
229
|
+
}
|
|
200
230
|
}
|
|
201
231
|
}
|
|
202
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-lifecycle.js","sourceRoot":"","sources":["../../src/services/execution-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EACL,eAAe,GAEhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"execution-lifecycle.js","sourceRoot":"","sources":["../../src/services/execution-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,eAAe,GAEhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO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,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;wBACnE,4DAA4D;wBAC5D,+DAA+D;oBACjE,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,OAAO,CAAC,KAAK,CACX,qDAAqD,WAAW,GAAG,EACnE,KAAK,CACN,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,2CAA2C,QAAQ,GAAG,EACtD,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,OAAO,CACL,GAAG;SACA,WAAW,EAAE;QACd,0CAA0C;SACzC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;QACxB,sEAAsE;SACrE,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;QAC7B,6BAA6B;SAC5B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,kCAAkC;SACjC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QACxB,eAAe;SACd,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module services/execution-logs-store
|
|
8
8
|
*/
|
|
9
9
|
import type Database from "better-sqlite3";
|
|
10
|
+
import type { NormalizedEntry } from "agent-execution-engine/agents";
|
|
10
11
|
/**
|
|
11
12
|
* Metadata for execution logs (without the full logs text)
|
|
12
13
|
*/
|
|
@@ -173,5 +174,79 @@ export declare class ExecutionLogsStore {
|
|
|
173
174
|
* ```
|
|
174
175
|
*/
|
|
175
176
|
getStats(): LogStats;
|
|
177
|
+
/**
|
|
178
|
+
* Append a normalized entry to execution logs
|
|
179
|
+
*
|
|
180
|
+
* Stores a NormalizedEntry object from agent-execution-engine as JSON.
|
|
181
|
+
* The entry is stored in the normalized_entry column alongside raw logs.
|
|
182
|
+
*
|
|
183
|
+
* @param executionId - Unique execution identifier
|
|
184
|
+
* @param entry - Normalized entry object from agent-execution-engine
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const entry: NormalizedEntry = {
|
|
189
|
+
* index: 0,
|
|
190
|
+
* type: { kind: 'assistant_message' },
|
|
191
|
+
* content: 'Hello world',
|
|
192
|
+
* timestamp: new Date(),
|
|
193
|
+
* };
|
|
194
|
+
* store.appendNormalizedEntry('exec-123', entry);
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
appendNormalizedEntry(executionId: string, entry: NormalizedEntry): void;
|
|
198
|
+
/**
|
|
199
|
+
* Get all normalized entries for an execution
|
|
200
|
+
*
|
|
201
|
+
* Retrieves and deserializes all normalized entries for an execution.
|
|
202
|
+
* Entries are returned in the order they were stored.
|
|
203
|
+
*
|
|
204
|
+
* @param executionId - Unique execution identifier
|
|
205
|
+
* @returns Array of normalized entries, or empty array if none found
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const entries = store.getNormalizedEntries('exec-123');
|
|
210
|
+
* entries.forEach(entry => {
|
|
211
|
+
* console.log(entry.type.kind, entry.content);
|
|
212
|
+
* });
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
getNormalizedEntries(executionId: string): NormalizedEntry[];
|
|
216
|
+
/**
|
|
217
|
+
* Check if execution has normalized entries
|
|
218
|
+
*
|
|
219
|
+
* Useful for determining which log format to use during migration period.
|
|
220
|
+
*
|
|
221
|
+
* @param executionId - Unique execution identifier
|
|
222
|
+
* @returns true if execution has at least one normalized entry
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* if (store.hasNormalizedEntries('exec-123')) {
|
|
227
|
+
* const entries = store.getNormalizedEntries('exec-123');
|
|
228
|
+
* } else {
|
|
229
|
+
* const logs = store.getRawLogs('exec-123');
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
hasNormalizedEntries(executionId: string): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Get entry count by kind for an execution
|
|
236
|
+
*
|
|
237
|
+
* Analyzes normalized entries and returns statistics about entry types.
|
|
238
|
+
* Useful for analytics, debugging, and monitoring.
|
|
239
|
+
*
|
|
240
|
+
* @param executionId - Unique execution identifier
|
|
241
|
+
* @returns Object mapping entry kinds to their counts
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* const stats = store.getEntryStats('exec-123');
|
|
246
|
+
* console.log(stats);
|
|
247
|
+
* // { assistant_message: 5, tool_use: 3, error: 1 }
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
getEntryStats(executionId: string): Record<string, number>;
|
|
176
251
|
}
|
|
177
252
|
//# sourceMappingURL=execution-logs-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-logs-store.d.ts","sourceRoot":"","sources":["../../src/services/execution-logs-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"execution-logs-store.d.ts","sourceRoot":"","sources":["../../src/services/execution-logs-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,MAAM,CA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C,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAW3D"}
|
|
@@ -40,8 +40,8 @@ export class ExecutionLogsStore {
|
|
|
40
40
|
*/
|
|
41
41
|
initializeLogs(executionId) {
|
|
42
42
|
const stmt = this.db.prepare(`
|
|
43
|
-
INSERT OR IGNORE INTO execution_logs (execution_id, raw_logs, byte_size, line_count)
|
|
44
|
-
VALUES (?, '', 0, 0)
|
|
43
|
+
INSERT OR IGNORE INTO execution_logs (execution_id, raw_logs, normalized_entry, byte_size, line_count)
|
|
44
|
+
VALUES (?, '', NULL, 0, 0)
|
|
45
45
|
`);
|
|
46
46
|
stmt.run(executionId);
|
|
47
47
|
}
|
|
@@ -235,5 +235,145 @@ export class ExecutionLogsStore {
|
|
|
235
235
|
: 0,
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Append a normalized entry to execution logs
|
|
240
|
+
*
|
|
241
|
+
* Stores a NormalizedEntry object from agent-execution-engine as JSON.
|
|
242
|
+
* The entry is stored in the normalized_entry column alongside raw logs.
|
|
243
|
+
*
|
|
244
|
+
* @param executionId - Unique execution identifier
|
|
245
|
+
* @param entry - Normalized entry object from agent-execution-engine
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const entry: NormalizedEntry = {
|
|
250
|
+
* index: 0,
|
|
251
|
+
* type: { kind: 'assistant_message' },
|
|
252
|
+
* content: 'Hello world',
|
|
253
|
+
* timestamp: new Date(),
|
|
254
|
+
* };
|
|
255
|
+
* store.appendNormalizedEntry('exec-123', entry);
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
appendNormalizedEntry(executionId, entry) {
|
|
259
|
+
// Check if execution_logs entry exists
|
|
260
|
+
const checkStmt = this.db.prepare(`
|
|
261
|
+
SELECT 1 FROM execution_logs WHERE execution_id = ?
|
|
262
|
+
`);
|
|
263
|
+
const exists = checkStmt.get(executionId);
|
|
264
|
+
const serialized = JSON.stringify(entry);
|
|
265
|
+
if (!exists) {
|
|
266
|
+
// First entry - create new row with NULL raw_logs
|
|
267
|
+
const insertStmt = this.db.prepare(`
|
|
268
|
+
INSERT INTO execution_logs (execution_id, raw_logs, normalized_entry, byte_size, line_count)
|
|
269
|
+
VALUES (?, NULL, ?, 0, 0)
|
|
270
|
+
`);
|
|
271
|
+
insertStmt.run(executionId, serialized);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
// Subsequent entries - append with newline
|
|
275
|
+
const updateStmt = this.db.prepare(`
|
|
276
|
+
UPDATE execution_logs
|
|
277
|
+
SET normalized_entry = COALESCE(normalized_entry, '') || char(10) || ?,
|
|
278
|
+
updated_at = CURRENT_TIMESTAMP
|
|
279
|
+
WHERE execution_id = ?
|
|
280
|
+
`);
|
|
281
|
+
updateStmt.run(serialized, executionId);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get all normalized entries for an execution
|
|
286
|
+
*
|
|
287
|
+
* Retrieves and deserializes all normalized entries for an execution.
|
|
288
|
+
* Entries are returned in the order they were stored.
|
|
289
|
+
*
|
|
290
|
+
* @param executionId - Unique execution identifier
|
|
291
|
+
* @returns Array of normalized entries, or empty array if none found
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* const entries = store.getNormalizedEntries('exec-123');
|
|
296
|
+
* entries.forEach(entry => {
|
|
297
|
+
* console.log(entry.type.kind, entry.content);
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
getNormalizedEntries(executionId) {
|
|
302
|
+
const stmt = this.db.prepare(`
|
|
303
|
+
SELECT normalized_entry
|
|
304
|
+
FROM execution_logs
|
|
305
|
+
WHERE execution_id = ?
|
|
306
|
+
AND normalized_entry IS NOT NULL
|
|
307
|
+
`);
|
|
308
|
+
const result = stmt.get(executionId);
|
|
309
|
+
if (!result || !result.normalized_entry) {
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
312
|
+
// Split by newline and parse each JSON line
|
|
313
|
+
const lines = result.normalized_entry
|
|
314
|
+
.split("\n")
|
|
315
|
+
.filter((line) => line.trim().length > 0);
|
|
316
|
+
return lines.map((line) => {
|
|
317
|
+
const entry = JSON.parse(line);
|
|
318
|
+
// Restore timestamp as Date object if it exists
|
|
319
|
+
if (entry.timestamp) {
|
|
320
|
+
entry.timestamp = new Date(entry.timestamp);
|
|
321
|
+
}
|
|
322
|
+
return entry;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Check if execution has normalized entries
|
|
327
|
+
*
|
|
328
|
+
* Useful for determining which log format to use during migration period.
|
|
329
|
+
*
|
|
330
|
+
* @param executionId - Unique execution identifier
|
|
331
|
+
* @returns true if execution has at least one normalized entry
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* if (store.hasNormalizedEntries('exec-123')) {
|
|
336
|
+
* const entries = store.getNormalizedEntries('exec-123');
|
|
337
|
+
* } else {
|
|
338
|
+
* const logs = store.getRawLogs('exec-123');
|
|
339
|
+
* }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
hasNormalizedEntries(executionId) {
|
|
343
|
+
const stmt = this.db.prepare(`
|
|
344
|
+
SELECT 1
|
|
345
|
+
FROM execution_logs
|
|
346
|
+
WHERE execution_id = ?
|
|
347
|
+
AND normalized_entry IS NOT NULL
|
|
348
|
+
AND normalized_entry != ''
|
|
349
|
+
`);
|
|
350
|
+
const result = stmt.get(executionId);
|
|
351
|
+
return result !== undefined;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Get entry count by kind for an execution
|
|
355
|
+
*
|
|
356
|
+
* Analyzes normalized entries and returns statistics about entry types.
|
|
357
|
+
* Useful for analytics, debugging, and monitoring.
|
|
358
|
+
*
|
|
359
|
+
* @param executionId - Unique execution identifier
|
|
360
|
+
* @returns Object mapping entry kinds to their counts
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const stats = store.getEntryStats('exec-123');
|
|
365
|
+
* console.log(stats);
|
|
366
|
+
* // { assistant_message: 5, tool_use: 3, error: 1 }
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
getEntryStats(executionId) {
|
|
370
|
+
const entries = this.getNormalizedEntries(executionId);
|
|
371
|
+
const stats = {};
|
|
372
|
+
for (const entry of entries) {
|
|
373
|
+
const kind = entry.type.kind;
|
|
374
|
+
stats[kind] = (stats[kind] || 0) + 1;
|
|
375
|
+
}
|
|
376
|
+
return stats;
|
|
377
|
+
}
|
|
238
378
|
}
|
|
239
379
|
//# sourceMappingURL=execution-logs-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-logs-store.js","sourceRoot":"","sources":["../../src/services/execution-logs-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"execution-logs-store.js","sourceRoot":"","sources":["../../src/services/execution-logs-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2BH;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,kBAAkB;IACT;IAApB,YAAoB,EAAqB;QAArB,OAAE,GAAF,EAAE,CAAmB;IAAG,CAAC;IAE7C;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,WAAmB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;KAG5B,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,WAAmB,EAAE,IAAY;QAC5C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,iBAAiB;QAE/D,MAAM,IAAI,GAAG,IAAI,CAAC,E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I,CAAoB,CAAC;YAElD,gDAAgD;YAChD,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpB,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9C,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,CAAC,WAAmB;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;;;;KAM5B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACrC,OAAO,MAAM,KAAK,SAAS,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,WAAmB;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;QACvD,MAAM,KAAK,GAA2B,EAAE,CAAC;QAEzC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -11,6 +11,8 @@ import type { Execution } from "@sudocode-ai/types";
|
|
|
11
11
|
import { ExecutionLifecycleService } from "./execution-lifecycle.js";
|
|
12
12
|
import type { TransportManager } from "../execution/transport/transport-manager.js";
|
|
13
13
|
import { ExecutionLogsStore } from "./execution-logs-store.js";
|
|
14
|
+
import { ExecutionWorkerPool } from "./execution-worker-pool.js";
|
|
15
|
+
import type { AgentType } from "@sudocode-ai/types/agents";
|
|
14
16
|
/**
|
|
15
17
|
* Configuration for creating an execution
|
|
16
18
|
*/
|
|
@@ -19,87 +21,42 @@ export interface ExecutionConfig {
|
|
|
19
21
|
model?: string;
|
|
20
22
|
timeout?: number;
|
|
21
23
|
baseBranch?: string;
|
|
24
|
+
createBaseBranch?: boolean;
|
|
22
25
|
branchName?: string;
|
|
26
|
+
reuseWorktreeId?: string;
|
|
23
27
|
checkpointInterval?: number;
|
|
24
28
|
continueOnStepFailure?: boolean;
|
|
25
29
|
captureFileChanges?: boolean;
|
|
26
30
|
captureToolCalls?: boolean;
|
|
27
31
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Template variable context for rendering
|
|
30
|
-
*/
|
|
31
|
-
export interface TemplateContext {
|
|
32
|
-
issueId: string;
|
|
33
|
-
title: string;
|
|
34
|
-
description: string;
|
|
35
|
-
relatedSpecs?: Array<{
|
|
36
|
-
id: string;
|
|
37
|
-
title: string;
|
|
38
|
-
}>;
|
|
39
|
-
feedback?: Array<{
|
|
40
|
-
issueId: string;
|
|
41
|
-
content: string;
|
|
42
|
-
}>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Result from prepareExecution - preview before starting
|
|
46
|
-
*/
|
|
47
|
-
export interface ExecutionPrepareResult {
|
|
48
|
-
renderedPrompt: string;
|
|
49
|
-
issue: {
|
|
50
|
-
id: string;
|
|
51
|
-
title: string;
|
|
52
|
-
content: string;
|
|
53
|
-
};
|
|
54
|
-
relatedSpecs: Array<{
|
|
55
|
-
id: string;
|
|
56
|
-
title: string;
|
|
57
|
-
}>;
|
|
58
|
-
defaultConfig: ExecutionConfig;
|
|
59
|
-
warnings?: string[];
|
|
60
|
-
errors?: string[];
|
|
61
|
-
}
|
|
62
32
|
/**
|
|
63
33
|
* ExecutionService
|
|
64
34
|
*
|
|
65
35
|
* Manages the full lifecycle of issue-based executions:
|
|
66
|
-
* - Preparing execution with template rendering
|
|
67
36
|
* - Creating and starting executions with worktree isolation
|
|
68
37
|
* - Creating follow-up executions that reuse worktrees
|
|
69
38
|
* - Canceling and cleaning up executions
|
|
70
39
|
*/
|
|
71
40
|
export declare class ExecutionService {
|
|
72
41
|
private db;
|
|
73
|
-
private
|
|
42
|
+
private projectId;
|
|
74
43
|
private lifecycleService;
|
|
75
44
|
private repoPath;
|
|
76
45
|
private transportManager?;
|
|
77
46
|
private logsStore;
|
|
78
|
-
private
|
|
47
|
+
private workerPool?;
|
|
79
48
|
/**
|
|
80
49
|
* Create a new ExecutionService
|
|
81
50
|
*
|
|
82
51
|
* @param db - Database instance
|
|
52
|
+
* @param projectId - Project ID for WebSocket broadcasts
|
|
83
53
|
* @param repoPath - Path to the git repository
|
|
84
54
|
* @param lifecycleService - Optional execution lifecycle service (creates one if not provided)
|
|
85
55
|
* @param transportManager - Optional transport manager for SSE streaming
|
|
86
56
|
* @param logsStore - Optional execution logs store (creates one if not provided)
|
|
57
|
+
* @param workerPool - Optional worker pool for isolated execution processes
|
|
87
58
|
*/
|
|
88
|
-
constructor(db: Database.Database, repoPath: string, lifecycleService?: ExecutionLifecycleService, transportManager?: TransportManager, logsStore?: ExecutionLogsStore);
|
|
89
|
-
/**
|
|
90
|
-
* Prepare execution - load issue, render template, return preview
|
|
91
|
-
*
|
|
92
|
-
* This method loads the issue and related context, renders the template,
|
|
93
|
-
* and returns a preview for the user to review before starting execution.
|
|
94
|
-
*
|
|
95
|
-
* @param issueId - ID of issue to prepare execution for
|
|
96
|
-
* @param options - Optional template and config overrides
|
|
97
|
-
* @returns Execution prepare result with rendered prompt and context
|
|
98
|
-
*/
|
|
99
|
-
prepareExecution(issueId: string, options?: {
|
|
100
|
-
templateId?: string;
|
|
101
|
-
config?: Partial<ExecutionConfig>;
|
|
102
|
-
}): Promise<ExecutionPrepareResult>;
|
|
59
|
+
constructor(db: Database.Database, projectId: string, repoPath: string, lifecycleService?: ExecutionLifecycleService, transportManager?: TransportManager, logsStore?: ExecutionLogsStore, workerPool?: ExecutionWorkerPool);
|
|
103
60
|
/**
|
|
104
61
|
* Create and start execution
|
|
105
62
|
*
|
|
@@ -110,20 +67,25 @@ export declare class ExecutionService {
|
|
|
110
67
|
* @param issueId - ID of issue to execute
|
|
111
68
|
* @param config - Execution configuration
|
|
112
69
|
* @param prompt - Rendered prompt to execute
|
|
70
|
+
* @param agentType - Type of agent to use (defaults to 'claude-code')
|
|
113
71
|
* @returns Created execution record
|
|
114
72
|
*/
|
|
115
|
-
createExecution(issueId: string, config: ExecutionConfig, prompt: string): Promise<Execution>;
|
|
73
|
+
createExecution(issueId: string, config: ExecutionConfig, prompt: string, agentType?: AgentType): Promise<Execution>;
|
|
116
74
|
/**
|
|
117
|
-
* Create follow-up execution
|
|
75
|
+
* Create follow-up execution
|
|
118
76
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
77
|
+
* For worktree-based executions: reuses the worktree and resumes the session.
|
|
78
|
+
* For local/non-worktree executions: creates a new execution with feedback context.
|
|
121
79
|
*
|
|
122
80
|
* @param executionId - ID of previous execution to follow up on
|
|
123
81
|
* @param feedback - Additional feedback/context to append to prompt
|
|
82
|
+
* @param options - Optional configuration
|
|
83
|
+
* @param options.includeOriginalPrompt - Whether to prepend the original issue content (default: false, assumes session resumption with full history)
|
|
124
84
|
* @returns Created follow-up execution record
|
|
125
85
|
*/
|
|
126
|
-
createFollowUp(executionId: string, feedback: string
|
|
86
|
+
createFollowUp(executionId: string, feedback: string, options?: {
|
|
87
|
+
includeOriginalPrompt?: boolean;
|
|
88
|
+
}): Promise<Execution>;
|
|
127
89
|
/**
|
|
128
90
|
* Cancel a running execution
|
|
129
91
|
*
|
|
@@ -157,9 +119,22 @@ export declare class ExecutionService {
|
|
|
157
119
|
* when they're configured for manual cleanup.
|
|
158
120
|
*
|
|
159
121
|
* @param executionId - ID of execution whose worktree to delete
|
|
122
|
+
* @param deleteBranch - Whether to also delete the execution's branch (default: false)
|
|
160
123
|
* @throws Error if execution not found, has no worktree, or worktree doesn't exist
|
|
161
124
|
*/
|
|
162
|
-
deleteWorktree(executionId: string): Promise<void>;
|
|
125
|
+
deleteWorktree(executionId: string, deleteBranch?: boolean): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Delete an execution and its entire chain
|
|
128
|
+
*
|
|
129
|
+
* Deletes the execution and all its follow-ups (descendants).
|
|
130
|
+
* Optionally deletes the worktree and/or branch.
|
|
131
|
+
*
|
|
132
|
+
* @param executionId - ID of execution to delete (can be root or any execution in chain)
|
|
133
|
+
* @param deleteBranch - Whether to also delete the execution's branch (default: false)
|
|
134
|
+
* @param deleteWorktree - Whether to also delete the execution's worktree (default: false)
|
|
135
|
+
* @throws Error if execution not found
|
|
136
|
+
*/
|
|
137
|
+
deleteExecution(executionId: string, deleteBranch?: boolean, deleteWorktree?: boolean): Promise<void>;
|
|
163
138
|
/**
|
|
164
139
|
* Shutdown execution service - cancel all active executions
|
|
165
140
|
*
|
|
@@ -184,5 +159,22 @@ export declare class ExecutionService {
|
|
|
184
159
|
* @returns Execution or null if not found
|
|
185
160
|
*/
|
|
186
161
|
getExecution(executionId: string): Execution | null;
|
|
162
|
+
/**
|
|
163
|
+
* Check if there are any active executions
|
|
164
|
+
*
|
|
165
|
+
* @returns true if there are active worker pool executions
|
|
166
|
+
*/
|
|
167
|
+
hasActiveExecutions(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Collect entity IDs that were already expanded in parent executions
|
|
170
|
+
*
|
|
171
|
+
* Walks the execution chain backwards and resolves each prompt to extract
|
|
172
|
+
* which entities were referenced (and thus expanded) in previous executions.
|
|
173
|
+
* This prevents redundant expansion of the same entities in follow-ups.
|
|
174
|
+
*
|
|
175
|
+
* @param executionId - ID of the current execution
|
|
176
|
+
* @returns Set of entity IDs that were already expanded
|
|
177
|
+
*/
|
|
178
|
+
private collectExpandedEntitiesFromChain;
|
|
187
179
|
}
|
|
188
180
|
//# sourceMappingURL=execution-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-service.d.ts","sourceRoot":"","sources":["../../src/services/execution-service.ts"],"names":[],"mappings":"AAAA;;;;;;;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