feat: add owned Vite previews and isolated task browser with approved actions
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
export const PREVIEW_LIVE = new Set(['queued', 'starting', 'ready', 'stopping']);
|
||||
export const previewPlanSeal = plan => Object.fromEntries(['schemaVersion','id','sessionId','projectId','taskId','runId','root','workspace','nodeIdentity','sourceFingerprint','cli','script','invocation','port','url','timeoutMs'].map(key => [key, plan[key]]));
|
||||
export function unresolvedPreviews(store, projectId, { includeReady = false } = {}) {
|
||||
return [...(store.core.preview_job?.values() ?? [])].filter(job => job.projectId === projectId
|
||||
&& (PREVIEW_LIVE.has(job.status) && (includeReady || job.status !== 'ready') || job.requiresVerification && !job.reconciliation));
|
||||
}
|
||||
export function assertPreviewsResolved(store, projectId, options) {
|
||||
if (unresolvedPreviews(store, projectId, options).length) throw Object.assign(new Error(options?.includeReady
|
||||
? '请先停止所属项目预览并核对原进程,再更改运行环境或工作区。'
|
||||
: '项目预览正在启动、停止或中断结果待核对,请先处理原预览记录。'), { status: 409 });
|
||||
}
|
||||
Reference in New Issue
Block a user