@kevlns/art-workshop 0.2.1 → 0.3.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/AGENTS.md +24 -51
- package/README.md +31 -93
- package/art-workshop.mjs +69 -25
- package/docs/commands.md +913 -80
- package/docs/configuration.md +33 -139
- package/docs/core-guidance.md +7 -7
- package/docs/data-formats.md +14 -152
- package/docs/deployment.md +40 -0
- package/docs/model-architecture.md +52 -0
- package/docs/modes.md +15 -116
- package/docs/remote-models.md +42 -0
- package/docs/troubleshooting.md +30 -68
- package/lib/adapters/dashscope.mjs +234 -0
- package/lib/adapters/index.mjs +28 -0
- package/lib/agent.mjs +2 -2
- package/lib/analysis-worker.mjs +25 -0
- package/lib/analyze.mjs +8 -8
- package/lib/backends.mjs +350 -74
- package/lib/bl.mjs +3 -18
- package/lib/candidates.mjs +82 -0
- package/lib/comfyui.mjs +10 -8
- package/lib/contracts.d.ts +67 -0
- package/lib/deployment-worker.mjs +97 -0
- package/lib/deployment.mjs +72 -0
- package/lib/design.mjs +5 -5
- package/lib/dimensions.mjs +22 -0
- package/lib/edit.mjs +6 -3
- package/lib/environments.mjs +67 -0
- package/lib/execution/remote.mjs +156 -0
- package/lib/executor.mjs +10 -24
- package/lib/generate.mjs +9 -5
- package/lib/generation-policy.mjs +198 -0
- package/lib/images.mjs +10 -0
- package/lib/lifecycle.mjs +40 -0
- package/lib/migration.mjs +154 -0
- package/lib/model-catalog.mjs +288 -0
- package/lib/model-registry.mjs +234 -0
- package/lib/plan.mjs +98 -28
- package/lib/project.mjs +13 -4
- package/lib/providers.mjs +27 -22
- package/lib/refs.mjs +12 -16
- package/lib/runtime.mjs +6 -4
- package/lib/service.mjs +45 -4
- package/lib/settings.mjs +2 -4
- package/lib/style-lifecycle.mjs +72 -0
- package/lib/task-references.mjs +35 -0
- package/lib/task-worker.mjs +225 -50
- package/lib/tasks.mjs +440 -63
- package/lib/templates.mjs +69 -0
- package/lib/transport/cli.mjs +69 -0
- package/lib/transport/http.mjs +82 -0
- package/lib/vision.mjs +46 -0
- package/lib/workflows.mjs +10 -1
- package/lib/workspace.mjs +190 -0
- package/package.json +9 -3
- package/skills/art-workshop/SKILL.md +27 -54
- package/v-cli.plugin.json +1257 -143
- package/docs//351/227/256/351/242/230/346/212/245/345/221/212-2026-10-08.md +0 -29
package/lib/executor.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {compileRemoteRequest} from './generation-policy.mjs';
|
|
2
|
+
import {adapters} from './adapters/index.mjs';
|
|
1
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync } from 'node:fs';
|
|
2
4
|
import { join, dirname, resolve, relative, isAbsolute } from 'node:path';
|
|
3
5
|
import { randomUUID } from 'node:crypto';
|
|
@@ -6,13 +8,14 @@ import { hash, writeJson } from './shared.mjs';
|
|
|
6
8
|
export { validatePlan } from './plan.mjs';
|
|
7
9
|
export { writeJson } from './shared.mjs';
|
|
8
10
|
import { runBl, sha256File, resolveBlEntry } from './bl.mjs';
|
|
11
|
+
import {ownedPath} from './workspace.mjs';
|
|
9
12
|
import {loadSettings,externalPath} from './settings.mjs';
|
|
10
13
|
|
|
11
14
|
function runtimeVersion() {
|
|
12
15
|
try { return JSON.parse(readFileSync(join(dirname(dirname(resolveBlEntry())), 'package.json'), 'utf8')).version ?? 'unknown'; }
|
|
13
16
|
catch { return 'unknown'; }
|
|
14
17
|
}
|
|
15
|
-
export function executePlan(plan, items, { outputRoot=loadSettings().paths.output, dry = false, runner
|
|
18
|
+
export function executePlan(plan, items, { outputRoot=loadSettings().paths.output, dry = false, runner, log = console.log } = {}) {
|
|
16
19
|
validatePlan(plan);
|
|
17
20
|
if (!items.length) throw new Error('没有选中任何计划项');
|
|
18
21
|
for (const item of items) {
|
|
@@ -23,15 +26,16 @@ export function executePlan(plan, items, { outputRoot=loadSettings().paths.outpu
|
|
|
23
26
|
externalPath(outputRoot,'输出目录');
|
|
24
27
|
if (dry) {
|
|
25
28
|
const requests = items.map(item => ({ ...(item.design?{design:item.design,execution:item.execution}:{}),itemId: item.itemId, variantId: item.variantId, seed: item.seed,
|
|
26
|
-
inputHash: item.inputHash, args: buildArgs(plan, item, join(outputRoot,'<runId>'), `${item.itemId}--${item.variantId}`) }));
|
|
29
|
+
inputHash: item.inputHash, ...(plan.backend?.provider!=='comfyui'?(()=>{const request=item.request??compileRemoteRequest(plan,item);return {request,wireRequest:adapters.get(request.adapter).preview?.(request)};})():{}), args: buildArgs(plan, item, join(outputRoot,'<runId>'), `${item.itemId}--${item.variantId}`) }));
|
|
27
30
|
log(JSON.stringify({ dry: true, remoteCalls: 0, planHash: plan.planHash, requests }, null, 2));
|
|
28
31
|
return { dry: true, requests };
|
|
29
32
|
}
|
|
33
|
+
if(!runner)throw new Error('真实执行必须使用受管 task 生命周期;executePlan 仅用于预演或注入测试');
|
|
30
34
|
const runId = `${plan.job.replaceAll('/', '-')}-${new Date().toISOString().replace(/[:.]/g, '-')}-${randomUUID().slice(0, 8)}`;
|
|
31
35
|
const runDir = join(outputRoot, runId);
|
|
32
36
|
mkdirSync(runDir, { recursive: true });
|
|
33
37
|
const manifest = { schema: 'art-workshop/run', runId, plan, planHash: plan.planHash, blVersion: runner === runBl ? runtimeVersion() : 'injected',
|
|
34
|
-
startedAt: new Date().toISOString(), items: []
|
|
38
|
+
startedAt: new Date().toISOString(), items: [] };
|
|
35
39
|
const manifestPath = join(runDir, 'manifest.json');
|
|
36
40
|
const persist = () => {
|
|
37
41
|
manifest.summary = { completed: manifest.items.filter(x => x.status !== 'running').length, expected: items.length,
|
|
@@ -77,10 +81,10 @@ export function outputPath(manifestPath, file) {
|
|
|
77
81
|
const path = resolve(base, file);
|
|
78
82
|
const rel = relative(base, path);
|
|
79
83
|
if (isAbsolute(rel) || rel === '..' || rel.startsWith('..\\') || rel.startsWith('../')) throw new Error('输出路径越界');
|
|
80
|
-
return
|
|
84
|
+
return ownedPath(base,file);
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
export function checkRun(manifest, manifestPath
|
|
87
|
+
export function checkRun(manifest, manifestPath) {
|
|
84
88
|
validatePlan(manifest.plan);
|
|
85
89
|
for (const item of manifest.items) {
|
|
86
90
|
const expected = manifest.plan.items.find(x => x.itemId === item.itemId && x.variantId === item.variantId);
|
|
@@ -89,28 +93,10 @@ export function checkRun(manifest, manifestPath, review = manifest.review ?? [])
|
|
|
89
93
|
if (hash({value:item[key]}) !== hash({value:expected[key]})) throw new Error(`执行记录已改变:${item.itemId}.${key}`);
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
if (!Array.isArray(review)) throw new Error('review 必须为数组');
|
|
93
|
-
const keys = new Set();
|
|
94
|
-
for (const row of review) {
|
|
95
|
-
// check 导出的失败记录也可保留在人工模板中,但不能被批准。
|
|
96
|
-
if (row.file === null && manifest.items.some(i => i.itemId === row.itemId && i.variantId === row.variantId && !i.files.length && !i.ok)) {
|
|
97
|
-
if (row.accepted === true) throw new Error('无产物的失败项不能通过验收');
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const key = `${row.itemId}/${row.variantId}/${row.file}`;
|
|
101
|
-
if (keys.has(key)) throw new Error(`重复 review:${key}`);
|
|
102
|
-
keys.add(key);
|
|
103
|
-
if (!manifest.items.some(i => i.itemId === row.itemId && i.variantId === row.variantId && i.files.includes(row.file))) throw new Error(`review 未匹配产物:${key}`);
|
|
104
|
-
for (const dimension of ['content', 'style', 'asset']) {
|
|
105
|
-
if (!['pass', 'fail', 'pending'].includes(row[dimension])) throw new Error(`review.${dimension} 必须为 pass/fail/pending`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
96
|
return manifest.items.flatMap(item => item.files.length ? item.files.map(file => {
|
|
109
97
|
const path = outputPath(manifestPath, file);
|
|
110
98
|
const integrity = existsSync(path) && sha256File(path) === item.outputHashes[file];
|
|
111
|
-
const row = review.find(r => r.itemId === item.itemId && r.variantId === item.variantId && r.file === file);
|
|
112
99
|
return { itemId: item.itemId, variantId: item.variantId, file, path, integrity, generated: item.ok,
|
|
113
|
-
checks: item.checks,
|
|
114
|
-
reason: row?.reason ?? '', accepted: integrity && item.ok && ['content', 'style', 'asset'].every(k => row?.[k] === 'pass') };
|
|
100
|
+
checks: item.checks, accepted: integrity && item.ok && !!manifest.finishedAt && !item.deleted };
|
|
115
101
|
}) : [{ itemId: item.itemId, variantId: item.variantId, file: null, generated: false, accepted: false, error: item.error }]);
|
|
116
102
|
}
|
package/lib/generate.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {taskReferencePrompt} from './task-references.mjs';
|
|
2
|
+
import {readObject,verifyReferences} from './workspace.mjs';
|
|
1
3
|
import { readJson, keys, id, text, texts, integer, hash } from './shared.mjs';
|
|
2
4
|
import { ROOT,loadProject,loadJob,projectPath } from './project.mjs';
|
|
3
5
|
import {selectCore,corePrompt,coreNegative} from './core.mjs';
|
|
@@ -5,12 +7,14 @@ import {execution,finishPlan} from './plan.mjs';
|
|
|
5
7
|
import {presentation,assetPrompt} from './presentation.mjs';
|
|
6
8
|
import {design,designPrompt} from './design.mjs';
|
|
7
9
|
export function compileGenerate({projectId,jobId,coreId,root=ROOT,localExecution={}}) {
|
|
10
|
+
const taskRecord=readObject(root,projectId,'task',jobId);const dynamicRefs=verifyReferences(root,taskRecord),referencePrompt=taskReferencePrompt(taskRecord);
|
|
8
11
|
const project=loadProject(projectId,root),job=loadJob(projectId,jobId,'generate',root);
|
|
9
|
-
keys(job,['project','kind','core','profile','execution','items'],'job');
|
|
12
|
+
keys(job,['project','kind','core','profile','asset','execution','items'],'job');
|
|
10
13
|
const selected=selectCore(project,job,coreId,root),core=selected.core;
|
|
11
|
-
|
|
14
|
+
if(Boolean(job.asset)===Boolean(job.profile))throw new Error('任务必须指定一份内联资产规格或一个资产规格模板');
|
|
15
|
+
const profile=job.asset??readJson(projectPath(root,projectId,'profiles',job.profile));
|
|
12
16
|
keys(profile,['project','id','name','constraints','defaults','allowedOverrides','presets','checks','design'],'profile');
|
|
13
|
-
if(profile.project!==projectId||profile.id!==job.profile) throw new Error('资产配置工程身份不匹配');
|
|
17
|
+
if(profile.project!==projectId||job.profile&&profile.id!==job.profile) throw new Error('资产配置工程身份不匹配');
|
|
14
18
|
keys(profile.constraints,['text','frame','scene','crop','shadow'],'constraints');
|
|
15
19
|
for(const v of Object.values(profile.constraints)) if(typeof v!=='boolean') throw new Error('资产约束必须为布尔值');
|
|
16
20
|
texts(profile.checks,'profile.checks');
|
|
@@ -44,8 +48,8 @@ export function compileGenerate({projectId,jobId,coreId,root=ROOT,localExecution
|
|
|
44
48
|
const p=presentation(profile,{...source.composition,...variant.composition},d);
|
|
45
49
|
if(!objectIds.has(p.value.focalTarget)) throw new Error('视觉焦点不存在');
|
|
46
50
|
const seed=variant.seed??source.seed??parseInt(hash([projectId,jobId,source.id]).slice(0,7),16); integer(seed,'seed');
|
|
47
|
-
items.push({...(d?{design:d,execution:execution(project,{...job.execution,size:`${d.outputSize.width}*${d.outputSize.height}`},localExecution)}:{}),itemId:source.id,variantId:variant.id,seed,brief:{...source,composition:p.value},prompt:`【风格核心】\n${corePrompt(core,source.entities.map(e=>e.kind))}\n【真实需求】\n${source.intent}。\n${lines.join('\n')}\n视觉焦点:${p.value.focalTarget}。\n【构图与资产】\n${p.prompt}\n${d ? designPrompt(d) : ""}\n${assetPrompt(profile)}`,negativeBlock:[coreNegative(core),profile.constraints.text?'':'文字, 字母, 水印',profile.constraints.frame?'':'装饰外框'].filter(Boolean).join(', '),imageArgs:[],checks:{content:source.mustRead,style:[corePrompt(core,source.entities.map(e=>e.kind))],asset:[...profile.checks,p.background]}});
|
|
51
|
+
items.push({...(d?{design:d,execution:execution(project,{...job.execution,size:`${d.outputSize.width}*${d.outputSize.height}`},localExecution)}:{}),itemId:source.id,variantId:variant.id,seed,brief:{...source,composition:p.value},prompt:`【风格核心】\n${corePrompt(core,source.entities.map(e=>e.kind))}\n【真实需求】\n${source.intent}。\n${lines.join('\n')}\n视觉焦点:${p.value.focalTarget}。\n【构图与资产】\n${p.prompt}\n${d ? designPrompt(d) : ""}\n${assetPrompt(profile)}${referencePrompt}`,negativeBlock:[coreNegative(core),profile.constraints.text?'':'文字, 字母, 水印',profile.constraints.frame?'':'装饰外框'].filter(Boolean).join(', '),imageArgs:[],checks:{content:source.mustRead,style:[corePrompt(core,source.entities.map(e=>e.kind))],asset:[...profile.checks,p.background]}});
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
return finishPlan({module:'generate',project:projectId,job:jobId,execution:execution(project,job.execution,localExecution),sources:{core:core.id,coreHash:core.coreHash,selection:selected.source},snapshots:{project,core,profile,job},refs:
|
|
54
|
+
return finishPlan({module:'generate',project:projectId,job:jobId,execution:execution(project,job.execution,localExecution),sources:{taskRevision:taskRecord.revision,taskConfigHash:hash(taskRecord.config),core:core.id,coreHash:core.coreHash,selection:selected.source},snapshots:{project,core,profile,job},refs:dynamicRefs.map(r=>({path:r.path,hash:r.hash})),items});
|
|
51
55
|
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { hash } from "./shared.mjs";
|
|
2
|
+
import {
|
|
3
|
+
resolveModel,
|
|
4
|
+
contractHash,
|
|
5
|
+
modelRegistry,
|
|
6
|
+
} from "./model-registry.mjs";
|
|
7
|
+
export function remotePrompt(item, compatibility) {
|
|
8
|
+
return compatibility.negativeInPrompt && item.negativeBlock
|
|
9
|
+
? item.prompt +
|
|
10
|
+
"\n\n必须避免以下内容(由负向约束并入主提示词):\n" +
|
|
11
|
+
item.negativeBlock
|
|
12
|
+
: item.prompt;
|
|
13
|
+
}
|
|
14
|
+
export function validateRemotePlan(plan, registry = modelRegistry) {
|
|
15
|
+
const model = plan.backend?.model ?? plan.execution.model;
|
|
16
|
+
const compatibility = registry.resolve(
|
|
17
|
+
plan.backend?.credentialReference?.api ?? "dashscope",
|
|
18
|
+
model,
|
|
19
|
+
plan.module,
|
|
20
|
+
);
|
|
21
|
+
if (!compatibility.supported)
|
|
22
|
+
throw new Error(model + ":" + compatibility.reason);
|
|
23
|
+
if (!compatibility.modes.includes(plan.module))
|
|
24
|
+
throw new Error(
|
|
25
|
+
model +
|
|
26
|
+
" 不支持当前任务类型(支持:" +
|
|
27
|
+
compatibility.modes
|
|
28
|
+
.map((mode) => (mode === "generate" ? "生成" : "编辑"))
|
|
29
|
+
.join(" / ") +
|
|
30
|
+
")",
|
|
31
|
+
);
|
|
32
|
+
for (const item of plan.items) {
|
|
33
|
+
const e = item.execution ?? plan.execution;
|
|
34
|
+
if (e.model !== model) throw new Error("计划执行模型与适配模型不一致");
|
|
35
|
+
const [w, h] = String(e.size).split("*").map(Number),
|
|
36
|
+
d = registry.resolve(
|
|
37
|
+
compatibility.api,
|
|
38
|
+
model,
|
|
39
|
+
plan.module,
|
|
40
|
+
!!item.imageArgs?.length,
|
|
41
|
+
).dimensions;
|
|
42
|
+
if (
|
|
43
|
+
!Number.isInteger(w) ||
|
|
44
|
+
!Number.isInteger(h) ||
|
|
45
|
+
w < d.min ||
|
|
46
|
+
h < d.min ||
|
|
47
|
+
w > d.max ||
|
|
48
|
+
h > d.max ||
|
|
49
|
+
w % d.step ||
|
|
50
|
+
h % d.step ||
|
|
51
|
+
w * h < d.minArea ||
|
|
52
|
+
w * h > d.maxArea ||
|
|
53
|
+
w / h < (d.minRatio ?? 0) ||
|
|
54
|
+
w / h > (d.maxRatio ?? Infinity)
|
|
55
|
+
)
|
|
56
|
+
throw new Error(model + " 分辨率超出适配范围,请重新编译预案");
|
|
57
|
+
if (
|
|
58
|
+
!Number.isInteger(e.perValue) ||
|
|
59
|
+
e.perValue < 1 ||
|
|
60
|
+
e.perValue > compatibility.maxCount
|
|
61
|
+
)
|
|
62
|
+
throw new Error("生成数量超出工具适配范围");
|
|
63
|
+
if (
|
|
64
|
+
!Number.isInteger(item.seed) ||
|
|
65
|
+
item.seed < 0 ||
|
|
66
|
+
item.seed > compatibility.maxSeed
|
|
67
|
+
)
|
|
68
|
+
throw new Error("seed 超出模型范围");
|
|
69
|
+
if ((item.imageArgs ?? []).length > compatibility.maxImages)
|
|
70
|
+
throw new Error("参考输入图片超过模型上限");
|
|
71
|
+
if (plan.module === "edit" && !(item.imageArgs ?? []).length)
|
|
72
|
+
throw new Error("编辑模型需要输入底图");
|
|
73
|
+
if (!compatibility.fields?.promptExtend && e.promptExtend)
|
|
74
|
+
throw new Error(
|
|
75
|
+
model + " 不支持提示词扩写,请关闭 promptExtend 后重新预演",
|
|
76
|
+
);
|
|
77
|
+
if (!compatibility.fields?.watermark && e.watermark)
|
|
78
|
+
throw new Error(model + " 不支持水印参数");
|
|
79
|
+
if (
|
|
80
|
+
compatibility.maxNegativeCharacters &&
|
|
81
|
+
[...(item.negativeBlock ?? "")].length >
|
|
82
|
+
compatibility.maxNegativeCharacters
|
|
83
|
+
)
|
|
84
|
+
throw new Error(
|
|
85
|
+
"负向提示词超过 " + compatibility.maxNegativeCharacters + " 字符",
|
|
86
|
+
);
|
|
87
|
+
if (
|
|
88
|
+
compatibility.maxPromptCharacters &&
|
|
89
|
+
[...remotePrompt(item, compatibility)].length >
|
|
90
|
+
compatibility.maxPromptCharacters
|
|
91
|
+
)
|
|
92
|
+
throw new Error(
|
|
93
|
+
"主提示词与负向约束合计超过 " +
|
|
94
|
+
compatibility.maxPromptCharacters +
|
|
95
|
+
" 字符",
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
return compatibility;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function compileRemoteRequest(
|
|
102
|
+
plan,
|
|
103
|
+
item,
|
|
104
|
+
{ registry = modelRegistry } = {},
|
|
105
|
+
) {
|
|
106
|
+
const e = item.execution ?? plan.execution,
|
|
107
|
+
api = plan.backend?.credentialReference?.api ?? "dashscope";
|
|
108
|
+
const spec = registry.resolve(
|
|
109
|
+
api,
|
|
110
|
+
e.model,
|
|
111
|
+
plan.module,
|
|
112
|
+
!!item.imageArgs?.length,
|
|
113
|
+
);
|
|
114
|
+
validateRemotePlan({ ...plan, items: [item] }, registry);
|
|
115
|
+
const parameters = { size: e.size, n: e.perValue, seed: item.seed },
|
|
116
|
+
adjustments = [];
|
|
117
|
+
const reserved = new Set([
|
|
118
|
+
"model",
|
|
119
|
+
"size",
|
|
120
|
+
"perValue",
|
|
121
|
+
"promptExtend",
|
|
122
|
+
"watermark",
|
|
123
|
+
]);
|
|
124
|
+
for (const key of Object.keys(e))
|
|
125
|
+
if (!reserved.has(key) && !spec.fields?.[key])
|
|
126
|
+
throw new Error("模型不支持参数 " + key);
|
|
127
|
+
for (const [key, rule] of Object.entries(spec.fields ?? {})) {
|
|
128
|
+
const value = e[key] ?? rule.default;
|
|
129
|
+
if (value === undefined) continue;
|
|
130
|
+
if (
|
|
131
|
+
rule.type === "integer"
|
|
132
|
+
? !Number.isSafeInteger(value) ||
|
|
133
|
+
value < (rule.min ?? -Infinity) ||
|
|
134
|
+
value > (rule.max ?? Infinity)
|
|
135
|
+
: typeof value !== rule.type
|
|
136
|
+
)
|
|
137
|
+
throw new Error("模型参数类型或范围错误:" + key);
|
|
138
|
+
if (rule.enum && !rule.enum.includes(value))
|
|
139
|
+
throw new Error("模型参数取值无效:" + key);
|
|
140
|
+
parameters[rule.wire] = value;
|
|
141
|
+
}
|
|
142
|
+
if (item.dimensionAdjustment)
|
|
143
|
+
adjustments.push({
|
|
144
|
+
parameter: "size",
|
|
145
|
+
action: "resolve-dimensions",
|
|
146
|
+
...item.dimensionAdjustment,
|
|
147
|
+
message: "尺寸已解析到当前模型的合法范围",
|
|
148
|
+
});
|
|
149
|
+
const prompt = remotePrompt(item, spec);
|
|
150
|
+
if (prompt !== item.prompt)
|
|
151
|
+
adjustments.push({
|
|
152
|
+
parameter: "negativePrompt",
|
|
153
|
+
action: "append-to-prompt",
|
|
154
|
+
message: "负向约束已明确并入主提示词",
|
|
155
|
+
});
|
|
156
|
+
if (item.negativeBlock && !spec.negativeInPrompt)
|
|
157
|
+
parameters.negative_prompt = item.negativeBlock;
|
|
158
|
+
return {
|
|
159
|
+
schema: "art/image-request-v1",
|
|
160
|
+
api,
|
|
161
|
+
adapter: spec.transport.adapter,
|
|
162
|
+
transport: spec.transport,
|
|
163
|
+
inputPolicy: spec.inputPolicy,
|
|
164
|
+
contractHash: contractHash(spec),
|
|
165
|
+
module: plan.module,
|
|
166
|
+
model: e.model,
|
|
167
|
+
prompt,
|
|
168
|
+
negativePrompt: spec.negativeInPrompt ? "" : (item.negativeBlock ?? ""),
|
|
169
|
+
images: [...(item.imageArgs ?? [])],
|
|
170
|
+
parameters,
|
|
171
|
+
size: e.size,
|
|
172
|
+
seed: item.seed,
|
|
173
|
+
count: e.perValue,
|
|
174
|
+
adjustments,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export function freezeRemotePlan(plan) {
|
|
178
|
+
const requests = plan.items.map((item) => compileRemoteRequest(plan, item));
|
|
179
|
+
return {
|
|
180
|
+
requests,
|
|
181
|
+
contract: {
|
|
182
|
+
schema: "art/execution-contract-v1",
|
|
183
|
+
hash: hash(requests.map((r) => r.contractHash)),
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export function assertRemoteContract(plan) {
|
|
188
|
+
if (!plan.executionContract || !plan.items.every((item) => item.request))
|
|
189
|
+
throw new Error("预案缺少当前执行契约,请重新预演");
|
|
190
|
+
const current = freezeRemotePlan(plan);
|
|
191
|
+
if (
|
|
192
|
+
hash(current.contract) !== hash(plan.executionContract) ||
|
|
193
|
+
plan.items.some(
|
|
194
|
+
(item, index) => hash(item.request) !== hash(current.requests[index]),
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
throw new Error("模型执行契约已变化,请重新预演");
|
|
198
|
+
}
|
package/lib/images.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import sharp from 'sharp';
|
|
2
|
+
export async function validateImage(buffer){
|
|
3
|
+
if(!Buffer.isBuffer(buffer)||buffer.length>20*1024*1024)throw new Error('单张图片最大 20MB');
|
|
4
|
+
try{
|
|
5
|
+
const pipeline=sharp(buffer,{limitInputPixels:64*1024*1024,failOn:'warning'}),metadata=await pipeline.metadata();
|
|
6
|
+
if(!['png','jpeg','webp'].includes(metadata.format)||!metadata.width||!metadata.height||metadata.pages>1)throw new Error('只支持单帧 PNG/JPEG/WebP');
|
|
7
|
+
await pipeline.resize(1,1).raw().toBuffer();
|
|
8
|
+
return {format:metadata.format,width:metadata.width,height:metadata.height};
|
|
9
|
+
}catch(error){throw new Error('图片无法完整解码:'+error.message);}
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Execution completion is separate from proof that all side effects have stopped. */
|
|
2
|
+
export const RUN_STATES = Object.freeze([
|
|
3
|
+
"queued",
|
|
4
|
+
"running",
|
|
5
|
+
"cancelling",
|
|
6
|
+
"succeeded",
|
|
7
|
+
"failed",
|
|
8
|
+
"cancelled",
|
|
9
|
+
"unknown",
|
|
10
|
+
]);
|
|
11
|
+
export const terminal = (status) =>
|
|
12
|
+
["succeeded", "failed", "cancelled", "unknown"].includes(status);
|
|
13
|
+
export function executionSettled(task) {
|
|
14
|
+
return (
|
|
15
|
+
terminal(task.status) &&
|
|
16
|
+
task.status !== "unknown" &&
|
|
17
|
+
task.stopConfirmed === true &&
|
|
18
|
+
!task.unsettled &&
|
|
19
|
+
!task.promptId &&
|
|
20
|
+
!task.remoteCancellation &&
|
|
21
|
+
!Object.values(task.remoteExecutions ?? {}).some((receipt) =>
|
|
22
|
+
["dispatching", "accepted"].includes(receipt.state),
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
export function executionLifecycle(task) {
|
|
27
|
+
if (task.status === "queued") return "accepted";
|
|
28
|
+
if (["running", "cancelling"].includes(task.status)) return "running";
|
|
29
|
+
if (!executionSettled(task)) return "unknown";
|
|
30
|
+
return { succeeded: "completed", failed: "failed", cancelled: "cancelled" }[
|
|
31
|
+
task.status
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
export function assertIdle(runs, label = "对象") {
|
|
35
|
+
const blocked = runs.filter((run) => !executionSettled(run));
|
|
36
|
+
if (blocked.length)
|
|
37
|
+
throw new Error(
|
|
38
|
+
`${label}存在运行中或停止未确认的执行:${blocked.map((run) => run.taskId).join(", ")}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {existsSync,mkdirSync,readdirSync,cpSync,renameSync,rmSync} from 'node:fs';
|
|
2
|
+
import {join,dirname,relative,resolve} from 'node:path';
|
|
3
|
+
import {randomUUID} from 'node:crypto';
|
|
4
|
+
import {id,readJson,writeJson,hash} from './shared.mjs';
|
|
5
|
+
import {createHash} from 'node:crypto';
|
|
6
|
+
import {externalPath} from './settings.mjs';
|
|
7
|
+
import {readFileSync} from 'node:fs';
|
|
8
|
+
import {locked,tasks,runtimeRoot,alive,taskFile} from './runtime.mjs';
|
|
9
|
+
import {taskStatus} from './tasks.mjs';
|
|
10
|
+
import {assertIdle} from './lifecycle.mjs';
|
|
11
|
+
import {ownedPath,STYLE_CATEGORIES,TASK_PURPOSES} from './workspace.mjs';
|
|
12
|
+
import {validateImage} from './images.mjs';
|
|
13
|
+
import {checkRun} from './executor.mjs';
|
|
14
|
+
|
|
15
|
+
/** Preflight old executions and synchronous manifests without modifying evidence. */
|
|
16
|
+
async function legacyRuns(settings,projectId){
|
|
17
|
+
const result=new Map(),oldRoot=join(dirname(settings.file),'.runtime',hash(settings.file).slice(0,12));
|
|
18
|
+
for(const run of tasks(oldRoot).filter(run=>(run.plan?.project??run.project)===projectId)){
|
|
19
|
+
if(alive(run.workerPid)||!['succeeded','failed','cancelled'].includes(run.status)||run.promptId||run.unsettled||run.remoteCancellation)throw new Error('旧工程存在运行或停止未知的执行,必须先核验原运行');
|
|
20
|
+
if(!run.finishedAt)throw new Error('旧执行缺少停止证据,不能推断完成');
|
|
21
|
+
result.set(run.taskId,{...run,stopConfirmed:true,root:runtimeRoot(settings),migration:{source:taskFile(oldRoot,run.taskId)}});
|
|
22
|
+
}
|
|
23
|
+
const manifests=[];
|
|
24
|
+
const scan=directory=>{if(!existsSync(directory))return;for(const entry of readdirSync(directory,{withFileTypes:true})){const path=ownedPath(settings.paths.output,directory,entry.name);if(entry.isDirectory())scan(path);else if(entry.name==='manifest.json')manifests.push(path);}};
|
|
25
|
+
scan(settings.paths.output);
|
|
26
|
+
for(const path of manifests){const manifest=readJson(path);if(manifest.schema!=='art-workshop/run'||manifest.plan?.project!==projectId)continue;
|
|
27
|
+
if(!manifest.finishedAt)throw new Error('历史批次缺少完成证据:'+manifest.runId);
|
|
28
|
+
const rows=checkRun(manifest,path);for(const row of rows.filter(row=>row.generated)){if(!row.integrity)throw new Error('历史候选完整性失败:'+row.file);await validateImage(readFileSync(row.path));}
|
|
29
|
+
const runId=manifest.taskId??('task-legacy-'+hash({path,runId:manifest.runId}).slice(0,24));id(runId);
|
|
30
|
+
const existing=result.get(runId);if(existing&&existing.plan?.planHash!==manifest.planHash)throw new Error('旧批次运行身份冲突');
|
|
31
|
+
result.set(runId,{...(existing??{}),schema:'art-workshop/task',taskId:runId,status:manifest.summary?.failed?'failed':'succeeded',stopConfirmed:true,createdAt:manifest.startedAt,finishedAt:manifest.finishedAt,plan:manifest.plan,items:manifest.plan.items,manifestPath:path,root:runtimeRoot(settings),outputRoot:settings.paths.output,migration:{...existing?.migration,manifestRunId:manifest.runId,review:manifest.review??[]}});
|
|
32
|
+
}
|
|
33
|
+
return [...result.values()];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Explicit one-time upgrade. Readers never fall back to legacy documents. */
|
|
37
|
+
export async function upgradeProject(root,projectId,{dry=true,referenceAssignments={},settings}={}){
|
|
38
|
+
if(!dry&&!settings)throw new Error('升级必须提供执行配置以检查运行占用');
|
|
39
|
+
const upgrade=async()=>{
|
|
40
|
+
id(projectId);
|
|
41
|
+
const journal=ownedPath(root,'.runtime/upgrades',projectId+'.json');
|
|
42
|
+
if(existsSync(journal)){
|
|
43
|
+
if(dry)throw new Error('升级事务未完成,请先显式执行 project upgrade 恢复原工程');
|
|
44
|
+
const transaction=readJson(journal),source=ownedPath(root,'projects',projectId);
|
|
45
|
+
if(transaction.schema!=='art-workshop/upgrade'||transaction.project!==projectId)throw new Error('升级事务身份不匹配');
|
|
46
|
+
const backup=ownedPath(root,'backups',transaction.backup),staging=ownedPath(root,'projects',transaction.staging);
|
|
47
|
+
if(existsSync(backup)){
|
|
48
|
+
for(const run of transaction.createdRuns){const file=taskFile(runtimeRoot(settings),run.taskId);if(existsSync(file)){if(hash(readJson(file))!==run.hash)throw new Error('升级后的执行记录被修改,不能自动回滚');rmSync(file,{force:true});}}
|
|
49
|
+
if(existsSync(source)){if(readJson(join(source,'project.json')).schemaVersion!==2)throw new Error('升级目标被修改,不能自动回滚');rmSync(source,{recursive:true,force:true});}
|
|
50
|
+
renameSync(backup,source);
|
|
51
|
+
}
|
|
52
|
+
if(existsSync(staging))rmSync(staging,{recursive:true,force:true});
|
|
53
|
+
rmSync(journal,{force:true});
|
|
54
|
+
}
|
|
55
|
+
if(settings)assertIdle(tasks(runtimeRoot(settings)).filter(t=>t.plan?.project===projectId||t.project===projectId).map(t=>taskStatus(runtimeRoot(settings),t.taskId)),'工程');
|
|
56
|
+
id(projectId);const source=ownedPath(root,'projects',projectId),project=readJson(ownedPath(source,'project.json'));
|
|
57
|
+
if(project.schemaVersion===2)return {project:projectId,current:true,changes:[]};
|
|
58
|
+
const runs=settings?await legacyRuns(settings,projectId):[];
|
|
59
|
+
const jobs=existsSync(ownedPath(source,'jobs'))?readdirSync(ownedPath(source,'jobs')).filter(f=>f.endsWith('.json')):[];
|
|
60
|
+
const cores=existsSync(ownedPath(source,'cores'))?readdirSync(ownedPath(source,'cores')).filter(f=>f.endsWith('.json')):[];
|
|
61
|
+
for(const file of jobs){const config=readJson(ownedPath(source,'jobs',file));if(config.kind==='edit')for(const item of config.items??[]){if(!item.source)throw new Error('旧编辑任务缺少底图:'+file);await validateImage(readFileSync(externalPath(resolve(root,item.source),'旧编辑底图')));}}
|
|
62
|
+
const approvedByRun=new Map(),groups=new Map(),selected=new Set();
|
|
63
|
+
for(const run of runs){
|
|
64
|
+
const manifest=run.manifestPath?readJson(run.manifestPath):null;
|
|
65
|
+
const approved=manifest?checkRun(manifest,run.manifestPath).filter(row=>row.integrity&&row.generated&&(run.migration.review??[]).some(review=>review.itemId===row.itemId&&review.variantId===row.variantId&&review.file===row.file&&['content','style','asset'].every(key=>review[key]==='pass'))):[];
|
|
66
|
+
approvedByRun.set(run.taskId,approved);
|
|
67
|
+
for(const row of approved){const key=run.plan.job+'/'+row.itemId,entry={runId:run.taskId,row};groups.set(key,[...(groups.get(key)??[]),entry]);}
|
|
68
|
+
}
|
|
69
|
+
for(const [key,entries] of groups){
|
|
70
|
+
const mapping=referenceAssignments.selections?.find(selection=>selection.task+'/'+selection.assetId===key);
|
|
71
|
+
const choice=mapping?entries.find(entry=>entry.runId===mapping.runId&&entry.row.file===mapping.file&&entry.row.variantId===mapping.variantId):entries.length===1?entries[0]:null;
|
|
72
|
+
if(!choice)throw new Error('同一资产存在多份旧采用记录,需在 selections 映射中明确 runId/file/variantId:'+key);
|
|
73
|
+
selected.add(hash({runId:choice.runId,assetId:choice.row.itemId,variantId:choice.row.variantId,file:choice.row.file}));
|
|
74
|
+
}
|
|
75
|
+
const refs=project.refsDir;
|
|
76
|
+
if(refs&&!referenceAssignments.confirmed)throw new Error('旧项目共享 refs 必须先明确归属映射,禁止猜测升级');
|
|
77
|
+
const result={project:projectId,current:false,runs:runs.map(run=>({id:run.taskId,job:run.plan?.job,status:run.status})),changes:[...jobs.map(f=>'jobs/'+f+' → tasks/'+f.slice(0,-5)+'/task.json'),...cores.map(f=>'cores/'+f+' → styles/'+f.slice(0,-5)+'/core.json')],dry};
|
|
78
|
+
if(refs){
|
|
79
|
+
const assignments=referenceAssignments.references;if(!Array.isArray(assignments))throw new Error('参考映射必须包含 references 列表');
|
|
80
|
+
const importRoot=externalPath(join(root,refs),'旧参考目录'),images=[];
|
|
81
|
+
const scan=dir=>{for(const entry of readdirSync(dir,{withFileTypes:true})){const file=ownedPath(importRoot,dir,entry.name);if(entry.isDirectory())scan(file);else if(/\.(png|jpe?g|webp)$/i.test(entry.name))images.push(file);}};
|
|
82
|
+
if(existsSync(importRoot))scan(importRoot);
|
|
83
|
+
for(const file of images)if(!assignments.some(a=>ownedPath(importRoot,a.path)===file))throw new Error('参考未明确映射:'+file);
|
|
84
|
+
for(const assignment of assignments){
|
|
85
|
+
if(!['style','task'].includes(assignment.kind))throw new Error('映射对象类型非法');id(assignment.id);
|
|
86
|
+
if(assignment.kind==='style'&&!STYLE_CATEGORIES.includes(assignment.category))throw new Error('风格映射分类非法');
|
|
87
|
+
if(assignment.kind==='task'&&(!assignment.purposes?.length||assignment.purposes.some(p=>!TASK_PURPOSES.includes(p))))throw new Error('任务映射用途非法');
|
|
88
|
+
const existing=ownedPath(source,assignment.kind==='style'?'styles':'tasks',assignment.id,assignment.kind+'.json');
|
|
89
|
+
const legacy=ownedPath(source,assignment.kind==='style'?'cores':'jobs',assignment.id+'.json');
|
|
90
|
+
if(!existsSync(existing)&&!existsSync(legacy))throw new Error('映射目标不存在:'+assignment.id);
|
|
91
|
+
await validateImage(readFileSync(ownedPath(importRoot,assignment.path)));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if(dry)return result;
|
|
95
|
+
// No symlink is allowed in a managed conversion tree.
|
|
96
|
+
const check=directory=>{for(const name of readdirSync(directory,{withFileTypes:true})){const path=ownedPath(directory,name.name);if(name.isDirectory())check(path);}};check(source);
|
|
97
|
+
const staging=ownedPath(root,'projects',projectId+'-upgrade-'+randomUUID()),backup=ownedPath(root,'backups',projectId+'-'+randomUUID());
|
|
98
|
+
cpSync(source,staging,{recursive:true,errorOnExist:true,force:false});
|
|
99
|
+
try{
|
|
100
|
+
for(const file of jobs){
|
|
101
|
+
const objectId=file.slice(0,-5);id(objectId);const config=readJson(join(staging,'jobs',file));
|
|
102
|
+
if(config.kind==='edit')for(const item of config.items??[]){
|
|
103
|
+
if(!item.source)throw new Error('旧编辑任务缺少底图,不能丢弃配置:'+objectId);
|
|
104
|
+
const input=externalPath(resolve(root,item.source),'旧编辑底图'),buffer=readFileSync(input);await validateImage(buffer);
|
|
105
|
+
const extension=input.slice(input.lastIndexOf('.')).toLowerCase();if(!['.png','.jpg','.jpeg','.webp'].includes(extension))throw new Error('旧编辑底图格式非法');
|
|
106
|
+
const name=randomUUID()+extension,target=ownedPath(staging,'tasks',objectId,'sources',name);mkdirSync(dirname(target),{recursive:true});cpSync(input,target,{errorOnExist:true,force:false});
|
|
107
|
+
item.source=relative(root,ownedPath(source,'tasks',objectId,'sources',name)).replaceAll('\\','/');
|
|
108
|
+
}
|
|
109
|
+
writeJson(join(staging,'tasks',objectId,'task.json'),{schema:'art-workshop/task',schemaVersion:2,project:projectId,id:objectId,name:objectId,revision:1,status:'draft',createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),source:null,config,references:[],report:null});
|
|
110
|
+
}
|
|
111
|
+
for(const file of cores){const objectId=file.slice(0,-5);id(objectId);const core=readJson(join(staging,'cores',file));const {coreHash,...body}=core;if(hash(body)!==coreHash||core.project!==projectId||core.id!==objectId)throw new Error('旧冻结核心完整性失败');writeJson(join(staging,'styles',objectId,'core.json'),core);writeJson(join(staging,'styles',objectId,'style.json'),{schema:'art-workshop/style',schemaVersion:2,project:projectId,id:objectId,name:objectId,revision:1,status:'frozen',coreHash,createdAt:core.approvedAt,updatedAt:core.approvedAt,source:null,config:core.config,references:[],report:{data:core.report,sourceRevision:1,path:null,runId:null,sourceHash:null}});}
|
|
112
|
+
for(const run of runs){
|
|
113
|
+
const file=ownedPath(staging,'tasks',run.plan?.job,'task.json');if(!existsSync(file))throw new Error('历史运行没有对应任务,不能丢弃:'+run.taskId);
|
|
114
|
+
const record=readJson(file),approved=approvedByRun.get(run.taskId);
|
|
115
|
+
for(const row of approved){const candidateId=hash({runId:run.taskId,assetId:row.itemId,variantId:row.variantId,file:row.file}),selection={assetId:row.itemId,runId:run.taskId,candidateId,path:row.path,hash:createHash('sha256').update(readFileSync(row.path)).digest('hex'),taskConfigHash:hash(record.config),actor:'legacy-upgrade',createdAt:run.finishedAt,revision:1};
|
|
116
|
+
if(selected.has(candidateId)){record.finalizations??=[];record.finalizations.push(selection);}else{record.finalizationHistory??=[];record.finalizationHistory.push({...selection,supersededByMigration:true});}
|
|
117
|
+
}
|
|
118
|
+
writeJson(file,record);
|
|
119
|
+
const destination=taskFile(runtimeRoot(settings),run.taskId);if(existsSync(destination)&&hash(readJson(destination))!==hash(run))throw new Error('目标执行记录冲突,保留原工程');
|
|
120
|
+
}
|
|
121
|
+
delete project.refsDir;project.schemaVersion=2;project.revision=1;writeJson(join(staging,'project.json'),project);
|
|
122
|
+
// Reject unresolved external refs rather than silently drop their associations.
|
|
123
|
+
if(refs){
|
|
124
|
+
const assignments=referenceAssignments.references;
|
|
125
|
+
if(!Array.isArray(assignments))throw new Error('参考映射必须包含 references 列表');
|
|
126
|
+
const importRoot=externalPath(join(root,refs),'旧参考目录');
|
|
127
|
+
const images=[];const scan=dir=>{for(const entry of readdirSync(dir,{withFileTypes:true})){const path=ownedPath(importRoot,dir,entry.name);if(entry.isDirectory())scan(path);else if(/\.(png|jpe?g|webp)$/i.test(entry.name))images.push(path);}};if(existsSync(importRoot))scan(importRoot);
|
|
128
|
+
for(const path of images)if(!assignments.some(a=>ownedPath(importRoot,a.path)===path))throw new Error('参考未明确映射:'+path);
|
|
129
|
+
for(const assignment of assignments){
|
|
130
|
+
if(!['style','task'].includes(assignment.kind))throw new Error('映射对象类型非法');id(assignment.id);
|
|
131
|
+
if(assignment.kind==='style'&&!STYLE_CATEGORIES.includes(assignment.category))throw new Error('风格映射分类非法');
|
|
132
|
+
if(assignment.kind==='task'&&(!assignment.purposes?.length||assignment.purposes.some(p=>!TASK_PURPOSES.includes(p))))throw new Error('任务映射用途非法');
|
|
133
|
+
const objectDir=ownedPath(staging,assignment.kind==='style'?'styles':'tasks',assignment.id),file=ownedPath(objectDir,assignment.kind+'.json');
|
|
134
|
+
const record=readJson(file),input=ownedPath(importRoot,assignment.path),buffer=readFileSync(input),refId='ref-'+randomUUID();
|
|
135
|
+
const extension=input.slice(input.lastIndexOf('.')).toLowerCase();if(!['.png','.jpg','.jpeg','.webp'].includes(extension))throw new Error('参考格式非法');
|
|
136
|
+
const target=['refs',...(assignment.kind==='style'?[assignment.category]:[]),refId+extension].join('/');
|
|
137
|
+
const destination=ownedPath(objectDir,target);mkdirSync(join(destination,'..'),{recursive:true});
|
|
138
|
+
cpSync(input,destination,{recursive:false,force:false});
|
|
139
|
+
record.references.push({id:refId,path:target,hash:createHash('sha256').update(buffer).digest('hex'),source:input,category:assignment.category??null,purposes:assignment.purposes??[],usage:'understand',note:assignment.note??'',ignore:assignment.ignore??''});writeJson(file,record);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for(const dir of ['jobs','cores'])rmSync(ownedPath(staging,dir),{recursive:true,force:true});
|
|
143
|
+
const createdRuns=runs.filter(run=>!existsSync(taskFile(runtimeRoot(settings),run.taskId))).map(run=>({taskId:run.taskId,hash:hash(run)}));
|
|
144
|
+
writeJson(journal,{schema:'art-workshop/upgrade',project:projectId,backup:relative(join(root,'backups'),backup),staging:relative(join(root,'projects'),staging),createdRuns});
|
|
145
|
+
mkdirSync(join(root,'backups'),{recursive:true});renameSync(source,backup);
|
|
146
|
+
const created=[];
|
|
147
|
+
try{renameSync(staging,source);for(const run of runs){const file=taskFile(runtimeRoot(settings),run.taskId);if(!existsSync(file)){created.push(file);writeJson(file,run);}}}
|
|
148
|
+
catch(error){for(const file of created)rmSync(file,{force:true});if(existsSync(source))rmSync(ownedPath(root,source),{recursive:true,force:true});renameSync(backup,source);rmSync(journal,{force:true});throw error;}
|
|
149
|
+
rmSync(journal,{force:true});
|
|
150
|
+
return {...result,backup};
|
|
151
|
+
}finally{if(existsSync(staging))rmSync(ownedPath(root,'projects',staging),{recursive:true,force:true});}
|
|
152
|
+
};
|
|
153
|
+
return dry?upgrade():locked(runtimeRoot(settings),'control',upgrade);
|
|
154
|
+
}
|