human2ai 0.1.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 (326) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +120 -0
  3. package/assets/quaternius/License_Standard.txt +22 -0
  4. package/assets/quaternius/README.md +31 -0
  5. package/assets/quaternius/Superhero_Female_FullBody.bin +0 -0
  6. package/assets/quaternius/Superhero_Female_FullBody.gltf +2056 -0
  7. package/assets/quaternius/Superhero_Male_FullBody.bin +0 -0
  8. package/assets/quaternius/Superhero_Male_FullBody.gltf +2018 -0
  9. package/dist/cli/integration.d.ts +39 -0
  10. package/dist/cli/integration.js +466 -0
  11. package/dist/cli/integration.js.map +1 -0
  12. package/dist/cli/main.d.ts +17 -0
  13. package/dist/cli/main.js +1455 -0
  14. package/dist/cli/main.js.map +1 -0
  15. package/dist/database/composition-session-repository.d.ts +37 -0
  16. package/dist/database/composition-session-repository.js +147 -0
  17. package/dist/database/composition-session-repository.js.map +1 -0
  18. package/dist/database/draft-version-errors.d.ts +29 -0
  19. package/dist/database/draft-version-errors.js +47 -0
  20. package/dist/database/draft-version-errors.js.map +1 -0
  21. package/dist/database/draft-version-store.d.ts +30 -0
  22. package/dist/database/draft-version-store.js +168 -0
  23. package/dist/database/draft-version-store.js.map +1 -0
  24. package/dist/database/image-asset-repository.d.ts +37 -0
  25. package/dist/database/image-asset-repository.js +101 -0
  26. package/dist/database/image-asset-repository.js.map +1 -0
  27. package/dist/database/image-input.d.ts +15 -0
  28. package/dist/database/image-input.js +28 -0
  29. package/dist/database/image-input.js.map +1 -0
  30. package/dist/database/migrate.d.ts +4 -0
  31. package/dist/database/migrate.js +45 -0
  32. package/dist/database/migrate.js.map +1 -0
  33. package/dist/database/project-session-repository.d.ts +72 -0
  34. package/dist/database/project-session-repository.js +291 -0
  35. package/dist/database/project-session-repository.js.map +1 -0
  36. package/dist/database/spatial-session-repository.d.ts +26 -0
  37. package/dist/database/spatial-session-repository.js +44 -0
  38. package/dist/database/spatial-session-repository.js.map +1 -0
  39. package/dist/database/style-library-repository.d.ts +70 -0
  40. package/dist/database/style-library-repository.js +290 -0
  41. package/dist/database/style-library-repository.js.map +1 -0
  42. package/dist/database/svg-input.d.ts +1 -0
  43. package/dist/database/svg-input.js +77 -0
  44. package/dist/database/svg-input.js.map +1 -0
  45. package/dist/database/ui-sketch-session-repository.d.ts +19 -0
  46. package/dist/database/ui-sketch-session-repository.js +35 -0
  47. package/dist/database/ui-sketch-session-repository.js.map +1 -0
  48. package/dist/domain/canvas-layer-order.d.ts +6 -0
  49. package/dist/domain/canvas-layer-order.js +40 -0
  50. package/dist/domain/canvas-layer-order.js.map +1 -0
  51. package/dist/domain/canvas-node-metadata.d.ts +20 -0
  52. package/dist/domain/canvas-node-metadata.js +17 -0
  53. package/dist/domain/canvas-node-metadata.js.map +1 -0
  54. package/dist/domain/canvas-states.d.ts +8 -0
  55. package/dist/domain/canvas-states.js +23 -0
  56. package/dist/domain/canvas-states.js.map +1 -0
  57. package/dist/domain/composition/analysis.d.ts +104 -0
  58. package/dist/domain/composition/analysis.js +337 -0
  59. package/dist/domain/composition/analysis.js.map +1 -0
  60. package/dist/domain/composition/camera-reference.d.ts +24 -0
  61. package/dist/domain/composition/camera-reference.js +34 -0
  62. package/dist/domain/composition/camera-reference.js.map +1 -0
  63. package/dist/domain/composition/draft.d.ts +50 -0
  64. package/dist/domain/composition/draft.js +609 -0
  65. package/dist/domain/composition/draft.js.map +1 -0
  66. package/dist/domain/composition/frame.d.ts +23 -0
  67. package/dist/domain/composition/frame.js +154 -0
  68. package/dist/domain/composition/frame.js.map +1 -0
  69. package/dist/domain/composition/geometry.d.ts +15 -0
  70. package/dist/domain/composition/geometry.js +262 -0
  71. package/dist/domain/composition/geometry.js.map +1 -0
  72. package/dist/domain/composition/index.d.ts +13 -0
  73. package/dist/domain/composition/index.js +10 -0
  74. package/dist/domain/composition/index.js.map +1 -0
  75. package/dist/domain/composition/layers.d.ts +4 -0
  76. package/dist/domain/composition/layers.js +12 -0
  77. package/dist/domain/composition/layers.js.map +1 -0
  78. package/dist/domain/composition/records.d.ts +14 -0
  79. package/dist/domain/composition/records.js +2 -0
  80. package/dist/domain/composition/records.js.map +1 -0
  81. package/dist/domain/composition/refinement/engine.d.ts +12 -0
  82. package/dist/domain/composition/refinement/engine.js +521 -0
  83. package/dist/domain/composition/refinement/engine.js.map +1 -0
  84. package/dist/domain/composition/refinement/relations.d.ts +16 -0
  85. package/dist/domain/composition/refinement/relations.js +293 -0
  86. package/dist/domain/composition/refinement/relations.js.map +1 -0
  87. package/dist/domain/composition/refinement/types.d.ts +181 -0
  88. package/dist/domain/composition/refinement/types.js +2 -0
  89. package/dist/domain/composition/refinement/types.js.map +1 -0
  90. package/dist/domain/composition/render.d.ts +5 -0
  91. package/dist/domain/composition/render.js +169 -0
  92. package/dist/domain/composition/render.js.map +1 -0
  93. package/dist/domain/composition/states.d.ts +9 -0
  94. package/dist/domain/composition/states.js +104 -0
  95. package/dist/domain/composition/states.js.map +1 -0
  96. package/dist/domain/composition/types.d.ts +149 -0
  97. package/dist/domain/composition/types.js +2 -0
  98. package/dist/domain/composition/types.js.map +1 -0
  99. package/dist/domain/composition/workflow.d.ts +15 -0
  100. package/dist/domain/composition/workflow.js +77 -0
  101. package/dist/domain/composition/workflow.js.map +1 -0
  102. package/dist/domain/fingerprint.d.ts +2 -0
  103. package/dist/domain/fingerprint.js +25 -0
  104. package/dist/domain/fingerprint.js.map +1 -0
  105. package/dist/domain/session/canvas-edit-history.d.ts +17 -0
  106. package/dist/domain/session/canvas-edit-history.js +53 -0
  107. package/dist/domain/session/canvas-edit-history.js.map +1 -0
  108. package/dist/domain/session/capabilities.d.ts +16 -0
  109. package/dist/domain/session/capabilities.js +84 -0
  110. package/dist/domain/session/capabilities.js.map +1 -0
  111. package/dist/domain/session/draft-version.d.ts +41 -0
  112. package/dist/domain/session/draft-version.js +2 -0
  113. package/dist/domain/session/draft-version.js.map +1 -0
  114. package/dist/domain/session/index.d.ts +5 -0
  115. package/dist/domain/session/index.js +3 -0
  116. package/dist/domain/session/index.js.map +1 -0
  117. package/dist/domain/session/types.d.ts +23 -0
  118. package/dist/domain/session/types.js +2 -0
  119. package/dist/domain/session/types.js.map +1 -0
  120. package/dist/domain/spatial/assets/quaternius-female-rig.json +799 -0
  121. package/dist/domain/spatial/assets/quaternius-rig.json +799 -0
  122. package/dist/domain/spatial/assets/quaternius-superhero-female.json +1 -0
  123. package/dist/domain/spatial/assets/quaternius-superhero.json +1 -0
  124. package/dist/domain/spatial/camera-box.d.ts +13 -0
  125. package/dist/domain/spatial/camera-box.js +52 -0
  126. package/dist/domain/spatial/camera-box.js.map +1 -0
  127. package/dist/domain/spatial/geometric-model.d.ts +4 -0
  128. package/dist/domain/spatial/geometric-model.js +101 -0
  129. package/dist/domain/spatial/geometric-model.js.map +1 -0
  130. package/dist/domain/spatial/hands.d.ts +36 -0
  131. package/dist/domain/spatial/hands.js +128 -0
  132. package/dist/domain/spatial/hands.js.map +1 -0
  133. package/dist/domain/spatial/index.d.ts +30 -0
  134. package/dist/domain/spatial/index.js +381 -0
  135. package/dist/domain/spatial/index.js.map +1 -0
  136. package/dist/domain/spatial/kinematics.d.ts +27 -0
  137. package/dist/domain/spatial/kinematics.js +285 -0
  138. package/dist/domain/spatial/kinematics.js.map +1 -0
  139. package/dist/domain/spatial/lighting.d.ts +35 -0
  140. package/dist/domain/spatial/lighting.js +173 -0
  141. package/dist/domain/spatial/lighting.js.map +1 -0
  142. package/dist/domain/spatial/model.d.ts +5 -0
  143. package/dist/domain/spatial/model.js +193 -0
  144. package/dist/domain/spatial/model.js.map +1 -0
  145. package/dist/domain/spatial/morph.d.ts +3 -0
  146. package/dist/domain/spatial/morph.js +187 -0
  147. package/dist/domain/spatial/morph.js.map +1 -0
  148. package/dist/domain/spatial/proportions.d.ts +46 -0
  149. package/dist/domain/spatial/proportions.js +59 -0
  150. package/dist/domain/spatial/proportions.js.map +1 -0
  151. package/dist/domain/spatial/reference-lines.d.ts +6 -0
  152. package/dist/domain/spatial/reference-lines.js +58 -0
  153. package/dist/domain/spatial/reference-lines.js.map +1 -0
  154. package/dist/domain/spatial/scene-cache.d.ts +15 -0
  155. package/dist/domain/spatial/scene-cache.js +69 -0
  156. package/dist/domain/spatial/scene-cache.js.map +1 -0
  157. package/dist/domain/spatial/scene.d.ts +8 -0
  158. package/dist/domain/spatial/scene.js +69 -0
  159. package/dist/domain/spatial/scene.js.map +1 -0
  160. package/dist/domain/spatial/types.d.ts +187 -0
  161. package/dist/domain/spatial/types.js +5 -0
  162. package/dist/domain/spatial/types.js.map +1 -0
  163. package/dist/domain/style/index.d.ts +1 -0
  164. package/dist/domain/style/index.js +2 -0
  165. package/dist/domain/style/index.js.map +1 -0
  166. package/dist/domain/style/prompt-summary.d.ts +2 -0
  167. package/dist/domain/style/prompt-summary.js +11 -0
  168. package/dist/domain/style/prompt-summary.js.map +1 -0
  169. package/dist/domain/style/types.d.ts +32 -0
  170. package/dist/domain/style/types.js +3 -0
  171. package/dist/domain/style/types.js.map +1 -0
  172. package/dist/domain/ui-sketch/draft.d.ts +12 -0
  173. package/dist/domain/ui-sketch/draft.js +424 -0
  174. package/dist/domain/ui-sketch/draft.js.map +1 -0
  175. package/dist/domain/ui-sketch/geometry.d.ts +7 -0
  176. package/dist/domain/ui-sketch/geometry.js +11 -0
  177. package/dist/domain/ui-sketch/geometry.js.map +1 -0
  178. package/dist/domain/ui-sketch/groups.d.ts +5 -0
  179. package/dist/domain/ui-sketch/groups.js +40 -0
  180. package/dist/domain/ui-sketch/groups.js.map +1 -0
  181. package/dist/domain/ui-sketch/index.d.ts +8 -0
  182. package/dist/domain/ui-sketch/index.js +8 -0
  183. package/dist/domain/ui-sketch/index.js.map +1 -0
  184. package/dist/domain/ui-sketch/layers.d.ts +4 -0
  185. package/dist/domain/ui-sketch/layers.js +11 -0
  186. package/dist/domain/ui-sketch/layers.js.map +1 -0
  187. package/dist/domain/ui-sketch/render.d.ts +2 -0
  188. package/dist/domain/ui-sketch/render.js +58 -0
  189. package/dist/domain/ui-sketch/render.js.map +1 -0
  190. package/dist/domain/ui-sketch/standardize.d.ts +17 -0
  191. package/dist/domain/ui-sketch/standardize.js +139 -0
  192. package/dist/domain/ui-sketch/standardize.js.map +1 -0
  193. package/dist/domain/ui-sketch/states.d.ts +5 -0
  194. package/dist/domain/ui-sketch/states.js +21 -0
  195. package/dist/domain/ui-sketch/states.js.map +1 -0
  196. package/dist/domain/ui-sketch/types.d.ts +73 -0
  197. package/dist/domain/ui-sketch/types.js +2 -0
  198. package/dist/domain/ui-sketch/types.js.map +1 -0
  199. package/dist/server/app.d.ts +18 -0
  200. package/dist/server/app.js +108 -0
  201. package/dist/server/app.js.map +1 -0
  202. package/dist/server/image-content-type-parser.d.ts +2 -0
  203. package/dist/server/image-content-type-parser.js +5 -0
  204. package/dist/server/image-content-type-parser.js.map +1 -0
  205. package/dist/server/routes/composition-sessions.d.ts +3 -0
  206. package/dist/server/routes/composition-sessions.js +190 -0
  207. package/dist/server/routes/composition-sessions.js.map +1 -0
  208. package/dist/server/routes/draft-version-routes.d.ts +10 -0
  209. package/dist/server/routes/draft-version-routes.js +201 -0
  210. package/dist/server/routes/draft-version-routes.js.map +1 -0
  211. package/dist/server/routes/image-assets.d.ts +3 -0
  212. package/dist/server/routes/image-assets.js +114 -0
  213. package/dist/server/routes/image-assets.js.map +1 -0
  214. package/dist/server/routes/project-sessions.d.ts +48 -0
  215. package/dist/server/routes/project-sessions.js +305 -0
  216. package/dist/server/routes/project-sessions.js.map +1 -0
  217. package/dist/server/routes/spatial-sessions.d.ts +3 -0
  218. package/dist/server/routes/spatial-sessions.js +80 -0
  219. package/dist/server/routes/spatial-sessions.js.map +1 -0
  220. package/dist/server/routes/style-library.d.ts +3 -0
  221. package/dist/server/routes/style-library.js +308 -0
  222. package/dist/server/routes/style-library.js.map +1 -0
  223. package/dist/server/routes/ui-sketch-sessions.d.ts +3 -0
  224. package/dist/server/routes/ui-sketch-sessions.js +14 -0
  225. package/dist/server/routes/ui-sketch-sessions.js.map +1 -0
  226. package/dist/server/runtime.d.ts +30 -0
  227. package/dist/server/runtime.js +123 -0
  228. package/dist/server/runtime.js.map +1 -0
  229. package/dist/server/spatial-render.d.ts +5 -0
  230. package/dist/server/spatial-render.js +360 -0
  231. package/dist/server/spatial-render.js.map +1 -0
  232. package/dist/server/start.d.ts +1 -0
  233. package/dist/server/start.js +3 -0
  234. package/dist/server/start.js.map +1 -0
  235. package/licenses/THIRD-PARTY-NOTICES.txt +16664 -0
  236. package/licenses/YisiUI-LICENSE +21 -0
  237. package/locales/en/common.json +671 -0
  238. package/migrations/0001_projects_and_sessions.sql +45 -0
  239. package/migrations/0002_composition_versions_and_refinements.sql +26 -0
  240. package/migrations/0003_ui_sketch_draft_versions.sql +12 -0
  241. package/migrations/0004_image_assets.sql +16 -0
  242. package/migrations/0005_style_library.sql +31 -0
  243. package/migrations/0006_session_styles.sql +6 -0
  244. package/migrations/0007_svg_image_assets.sql +19 -0
  245. package/migrations/0008_spatial_spaces.sql +20 -0
  246. package/package.json +82 -0
  247. package/schemas/composition-draft.schema.json +234 -0
  248. package/schemas/composition-refinement-plan.schema.json +758 -0
  249. package/schemas/spatial-draft.schema.json +517 -0
  250. package/schemas/spatial-operations.schema.json +1082 -0
  251. package/schemas/ui-layout-standardization-plan.schema.json +29 -0
  252. package/schemas/ui-sketch-draft.schema.json +197 -0
  253. package/skills/human2ai/SKILL.md +149 -0
  254. package/skills/human2ai/agents/openai.yaml +3 -0
  255. package/skills/human2ai/references/composition-projection.md +170 -0
  256. package/skills/human2ai/references/composition.md +79 -0
  257. package/skills/human2ai/references/spatial.md +188 -0
  258. package/skills/human2ai/references/svg-images.md +27 -0
  259. package/skills/human2ai/references/ui-layout.md +100 -0
  260. package/web/out/404/index.html +1 -0
  261. package/web/out/404.html +1 -0
  262. package/web/out/__next.__PAGE__.txt +26 -0
  263. package/web/out/__next._full.txt +21 -0
  264. package/web/out/__next._tree.txt +4 -0
  265. package/web/out/_next/static/TV-jgcACg6HANZAMZTE2S/_buildManifest.js +1 -0
  266. package/web/out/_next/static/TV-jgcACg6HANZAMZTE2S/_ssgManifest.js +1 -0
  267. package/web/out/_next/static/chunks/130-9fadd0432daff55d.js +1 -0
  268. package/web/out/_next/static/chunks/158-eb00456e1bab68b3.js +52 -0
  269. package/web/out/_next/static/chunks/20-0801fc297cda2a7a.js +1 -0
  270. package/web/out/_next/static/chunks/248-d4a79649dae2a3f8.js +259 -0
  271. package/web/out/_next/static/chunks/678-1305cadf8254d814.js +1 -0
  272. package/web/out/_next/static/chunks/728-eb8b667f79229443.js +1 -0
  273. package/web/out/_next/static/chunks/83607670-bc1279370476e59f.js +1 -0
  274. package/web/out/_next/static/chunks/app/_global-error/page-5eece43b8152c414.js +1 -0
  275. package/web/out/_next/static/chunks/app/_not-found/page-c0cd75ac39fbf9cf.js +1 -0
  276. package/web/out/_next/static/chunks/app/composition/page-051ee2fabb12110a.js +1 -0
  277. package/web/out/_next/static/chunks/app/layout-745ca27ef8830f4f.js +1 -0
  278. package/web/out/_next/static/chunks/app/page-0027378a269a6168.js +1 -0
  279. package/web/out/_next/static/chunks/app/spatial/page-266dedc81784d4f6.js +1 -0
  280. package/web/out/_next/static/chunks/app/styles/page-d5cb83af828ea9ed.js +1 -0
  281. package/web/out/_next/static/chunks/app/ui-sketch/page-2a8436e05a05c618.js +1 -0
  282. package/web/out/_next/static/chunks/c3f2cda1-9e279dab137b7272.js +342 -0
  283. package/web/out/_next/static/chunks/c7879cf7-7873c8afd9c9c666.js +1 -0
  284. package/web/out/_next/static/chunks/framework-6eacf80ec1e4c887.js +1 -0
  285. package/web/out/_next/static/chunks/main-5ee8fd93319f955c.js +5 -0
  286. package/web/out/_next/static/chunks/main-app-0cf10803ab17c700.js +1 -0
  287. package/web/out/_next/static/chunks/next/dist/client/components/builtin/app-error-5eece43b8152c414.js +1 -0
  288. package/web/out/_next/static/chunks/next/dist/client/components/builtin/forbidden-5eece43b8152c414.js +1 -0
  289. package/web/out/_next/static/chunks/next/dist/client/components/builtin/global-error-728204b7cccc4ed2.js +1 -0
  290. package/web/out/_next/static/chunks/next/dist/client/components/builtin/not-found-5eece43b8152c414.js +1 -0
  291. package/web/out/_next/static/chunks/next/dist/client/components/builtin/unauthorized-5eece43b8152c414.js +1 -0
  292. package/web/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  293. package/web/out/_next/static/chunks/webpack-97ae63c0e0b2a512.js +1 -0
  294. package/web/out/_next/static/css/3b7982b41ed8eccd.css +4 -0
  295. package/web/out/_next/static/css/81ae71f1d3e9a866.css +1 -0
  296. package/web/out/_next/static/css/8c3843f4951fa9f6.css +5 -0
  297. package/web/out/_next/static/css/c739d0131cdcc891.css +1 -0
  298. package/web/out/_next/static/css/ce1b4bb3ad3c6073.css +1 -0
  299. package/web/out/_next/static/css/db96ae2e88545d96.css +1 -0
  300. package/web/out/_not-found/__next._full.txt +18 -0
  301. package/web/out/_not-found/__next._not-found.__PAGE__.txt +24 -0
  302. package/web/out/_not-found/__next._tree.txt +3 -0
  303. package/web/out/_not-found/index.html +1 -0
  304. package/web/out/_not-found/index.txt +18 -0
  305. package/web/out/composition/__next._full.txt +25 -0
  306. package/web/out/composition/__next._tree.txt +6 -0
  307. package/web/out/composition/__next.composition.__PAGE__.txt +31 -0
  308. package/web/out/composition/index.html +1 -0
  309. package/web/out/composition/index.txt +25 -0
  310. package/web/out/index.html +1 -0
  311. package/web/out/index.txt +21 -0
  312. package/web/out/spatial/__next._full.txt +23 -0
  313. package/web/out/spatial/__next._tree.txt +4 -0
  314. package/web/out/spatial/__next.spatial.__PAGE__.txt +29 -0
  315. package/web/out/spatial/index.html +1 -0
  316. package/web/out/spatial/index.txt +23 -0
  317. package/web/out/styles/__next._full.txt +23 -0
  318. package/web/out/styles/__next._tree.txt +4 -0
  319. package/web/out/styles/__next.styles.__PAGE__.txt +29 -0
  320. package/web/out/styles/index.html +1 -0
  321. package/web/out/styles/index.txt +23 -0
  322. package/web/out/ui-sketch/__next._full.txt +25 -0
  323. package/web/out/ui-sketch/__next._tree.txt +6 -0
  324. package/web/out/ui-sketch/__next.ui-sketch.__PAGE__.txt +31 -0
  325. package/web/out/ui-sketch/index.html +1 -0
  326. package/web/out/ui-sketch/index.txt +25 -0
