feat: add durable isolated Git workspaces and source-bound delivery

This commit is contained in:
Agent Workbench Dev
2026-10-29 23:22:30 +08:00
parent 7d60dc9c55
commit 7d9bfb85da
22 changed files with 1038 additions and 26 deletions
+4
View File
@@ -9,6 +9,8 @@ import { inspectProject } from './project-inspector.mjs';
import { gitArguments, gitEnvironment, runGit } from './git-process.mjs';
import { DeliveryReporter, verifiedCheck } from './delivery-report.mjs';
import { pendingDeliveryReview, resolveDeliveryReview } from '../shared/contracts/delivery-review.mjs';
import { assertWorkspacesResolved } from '../shared/contracts/workspaces.mjs';
import { verifyWorkspaceProject } from './workspaces/git-workspaces.mjs';
const at = () => new Date().toISOString();
const sha = value => createHash('sha256').update(value).digest('hex');
@@ -71,6 +73,7 @@ export class GitDelivery {
}
assertTask(session) {
assertChangeSetsResolved(this.store, session.projectId, { includePrepared: true });
assertWorkspacesResolved(this.store, session.projectId, { includePrepared: true });
if (!session.taskId || !session.runId) throw conflict('先发送一个项目任务,再准备本任务的Git交付。');
const task = this.store.owned('task', session.taskId, session.id), run = this.store.owned('run', session.runId, session.id);
if (run.taskId !== task.id) throw conflict('当前Task和Run归属不一致。');
@@ -84,6 +87,7 @@ export class GitDelivery {
}
async snapshot(project, { allowOwnLock = false } = {}) {
await verifyWorkspaceProject(this.store, project);
const root = safePath(project);
let top;
try { top = await this.needGit(project, ['rev-parse', '--show-toplevel']); }