@kevlns/v-cli 0.6.4 → 0.7.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/README.md CHANGED
@@ -47,7 +47,7 @@ v-cli capability run unity.doctor --project . --json
47
47
  v-cli capability run unity.test-start --project . --set mode=EditMode --json
48
48
  ```
49
49
 
50
- project init 写入工程 `.vant/config/v-cli.json`,只保存 schemaVersion 和 provider bindings。已有配置只补缺失且有默认值的段,不覆盖已有值;显式 --binding 指向已有段时拒绝并提示 --reset。--reset 先备份再替换;--dry-run 不写配置或备份。art 需要显式 workspace/output/cache/projectId 绑定,不能猜当前工程 ID。
50
+ project init 写入工程 `.vant/config/v-cli.json`,只保存 schemaVersion 和 provider bindings。已有配置只补缺失且有默认值的段,不覆盖已有值;显式 --binding 指向已有段时拒绝并提示 --reset。--reset 先备份再替换;--dry-run 不写配置或备份。art 图片通道需要显式 workspace/output/cache/projectId 绑定,不能猜当前图片工程 ID;视频通道以当前工程根目录保存独立配置与任务。
51
51
 
52
52
  Vant 的角色、workflow 和项目组织属于 `.vant/config/project.json`,v-cli 不读取或写入。绑定路径限定工程内,拒绝穿越和链接越界;具体字段见 capability describe 的 provider.binding。
53
53
 
@@ -78,12 +78,14 @@ query.json 应包含完整的 handle 字段;不要手工伪造。每次查询
78
78
 
79
79
  ### 美术工坊
80
80
 
81
- 先读取 `v-cli agent docs art`。art 工具拥有工程风格/任务、模型登记、生成策略、后台运行、停止证据及候选定版;v-cli art provider 负责结构化路由和句柄关联,不维护第二份型号目录。
81
+ 先读取 `v-cli agent docs art`。同一 art 工具提供 `image` 与 `video` 两个独立二级通道:图片负责风格、图片任务、生成编辑与定版;视频负责剧本、镜头、生成、成片与精修。v-cli art provider 负责结构化路由和执行证据,不维护第二份图片或视频业务实现。
82
+
83
+ 图片使用 `v-cli art image ...` 与 `art.image-*` 能力,原有图片命令和 `art.*` 能力保留兼容。视频使用 `v-cli art video ...` 与 `art.video-*` 能力,请求内容通过工程内 JSON 文件传入;视频模型配置与数据分别归 `.vant/config/video.json`、`.vant/video`。写动作保留稳定操作身份和未知结果屏障,不能通过换通道或新 ID 重投相同未决请求。视频需要带该通道的 art-workshop 包及 Node.js 22.13 以上运行时。
82
84
 
83
85
  ```sh
84
- v-cli art config show
85
- v-cli art agent index
86
- v-cli art config validate
86
+ v-cli art image config show
87
+ v-cli art image agent index
88
+ v-cli art image config validate
87
89
  v-cli capability list --provider art --json
88
90
  v-cli capability describe art.run-status --json
89
91
  v-cli capability describe art.run-resume --json
package/dist/cli.mjs CHANGED
@@ -345,7 +345,7 @@ var OFFICIAL_PLUGINS = [
345
345
  command: "ship",
346
346
  description: "\u5DF2\u6784\u5EFA\u6E38\u620F\u7684 Steam/\u5FAE\u4FE1\u5C0F\u6E38\u620F\u6821\u9A8C\u3001\u9884\u6F14\u548C\u6D4B\u8BD5\u901A\u9053\u4E0A\u4F20"
347
347
  },
348
- { package: "@kevlns/art-workshop", command: "art", description: "\u7F8E\u672F\u5DE5\u574A\uFF1A\u98CE\u683C\u5206\u6790\u4E0E\u51BB\u7ED3\u3001\u8FDC\u7A0B\u6216\u672C\u5730 ComfyUI \u751F\u56FE\u53CA\u7F16\u8F91\u3001\u73AF\u5883\u68C0\u67E5\u4E0E\u4EFB\u52A1\u7BA1\u7406" }
348
+ { package: "@kevlns/art-workshop", command: "art", description: "\u7F8E\u672F\u5DE5\u574A\uFF1Aimage \u56FE\u7247\u4E0E video \u89C6\u9891\u72EC\u7ACB\u901A\u9053\uFF0C\u6DB5\u76D6\u98CE\u683C\u3001\u751F\u56FE\u7F16\u8F91\u3001\u5267\u672C\u955C\u5934\u3001\u6210\u7247\u7CBE\u4FEE\u548C\u8FD0\u884C\u7BA1\u7406" }
349
349
  ];
