@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.
Files changed (89) hide show
  1. package/.agents/skills/uzoo-anime-cli/SKILL.md +89 -0
  2. package/.agents/skills/uzoo-anime-cli/references/agreement-workflow.md +41 -0
  3. package/.agents/skills/uzoo-anime-cli/references/canvas-workflow.md +53 -0
  4. package/.agents/skills/uzoo-anime-cli/references/commands.md +242 -0
  5. package/.agents/skills/uzoo-anime-cli/references/generation-workflow.md +142 -0
  6. package/.agents/skills/uzoo-anime-cli/references/image-tools-workflow.md +153 -0
  7. package/.agents/skills/uzoo-anime-cli/references/interaction-workflow.md +67 -0
  8. package/.agents/skills/uzoo-anime-cli/references/material-graph-workflow.md +113 -0
  9. package/.agents/skills/uzoo-anime-cli/references/node-capabilities.md +64 -0
  10. package/.agents/skills/uzoo-anime-cli/references/node-workflow.md +90 -0
  11. package/.agents/skills/uzoo-anime-cli/references/remake-workflow.md +54 -0
  12. package/.agents/skills/uzoo-anime-cli/references/repaint-workflow.md +13 -0
  13. package/.agents/skills/uzoo-anime-cli/references/seedance-review-workflow.md +37 -0
  14. package/.agents/skills/uzoo-anime-cli/references/video-tools-workflow.md +67 -0
  15. package/CHANGELOG.md +13 -0
  16. package/LICENSE +21 -0
  17. package/README.md +46 -3
  18. package/assets/favicon-uzoo.png +0 -0
  19. package/assets/logo-uzoo.svg +7 -0
  20. 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
  21. package/examples/matting.json +5 -0
  22. package/extensions/uzoo-cli-login/manifest.json +9 -0
  23. package/extensions/uzoo-cli-login/popup.css +1 -0
  24. package/extensions/uzoo-cli-login/popup.html +14 -0
  25. package/extensions/uzoo-cli-login/popup.js +65 -0
  26. package/package.json +53 -6
  27. package/src/agreement-page.js +62 -0
  28. package/src/agreement.js +419 -0
  29. package/src/annotation-media.js +386 -0
  30. package/src/api.js +168 -0
  31. package/src/browser-login.js +13 -0
  32. package/src/callback-page.js +44 -0
  33. package/src/canvas.js +105 -0
  34. package/src/cli-authorization.js +122 -0
  35. package/src/cli.js +464 -0
  36. package/src/download-name.js +17 -0
  37. package/src/draft-finalize.js +229 -0
  38. package/src/generation-graph.js +124 -0
  39. package/src/generation-input.js +472 -0
  40. package/src/graph-disconnect.js +89 -0
  41. package/src/graph.js +431 -0
  42. package/src/group-edit.js +53 -0
  43. package/src/group-layout.js +113 -0
  44. package/src/group-membership.js +125 -0
  45. package/src/history-add.js +119 -0
  46. package/src/image-annotation.js +246 -0
  47. package/src/image-crop.js +283 -0
  48. package/src/image-matting.js +82 -0
  49. package/src/image-media.js +89 -0
  50. package/src/image-output.js +385 -0
  51. package/src/install.js +237 -0
  52. package/src/local-output.js +23 -0
  53. package/src/material-download.js +55 -0
  54. package/src/material-save.js +254 -0
  55. package/src/materials.js +147 -0
  56. package/src/matting-background.js +73 -0
  57. package/src/matting-jobs.js +63 -0
  58. package/src/matting-worker.js +49 -0
  59. package/src/matting.js +170 -0
  60. package/src/media-copy.js +53 -0
  61. package/src/media.js +343 -0
  62. package/src/model-options.js +76 -0
  63. package/src/multipart.js +28 -0
  64. package/src/node-copy.js +95 -0
  65. package/src/node-delete.js +49 -0
  66. package/src/node-history.js +231 -0
  67. package/src/normal-login.js +118 -0
  68. package/src/package-info.js +8 -0
  69. package/src/png-alpha.js +60 -0
  70. package/src/protocol.js +83 -0
  71. package/src/remake.js +738 -0
  72. package/src/repaint-archive.js +53 -0
  73. package/src/repaint-delivery.js +783 -0
  74. package/src/repaint-export.js +63 -0
  75. package/src/repaint-graph.js +214 -0
  76. package/src/repaint-history.js +267 -0
  77. package/src/repaint-materials.js +601 -0
  78. package/src/repaint-reverse.js +614 -0
  79. package/src/repaint-sequence.js +132 -0
  80. package/src/repaint-settings.js +576 -0
  81. package/src/repaint-video.js +798 -0
  82. package/src/repaint.js +326 -0
  83. package/src/resource.js +110 -0
  84. package/src/review.js +435 -0
  85. package/src/service.js +85 -0
  86. package/src/store.js +100 -0
  87. package/src/video-clip.js +381 -0
  88. package/src/video-frame.js +296 -0
  89. package/src/workflows.js +214 -0
