@kevlns/art-workshop 0.4.2 → 0.5.1
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 +25 -105
- package/LICENSE +21 -21
- package/README.md +63 -63
- package/art-workshop.mjs +174 -167
- package/docs/commands.md +116 -8
- package/docs/configuration.md +82 -82
- package/docs/core-guidance.md +50 -50
- package/docs/data-formats.md +85 -79
- package/docs/deployment.md +32 -32
- package/docs/local-models/qwen-image-2.1.json +73 -73
- package/docs/local-models/qwen-image-2.1.md +33 -33
- package/docs/model-architecture.md +78 -78
- package/docs/modes.md +67 -67
- package/lib/agent.mjs +32 -47
- package/lib/analysis-worker.mjs +32 -29
- package/lib/analyze.mjs +85 -78
- package/lib/asset-profile.mjs +23 -0
- package/lib/candidates.mjs +103 -101
- package/lib/comfy-recovery.mjs +17 -17
- package/lib/conversation.mjs +77 -0
- package/lib/core.mjs +75 -89
- package/lib/deployment-guide.mjs +12 -12
- package/lib/design.mjs +29 -29
- package/lib/dimensions.mjs +22 -22
- package/lib/edit.mjs +41 -38
- package/lib/environment-operations.mjs +49 -49
- package/lib/environment-runtime.mjs +99 -99
- package/lib/environments.mjs +55 -55
- package/lib/errors.mjs +32 -0
- package/lib/executor.mjs +107 -107
- package/lib/generate.mjs +58 -59
- package/lib/heartbeat.mjs +16 -16
- package/lib/images.mjs +1 -1
- package/lib/lifecycle.mjs +53 -53
- package/lib/migration.mjs +154 -154
- package/lib/object-format.mjs +112 -0
- package/lib/presentation.mjs +18 -2
- package/lib/process-identity.mjs +14 -14
- package/lib/project.mjs +39 -39
- package/lib/prompt-structure.mjs +7 -3
- package/lib/refs.mjs +26 -26
- package/lib/runtime.mjs +25 -25
- package/lib/service.mjs +126 -126
- package/lib/settings.mjs +50 -50
- package/lib/shared.mjs +67 -66
- package/lib/style-bundle.mjs +85 -85
- package/lib/style-contract.mjs +74 -35
- package/lib/style-evidence.mjs +39 -0
- package/lib/style-lifecycle.mjs +125 -120
- package/lib/style-report.mjs +201 -0
- package/lib/style-review.mjs +14 -75
- package/lib/task-contract.mjs +93 -59
- package/lib/tasks.mjs +497 -495
- package/lib/templates.mjs +80 -70
- package/lib/vision.mjs +56 -46
- package/lib/workspace.mjs +292 -238
- package/package.json +3 -5
- package/rules/core-guidance.json +22 -22
- package/skills/art-workshop/SKILL.md +17 -112
- package/skills/art-workshop/references/conversation.md +11 -0
- package/skills/art-workshop/references/expression.md +27 -0
- package/skills/art-workshop/references/getty.md +76 -0
- package/skills/art-workshop/references/project.md +109 -0
- package/skills/art-workshop/references/style-discussion.md +27 -0
- package/skills/art-workshop/scripts/getty.py +269 -0
- package/v-cli.plugin.json +2747 -2491
- package/scripts/sync-skill.mjs +0 -6
- /package/{skills/art-workshop → adapters/codex}/agents/openai.yaml +0 -0
package/art-workshop.mjs
CHANGED
|
@@ -1,167 +1,174 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {prepareRuntime} from './lib/environment-runtime.mjs';
|
|
3
|
-
import {readdirSync,existsSync} from 'node:fs';
|
|
4
|
-
import {join,resolve} from 'node:path';
|
|
5
|
-
import {readJson,writeJson} from './lib/shared.mjs';
|
|
6
|
-
const args=process.argv.slice(2),pos=[],options={};
|
|
7
|
-
if(args.length===1&&['--version','-V'].includes(args[0])){console.log(readJson(new URL('./package.json',import.meta.url)).version);process.exit(0);}
|
|
8
|
-
const help='art-workshop: config path/show/init/validate | doctor [--backend ID] [--start] | workflow list | environment guide/list/prepare/inspect/verify/register/unregister | refs guide | agent index/docs/
|
|
9
|
-
if(!args.length||args.length===1&&['--help','-h','help'].includes(args[0])){console.log(help);process.exit(0);}
|
|
10
|
-
const {
|
|
11
|
-
const {
|
|
12
|
-
const {
|
|
13
|
-
const {
|
|
14
|
-
const {
|
|
15
|
-
const {
|
|
16
|
-
const {
|
|
17
|
-
const {
|
|
18
|
-
const {
|
|
19
|
-
const {
|
|
20
|
-
const {
|
|
21
|
-
const {
|
|
22
|
-
const {
|
|
23
|
-
const {
|
|
24
|
-
const {
|
|
25
|
-
const {
|
|
26
|
-
const {
|
|
27
|
-
const {
|
|
28
|
-
const {
|
|
29
|
-
const {
|
|
30
|
-
const {
|
|
31
|
-
const {
|
|
32
|
-
const {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if(module==='
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
else if(action==='
|
|
59
|
-
else if(
|
|
60
|
-
else
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
else
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if(action==='
|
|
67
|
-
else if(action==='
|
|
68
|
-
else if(action==='
|
|
69
|
-
else throw new Error('未知
|
|
70
|
-
}
|
|
71
|
-
else if(module==='
|
|
72
|
-
if(action==='
|
|
73
|
-
else if(action==='
|
|
74
|
-
else
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if(action==='
|
|
79
|
-
else if(action==='
|
|
80
|
-
else
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if(action==='
|
|
87
|
-
else if(action==='
|
|
88
|
-
else
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
else if(action==='
|
|
94
|
-
else if(action==='
|
|
95
|
-
else if(action==='
|
|
96
|
-
else
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if(action
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
else if(module==='
|
|
110
|
-
|
|
111
|
-
if(action==='
|
|
112
|
-
else if(action==='
|
|
113
|
-
else
|
|
114
|
-
}
|
|
115
|
-
else if(module==='
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
else if(action==='
|
|
120
|
-
else
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if(action==='
|
|
127
|
-
else if(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
else
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if(action==='
|
|
153
|
-
else if(action==='
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
else if(action==='
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {prepareRuntime} from './lib/environment-runtime.mjs';
|
|
3
|
+
import {readdirSync,existsSync} from 'node:fs';
|
|
4
|
+
import {join,resolve} from 'node:path';
|
|
5
|
+
import {readJson,writeJson} from './lib/shared.mjs';
|
|
6
|
+
const args=process.argv.slice(2),pos=[],options={};
|
|
7
|
+
if(args.length===1&&['--version','-V'].includes(args[0])){console.log(readJson(new URL('./package.json',import.meta.url)).version);process.exit(0);}
|
|
8
|
+
const help='art-workshop: config path/show/init/validate | doctor [--backend ID] [--start] | workflow list | environment guide/list/prepare/inspect/verify/register/unregister | refs guide | agent index/docs/export | conversation start/status/cancel/resume | list | style export/import/sources/create/list/read/update/derive/discard/analyze/resolve/adopt/recover/validate/show | generate show/plan/run | edit show/plan/run | task list/status/wait/cancel/recover/resume | shutdown | check RUN | project init/upgrade | job template/from-candidate/create/list/read/update/derive/discard/restore/analyze | reference import/list/update/remove | candidate list/favorites/favorite/finalize/delete/finalizations | compare PLAN PLAN\nrun --background 返回任务 ID;--backend 选择后端。shutdown 停止当前工作区关联任务,核验共享队列和进程身份后关闭本地服务。\n也可用 v-cli art 调用;先 v-cli agent docs art,再 v-cli agent describe art --json 查看完整参数。';
|
|
9
|
+
if(!args.length||args.length===1&&['--help','-h','help'].includes(args[0])){console.log(help);process.exit(0);}
|
|
10
|
+
const {taskObjectView}=await import('./lib/asset-profile.mjs');
|
|
11
|
+
const {loadJob,loadProject}=await import('./lib/project.mjs');
|
|
12
|
+
const {referenceRoot,referenceGuide}=await import('./lib/refs.mjs');
|
|
13
|
+
const {loadSettings,initSettings,externalPath}=await import('./lib/settings.mjs');
|
|
14
|
+
const {validateReport,loadCore}=await import('./lib/core.mjs');
|
|
15
|
+
const {compileGenerate}=await import('./lib/generate.mjs');
|
|
16
|
+
const {compileEdit}=await import('./lib/edit.mjs');
|
|
17
|
+
const {validatePlan,selectItems}=await import('./lib/plan.mjs');
|
|
18
|
+
const {executePlan,checkRun}=await import('./lib/executor.mjs');
|
|
19
|
+
const {agentIndex,agentDocs,exportSkill}=await import('./lib/agent.mjs');
|
|
20
|
+
const {backendDefaults,bindBackend,buildComfyRequest}=await import('./lib/backends.mjs');
|
|
21
|
+
const {startTask,taskStatus,taskView,recoverTask,resumeTask,waitTask,cancelTask,shutdown}=await import('./lib/tasks.mjs');
|
|
22
|
+
const {runtimeRoot,tasks}=await import('./lib/runtime.mjs');
|
|
23
|
+
const {validateConfiguration,doctor}=await import('./lib/diagnostics.mjs');
|
|
24
|
+
const {finishMigration,createProject,createObject,listObjects,readObject,styleView,updateObject,deriveObject,discardObject,restoreTask,importReference,removeReference,updateReference,taskDisplayState,STYLE_CATEGORIES,TASK_PURPOSES}=await import('./lib/workspace.mjs');
|
|
25
|
+
const {startAnalysis,adoptStyle,recoverStyleAdoption,resolveStyleIssue,reviseStyleRules}=await import('./lib/style-lifecycle.mjs');
|
|
26
|
+
const {candidates,finalize,deleteCandidate,finalizations,editFromCandidate}=await import('./lib/candidates.mjs');
|
|
27
|
+
const {favoriteList,setFavorite}=await import('./lib/favorites.mjs');
|
|
28
|
+
const {upgradeProject}=await import('./lib/migration.mjs');
|
|
29
|
+
const {workflowList}=await import('./lib/workflows.mjs');
|
|
30
|
+
const {jobTemplate}=await import('./lib/templates.mjs');
|
|
31
|
+
const {deploymentGuide}=await import('./lib/deployment-guide.mjs');
|
|
32
|
+
const {inspectInstallation,discoverInstallations}=await import('./lib/environments.mjs');
|
|
33
|
+
const {verifyInstallation,registerInstallation,unregisterInstallation}=await import('./lib/environment-operations.mjs');
|
|
34
|
+
const flags=new Set(['dry','explore','background','start','replace','confirm','all-variants']);
|
|
35
|
+
const allowed=new Set(['config','workspace','output-dir','refs-dir','cache-dir','directory','host','session','request','endpoint','guide','project','input','out','report','note','core','job','plan','item','variant','offset','limit','file','backend','timeout','kind','id','revision','source','category','purposes','mapping','run','candidate','actor','operation','retry-run','item-id','value','name',...flags]);
|
|
36
|
+
for(let i=0;i<args.length;i++){if(args[i].startsWith('--')){const k=args[i].slice(2);if(!allowed.has(k)||k in options) throw new Error('未知或重复参数 '+k);options[k]=flags.has(k)?true:args[++i];if(options[k]===undefined) throw new Error('参数缺少值 '+k);}else pos.push(args[i]);}
|
|
37
|
+
const print=x=>console.log(JSON.stringify(x?.schema==='art-workshop/style'?styleView(settings.paths.workspace,x):x,null,2));
|
|
38
|
+
if(pos[0]==='workflow'&&pos[1]==='list'){print(workflowList());process.exit(0);}
|
|
39
|
+
let settings;
|
|
40
|
+
try{settings=loadSettings({file:options.config?resolve(options.config):undefined,workspace:options.workspace,output:options['output-dir'],refs:options['refs-dir'],cache:options['cache-dir']});}
|
|
41
|
+
catch(error){print({ok:false,stage:'configuration',issues:[{code:'configuration',message:error.message}]});process.exit(1);}
|
|
42
|
+
if(pos[0]==='config'&&pos[1]==='validate'||pos[0]==='doctor'){
|
|
43
|
+
if(pos[0]==='doctor'&&pos[1])throw new Error('doctor 不接受位置参数');
|
|
44
|
+
const report=pos[0]==='doctor'?await doctor(settings,{backend:options.backend,start:options.start}):validateConfiguration(settings,{backend:options.backend});print(report);process.exitCode=report.ok?0:1;
|
|
45
|
+
}else{
|
|
46
|
+
if(options.start)throw new Error('--start 仅用于 doctor');
|
|
47
|
+
const ROOT=settings.paths.workspace;
|
|
48
|
+
const path=x=>externalPath(resolve(ROOT,x),'资源文件');
|
|
49
|
+
function required(k){const value=options[k]??(k==='project'?settings.defaultProject:undefined);if(!value) throw new Error('需要 --'+k);return value;}
|
|
50
|
+
function manifestPath(value){const p=externalPath(resolve(settings.paths.output,value));return p.endsWith('.json')?p:join(p,'manifest.json');}
|
|
51
|
+
try {
|
|
52
|
+
const [module,action]=pos;
|
|
53
|
+
|
|
54
|
+
const effectiveRefs=referenceRoot({defaultRefsDir:settings.paths.refs});
|
|
55
|
+
if(module==='conversation'){
|
|
56
|
+
const {startConversation,conversationStatus,controlConversation}=await import('./lib/conversation.mjs');
|
|
57
|
+
if(action==='start')print(await startConversation(readJson(path(required('input'))),settings));
|
|
58
|
+
else if(action==='status')print(await conversationStatus(settings,required('session'),required('request')));
|
|
59
|
+
else if(['cancel','resume','close'].includes(action))print(await controlConversation(settings,required('session'),required('request'),action));
|
|
60
|
+
else throw new Error('未知 conversation 操作');
|
|
61
|
+
}else if(module==='environment'){
|
|
62
|
+
if(action==='guide')print(deploymentGuide(options.guide));
|
|
63
|
+
else if(action==='list')print({environments:discoverInstallations()});
|
|
64
|
+
else if(action==='prepare')print(await prepareRuntime(required('directory'),{guideId:options.guide}));
|
|
65
|
+
else if(action==='inspect')print(await inspectInstallation(required('directory'),required('endpoint'),options.guide));
|
|
66
|
+
else if(action==='verify'){const result=await verifyInstallation(required('directory'),required('endpoint'),{guideId:options.guide});print(result);if(!result.ok)process.exitCode=1;}
|
|
67
|
+
else if(action==='register')print(await registerInstallation(required('directory'),required('endpoint'),{guideId:options.guide}));
|
|
68
|
+
else if(action==='unregister')print(await unregisterInstallation(required('directory')));
|
|
69
|
+
else throw new Error('未知 environment 操作');
|
|
70
|
+
}
|
|
71
|
+
else if(module==='config'){
|
|
72
|
+
if(action==='path') console.log(settings.file);
|
|
73
|
+
else if(action==='show') print(settings);
|
|
74
|
+
else if(action==='init') print(initSettings(settings.file));
|
|
75
|
+
else throw new Error('未知 config 操作');
|
|
76
|
+
}
|
|
77
|
+
else if(module==='project'){
|
|
78
|
+
if(action==='upgrade')print(await upgradeProject(ROOT,required('project'),{dry:options.dry,settings,referenceAssignments:options.mapping?readJson(path(options.mapping)):undefined}));
|
|
79
|
+
else if(action==='init')print(await createProject(settings,required('project'),readJson(path(required('input')))));
|
|
80
|
+
else throw new Error('未知 project 操作');
|
|
81
|
+
}
|
|
82
|
+
else if(module==='reference'){
|
|
83
|
+
const projectId=required('project'),kind=required('kind'),objectId=required('id');
|
|
84
|
+
if(action==='list')print(readObject(ROOT,projectId,kind,objectId).references);
|
|
85
|
+
else if(action==='import')print(await importReference(settings,projectId,kind,objectId,Number(required('revision')),{source:required('source'),category:options.category,purposes:options.purposes?.split(','),itemId:options['item-id'],note:options.note??''}));
|
|
86
|
+
else if(action==='remove')print(await removeReference(settings,projectId,kind,objectId,Number(required('revision')),required('item')));
|
|
87
|
+
else if(action==='update')print(await updateReference(settings,projectId,kind,objectId,Number(required('revision')),required('item'),readJson(path(required('input')))));
|
|
88
|
+
else throw new Error('未知 reference 操作');
|
|
89
|
+
}
|
|
90
|
+
else if(module==='job'||module==='style'&&['create','list','update','derive','discard','read','migration-complete'].includes(action)){
|
|
91
|
+
const projectId=required('project'),kind=module==='job'?'task':'style';
|
|
92
|
+
if(action==='migration-complete')print(await finishMigration(settings,projectId,kind,required('id'),Number(required('revision')),readJson(path(required('input')))));
|
|
93
|
+
else if(action==='template'&&kind==='task')print(jobTemplate(ROOT,projectId,{kind:options.kind,core:options.core}));
|
|
94
|
+
else if(action==='from-candidate'&&kind==='task')print(await editFromCandidate(settings,projectId,required('id'),{runId:required('run'),candidateId:required('candidate')}));
|
|
95
|
+
else if(action==='list'){const records=listObjects(ROOT,projectId,kind),runs=kind==='task'?tasks(runtimeRoot(settings)).map(t=>taskStatus(runtimeRoot(settings),t.taskId)):[];print(records.map(record=>kind==='task'?{...taskObjectView(ROOT,record),display:taskDisplayState(record,runs,record.finalizations??[])}:styleView(ROOT,record)));}
|
|
96
|
+
else if(action==='create')print(await createObject(settings,projectId,kind,readJson(path(required('input')))));
|
|
97
|
+
else if(action==='read'){const record=readObject(ROOT,projectId,kind,required('id'));print(kind==='style'?styleView(ROOT,record):taskObjectView(ROOT,record));}
|
|
98
|
+
else if(action==='update'){const record=await updateObject(settings,projectId,kind,required('id'),Number(required('revision')),readJson(path(required('input'))));print(kind==='style'?styleView(ROOT,record):taskObjectView(ROOT,record));}
|
|
99
|
+
else if(action==='analyze'&&kind==='task')print(await startAnalysis(settings,projectId,required('id'),Number(required('revision')),{dry:options.dry,kind:'task',operationId:options.operation}));
|
|
100
|
+
else if(action==='derive')print(await deriveObject(settings,projectId,kind,required('id'),Number(required('revision'))));
|
|
101
|
+
else if(action==='restore'&&kind==='task')print(await restoreTask(settings,projectId,required('id'),Number(required('revision'))));
|
|
102
|
+
else if(action==='discard')print(await discardObject(settings,projectId,kind,required('id'),Number(required('revision'))));
|
|
103
|
+
else throw new Error('未知对象操作');
|
|
104
|
+
}
|
|
105
|
+
else if(module==='refs'){
|
|
106
|
+
if(action!=='guide') throw new Error('未知 refs 操作;使用 refs guide');
|
|
107
|
+
console.log(referenceGuide(effectiveRefs));
|
|
108
|
+
}
|
|
109
|
+
else if(module==='agent'){
|
|
110
|
+
if(action==='index') print({...agentIndex(undefined,ROOT),config:settings.file,paths:settings.paths});
|
|
111
|
+
else if(action==='docs') console.log(agentDocs());
|
|
112
|
+
else if(action==='export') print(exportSkill({directory:required('directory'),host:required('host'),dry:options.dry}));
|
|
113
|
+
else throw new Error('未知 agent 操作');
|
|
114
|
+
}
|
|
115
|
+
else if(module==='list'){print((existsSync(join(ROOT,'projects'))?readdirSync(join(ROOT,'projects')):[]).map(id=>readJson(join(ROOT,'projects',id,'project.json'))));}
|
|
116
|
+
else if(module==='style'&&['export','import','sources'].includes(action)){
|
|
117
|
+
const bundle=await import('./lib/style-bundle.mjs');
|
|
118
|
+
if(action==='export')print(bundle.exportStyleBundle(ROOT,required('project'),required('id'),path(required('out'))));
|
|
119
|
+
else if(action==='import')print(await bundle.importStyleBundle(settings,required('project'),path(required('file'))));
|
|
120
|
+
else print(bundle.listStyleSources(readJson(path(required('input')))));
|
|
121
|
+
}
|
|
122
|
+
else if(module==='style'){
|
|
123
|
+
const projectId=required('project');
|
|
124
|
+
if(action==='analyze')print(await startAnalysis(settings,projectId,required('id'),Number(required('revision')),{dry:options.dry,operationId:options.operation}));
|
|
125
|
+
else if(action==='recover')print(await recoverStyleAdoption(settings,projectId,required('id')));
|
|
126
|
+
else if(action==='revise')print(styleView(ROOT,await reviseStyleRules(settings,projectId,required('id'),Number(required('revision')),readJson(path(required('input'))))));
|
|
127
|
+
else if(action==='resolve')print(styleView(ROOT,await resolveStyleIssue(settings,projectId,required('id'),Number(required('revision')),readJson(path(required('input'))))));
|
|
128
|
+
else if(action==='adopt')print(await adoptStyle(settings,projectId,required('id'),Number(required('revision')),{note:options.note}));
|
|
129
|
+
else if(action==='validate') print(validateReport(readJson(path(required('report'))),projectId));
|
|
130
|
+
else if(action==='show') print(loadCore(projectId,required('core'),ROOT));
|
|
131
|
+
else throw new Error('未知 style 操作');
|
|
132
|
+
}else if(['generate','edit'].includes(module)){
|
|
133
|
+
if(action==='show') print(loadJob(required('project'),required('job'),module,ROOT));
|
|
134
|
+
else if(['plan','run'].includes(action)){
|
|
135
|
+
let plan;
|
|
136
|
+
if(options.plan){if(action!=='run'||['project','job','core','explore','backend'].some(k=>options[k]!==undefined)) throw new Error('冻结计划不能同时调整来源;修改任务后重新 plan');plan=readJson(path(options.plan));validatePlan(plan);if(plan.module!==module) throw new Error('计划模块不匹配');}
|
|
137
|
+
else {const job=loadJob(required('project'),required('job'),module,ROOT),backend=options.backend??job.generation?.backend;plan=bindBackend((module==='generate'?compileGenerate:compileEdit)({projectId:required('project'),jobId:required('job'),coreId:options.core,root:ROOT,localExecution:backendDefaults(settings,backend)}),settings,backend);}
|
|
138
|
+
if(action==='plan'){if(options.out) writeJson(path(options.out),plan);print(plan);}
|
|
139
|
+
else {
|
|
140
|
+
if(options['retry-run']&&(options.dry||options.variant||options.item||options.offset||options.limit))throw new Error('失败项重试不能混用预演或手动筛选');
|
|
141
|
+
if(options.variant&&options['all-variants'])throw new Error('不能同时选择单个候选与全部候选');
|
|
142
|
+
const variant=options.variant??(options.explore||options['all-variants']?undefined:'base');const items=selectItems(plan,{item:options.item,variant,offset:options.offset===undefined?0:Number(options.offset),limit:options.limit===undefined?undefined:Number(options.limit)});
|
|
143
|
+
if(options.dry){if(plan.backend?.provider==='comfyui')print({dry:true,remoteCalls:0,planHash:plan.planHash,requests:items.map(item=>({itemId:item.itemId,variantId:item.variantId,requests:Array.from({length:(item.execution??plan.execution).perValue},(_,index)=>buildComfyRequest(plan,item,{index}))}))});else executePlan(plan,items,{outputRoot:settings.paths.output,dry:true});}
|
|
144
|
+
else {const task=await startTask(plan,items,settings,{operationId:options.operation,retryRun:options['retry-run']??null});if(options.background)print(task);else {console.log('task → '+task.taskId);const result=await waitTask(runtimeRoot(settings),task.taskId);print(taskView(result));if(result.status!=='succeeded')process.exitCode=1;}}
|
|
145
|
+
}
|
|
146
|
+
}else throw new Error('未知模块操作');
|
|
147
|
+
}else if(module==='task'){
|
|
148
|
+
const root=runtimeRoot(settings),taskId=pos[2];
|
|
149
|
+
if(action==='list')print(tasks(root).filter(t=>!options.project||(t.plan?.project??t.project)===options.project).map(t=>taskView(taskStatus(root,t.taskId))));
|
|
150
|
+
else if(action==='recover')print(recoverTask(root,required('project'),required('operation')));
|
|
151
|
+
else if(action==='status')print(taskView(taskStatus(root,taskId)));
|
|
152
|
+
else if(action==='resume')print(await resumeTask(root,taskId));
|
|
153
|
+
else if(action==='cancel')print(taskView(await cancelTask(root,taskId)));
|
|
154
|
+
else if(action==='wait'){const timeoutSeconds=options.timeout===undefined?3600:Number(options.timeout);if(!Number.isFinite(timeoutSeconds)||timeoutSeconds<=0)throw new Error('timeout 必须为正秒数');const result=await waitTask(root,taskId,{timeoutSeconds});print(taskView(result));if(result.status!=='succeeded')process.exitCode=1;}
|
|
155
|
+
else throw new Error('未知 task 操作');
|
|
156
|
+
}else if(module==='shutdown'){if(action)throw new Error('shutdown 不接受位置参数');print(await shutdown(settings));}
|
|
157
|
+
else if(module==='candidate'){
|
|
158
|
+
const projectId=required('project');
|
|
159
|
+
if(action==='favorites')print(favoriteList(settings,projectId));
|
|
160
|
+
else if(action==='favorite'){
|
|
161
|
+
if(!['true','false'].includes(options.value))throw new Error('value 必须为 true 或 false');
|
|
162
|
+
print(await setFavorite(settings,projectId,required('job'),{runId:required('run'),candidateId:required('candidate'),value:options.value==='true'}));
|
|
163
|
+
}
|
|
164
|
+
else if(action==='list')print(candidates(settings,projectId,required('job'),required('run')));
|
|
165
|
+
else if(action==='finalize')print(await finalize(settings,projectId,required('job'),Number(required('revision')),{runId:required('run'),candidateId:required('candidate'),replace:options.replace,actor:required('actor'),name:options.name}));
|
|
166
|
+
else if(action==='delete')print(await deleteCandidate(settings,projectId,required('job'),Number(required('revision')),{runId:required('run'),candidateId:required('candidate'),confirm:options.confirm,actor:required('actor')}));
|
|
167
|
+
else if(action==='finalizations')print(finalizations(settings,projectId,required('job')));
|
|
168
|
+
else throw new Error('未知 candidate 操作');
|
|
169
|
+
}else if(module==='check'){print(checkRun(readJson(manifestPath(action??required('file'))),manifestPath(action??required('file'))));
|
|
170
|
+
}else if(module==='compare'){const read=value=>{const data=readJson(path(value));const plan=data.plan??data;validatePlan(plan);return plan;};const a=read(action),b=read(pos[2]);print({sameCore:a.sources.coreHash===b.sources.coreHash,execution:{before:a.execution,after:b.execution},items:b.items.map(x=>({itemId:x.itemId,variantId:x.variantId,changed:a.items.find(y=>y.itemId===x.itemId&&y.variantId===x.variantId)?.inputHash!==x.inputHash}))});}
|
|
171
|
+
else if(!module||module==='help') console.log(help);
|
|
172
|
+
else throw new Error('未知模块或旧入口:'+module);
|
|
173
|
+
}catch(e){print({ok:false,error:e.message,...(e.diagnostic?{diagnostic:e.diagnostic}:{})});process.exitCode=1;}
|
|
174
|
+
}
|
package/docs/commands.md
CHANGED
|
@@ -115,20 +115,19 @@ v-cli art agent docs
|
|
|
115
115
|
- 查询与预演不创建参考目录
|
|
116
116
|
- 无网络调用
|
|
117
117
|
|
|
118
|
-
### agent
|
|
118
|
+
### agent export
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
显式导出技能到指定宿主目录;默认安装不导出
|
|
121
121
|
|
|
122
122
|
```sh
|
|
123
|
-
v-cli art agent
|
|
123
|
+
v-cli art agent export --host codex --directory <DIR> [--dry]
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
- `--
|
|
127
|
-
- `--
|
|
126
|
+
- `--host <HOST>`:目标宿主 codex 或 claude
|
|
127
|
+
- `--directory <DIR>`:明确指定导出目录
|
|
128
|
+
- `--dry`:仅预演
|
|
128
129
|
|
|
129
|
-
-
|
|
130
|
-
- 无网络调用
|
|
131
|
-
- 覆盖同名随包 skill 和 runtime.json,保留扩展文件
|
|
130
|
+
- 仅显式请求时导出,不扫描用户目录,不生成安装绝对路径回执
|
|
132
131
|
|
|
133
132
|
### list
|
|
134
133
|
|
|
@@ -1061,6 +1060,115 @@ v-cli art style sources
|
|
|
1061
1060
|
|
|
1062
1061
|
- 冻结风格包只读;不覆盖已有文件;修改请派生草稿;只导出明确引用的参考图片
|
|
1063
1062
|
|
|
1063
|
+
### conversation start
|
|
1064
|
+
|
|
1065
|
+
编译并幂等提交会话出图,不创建项目任务
|
|
1066
|
+
|
|
1067
|
+
```sh
|
|
1068
|
+
v-cli art conversation start --config <path> --input <path>
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
- `--config <path>`:隔离配置路径
|
|
1072
|
+
- `--input <path>`:结构化会话请求 JSON
|
|
1073
|
+
|
|
1074
|
+
- bounded
|
|
1075
|
+
- idempotent
|
|
1076
|
+
- no-job-create
|
|
1077
|
+
|
|
1078
|
+
### conversation status
|
|
1079
|
+
|
|
1080
|
+
查询原运行与真实产物
|
|
1081
|
+
|
|
1082
|
+
```sh
|
|
1083
|
+
v-cli art conversation status --config <path> --session <id> --request <id>
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
- `--config <path>`:隔离配置路径
|
|
1087
|
+
- `--session <id>`:会话身份
|
|
1088
|
+
- `--request <id>`:原请求身份
|
|
1089
|
+
|
|
1090
|
+
- bounded
|
|
1091
|
+
- idempotent
|
|
1092
|
+
- no-job-create
|
|
1093
|
+
|
|
1094
|
+
### conversation cancel
|
|
1095
|
+
|
|
1096
|
+
取消原运行
|
|
1097
|
+
|
|
1098
|
+
```sh
|
|
1099
|
+
v-cli art conversation cancel --config <path> --session <id> --request <id>
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
- `--config <path>`:隔离配置路径
|
|
1103
|
+
- `--session <id>`:会话身份
|
|
1104
|
+
- `--request <id>`:原请求身份
|
|
1105
|
+
|
|
1106
|
+
- bounded
|
|
1107
|
+
- idempotent
|
|
1108
|
+
- no-job-create
|
|
1109
|
+
|
|
1110
|
+
### conversation resume
|
|
1111
|
+
|
|
1112
|
+
仅恢复原上游身份,不重新提交
|
|
1113
|
+
|
|
1114
|
+
```sh
|
|
1115
|
+
v-cli art conversation resume --config <path> --session <id> --request <id>
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
- `--config <path>`:隔离配置路径
|
|
1119
|
+
- `--session <id>`:会话身份
|
|
1120
|
+
- `--request <id>`:原请求身份
|
|
1121
|
+
|
|
1122
|
+
- bounded
|
|
1123
|
+
- idempotent
|
|
1124
|
+
- no-job-create
|
|
1125
|
+
|
|
1126
|
+
### conversation close
|
|
1127
|
+
|
|
1128
|
+
宿主退出时停止本请求的worker,保留外部共享服务
|
|
1129
|
+
|
|
1130
|
+
```sh
|
|
1131
|
+
v-cli art conversation close --config <path> --session <id> --request <id>
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
- `--config <path>`:隔离配置路径
|
|
1135
|
+
- `--session <id>`:会话身份
|
|
1136
|
+
- `--request <id>`:原请求身份
|
|
1137
|
+
|
|
1138
|
+
- bounded
|
|
1139
|
+
- idempotent
|
|
1140
|
+
- no-job-create
|
|
1141
|
+
|
|
1142
|
+
### style migration-complete
|
|
1143
|
+
|
|
1144
|
+
校验当前迁移草稿并完成配置迁移;input 为 {note},不分析、不生成或定版
|
|
1145
|
+
|
|
1146
|
+
```sh
|
|
1147
|
+
v-cli art style migration-complete
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
- `--project <id>`:工程身份
|
|
1151
|
+
- `--id <id>`:对象身份
|
|
1152
|
+
- `--revision <number>`:预期对象版本
|
|
1153
|
+
- `--input <file>`:JSON {rules,summary,note};rules 为完整规则数组,每条 id/scope/strength/instruction/when,avoid 可含 negative 抽象排除表达数组
|
|
1154
|
+
|
|
1155
|
+
- 查询不写入;修改验证 revision、归属和停止确认;冻结风格只读
|
|
1156
|
+
|
|
1157
|
+
### job migration-complete
|
|
1158
|
+
|
|
1159
|
+
校验当前迁移草稿并完成配置迁移;input 为 {note},不分析、不生成或定版
|
|
1160
|
+
|
|
1161
|
+
```sh
|
|
1162
|
+
v-cli art job migration-complete
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
- `--project <id>`:工程身份
|
|
1166
|
+
- `--id <id>`:对象身份
|
|
1167
|
+
- `--revision <number>`:预期对象版本
|
|
1168
|
+
- `--input <file>`:JSON {rules,summary,note};rules 为完整规则数组,每条 id/scope/strength/instruction/when,avoid 可含 negative 抽象排除表达数组
|
|
1169
|
+
|
|
1170
|
+
- 查询不写入;修改验证 revision、归属和停止确认;冻结风格只读
|
|
1171
|
+
|
|
1064
1172
|
## 结果验证
|
|
1065
1173
|
|
|
1066
1174
|
按任务身份、停止证据和实际产物核验;只读检查不证明真实出图。
|