@uzooai/anime-ai-cli 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/uzoo-anime-cli/SKILL.md +89 -0
- package/.agents/skills/uzoo-anime-cli/references/agreement-workflow.md +41 -0
- package/.agents/skills/uzoo-anime-cli/references/canvas-workflow.md +53 -0
- package/.agents/skills/uzoo-anime-cli/references/commands.md +242 -0
- package/.agents/skills/uzoo-anime-cli/references/generation-workflow.md +142 -0
- package/.agents/skills/uzoo-anime-cli/references/image-tools-workflow.md +153 -0
- package/.agents/skills/uzoo-anime-cli/references/interaction-workflow.md +67 -0
- package/.agents/skills/uzoo-anime-cli/references/material-graph-workflow.md +113 -0
- package/.agents/skills/uzoo-anime-cli/references/node-capabilities.md +64 -0
- package/.agents/skills/uzoo-anime-cli/references/node-workflow.md +90 -0
- package/.agents/skills/uzoo-anime-cli/references/remake-workflow.md +54 -0
- package/.agents/skills/uzoo-anime-cli/references/repaint-workflow.md +13 -0
- package/.agents/skills/uzoo-anime-cli/references/seedance-review-workflow.md +37 -0
- package/.agents/skills/uzoo-anime-cli/references/video-tools-workflow.md +67 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +46 -3
- package/assets/favicon-uzoo.png +0 -0
- package/assets/logo-uzoo.svg +7 -0
- package/docs/Agent/346/216/245/345/205/245/344/270/216/347/211/210/346/234/254/346/233/264/346/226/260.md +43 -0
- package/examples/matting.json +5 -0
- package/extensions/uzoo-cli-login/manifest.json +9 -0
- package/extensions/uzoo-cli-login/popup.css +1 -0
- package/extensions/uzoo-cli-login/popup.html +14 -0
- package/extensions/uzoo-cli-login/popup.js +65 -0
- package/package.json +53 -6
- package/src/agreement-page.js +62 -0
- package/src/agreement.js +419 -0
- package/src/annotation-media.js +386 -0
- package/src/api.js +168 -0
- package/src/browser-login.js +13 -0
- package/src/callback-page.js +44 -0
- package/src/canvas.js +105 -0
- package/src/cli-authorization.js +122 -0
- package/src/cli.js +464 -0
- package/src/download-name.js +17 -0
- package/src/draft-finalize.js +229 -0
- package/src/generation-graph.js +124 -0
- package/src/generation-input.js +472 -0
- package/src/graph-disconnect.js +89 -0
- package/src/graph.js +431 -0
- package/src/group-edit.js +53 -0
- package/src/group-layout.js +113 -0
- package/src/group-membership.js +125 -0
- package/src/history-add.js +119 -0
- package/src/image-annotation.js +246 -0
- package/src/image-crop.js +283 -0
- package/src/image-matting.js +82 -0
- package/src/image-media.js +89 -0
- package/src/image-output.js +385 -0
- package/src/install.js +237 -0
- package/src/local-output.js +23 -0
- package/src/material-download.js +55 -0
- package/src/material-save.js +254 -0
- package/src/materials.js +147 -0
- package/src/matting-background.js +73 -0
- package/src/matting-jobs.js +63 -0
- package/src/matting-worker.js +49 -0
- package/src/matting.js +170 -0
- package/src/media-copy.js +53 -0
- package/src/media.js +343 -0
- package/src/model-options.js +76 -0
- package/src/multipart.js +28 -0
- package/src/node-copy.js +95 -0
- package/src/node-delete.js +49 -0
- package/src/node-history.js +231 -0
- package/src/normal-login.js +118 -0
- package/src/package-info.js +8 -0
- package/src/png-alpha.js +60 -0
- package/src/protocol.js +83 -0
- package/src/remake.js +738 -0
- package/src/repaint-archive.js +53 -0
- package/src/repaint-delivery.js +783 -0
- package/src/repaint-export.js +63 -0
- package/src/repaint-graph.js +214 -0
- package/src/repaint-history.js +267 -0
- package/src/repaint-materials.js +601 -0
- package/src/repaint-reverse.js +614 -0
- package/src/repaint-sequence.js +132 -0
- package/src/repaint-settings.js +576 -0
- package/src/repaint-video.js +798 -0
- package/src/repaint.js +326 -0
- package/src/resource.js +110 -0
- package/src/review.js +435 -0
- package/src/service.js +85 -0
- package/src/store.js +100 -0
- package/src/video-clip.js +381 -0
- package/src/video-frame.js +296 -0
- package/src/workflows.js +214 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { isDeepStrictEqual as equal } from 'node:util'
|
|
3
|
+
import { atomic, json, root, safeName } from './store.js'
|
|
4
|
+
import { repaintPromptContext, reversePath, startReverse, getReverse, recoverReverse } from './repaint-reverse.js'
|
|
5
|
+
import { deliveryInput, deliveryPath, startDelivery, getDelivery, recoverDelivery } from './repaint-delivery.js'
|
|
6
|
+
import { repaintVideoInput, repaintVideoPath, startRepaintVideo, getRepaintVideo, recoverRepaintVideo } from './repaint-video.js'
|
|
7
|
+
import { repaintAttachmentView } from './repaint-settings.js'
|
|
8
|
+
import { requireServiceReady } from './service.js'
|
|
9
|
+
|
|
10
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
11
|
+
const paths = { reverse: reversePath, delivery: deliveryPath, video: repaintVideoPath }
|
|
12
|
+
const getters = { reverse: getReverse, delivery: getDelivery, video: getRepaintVideo }
|
|
13
|
+
const recoverers = { reverse: recoverReverse, delivery: recoverDelivery, video: recoverRepaintVideo }
|
|
14
|
+
export const repaintSequencePath = (profile, operation) =>
|
|
15
|
+
path.join(root(), 'repaint-sequence', safeName(profile), safeName(operation) + '.json')
|
|
16
|
+
|
|
17
|
+
export function repaintSequenceInput(value) {
|
|
18
|
+
if (!object(value) || Object.keys(value).some(k => k !== 'steps') || !Array.isArray(value.steps) ||
|
|
19
|
+
!value.steps.length || value.steps.length > 100)
|
|
20
|
+
throw new Error('多段调度输入仅支持steps数组(1–100项),不是批量接口或合成任务')
|
|
21
|
+
const names = new Set(), actions = new Set()
|
|
22
|
+
return { steps: value.steps.map(step => {
|
|
23
|
+
if (!object(step) || Object.keys(step).some(k => !['type', 'segment_index', 'operation', 'input'].includes(k)) ||
|
|
24
|
+
!Object.hasOwn(paths, step.type) || !Number.isSafeInteger(step.segment_index) || step.segment_index < 1 ||
|
|
25
|
+
typeof step.operation !== 'string')
|
|
26
|
+
throw new Error('调度步骤需要type reverse/delivery/video、正整数segment_index及operation')
|
|
27
|
+
safeName(step.operation)
|
|
28
|
+
const action = step.type + ':' + step.segment_index
|
|
29
|
+
if (names.has(step.operation) || actions.has(action)) throw new Error('调度中operation或同片段同阶段重复')
|
|
30
|
+
names.add(step.operation); actions.add(action)
|
|
31
|
+
if (step.type === 'reverse' && Object.hasOwn(step, 'input')) throw new Error('反推步骤不接受额外input')
|
|
32
|
+
if (step.type !== 'reverse' && !Object.hasOwn(step, 'input'))
|
|
33
|
+
throw new Error('最终提示词须明确替换规则或空对象;视频须明确模型参数,不自动选择')
|
|
34
|
+
return { type: step.type, segment_index: step.segment_index, operation: step.operation,
|
|
35
|
+
...(step.type === 'delivery' ? { input: deliveryInput(step.input) } : {}),
|
|
36
|
+
...(step.type === 'video' ? { input: repaintVideoInput(step.input) } : {}) }
|
|
37
|
+
}) }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function context(client, profile, parent, input) {
|
|
41
|
+
await requireServiceReady(client)
|
|
42
|
+
const bindings = [], indexes = [...new Set(input.steps.map(s => s.segment_index))]
|
|
43
|
+
let owner, attachments
|
|
44
|
+
for (const index of indexes) {
|
|
45
|
+
const ctx = await repaintPromptContext(client, profile, parent, index)
|
|
46
|
+
owner = ctx.parent.owner
|
|
47
|
+
const current = repaintAttachmentView(ctx.job.delivery_prompt_attachments, client.baseUrl)
|
|
48
|
+
if (attachments && !equal(attachments, current)) throw new Error('核对期间全局附件发生变化')
|
|
49
|
+
attachments = current
|
|
50
|
+
bindings.push(ctx.binding)
|
|
51
|
+
}
|
|
52
|
+
return { owner, bindings, attachments }
|
|
53
|
+
}
|
|
54
|
+
function summary(record, steps, next = null) {
|
|
55
|
+
return { operation: record.operation, repaint_operation: record.parentOperation,
|
|
56
|
+
workflow: 'canvas_single_step_sequence', product_batch_supported: false,
|
|
57
|
+
state: next ? 'pending' : 'completed', steps, next_step: next,
|
|
58
|
+
total_estimated_credit_cost: null,
|
|
59
|
+
estimate_note: '后续阶段依赖前序结果,逐项实时预估;当前报价不授权下一项',
|
|
60
|
+
generation_submitted: false, processing_submitted: false, canvas_written: false }
|
|
61
|
+
}
|
|
62
|
+
export async function prepareRepaintSequence(client, profile, parent, operation, value) {
|
|
63
|
+
safeName(parent); safeName(operation)
|
|
64
|
+
const input = repaintSequenceInput(value)
|
|
65
|
+
const binding = await context(client, profile, parent, input)
|
|
66
|
+
const file = repaintSequencePath(profile, operation), previous = await json(file, null)
|
|
67
|
+
const record = { schema: 1, profile, operation, parentOperation: parent,
|
|
68
|
+
baseUrl: client.baseUrl, input, ...binding }
|
|
69
|
+
if (previous && !equal(previous, record)) throw new Error('调度operation已绑定其他输入或配置;先查询原调度')
|
|
70
|
+
if (!previous) await atomic(file, record)
|
|
71
|
+
return inspectRepaintSequence(client, profile, operation)
|
|
72
|
+
}
|
|
73
|
+
async function bound(client, profile, operation) {
|
|
74
|
+
const record = await json(repaintSequencePath(profile, operation), null)
|
|
75
|
+
if (!record || record.schema !== 1 || record.operation !== operation || record.profile !== profile || record.baseUrl !== client.baseUrl)
|
|
76
|
+
throw new Error('调度operation不存在或服务不匹配')
|
|
77
|
+
const binding = await context(client, profile, record.parentOperation, repaintSequenceInput(record.input))
|
|
78
|
+
if (!equal(binding, { owner: record.owner, bindings: record.bindings, attachments: record.attachments }))
|
|
79
|
+
throw new Error('调度账号、方案、来源、节点或全局配置变化;停止原调度,不重做')
|
|
80
|
+
return record
|
|
81
|
+
}
|
|
82
|
+
async function inspect(client, profile, record) {
|
|
83
|
+
const steps = []
|
|
84
|
+
let next = null
|
|
85
|
+
for (const step of record.input.steps) {
|
|
86
|
+
const child = await json(paths[step.type](profile, step.operation), null)
|
|
87
|
+
if (child && (child.parentOperation !== record.parentOperation || child.index !== step.segment_index ||
|
|
88
|
+
child.owner !== record.owner || child.baseUrl !== record.baseUrl ||
|
|
89
|
+
(step.type !== 'reverse' && !equal(child.input, step.input))))
|
|
90
|
+
throw new Error('子operation已绑定其他任务/参数;不认领或换键重提')
|
|
91
|
+
const observed = child ? await getters[step.type](client, profile, step.operation) : null
|
|
92
|
+
const completed = observed?.state === 'completed' && observed.canvas_synced === true && !observed.fallback
|
|
93
|
+
const status = completed ? 'completed' : child?.attempted ? observed?.state || 'submission_unknown' : 'not_submitted'
|
|
94
|
+
const item = { ...step, state: status, ...(observed ? { result: observed } : {}) }
|
|
95
|
+
steps.push(item)
|
|
96
|
+
if (!completed && !next) next = item
|
|
97
|
+
}
|
|
98
|
+
return summary(record, steps, next)
|
|
99
|
+
}
|
|
100
|
+
export async function inspectRepaintSequence(client, profile, operation) {
|
|
101
|
+
const record = await bound(client, profile, operation)
|
|
102
|
+
return inspect(client, profile, record)
|
|
103
|
+
}
|
|
104
|
+
export async function nextRepaintSequence(client, profile, operation, { confirmed = false, expectedCost, step: expectedStep, recover = false, ...options } = {}) {
|
|
105
|
+
if (confirmed && recover) throw new Error('恢复与收费提交须分开执行')
|
|
106
|
+
const record = await bound(client, profile, operation)
|
|
107
|
+
const view = await inspect(client, profile, record), step = view.next_step
|
|
108
|
+
if ((confirmed || recover) && (!step || expectedStep !== step.operation))
|
|
109
|
+
throw new Error('当次确认的子operation不再是下一项;重新查看,不将旧确认用于后续任务')
|
|
110
|
+
if (!step) return view
|
|
111
|
+
const child = await json(paths[step.type](profile, step.operation), null)
|
|
112
|
+
if (recover) {
|
|
113
|
+
if (!child) throw new Error('原子operation尚未准备,不能恢复')
|
|
114
|
+
const result = await recoverers[step.type](client, profile, step.operation)
|
|
115
|
+
return { ...view, executed_step: step.operation, result, canvas_written: null, canvas_synced: result.canvas_synced === true,
|
|
116
|
+
next: '本次仅恢复原子操作;再次sequence-get查看下一项,不自动提交' }
|
|
117
|
+
}
|
|
118
|
+
if (child?.attempted) {
|
|
119
|
+
if (confirmed) throw new Error('原子操作已提交或结果未知;只查询/恢复,不重新提交')
|
|
120
|
+
return { ...view, next: '原子操作已提交或未知;sequence-recover --step 原子operation仅恢复原操作,失败不自动重做' }
|
|
121
|
+
}
|
|
122
|
+
const args = [client, profile, record.parentOperation, step.segment_index, step.operation]
|
|
123
|
+
let result
|
|
124
|
+
if (step.type === 'reverse') result = await startReverse(...args, confirmed, expectedCost)
|
|
125
|
+
else if (step.type === 'delivery') result = await startDelivery(...args, step.input, confirmed, expectedCost)
|
|
126
|
+
else result = await startRepaintVideo(...args, step.input, confirmed, expectedCost, options)
|
|
127
|
+
return { ...view, executed_step: confirmed ? step.operation : null, prepared_step: step.operation, result,
|
|
128
|
+
generation_submitted: confirmed && step.type === 'video' ? result.submitted : false,
|
|
129
|
+
processing_submitted: confirmed && step.type !== 'video' ? result.processing_submitted : false,
|
|
130
|
+
canvas_written: confirmed ? null : false, canvas_synced: result.canvas_synced === true,
|
|
131
|
+
next: '本次仅准备或执行这一项;展示result中的参数/钱包/实时费用并取得该项确认,后续另行准备与确认' }
|
|
132
|
+
}
|