@aswless_854771076/ai_short_studio_cli 0.1.158 → 0.1.160
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 +35 -5
- package/dist/command-helpers.js +1 -0
- package/dist/commands/canvas/asset/audit.d.ts +14 -0
- package/dist/commands/canvas/asset/audit.js +90 -0
- package/dist/commands/canvas/asset/select.d.ts +1 -0
- package/dist/commands/canvas/asset/select.js +1 -0
- package/dist/commands/canvas/continuity/analyze.js +1 -1
- package/dist/commands/canvas/document/save.d.ts +1 -0
- package/dist/commands/canvas/document/save.js +14 -0
- package/dist/commands/canvas/settings/set.d.ts +1 -0
- package/dist/commands/canvas/settings/set.js +2 -1
- package/dist/commands/preflight.js +28 -0
- package/dist/commands/skill/diff.d.ts +16 -0
- package/dist/commands/skill/diff.js +17 -0
- package/dist/domain/canvas-asset-audit.d.ts +53 -0
- package/dist/domain/canvas-asset-audit.js +112 -0
- package/dist/domain/canvas-document-contract.d.ts +49 -0
- package/dist/domain/canvas-document-contract.js +94 -0
- package/dist/skill/skill-manager.d.ts +64 -0
- package/dist/skill/skill-manager.js +69 -5
- package/package.json +1 -1
- package/scripts/postinstall.mjs +6 -1
- package/skills/using-vvicat-ai-short-studio-cli/SKILL.md +5 -3
- package/skills/using-vvicat-ai-short-studio-cli/references/assets-and-storyboard.md +8 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/canvas-inspection.md +10 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/canvas-media-gates.md +39 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/canvas-production-principles.md +11 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/commands/assets-and-tasks.md +3 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/commands/canvas.md +4 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/commands/project.md +3 -1
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/SKILL.md +3 -3
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/assets/modules/define-drama-brief/prompts/drama_brief.en.txt +3 -3
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/assets/modules/define-drama-brief/prompts/drama_brief.zh.txt +3 -3
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/feature-completeness.md +2 -2
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/generation/write-drama-video-prompts.md +1 -1
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/module-map.json +130 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/pipeline.md +25 -0
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/prompt/seedance-prompting.md +1 -1
- package/skills/using-vvicat-ai-short-studio-cli/references/short-drama/storyboard/plan-shot-continuity.md +3 -3
package/README.md
CHANGED
|
@@ -7,23 +7,35 @@ npm view @aswless_854771076/ai_short_studio_cli dist-tags.latest
|
|
|
7
7
|
npm install --global @aswless_854771076/ai_short_studio_cli@latest
|
|
8
8
|
ai-short-studio --version
|
|
9
9
|
ai-short-studio auth login
|
|
10
|
+
ai-short-studio auth login --provider supabase
|
|
10
11
|
ai-short-studio project list --json
|
|
11
12
|
ai-short-studio canvas node types --json
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
npm 包只内置一个 `using-vvicat-ai-short-studio-cli` Agent Skill。短剧和 humanizer 等参考资料统一放在该 Skill 的 `references/` 下。安装或升级 CLI 时,`postinstall` 会自动安装或更新这个 Skill;用户修改过或不由 CLI 管理的副本不会被覆盖。设置 `VVICAT_SKIP_SKILL_INSTALL=1` 可关闭自动安装。
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
短剧默认采用专业拆镜,逐镜保留时间宫格与镜头故事版;`count: 1` 不表示单格,用户要求只完成分镜图时不执行视频提示词或视频。`canvas node edit-shot` 会同步镜头字段别名并拒绝改写来源原文;修改时长后检查响应的 `durationOverrides`,保留的下游手工时长需要逐项确认。普通单帧不能提交为专业双板审核。
|
|
17
18
|
|
|
18
19
|
`skill install/status/update` 管理这个唯一 Skill。短剧创作、humanizer 审计和自由画布视频制作资料通过主 Skill 的 references 按需读取。
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
`references/canvas-production-principles.md`、`references/canvas-inspection.md` 与 `references/canvas-media-gates.md` 是 CLI 与内置 Agent 共用的业务经验正文;CLI 继续按原命令合同执行。内置接入仍在开发验证,不代表侧栏已可用。
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
生产环境登录使用 MemHub 浏览器授权;兼容 Supabase 的邮箱注册和登录从 stdin 读取密码:
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
```bash
|
|
26
|
+
ai-short-studio auth signup --provider supabase --email user@example.com --password-stdin
|
|
27
|
+
ai-short-studio auth login --provider supabase --email user@example.com --password-stdin
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Agent 代操作时,用户已在当前会话明确提供的密码只能直接写入正在等待的隐藏密码提示,不得复述、拼入 shell 命令、落盘或跨会话保存。
|
|
31
|
+
|
|
32
|
+
注册响应中的 `confirmationRequired` 表示是否需要先完成邮件验证。Supabase 直接返回会话时,CLI 会立即登录并把 refresh token 保存到系统钥匙串;需要邮件验证时不会写入空凭据,验证后再执行登录。MemHub 登录成功后使用短期 API Key 访问服务。
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
注册确认链接使用当前 profile 的 `baseUrl` 和 `--locale`,指向同域的 `/{locale}/auth/callback`。API 与网页需保持同域,并在 Supabase Redirect URLs 中允许各环境的 `/**`;Site URL 只作为未显式传入回调时的生产兜底。
|
|
35
|
+
|
|
36
|
+
CLI 只把 refresh token 保存到系统钥匙串。短期 access token 会写入权限为 `0600` 的本机 session 缓存;同一 profile 的并发进程通过跨进程锁共享刷新结果,只有缓存缺失或确实需要刷新时才访问钥匙串,从而避免 Agent 批量操作反复触发 macOS Keychain。退出登录会清除该缓存,CI 可用 `VVICAT_ACCESS_TOKEN` 直接注入临时令牌。未配置服务地址时默认连接 `https://ai-short-studio.vvicat.dev`,`--base-url`、`VVICAT_BASE_URL` 和当前 profile 可依次覆盖。首次登录会从服务端 bootstrap 取得 Supabase 公共配置,也可用 `VVICAT_SUPABASE_URL`、`VVICAT_SUPABASE_PUBLISHABLE_KEY` 显式覆盖。Google 登录在 Windows 上直接调用系统 URL Handler,确保带 `&` 的 PKCE 授权参数完整传给浏览器。服务地址和非敏感 profile 写入系统配置目录;切换环境时必须使用独立的 `--profile`,避免复用旧认证。
|
|
37
|
+
|
|
38
|
+
创作前运行 `ai-short-studio preflight --json`。CLI 会通过公开的 `/api/v1/bootstrap` 检查服务连通性、取得 Supabase 公共配置、读取 npm `latest` 稳定版本并自动更新全局 CLI;更新成功后按输出重新运行。临时不更新时传 `--no-update`。随后预检检查登录态和文本、人物、场景、故事版、视频模型配置。npm registry 暂时不可用时服务端使用配置版本降级。
|
|
27
39
|
|
|
28
40
|
## 命令范围
|
|
29
41
|
|
|
@@ -171,6 +183,14 @@ ai-short-studio skill update --target codex --json
|
|
|
171
183
|
|
|
172
184
|
手动恢复或安装到其他 Agent 时,可使用 `--target agents`;自定义全部内置 Skills 的父目录使用 `--root <path>`。旧版 `--directory <path>` 保留为兼容入口,只把主 CLI Skill 精确安装到该目录。自动安装对应使用 `VVICAT_SKILLS_ROOT`;旧变量 `VVICAT_SKILL_DIRECTORY` 仍保持主 Skill 精确目录语义。CLI 会记录版本和 SHA-256;已安装 Skill 被用户修改后,更新默认停止,只有显式 `--force` 才覆盖。自动安装可通过 `VVICAT_SKIP_SKILL_INSTALL=1` 跳过。
|
|
173
185
|
|
|
186
|
+
自动安装被跳过时,`skill status`、`skill update`、`skill diff` 和 postinstall 输出都会带上 `state` 与跳过原因,避免 CLI 升级后 Skill 悄悄停在旧版本:`current` 表示版本与校验和都与随包一致;`outdated` 表示托管目录的清单版本低于当前 CLI;`modified` 表示目录内容与安装时记录的校验和不一致(用户改动或混入其他文件);`unmanaged` 表示目录没有 CLI 清单;`missing` 表示未安装。
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
ai-short-studio skill diff --target codex --json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`skill diff` 对照随包版本列出 `changed`(内容不同)、`extra`(本地新增)和 `missing`(随包有而本地没有)的文件,供用户决定手工合并还是 `skill install --force` 覆盖。`preflight --json` 会返回 `skill` 块,其中 `skillReady` 只有在 `state === "current"` 时为真;未就绪时 `nextAction` 给出下一步命令,Agent 应在处理完 Skill 版本前停止创作。
|
|
193
|
+
|
|
174
194
|
## 发布
|
|
175
195
|
|
|
176
196
|
使用具有发布权限并允许 bypass 2FA 的 npm Granular Access Token:
|
|
@@ -217,8 +237,18 @@ npm run release:ci:test -- --version 0.1.1-beta.0
|
|
|
217
237
|
|
|
218
238
|
新项目先运行 `canvas documents` 和 `canvas workflow status`,由 Agent 在无限画布创建 自由画布 JSON 文档;用 `canvas document save` 追加版本,用 `canvas document status` 检查上游选版。`canvas node diagnose <nodeId>` 仅用于历史媒体节点的恢复,不是新流程入口。完整操作见随包 Skill 的 自由画布文档流程。
|
|
219
239
|
|
|
240
|
+
`canvas document save` 在发出任何远程请求前按随包 `module-map.json` 的 `documents` 合同核对正文:登记的文档键缺少必需顶层字段,或 `non_empty` 字段为空时直接失败,并指出应先读取的模板路径。阶段状态只看文档键、版本和来源快照,不校验正文,因此只写摘要一类的占位文档会让阶段显示 `ready` 却向下游传递空分析。只有用户明确要求保存半成品草稿时才加 `--allow-partial`,该版本会被警告为不得作为阶段依据。
|
|
241
|
+
|
|
242
|
+
`canvas asset audit --project <projectId> --json` 补齐资产生成前的机器门禁:读取已就绪的资产计划文档和画布节点、连线,按人物、场景、道具逐类核对是否使用了对应的设定板节点(`character-turnaround`、`location-image`、`prop-turnaround`),而不是透明边界的 `image-generate`;同时检查设定板的 `prompt` 端口是否来自结构化设定节点、是否接线、是否手写了 `config.prompt`。存在失败项时退出码为 7,`errors[].nodeIds` 直接指出要重建的节点;计划文档未就绪时返回 `blocked: "asset-plan-not-ready"`。同一项目有多份资产计划时用 `--document-key` 指定。该命令只做跨节点事实核对——缺少必需端口由服务端在提交时拒绝,不在本命令范围内。
|
|
243
|
+
|
|
220
244
|
Use `canvas node diagnose` to inspect inputs, selected versions, task status and recovery actions without running a model. `canvas node storyboard-draft` reads an unapproved planning draft; `--file` submits explicit edit/promote requests and `--dry-run` previews them. Content errors do not prevent draft saves. Promotion validates the complete plan; draft saves neither change the formal selection nor generate media. See the bundled Skill's `references/agent-recovery.md`. Image quality is inspected by a person or Agent; the platform checks review records and provenance, rather than detecting visual defects automatically.
|
|
221
245
|
|
|
222
246
|
Agent 可直接在 `text-resource` 节点保存剧本、导演本和制作计划等自由画布文档(文档结构由平台画布统一校验);每次保存都通过 `--input` 固化上游版本,审核使用独立 `canvas.review.v1` 文档。历史 `screenplay-resource` 和 `storyboard-draft` 只用于迁移旧项目,不得用于新项目。
|
|
223
247
|
|
|
224
248
|
Agents author freeform JSON documents directly in `text-resource` nodes and preserve every source version through `--input`; legacy screenplay resources and storyboard drafts are migration-only compatibility paths.
|
|
249
|
+
|
|
250
|
+
`canvas asset select-version`(或 `asset select`)修改资产全局选版,不覆盖节点的固定输出版本。网页节点“查看版本”和内置助手的 `canvas_select_version` 只切换当前节点,保留兄弟节点与全局选版,并使下游过期;运行中节点不能切版。读取或编辑节点时优先使用 `selectedOutputVersionId`。本次没有新增 CLI 节点切版命令,不能用普通配置补丁代替。
|
|
251
|
+
|
|
252
|
+
画布 settings 管理制作配置,不修改内置助手 agentModel;项目 outputLanguage 创建后不可改。null 只对可覆盖字段恢复默认。内置助手使用专用工具复用同一保存服务,CLI 继续使用 canvas settings get/set。
|
|
253
|
+
|
|
254
|
+
连续性 --apply-ready 只配置尾帧提取节点和连线,不运行媒体任务。网页、CLI与内置助手复用同一分析规则;读取图和设置版本不一致时重新分析,不覆盖新图。内置助手的专用工具额外核对分析指纹和指定建议。
|
package/dist/command-helpers.js
CHANGED
|
@@ -22,6 +22,7 @@ export function canvasEditConflictReason(error) {
|
|
|
22
22
|
return reason === 'CANVAS_VERSION_CONFLICT' || reason === 'ASSET_VERSION_RACE' ? reason : null;
|
|
23
23
|
}
|
|
24
24
|
export async function resolveCanvasNodeVersionId(api, projectId, node) {
|
|
25
|
+
// 普通媒体和结构化资源都可固定节点选版,不能被资产全局选版替代。
|
|
25
26
|
const selectedOutputVersionId = node.data.selectedOutputVersionId;
|
|
26
27
|
if (typeof selectedOutputVersionId === 'string' && selectedOutputVersionId) {
|
|
27
28
|
return selectedOutputVersionId;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
2
|
+
export default class CanvasAssetAudit extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'document-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
locale: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
episode: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { commandApi, projectFlag } from '../../../command-helpers.js';
|
|
4
|
+
import { auditAssets } from '../../../domain/canvas-asset-audit.js';
|
|
5
|
+
function isAssetPlanKey(key, requested) {
|
|
6
|
+
if (requested)
|
|
7
|
+
return key === requested || key.endsWith(`.${requested}`);
|
|
8
|
+
return key === 'asset-plan' || key.endsWith('.asset-plan');
|
|
9
|
+
}
|
|
10
|
+
function selectedVersionText(payload) {
|
|
11
|
+
const asset = payload.asset && typeof payload.asset === 'object' && !Array.isArray(payload.asset)
|
|
12
|
+
? payload.asset : null;
|
|
13
|
+
const version = asset?.selectedVersion && typeof asset.selectedVersion === 'object' && !Array.isArray(asset.selectedVersion)
|
|
14
|
+
? asset.selectedVersion : null;
|
|
15
|
+
const text = version?.textContent;
|
|
16
|
+
if (typeof text !== 'string')
|
|
17
|
+
throw new Error('资产计划文档没有选定版本正文');
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
20
|
+
export default class CanvasAssetAudit extends BaseCommand {
|
|
21
|
+
static description = '按资产计划核对画布设定板节点,拦截用 image-generate 冒充资产设定';
|
|
22
|
+
static flags = {
|
|
23
|
+
...BaseCommand.baseFlags,
|
|
24
|
+
project: projectFlag,
|
|
25
|
+
'document-key': Flags.string({ description: '资产计划文档键;默认匹配以 asset-plan 结尾的文档' }),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { flags } = await this.parse(CanvasAssetAudit);
|
|
29
|
+
const { api } = await commandApi(flags);
|
|
30
|
+
const payload = await api.canvasDocuments(flags.project);
|
|
31
|
+
const documents = Array.isArray(payload.documents) ? payload.documents : [];
|
|
32
|
+
const candidates = documents.filter((item) => typeof item.documentKey === 'string'
|
|
33
|
+
&& isAssetPlanKey(item.documentKey, flags['document-key']));
|
|
34
|
+
if (candidates.length === 0) {
|
|
35
|
+
this.print({
|
|
36
|
+
ok: true,
|
|
37
|
+
skipped: 'no-asset-plan',
|
|
38
|
+
message: '画布上没有资产计划文档;资产阶段开始前无需核对。',
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const ready = candidates.find((item) => item.status?.ready === true);
|
|
43
|
+
const document = ready ?? candidates[0];
|
|
44
|
+
if (!document || typeof document.nodeId !== 'string')
|
|
45
|
+
throw new Error('资产计划文档缺少节点 ID');
|
|
46
|
+
if (document.status?.ready !== true) {
|
|
47
|
+
// 用未就绪的计划做核对会给出假的通过结论,必须先修文档来源。
|
|
48
|
+
this.print({
|
|
49
|
+
ok: false,
|
|
50
|
+
blocked: 'asset-plan-not-ready',
|
|
51
|
+
nodeId: document.nodeId,
|
|
52
|
+
documentKey: document.documentKey,
|
|
53
|
+
reason: document.status?.reason ?? null,
|
|
54
|
+
message: '资产计划文档未就绪(缺少版本、来源快照过期或正文无效);先修复该文档再核对资产节点。',
|
|
55
|
+
});
|
|
56
|
+
this.error('资产计划文档未就绪,资产门禁未执行', { exit: 7 });
|
|
57
|
+
}
|
|
58
|
+
const node = await api.node(flags.project, document.nodeId);
|
|
59
|
+
if (node.kind !== 'text-resource' || typeof node.refId !== 'string')
|
|
60
|
+
throw new Error('资产计划节点不是已保存的画布文档');
|
|
61
|
+
const assetPayload = await api.asset(flags.project, node.refId);
|
|
62
|
+
const textContent = selectedVersionText(assetPayload);
|
|
63
|
+
let plan;
|
|
64
|
+
try {
|
|
65
|
+
plan = JSON.parse(textContent);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
throw new Error('资产计划文档正文不是合法 JSON');
|
|
69
|
+
}
|
|
70
|
+
const canvas = await api.inspectCanvas(flags.project, { includes: ['nodes', 'edges'] });
|
|
71
|
+
const nodes = (Array.isArray(canvas.nodes) ? canvas.nodes : [])
|
|
72
|
+
.map((item) => ({
|
|
73
|
+
id: String(item.id),
|
|
74
|
+
kind: String(item.kind),
|
|
75
|
+
title: typeof item.title === 'string' ? item.title : undefined,
|
|
76
|
+
config: item.data?.config,
|
|
77
|
+
}));
|
|
78
|
+
const edges = (Array.isArray(canvas.edges) ? canvas.edges : [])
|
|
79
|
+
.map((item) => ({
|
|
80
|
+
sourceNodeId: String(item.sourceNodeId),
|
|
81
|
+
targetNodeId: String(item.targetNodeId),
|
|
82
|
+
targetHandle: typeof item.targetHandle === 'string' ? item.targetHandle : null,
|
|
83
|
+
}));
|
|
84
|
+
const result = auditAssets({ nodes, edges, plan });
|
|
85
|
+
this.print({ ...result, documentKey: document.documentKey, documentNodeId: document.nodeId });
|
|
86
|
+
if (!result.ok) {
|
|
87
|
+
this.error(`资产门禁未通过:${result.errors.map((item) => item.code).join('、')}`, { exit: 7 });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Args, Flags } from '@oclif/core';
|
|
|
2
2
|
import { BaseCommand } from '../../../base-command.js';
|
|
3
3
|
import { commandApi, projectFlag } from '../../../command-helpers.js';
|
|
4
4
|
export default class CanvasAssetSelect extends BaseCommand {
|
|
5
|
+
static description = '设置资产全局选版;不覆盖节点已固定的输出版本';
|
|
5
6
|
static args = { assetId: Args.string({ required: true }) };
|
|
6
7
|
static flags = { ...BaseCommand.baseFlags, project: projectFlag, version: Flags.string({ required: true }) };
|
|
7
8
|
async run() { const { args, flags } = await this.parse(CanvasAssetSelect); const { api } = await commandApi(flags); this.print(await api.selectAssetVersion(flags.project, args.assetId, flags.version)); }
|
|
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { BaseCommand } from '../../../base-command.js';
|
|
3
3
|
import { commandApi, projectFlag } from '../../../command-helpers.js';
|
|
4
4
|
export default class CanvasContinuityAnalyze extends BaseCommand {
|
|
5
|
-
static description = '
|
|
5
|
+
static description = '只读分析镜头依赖;显式 --apply-ready 仅创建尾帧链,不运行媒体任务';
|
|
6
6
|
static flags = {
|
|
7
7
|
...BaseCommand.baseFlags,
|
|
8
8
|
project: projectFlag,
|
|
@@ -11,6 +11,7 @@ export default class CanvasDocumentSave extends BaseCommand {
|
|
|
11
11
|
'schema-key': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
'document-key': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
13
|
input: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'allow-partial': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
15
|
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
16
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
locale: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -2,6 +2,7 @@ import { Args, Flags } from '@oclif/core';
|
|
|
2
2
|
import { BaseCommand } from '../../../base-command.js';
|
|
3
3
|
import { commandApi, projectFlag, readJsonInput } from '../../../command-helpers.js';
|
|
4
4
|
import { assertCanvasSchemaKey } from '../../../domain/canvas-schema-key.js';
|
|
5
|
+
import { validateCanvasDocumentContent } from '../../../domain/canvas-document-contract.js';
|
|
5
6
|
export default class CanvasDocumentSave extends BaseCommand {
|
|
6
7
|
static description = '将 JSON 保存为画布文本资源的不可变文档版本';
|
|
7
8
|
static args = { nodeId: Args.string({ required: true }) };
|
|
@@ -13,6 +14,10 @@ export default class CanvasDocumentSave extends BaseCommand {
|
|
|
13
14
|
'schema-key': Flags.string({ required: true, description: '画布文档结构版本,例如 canvas.brief.v1' }),
|
|
14
15
|
'document-key': Flags.string({ required: true, description: '项目内稳定文档键,例如 brief 或 ep-001.script' }),
|
|
15
16
|
input: Flags.string({ multiple: true, description: '依据的上游节点 ID,可重复指定' }),
|
|
17
|
+
'allow-partial': Flags.boolean({
|
|
18
|
+
description: '仅保存用户明确要求的不完整草稿时使用;保存后该版本不得作为阶段依据',
|
|
19
|
+
default: false,
|
|
20
|
+
}),
|
|
16
21
|
};
|
|
17
22
|
async run() {
|
|
18
23
|
const { args, flags } = await this.parse(CanvasDocumentSave);
|
|
@@ -22,6 +27,15 @@ export default class CanvasDocumentSave extends BaseCommand {
|
|
|
22
27
|
this.warn(`--schema-key 的旧前缀已归一化为 ${schemaKey},请改用 canvas.* 合同键。`);
|
|
23
28
|
}
|
|
24
29
|
const content = await readJsonInput(flags.file);
|
|
30
|
+
// 阶段状态只核对文档键和来源快照,不看正文;在本地按随包模板拦下占位文档。
|
|
31
|
+
const validation = await validateCanvasDocumentContent({
|
|
32
|
+
documentKey: flags['document-key'],
|
|
33
|
+
schemaKey,
|
|
34
|
+
content,
|
|
35
|
+
allowPartial: flags['allow-partial'],
|
|
36
|
+
});
|
|
37
|
+
for (const warning of validation.warnings)
|
|
38
|
+
this.warn(warning);
|
|
25
39
|
const { api } = await commandApi(flags);
|
|
26
40
|
const node = await api.node(flags.project, args.nodeId);
|
|
27
41
|
if (node.kind !== 'text-resource')
|
|
@@ -8,6 +8,7 @@ type ReadInput = (file?: string) => Promise<Record<string, unknown>>;
|
|
|
8
8
|
export declare function parseSettingFlagValue(value: string): unknown;
|
|
9
9
|
export declare function buildCanvasSettingsInput(flags: CanvasSettingsFlags, readInput?: ReadInput): Promise<Record<string, unknown>>;
|
|
10
10
|
export default class CanvasSettingsSet extends BaseCommand {
|
|
11
|
+
static description: string;
|
|
11
12
|
static flags: {
|
|
12
13
|
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
field: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -40,10 +40,11 @@ export async function buildCanvasSettingsInput(flags, readInput = readJsonInput)
|
|
|
40
40
|
return readInput(flags.file);
|
|
41
41
|
}
|
|
42
42
|
export default class CanvasSettingsSet extends BaseCommand {
|
|
43
|
+
static description = '修改画布制作设置;不修改助手模型,项目输出语言不可更改';
|
|
43
44
|
static flags = {
|
|
44
45
|
...BaseCommand.baseFlags,
|
|
45
46
|
project: projectFlag,
|
|
46
|
-
field: Flags.string({ description: '
|
|
47
|
+
field: Flags.string({ description: '要更新的画布字段;null 清除覆盖并继承默认,outputLanguage 只允许项目原语言', dependsOn: ['value'], exclusive: ['file'] }),
|
|
47
48
|
value: Flags.string({ description: '字段值', dependsOn: ['field'], exclusive: ['file'] }),
|
|
48
49
|
file: Flags.string({ description: '设置 JSON 文件;省略时读取 stdin', exclusive: ['field', 'value'] }),
|
|
49
50
|
};
|
|
@@ -4,6 +4,7 @@ import { ProfileStore } from '../config/profiles.js';
|
|
|
4
4
|
import { VvicatApi } from '../domain/vvicat-api.js';
|
|
5
5
|
import { createRuntime, DEFAULT_BASE_URL } from '../runtime.js';
|
|
6
6
|
import { compareStableVersions, fetchBootstrap, inspectCreationConfig, readCurrentPackageIdentity, updateCliPackage, } from '../preflight.js';
|
|
7
|
+
import { skillGate } from '../skill/skill-manager.js';
|
|
7
8
|
export default class Preflight extends BaseCommand {
|
|
8
9
|
static description = '创作前检查 CLI、服务连接、认证和模型配置';
|
|
9
10
|
static flags = {
|
|
@@ -30,11 +31,21 @@ export default class Preflight extends BaseCommand {
|
|
|
30
31
|
latestVersion: bootstrap.cli.latestVersion,
|
|
31
32
|
};
|
|
32
33
|
if (version.restartRequired) {
|
|
34
|
+
// 刚升级的 CLI 尚未由新进程执行过 postinstall,Skill 很可能仍是旧版;这里直接暴露状态。
|
|
35
|
+
const pendingSkill = await skillGate();
|
|
33
36
|
this.print({
|
|
34
37
|
connected: true,
|
|
35
38
|
profile: selected?.name ?? null,
|
|
36
39
|
baseUrl,
|
|
37
40
|
version,
|
|
41
|
+
skill: {
|
|
42
|
+
state: pendingSkill.state,
|
|
43
|
+
target: pendingSkill.target,
|
|
44
|
+
installedVersion: pendingSkill.installedVersion,
|
|
45
|
+
packageVersion: pendingSkill.packageVersion,
|
|
46
|
+
modified: pendingSkill.modified,
|
|
47
|
+
skillReady: pendingSkill.skillReady,
|
|
48
|
+
},
|
|
38
49
|
ready: false,
|
|
39
50
|
nextAction: '重新运行 ai-short-studio preflight --json',
|
|
40
51
|
});
|
|
@@ -43,6 +54,7 @@ export default class Preflight extends BaseCommand {
|
|
|
43
54
|
const runtime = await createRuntime(flags);
|
|
44
55
|
await runtime.client.request('/api/auth/session');
|
|
45
56
|
const readiness = inspectCreationConfig(await new VvicatApi(runtime.client).config());
|
|
57
|
+
const skill = await skillGate();
|
|
46
58
|
this.print({
|
|
47
59
|
connected: true,
|
|
48
60
|
profile: selected?.name ?? null,
|
|
@@ -50,6 +62,22 @@ export default class Preflight extends BaseCommand {
|
|
|
50
62
|
authenticated: true,
|
|
51
63
|
updateAvailable: hasUpdate,
|
|
52
64
|
version,
|
|
65
|
+
// CLI 升级不会自动覆盖用户改过的 Skill;这里把"CLI 新、Skill 旧"变成显式停止条件。
|
|
66
|
+
skill: {
|
|
67
|
+
state: skill.state,
|
|
68
|
+
target: skill.target,
|
|
69
|
+
installedVersion: skill.installedVersion,
|
|
70
|
+
packageVersion: skill.packageVersion,
|
|
71
|
+
modified: skill.modified,
|
|
72
|
+
skillReady: skill.skillReady,
|
|
73
|
+
},
|
|
74
|
+
...(skill.skillReady
|
|
75
|
+
? {}
|
|
76
|
+
: {
|
|
77
|
+
nextAction: skill.state === 'missing'
|
|
78
|
+
? '运行 ai-short-studio skill install --target <codex|agents> 后再创作'
|
|
79
|
+
: '先运行 ai-short-studio skill diff 核对差异,再决定保留并手工合并或 skill install --force;不得在旧 Skill 上继续创作',
|
|
80
|
+
}),
|
|
53
81
|
...readiness,
|
|
54
82
|
});
|
|
55
83
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class SkillDiff extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
target: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
directory: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
root: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
skill: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
locale: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
episode: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
import { diffSkill } from '../../skill/skill-manager.js';
|
|
3
|
+
import { resolveSkillsRoot, selectedSkillNames, skillFlags } from '../../skill/command-flags.js';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
export default class SkillDiff extends BaseCommand {
|
|
6
|
+
static description = '列出已安装 Skill 相对随包版本缺失、多出和内容不同的文件';
|
|
7
|
+
static flags = { ...BaseCommand.baseFlags, ...skillFlags };
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = await this.parse(SkillDiff);
|
|
10
|
+
const root = resolveSkillsRoot(flags);
|
|
11
|
+
const results = [];
|
|
12
|
+
for (const name of selectedSkillNames(flags.skill)) {
|
|
13
|
+
results.push(await diffSkill(flags.directory ?? join(root, name)));
|
|
14
|
+
}
|
|
15
|
+
this.print(results.length === 1 && flags.directory ? results[0] : { root, skills: results });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 资产阶段的结构性核对。
|
|
3
|
+
*
|
|
4
|
+
* 服务端在提交生成时只校验单节点的必需端口(例如 `CANVAS_REQUIRED_INPUT_MISSING:prompt`),
|
|
5
|
+
* 看不到"资产计划声明了 12 个人物,画布上却一个 character-turnaround 都没有"这类跨节点事实,
|
|
6
|
+
* 也看不出设定资产被塞进了透明的 image-generate 节点。这里把这些事实做成可复现的失败项,
|
|
7
|
+
* 让资产门禁能在付费提交之前失败,而不是等用户在成片里看到不像同一张脸。
|
|
8
|
+
*/
|
|
9
|
+
export interface AssetAuditNode {
|
|
10
|
+
id: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
config?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface AssetAuditEdge {
|
|
16
|
+
sourceNodeId: string;
|
|
17
|
+
targetNodeId: string;
|
|
18
|
+
targetHandle?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface AssetAuditPlan {
|
|
21
|
+
characters?: unknown;
|
|
22
|
+
scenes?: unknown;
|
|
23
|
+
props?: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface AssetAuditIssue {
|
|
26
|
+
code: string;
|
|
27
|
+
severity: 'error' | 'warning';
|
|
28
|
+
message: string;
|
|
29
|
+
nodeIds: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface AssetAuditResult {
|
|
32
|
+
ok: boolean;
|
|
33
|
+
errors: AssetAuditIssue[];
|
|
34
|
+
warnings: AssetAuditIssue[];
|
|
35
|
+
counts: {
|
|
36
|
+
planned: {
|
|
37
|
+
characters: number;
|
|
38
|
+
scenes: number;
|
|
39
|
+
props: number;
|
|
40
|
+
};
|
|
41
|
+
sheets: {
|
|
42
|
+
characters: number;
|
|
43
|
+
scenes: number;
|
|
44
|
+
props: number;
|
|
45
|
+
};
|
|
46
|
+
imageGenerate: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export declare function auditAssets(input: {
|
|
50
|
+
nodes: AssetAuditNode[];
|
|
51
|
+
edges: AssetAuditEdge[];
|
|
52
|
+
plan: AssetAuditPlan;
|
|
53
|
+
}): AssetAuditResult;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 资产阶段的结构性核对。
|
|
3
|
+
*
|
|
4
|
+
* 服务端在提交生成时只校验单节点的必需端口(例如 `CANVAS_REQUIRED_INPUT_MISSING:prompt`),
|
|
5
|
+
* 看不到"资产计划声明了 12 个人物,画布上却一个 character-turnaround 都没有"这类跨节点事实,
|
|
6
|
+
* 也看不出设定资产被塞进了透明的 image-generate 节点。这里把这些事实做成可复现的失败项,
|
|
7
|
+
* 让资产门禁能在付费提交之前失败,而不是等用户在成片里看到不像同一张脸。
|
|
8
|
+
*/
|
|
9
|
+
// 资产种类到设定板节点、允许的结构化设定来源的固定对应;改这里等于改资产门禁。
|
|
10
|
+
const ASSET_CATEGORIES = [
|
|
11
|
+
{
|
|
12
|
+
category: 'characters',
|
|
13
|
+
label: '人物',
|
|
14
|
+
sheetKind: 'character-turnaround',
|
|
15
|
+
sourceKinds: ['character-visual-design', 'character-resource', 'character-design'],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
category: 'scenes',
|
|
19
|
+
label: '场景',
|
|
20
|
+
sheetKind: 'location-image',
|
|
21
|
+
sourceKinds: ['location-resource', 'location-design'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
category: 'props',
|
|
25
|
+
label: '道具',
|
|
26
|
+
sheetKind: 'prop-turnaround',
|
|
27
|
+
sourceKinds: ['prop-resource', 'prop-design'],
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const TRANSPARENT_IMAGE_KIND = 'image-generate';
|
|
31
|
+
function planCount(plan, category) {
|
|
32
|
+
const value = plan[category];
|
|
33
|
+
return Array.isArray(value) ? value.length : 0;
|
|
34
|
+
}
|
|
35
|
+
function hasPromptInput(nodeId, edges) {
|
|
36
|
+
// 旧画布可能没有 targetHandle,此时任何入边都按已接线处理,避免误报。
|
|
37
|
+
return edges.some((edge) => edge.targetNodeId === nodeId
|
|
38
|
+
&& (edge.targetHandle === 'prompt' || !edge.targetHandle));
|
|
39
|
+
}
|
|
40
|
+
function promptSourceKind(nodeId, edges, kindById) {
|
|
41
|
+
const edge = edges.find((item) => item.targetNodeId === nodeId
|
|
42
|
+
&& (item.targetHandle === 'prompt' || !item.targetHandle));
|
|
43
|
+
return edge ? kindById.get(edge.sourceNodeId) ?? null : null;
|
|
44
|
+
}
|
|
45
|
+
export function auditAssets(input) {
|
|
46
|
+
const kindById = new Map(input.nodes.map((node) => [node.id, node.kind]));
|
|
47
|
+
const errors = [];
|
|
48
|
+
const warnings = [];
|
|
49
|
+
const imageGenerateIds = input.nodes.filter((node) => node.kind === TRANSPARENT_IMAGE_KIND).map((node) => node.id);
|
|
50
|
+
const counts = {
|
|
51
|
+
planned: { characters: 0, scenes: 0, props: 0 },
|
|
52
|
+
sheets: { characters: 0, scenes: 0, props: 0 },
|
|
53
|
+
imageGenerate: imageGenerateIds.length,
|
|
54
|
+
};
|
|
55
|
+
for (const { category, label, sheetKind, sourceKinds } of ASSET_CATEGORIES) {
|
|
56
|
+
const planned = planCount(input.plan, category);
|
|
57
|
+
const sheets = input.nodes.filter((node) => node.kind === sheetKind);
|
|
58
|
+
counts.planned[category] = planned;
|
|
59
|
+
counts.sheets[category] = sheets.length;
|
|
60
|
+
if (planned === 0)
|
|
61
|
+
continue;
|
|
62
|
+
if (sheets.length === 0) {
|
|
63
|
+
const transparent = imageGenerateIds.length > 0
|
|
64
|
+
? `画布现有 ${imageGenerateIds.length} 个 image-generate 节点(${imageGenerateIds.slice(0, 5).join('、')}${imageGenerateIds.length > 5 ? ' 等' : ''});透明边界不会追加${label}设定板合同,不能代替。`
|
|
65
|
+
: '';
|
|
66
|
+
errors.push({
|
|
67
|
+
code: 'sheet-node-missing',
|
|
68
|
+
severity: 'error',
|
|
69
|
+
message: `资产计划声明了 ${planned} 个${label},画布上没有 ${sheetKind} 节点。${transparent}`,
|
|
70
|
+
nodeIds: transparent ? imageGenerateIds : [],
|
|
71
|
+
});
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (sheets.length < planned) {
|
|
75
|
+
warnings.push({
|
|
76
|
+
code: 'sheet-coverage-partial',
|
|
77
|
+
severity: 'warning',
|
|
78
|
+
message: `资产计划声明了 ${planned} 个${label},当前只有 ${sheets.length} 个 ${sheetKind} 节点;分批生成可以接受,但不得用 image-generate 补齐剩余项。`,
|
|
79
|
+
nodeIds: [],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
for (const sheet of sheets) {
|
|
83
|
+
const prompt = sheet.config?.prompt;
|
|
84
|
+
if (typeof prompt === 'string' && prompt.trim()) {
|
|
85
|
+
warnings.push({
|
|
86
|
+
code: 'sheet-config-prompt',
|
|
87
|
+
severity: 'warning',
|
|
88
|
+
message: `${sheetKind} 节点 ${sheet.id} 手写了 config.prompt 正文;设定正文应经 prompt 端口由结构化设定节点提供,手写内容不会得到${label}设定板合同的保证。`,
|
|
89
|
+
nodeIds: [sheet.id],
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const sourceKind = promptSourceKind(sheet.id, input.edges, kindById);
|
|
93
|
+
if (sourceKind && !sourceKinds.includes(sourceKind)) {
|
|
94
|
+
warnings.push({
|
|
95
|
+
code: 'sheet-prompt-source',
|
|
96
|
+
severity: 'warning',
|
|
97
|
+
message: `${sheetKind} 节点 ${sheet.id} 的 prompt 端口来自 ${sourceKind},不是${label}结构化设定节点(${sourceKinds.join(' / ')});确认这是有意的,否则先补结构化设定。`,
|
|
98
|
+
nodeIds: [sheet.id],
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (!hasPromptInput(sheet.id, input.edges)) {
|
|
102
|
+
warnings.push({
|
|
103
|
+
code: 'sheet-prompt-unconnected',
|
|
104
|
+
severity: 'warning',
|
|
105
|
+
message: `${sheetKind} 节点 ${sheet.id} 的 prompt 端口没有入边;服务端会在提交时以 CANVAS_REQUIRED_INPUT_MISSING 拒绝,提前接线可省一次失败提交。`,
|
|
106
|
+
nodeIds: [sheet.id],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { ok: errors.length === 0, errors, warnings, counts };
|
|
112
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 画布文档的内容合同。
|
|
3
|
+
*
|
|
4
|
+
* `canvas workflow status` 只按 `document-key` 找到已保存版本,并核对 `--input` 快照是否
|
|
5
|
+
* 过期,不检查正文结构:一份只有 summary 的占位文档同样会让阶段变成 ready。历史问题里
|
|
6
|
+
* Agent 就是先存了这种占位文档,再继续生成资产,事后无法从阶段状态看出分析是空的。
|
|
7
|
+
*
|
|
8
|
+
* 因此把"哪些文档必须包含哪些顶层字段"登记在随包 `module-map.json` 的 `documents`,由 CLI
|
|
9
|
+
* 在发出保存请求前本地核对。字段清单只从该文件读取一次;读取失败时放行并给出警告,避免
|
|
10
|
+
* Skill 目录被用户改动后阻塞与内容无关的保存流程。
|
|
11
|
+
*/
|
|
12
|
+
export type CanvasDocumentContract = {
|
|
13
|
+
module: string;
|
|
14
|
+
template_stem: string;
|
|
15
|
+
stage?: string;
|
|
16
|
+
required_fields: string[];
|
|
17
|
+
non_empty_fields?: string[];
|
|
18
|
+
};
|
|
19
|
+
type DocumentContractMap = Record<string, CanvasDocumentContract>;
|
|
20
|
+
/**
|
|
21
|
+
* 按服务端同一套规则解析文档键:先精确匹配登记键,再匹配 `ep-001.script` 这类带分集前缀的键。
|
|
22
|
+
* 与 `documentForModule` 保持一致,避免 CLI 放行、阶段却始终 missing。
|
|
23
|
+
*/
|
|
24
|
+
export declare function matchDocumentContract(map: DocumentContractMap, documentKey: string): CanvasDocumentContract | null;
|
|
25
|
+
export declare function templatePathOf(contract: CanvasDocumentContract): string;
|
|
26
|
+
export type DocumentContentCheck = {
|
|
27
|
+
contract: null;
|
|
28
|
+
} | {
|
|
29
|
+
contract: CanvasDocumentContract;
|
|
30
|
+
missing: string[];
|
|
31
|
+
empty: string[];
|
|
32
|
+
};
|
|
33
|
+
export declare function checkDocumentContent(map: DocumentContractMap, documentKey: string, content: unknown): DocumentContentCheck;
|
|
34
|
+
/**
|
|
35
|
+
* 文档键的 schema-key 约定:`canvas.<document-key 末段>.v1`;审核记录统一用 `canvas.review.v1`。
|
|
36
|
+
* 服务端只校验 `canvas.*` 形状,写错不会报错,所以这里给出可修正的提示。
|
|
37
|
+
*/
|
|
38
|
+
export declare function expectedSchemaKey(documentKey: string): string;
|
|
39
|
+
export type DocumentContentValidation = {
|
|
40
|
+
contract: CanvasDocumentContract | null;
|
|
41
|
+
warnings: string[];
|
|
42
|
+
};
|
|
43
|
+
export declare function validateCanvasDocumentContent(input: {
|
|
44
|
+
documentKey: string;
|
|
45
|
+
schemaKey: string;
|
|
46
|
+
content: unknown;
|
|
47
|
+
allowPartial?: boolean;
|
|
48
|
+
}): Promise<DocumentContentValidation>;
|
|
49
|
+
export {};
|