@@ -0,0 +1,53 @@
1
+ import fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
+ import crypto from 'node:crypto'
4
+ import { isDeepStrictEqual as equal } from 'node:util'
5
+ import { root, safeName, json } from './store.js'
6
+ import { exclusiveOutput } from './local-output.js'
7
+
8
+ const types = ['reverse', 'delivery', 'video']
9
+ const hash = value => crypto.createHash('sha256').update(JSON.stringify(value)).digest('hex')
10
+ export const repaintArchivePath = (profile, type, operation) => {
11
+ if (!types.includes(type)) throw new Error('归档类型须为reverse/delivery/video')
12
+ return path.join(root(), 'repaint-archive', safeName(profile), type, safeName(operation) + '.json')
13
+ }
14
+ function identity(record, type) {
15
+ return {
16
+ profile: record.profile, operation: record.operation, type,
17
+ baseUrl: record.baseUrl, owner: record.owner,
18
+ parentOperation: record.parentOperation, binding: record.binding,
19
+ ...(type === 'video' ? { taskId: record.taskId } : {})
20
+ }
21
+ }
22
+ export async function readRepaintArchive(record, type) {
23
+ const saved = await json(repaintArchivePath(record.profile, type, record.operation), null)
24
+ if (!saved) return null
25
+ if (saved.schema !== 1 || !saved.payload ||
26
+ saved.sha256 !== hash(saved.payload) || !equal(saved.payload.identity, JSON.parse(JSON.stringify(identity(record, type)))))
27
+ throw Object.assign(new Error('本地原结果归档损坏或绑定不匹配;不冒充服务端历史'), { code: 'REPAINT_ARCHIVE_INVALID' })
28
+ return saved
29
+ }
30
+ export async function archiveRepaintResult(record, type, result, billing, details = {}) {
31
+ if (type === 'video' ? !record.taskId : !record.accepted)
32
+ throw new Error('没有原接收证据,不归档观察结果')
33
+ // Video references expire and cannot grant download permission. Store metadata
34
+ // only; exporting video always asks the original protected endpoint again.
35
+ const content = type === 'video'
36
+ ? Object.fromEntries(['mime_type', 'width', 'height', 'duration'].map(k => [k, result[k] ?? null]))
37
+ : structuredClone(result)
38
+ const payload = JSON.parse(JSON.stringify({ identity: identity(record, type), result: content, billing, details }))
39
+ const previous = await readRepaintArchive(record, type)
40
+ if (previous) {
41
+ if (!equal(previous.payload, payload))
42
+ throw Object.assign(new Error('原operation已有不同的已核验归档;不覆盖历史'), { code: 'REPAINT_ARCHIVE_CONFLICT' })
43
+ return previous
44
+ }
45
+ const saved = { schema: 1, verified_at: new Date().toISOString(), payload, sha256: hash(payload) }
46
+ const target = repaintArchivePath(record.profile, type, record.operation)
47
+ await fs.mkdir(path.dirname(target), { recursive: true })
48
+ await exclusiveOutput(target, async temporary => {
49
+ await fs.writeFile(temporary, JSON.stringify(saved, null, 2) + '\n', { flag: 'wx', mode: 0o600 })
50
+ return {}
51
+ })
52
+ return saved
53
+ }