350
350
  var OFFICIAL_COMMAND_NAMES = new Set(
351
351
  OFFICIAL_PLUGINS.map((p) => p.command)
@@ -761,7 +761,7 @@ function exportToolSkill(command, options) {
761
761
  }
762
762
 
763
763
  // src/version.ts
764
- var VERSION = "0.6.4";
764
+ var VERSION = "0.7.1";
765
765
 
766
766
  // src/commands/agent.ts
767
767
  function buildAgentIndex(builtin, local, official) {
@@ -1085,8 +1085,14 @@ var PathSafetyError = class extends Error {
1085
1085
  function isPlainAbsolute(input) {
1086
1086
  return path5.isAbsolute(input) || /^[A-Za-z]:/.test(input) || input.startsWith("\\\\") || input.startsWith("//");
1087
1087
  }
1088
- function resolveProjectRoot(input, cwd = process.cwd()) {
1088
+ function resolveProjectRoot(input, cwd = process.cwd(), options = {}) {
1089
1089
  const root2 = path5.resolve(cwd, input ?? ".");
1090
+ const { realRoot } = resolveRootDirectory(root2);
1091
+ const storageRoot = path5.resolve(cwd, options.storageRoot ?? root2);
1092
+ const { realRoot: realStorageRoot } = resolveRootDirectory(storageRoot);
1093
+ return { root: root2, realRoot, storageRoot, realStorageRoot };
1094
+ }
1095
+ function resolveRootDirectory(root2) {
1090
1096
  let stat;
1091
1097
  try {
1092
1098
  stat = fs4.statSync(root2);
@@ -1105,7 +1111,7 @@ function resolveProjectRoot(input, cwd = process.cwd()) {
1105
1111
  `\u5DE5\u7A0B\u6839\u65E0\u6CD5\u89E3\u6790 realpath: ${err instanceof Error ? err.message : String(err)}`
1106
1112
  );
1107
1113
  }
1108
- return { root: root2, realRoot };
1114
+ return { realRoot };
1109
1115
  }
1110
1116
  function splitSafeRelative(relative, label) {
1111
1117
  if (typeof relative !== "string" || relative.length === 0) {
@@ -1147,8 +1153,12 @@ function resolveInsideProject(project2, relative, label) {
1147
1153
  return { path: project2.root, realPath: project2.realRoot };
1148
1154
  }
1149
1155
  const segments = splitSafeRelative(relative, label);
1150
- const target = path5.join(project2.root, ...segments);
1151
- const existingAncestor = deepestExisting(target, project2.realRoot);
1156
+ const owned = segments.map((segment) => process.platform === "win32" ? segment.toLowerCase() : segment);
1157
+ const storage = owned[0] === ".vant" && owned[1] !== "rules" && !(owned.length === 2 && owned[1] === "rules.md");
1158
+ const root2 = storage ? project2.storageRoot : project2.root;
1159
+ const realRoot = storage ? project2.realStorageRoot : project2.realRoot;
1160
+ const target = path5.join(root2, ...segments);
1161
+ const existingAncestor = deepestExisting(target, realRoot);
1152
1162
  let ancestorReal;
1153
1163
  try {
1154
1164
  ancestorReal = fs4.realpathSync.native(existingAncestor);
@@ -1158,7 +1168,7 @@ function resolveInsideProject(project2, relative, label) {
1158
1168
  `${label} \u65E0\u6CD5\u89E3\u6790 realpath: ${err instanceof Error ? err.message : String(err)}`
1159
1169
  );
1160
1170
  }
1161
- if (!isInside(project2.realRoot, ancestorReal)) {
1171
+ if (!isInside(realRoot, ancestorReal)) {
1162
1172
  throw new PathSafetyError(
1163
1173
  "path-escape",
1164
1174
  `${label} \u89E3\u6790\u540E\u9003\u9038\u5DE5\u7A0B\u6839\uFF08${relative} \u2192 ${ancestorReal}\uFF09`
@@ -1171,7 +1181,7 @@ function resolveInsideProject(project2, relative, label) {
1171
1181
  throw new PathSafetyError("path-symlink", `${label} \u662F\u7B26\u53F7\u94FE\u63A5/\u8054\u63A5\uFF0C\u62D2\u7EDD\u5199\u5165\u6216\u8DDF\u968F: ${target}`);
1172
1182
  }
1173
1183
  realPath = fs4.realpathSync.native(target);
1174
- if (!isInside(project2.realRoot, realPath)) {
1184
+ if (!isInside(realRoot, realPath)) {
1175
1185
  throw new PathSafetyError("path-escape", `${label} \u7684\u771F\u5B9E\u8DEF\u5F84\u9003\u9038\u5DE5\u7A0B\u6839: ${realPath}`);
1176
1186
  }
1177
1187
  }
@@ -1726,7 +1736,7 @@ function resolveBindings(project2, config, providers) {
1726
1736
  return { ok: true, bindings: result4 };
1727
1737
  }
1728
1738
  function loadProjectConfig(project2, providers) {
1729
- const file2 = path7.join(project2.root, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1739
+ const file2 = path7.join(project2.storageRoot, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1730
1740
  const initHint = `\u8BF7\u5148\u5728\u5DE5\u7A0B\u6839\u8FD0\u884C \`v-cli project init --project <\u5DE5\u7A0B\u6839>\` \u751F\u6210 ${PROJECT_CLI_CONFIG_RELATIVE}`;
1731
1741
  let text5;
1732
1742
  try {
@@ -1826,8 +1836,8 @@ function atomicWriteConfig(project2, file2, content) {
1826
1836
  }
1827
1837
  }
1828
1838
  function initProjectConfig(project2, providers, overrides = {}, options = {}) {
1829
- const file2 = path7.join(project2.root, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1830
- const vantFile = path7.join(project2.root, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1839
+ const file2 = path7.join(project2.storageRoot, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1840
+ const vantFile = path7.join(project2.storageRoot, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1831
1841
  const vantConfig = { file: vantFile, exists: fs6.existsSync(vantFile) };
1832
1842
  const refused = (reason) => ({
1833
1843
  ok: false,
@@ -1951,7 +1961,7 @@ function initProjectConfig(project2, providers, overrides = {}, options = {}) {
1951
1961
  }
1952
1962
  let backupPath;
1953
1963
  if (reset && exists && !dryRun) {
1954
- const backupDir = path7.join(project2.root, ...CONFIG_BACKUP_RELATIVE.split("/"));
1964
+ const backupDir = path7.join(project2.storageRoot, ...CONFIG_BACKUP_RELATIVE.split("/"));
1955
1965
  resolveInsideProject(project2, CONFIG_BACKUP_RELATIVE, CONFIG_BACKUP_RELATIVE);
1956
1966
  fs6.mkdirSync(backupDir, { recursive: true });
1957
1967
  const stamp = `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}-${process.pid.toString(36)}`;
@@ -1962,7 +1972,7 @@ function initProjectConfig(project2, providers, overrides = {}, options = {}) {
1962
1972
  if (exists) {
1963
1973
  atomicWriteConfig(project2, file2, rendered.content);
1964
1974
  } else {
1965
- const configDir = path7.join(project2.root, ".vant", "config");
1975
+ const configDir = path7.join(project2.storageRoot, ".vant", "config");
1966
1976
  resolveInsideProject(project2, ".vant/config", ".vant/config");
1967
1977
  fs6.mkdirSync(configDir, { recursive: true });
1968
1978
  fs6.writeFileSync(file2, rendered.content, { encoding: "utf-8", flag: "wx" });
@@ -2067,7 +2077,7 @@ function inspectProject(project2, providers) {
2067
2077
  });
2068
2078
  }
2069
2079
  }
2070
- const vantDir = path7.join(project2.root, ".vant");
2080
+ const vantDir = path7.join(project2.storageRoot, ".vant");
2071
2081
  let configFiles = [];
2072
2082
  const configDir = path7.join(vantDir, "config");
2073
2083
  if (fs6.existsSync(configDir)) {
@@ -2077,7 +2087,7 @@ function inspectProject(project2, providers) {
2077
2087
  configFiles = [];
2078
2088
  }
2079
2089
  }
2080
- const stateDir = path7.join(project2.root, ...OPERATIONS_RELATIVE.split("/"));
2090
+ const stateDir = path7.join(project2.storageRoot, ...OPERATIONS_RELATIVE.split("/"));
2081
2091
  let operationCount = 0;
2082
2092
  if (fs6.existsSync(stateDir)) {
2083
2093
  try {
@@ -2086,7 +2096,7 @@ function inspectProject(project2, providers) {
2086
2096
  operationCount = 0;
2087
2097
  }
2088
2098
  }
2089
- const vantFile = path7.join(project2.root, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
2099
+ const vantFile = path7.join(project2.storageRoot, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
2090
2100
  let bindingsValue = {};
2091
2101
  if (loaded.ok) bindingsValue = loaded.config.bindings;
2092
2102
  return {
@@ -2331,7 +2341,12 @@ function buildExecutionHandle(input) {
2331
2341
  capabilityId: input.capabilityId,
2332
2342
  originOperationId: input.operationId,
2333
2343
  backendTaskId: input.seed.backendTaskId,
2334
- project: { root: input.project.realRoot, configFile: input.configFile },
2344
+ project: {
2345
+ root: input.project.realRoot,
2346
+ codeRoot: input.project.realRoot,
2347
+ storageRoot: input.project.realStorageRoot,
2348
+ configFile: input.configFile
2349
+ },
2335
2350
  startedAt: input.startedAt,
2336
2351
  recoverable: input.persisted,
2337
2352
  recordDir: `${OPERATIONS_RELATIVE}/${input.operationId}`
@@ -2382,6 +2397,8 @@ function verifyExecutionHandle(input) {
2382
2397
  if (!isPlainObject6(handle.project) || typeof handle.project.root !== "string" || typeof handle.project.configFile !== "string") {
2383
2398
  return fail("handle-invalid", ["\u53E5\u67C4 project.root/configFile \u5FC5\u987B\u662F\u5B57\u7B26\u4E32"]);
2384
2399
  }
2400
+ if (Object.keys(handle.project).some((key) => !["root", "configFile", "codeRoot", "storageRoot"].includes(key)) || handle.project.codeRoot === void 0 !== (handle.project.storageRoot === void 0) || handle.project.codeRoot !== void 0 && (typeof handle.project.codeRoot !== "string" || !handle.project.codeRoot || typeof handle.project.storageRoot !== "string" || !handle.project.storageRoot || comparePathForm(handle.project.codeRoot) !== comparePathForm(handle.project.root)))
2401
+ return fail("handle-invalid", ["\u53E5\u67C4\u4EE3\u7801\u6839\u548C\u5B58\u50A8\u6839\u5FC5\u987B\u5B8C\u6574\u4E14\u4E0E\u539F\u542F\u52A8\u8EAB\u4EFD\u4E00\u81F4"]);
2385
2402
  if (!isPlainObject6(handle.integrity) || handle.integrity.algo !== "sha256" || typeof handle.integrity.digest !== "string") {
2386
2403
  return fail("handle-invalid", ["\u53E5\u67C4 integrity \u7F3A\u5931\u6216\u975E\u6CD5"]);
2387
2404
  }
@@ -2399,9 +2416,10 @@ function verifyExecutionHandle(input) {
2399
2416
  `\u53E5\u67C4\u7684\u89E6\u53D1\u80FD\u529B\u4E3A "${handle.capabilityId}"\uFF0C\u671F\u671B "${input.expectCapabilityId}"`
2400
2417
  ]);
2401
2418
  }
2402
- if (comparePathForm(handle.project.root) !== comparePathForm(project2.realRoot)) {
2419
+ const handleStorageRoot = String(handle.project.storageRoot ?? handle.project.root);
2420
+ if (comparePathForm(handleStorageRoot) !== comparePathForm(project2.realStorageRoot)) {
2403
2421
  return fail("handle-project-mismatch", [
2404
- `\u53E5\u67C4\u5DE5\u7A0B ${handle.project.root} \u4E0E\u5F53\u524D\u5DE5\u7A0B ${project2.realRoot} \u4E0D\u4E00\u81F4\uFF1A\u62D2\u7EDD\u6267\u884C`
2422
+ `\u53E5\u67C4\u5B58\u50A8 ${handleStorageRoot} \u4E0E\u5F53\u524D\u5B58\u50A8 ${project2.realStorageRoot} \u4E0D\u4E00\u81F4\uFF1A\u62D2\u7EDD\u6267\u884C`
2405
2423
  ]);
2406
2424
  }
2407
2425
  if (handle.recoverable !== true) {
@@ -2460,7 +2478,10 @@ function verifyExecutionHandle(input) {
2460
2478
  if (recordProject !== void 0 && comparePathForm(String(recordProject.root ?? "")) !== comparePathForm(handle.project.root)) {
2461
2479
  mismatches.push("project.root \u4E0E\u8BB0\u5F55\u4E0D\u4E00\u81F4");
2462
2480
  } else if (recordProject !== void 0) checks.push("project.root");
2481
+ if (recordProject !== void 0 && (comparePathForm(String(recordProject.storageRoot ?? recordProject.root ?? "")) !== comparePathForm(handleStorageRoot) || comparePathForm(String(recordProject.codeRoot ?? recordProject.root ?? "")) !== comparePathForm(String(handle.project.codeRoot ?? handle.project.root)) || comparePathForm(String(recordProject.configFile ?? "")) !== comparePathForm(handle.project.configFile)))
2482
+ mismatches.push("project.codeRoot/storageRoot/configFile \u4E0E\u8BB0\u5F55\u4E0D\u4E00\u81F4");
2463
2483
  if (recordHandle !== void 0) {
2484
+ if (canonicalize(recordHandle.project) !== canonicalize(handle.project)) mismatches.push("handle.project \u4E0E\u539F\u53E5\u67C4\u4E0D\u4E00\u81F4");
2464
2485
  if (recordHandle.backendTaskId !== handle.backendTaskId) {
2465
2486
  mismatches.push(
2466
2487
  `backendTaskId: \u8BB0\u5F55 ${JSON.stringify(recordHandle.backendTaskId)} \u2260 \u53E5\u67C4 ${JSON.stringify(handle.backendTaskId)}\uFF08\u5173\u8054\u5DF2\u5931\u6548\u6216\u88AB\u5176\u4ED6\u4EFB\u52A1\u66FF\u4EE3\uFF09`
@@ -2491,7 +2512,8 @@ function verifyExecutionHandle(input) {
2491
2512
  execution: recordExecution !== null && typeof recordExecution.status === "string" && typeof recordExecution.lifecycle === "string" ? { status: recordExecution.status, lifecycle: recordExecution.lifecycle } : null,
2492
2513
  acceptance: recordAcceptance !== null && typeof recordAcceptance.status === "string" ? { status: recordAcceptance.status, pending: recordAcceptance.pending === true } : null
2493
2514
  },
2494
- checks
2515
+ checks,
2516
+ originProject: { ...handle.project }
2495
2517
  };
2496
2518
  }
2497
2519
 
@@ -2672,6 +2694,8 @@ function buildResult(input) {
2672
2694
  },
2673
2695
  project: {
2674
2696
  root: input.project.realRoot,
2697
+ codeRoot: input.project.realRoot,
2698
+ storageRoot: input.project.realStorageRoot,
2675
2699
  configFile: input.configFile,
2676
2700
  bindingDirs: input.bindingDirs
2677
2701
  },
@@ -2718,7 +2742,7 @@ async function runCapability(registry, request, deps = {}) {
2718
2742
  }
2719
2743
  let project2;
2720
2744
  try {
2721
- project2 = resolveProjectRoot(request.projectRoot, request.cwd ?? process.cwd());
2745
+ project2 = resolveProjectRoot(request.projectRoot, request.cwd ?? process.cwd(), { storageRoot: request.storageRoot });
2722
2746
  } catch (err) {
2723
2747
  if (err instanceof PathSafetyError) {
2724
2748
  throw new CapabilityError(structuredError(err.code, "request", err.message));
@@ -2760,7 +2784,7 @@ async function runCapability(registry, request, deps = {}) {
2760
2784
  schemaVersion: 1,
2761
2785
  operationId,
2762
2786
  capability: { id: entry.descriptor.id, version: entry.descriptor.version },
2763
- project: { root: project2.realRoot, configFile: loadedConfig.file },
2787
+ project: { root: project2.realRoot, codeRoot: project2.realRoot, storageRoot: project2.realStorageRoot, configFile: loadedConfig.file },
2764
2788
  taskId: request.taskId ?? null,
2765
2789
  runId: request.runId ?? null,
2766
2790
  recordedAt: startedAt.toISOString(),
@@ -2969,11 +2993,16 @@ async function runCapability(registry, request, deps = {}) {
2969
2993
  }
2970
2994
  let releaseResources;
2971
2995
  try {
2972
- releaseResources = await acquireResources(project2.realRoot, entry.descriptor.resources, Object.values(providerBindingDirs), {
2973
- waitForLocal: true,
2974
- signal,
2975
- timeoutMs: entry.descriptor.timeoutMs
2976
- });
2996
+ releaseResources = await acquireResources(
2997
+ project2.realRoot,
2998
+ entry.descriptor.resources,
2999
+ [...Object.values(providerBindingDirs), resolveInsideProject(project2, ".vant", "\u5DE5\u7A0B\u6570\u636E").path],
3000
+ {
3001
+ waitForLocal: true,
3002
+ signal,
3003
+ timeoutMs: entry.descriptor.timeoutMs
3004
+ }
3005
+ );
2977
3006
  store.event("resources-acquired", "\u5DF2\u53D6\u5F97\u8DE8\u8FDB\u7A0B\u8D44\u6E90\u79DF\u7EA6");
2978
3007
  } catch (error) {
2979
3008
  if (signal.aborted) return cancelledBeforeExecution();
@@ -6844,18 +6873,10 @@ var definitions3 = [
6844
6873
  { id: "agent-docs", command: ["agent", "docs"], fields: {}, readonly: true, text: true, global: true },
6845
6874
  { id: "agent-init", command: ["agent", "init"], fields: { directory: file, dry: { type: "boolean" } }, required: ["directory"], global: true },
6846
6875
  { id: "agent-export", command: ["agent", "export"], fields: { directory: file, host: { type: "string", enum: ["codex", "claude"] }, dry: { type: "boolean" } }, required: ["directory", "host"], global: true },
6847
- ...["start", "status", "cancel", "resume", "close"].map((action) => ({
6848
- id: "conversation-" + action,
6849
- command: ["conversation", action],
6850
- global: true,
6851
- fields: action === "start" ? { input: file } : { session: identifier, request: identifier },
6852
- required: action === "start" ? ["input"] : ["session", "request"],
6853
- readonly: action === "status",
6854
- network: action !== "status"
6855
- })),
6876
+ { id: "conversation-start", command: ["conversation", "start"], fields: { input: file }, required: ["input"], network: true, global: true },
6877
+ ...["status", "cancel", "resume", "close"].map((action) => ({ id: "conversation-" + action, command: ["conversation", action], fields: { session: { type: "string", minLength: 1 }, request: { type: "string", minLength: 1 } }, required: ["session", "request"], readonly: action === "status", network: action !== "status", global: true })),
6856
6878
  ...["style", "job"].map((kind) => ({ id: kind + "-migration-complete", command: [kind, "migration-complete"], fields: objectFields, required: ["id", "revision", "input"] })),
6857
6879
  { id: "list", command: ["list"], fields: {}, readonly: true, global: true },
6858
- { id: "style-validate", command: ["style", "validate"], fields: { report: file }, required: ["report"], readonly: true },
6859
6880
  { id: "style-show", command: ["style", "show"], fields: { core: identifier }, required: ["core"], readonly: true },
6860
6881
  ...["generate", "edit"].map((kind) => ({ id: kind + "-show", command: [kind, "show"], fields: { job: identifier }, required: ["job"], readonly: true })),
6861
6882
  { id: "check", command: ["check"], fields: { run: file }, required: ["run"], positional: ["run"], readonly: true, global: true },
@@ -6896,13 +6917,6 @@ var definitions3 = [
6896
6917
  fields: { input: file },
6897
6918
  required: ["input"]
6898
6919
  },
6899
- {
6900
- id: "style-analyze",
6901
- command: ["style", "analyze"],
6902
- fields: { id: identifier, revision, dry: { type: "boolean" } },
6903
- required: ["id", "revision"],
6904
- start: true
6905
- },
6906
6920
  {
6907
6921
  id: "job-analyze",
6908
6922
  command: ["job", "analyze"],
@@ -6913,14 +6927,9 @@ var definitions3 = [
6913
6927
  { id: "style-export", command: ["style", "export"], fields: { id: identifier, out: file }, required: ["id", "out"] },
6914
6928
  { id: "style-import", command: ["style", "import"], fields: { file }, required: ["file"] },
6915
6929
  { id: "style-sources", command: ["style", "sources"], fields: { input: file }, required: ["input"], readonly: true, global: true },
6916
- { id: "style-revise", command: ["style", "revise"], fields: objectFields, required: ["id", "revision", "input"] },
6917
- { id: "style-resolve", command: ["style", "resolve"], fields: objectFields, required: ["id", "revision", "input"] },
6918
- {
6919
- id: "style-adopt",
6920
- command: ["style", "adopt"],
6921
- fields: { id: identifier, revision, note: { type: "string" } },
6922
- required: ["id", "revision"]
6923
- },
6930
+ { id: "style-sample-job", command: ["style", "sample-job"], fields: { id: identifier, revision, name: { type: "string", minLength: 1 }, count: { type: "integer", minimum: 1, maximum: 4 } }, required: ["id", "revision"] },
6931
+ { id: "style-sample-select", command: ["style", "sample-select"], fields: { id: identifier, revision, job: identifier, run: identifier, candidate: { type: "string", pattern: "^[a-f0-9]{64}$" }, note: { type: "string", maxLength: 2e3 } }, required: ["id", "revision", "job", "run", "candidate"] },
6932
+ { id: "style-sample-remove", command: ["style", "sample-remove"], fields: { id: identifier, revision, sample: identifier }, required: ["id", "revision", "sample"] },
6924
6933
  {
6925
6934
  id: "style-recover",
6926
6935
  command: ["style", "recover"],
@@ -7027,13 +7036,73 @@ var definitions3 = [
7027
7036
  { id: "candidate-favorites", command: ["candidate", "favorites"], fields: {}, readonly: true },
7028
7037
  { id: "candidate-favorite", command: ["candidate", "favorite"], fields: { job: identifier, run: identifier, candidate: { type: "string", pattern: "^[a-f0-9]{64}$" }, value: { type: "string", enum: ["true", "false"] } }, required: ["job", "run", "candidate", "value"] }
7029
7038
  ];
7039
+ var imageDefinitions = definitions3.map((definition) => ({
7040
+ ...definition,
7041
+ channel: "image",
7042
+ command: ["image", ...definition.command]
7043
+ }));
7044
+ var videoActions = [
7045
+ "describe",
7046
+ "snapshot",
7047
+ "settings.get",
7048
+ "settings.save",
7049
+ "settings.presets.h3",
7050
+ "runtime.status",
7051
+ "runtime.start",
7052
+ "runtime.stop",
7053
+ "task.list",
7054
+ "task.read",
7055
+ "task.create",
7056
+ "task.rename",
7057
+ "task.archive",
7058
+ "operation.create",
7059
+ "operation.update",
7060
+ "operation.rename",
7061
+ "operation.derive",
7062
+ "operation.validate",
7063
+ "operation.run",
7064
+ "operation.resume",
7065
+ "operation.cancel",
7066
+ "operation.accept",
7067
+ "operation.bind",
7068
+ "script.read",
7069
+ "script.update",
7070
+ "script.plan",
7071
+ "script.apply",
7072
+ "film.compose",
7073
+ "film.refine",
7074
+ "film.preview",
7075
+ "film.adopt",
7076
+ "film.undo",
7077
+ "material.list",
7078
+ "material.import",
7079
+ "material.import-file",
7080
+ "material.upload",
7081
+ "material.hide",
7082
+ "image",
7083
+ "media.status",
7084
+ "execution.status"
7085
+ ];
7086
+ var videoReads = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "task.list", "task.read", "operation.validate", "script.read", "script.plan", "material.list", "image", "media.status", "execution.status"]);
7087
+ var videoNoInput = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "runtime.start", "runtime.stop", "task.list", "material.list", "media.status"]);
7088
+ var videoNetwork = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.save", "runtime.status", "runtime.start", "runtime.stop", "operation.create", "operation.update", "operation.derive", "operation.validate", "operation.run", "operation.resume", "operation.cancel", "script.plan", "script.apply", "film.refine"]);
7089
+ var videoDefinitions = videoActions.map((action) => ({
7090
+ id: "video-" + action.replaceAll(".", "-"),
7091
+ channel: "video",
7092
+ command: ["video", ...action.split(".")],
7093
+ fields: action === "execution.status" ? { operation: { type: "string", pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" } } : { input: file },
7094
+ required: action === "execution.status" ? ["operation"] : videoNoInput.has(action) ? [] : ["input"],
7095
+ readonly: videoReads.has(action),
7096
+ network: videoNetwork.has(action),
7097
+ global: true
7098
+ }));
7030
7099
  function createArtProvider(deps) {
7031
7100
  const discover = deps.discoverBackend ?? (() => discoverOfficialPlugin(
7032
7101
  OFFICIAL_PLUGINS.find((s) => s.command === "art")
7033
7102
  ));
7034
- const registrations = definitions3.map((d) => ({
7103
+ const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions].map((d) => ({
7035
7104
  descriptor: {
7036
- id: "art." + d.id,
7105
+ id: "art." + (d.channel === "image" ? "image-" : "") + d.id,
7037
7106
  commands: [d.command],
7038
7107
  version: "0.1.0",
7039
7108
  description: "\u7F8E\u672F\u5DE5\u574A " + d.command.join(" ") + "\uFF1B\u5BF9\u8C61\u7248\u672C\u4E0E\u505C\u6B62\u8BC1\u636E\u7531\u5DE5\u5177\u6838\u9A8C",
@@ -7094,11 +7163,14 @@ function createArtProvider(deps) {
7094
7163
  strategy: "none",
7095
7164
  description: "\u542F\u52A8\u4E0D\u81EA\u52A8\u91CD\u8BD5\uFF1B\u6062\u590D\u67E5\u8BE2\u539F\u53E5\u67C4"
7096
7165
  },
7097
- timeoutMs: d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
7098
- tags: ["art", "lifecycle"]
7166
+ timeoutMs: d.channel === "video" ? 15 * 60 * 1e3 : d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
7167
+ tags: ["art", d.channel || "image", "lifecycle"]
7099
7168
  },
7100
7169
  implementation: {
7101
7170
  execute: async (input, ctx) => {
7171
+ const businessCommand = d.channel === "image" ? d.command.slice(1) : d.command;
7172
+ const videoAction = d.channel === "video" ? d.command.slice(1).join(".") : null;
7173
+ let videoInput = {};
7102
7174
  const backend = discover();
7103
7175
  const fail = (code, message) => ({
7104
7176
  execution: {
@@ -7118,9 +7190,15 @@ function createArtProvider(deps) {
7118
7190
  if (d.start && input.plan) {
7119
7191
  const file2 = resolveInsideProject(ctx.projectAnchor, String(input.plan), "art.plan").path;
7120
7192
  const plan = JSON.parse(readFileSync(file2, "utf8"));
7121
- if (plan.project !== ctx.binding.projectId || plan.module !== d.command[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
7193
+ if (plan.project !== ctx.binding.projectId || plan.module !== businessCommand[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
7122
7194
  }
7123
- const argv = [
7195
+ const argv = d.channel === "video" ? [
7196
+ ...d.command,
7197
+ "--workspace",
7198
+ ctx.projectAnchor.storageRoot,
7199
+ "--project",
7200
+ String(ctx.binding.projectId)
7201
+ ] : [
7124
7202
  ...d.command,
7125
7203
  "--workspace",
7126
7204
  ctx.bindingDirs.workspace,
@@ -7131,7 +7209,7 @@ function createArtProvider(deps) {
7131
7209
  "--config",
7132
7210
  path12.join(ctx.bindingDirs.workspace, "settings.json")
7133
7211
  ];
7134
- if (!d.global && !d.control && !(d.command[1] === "run" && input.plan))
7212
+ if (!d.global && !d.control && !(businessCommand[1] === "run" && input.plan))
7135
7213
  argv.push("--project", String(ctx.binding.projectId));
7136
7214
  if (d.control) {
7137
7215
  const verification = verifyExecutionHandle({
@@ -7145,7 +7223,7 @@ function createArtProvider(deps) {
7145
7223
  return fail("art-handle-missing", "\u53E5\u67C4\u7F3A\u5C11\u540E\u7AEF\u8FD0\u884C\u8EAB\u4EFD");
7146
7224
  const origin = JSON.parse(readFileSync(resolveInsideProject(ctx.projectAnchor, verification.record.recordDir + "/result.json", "art.origin").path, "utf8"));
7147
7225
  if (origin.output?.result?.project !== ctx.binding.projectId || ["workspace", "output", "cache"].some((key) => origin.project?.bindingDirs?.art?.[key] !== ctx.bindingDirs?.[key])) return fail("art-handle-binding-changed", "\u8FD0\u884C\u8EAB\u4EFD\u4E0E\u5F53\u524D\u5DE5\u7A0B\u7ED1\u5B9A\u4E0D\u540C\uFF1B\u8BF7\u6062\u590D\u539F\u7ED1\u5B9A\u540E\u64CD\u4F5C");
7148
- argv.splice(2, 0, verification.record.backendTaskId);
7226
+ argv.splice(d.command.length, 0, verification.record.backendTaskId);
7149
7227
  }
7150
7228
  if (d.id === "run-wait" && input.timeout === void 0) argv.push("--timeout", "30");
7151
7229
  for (const key of d.positional ?? []) argv.push(resolveInsideProject(ctx.projectAnchor, String(input[key]), "art." + key).path);
@@ -7156,18 +7234,28 @@ function createArtProvider(deps) {
7156
7234
  String(value),
7157
7235
  "art." + key
7158
7236
  ).path : value;
7237
+ if (d.channel === "video" && key === "input") {
7238
+ try {
7239
+ const parsed = JSON.parse(readFileSync(String(actual), "utf8"));
7240
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return fail("art-video-input-invalid", "\u89C6\u9891\u8BF7\u6C42\u6587\u4EF6\u5FC5\u987B\u4E3A JSON \u5BF9\u8C61");
7241
+ videoInput = parsed;
7242
+ } catch (error) {
7243
+ return fail("art-video-input-invalid", error instanceof Error ? error.message : "\u65E0\u6CD5\u8BFB\u53D6\u89C6\u9891\u8BF7\u6C42\u6587\u4EF6");
7244
+ }
7245
+ }
7159
7246
  argv.push("--" + key);
7160
7247
  if (value !== true) argv.push(String(actual));
7161
7248
  }
7162
7249
  if (d.start && d.id !== "run-recover" && !input.dry) argv.push("--operation", ctx.operationId);
7163
- if (d.start && d.command[1] === "run" && !input.dry)
7250
+ if (d.channel === "video" && !d.readonly) argv.push("--operation", ctx.operationId);
7251
+ if (d.start && businessCommand[1] === "run" && !input.dry)
7164
7252
  argv.push("--background");
7165
7253
  const outcome = await deps.executor.run({
7166
7254
  file: process.execPath,
7167
7255
  args: [backend.bin, ...argv],
7168
7256
  cwd: ctx.projectAnchor.root,
7169
7257
  env: deps.env,
7170
- timeoutMs: d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
7258
+ timeoutMs: d.channel === "video" ? 15 * 60 * 1e3 : d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
7171
7259
  signal: ctx.signal
7172
7260
  });
7173
7261
  let output;
@@ -7177,7 +7265,7 @@ function createArtProvider(deps) {
7177
7265
  if (!output || typeof output !== "object") throw new Error();
7178
7266
  } catch {
7179
7267
  const processState = executionFromProcess(outcome);
7180
- const uncertain = d.start || d.control || d.command[0] === "conversation" || processState.lifecycle === "unknown";
7268
+ const uncertain = d.start || d.control || businessCommand[0] === "conversation" || d.channel === "video" && !d.readonly || processState.lifecycle === "unknown";
7181
7269
  return {
7182
7270
  execution: {
7183
7271
  ...processState,
@@ -7194,8 +7282,19 @@ function createArtProvider(deps) {
7194
7282
  };
7195
7283
  }
7196
7284
  let lifecycle = executionFromProcess(outcome).lifecycle;
7197
- if (d.command[0] === "conversation" && output.stopConfirmed !== true)
7198
- lifecycle = "unknown";
7285
+ if (businessCommand[0] === "conversation" && output.stopConfirmed !== true) lifecycle = "unknown";
7286
+ if (d.channel === "video" && output.unknown === true) lifecycle = "unknown";
7287
+ if (d.channel === "video" && output.ok !== false && ["operation.run", "operation.resume", "operation.cancel"].includes(videoAction || "")) {
7288
+ const operations = Array.isArray(output.operations) ? output.operations : [];
7289
+ const operation = operations.find((value) => value.id === videoInput.operationId);
7290
+ const runs = Array.isArray(operation?.runs) ? operation.runs : [];
7291
+ const run = videoInput.requestId ? runs.find((value) => value.requestId === videoInput.requestId) : videoInput.runId ? runs.find((value) => value.id === videoInput.runId) : runs.at(-1);
7292
+ lifecycle = output.id !== videoInput.taskId || !run || typeof run.id !== "string" || !run.id || typeof run.requestId !== "string" || !run.requestId || run.status === "unknown" ? "unknown" : ["dispatching", "running"].includes(String(run.status)) ? "accepted" : run.status === "succeeded" || run.cancelled === true && run.stopConfirmed === true ? "completed" : "failed";
7293
+ }
7294
+ if (videoAction === "execution.status") {
7295
+ if (output.unknown === true || ["unknown", "executing"].includes(String(output.status))) lifecycle = "unknown";
7296
+ else if (output.status === "submitted") lifecycle = "accepted";
7297
+ }
7199
7298
  if (typeof output.taskId === "string")
7200
7299
  lifecycle = output.lifecycle ?? (d.start && !input.dry ? "accepted" : output.stopConfirmed === true ? "completed" : "unknown");
7201
7300
  return {
package/dist/sdk.d.ts CHANGED
@@ -13,13 +13,20 @@ interface ProjectRoot {
13
13
  root: string;
14
14
  /** 工程根 realpath(包含关系判定的基准) */
15
15
  realRoot: string;
16
+ /** 宿主拥有的 .vant 数据根;业务代码始终使用 root。 */
17
+ storageRoot: string;
18
+ realStorageRoot: string;
16
19
  }
20
+ /** SDK 显式支持独立代码根与 .vant 数据根。 */
21
+ declare const PROJECT_STORAGE_ROOT_VERSION = 1;
17
22
  declare class PathSafetyError extends Error {
18
23
  readonly code: string;
19
24
  constructor(code: string, message: string);
20
25
  }
21
26
  /** 解析并锚定工程根;不存在/不是目录时抛出 */
22
- declare function resolveProjectRoot(input?: string, cwd?: string): ProjectRoot;
27
+ declare function resolveProjectRoot(input?: string, cwd?: string, options?: {
28
+ storageRoot?: string;
29
+ }): ProjectRoot;
23
30
  /** 拆分相对路径为段;非法即抛 */
24
31
  declare function splitSafeRelative(relative: string, label: string): string[];
25
32
  /**
@@ -242,6 +249,8 @@ interface ExecutionHandle {
242
249
  project: {
243
250
  root: string;
244
251
  configFile: string;
252
+ codeRoot?: string;
253
+ storageRoot?: string;
245
254
  };
246
255
  startedAt: string;
247
256
  /** false = 未落盘启动(--no-persist),不可跨进程恢复 */
@@ -288,6 +297,8 @@ type HandleVerification = {
288
297
  };
289
298
  /** 已通过的身份核对项(写入验收证据) */
290
299
  checks: string[];
300
+ /** 原启动身份,只读恢复时不改写为当前业务 checkout。 */
301
+ originProject: ExecutionHandle["project"];
291
302
  } | {
292
303
  ok: false;
293
304
  code: string;
@@ -482,6 +493,8 @@ interface LogRef {
482
493
  interface ProjectBindingInfo {
483
494
  /** 工程根绝对路径(realpath) */
484
495
  root: string;
496
+ codeRoot: string;
497
+ storageRoot: string;
485
498
  /** .vant/config/v-cli.json 绝对路径 */
486
499
  configFile: string;
487
500
  /** 已安全解析的绑定路径(provider id -> 字段名 -> 绝对路径) */
@@ -869,6 +882,8 @@ interface CapabilityRunRequest {
869
882
  capabilityId: string;
870
883
  /** 显式工程根(--project);缺省用 cwd */
871
884
  projectRoot?: string;
885
+ /** 宿主拥有的 .vant 数据根;未指定时与 projectRoot 相同。 */
886
+ storageRoot?: string;
872
887
  cwd?: string;
873
888
  input?: Record<string, unknown>;
874
889
  operationId?: string;
@@ -1192,7 +1207,7 @@ declare function redactArgv(argv: string[]): RedactionResult<string[]>;
1192
1207
  declare const REDACTION_PLACEHOLDER = "***redacted***";
1193
1208
 
1194
1209
  /** 版本常量:与 package.json 保持一致(有测试保证) */
1195
- declare const VERSION = "0.6.4";
1210
+ declare const VERSION = "0.7.1";
1196
1211
 
1197
1212
  /** 已发布命令清单与真实注册表逐项对照,不从命名猜测覆盖。 */
1198
1213
  declare function capabilityCoverage(registry: CapabilityRegistry): {
@@ -1211,4 +1226,4 @@ declare function capabilityCoverage(registry: CapabilityRegistry): {
1211
1226
  }[];
1212
1227
  };
1213
1228
 
1214
- export { type AcceptanceStatus, type ArtProviderDeps, type Artifact, type CapabilityDescriptor, CapabilityError, type CapabilityExecutionContext, type CapabilityImplementation, type CapabilityProvider, type CapabilityRegistration, CapabilityRegistrationError, CapabilityRegistry, type CapabilityRunRequest, type CapabilityRunResult, type CapabilityRuntimeDeps, type CapabilitySummary, type DefaultRegistryOptions, EXECUTION_HANDLE_VERSION, type ErrorCategory, type Evidence, type ExecutionHandle, type ExecutionHandleSeed, type ExecutionLifecycle, type ExecutionStatus, FIGMA_PROVIDER_ID, FIGMA_PROVIDER_VERSION, type FigmaBinding, type FigmaProviderDeps, type HandleVerification, type ImplementationOutcome, type InitProjectConfigResult, JSON_TYPES, type JsonSchema, type JsonSchemaArray, type JsonSchemaBoolean, type JsonSchemaNull, type JsonSchemaNumber, type JsonSchemaObject, type JsonSchemaString, type JsonSchemaType, type LoadProjectConfigResult, type LogRef, NodeProcessExecutor, OPERATIONS_RELATIVE, OperationExistsError, type OperationLogger, OperationStore, type OperationSummary, PROJECT_CLI_CONFIG_RELATIVE, PathSafetyError, type PreconditionChecker, type PreconditionDeclaration, type PreconditionOutcome, type ProcessExecutor, type ProcessInvocation, type ProcessOutcome, type ProjectBindingInfo, type ProjectCliConfig, type ProjectInspection, type ProjectRoot, type ProviderBindingContract, type ProviderBindingResolution, type ProviderBindingResolutionError, type ProviderBindingResolutionOk, type ProviderBindingResolveInput, type ProviderDefaultBinding, type ProviderInfo, type ProviderPathField, type ProviderSet, type ProviderState, type ProviderStatus, REDACTION_PLACEHOLDER, type ResolvedProviderBinding, type ResourceAuthorizationDecision, type ResourceAuthorizationRequest, type ResourceAuthorizer, type ResourceKind, type ResourceMode, type ResourceRequirement, type RetrySemantics, type SideEffectDeclaration, type SideEffectKind, type SideEffectRecord, type StructuredError, type ToolSkill, UNITY_PROVIDER_ID, UNITY_PROVIDER_VERSION, type UnityBinding, type UnityProviderDeps, type UnityTestMode, VANT_PROJECT_CONFIG_RELATIVE, VERSION, artBindingContract, buildDoctorArgv, buildExecArgv, buildExecutionHandle, canonicalize, capabilityCoverage, createArtProvider, createDefaultRegistry, createFigmaProvider, createUnityProvider, discoverToolSkills, executionFromProcess, exitCodeForResult, exportToolSkill, figmaBindingContract, formatResultJson, generateOperationId, initProjectConfig, inspectProject, loadProjectConfig, readRuntimeSkill, redactArgv, redactSecrets, renderProjectConfig, resolveBindings, resolveInsideProject, resolveProjectRoot, runCapability, splitSafeRelative, structuredError, toProviderSet, toStructuredError, unityBindingContract, validateCapability, validateOperationId, validateProjectCliConfig, validateProvider, validateSchemaDefinition, validateValue, verifyExecutionHandle };
1229
+ export { type AcceptanceStatus, type ArtProviderDeps, type Artifact, type CapabilityDescriptor, CapabilityError, type CapabilityExecutionContext, type CapabilityImplementation, type CapabilityProvider, type CapabilityRegistration, CapabilityRegistrationError, CapabilityRegistry, type CapabilityRunRequest, type CapabilityRunResult, type CapabilityRuntimeDeps, type CapabilitySummary, type DefaultRegistryOptions, EXECUTION_HANDLE_VERSION, type ErrorCategory, type Evidence, type ExecutionHandle, type ExecutionHandleSeed, type ExecutionLifecycle, type ExecutionStatus, FIGMA_PROVIDER_ID, FIGMA_PROVIDER_VERSION, type FigmaBinding, type FigmaProviderDeps, type HandleVerification, type ImplementationOutcome, type InitProjectConfigResult, JSON_TYPES, type JsonSchema, type JsonSchemaArray, type JsonSchemaBoolean, type JsonSchemaNull, type JsonSchemaNumber, type JsonSchemaObject, type JsonSchemaString, type JsonSchemaType, type LoadProjectConfigResult, type LogRef, NodeProcessExecutor, OPERATIONS_RELATIVE, OperationExistsError, type OperationLogger, OperationStore, type OperationSummary, PROJECT_CLI_CONFIG_RELATIVE, PROJECT_STORAGE_ROOT_VERSION, PathSafetyError, type PreconditionChecker, type PreconditionDeclaration, type PreconditionOutcome, type ProcessExecutor, type ProcessInvocation, type ProcessOutcome, type ProjectBindingInfo, type ProjectCliConfig, type ProjectInspection, type ProjectRoot, type ProviderBindingContract, type ProviderBindingResolution, type ProviderBindingResolutionError, type ProviderBindingResolutionOk, type ProviderBindingResolveInput, type ProviderDefaultBinding, type ProviderInfo, type ProviderPathField, type ProviderSet, type ProviderState, type ProviderStatus, REDACTION_PLACEHOLDER, type ResolvedProviderBinding, type ResourceAuthorizationDecision, type ResourceAuthorizationRequest, type ResourceAuthorizer, type ResourceKind, type ResourceMode, type ResourceRequirement, type RetrySemantics, type SideEffectDeclaration, type SideEffectKind, type SideEffectRecord, type StructuredError, type ToolSkill, UNITY_PROVIDER_ID, UNITY_PROVIDER_VERSION, type UnityBinding, type UnityProviderDeps, type UnityTestMode, VANT_PROJECT_CONFIG_RELATIVE, VERSION, artBindingContract, buildDoctorArgv, buildExecArgv, buildExecutionHandle, canonicalize, capabilityCoverage, createArtProvider, createDefaultRegistry, createFigmaProvider, createUnityProvider, discoverToolSkills, executionFromProcess, exitCodeForResult, exportToolSkill, figmaBindingContract, formatResultJson, generateOperationId, initProjectConfig, inspectProject, loadProjectConfig, readRuntimeSkill, redactArgv, redactSecrets, renderProjectConfig, resolveBindings, resolveInsideProject, resolveProjectRoot, runCapability, splitSafeRelative, structuredError, toProviderSet, toStructuredError, unityBindingContract, validateCapability, validateOperationId, validateProjectCliConfig, validateProvider, validateSchemaDefinition, validateValue, verifyExecutionHandle };
package/dist/sdk.mjs CHANGED
@@ -644,6 +644,7 @@ import { createHash, randomUUID } from "crypto";
644
644
  // src/core/project/paths.ts
645
645
  import fs from "fs";
646
646
  import path from "path";
647
+ var PROJECT_STORAGE_ROOT_VERSION = 1;
647
648
  var PathSafetyError = class extends Error {
648
649
  code;
649
650
  constructor(code, message) {
@@ -655,8 +656,14 @@ var PathSafetyError = class extends Error {
655
656
  function isPlainAbsolute(input) {
656
657
  return path.isAbsolute(input) || /^[A-Za-z]:/.test(input) || input.startsWith("\\\\") || input.startsWith("//");
657
658
  }
658
- function resolveProjectRoot(input, cwd = process.cwd()) {
659
+ function resolveProjectRoot(input, cwd = process.cwd(), options = {}) {
659
660
  const root2 = path.resolve(cwd, input ?? ".");
661
+ const { realRoot } = resolveRootDirectory(root2);
662
+ const storageRoot = path.resolve(cwd, options.storageRoot ?? root2);
663
+ const { realRoot: realStorageRoot } = resolveRootDirectory(storageRoot);
664
+ return { root: root2, realRoot, storageRoot, realStorageRoot };
665
+ }
666
+ function resolveRootDirectory(root2) {
660
667
  let stat;
661
668
  try {
662
669
  stat = fs.statSync(root2);
@@ -675,7 +682,7 @@ function resolveProjectRoot(input, cwd = process.cwd()) {
675
682
  `\u5DE5\u7A0B\u6839\u65E0\u6CD5\u89E3\u6790 realpath: ${err instanceof Error ? err.message : String(err)}`
676
683
  );
677
684
  }
678
- return { root: root2, realRoot };
685
+ return { realRoot };
679
686
  }
680
687
  function splitSafeRelative(relative, label) {
681
688
  if (typeof relative !== "string" || relative.length === 0) {
@@ -717,8 +724,12 @@ function resolveInsideProject(project, relative, label) {
717
724
  return { path: project.root, realPath: project.realRoot };
718
725
  }
719
726
  const segments = splitSafeRelative(relative, label);
720
- const target = path.join(project.root, ...segments);
721
- const existingAncestor = deepestExisting(target, project.realRoot);
727
+ const owned = segments.map((segment) => process.platform === "win32" ? segment.toLowerCase() : segment);
728
+ const storage = owned[0] === ".vant" && owned[1] !== "rules" && !(owned.length === 2 && owned[1] === "rules.md");
729
+ const root2 = storage ? project.storageRoot : project.root;
730
+ const realRoot = storage ? project.realStorageRoot : project.realRoot;
731
+ const target = path.join(root2, ...segments);
732
+ const existingAncestor = deepestExisting(target, realRoot);
722
733
  let ancestorReal;
723
734
  try {
724
735
  ancestorReal = fs.realpathSync.native(existingAncestor);
@@ -728,7 +739,7 @@ function resolveInsideProject(project, relative, label) {
728
739
  `${label} \u65E0\u6CD5\u89E3\u6790 realpath: ${err instanceof Error ? err.message : String(err)}`
729
740
  );
730
741
  }
731
- if (!isInside(project.realRoot, ancestorReal)) {
742
+ if (!isInside(realRoot, ancestorReal)) {
732
743
  throw new PathSafetyError(
733
744
  "path-escape",
734
745
  `${label} \u89E3\u6790\u540E\u9003\u9038\u5DE5\u7A0B\u6839\uFF08${relative} \u2192 ${ancestorReal}\uFF09`
@@ -741,7 +752,7 @@ function resolveInsideProject(project, relative, label) {
741
752
  throw new PathSafetyError("path-symlink", `${label} \u662F\u7B26\u53F7\u94FE\u63A5/\u8054\u63A5\uFF0C\u62D2\u7EDD\u5199\u5165\u6216\u8DDF\u968F: ${target}`);
742
753
  }
743
754
  realPath = fs.realpathSync.native(target);
744
- if (!isInside(project.realRoot, realPath)) {
755
+ if (!isInside(realRoot, realPath)) {
745
756
  throw new PathSafetyError("path-escape", `${label} \u7684\u771F\u5B9E\u8DEF\u5F84\u9003\u9038\u5DE5\u7A0B\u6839: ${realPath}`);
746
757
  }
747
758
  }
@@ -1047,7 +1058,7 @@ function resolveBindings(project, config, providers) {
1047
1058
  return { ok: true, bindings: result4 };
1048
1059
  }
1049
1060
  function loadProjectConfig(project, providers) {
1050
- const file2 = path3.join(project.root, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1061
+ const file2 = path3.join(project.storageRoot, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1051
1062
  const initHint = `\u8BF7\u5148\u5728\u5DE5\u7A0B\u6839\u8FD0\u884C \`v-cli project init --project <\u5DE5\u7A0B\u6839>\` \u751F\u6210 ${PROJECT_CLI_CONFIG_RELATIVE}`;
1052
1063
  let text5;
1053
1064
  try {
@@ -1147,8 +1158,8 @@ function atomicWriteConfig(project, file2, content) {
1147
1158
  }
1148
1159
  }
1149
1160
  function initProjectConfig(project, providers, overrides = {}, options = {}) {
1150
- const file2 = path3.join(project.root, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1151
- const vantFile = path3.join(project.root, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1161
+ const file2 = path3.join(project.storageRoot, ...PROJECT_CLI_CONFIG_RELATIVE.split("/"));
1162
+ const vantFile = path3.join(project.storageRoot, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1152
1163
  const vantConfig = { file: vantFile, exists: fs3.existsSync(vantFile) };
1153
1164
  const refused = (reason) => ({
1154
1165
  ok: false,
@@ -1272,7 +1283,7 @@ function initProjectConfig(project, providers, overrides = {}, options = {}) {
1272
1283
  }
1273
1284
  let backupPath;
1274
1285
  if (reset && exists && !dryRun) {
1275
- const backupDir = path3.join(project.root, ...CONFIG_BACKUP_RELATIVE.split("/"));
1286
+ const backupDir = path3.join(project.storageRoot, ...CONFIG_BACKUP_RELATIVE.split("/"));
1276
1287
  resolveInsideProject(project, CONFIG_BACKUP_RELATIVE, CONFIG_BACKUP_RELATIVE);
1277
1288
  fs3.mkdirSync(backupDir, { recursive: true });
1278
1289
  const stamp = `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}-${process.pid.toString(36)}`;
@@ -1283,7 +1294,7 @@ function initProjectConfig(project, providers, overrides = {}, options = {}) {
1283
1294
  if (exists) {
1284
1295
  atomicWriteConfig(project, file2, rendered.content);
1285
1296
  } else {
1286
- const configDir = path3.join(project.root, ".vant", "config");
1297
+ const configDir = path3.join(project.storageRoot, ".vant", "config");
1287
1298
  resolveInsideProject(project, ".vant/config", ".vant/config");
1288
1299
  fs3.mkdirSync(configDir, { recursive: true });
1289
1300
  fs3.writeFileSync(file2, rendered.content, { encoding: "utf-8", flag: "wx" });
@@ -1388,7 +1399,7 @@ function inspectProject(project, providers) {
1388
1399
  });
1389
1400
  }
1390
1401
  }
1391
- const vantDir = path3.join(project.root, ".vant");
1402
+ const vantDir = path3.join(project.storageRoot, ".vant");
1392
1403
  let configFiles = [];
1393
1404
  const configDir = path3.join(vantDir, "config");
1394
1405
  if (fs3.existsSync(configDir)) {
@@ -1398,7 +1409,7 @@ function inspectProject(project, providers) {
1398
1409
  configFiles = [];
1399
1410
  }
1400
1411
  }
1401
- const stateDir = path3.join(project.root, ...OPERATIONS_RELATIVE.split("/"));
1412
+ const stateDir = path3.join(project.storageRoot, ...OPERATIONS_RELATIVE.split("/"));
1402
1413
  let operationCount = 0;
1403
1414
  if (fs3.existsSync(stateDir)) {
1404
1415
  try {
@@ -1407,7 +1418,7 @@ function inspectProject(project, providers) {
1407
1418
  operationCount = 0;
1408
1419
  }
1409
1420
  }
1410
- const vantFile = path3.join(project.root, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1421
+ const vantFile = path3.join(project.storageRoot, ...VANT_PROJECT_CONFIG_RELATIVE.split("/"));
1411
1422
  let bindingsValue = {};
1412
1423
  if (loaded.ok) bindingsValue = loaded.config.bindings;
1413
1424
  return {
@@ -1652,7 +1663,12 @@ function buildExecutionHandle(input) {
1652
1663
  capabilityId: input.capabilityId,
1653
1664
  originOperationId: input.operationId,
1654
1665
  backendTaskId: input.seed.backendTaskId,
1655
- project: { root: input.project.realRoot, configFile: input.configFile },
1666
+ project: {
1667
+ root: input.project.realRoot,
1668
+ codeRoot: input.project.realRoot,
1669
+ storageRoot: input.project.realStorageRoot,
1670
+ configFile: input.configFile
1671
+ },
1656
1672
  startedAt: input.startedAt,
1657
1673
  recoverable: input.persisted,
1658
1674
  recordDir: `${OPERATIONS_RELATIVE}/${input.operationId}`
@@ -1703,6 +1719,8 @@ function verifyExecutionHandle(input) {
1703
1719
  if (!isPlainObject4(handle.project) || typeof handle.project.root !== "string" || typeof handle.project.configFile !== "string") {
1704
1720
  return fail("handle-invalid", ["\u53E5\u67C4 project.root/configFile \u5FC5\u987B\u662F\u5B57\u7B26\u4E32"]);
1705
1721
  }
1722
+ if (Object.keys(handle.project).some((key) => !["root", "configFile", "codeRoot", "storageRoot"].includes(key)) || handle.project.codeRoot === void 0 !== (handle.project.storageRoot === void 0) || handle.project.codeRoot !== void 0 && (typeof handle.project.codeRoot !== "string" || !handle.project.codeRoot || typeof handle.project.storageRoot !== "string" || !handle.project.storageRoot || comparePathForm(handle.project.codeRoot) !== comparePathForm(handle.project.root)))
1723
+ return fail("handle-invalid", ["\u53E5\u67C4\u4EE3\u7801\u6839\u548C\u5B58\u50A8\u6839\u5FC5\u987B\u5B8C\u6574\u4E14\u4E0E\u539F\u542F\u52A8\u8EAB\u4EFD\u4E00\u81F4"]);
1706
1724
  if (!isPlainObject4(handle.integrity) || handle.integrity.algo !== "sha256" || typeof handle.integrity.digest !== "string") {
1707
1725
  return fail("handle-invalid", ["\u53E5\u67C4 integrity \u7F3A\u5931\u6216\u975E\u6CD5"]);
1708
1726
  }
@@ -1720,9 +1738,10 @@ function verifyExecutionHandle(input) {
1720
1738
  `\u53E5\u67C4\u7684\u89E6\u53D1\u80FD\u529B\u4E3A "${handle.capabilityId}"\uFF0C\u671F\u671B "${input.expectCapabilityId}"`
1721
1739
  ]);
1722
1740
  }
1723
- if (comparePathForm(handle.project.root) !== comparePathForm(project.realRoot)) {
1741
+ const handleStorageRoot = String(handle.project.storageRoot ?? handle.project.root);
1742
+ if (comparePathForm(handleStorageRoot) !== comparePathForm(project.realStorageRoot)) {
1724
1743
  return fail("handle-project-mismatch", [
1725
- `\u53E5\u67C4\u5DE5\u7A0B ${handle.project.root} \u4E0E\u5F53\u524D\u5DE5\u7A0B ${project.realRoot} \u4E0D\u4E00\u81F4\uFF1A\u62D2\u7EDD\u6267\u884C`
1744
+ `\u53E5\u67C4\u5B58\u50A8 ${handleStorageRoot} \u4E0E\u5F53\u524D\u5B58\u50A8 ${project.realStorageRoot} \u4E0D\u4E00\u81F4\uFF1A\u62D2\u7EDD\u6267\u884C`
1726
1745
  ]);
1727
1746
  }
1728
1747
  if (handle.recoverable !== true) {
@@ -1781,7 +1800,10 @@ function verifyExecutionHandle(input) {
1781
1800
  if (recordProject !== void 0 && comparePathForm(String(recordProject.root ?? "")) !== comparePathForm(handle.project.root)) {
1782
1801
  mismatches.push("project.root \u4E0E\u8BB0\u5F55\u4E0D\u4E00\u81F4");
1783
1802
  } else if (recordProject !== void 0) checks.push("project.root");
1803
+ if (recordProject !== void 0 && (comparePathForm(String(recordProject.storageRoot ?? recordProject.root ?? "")) !== comparePathForm(handleStorageRoot) || comparePathForm(String(recordProject.codeRoot ?? recordProject.root ?? "")) !== comparePathForm(String(handle.project.codeRoot ?? handle.project.root)) || comparePathForm(String(recordProject.configFile ?? "")) !== comparePathForm(handle.project.configFile)))
1804
+ mismatches.push("project.codeRoot/storageRoot/configFile \u4E0E\u8BB0\u5F55\u4E0D\u4E00\u81F4");
1784
1805
  if (recordHandle !== void 0) {
1806
+ if (canonicalize(recordHandle.project) !== canonicalize(handle.project)) mismatches.push("handle.project \u4E0E\u539F\u53E5\u67C4\u4E0D\u4E00\u81F4");
1785
1807
  if (recordHandle.backendTaskId !== handle.backendTaskId) {
1786
1808
  mismatches.push(
1787
1809
  `backendTaskId: \u8BB0\u5F55 ${JSON.stringify(recordHandle.backendTaskId)} \u2260 \u53E5\u67C4 ${JSON.stringify(handle.backendTaskId)}\uFF08\u5173\u8054\u5DF2\u5931\u6548\u6216\u88AB\u5176\u4ED6\u4EFB\u52A1\u66FF\u4EE3\uFF09`
@@ -1812,7 +1834,8 @@ function verifyExecutionHandle(input) {
1812
1834
  execution: recordExecution !== null && typeof recordExecution.status === "string" && typeof recordExecution.lifecycle === "string" ? { status: recordExecution.status, lifecycle: recordExecution.lifecycle } : null,
1813
1835
  acceptance: recordAcceptance !== null && typeof recordAcceptance.status === "string" ? { status: recordAcceptance.status, pending: recordAcceptance.pending === true } : null
1814
1836
  },
1815
- checks
1837
+ checks,
1838
+ originProject: { ...handle.project }
1816
1839
  };
1817
1840
  }
1818
1841
 
@@ -2015,6 +2038,8 @@ function buildResult(input) {
2015
2038
  },
2016
2039
  project: {
2017
2040
  root: input.project.realRoot,
2041
+ codeRoot: input.project.realRoot,
2042
+ storageRoot: input.project.realStorageRoot,
2018
2043
  configFile: input.configFile,
2019
2044
  bindingDirs: input.bindingDirs
2020
2045
  },
@@ -2061,7 +2086,7 @@ async function runCapability(registry, request, deps = {}) {
2061
2086
  }
2062
2087
  let project;
2063
2088
  try {
2064
- project = resolveProjectRoot(request.projectRoot, request.cwd ?? process.cwd());
2089
+ project = resolveProjectRoot(request.projectRoot, request.cwd ?? process.cwd(), { storageRoot: request.storageRoot });
2065
2090
  } catch (err) {
2066
2091
  if (err instanceof PathSafetyError) {
2067
2092
  throw new CapabilityError(structuredError(err.code, "request", err.message));
@@ -2103,7 +2128,7 @@ async function runCapability(registry, request, deps = {}) {
2103
2128
  schemaVersion: 1,
2104
2129
  operationId,
2105
2130
  capability: { id: entry.descriptor.id, version: entry.descriptor.version },
2106
- project: { root: project.realRoot, configFile: loadedConfig.file },
2131
+ project: { root: project.realRoot, codeRoot: project.realRoot, storageRoot: project.realStorageRoot, configFile: loadedConfig.file },
2107
2132
  taskId: request.taskId ?? null,
2108
2133
  runId: request.runId ?? null,
2109
2134
  recordedAt: startedAt.toISOString(),
@@ -2312,11 +2337,16 @@ async function runCapability(registry, request, deps = {}) {
2312
2337
  }
2313
2338
  let releaseResources;
2314
2339
  try {
2315
- releaseResources = await acquireResources(project.realRoot, entry.descriptor.resources, Object.values(providerBindingDirs), {
2316
- waitForLocal: true,
2317
- signal,
2318
- timeoutMs: entry.descriptor.timeoutMs
2319
- });
2340
+ releaseResources = await acquireResources(
2341
+ project.realRoot,
2342
+ entry.descriptor.resources,
2343
+ [...Object.values(providerBindingDirs), resolveInsideProject(project, ".vant", "\u5DE5\u7A0B\u6570\u636E").path],
2344
+ {
2345
+ waitForLocal: true,
2346
+ signal,
2347
+ timeoutMs: entry.descriptor.timeoutMs
2348
+ }
2349
+ );
2320
2350
  store.event("resources-acquired", "\u5DF2\u53D6\u5F97\u8DE8\u8FDB\u7A0B\u8D44\u6E90\u79DF\u7EA6");
2321
2351
  } catch (error) {
2322
2352
  if (signal.aborted) return cancelledBeforeExecution();
@@ -3023,7 +3053,7 @@ var OFFICIAL_PLUGINS = [
3023
3053
  command: "ship",
3024
3054
  description: "\u5DF2\u6784\u5EFA\u6E38\u620F\u7684 Steam/\u5FAE\u4FE1\u5C0F\u6E38\u620F\u6821\u9A8C\u3001\u9884\u6F14\u548C\u6D4B\u8BD5\u901A\u9053\u4E0A\u4F20"
3025
3055
  },
3026
- { package: "@kevlns/art-workshop", command: "art", description: "\u7F8E\u672F\u5DE5\u574A\uFF1A\u98CE\u683C\u5206\u6790\u4E0E\u51BB\u7ED3\u3001\u8FDC\u7A0B\u6216\u672C\u5730 ComfyUI \u751F\u56FE\u53CA\u7F16\u8F91\u3001\u73AF\u5883\u68C0\u67E5\u4E0E\u4EFB\u52A1\u7BA1\u7406" }
3056
+ { package: "@kevlns/art-workshop", command: "art", description: "\u7F8E\u672F\u5DE5\u574A\uFF1Aimage \u56FE\u7247\u4E0E video \u89C6\u9891\u72EC\u7ACB\u901A\u9053\uFF0C\u6DB5\u76D6\u98CE\u683C\u3001\u751F\u56FE\u7F16\u8F91\u3001\u5267\u672C\u955C\u5934\u3001\u6210\u7247\u7CBE\u4FEE\u548C\u8FD0\u884C\u7BA1\u7406" }
3027
3057
  ];
3028
3058
  var OFFICIAL_COMMAND_NAMES = new Set(
3029
3059
  OFFICIAL_PLUGINS.map((p) => p.command)
@@ -6300,18 +6330,10 @@ var definitions3 = [
6300
6330
  { id: "agent-docs", command: ["agent", "docs"], fields: {}, readonly: true, text: true, global: true },
6301
6331
  { id: "agent-init", command: ["agent", "init"], fields: { directory: file, dry: { type: "boolean" } }, required: ["directory"], global: true },
6302
6332
  { id: "agent-export", command: ["agent", "export"], fields: { directory: file, host: { type: "string", enum: ["codex", "claude"] }, dry: { type: "boolean" } }, required: ["directory", "host"], global: true },
6303
- ...["start", "status", "cancel", "resume", "close"].map((action) => ({
6304
- id: "conversation-" + action,
6305
- command: ["conversation", action],
6306
- global: true,
6307
- fields: action === "start" ? { input: file } : { session: identifier, request: identifier },
6308
- required: action === "start" ? ["input"] : ["session", "request"],
6309
- readonly: action === "status",
6310
- network: action !== "status"
6311
- })),
6333
+ { id: "conversation-start", command: ["conversation", "start"], fields: { input: file }, required: ["input"], network: true, global: true },
6334
+ ...["status", "cancel", "resume", "close"].map((action) => ({ id: "conversation-" + action, command: ["conversation", action], fields: { session: { type: "string", minLength: 1 }, request: { type: "string", minLength: 1 } }, required: ["session", "request"], readonly: action === "status", network: action !== "status", global: true })),
6312
6335
  ...["style", "job"].map((kind) => ({ id: kind + "-migration-complete", command: [kind, "migration-complete"], fields: objectFields, required: ["id", "revision", "input"] })),
6313
6336
  { id: "list", command: ["list"], fields: {}, readonly: true, global: true },
6314
- { id: "style-validate", command: ["style", "validate"], fields: { report: file }, required: ["report"], readonly: true },
6315
6337
  { id: "style-show", command: ["style", "show"], fields: { core: identifier }, required: ["core"], readonly: true },
6316
6338
  ...["generate", "edit"].map((kind) => ({ id: kind + "-show", command: [kind, "show"], fields: { job: identifier }, required: ["job"], readonly: true })),
6317
6339
  { id: "check", command: ["check"], fields: { run: file }, required: ["run"], positional: ["run"], readonly: true, global: true },
@@ -6352,13 +6374,6 @@ var definitions3 = [
6352
6374
  fields: { input: file },
6353
6375
  required: ["input"]
6354
6376
  },
6355
- {
6356
- id: "style-analyze",
6357
- command: ["style", "analyze"],
6358
- fields: { id: identifier, revision, dry: { type: "boolean" } },
6359
- required: ["id", "revision"],
6360
- start: true
6361
- },
6362
6377
  {
6363
6378
  id: "job-analyze",
6364
6379
  command: ["job", "analyze"],
@@ -6369,14 +6384,9 @@ var definitions3 = [
6369
6384
  { id: "style-export", command: ["style", "export"], fields: { id: identifier, out: file }, required: ["id", "out"] },
6370
6385
  { id: "style-import", command: ["style", "import"], fields: { file }, required: ["file"] },
6371
6386
  { id: "style-sources", command: ["style", "sources"], fields: { input: file }, required: ["input"], readonly: true, global: true },
6372
- { id: "style-revise", command: ["style", "revise"], fields: objectFields, required: ["id", "revision", "input"] },
6373
- { id: "style-resolve", command: ["style", "resolve"], fields: objectFields, required: ["id", "revision", "input"] },
6374
- {
6375
- id: "style-adopt",
6376
- command: ["style", "adopt"],
6377
- fields: { id: identifier, revision, note: { type: "string" } },
6378
- required: ["id", "revision"]
6379
- },
6387
+ { id: "style-sample-job", command: ["style", "sample-job"], fields: { id: identifier, revision, name: { type: "string", minLength: 1 }, count: { type: "integer", minimum: 1, maximum: 4 } }, required: ["id", "revision"] },
6388
+ { id: "style-sample-select", command: ["style", "sample-select"], fields: { id: identifier, revision, job: identifier, run: identifier, candidate: { type: "string", pattern: "^[a-f0-9]{64}$" }, note: { type: "string", maxLength: 2e3 } }, required: ["id", "revision", "job", "run", "candidate"] },
6389
+ { id: "style-sample-remove", command: ["style", "sample-remove"], fields: { id: identifier, revision, sample: identifier }, required: ["id", "revision", "sample"] },
6380
6390
  {
6381
6391
  id: "style-recover",
6382
6392
  command: ["style", "recover"],
@@ -6483,13 +6493,73 @@ var definitions3 = [
6483
6493
  { id: "candidate-favorites", command: ["candidate", "favorites"], fields: {}, readonly: true },
6484
6494
  { id: "candidate-favorite", command: ["candidate", "favorite"], fields: { job: identifier, run: identifier, candidate: { type: "string", pattern: "^[a-f0-9]{64}$" }, value: { type: "string", enum: ["true", "false"] } }, required: ["job", "run", "candidate", "value"] }
6485
6495
  ];
6496
+ var imageDefinitions = definitions3.map((definition) => ({
6497
+ ...definition,
6498
+ channel: "image",
6499
+ command: ["image", ...definition.command]
6500
+ }));
6501
+ var videoActions = [
6502
+ "describe",
6503
+ "snapshot",
6504
+ "settings.get",
6505
+ "settings.save",
6506
+ "settings.presets.h3",
6507
+ "runtime.status",
6508
+ "runtime.start",
6509
+ "runtime.stop",
6510
+ "task.list",
6511
+ "task.read",
6512
+ "task.create",
6513
+ "task.rename",
6514
+ "task.archive",
6515
+ "operation.create",
6516
+ "operation.update",
6517
+ "operation.rename",
6518
+ "operation.derive",
6519
+ "operation.validate",
6520
+ "operation.run",
6521
+ "operation.resume",
6522
+ "operation.cancel",
6523
+ "operation.accept",
6524
+ "operation.bind",
6525
+ "script.read",
6526
+ "script.update",
6527
+ "script.plan",
6528
+ "script.apply",
6529
+ "film.compose",
6530
+ "film.refine",
6531
+ "film.preview",
6532
+ "film.adopt",
6533
+ "film.undo",
6534
+ "material.list",
6535
+ "material.import",
6536
+ "material.import-file",
6537
+ "material.upload",
6538
+ "material.hide",
6539
+ "image",
6540
+ "media.status",
6541
+ "execution.status"
6542
+ ];
6543
+ var videoReads = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "task.list", "task.read", "operation.validate", "script.read", "script.plan", "material.list", "image", "media.status", "execution.status"]);
6544
+ var videoNoInput = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "runtime.start", "runtime.stop", "task.list", "material.list", "media.status"]);
6545
+ var videoNetwork = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.save", "runtime.status", "runtime.start", "runtime.stop", "operation.create", "operation.update", "operation.derive", "operation.validate", "operation.run", "operation.resume", "operation.cancel", "script.plan", "script.apply", "film.refine"]);
6546
+ var videoDefinitions = videoActions.map((action) => ({
6547
+ id: "video-" + action.replaceAll(".", "-"),
6548
+ channel: "video",
6549
+ command: ["video", ...action.split(".")],
6550
+ fields: action === "execution.status" ? { operation: { type: "string", pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" } } : { input: file },
6551
+ required: action === "execution.status" ? ["operation"] : videoNoInput.has(action) ? [] : ["input"],
6552
+ readonly: videoReads.has(action),
6553
+ network: videoNetwork.has(action),
6554
+ global: true
6555
+ }));
6486
6556
  function createArtProvider(deps) {
6487
6557
  const discover = deps.discoverBackend ?? (() => discoverOfficialPlugin(
6488
6558
  OFFICIAL_PLUGINS.find((s) => s.command === "art")
6489
6559
  ));
6490
- const registrations = definitions3.map((d) => ({
6560
+ const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions].map((d) => ({
6491
6561
  descriptor: {
6492
- id: "art." + d.id,
6562
+ id: "art." + (d.channel === "image" ? "image-" : "") + d.id,
6493
6563
  commands: [d.command],
6494
6564
  version: "0.1.0",
6495
6565
  description: "\u7F8E\u672F\u5DE5\u574A " + d.command.join(" ") + "\uFF1B\u5BF9\u8C61\u7248\u672C\u4E0E\u505C\u6B62\u8BC1\u636E\u7531\u5DE5\u5177\u6838\u9A8C",
@@ -6550,11 +6620,14 @@ function createArtProvider(deps) {
6550
6620
  strategy: "none",
6551
6621
  description: "\u542F\u52A8\u4E0D\u81EA\u52A8\u91CD\u8BD5\uFF1B\u6062\u590D\u67E5\u8BE2\u539F\u53E5\u67C4"
6552
6622
  },
6553
- timeoutMs: d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
6554
- tags: ["art", "lifecycle"]
6623
+ timeoutMs: d.channel === "video" ? 15 * 60 * 1e3 : d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
6624
+ tags: ["art", d.channel || "image", "lifecycle"]
6555
6625
  },
6556
6626
  implementation: {
6557
6627
  execute: async (input, ctx) => {
6628
+ const businessCommand = d.channel === "image" ? d.command.slice(1) : d.command;
6629
+ const videoAction = d.channel === "video" ? d.command.slice(1).join(".") : null;
6630
+ let videoInput = {};
6558
6631
  const backend = discover();
6559
6632
  const fail = (code, message) => ({
6560
6633
  execution: {
@@ -6574,9 +6647,15 @@ function createArtProvider(deps) {
6574
6647
  if (d.start && input.plan) {
6575
6648
  const file2 = resolveInsideProject(ctx.projectAnchor, String(input.plan), "art.plan").path;
6576
6649
  const plan = JSON.parse(readFileSync(file2, "utf8"));
6577
- if (plan.project !== ctx.binding.projectId || plan.module !== d.command[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
6650
+ if (plan.project !== ctx.binding.projectId || plan.module !== businessCommand[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
6578
6651
  }
6579
- const argv = [
6652
+ const argv = d.channel === "video" ? [
6653
+ ...d.command,
6654
+ "--workspace",
6655
+ ctx.projectAnchor.storageRoot,
6656
+ "--project",
6657
+ String(ctx.binding.projectId)
6658
+ ] : [
6580
6659
  ...d.command,
6581
6660
  "--workspace",
6582
6661
  ctx.bindingDirs.workspace,
@@ -6587,7 +6666,7 @@ function createArtProvider(deps) {
6587
6666
  "--config",
6588
6667
  path9.join(ctx.bindingDirs.workspace, "settings.json")
6589
6668
  ];
6590
- if (!d.global && !d.control && !(d.command[1] === "run" && input.plan))
6669
+ if (!d.global && !d.control && !(businessCommand[1] === "run" && input.plan))
6591
6670
  argv.push("--project", String(ctx.binding.projectId));
6592
6671
  if (d.control) {
6593
6672
  const verification = verifyExecutionHandle({
@@ -6601,7 +6680,7 @@ function createArtProvider(deps) {
6601
6680
  return fail("art-handle-missing", "\u53E5\u67C4\u7F3A\u5C11\u540E\u7AEF\u8FD0\u884C\u8EAB\u4EFD");
6602
6681
  const origin = JSON.parse(readFileSync(resolveInsideProject(ctx.projectAnchor, verification.record.recordDir + "/result.json", "art.origin").path, "utf8"));
6603
6682
  if (origin.output?.result?.project !== ctx.binding.projectId || ["workspace", "output", "cache"].some((key) => origin.project?.bindingDirs?.art?.[key] !== ctx.bindingDirs?.[key])) return fail("art-handle-binding-changed", "\u8FD0\u884C\u8EAB\u4EFD\u4E0E\u5F53\u524D\u5DE5\u7A0B\u7ED1\u5B9A\u4E0D\u540C\uFF1B\u8BF7\u6062\u590D\u539F\u7ED1\u5B9A\u540E\u64CD\u4F5C");
6604
- argv.splice(2, 0, verification.record.backendTaskId);
6683
+ argv.splice(d.command.length, 0, verification.record.backendTaskId);
6605
6684
  }
6606
6685
  if (d.id === "run-wait" && input.timeout === void 0) argv.push("--timeout", "30");
6607
6686
  for (const key of d.positional ?? []) argv.push(resolveInsideProject(ctx.projectAnchor, String(input[key]), "art." + key).path);
@@ -6612,18 +6691,28 @@ function createArtProvider(deps) {
6612
6691
  String(value),
6613
6692
  "art." + key
6614
6693
  ).path : value;
6694
+ if (d.channel === "video" && key === "input") {
6695
+ try {
6696
+ const parsed = JSON.parse(readFileSync(String(actual), "utf8"));
6697
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return fail("art-video-input-invalid", "\u89C6\u9891\u8BF7\u6C42\u6587\u4EF6\u5FC5\u987B\u4E3A JSON \u5BF9\u8C61");
6698
+ videoInput = parsed;
6699
+ } catch (error) {
6700
+ return fail("art-video-input-invalid", error instanceof Error ? error.message : "\u65E0\u6CD5\u8BFB\u53D6\u89C6\u9891\u8BF7\u6C42\u6587\u4EF6");
6701
+ }
6702
+ }
6615
6703
  argv.push("--" + key);
6616
6704
  if (value !== true) argv.push(String(actual));
6617
6705
  }
6618
6706
  if (d.start && d.id !== "run-recover" && !input.dry) argv.push("--operation", ctx.operationId);
6619
- if (d.start && d.command[1] === "run" && !input.dry)
6707
+ if (d.channel === "video" && !d.readonly) argv.push("--operation", ctx.operationId);
6708
+ if (d.start && businessCommand[1] === "run" && !input.dry)
6620
6709
  argv.push("--background");
6621
6710
  const outcome = await deps.executor.run({
6622
6711
  file: process.execPath,
6623
6712
  args: [backend.bin, ...argv],
6624
6713
  cwd: ctx.projectAnchor.root,
6625
6714
  env: deps.env,
6626
- timeoutMs: d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
6715
+ timeoutMs: d.channel === "video" ? 15 * 60 * 1e3 : d.id === "environment-prepare" ? 18e5 : ["environment-verify", "environment-register"].includes(d.id) ? 72e5 : 9e4,
6627
6716
  signal: ctx.signal
6628
6717
  });
6629
6718
  let output;
@@ -6633,7 +6722,7 @@ function createArtProvider(deps) {
6633
6722
  if (!output || typeof output !== "object") throw new Error();
6634
6723
  } catch {
6635
6724
  const processState = executionFromProcess(outcome);
6636
- const uncertain = d.start || d.control || d.command[0] === "conversation" || processState.lifecycle === "unknown";
6725
+ const uncertain = d.start || d.control || businessCommand[0] === "conversation" || d.channel === "video" && !d.readonly || processState.lifecycle === "unknown";
6637
6726
  return {
6638
6727
  execution: {
6639
6728
  ...processState,
@@ -6650,8 +6739,19 @@ function createArtProvider(deps) {
6650
6739
  };
6651
6740
  }
6652
6741
  let lifecycle = executionFromProcess(outcome).lifecycle;
6653
- if (d.command[0] === "conversation" && output.stopConfirmed !== true)
6654
- lifecycle = "unknown";
6742
+ if (businessCommand[0] === "conversation" && output.stopConfirmed !== true) lifecycle = "unknown";
6743
+ if (d.channel === "video" && output.unknown === true) lifecycle = "unknown";
6744
+ if (d.channel === "video" && output.ok !== false && ["operation.run", "operation.resume", "operation.cancel"].includes(videoAction || "")) {
6745
+ const operations = Array.isArray(output.operations) ? output.operations : [];
6746
+ const operation = operations.find((value) => value.id === videoInput.operationId);
6747
+ const runs = Array.isArray(operation?.runs) ? operation.runs : [];
6748
+ const run = videoInput.requestId ? runs.find((value) => value.requestId === videoInput.requestId) : videoInput.runId ? runs.find((value) => value.id === videoInput.runId) : runs.at(-1);
6749
+ lifecycle = output.id !== videoInput.taskId || !run || typeof run.id !== "string" || !run.id || typeof run.requestId !== "string" || !run.requestId || run.status === "unknown" ? "unknown" : ["dispatching", "running"].includes(String(run.status)) ? "accepted" : run.status === "succeeded" || run.cancelled === true && run.stopConfirmed === true ? "completed" : "failed";
6750
+ }
6751
+ if (videoAction === "execution.status") {
6752
+ if (output.unknown === true || ["unknown", "executing"].includes(String(output.status))) lifecycle = "unknown";
6753
+ else if (output.status === "submitted") lifecycle = "accepted";
6754
+ }
6655
6755
  if (typeof output.taskId === "string")
6656
6756
  lifecycle = output.lifecycle ?? (d.start && !input.dry ? "accepted" : output.stopConfirmed === true ? "completed" : "unknown");
6657
6757
  return {
@@ -7539,7 +7639,7 @@ function exportToolSkill(command, options) {
7539
7639
  }
7540
7640
 
7541
7641
  // src/version.ts
7542
- var VERSION = "0.6.4";
7642
+ var VERSION = "0.7.1";
7543
7643
 
7544
7644
  // src/capability-coverage.ts
7545
7645
  function capabilityCoverage(registry) {
@@ -7585,6 +7685,7 @@ export {
7585
7685
  OperationExistsError,
7586
7686
  OperationStore,
7587
7687
  PROJECT_CLI_CONFIG_RELATIVE,
7688
+ PROJECT_STORAGE_ROOT_VERSION,
7588
7689
  PathSafetyError,
7589
7690
  REDACTION_PLACEHOLDER,
7590
7691
  UNITY_PROVIDER_ID,
@@ -0,0 +1,38 @@
1
+ # SDK 项目代码根与数据根
2
+
3
+ `PROJECT_STORAGE_ROOT_VERSION === 1` 表示 SDK 支持独立代码根和数据根。
4
+ 宿主应先检查该标志,再传入双根;旧 SDK 无法满足这一合同,不能静默丢弃 `storageRoot`。
5
+
6
+ ```ts
7
+ const anchor = resolveProjectRoot(devCheckout, undefined, { storageRoot: projectDirectory });
8
+ initProjectConfig(anchor, providers, bindings);
9
+ const loaded = loadProjectConfig(anchor, providers);
10
+ const result = await runCapability(registry, {
11
+ capabilityId,
12
+ projectRoot: devCheckout,
13
+ storageRoot: projectDirectory,
14
+ operationId,
15
+ input,
16
+ });
17
+ ```
18
+
19
+ `root` / `realRoot` 始终是当前业务 checkout。`storageRoot` / `realStorageRoot`
20
+ 只承载宿主管理的 `.vant` 数据。两者都必须是已有目录,并分别取得 realpath 锚点。
21
+ 省略数据根时,两个根相同。
22
+
23
+ `resolveInsideProject` 对普通业务路径使用代码根;`.vant` 及其子路径使用数据根,
24
+ 其中 `.vant/rules.md` 和 `.vant/rules/` 是代码输入,仍使用代码根。
25
+ 绝对路径、穿越路径和逃逸锚点的符号链接仍被拒绝。
26
+
27
+ 配置、配置备份、操作记录、默认 `.vant/art` 和视频数据因此持续位于数据根。
28
+ `art.workspace` / `output` / `cache` 若配置为 `Arts` 等业务路径,则解析到当前 checkout;
29
+ 输入、计划、导出路径也按同一规则解析。后端进程的 cwd 始终是代码根。
30
+
31
+ 新操作的 input、result 和 handle 都记录原始 `codeRoot` 与 `storageRoot`。
32
+ 句柄校验从当前数据根读取原操作证据,核对存储身份和原句柄身份,并返回 `originProject`。
33
+ 历史单根句柄以原 `project.root` 作为其存储身份;恢复不会重写原代码根,
34
+ 也不会让当前调用获得原 checkout 的业务文件路径。
35
+ 另一个数据根不能恢复该句柄。未知操作仍占用原 operationId,不会通过换根重放。
36
+
37
+ 双根解析是路径路由合同,宿主仍须独立落实文件访问授权。
38
+ SDK 路径选择不会扩大 DSH 原生会话的读写权限。
@@ -38,7 +38,7 @@ src/providers/figma/protocol.ts 按 stdout/stderr 分流解释真实工具输出
38
38
 
39
39
  src/providers/art/index.ts 解释工具 JSON,保留原 taskId/deploymentId、状态、停止确认与诊断。启动仅生成可追踪句柄,不把 queued/running 当完成。status/cancel/resume 先校验原 handle,按原 backendTaskId 路由。
40
40
 
41
- 运行结果透传 itemStates 和 resultVersion,按提交的资产及变体记录进度;批次仍 running 时已有对象可以完成,不能用批次状态覆盖逐项结果。归档与恢复使用 job-discard/job-restore,收藏使用 candidate-favorite/candidate-favorites,规则修订使用 style-revise,均通过同一结构化能力契约。
41
+ 运行结果透传 itemStates 和 resultVersion,按提交的资产及变体记录进度;批次仍 running 时已有对象可以完成,不能用批次状态覆盖逐项结果。归档与恢复使用 job-discard/job-restore,收藏使用 candidate-favorite/candidate-favorites,规则编辑使用 style-update;style-sample-job 创建样张任务,generate-plan 确定性编译当前规则;风格分析、报告决策和采用入口已移除,均通过同一结构化能力契约。
42
42
 
43
43
  图片协议与参数由 art 工具的 model-registry/generation-policy/adapters 负责。v-cli 不根据 Qwen/Wan 名称、provider 名或订阅渠道猜测请求格式。明确失败、停止未知、上游已完成待下载分别保留,不自动重发。
44
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevlns/v-cli",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "description": "提供工具发现、插件路由、工程绑定、结构化能力执行和操作证据管理。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  "toolbox"
59
59
  ],
60
60
  "dependencies": {
61
- "@kevlns/art-workshop": "0.5.2",
61
+ "@kevlns/art-workshop": "0.6.1",
62
62
  "@kevlns/figma-to-uprefab": "0.1.4",
63
63
  "@kevlns/ship-cli": "0.1.2",
64
64
  "@kevlns/u-cli-mod": "0.3.1",
@@ -18,7 +18,7 @@
18
18
 
19
19
  ### 核心约定(v-cli 本体)
20
20
 
21
- - 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.6.4
21
+ - 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.7.1
22
22
  - 命令分三类:builtin(内置)、local(~/.vant/tools/v-cli/commands/ 下的本地插件)、official(官方插件白名单);
23
23
  **命令集合以实际发现为准**:先运行 `v-cli agent index --json` 获取全部命令与 agent 元数据
24
24
  - 单个命令的完整元数据用 `v-cli agent describe <命令名> --json` 查看
@@ -45,11 +45,11 @@
45
45
 
46
46
  ### @kevlns/art-workshop — 命令 `v-cli art …`
47
47
 
48
- **版本**:0.5.2
49
- **描述**:管理项目风格、参考图、图片生成、编辑和定版。支持本地 ComfyUI 与远程图片模型。
48
+ **版本**:0.6.1
49
+ **描述**:管理图片与视频两个独立制作通道;图片旧命令兼容,视频复用项目状态、CAS及原执行身份。
50
50
  **平台**:win32, linux, darwin
51
51
 
52
- **何时使用**:先读取对象和版本,编译并预演后在授权范围后台执行。风格分析有独立运行身份,采用检查报告来源;任务空闲才可编辑,停止未确认保留资源。生成完成仅做技术完整性校验,用户定版,不要求人工三维评分。
52
+ **何时使用**:读取对象和版本,保存规则即更新当前风格。按规则生成样张,在图片卡片上定版后自动加入风格运行时参考;原始分主题参考只用于分析。生成先编译预演,未知运行只恢复原身份。
53
53
 
54
54
  **首次调用前必读**:`v-cli agent docs art`(插件包内 清单声明的 SKILL.md)
55
55
  **实时参数/命令**:`v-cli agent describe art --json`