@@ -0,0 +1,45 @@
1
+ CREATE TABLE projects (
2
+ id TEXT PRIMARY KEY,
3
+ name TEXT NOT NULL CHECK (length(trim(name)) > 0),
4
+ description TEXT,
5
+ revision INTEGER NOT NULL DEFAULT 1 CHECK (revision > 0),
6
+ created_at TEXT NOT NULL,
7
+ updated_at TEXT NOT NULL
8
+ ) STRICT;
9
+
10
+ CREATE TABLE session_types (
11
+ code TEXT PRIMARY KEY
12
+ ) STRICT;
13
+
14
+ INSERT INTO session_types (code)
15
+ VALUES ('image-composition'), ('ui-layout');
16
+
17
+ CREATE TABLE sessions (
18
+ id TEXT PRIMARY KEY,
19
+ project_id TEXT,
20
+ session_type TEXT NOT NULL,
21
+ title TEXT NOT NULL CHECK (length(trim(title)) > 0),
22
+ lifecycle_stage TEXT NOT NULL DEFAULT 'draft'
23
+ CHECK (lifecycle_stage IN ('draft', 'interpreted', 'approved', 'exported')),
24
+ revision INTEGER NOT NULL DEFAULT 1 CHECK (revision > 0),
25
+ created_at TEXT NOT NULL,
26
+ updated_at TEXT NOT NULL,
27
+ FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE SET NULL,
28
+ FOREIGN KEY (session_type) REFERENCES session_types(code)
29
+ ) STRICT;
30
+
31
+ CREATE INDEX sessions_project_updated_idx
32
+ ON sessions (project_id, updated_at DESC);
33
+
34
+ CREATE INDEX sessions_type_updated_idx
35
+ ON sessions (session_type, updated_at DESC);
36
+
37
+ CREATE TABLE composition_sessions (
38
+ session_id TEXT PRIMARY KEY,
39
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
40
+ ) STRICT;
41
+
42
+ CREATE TABLE ui_sessions (
43
+ session_id TEXT PRIMARY KEY,
44
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
45
+ ) STRICT;
@@ -0,0 +1,26 @@
1
+ CREATE TABLE composition_draft_versions (
2
+ id TEXT PRIMARY KEY,
3
+ session_id TEXT NOT NULL,
4
+ revision INTEGER NOT NULL CHECK (revision > 0),
5
+ fingerprint TEXT NOT NULL,
6
+ draft_json TEXT NOT NULL CHECK (json_valid(draft_json)),
7
+ created_at TEXT NOT NULL,
8
+ UNIQUE (session_id, revision),
9
+ FOREIGN KEY (session_id) REFERENCES composition_sessions(session_id) ON DELETE CASCADE
10
+ ) STRICT;
11
+
12
+ CREATE INDEX composition_draft_versions_session_created_idx
13
+ ON composition_draft_versions (session_id, revision DESC);
14
+
15
+ CREATE TABLE composition_refinement_runs (
16
+ id TEXT PRIMARY KEY,
17
+ source_draft_version_id TEXT NOT NULL,
18
+ plan_json TEXT NOT NULL CHECK (json_valid(plan_json)),
19
+ result_json TEXT NOT NULL CHECK (json_valid(result_json)),
20
+ created_at TEXT NOT NULL,
21
+ FOREIGN KEY (source_draft_version_id)
22
+ REFERENCES composition_draft_versions(id) ON DELETE CASCADE
23
+ ) STRICT;
24
+
25
+ CREATE INDEX composition_refinement_runs_source_created_idx
26
+ ON composition_refinement_runs (source_draft_version_id, created_at DESC);
@@ -0,0 +1,12 @@
1
+ CREATE TABLE ui_sketch_draft_versions (
2
+ id TEXT PRIMARY KEY,
3
+ session_id TEXT NOT NULL,
4
+ revision INTEGER NOT NULL CHECK (revision > 0),
5
+ draft_json TEXT NOT NULL CHECK (json_valid(draft_json)),
6
+ created_at TEXT NOT NULL,
7
+ UNIQUE (session_id, revision),
8
+ FOREIGN KEY (session_id) REFERENCES ui_sessions(session_id) ON DELETE CASCADE
9
+ ) STRICT;
10
+
11
+ CREATE INDEX ui_sketch_draft_versions_session_created_idx
12
+ ON ui_sketch_draft_versions (session_id, revision DESC);
@@ -0,0 +1,16 @@
1
+ CREATE TABLE image_assets (
2
+ id TEXT PRIMARY KEY,
3
+ session_id TEXT NOT NULL,
4
+ relative_path TEXT NOT NULL UNIQUE,
5
+ original_filename TEXT NOT NULL,
6
+ mime_type TEXT NOT NULL CHECK (mime_type IN ('image/png', 'image/jpeg', 'image/webp')),
7
+ byte_size INTEGER NOT NULL CHECK (byte_size > 0),
8
+ width INTEGER NOT NULL CHECK (width > 0),
9
+ height INTEGER NOT NULL CHECK (height > 0),
10
+ sha256 TEXT NOT NULL,
11
+ created_at TEXT NOT NULL,
12
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
13
+ ) STRICT;
14
+
15
+ CREATE INDEX image_assets_session_created_idx
16
+ ON image_assets (session_id, created_at DESC);
@@ -0,0 +1,31 @@
1
+ CREATE TABLE style_entries (
2
+ id TEXT PRIMARY KEY,
3
+ name TEXT NOT NULL CHECK (length(trim(name)) > 0),
4
+ category TEXT NOT NULL CHECK (category IN ('visual', 'ui')),
5
+ creator_type TEXT NOT NULL CHECK (creator_type IN ('user', 'agent')),
6
+ description TEXT NOT NULL CHECK (length(trim(description)) > 0),
7
+ revision INTEGER NOT NULL DEFAULT 1 CHECK (revision > 0),
8
+ created_at TEXT NOT NULL,
9
+ updated_at TEXT NOT NULL
10
+ ) STRICT;
11
+
12
+ CREATE INDEX style_entries_updated_idx
13
+ ON style_entries (updated_at DESC, id);
14
+
15
+ CREATE TABLE style_reference_images (
16
+ id TEXT PRIMARY KEY,
17
+ style_id TEXT NOT NULL,
18
+ relative_path TEXT NOT NULL UNIQUE,
19
+ original_filename TEXT NOT NULL,
20
+ mime_type TEXT NOT NULL CHECK (mime_type IN ('image/png', 'image/jpeg', 'image/webp')),
21
+ byte_size INTEGER NOT NULL CHECK (byte_size > 0),
22
+ width INTEGER NOT NULL CHECK (width > 0),
23
+ height INTEGER NOT NULL CHECK (height > 0),
24
+ position INTEGER NOT NULL CHECK (position >= 0),
25
+ created_at TEXT NOT NULL,
26
+ UNIQUE (style_id, position),
27
+ FOREIGN KEY (style_id) REFERENCES style_entries(id) ON DELETE CASCADE
28
+ ) STRICT;
29
+
30
+ CREATE INDEX style_reference_images_style_position_idx
31
+ ON style_reference_images (style_id, position);
@@ -0,0 +1,6 @@
1
+ ALTER TABLE style_entries ADD COLUMN prompt_summary TEXT;
2
+ ALTER TABLE sessions ADD COLUMN style_id TEXT REFERENCES style_entries(id) ON DELETE SET NULL;
3
+ CREATE INDEX sessions_style_idx ON sessions(style_id);
4
+
5
+ ALTER TABLE composition_draft_versions ADD COLUMN style_processing_json TEXT;
6
+ ALTER TABLE ui_sketch_draft_versions ADD COLUMN style_processing_json TEXT;
@@ -0,0 +1,19 @@
1
+ CREATE TABLE image_assets_with_svg (
2
+ id TEXT PRIMARY KEY,
3
+ session_id TEXT NOT NULL,
4
+ relative_path TEXT NOT NULL UNIQUE,
5
+ original_filename TEXT NOT NULL,
6
+ mime_type TEXT NOT NULL CHECK (mime_type IN ('image/png', 'image/jpeg', 'image/webp', 'image/svg+xml')),
7
+ byte_size INTEGER NOT NULL CHECK (byte_size > 0),
8
+ width INTEGER NOT NULL CHECK (width > 0),
9
+ height INTEGER NOT NULL CHECK (height > 0),
10
+ sha256 TEXT NOT NULL,
11
+ created_at TEXT NOT NULL,
12
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
13
+ ) STRICT;
14
+
15
+ INSERT INTO image_assets_with_svg SELECT * FROM image_assets;
16
+ DROP TABLE image_assets;
17
+ ALTER TABLE image_assets_with_svg RENAME TO image_assets;
18
+ CREATE INDEX image_assets_session_created_idx
19
+ ON image_assets (session_id, created_at DESC);
@@ -0,0 +1,20 @@
1
+ INSERT INTO session_types (code) VALUES ('spatial');
2
+
3
+ CREATE TABLE spatial_sessions (
4
+ session_id TEXT PRIMARY KEY,
5
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
6
+ ) STRICT;
7
+
8
+ CREATE TABLE spatial_draft_versions (
9
+ id TEXT PRIMARY KEY,
10
+ session_id TEXT NOT NULL,
11
+ revision INTEGER NOT NULL CHECK (revision > 0),
12
+ draft_json TEXT NOT NULL CHECK (json_valid(draft_json)),
13
+ created_at TEXT NOT NULL,
14
+ style_processing_json TEXT CHECK (style_processing_json IS NULL OR json_valid(style_processing_json)),
15
+ UNIQUE (session_id, revision),
16
+ FOREIGN KEY (session_id) REFERENCES spatial_sessions(session_id) ON DELETE CASCADE
17
+ ) STRICT;
18
+
19
+ CREATE INDEX spatial_draft_versions_session_revision_idx
20
+ ON spatial_draft_versions (session_id, revision DESC);
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "human2ai",
3
+ "version": "0.1.0",
4
+ "description": "Local visual collaboration workspace for people and AI agents, with a browser UI and CLI.",
5
+ "license": "MIT",
6
+ "author": "贾思斋",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/yisi-ai/human2ai.git"
10
+ },
11
+ "homepage": "https://github.com/yisi-ai/human2ai#readme",
12
+ "bugs": "https://github.com/yisi-ai/human2ai/issues",
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "registry": "https://registry.npmjs.org/"
16
+ },
17
+ "type": "module",
18
+ "bin": {
19
+ "human2ai": "./dist/cli/main.js",
20
+ "h2a": "./dist/cli/main.js"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "web/out",
25
+ "migrations",
26
+ "schemas",
27
+ "skills/human2ai",
28
+ "locales/en/common.json",
29
+ "licenses",
30
+ "assets/quaternius"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22"
34
+ },
35
+ "packageManager": "npm@11",
36
+ "workspaces": [
37
+ "web",
38
+ "design-system/surfaces/*",
39
+ "storybook"
40
+ ],
41
+ "scripts": {
42
+ "dev": "node scripts/dev.mjs",
43
+ "dev:web": "npm run dev --workspace web",
44
+ "cli": "tsx src/cli/main.ts",
45
+ "server:dev": "tsx watch src/server/start.ts",
46
+ "build": "npm run build:server && npm run build:web",
47
+ "build:server": "tsc -p tsconfig.build.json",
48
+ "build:web": "npm run build --workspace web",
49
+ "prepack": "npm run build && node scripts/prepare-package.mjs && node scripts/check-package.mjs",
50
+ "pack:check": "npm run prepack",
51
+ "repository:check": "node scripts/check-repository.mjs",
52
+ "typecheck": "npm run typecheck:server && npm run typecheck:web && npm run storybook:typecheck",
53
+ "typecheck:server": "tsc --noEmit -p tsconfig.json",
54
+ "typecheck:web": "npm run typecheck --workspace web",
55
+ "domain-baseline:check": "node scripts/domain-baseline.mjs check",
56
+ "domain-baseline:test": "node scripts/domain-baseline.mjs test",
57
+ "i18n:check": "node scripts/check-i18n.mjs",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest",
60
+ "storybook": "npm run storybook --workspace @human2ai/storybook",
61
+ "storybook:build": "npm run build --workspace @human2ai/storybook",
62
+ "storybook:typecheck": "npm run typecheck --workspace @human2ai/storybook",
63
+ "yisiui": "node .yisiui/launcher.mjs"
64
+ },
65
+ "dependencies": {
66
+ "@fastify/static": "10.1.3",
67
+ "ajv": "8.20.0",
68
+ "better-sqlite3": "13.0.3",
69
+ "fastify": "5.12.1",
70
+ "saxes": "6.0.0",
71
+ "sharp": "0.35.3",
72
+ "three": "0.186.0"
73
+ },
74
+ "devDependencies": {
75
+ "@types/better-sqlite3": "9.6.0",
76
+ "@types/node": "22.15.3",
77
+ "@types/three": "0.185.0",
78
+ "tsx": "4.23.12",
79
+ "typescript": "5.8.3",
80
+ "vitest": "4.1.11"
81
+ }
82
+ }
@@ -0,0 +1,234 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yisi.local/schemas/composition-draft.schema.json",
4
+ "title": "User Composition Draft",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["version", "kind", "processingSemantic", "frame", "overallNote", "focusPoints", "areas", "images"],
8
+ "allOf": [
9
+ { "if": { "required": ["states"] }, "then": { "required": ["activeStateId"] } },
10
+ { "if": { "required": ["activeStateId"] }, "then": { "required": ["states"] } }
11
+ ],
12
+ "properties": {
13
+ "activeStateId": { "type": "string", "minLength": 1 },
14
+ "states": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/state" } },
15
+ "layerOrder": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
16
+ "version": { "const": 1 },
17
+ "kind": { "const": "composition-draft" },
18
+ "processingSemantic": { "enum": [null, "scene-composition", "editorial-layout"] },
19
+ "frame": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": ["width", "height"],
23
+ "properties": {
24
+ "width": { "type": "integer", "minimum": 256, "maximum": 4096 },
25
+ "height": { "type": "integer", "minimum": 256, "maximum": 4096 },
26
+ "bounds": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["x", "y", "width", "height"],
30
+ "properties": {
31
+ "x": { "type": "number" },
32
+ "y": { "type": "number" },
33
+ "width": { "type": "number", "exclusiveMinimum": 0 },
34
+ "height": { "type": "number", "exclusiveMinimum": 0 }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "overallNote": { "type": "string" },
40
+ "focusPoints": {
41
+ "type": "array",
42
+ "maxItems": 3,
43
+ "items": { "$ref": "#/$defs/point" }
44
+ },
45
+ "directionLine": {
46
+ "oneOf": [
47
+ { "type": "null" },
48
+ {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": ["id", "x", "y", "rotation", "note", "annotation", "semanticType", "shotScale"],
52
+ "properties": {
53
+ "id": { "const": "direction-1" },
54
+ "x": { "type": "number" },
55
+ "y": { "type": "number" },
56
+ "rotation": { "type": "number" },
57
+ "origin": { "enum": ["user", "agent", "import"] },
58
+ "note": { "type": "string" },
59
+ "annotation": { "type": "string" },
60
+ "semanticType": { "type": "string" },
61
+ "shotScale": { "enum": ["auto", "foreground", "midground", "background"] }
62
+ }
63
+ }
64
+ ]
65
+ },
66
+ "areas": {
67
+ "type": "array",
68
+ "items": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["id", "primitive", "x", "y", "area", "aspect", "visualWeight", "note", "annotation", "semanticType", "shotScale"],
72
+ "properties": {
73
+ "id": { "type": "string", "pattern": "^area-[0-9]+$" },
74
+ "primitive": { "enum": ["circle", "triangle", "quadrilateral"] },
75
+ "x": { "type": "number" },
76
+ "y": { "type": "number" },
77
+ "area": { "type": "number", "exclusiveMinimum": 0 },
78
+ "aspect": { "enum": ["square", "free", "landscape", "portrait"] },
79
+ "visualWeight": { "enum": ["auto", "high", "medium", "low", "decorative"] },
80
+ "displayText": { "type": "string" },
81
+ "isLightSource": { "type": "boolean" },
82
+ "rotation": { "type": "number" },
83
+ "width": { "type": "number", "exclusiveMinimum": 0 },
84
+ "height": { "type": "number", "exclusiveMinimum": 0 },
85
+ "origin": { "enum": ["user", "agent", "import"] },
86
+ "note": { "type": "string" },
87
+ "annotation": { "type": "string" },
88
+ "semanticType": { "type": "string" },
89
+ "shotScale": { "enum": ["auto", "foreground", "midground", "background"] }
90
+ },
91
+ "allOf": [
92
+ {
93
+ "if": { "properties": { "aspect": { "const": "free" } } },
94
+ "then": { "required": ["width", "height"] }
95
+ },
96
+ {
97
+ "if": {
98
+ "properties": { "semanticType": { "const": "text-region" } },
99
+ "required": ["semanticType"]
100
+ },
101
+ "then": { "required": ["displayText"], "properties": { "isLightSource": { "const": false } } },
102
+ "else": { "not": { "required": ["displayText"] } }
103
+ }
104
+ ]
105
+ }
106
+ },
107
+ "images": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["id", "x", "y", "width", "height", "rotation", "visualWeight", "assetId", "crop", "note", "annotation", "semanticType", "shotScale"],
113
+ "properties": {
114
+ "id": { "type": "string", "pattern": "^image-[0-9]+$" },
115
+ "x": { "type": "number" },
116
+ "y": { "type": "number" },
117
+ "width": { "type": "number", "exclusiveMinimum": 0 },
118
+ "height": { "type": "number", "exclusiveMinimum": 0 },
119
+ "rotation": { "type": "number" },
120
+ "visualWeight": { "enum": ["auto", "high", "medium", "low", "decorative"] },
121
+ "cameraReference": {
122
+ "type": "object", "additionalProperties": false,
123
+ "required": ["sessionId", "cameraId", "renderedRevision"],
124
+ "properties": {
125
+ "sessionId": { "type": "string", "minLength": 1 },
126
+ "cameraId": { "type": "string", "minLength": 1 },
127
+ "renderedRevision": { "type": "integer", "minimum": 0 }
128
+ }
129
+ },
130
+ "assetId": {
131
+ "type": ["string", "null"],
132
+ "minLength": 1
133
+ },
134
+ "crop": {
135
+ "oneOf": [
136
+ { "type": "null" },
137
+ { "$ref": "#/$defs/imageCrop" }
138
+ ]
139
+ },
140
+ "origin": { "enum": ["user", "agent", "import"] },
141
+ "note": { "type": "string" },
142
+ "annotation": { "type": "string" },
143
+ "semanticType": { "type": "string" },
144
+ "shotScale": { "enum": ["auto", "foreground", "midground", "background"] }
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "$defs": {
150
+ "state": {
151
+ "type": "object", "additionalProperties": false,
152
+ "required": ["id", "number", "layout"],
153
+ "properties": {
154
+ "id": { "type": "string", "minLength": 1, "maxLength": 100 },
155
+ "number": { "type": "integer", "minimum": 1 },
156
+ "name": { "type": "string", "minLength": 1, "maxLength": 100 },
157
+ "layout": {
158
+ "type": "object", "additionalProperties": false,
159
+ "required": ["frame", "layerOrder", "focusPoints", "directionLine", "areas", "images"],
160
+ "properties": {
161
+ "frame": { "allOf": [{ "$ref": "#/properties/frame" }, { "type": "object", "required": ["bounds"] }] },
162
+ "layerOrder": { "$ref": "#/properties/layerOrder" },
163
+ "focusPoints": { "type": "array", "maxItems": 3, "items": { "$ref": "#/$defs/layoutPoint" } },
164
+ "directionLine": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/layoutDirection" }] },
165
+ "areas": { "type": "array", "items": { "$ref": "#/$defs/layoutArea" } },
166
+ "images": { "type": "array", "items": { "$ref": "#/$defs/layoutImage" } }
167
+ }
168
+ }
169
+ }
170
+ },
171
+ "layoutPoint": {
172
+ "type": "object", "additionalProperties": false, "required": ["id", "x", "y"],
173
+ "properties": {
174
+ "id": { "type": "string", "pattern": "^focus-[0-9]+$" },
175
+ "x": { "type": "number" }, "y": { "type": "number" }
176
+ }
177
+ },
178
+ "layoutDirection": {
179
+ "type": "object", "additionalProperties": false, "required": ["id", "x", "y", "rotation"],
180
+ "properties": {
181
+ "id": { "const": "direction-1" }, "x": { "type": "number" }, "y": { "type": "number" },
182
+ "rotation": { "type": "number" }
183
+ }
184
+ },
185
+ "layoutArea": {
186
+ "type": "object", "additionalProperties": false, "required": ["id", "x", "y", "area", "aspect"],
187
+ "properties": {
188
+ "id": { "type": "string", "pattern": "^area-[0-9]+$" },
189
+ "x": { "type": "number" }, "y": { "type": "number" },
190
+ "area": { "type": "number", "exclusiveMinimum": 0 },
191
+ "aspect": { "enum": ["square", "free", "landscape", "portrait"] },
192
+ "rotation": { "type": "number" },
193
+ "width": { "type": "number", "exclusiveMinimum": 0 },
194
+ "height": { "type": "number", "exclusiveMinimum": 0 }
195
+ },
196
+ "allOf": [{ "if": { "properties": { "aspect": { "const": "free" } } }, "then": { "required": ["width", "height"] } }]
197
+ },
198
+ "layoutImage": {
199
+ "type": "object", "additionalProperties": false, "required": ["id", "x", "y", "width", "height", "rotation"],
200
+ "properties": {
201
+ "id": { "type": "string", "pattern": "^image-[0-9]+$" },
202
+ "x": { "type": "number" }, "y": { "type": "number" },
203
+ "width": { "type": "number", "exclusiveMinimum": 0 },
204
+ "height": { "type": "number", "exclusiveMinimum": 0 }, "rotation": { "type": "number" }
205
+ }
206
+ },
207
+ "imageCrop": {
208
+ "type": "object",
209
+ "additionalProperties": false,
210
+ "required": ["x", "y", "width", "height"],
211
+ "properties": {
212
+ "x": { "type": "number", "minimum": 0, "maximum": 1 },
213
+ "y": { "type": "number", "minimum": 0, "maximum": 1 },
214
+ "width": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 },
215
+ "height": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 }
216
+ }
217
+ },
218
+ "point": {
219
+ "type": "object",
220
+ "additionalProperties": false,
221
+ "required": ["id", "x", "y", "note", "annotation", "semanticType", "shotScale"],
222
+ "properties": {
223
+ "id": { "type": "string", "pattern": "^focus-[0-9]+$" },
224
+ "x": { "type": "number" },
225
+ "y": { "type": "number" },
226
+ "origin": { "enum": ["user", "agent", "import"] },
227
+ "note": { "type": "string" },
228
+ "annotation": { "type": "string" },
229
+ "semanticType": { "type": "string" },
230
+ "shotScale": { "enum": ["auto", "foreground", "midground", "background"] }
231
+ }
232
+ }
233
+ }
234
+ }