@lingjingai/scriptctl 0.63.14 → 0.63.15

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 (777) hide show
  1. package/README.md +7 -1
  2. package/changes/0.63.15.md +15 -0
  3. package/dist/bin.js +1 -20844
  4. package/dist/chunk-3LPIMYYI.js +823 -0
  5. package/dist/cli.d.ts +214 -5
  6. package/dist/cli.js +1 -187
  7. package/dist/review-agent.js +56 -3593
  8. package/package.json +12 -5
  9. package/dist/bin.d.ts +0 -2
  10. package/dist/bin.js.map +0 -7
  11. package/dist/cli/register-authoring.d.ts +0 -4
  12. package/dist/cli/register-authoring.js +0 -35
  13. package/dist/cli/register-authoring.js.map +0 -1
  14. package/dist/cli/register-review.d.ts +0 -3
  15. package/dist/cli/register-review.js +0 -20
  16. package/dist/cli/register-review.js.map +0 -1
  17. package/dist/cli/register-script.d.ts +0 -3
  18. package/dist/cli/register-script.js +0 -297
  19. package/dist/cli/register-script.js.map +0 -1
  20. package/dist/cli/register-tools.d.ts +0 -3
  21. package/dist/cli/register-tools.js +0 -23
  22. package/dist/cli/register-tools.js.map +0 -1
  23. package/dist/cli/register-workflows.d.ts +0 -4
  24. package/dist/cli/register-workflows.js +0 -108
  25. package/dist/cli/register-workflows.js.map +0 -1
  26. package/dist/cli/registry.d.ts +0 -14
  27. package/dist/cli/registry.js +0 -65
  28. package/dist/cli/registry.js.map +0 -1
  29. package/dist/cli.js.map +0 -1
  30. package/dist/common.d.ts +0 -93
  31. package/dist/common.js +0 -240
  32. package/dist/common.js.map +0 -1
  33. package/dist/domain/authoring/apply.d.ts +0 -1
  34. package/dist/domain/authoring/apply.js +0 -2
  35. package/dist/domain/authoring/apply.js.map +0 -1
  36. package/dist/domain/authoring/export.d.ts +0 -1
  37. package/dist/domain/authoring/export.js +0 -2
  38. package/dist/domain/authoring/export.js.map +0 -1
  39. package/dist/domain/authoring/parser.d.ts +0 -2
  40. package/dist/domain/authoring/parser.js +0 -3
  41. package/dist/domain/authoring/parser.js.map +0 -1
  42. package/dist/domain/authoring/serializer.d.ts +0 -1
  43. package/dist/domain/authoring/serializer.js +0 -2
  44. package/dist/domain/authoring/serializer.js.map +0 -1
  45. package/dist/domain/authoring/shared/bracket.d.ts +0 -4
  46. package/dist/domain/authoring/shared/bracket.js +0 -95
  47. package/dist/domain/authoring/shared/bracket.js.map +0 -1
  48. package/dist/domain/authoring/shared/types.d.ts +0 -12
  49. package/dist/domain/authoring/shared/types.js +0 -2
  50. package/dist/domain/authoring/shared/types.js.map +0 -1
  51. package/dist/domain/authoring/types.d.ts +0 -2
  52. package/dist/domain/authoring/types.js +0 -3
  53. package/dist/domain/authoring/types.js.map +0 -1
  54. package/dist/domain/authoring/v3/apply.d.ts +0 -33
  55. package/dist/domain/authoring/v3/apply.js +0 -784
  56. package/dist/domain/authoring/v3/apply.js.map +0 -1
  57. package/dist/domain/authoring/v3/export.d.ts +0 -7
  58. package/dist/domain/authoring/v3/export.js +0 -85
  59. package/dist/domain/authoring/v3/export.js.map +0 -1
  60. package/dist/domain/authoring/v3/parser.d.ts +0 -3
  61. package/dist/domain/authoring/v3/parser.js +0 -823
  62. package/dist/domain/authoring/v3/parser.js.map +0 -1
  63. package/dist/domain/authoring/v3/serializer.d.ts +0 -2
  64. package/dist/domain/authoring/v3/serializer.js +0 -244
  65. package/dist/domain/authoring/v3/serializer.js.map +0 -1
  66. package/dist/domain/authoring/v3/types.d.ts +0 -76
  67. package/dist/domain/authoring/v3/types.js +0 -2
  68. package/dist/domain/authoring/v3/types.js.map +0 -1
  69. package/dist/domain/authoring/v4/apply.d.ts +0 -40
  70. package/dist/domain/authoring/v4/apply.js +0 -451
  71. package/dist/domain/authoring/v4/apply.js.map +0 -1
  72. package/dist/domain/authoring/v4/parser.d.ts +0 -2
  73. package/dist/domain/authoring/v4/parser.js +0 -729
  74. package/dist/domain/authoring/v4/parser.js.map +0 -1
  75. package/dist/domain/authoring/v4/serializer.d.ts +0 -6
  76. package/dist/domain/authoring/v4/serializer.js +0 -280
  77. package/dist/domain/authoring/v4/serializer.js.map +0 -1
  78. package/dist/domain/authoring/v4/types.d.ts +0 -50
  79. package/dist/domain/authoring/v4/types.js +0 -2
  80. package/dist/domain/authoring/v4/types.js.map +0 -1
  81. package/dist/domain/creative-draft/compose.d.ts +0 -18
  82. package/dist/domain/creative-draft/compose.js +0 -448
  83. package/dist/domain/creative-draft/compose.js.map +0 -1
  84. package/dist/domain/ingest/apply-plan.d.ts +0 -23
  85. package/dist/domain/ingest/apply-plan.js +0 -210
  86. package/dist/domain/ingest/apply-plan.js.map +0 -1
  87. package/dist/domain/ingest/assembler.d.ts +0 -65
  88. package/dist/domain/ingest/assembler.js +0 -263
  89. package/dist/domain/ingest/assembler.js.map +0 -1
  90. package/dist/domain/ingest/asset-audit.d.ts +0 -50
  91. package/dist/domain/ingest/asset-audit.js +0 -196
  92. package/dist/domain/ingest/asset-audit.js.map +0 -1
  93. package/dist/domain/ingest/chunker.d.ts +0 -9
  94. package/dist/domain/ingest/chunker.js +0 -49
  95. package/dist/domain/ingest/chunker.js.map +0 -1
  96. package/dist/domain/ingest/environment.d.ts +0 -3
  97. package/dist/domain/ingest/environment.js +0 -32
  98. package/dist/domain/ingest/environment.js.map +0 -1
  99. package/dist/domain/ingest/evidence.d.ts +0 -5
  100. package/dist/domain/ingest/evidence.js +0 -66
  101. package/dist/domain/ingest/evidence.js.map +0 -1
  102. package/dist/domain/ingest/govern.d.ts +0 -3
  103. package/dist/domain/ingest/govern.js +0 -157
  104. package/dist/domain/ingest/govern.js.map +0 -1
  105. package/dist/domain/ingest/jsonl-parser.d.ts +0 -6
  106. package/dist/domain/ingest/jsonl-parser.js +0 -204
  107. package/dist/domain/ingest/jsonl-parser.js.map +0 -1
  108. package/dist/domain/ingest/markdown-parser.d.ts +0 -6
  109. package/dist/domain/ingest/markdown-parser.js +0 -187
  110. package/dist/domain/ingest/markdown-parser.js.map +0 -1
  111. package/dist/domain/ingest/production-validation.d.ts +0 -8
  112. package/dist/domain/ingest/production-validation.js +0 -37
  113. package/dist/domain/ingest/production-validation.js.map +0 -1
  114. package/dist/domain/ingest/records.d.ts +0 -72
  115. package/dist/domain/ingest/records.js +0 -10
  116. package/dist/domain/ingest/records.js.map +0 -1
  117. package/dist/domain/ingest/renumber.d.ts +0 -14
  118. package/dist/domain/ingest/renumber.js +0 -130
  119. package/dist/domain/ingest/renumber.js.map +0 -1
  120. package/dist/domain/ingest/serial-context.d.ts +0 -93
  121. package/dist/domain/ingest/serial-context.js +0 -355
  122. package/dist/domain/ingest/serial-context.js.map +0 -1
  123. package/dist/domain/ingest/state-identity.d.ts +0 -2
  124. package/dist/domain/ingest/state-identity.js +0 -3
  125. package/dist/domain/ingest/state-identity.js.map +0 -1
  126. package/dist/domain/ingest/state-reconcile.d.ts +0 -12
  127. package/dist/domain/ingest/state-reconcile.js +0 -92
  128. package/dist/domain/ingest/state-reconcile.js.map +0 -1
  129. package/dist/domain/ingest/validation.d.ts +0 -1
  130. package/dist/domain/ingest/validation.js +0 -2
  131. package/dist/domain/ingest/validation.js.map +0 -1
  132. package/dist/domain/ingest/video-apply.d.ts +0 -4
  133. package/dist/domain/ingest/video-apply.js +0 -128
  134. package/dist/domain/ingest/video-apply.js.map +0 -1
  135. package/dist/domain/ingest/video-context.d.ts +0 -64
  136. package/dist/domain/ingest/video-context.js +0 -480
  137. package/dist/domain/ingest/video-context.js.map +0 -1
  138. package/dist/domain/ingest/video-records.d.ts +0 -57
  139. package/dist/domain/ingest/video-records.js +0 -9
  140. package/dist/domain/ingest/video-records.js.map +0 -1
  141. package/dist/domain/ingest/video-serial-md.d.ts +0 -81
  142. package/dist/domain/ingest/video-serial-md.js +0 -297
  143. package/dist/domain/ingest/video-serial-md.js.map +0 -1
  144. package/dist/domain/ingest/video-source-evolution.d.ts +0 -25
  145. package/dist/domain/ingest/video-source-evolution.js +0 -40
  146. package/dist/domain/ingest/video-source-evolution.js.map +0 -1
  147. package/dist/domain/ingest/video-state-evidence.d.ts +0 -66
  148. package/dist/domain/ingest/video-state-evidence.js +0 -385
  149. package/dist/domain/ingest/video-state-evidence.js.map +0 -1
  150. package/dist/domain/ingest/video-timestamp.d.ts +0 -8
  151. package/dist/domain/ingest/video-timestamp.js +0 -26
  152. package/dist/domain/ingest/video-timestamp.js.map +0 -1
  153. package/dist/domain/loom/checkpointer.d.ts +0 -3
  154. package/dist/domain/loom/checkpointer.js +0 -30
  155. package/dist/domain/loom/checkpointer.js.map +0 -1
  156. package/dist/domain/loom/index.d.ts +0 -45
  157. package/dist/domain/loom/index.js +0 -277
  158. package/dist/domain/loom/index.js.map +0 -1
  159. package/dist/domain/loom/types.d.ts +0 -101
  160. package/dist/domain/loom/types.js +0 -2
  161. package/dist/domain/loom/types.js.map +0 -1
  162. package/dist/domain/script/address.d.ts +0 -1
  163. package/dist/domain/script/address.js +0 -2
  164. package/dist/domain/script/address.js.map +0 -1
  165. package/dist/domain/script/dispatch.d.ts +0 -18
  166. package/dist/domain/script/dispatch.js +0 -55
  167. package/dist/domain/script/dispatch.js.map +0 -1
  168. package/dist/domain/script/lookups.d.ts +0 -1
  169. package/dist/domain/script/lookups.js +0 -2
  170. package/dist/domain/script/lookups.js.map +0 -1
  171. package/dist/domain/script/migrations/registry.d.ts +0 -4
  172. package/dist/domain/script/migrations/registry.js +0 -76
  173. package/dist/domain/script/migrations/registry.js.map +0 -1
  174. package/dist/domain/script/migrations/types.d.ts +0 -17
  175. package/dist/domain/script/migrations/types.js +0 -2
  176. package/dist/domain/script/migrations/types.js.map +0 -1
  177. package/dist/domain/script/migrations/v3-to-v4.d.ts +0 -3
  178. package/dist/domain/script/migrations/v3-to-v4.js +0 -57
  179. package/dist/domain/script/migrations/v3-to-v4.js.map +0 -1
  180. package/dist/domain/script/names.d.ts +0 -1
  181. package/dist/domain/script/names.js +0 -2
  182. package/dist/domain/script/names.js.map +0 -1
  183. package/dist/domain/script/parse.d.ts +0 -1
  184. package/dist/domain/script/parse.js +0 -2
  185. package/dist/domain/script/parse.js.map +0 -1
  186. package/dist/domain/script/patch/apply.d.ts +0 -1
  187. package/dist/domain/script/patch/apply.js +0 -2
  188. package/dist/domain/script/patch/apply.js.map +0 -1
  189. package/dist/domain/script/patch/helpers.d.ts +0 -1
  190. package/dist/domain/script/patch/helpers.js +0 -2
  191. package/dist/domain/script/patch/helpers.js.map +0 -1
  192. package/dist/domain/script/patch/inline-speaker.d.ts +0 -1
  193. package/dist/domain/script/patch/inline-speaker.js +0 -2
  194. package/dist/domain/script/patch/inline-speaker.js.map +0 -1
  195. package/dist/domain/script/patch/ops-action.d.ts +0 -1
  196. package/dist/domain/script/patch/ops-action.js +0 -2
  197. package/dist/domain/script/patch/ops-action.js.map +0 -1
  198. package/dist/domain/script/patch/ops-asset.d.ts +0 -1
  199. package/dist/domain/script/patch/ops-asset.js +0 -2
  200. package/dist/domain/script/patch/ops-asset.js.map +0 -1
  201. package/dist/domain/script/patch/ops-dialogue.d.ts +0 -1
  202. package/dist/domain/script/patch/ops-dialogue.js +0 -2
  203. package/dist/domain/script/patch/ops-dialogue.js.map +0 -1
  204. package/dist/domain/script/patch/ops-extend.d.ts +0 -1
  205. package/dist/domain/script/patch/ops-extend.js +0 -2
  206. package/dist/domain/script/patch/ops-extend.js.map +0 -1
  207. package/dist/domain/script/patch/ops-meta.d.ts +0 -1
  208. package/dist/domain/script/patch/ops-meta.js +0 -2
  209. package/dist/domain/script/patch/ops-meta.js.map +0 -1
  210. package/dist/domain/script/patch/ops-scene.d.ts +0 -1
  211. package/dist/domain/script/patch/ops-scene.js +0 -2
  212. package/dist/domain/script/patch/ops-scene.js.map +0 -1
  213. package/dist/domain/script/patch/ops-state.d.ts +0 -1
  214. package/dist/domain/script/patch/ops-state.js +0 -2
  215. package/dist/domain/script/patch/ops-state.js.map +0 -1
  216. package/dist/domain/script/patch/registry.d.ts +0 -1
  217. package/dist/domain/script/patch/registry.js +0 -2
  218. package/dist/domain/script/patch/registry.js.map +0 -1
  219. package/dist/domain/script/patch/types.d.ts +0 -1
  220. package/dist/domain/script/patch/types.js +0 -2
  221. package/dist/domain/script/patch/types.js.map +0 -1
  222. package/dist/domain/script/refs.d.ts +0 -1
  223. package/dist/domain/script/refs.js +0 -2
  224. package/dist/domain/script/refs.js.map +0 -1
  225. package/dist/domain/script/scene-refs.d.ts +0 -1
  226. package/dist/domain/script/scene-refs.js +0 -2
  227. package/dist/domain/script/scene-refs.js.map +0 -1
  228. package/dist/domain/script/schema.d.ts +0 -1
  229. package/dist/domain/script/schema.js +0 -2
  230. package/dist/domain/script/schema.js.map +0 -1
  231. package/dist/domain/script/selector.d.ts +0 -1
  232. package/dist/domain/script/selector.js +0 -2
  233. package/dist/domain/script/selector.js.map +0 -1
  234. package/dist/domain/script/shared/regex.d.ts +0 -2
  235. package/dist/domain/script/shared/regex.js +0 -7
  236. package/dist/domain/script/shared/regex.js.map +0 -1
  237. package/dist/domain/script/shared/types.d.ts +0 -1
  238. package/dist/domain/script/shared/types.js +0 -5
  239. package/dist/domain/script/shared/types.js.map +0 -1
  240. package/dist/domain/script/shared/validation.d.ts +0 -1
  241. package/dist/domain/script/shared/validation.js +0 -3
  242. package/dist/domain/script/shared/validation.js.map +0 -1
  243. package/dist/domain/script/shared.d.ts +0 -15
  244. package/dist/domain/script/shared.js +0 -35
  245. package/dist/domain/script/shared.js.map +0 -1
  246. package/dist/domain/script/text-util.d.ts +0 -7
  247. package/dist/domain/script/text-util.js +0 -95
  248. package/dist/domain/script/text-util.js.map +0 -1
  249. package/dist/domain/script/timestamp.d.ts +0 -1
  250. package/dist/domain/script/timestamp.js +0 -3
  251. package/dist/domain/script/timestamp.js.map +0 -1
  252. package/dist/domain/script/types.d.ts +0 -1
  253. package/dist/domain/script/types.js +0 -2
  254. package/dist/domain/script/types.js.map +0 -1
  255. package/dist/domain/script/v3/address.d.ts +0 -32
  256. package/dist/domain/script/v3/address.js +0 -136
  257. package/dist/domain/script/v3/address.js.map +0 -1
  258. package/dist/domain/script/v3/lookups.d.ts +0 -33
  259. package/dist/domain/script/v3/lookups.js +0 -316
  260. package/dist/domain/script/v3/lookups.js.map +0 -1
  261. package/dist/domain/script/v3/ordinal.d.ts +0 -8
  262. package/dist/domain/script/v3/ordinal.js +0 -91
  263. package/dist/domain/script/v3/ordinal.js.map +0 -1
  264. package/dist/domain/script/v3/parse.d.ts +0 -3
  265. package/dist/domain/script/v3/parse.js +0 -164
  266. package/dist/domain/script/v3/parse.js.map +0 -1
  267. package/dist/domain/script/v3/patch/apply.d.ts +0 -2
  268. package/dist/domain/script/v3/patch/apply.js +0 -31
  269. package/dist/domain/script/v3/patch/apply.js.map +0 -1
  270. package/dist/domain/script/v3/patch/helpers.d.ts +0 -15
  271. package/dist/domain/script/v3/patch/helpers.js +0 -155
  272. package/dist/domain/script/v3/patch/helpers.js.map +0 -1
  273. package/dist/domain/script/v3/patch/inline-speaker.d.ts +0 -2
  274. package/dist/domain/script/v3/patch/inline-speaker.js +0 -50
  275. package/dist/domain/script/v3/patch/inline-speaker.js.map +0 -1
  276. package/dist/domain/script/v3/patch/ops-action.d.ts +0 -12
  277. package/dist/domain/script/v3/patch/ops-action.js +0 -355
  278. package/dist/domain/script/v3/patch/ops-action.js.map +0 -1
  279. package/dist/domain/script/v3/patch/ops-asset.d.ts +0 -14
  280. package/dist/domain/script/v3/patch/ops-asset.js +0 -347
  281. package/dist/domain/script/v3/patch/ops-asset.js.map +0 -1
  282. package/dist/domain/script/v3/patch/ops-dialogue.d.ts +0 -2
  283. package/dist/domain/script/v3/patch/ops-dialogue.js +0 -21
  284. package/dist/domain/script/v3/patch/ops-dialogue.js.map +0 -1
  285. package/dist/domain/script/v3/patch/ops-extend.d.ts +0 -8
  286. package/dist/domain/script/v3/patch/ops-extend.js +0 -122
  287. package/dist/domain/script/v3/patch/ops-extend.js.map +0 -1
  288. package/dist/domain/script/v3/patch/ops-meta.d.ts +0 -5
  289. package/dist/domain/script/v3/patch/ops-meta.js +0 -82
  290. package/dist/domain/script/v3/patch/ops-meta.js.map +0 -1
  291. package/dist/domain/script/v3/patch/ops-scene.d.ts +0 -6
  292. package/dist/domain/script/v3/patch/ops-scene.js +0 -351
  293. package/dist/domain/script/v3/patch/ops-scene.js.map +0 -1
  294. package/dist/domain/script/v3/patch/ops-state.d.ts +0 -8
  295. package/dist/domain/script/v3/patch/ops-state.js +0 -155
  296. package/dist/domain/script/v3/patch/ops-state.js.map +0 -1
  297. package/dist/domain/script/v3/patch/ops-timestamp.d.ts +0 -6
  298. package/dist/domain/script/v3/patch/ops-timestamp.js +0 -47
  299. package/dist/domain/script/v3/patch/ops-timestamp.js.map +0 -1
  300. package/dist/domain/script/v3/patch/registry.d.ts +0 -2
  301. package/dist/domain/script/v3/patch/registry.js +0 -56
  302. package/dist/domain/script/v3/patch/registry.js.map +0 -1
  303. package/dist/domain/script/v3/patch/types.d.ts +0 -10
  304. package/dist/domain/script/v3/patch/types.js +0 -2
  305. package/dist/domain/script/v3/patch/types.js.map +0 -1
  306. package/dist/domain/script/v3/refs.d.ts +0 -4
  307. package/dist/domain/script/v3/refs.js +0 -64
  308. package/dist/domain/script/v3/refs.js.map +0 -1
  309. package/dist/domain/script/v3/scene-refs.d.ts +0 -3
  310. package/dist/domain/script/v3/scene-refs.js +0 -35
  311. package/dist/domain/script/v3/scene-refs.js.map +0 -1
  312. package/dist/domain/script/v3/schema.d.ts +0 -6
  313. package/dist/domain/script/v3/schema.js +0 -58
  314. package/dist/domain/script/v3/schema.js.map +0 -1
  315. package/dist/domain/script/v3/selector.d.ts +0 -44
  316. package/dist/domain/script/v3/selector.js +0 -178
  317. package/dist/domain/script/v3/selector.js.map +0 -1
  318. package/dist/domain/script/v3/types.d.ts +0 -106
  319. package/dist/domain/script/v3/types.js +0 -2
  320. package/dist/domain/script/v3/types.js.map +0 -1
  321. package/dist/domain/script/v3/validation.d.ts +0 -2
  322. package/dist/domain/script/v3/validation.js +0 -2
  323. package/dist/domain/script/v3/validation.js.map +0 -1
  324. package/dist/domain/script/v4/address.d.ts +0 -61
  325. package/dist/domain/script/v4/address.js +0 -99
  326. package/dist/domain/script/v4/address.js.map +0 -1
  327. package/dist/domain/script/v4/factory.d.ts +0 -2
  328. package/dist/domain/script/v4/factory.js +0 -13
  329. package/dist/domain/script/v4/factory.js.map +0 -1
  330. package/dist/domain/script/v4/from-v3.d.ts +0 -29
  331. package/dist/domain/script/v4/from-v3.js +0 -307
  332. package/dist/domain/script/v4/from-v3.js.map +0 -1
  333. package/dist/domain/script/v4/ids.d.ts +0 -5
  334. package/dist/domain/script/v4/ids.js +0 -41
  335. package/dist/domain/script/v4/ids.js.map +0 -1
  336. package/dist/domain/script/v4/ordinal.d.ts +0 -3
  337. package/dist/domain/script/v4/ordinal.js +0 -66
  338. package/dist/domain/script/v4/ordinal.js.map +0 -1
  339. package/dist/domain/script/v4/parse.d.ts +0 -5
  340. package/dist/domain/script/v4/parse.js +0 -196
  341. package/dist/domain/script/v4/parse.js.map +0 -1
  342. package/dist/domain/script/v4/patch/apply.d.ts +0 -3
  343. package/dist/domain/script/v4/patch/apply.js +0 -24
  344. package/dist/domain/script/v4/patch/apply.js.map +0 -1
  345. package/dist/domain/script/v4/patch/helpers.d.ts +0 -32
  346. package/dist/domain/script/v4/patch/helpers.js +0 -138
  347. package/dist/domain/script/v4/patch/helpers.js.map +0 -1
  348. package/dist/domain/script/v4/patch/ops-action.d.ts +0 -13
  349. package/dist/domain/script/v4/patch/ops-action.js +0 -351
  350. package/dist/domain/script/v4/patch/ops-action.js.map +0 -1
  351. package/dist/domain/script/v4/patch/ops-asset.d.ts +0 -17
  352. package/dist/domain/script/v4/patch/ops-asset.js +0 -556
  353. package/dist/domain/script/v4/patch/ops-asset.js.map +0 -1
  354. package/dist/domain/script/v4/patch/ops-extend.d.ts +0 -11
  355. package/dist/domain/script/v4/patch/ops-extend.js +0 -103
  356. package/dist/domain/script/v4/patch/ops-extend.js.map +0 -1
  357. package/dist/domain/script/v4/patch/ops-meta.d.ts +0 -5
  358. package/dist/domain/script/v4/patch/ops-meta.js +0 -49
  359. package/dist/domain/script/v4/patch/ops-meta.js.map +0 -1
  360. package/dist/domain/script/v4/patch/ops-scene-ref.d.ts +0 -3
  361. package/dist/domain/script/v4/patch/ops-scene-ref.js +0 -74
  362. package/dist/domain/script/v4/patch/ops-scene-ref.js.map +0 -1
  363. package/dist/domain/script/v4/patch/ops-structure.d.ts +0 -6
  364. package/dist/domain/script/v4/patch/ops-structure.js +0 -236
  365. package/dist/domain/script/v4/patch/ops-structure.js.map +0 -1
  366. package/dist/domain/script/v4/patch/ops-timestamp.d.ts +0 -6
  367. package/dist/domain/script/v4/patch/ops-timestamp.js +0 -40
  368. package/dist/domain/script/v4/patch/ops-timestamp.js.map +0 -1
  369. package/dist/domain/script/v4/patch/registry.d.ts +0 -2
  370. package/dist/domain/script/v4/patch/registry.js +0 -53
  371. package/dist/domain/script/v4/patch/registry.js.map +0 -1
  372. package/dist/domain/script/v4/patch/schema.d.ts +0 -7
  373. package/dist/domain/script/v4/patch/schema.js +0 -77
  374. package/dist/domain/script/v4/patch/schema.js.map +0 -1
  375. package/dist/domain/script/v4/patch/types.d.ts +0 -10
  376. package/dist/domain/script/v4/patch/types.js +0 -2
  377. package/dist/domain/script/v4/patch/types.js.map +0 -1
  378. package/dist/domain/script/v4/selector.d.ts +0 -11
  379. package/dist/domain/script/v4/selector.js +0 -124
  380. package/dist/domain/script/v4/selector.js.map +0 -1
  381. package/dist/domain/script/v4/types.d.ts +0 -120
  382. package/dist/domain/script/v4/types.js +0 -2
  383. package/dist/domain/script/v4/types.js.map +0 -1
  384. package/dist/domain/script/v4/validation.d.ts +0 -2
  385. package/dist/domain/script/v4/validation.js +0 -2
  386. package/dist/domain/script/v4/validation.js.map +0 -1
  387. package/dist/failures.d.ts +0 -58
  388. package/dist/failures.js +0 -96
  389. package/dist/failures.js.map +0 -1
  390. package/dist/infra/converters.d.ts +0 -9
  391. package/dist/infra/converters.js +0 -689
  392. package/dist/infra/converters.js.map +0 -1
  393. package/dist/infra/env.d.ts +0 -2
  394. package/dist/infra/env.js +0 -81
  395. package/dist/infra/env.js.map +0 -1
  396. package/dist/infra/episode-title.d.ts +0 -4
  397. package/dist/infra/episode-title.js +0 -129
  398. package/dist/infra/episode-title.js.map +0 -1
  399. package/dist/infra/ingest/review-renderer.d.ts +0 -1
  400. package/dist/infra/ingest/review-renderer.js +0 -440
  401. package/dist/infra/ingest/review-renderer.js.map +0 -1
  402. package/dist/infra/ingest/source-resolver.d.ts +0 -21
  403. package/dist/infra/ingest/source-resolver.js +0 -51
  404. package/dist/infra/ingest/source-resolver.js.map +0 -1
  405. package/dist/infra/ingest/text-reader.d.ts +0 -3
  406. package/dist/infra/ingest/text-reader.js +0 -27
  407. package/dist/infra/ingest/text-reader.js.map +0 -1
  408. package/dist/infra/ingest/video-discovery.d.ts +0 -8
  409. package/dist/infra/ingest/video-discovery.js +0 -69
  410. package/dist/infra/ingest/video-discovery.js.map +0 -1
  411. package/dist/infra/ingest/video-source-snapshot.d.ts +0 -4
  412. package/dist/infra/ingest/video-source-snapshot.js +0 -47
  413. package/dist/infra/ingest/video-source-snapshot.js.map +0 -1
  414. package/dist/infra/ingest/video-state-evidence.d.ts +0 -14
  415. package/dist/infra/ingest/video-state-evidence.js +0 -140
  416. package/dist/infra/ingest/video-state-evidence.js.map +0 -1
  417. package/dist/infra/ingest/video-transcode.d.ts +0 -7
  418. package/dist/infra/ingest/video-transcode.js +0 -98
  419. package/dist/infra/ingest/video-transcode.js.map +0 -1
  420. package/dist/infra/ingest/workspace-lock.d.ts +0 -1
  421. package/dist/infra/ingest/workspace-lock.js +0 -32
  422. package/dist/infra/ingest/workspace-lock.js.map +0 -1
  423. package/dist/infra/ingest/workspace-store.d.ts +0 -18
  424. package/dist/infra/ingest/workspace-store.js +0 -70
  425. package/dist/infra/ingest/workspace-store.js.map +0 -1
  426. package/dist/infra/llm/anthropic-model.d.ts +0 -11
  427. package/dist/infra/llm/anthropic-model.js +0 -130
  428. package/dist/infra/llm/anthropic-model.js.map +0 -1
  429. package/dist/infra/llm/doubao-model.d.ts +0 -60
  430. package/dist/infra/llm/doubao-model.js +0 -249
  431. package/dist/infra/llm/doubao-model.js.map +0 -1
  432. package/dist/infra/llm/failure-mapping.d.ts +0 -6
  433. package/dist/infra/llm/failure-mapping.js +0 -146
  434. package/dist/infra/llm/failure-mapping.js.map +0 -1
  435. package/dist/infra/llm/gemini-upload.d.ts +0 -13
  436. package/dist/infra/llm/gemini-upload.js +0 -138
  437. package/dist/infra/llm/gemini-upload.js.map +0 -1
  438. package/dist/infra/llm/gemini-video-model.d.ts +0 -50
  439. package/dist/infra/llm/gemini-video-model.js +0 -371
  440. package/dist/infra/llm/gemini-video-model.js.map +0 -1
  441. package/dist/infra/llm/openai-compatible-model.d.ts +0 -14
  442. package/dist/infra/llm/openai-compatible-model.js +0 -207
  443. package/dist/infra/llm/openai-compatible-model.js.map +0 -1
  444. package/dist/infra/llm/retry.d.ts +0 -8
  445. package/dist/infra/llm/retry.js +0 -41
  446. package/dist/infra/llm/retry.js.map +0 -1
  447. package/dist/infra/local-script-output-store.d.ts +0 -43
  448. package/dist/infra/local-script-output-store.js +0 -168
  449. package/dist/infra/local-script-output-store.js.map +0 -1
  450. package/dist/infra/script-output-api.d.ts +0 -50
  451. package/dist/infra/script-output-api.js +0 -251
  452. package/dist/infra/script-output-api.js.map +0 -1
  453. package/dist/infra/script-output-store.d.ts +0 -152
  454. package/dist/infra/script-output-store.js +0 -114
  455. package/dist/infra/script-output-store.js.map +0 -1
  456. package/dist/infra/script-working-copy.d.ts +0 -23
  457. package/dist/infra/script-working-copy.js +0 -157
  458. package/dist/infra/script-working-copy.js.map +0 -1
  459. package/dist/infra/storage.d.ts +0 -35
  460. package/dist/infra/storage.js +0 -91
  461. package/dist/infra/storage.js.map +0 -1
  462. package/dist/llm/composition.d.ts +0 -5
  463. package/dist/llm/composition.js +0 -5
  464. package/dist/llm/composition.js.map +0 -1
  465. package/dist/llm/config.d.ts +0 -28
  466. package/dist/llm/config.js +0 -231
  467. package/dist/llm/config.js.map +0 -1
  468. package/dist/llm/registry.d.ts +0 -43
  469. package/dist/llm/registry.js +0 -69
  470. package/dist/llm/registry.js.map +0 -1
  471. package/dist/llm/router.d.ts +0 -46
  472. package/dist/llm/router.js +0 -512
  473. package/dist/llm/router.js.map +0 -1
  474. package/dist/llm/tasks/ingest/arc-summary.d.ts +0 -8
  475. package/dist/llm/tasks/ingest/arc-summary.js +0 -26
  476. package/dist/llm/tasks/ingest/arc-summary.js.map +0 -1
  477. package/dist/llm/tasks/ingest/asset-audit.d.ts +0 -6
  478. package/dist/llm/tasks/ingest/asset-audit.js +0 -158
  479. package/dist/llm/tasks/ingest/asset-audit.js.map +0 -1
  480. package/dist/llm/tasks/ingest/asset-curate.d.ts +0 -13
  481. package/dist/llm/tasks/ingest/asset-curate.js +0 -45
  482. package/dist/llm/tasks/ingest/asset-curate.js.map +0 -1
  483. package/dist/llm/tasks/ingest/asset-extract.d.ts +0 -12
  484. package/dist/llm/tasks/ingest/asset-extract.js +0 -51
  485. package/dist/llm/tasks/ingest/asset-extract.js.map +0 -1
  486. package/dist/llm/tasks/ingest/asset-govern.d.ts +0 -22
  487. package/dist/llm/tasks/ingest/asset-govern.js +0 -143
  488. package/dist/llm/tasks/ingest/asset-govern.js.map +0 -1
  489. package/dist/llm/tasks/ingest/body-start.d.ts +0 -10
  490. package/dist/llm/tasks/ingest/body-start.js +0 -41
  491. package/dist/llm/tasks/ingest/body-start.js.map +0 -1
  492. package/dist/llm/tasks/ingest/episode-assets.d.ts +0 -29
  493. package/dist/llm/tasks/ingest/episode-assets.js +0 -282
  494. package/dist/llm/tasks/ingest/episode-assets.js.map +0 -1
  495. package/dist/llm/tasks/ingest/mention-resolve.d.ts +0 -9
  496. package/dist/llm/tasks/ingest/mention-resolve.js +0 -39
  497. package/dist/llm/tasks/ingest/mention-resolve.js.map +0 -1
  498. package/dist/llm/tasks/ingest/name-fix.d.ts +0 -9
  499. package/dist/llm/tasks/ingest/name-fix.js +0 -56
  500. package/dist/llm/tasks/ingest/name-fix.js.map +0 -1
  501. package/dist/llm/tasks/ingest/state-reconcile.d.ts +0 -8
  502. package/dist/llm/tasks/ingest/state-reconcile.js +0 -44
  503. package/dist/llm/tasks/ingest/state-reconcile.js.map +0 -1
  504. package/dist/llm/tasks/ingest/text-normalize.d.ts +0 -10
  505. package/dist/llm/tasks/ingest/text-normalize.js +0 -122
  506. package/dist/llm/tasks/ingest/text-normalize.js.map +0 -1
  507. package/dist/llm/tasks/ingest/video-serial.d.ts +0 -24
  508. package/dist/llm/tasks/ingest/video-serial.js +0 -416
  509. package/dist/llm/tasks/ingest/video-serial.js.map +0 -1
  510. package/dist/llm/tasks/schemas.d.ts +0 -9
  511. package/dist/llm/tasks/schemas.js +0 -466
  512. package/dist/llm/tasks/schemas.js.map +0 -1
  513. package/dist/llm/types.d.ts +0 -178
  514. package/dist/llm/types.js +0 -44
  515. package/dist/llm/types.js.map +0 -1
  516. package/dist/output.d.ts +0 -3
  517. package/dist/output.js +0 -94
  518. package/dist/output.js.map +0 -1
  519. package/dist/package-root.d.ts +0 -2
  520. package/dist/package-root.js +0 -38
  521. package/dist/package-root.js.map +0 -1
  522. package/dist/review-agent.js.map +0 -7
  523. package/dist/usecases/changelog.d.ts +0 -9
  524. package/dist/usecases/changelog.js +0 -134
  525. package/dist/usecases/changelog.js.map +0 -1
  526. package/dist/usecases/doctor.d.ts +0 -2
  527. package/dist/usecases/doctor.js +0 -231
  528. package/dist/usecases/doctor.js.map +0 -1
  529. package/dist/usecases/ingest/body-start.d.ts +0 -8
  530. package/dist/usecases/ingest/body-start.js +0 -36
  531. package/dist/usecases/ingest/body-start.js.map +0 -1
  532. package/dist/usecases/ingest/command.d.ts +0 -5
  533. package/dist/usecases/ingest/command.js +0 -183
  534. package/dist/usecases/ingest/command.js.map +0 -1
  535. package/dist/usecases/ingest/failure.d.ts +0 -26
  536. package/dist/usecases/ingest/failure.js +0 -153
  537. package/dist/usecases/ingest/failure.js.map +0 -1
  538. package/dist/usecases/ingest/fanout.d.ts +0 -10
  539. package/dist/usecases/ingest/fanout.js +0 -23
  540. package/dist/usecases/ingest/fanout.js.map +0 -1
  541. package/dist/usecases/ingest/final-asset-audit.d.ts +0 -39
  542. package/dist/usecases/ingest/final-asset-audit.js +0 -88
  543. package/dist/usecases/ingest/final-asset-audit.js.map +0 -1
  544. package/dist/usecases/ingest/generate-video-state-evidence.d.ts +0 -23
  545. package/dist/usecases/ingest/generate-video-state-evidence.js +0 -124
  546. package/dist/usecases/ingest/generate-video-state-evidence.js.map +0 -1
  547. package/dist/usecases/ingest/pass4-mention-resolve.d.ts +0 -11
  548. package/dist/usecases/ingest/pass4-mention-resolve.js +0 -52
  549. package/dist/usecases/ingest/pass4-mention-resolve.js.map +0 -1
  550. package/dist/usecases/ingest/pass5-extract.d.ts +0 -7
  551. package/dist/usecases/ingest/pass5-extract.js +0 -51
  552. package/dist/usecases/ingest/pass5-extract.js.map +0 -1
  553. package/dist/usecases/ingest/pass5-govern.d.ts +0 -13
  554. package/dist/usecases/ingest/pass5-govern.js +0 -157
  555. package/dist/usecases/ingest/pass5-govern.js.map +0 -1
  556. package/dist/usecases/ingest/pipeline.d.ts +0 -28
  557. package/dist/usecases/ingest/pipeline.js +0 -335
  558. package/dist/usecases/ingest/pipeline.js.map +0 -1
  559. package/dist/usecases/ingest/publish-command.d.ts +0 -1
  560. package/dist/usecases/ingest/publish-command.js +0 -4
  561. package/dist/usecases/ingest/publish-command.js.map +0 -1
  562. package/dist/usecases/ingest/serial-govern.d.ts +0 -40
  563. package/dist/usecases/ingest/serial-govern.js +0 -488
  564. package/dist/usecases/ingest/serial-govern.js.map +0 -1
  565. package/dist/usecases/ingest/skip-video-episode.d.ts +0 -4
  566. package/dist/usecases/ingest/skip-video-episode.js +0 -120
  567. package/dist/usecases/ingest/skip-video-episode.js.map +0 -1
  568. package/dist/usecases/ingest/status.d.ts +0 -61
  569. package/dist/usecases/ingest/status.js +0 -347
  570. package/dist/usecases/ingest/status.js.map +0 -1
  571. package/dist/usecases/ingest/timings.d.ts +0 -51
  572. package/dist/usecases/ingest/timings.js +0 -68
  573. package/dist/usecases/ingest/timings.js.map +0 -1
  574. package/dist/usecases/ingest/usage-report.d.ts +0 -125
  575. package/dist/usecases/ingest/usage-report.js +0 -248
  576. package/dist/usecases/ingest/usage-report.js.map +0 -1
  577. package/dist/usecases/ingest/video-pipeline.d.ts +0 -81
  578. package/dist/usecases/ingest/video-pipeline.js +0 -548
  579. package/dist/usecases/ingest/video-pipeline.js.map +0 -1
  580. package/dist/usecases/ingest/video-skip-state.d.ts +0 -29
  581. package/dist/usecases/ingest/video-skip-state.js +0 -148
  582. package/dist/usecases/ingest/video-skip-state.js.map +0 -1
  583. package/dist/usecases/ingest/view-command.d.ts +0 -4
  584. package/dist/usecases/ingest/view-command.js +0 -67
  585. package/dist/usecases/ingest/view-command.js.map +0 -1
  586. package/dist/usecases/ingest/view-server.d.ts +0 -29
  587. package/dist/usecases/ingest/view-server.js +0 -364
  588. package/dist/usecases/ingest/view-server.js.map +0 -1
  589. package/dist/usecases/script/action-span.d.ts +0 -10
  590. package/dist/usecases/script/action-span.js +0 -42
  591. package/dist/usecases/script/action-span.js.map +0 -1
  592. package/dist/usecases/script/actions.d.ts +0 -3
  593. package/dist/usecases/script/actions.js +0 -184
  594. package/dist/usecases/script/actions.js.map +0 -1
  595. package/dist/usecases/script/actor.d.ts +0 -3
  596. package/dist/usecases/script/actor.js +0 -26
  597. package/dist/usecases/script/actor.js.map +0 -1
  598. package/dist/usecases/script/actors.d.ts +0 -3
  599. package/dist/usecases/script/actors.js +0 -25
  600. package/dist/usecases/script/actors.js.map +0 -1
  601. package/dist/usecases/script/add-actor.d.ts +0 -3
  602. package/dist/usecases/script/add-actor.js +0 -13
  603. package/dist/usecases/script/add-actor.js.map +0 -1
  604. package/dist/usecases/script/add-episode.d.ts +0 -3
  605. package/dist/usecases/script/add-episode.js +0 -9
  606. package/dist/usecases/script/add-episode.js.map +0 -1
  607. package/dist/usecases/script/add-location.d.ts +0 -3
  608. package/dist/usecases/script/add-location.js +0 -11
  609. package/dist/usecases/script/add-location.js.map +0 -1
  610. package/dist/usecases/script/add-prop.d.ts +0 -3
  611. package/dist/usecases/script/add-prop.js +0 -11
  612. package/dist/usecases/script/add-prop.js.map +0 -1
  613. package/dist/usecases/script/alias.d.ts +0 -3
  614. package/dist/usecases/script/alias.js +0 -39
  615. package/dist/usecases/script/alias.js.map +0 -1
  616. package/dist/usecases/script/assets.d.ts +0 -3
  617. package/dist/usecases/script/assets.js +0 -46
  618. package/dist/usecases/script/assets.js.map +0 -1
  619. package/dist/usecases/script/audit-assets.d.ts +0 -4
  620. package/dist/usecases/script/audit-assets.js +0 -37
  621. package/dist/usecases/script/audit-assets.js.map +0 -1
  622. package/dist/usecases/script/command-constraints.d.ts +0 -38
  623. package/dist/usecases/script/command-constraints.js +0 -143
  624. package/dist/usecases/script/command-constraints.js.map +0 -1
  625. package/dist/usecases/script/compose-creative-draft.d.ts +0 -3
  626. package/dist/usecases/script/compose-creative-draft.js +0 -106
  627. package/dist/usecases/script/compose-creative-draft.js.map +0 -1
  628. package/dist/usecases/script/context.d.ts +0 -3
  629. package/dist/usecases/script/context.js +0 -52
  630. package/dist/usecases/script/context.js.map +0 -1
  631. package/dist/usecases/script/create.d.ts +0 -3
  632. package/dist/usecases/script/create.js +0 -27
  633. package/dist/usecases/script/create.js.map +0 -1
  634. package/dist/usecases/script/delete.d.ts +0 -3
  635. package/dist/usecases/script/delete.js +0 -88
  636. package/dist/usecases/script/delete.js.map +0 -1
  637. package/dist/usecases/script/describe.d.ts +0 -3
  638. package/dist/usecases/script/describe.js +0 -32
  639. package/dist/usecases/script/describe.js.map +0 -1
  640. package/dist/usecases/script/dialogue.d.ts +0 -3
  641. package/dist/usecases/script/dialogue.js +0 -30
  642. package/dist/usecases/script/dialogue.js.map +0 -1
  643. package/dist/usecases/script/dispatch.d.ts +0 -3
  644. package/dist/usecases/script/dispatch.js +0 -10
  645. package/dist/usecases/script/dispatch.js.map +0 -1
  646. package/dist/usecases/script/do.d.ts +0 -3
  647. package/dist/usecases/script/do.js +0 -186
  648. package/dist/usecases/script/do.js.map +0 -1
  649. package/dist/usecases/script/emotion.d.ts +0 -3
  650. package/dist/usecases/script/emotion.js +0 -24
  651. package/dist/usecases/script/emotion.js.map +0 -1
  652. package/dist/usecases/script/episodes.d.ts +0 -3
  653. package/dist/usecases/script/episodes.js +0 -62
  654. package/dist/usecases/script/episodes.js.map +0 -1
  655. package/dist/usecases/script/export-authoring.d.ts +0 -4
  656. package/dist/usecases/script/export-authoring.js +0 -326
  657. package/dist/usecases/script/export-authoring.js.map +0 -1
  658. package/dist/usecases/script/extend.d.ts +0 -3
  659. package/dist/usecases/script/extend.js +0 -94
  660. package/dist/usecases/script/extend.js.map +0 -1
  661. package/dist/usecases/script/ids.d.ts +0 -3
  662. package/dist/usecases/script/ids.js +0 -148
  663. package/dist/usecases/script/ids.js.map +0 -1
  664. package/dist/usecases/script/importance.d.ts +0 -3
  665. package/dist/usecases/script/importance.js +0 -16
  666. package/dist/usecases/script/importance.js.map +0 -1
  667. package/dist/usecases/script/insert.d.ts +0 -3
  668. package/dist/usecases/script/insert.js +0 -127
  669. package/dist/usecases/script/insert.js.map +0 -1
  670. package/dist/usecases/script/issues.d.ts +0 -3
  671. package/dist/usecases/script/issues.js +0 -35
  672. package/dist/usecases/script/issues.js.map +0 -1
  673. package/dist/usecases/script/lib.d.ts +0 -152
  674. package/dist/usecases/script/lib.js +0 -1654
  675. package/dist/usecases/script/lib.js.map +0 -1
  676. package/dist/usecases/script/locations.d.ts +0 -3
  677. package/dist/usecases/script/locations.js +0 -25
  678. package/dist/usecases/script/locations.js.map +0 -1
  679. package/dist/usecases/script/merge.d.ts +0 -3
  680. package/dist/usecases/script/merge.js +0 -43
  681. package/dist/usecases/script/merge.js.map +0 -1
  682. package/dist/usecases/script/migrate.d.ts +0 -3
  683. package/dist/usecases/script/migrate.js +0 -210
  684. package/dist/usecases/script/migrate.js.map +0 -1
  685. package/dist/usecases/script/move.d.ts +0 -3
  686. package/dist/usecases/script/move.js +0 -50
  687. package/dist/usecases/script/move.js.map +0 -1
  688. package/dist/usecases/script/parenthetical.d.ts +0 -3
  689. package/dist/usecases/script/parenthetical.js +0 -52
  690. package/dist/usecases/script/parenthetical.js.map +0 -1
  691. package/dist/usecases/script/props.d.ts +0 -3
  692. package/dist/usecases/script/props.js +0 -25
  693. package/dist/usecases/script/props.js.map +0 -1
  694. package/dist/usecases/script/refs.d.ts +0 -3
  695. package/dist/usecases/script/refs.js +0 -111
  696. package/dist/usecases/script/refs.js.map +0 -1
  697. package/dist/usecases/script/rename.d.ts +0 -3
  698. package/dist/usecases/script/rename.js +0 -35
  699. package/dist/usecases/script/rename.js.map +0 -1
  700. package/dist/usecases/script/replace.d.ts +0 -3
  701. package/dist/usecases/script/replace.js +0 -33
  702. package/dist/usecases/script/replace.js.map +0 -1
  703. package/dist/usecases/script/review.d.ts +0 -3
  704. package/dist/usecases/script/review.js +0 -187
  705. package/dist/usecases/script/review.js.map +0 -1
  706. package/dist/usecases/script/role.d.ts +0 -3
  707. package/dist/usecases/script/role.js +0 -16
  708. package/dist/usecases/script/role.js.map +0 -1
  709. package/dist/usecases/script/scenes.d.ts +0 -3
  710. package/dist/usecases/script/scenes.js +0 -66
  711. package/dist/usecases/script/scenes.js.map +0 -1
  712. package/dist/usecases/script/script-patch.d.ts +0 -3
  713. package/dist/usecases/script/script-patch.js +0 -321
  714. package/dist/usecases/script/script-patch.js.map +0 -1
  715. package/dist/usecases/script/script-validate.d.ts +0 -3
  716. package/dist/usecases/script/script-validate.js +0 -27
  717. package/dist/usecases/script/script-validate.js.map +0 -1
  718. package/dist/usecases/script/session.d.ts +0 -62
  719. package/dist/usecases/script/session.js +0 -567
  720. package/dist/usecases/script/session.js.map +0 -1
  721. package/dist/usecases/script/split.d.ts +0 -3
  722. package/dist/usecases/script/split.js +0 -41
  723. package/dist/usecases/script/split.js.map +0 -1
  724. package/dist/usecases/script/state-add.d.ts +0 -3
  725. package/dist/usecases/script/state-add.js +0 -22
  726. package/dist/usecases/script/state-add.js.map +0 -1
  727. package/dist/usecases/script/state-delete.d.ts +0 -3
  728. package/dist/usecases/script/state-delete.js +0 -22
  729. package/dist/usecases/script/state-delete.js.map +0 -1
  730. package/dist/usecases/script/state-rename.d.ts +0 -3
  731. package/dist/usecases/script/state-rename.js +0 -16
  732. package/dist/usecases/script/state-rename.js.map +0 -1
  733. package/dist/usecases/script/states.d.ts +0 -3
  734. package/dist/usecases/script/states.js +0 -197
  735. package/dist/usecases/script/states.js.map +0 -1
  736. package/dist/usecases/script/summary.d.ts +0 -3
  737. package/dist/usecases/script/summary.js +0 -72
  738. package/dist/usecases/script/summary.js.map +0 -1
  739. package/dist/usecases/script/synopsis-generate.d.ts +0 -115
  740. package/dist/usecases/script/synopsis-generate.js +0 -776
  741. package/dist/usecases/script/synopsis-generate.js.map +0 -1
  742. package/dist/usecases/script/synopsis.d.ts +0 -3
  743. package/dist/usecases/script/synopsis.js +0 -45
  744. package/dist/usecases/script/synopsis.js.map +0 -1
  745. package/dist/usecases/script/timestamp-filter.d.ts +0 -4
  746. package/dist/usecases/script/timestamp-filter.js +0 -55
  747. package/dist/usecases/script/timestamp-filter.js.map +0 -1
  748. package/dist/usecases/script/timestamp.d.ts +0 -3
  749. package/dist/usecases/script/timestamp.js +0 -11
  750. package/dist/usecases/script/timestamp.js.map +0 -1
  751. package/dist/usecases/script/transition.d.ts +0 -3
  752. package/dist/usecases/script/transition.js +0 -23
  753. package/dist/usecases/script/transition.js.map +0 -1
  754. package/dist/usecases/script/type.d.ts +0 -3
  755. package/dist/usecases/script/type.js +0 -23
  756. package/dist/usecases/script/type.js.map +0 -1
  757. package/dist/usecases/script/v3/mutations.d.ts +0 -2
  758. package/dist/usecases/script/v3/mutations.js +0 -5
  759. package/dist/usecases/script/v3/mutations.js.map +0 -1
  760. package/dist/usecases/script/v4/mutations.d.ts +0 -2
  761. package/dist/usecases/script/v4/mutations.js +0 -6
  762. package/dist/usecases/script/v4/mutations.js.map +0 -1
  763. package/dist/usecases/script/v4/queries.d.ts +0 -15
  764. package/dist/usecases/script/v4/queries.js +0 -196
  765. package/dist/usecases/script/v4/queries.js.map +0 -1
  766. package/dist/usecases/script/working-copy.d.ts +0 -5
  767. package/dist/usecases/script/working-copy.js +0 -399
  768. package/dist/usecases/script/working-copy.js.map +0 -1
  769. package/dist/usecases/script/worldview.d.ts +0 -3
  770. package/dist/usecases/script/worldview.js +0 -17
  771. package/dist/usecases/script/worldview.js.map +0 -1
  772. package/dist/usecases/script/write-authoring.d.ts +0 -3
  773. package/dist/usecases/script/write-authoring.js +0 -263
  774. package/dist/usecases/script/write-authoring.js.map +0 -1
  775. package/dist/usecases/update.d.ts +0 -13
  776. package/dist/usecases/update.js +0 -128
  777. package/dist/usecases/update.js.map +0 -1
@@ -1,784 +0,0 @@
1
- import { CliError, EXIT_INPUT, EXIT_USAGE } from "../../../common.js";
2
- import { validateScriptV3 } from "../../script/v3/validation.js";
3
- function fail(code, message, received, nextSteps, exitCode = EXIT_INPUT) {
4
- throw new CliError(message, {
5
- exitCode,
6
- errorCode: code,
7
- hint: nextSteps[0],
8
- data: { actual: received },
9
- });
10
- }
11
- function sourceLabel(source) {
12
- return `line ${source.line}, column ${source.column}`;
13
- }
14
- function canonicalize(value) {
15
- if (Array.isArray(value))
16
- return value.map(canonicalize);
17
- if (value !== null && typeof value === "object") {
18
- const result = {};
19
- for (const [key, item] of Object.entries(value).sort(([left], [right]) => left.localeCompare(right))) {
20
- result[key] = canonicalize(item);
21
- }
22
- return result;
23
- }
24
- return value;
25
- }
26
- function semanticEqual(left, right) {
27
- return JSON.stringify(canonicalize(left)) === JSON.stringify(canonicalize(right));
28
- }
29
- function assetId(_kind, value) {
30
- if ("actor_id" in value)
31
- return value.actor_id;
32
- if ("location_id" in value)
33
- return value.location_id;
34
- return value.prop_id;
35
- }
36
- function assetName(_kind, value) {
37
- if ("actor_name" in value)
38
- return value.actor_name;
39
- if ("location_name" in value)
40
- return value.location_name;
41
- return value.prop_name;
42
- }
43
- function assetsFor(script, kind) {
44
- if (kind === "actor")
45
- return script.actors;
46
- if (kind === "location")
47
- return script.locations;
48
- return script.props;
49
- }
50
- function pushAsset(script, asset) {
51
- if ("actor_id" in asset.value)
52
- script.actors.push(asset.value);
53
- else if ("location_id" in asset.value)
54
- script.locations.push(asset.value);
55
- else
56
- script.props.push(asset.value);
57
- }
58
- function findAsset(script, kind, id) {
59
- return assetsFor(script, kind).find((asset) => assetId(kind, asset) === id);
60
- }
61
- function findAssetByAnyId(script, id) {
62
- for (const kind of ["actor", "location", "prop"]) {
63
- const value = findAsset(script, kind, id);
64
- if (value !== undefined)
65
- return { kind, value };
66
- }
67
- return undefined;
68
- }
69
- function prepareDeclarations(declarations) {
70
- const assets = [];
71
- const states = [];
72
- const groupOrder = { actor: 0, location: 1, prop: 2 };
73
- let lastGroup = -1;
74
- let currentAsset;
75
- let standaloneStarted = false;
76
- const seenOwners = new Set();
77
- for (const declaration of declarations) {
78
- if (declaration.declarationKind !== "state") {
79
- if (standaloneStarted) {
80
- fail("AUTHORING_DECLARATION_ORDER", "Asset declarations must precede standalone state declarations.", [sourceLabel(declaration.source)], ["Move standalone states to the end of <create>."]);
81
- }
82
- const kind = declaration.declarationKind;
83
- if (groupOrder[kind] < lastGroup) {
84
- fail("AUTHORING_DECLARATION_ORDER", "Asset declaration groups are out of canonical order.", [sourceLabel(declaration.source), kind], ["Order asset declarations as actor, location, then prop."]);
85
- }
86
- lastGroup = groupOrder[kind];
87
- const value = structuredClone(declaration.value);
88
- value.states = [];
89
- const prepared = { kind, value, source: declaration.source };
90
- const ownerKey = `${kind}:${assetId(kind, value)}`;
91
- if (seenOwners.has(ownerKey)) {
92
- fail("AUTHORING_DECLARATION_DUPLICATE", "Asset declaration is duplicated.", [sourceLabel(declaration.source), ownerKey], ["Keep one declaration per asset."]);
93
- }
94
- seenOwners.add(ownerKey);
95
- assets.push(prepared);
96
- currentAsset = prepared;
97
- continue;
98
- }
99
- const ownerKey = `${declaration.ownerKind}:${declaration.ownerId}`;
100
- if (currentAsset !== undefined
101
- && currentAsset.kind === declaration.ownerKind
102
- && assetId(currentAsset.kind, currentAsset.value) === declaration.ownerId) {
103
- currentAsset.value.states.push(structuredClone(declaration.value));
104
- continue;
105
- }
106
- standaloneStarted = true;
107
- currentAsset = undefined;
108
- states.push({
109
- kind: declaration.ownerKind,
110
- ownerId: declaration.ownerId,
111
- value: structuredClone(declaration.value),
112
- source: declaration.source,
113
- });
114
- }
115
- for (const asset of assets) {
116
- const id = assetId(asset.kind, asset.value);
117
- if (asset.value.states.length === 0 || asset.value.states[0].state_id !== "default") {
118
- fail("AUTHORING_DEFAULT_STATE_REQUIRED", "Every declared asset must be immediately followed by its states, beginning with default.", [sourceLabel(asset.source), `${asset.kind}:${id}`], [`Add [state|${asset.kind}:${id}|default|...] directly after the asset declaration.`]);
119
- }
120
- if (asset.value.states.filter((state) => state.state_id === "default").length !== 1) {
121
- fail("AUTHORING_DEFAULT_STATE_DUPLICATE", "Every declared asset must contain exactly one default state.", [sourceLabel(asset.source), `${asset.kind}:${id}`], ["Keep exactly one default state."]);
122
- }
123
- const aliases = asset.value.aliases ?? [];
124
- if (new Set(aliases).size !== aliases.length || aliases.includes(assetName(asset.kind, asset.value))) {
125
- fail("AUTHORING_ALIAS_INVALID", "Asset aliases must be unique and must differ from the canonical name.", [sourceLabel(asset.source), `${asset.kind}:${id}`], ["Remove duplicate aliases and the canonical name from aliases."]);
126
- }
127
- }
128
- return { assets, states };
129
- }
130
- function emptyDeclarationPlan() {
131
- return {
132
- createdAssets: [],
133
- existingAssets: [],
134
- createdStates: [],
135
- existingStates: [],
136
- };
137
- }
138
- function applyDeclarations(script, declarations) {
139
- const prepared = prepareDeclarations(declarations);
140
- const plan = emptyDeclarationPlan();
141
- for (const asset of prepared.assets) {
142
- const id = assetId(asset.kind, asset.value);
143
- const address = `${asset.kind}:${id}`;
144
- const anyExisting = findAssetByAnyId(script, id);
145
- if (anyExisting !== undefined) {
146
- if (anyExisting.kind === asset.kind && semanticEqual(anyExisting.value, asset.value)) {
147
- plan.existingAssets.push(address);
148
- plan.existingStates.push(...asset.value.states.map((state) => `${address}/${state.state_id}`));
149
- continue;
150
- }
151
- fail("AUTHORING_ASSET_CONFLICT", "Create-only asset declaration conflicts with an existing asset.", [sourceLabel(asset.source), `${asset.kind}:${id}`], ["Use the existing identical definition or change it with an explicit mutation verb."]);
152
- }
153
- pushAsset(script, asset);
154
- plan.createdAssets.push(address);
155
- plan.createdStates.push(...asset.value.states.map((state) => `${address}/${state.state_id}`));
156
- }
157
- for (const state of prepared.states) {
158
- const owner = findAsset(script, state.kind, state.ownerId);
159
- if (owner === undefined) {
160
- fail("AUTHORING_STATE_OWNER_NOT_FOUND", "Standalone state owner does not exist.", [sourceLabel(state.source), `${state.kind}:${state.ownerId}`], ["Declare the asset before its states or use an existing asset ID."]);
161
- }
162
- const existing = owner.states.find((candidate) => candidate.state_id === state.value.state_id);
163
- if (existing !== undefined && !semanticEqual(existing, state.value)) {
164
- fail("AUTHORING_STATE_CONFLICT", "Create-only state declaration conflicts with an existing state on the same asset.", [sourceLabel(state.source), `${state.kind}:${state.ownerId}/${state.value.state_id}`], ["Use an unused state ID for this asset, or reuse the identical existing state."]);
165
- }
166
- const stateAddress = `${state.kind}:${state.ownerId}/${state.value.state_id}`;
167
- if (existing === undefined) {
168
- owner.states.push(state.value);
169
- plan.createdStates.push(stateAddress);
170
- }
171
- else
172
- plan.existingStates.push(stateAddress);
173
- }
174
- return plan;
175
- }
176
- function sceneCounts(scene) {
177
- return { episodes: 0, scenes: scene === undefined ? 0 : 1, actions: scene?.actions.length ?? 0 };
178
- }
179
- function episodeCounts(episode) {
180
- return {
181
- episodes: episode === undefined ? 0 : 1,
182
- scenes: episode?.scenes.length ?? 0,
183
- actions: episode?.scenes.reduce((total, scene) => total + scene.actions.length, 0) ?? 0,
184
- };
185
- }
186
- function episodesCounts(episodes) {
187
- return episodes.reduce((counts, episode) => ({
188
- episodes: counts.episodes + 1,
189
- scenes: counts.scenes + episode.scenes.length,
190
- actions: counts.actions + episode.scenes.reduce((total, scene) => total + scene.actions.length, 0),
191
- }), { episodes: 0, scenes: 0, actions: 0 });
192
- }
193
- function scenesCounts(scenes) {
194
- return {
195
- episodes: 0,
196
- scenes: scenes.length,
197
- actions: scenes.reduce((total, scene) => total + scene.actions.length, 0),
198
- };
199
- }
200
- function idDiff(before, after) {
201
- const beforeSet = new Set(before);
202
- const afterSet = new Set(after);
203
- return {
204
- retainedIds: after.filter((id) => beforeSet.has(id)),
205
- createdIds: after.filter((id) => !beforeSet.has(id)),
206
- removedIds: before.filter((id) => !afterSet.has(id)),
207
- };
208
- }
209
- function assertSceneReferencesMaterialized(scene, source) {
210
- const unmaterialized = [];
211
- if (scene.location !== null && !scene.location.state_id)
212
- unmaterialized.push(`location:${scene.location.location_id}`);
213
- for (const actor of scene.actors)
214
- if (!actor.state_id)
215
- unmaterialized.push(`actor:${actor.actor_id}`);
216
- for (const prop of scene.props)
217
- if (!prop.state_id)
218
- unmaterialized.push(`prop:${prop.prop_id}`);
219
- if (unmaterialized.length > 0) {
220
- fail("AUTHORING_SCENE_REF_UNMATERIALIZED", "Every scene asset reference in an authored block must bind a state.", [sourceLabel(source), ...unmaterialized], ["Add the concrete state ID to every location, cast, and prop record."]);
221
- }
222
- }
223
- function assertEpisodeReferencesMaterialized(episode, source) {
224
- for (const scene of episode.scenes)
225
- assertSceneReferencesMaterialized(scene, source);
226
- }
227
- function episodeIndex(script, episodeId) {
228
- return script.episodes.findIndex((episode) => episode.episode_id === episodeId);
229
- }
230
- function sceneIndex(episode, sceneId) {
231
- return episode.scenes.findIndex((scene) => scene.scene_id === sceneId);
232
- }
233
- function sceneCoordinate(script, parent, sceneId) {
234
- const epIndex = episodeIndex(script, parent);
235
- if (epIndex < 0)
236
- fail("AUTHORING_EPISODE_NOT_FOUND", "Episode target does not exist.", [parent], ["Inspect episodes and use an existing parent."]);
237
- const index = sceneIndex(script.episodes[epIndex], sceneId);
238
- if (index < 0)
239
- fail("AUTHORING_SCENE_NOT_FOUND", "Scene target does not exist.", [`${parent}/${sceneId}`], ["Inspect scenes and use an existing target."]);
240
- return [epIndex, index];
241
- }
242
- function compareCoordinate(left, right) {
243
- const length = Math.max(left.length, right.length);
244
- for (let index = 0; index < length; index += 1) {
245
- const diff = (left[index] ?? 0) - (right[index] ?? 0);
246
- if (diff !== 0)
247
- return diff;
248
- }
249
- return 0;
250
- }
251
- function assertStrictOrder(coords, message) {
252
- for (let index = 1; index < coords.length; index += 1) {
253
- if (compareCoordinate(coords[index - 1].coord, coords[index].coord) >= 0) {
254
- fail("AUTHORING_TARGET_ORDER", message, [sourceLabel(coords[index].source)], ["List replace targets in current document order without duplicates."], EXIT_USAGE);
255
- }
256
- }
257
- }
258
- function applyEpisodeTargets(baseline, script, targets, mode) {
259
- const plans = [];
260
- if (mode === "replace") {
261
- const coords = targets.map((target) => {
262
- const index = episodeIndex(baseline, target.value.episode_id);
263
- if (index < 0)
264
- fail("AUTHORING_EPISODE_NOT_FOUND", "Episode replace target does not exist.", [sourceLabel(target.source), target.value.episode_id], ["Use --create for a new episode or choose an existing ID."]);
265
- return { coord: [index], source: target.source };
266
- });
267
- assertStrictOrder(coords, "Episode replace targets are not in document order.");
268
- }
269
- for (const target of targets) {
270
- assertEpisodeReferencesMaterialized(target.value, target.source);
271
- const existingIndex = episodeIndex(baseline, target.value.episode_id);
272
- const existing = existingIndex < 0 ? undefined : baseline.episodes[existingIndex];
273
- if (mode === "create") {
274
- if (existing !== undefined) {
275
- if (!semanticEqual(existing, target.value)) {
276
- fail("AUTHORING_CREATE_CONFLICT", "Episode create target already exists with different content.", [sourceLabel(target.source), target.value.episode_id], ["Use --replace to replace it, or make the create block identical for a no-op retry."]);
277
- }
278
- }
279
- else {
280
- script.episodes.push(structuredClone(target.value));
281
- }
282
- }
283
- else {
284
- script.episodes[existingIndex] = structuredClone(target.value);
285
- }
286
- plans.push({
287
- kind: "episode",
288
- address: target.value.episode_id,
289
- before: episodeCounts(existing),
290
- after: episodeCounts(target.value),
291
- ...idDiff(existing?.scenes.map((scene) => scene.scene_id) ?? [], target.value.scenes.map((scene) => scene.scene_id)),
292
- untouchedSiblings: Math.max(0, baseline.episodes.length - (existing === undefined ? 0 : 1)),
293
- });
294
- }
295
- return plans;
296
- }
297
- function applySceneTargets(baseline, script, targets, mode) {
298
- const plans = [];
299
- if (mode === "replace") {
300
- const coords = targets.map((target) => ({ coord: sceneCoordinate(baseline, target.parent, target.value.scene_id), source: target.source }));
301
- assertStrictOrder(coords, "Scene replace targets are not in document order.");
302
- }
303
- for (const target of targets) {
304
- assertSceneReferencesMaterialized(target.value, target.source);
305
- const epIndex = episodeIndex(baseline, target.parent);
306
- if (epIndex < 0)
307
- fail("AUTHORING_EPISODE_NOT_FOUND", "Scene parent episode does not exist.", [sourceLabel(target.source), target.parent], ["Use an existing episode parent."]);
308
- const baseEpisode = baseline.episodes[epIndex];
309
- const outputEpisode = script.episodes[epIndex];
310
- const existingIndex = sceneIndex(baseEpisode, target.value.scene_id);
311
- const existing = existingIndex < 0 ? undefined : baseEpisode.scenes[existingIndex];
312
- if (mode === "create") {
313
- if (existing !== undefined) {
314
- if (!semanticEqual(existing, target.value)) {
315
- fail("AUTHORING_CREATE_CONFLICT", "Scene create target already exists with different content.", [sourceLabel(target.source), `${target.parent}/${target.value.scene_id}`], ["Use --replace or make the create block identical for a no-op retry."]);
316
- }
317
- }
318
- else {
319
- outputEpisode.scenes.push(structuredClone(target.value));
320
- }
321
- }
322
- else {
323
- if (existingIndex < 0)
324
- fail("AUTHORING_SCENE_NOT_FOUND", "Scene replace target does not exist.", [sourceLabel(target.source), `${target.parent}/${target.value.scene_id}`], ["Use --create for a new scene or choose an existing scene."]);
325
- outputEpisode.scenes[existingIndex] = structuredClone(target.value);
326
- }
327
- plans.push({
328
- kind: "scene",
329
- address: `${target.parent}/${target.value.scene_id}`,
330
- before: sceneCounts(existing),
331
- after: sceneCounts(target.value),
332
- ...idDiff(existing === undefined ? [] : [existing.scene_id], [target.value.scene_id]),
333
- untouchedSiblings: Math.max(0, baseEpisode.scenes.length - (existing === undefined ? 0 : 1)),
334
- });
335
- }
336
- return plans;
337
- }
338
- function applyEpisodeSpans(baseline, script, targets) {
339
- const resolved = targets.map((target) => {
340
- const from = episodeIndex(baseline, target.from);
341
- const through = episodeIndex(baseline, target.through);
342
- if (from < 0 || through < 0)
343
- fail("AUTHORING_SPAN_ENDPOINT_NOT_FOUND", "Episode-span endpoint does not exist.", [sourceLabel(target.source), `${target.from}..${target.through}`], ["Use existing episode IDs as span endpoints."]);
344
- if (from > through)
345
- fail("AUTHORING_SPAN_REVERSED", "Episode-span endpoints are reversed in current document order.", [sourceLabel(target.source), `${target.from}..${target.through}`], ["Swap from and through."]);
346
- if (target.episodes.length === 0)
347
- fail("AUTHORING_EMPTY_SPAN", "Episode-span replacement cannot be empty.", [sourceLabel(target.source)], ["Include at least one complete episode."]);
348
- for (const episode of target.episodes)
349
- assertEpisodeReferencesMaterialized(episode, target.source);
350
- return { target, from, through };
351
- });
352
- assertStrictOrder(resolved.map((item) => ({ coord: [item.from], source: item.target.source })), "Episode spans are not in document order.");
353
- for (let index = 1; index < resolved.length; index += 1) {
354
- if (resolved[index].from <= resolved[index - 1].through)
355
- fail("AUTHORING_SPAN_OVERLAP", "Episode spans overlap.", [sourceLabel(resolved[index].target.source)], ["Use disjoint episode spans."]);
356
- }
357
- const plans = resolved.map(({ target, from, through }) => {
358
- const before = baseline.episodes.slice(from, through + 1);
359
- return {
360
- kind: "episode-span",
361
- address: `${target.from}..${target.through}`,
362
- before: episodesCounts(before),
363
- after: episodesCounts(target.episodes),
364
- ...idDiff(before.map((episode) => episode.episode_id), target.episodes.map((episode) => episode.episode_id)),
365
- untouchedSiblings: baseline.episodes.length - before.length,
366
- };
367
- });
368
- for (const { target, from, through } of [...resolved].reverse()) {
369
- script.episodes.splice(from, through - from + 1, ...structuredClone(target.episodes));
370
- }
371
- return plans;
372
- }
373
- function applySceneSpans(baseline, script, targets) {
374
- const resolved = targets.map((target) => {
375
- const epIndex = episodeIndex(baseline, target.parent);
376
- if (epIndex < 0)
377
- fail("AUTHORING_EPISODE_NOT_FOUND", "Scene-span parent does not exist.", [sourceLabel(target.source), target.parent], ["Use an existing parent episode."]);
378
- const episode = baseline.episodes[epIndex];
379
- const from = sceneIndex(episode, target.from);
380
- const through = sceneIndex(episode, target.through);
381
- if (from < 0 || through < 0)
382
- fail("AUTHORING_SPAN_ENDPOINT_NOT_FOUND", "Scene-span endpoint does not exist in its parent.", [sourceLabel(target.source), `${target.parent}:${target.from}..${target.through}`], ["Use scene IDs from the same existing episode."]);
383
- if (from > through)
384
- fail("AUTHORING_SPAN_REVERSED", "Scene-span endpoints are reversed in current document order.", [sourceLabel(target.source), `${target.from}..${target.through}`], ["Swap from and through."]);
385
- if (target.scenes.length === 0)
386
- fail("AUTHORING_EMPTY_SPAN", "Scene-span replacement cannot be empty.", [sourceLabel(target.source)], ["Include at least one complete scene."]);
387
- for (const scene of target.scenes)
388
- assertSceneReferencesMaterialized(scene, target.source);
389
- return { target, epIndex, from, through };
390
- });
391
- assertStrictOrder(resolved.map((item) => ({ coord: [item.epIndex, item.from], source: item.target.source })), "Scene spans are not in document order.");
392
- for (let index = 1; index < resolved.length; index += 1) {
393
- const previous = resolved[index - 1];
394
- const current = resolved[index];
395
- if (current.epIndex === previous.epIndex && current.from <= previous.through)
396
- fail("AUTHORING_SPAN_OVERLAP", "Scene spans overlap.", [sourceLabel(current.target.source)], ["Use disjoint scene spans."]);
397
- }
398
- const plans = resolved.map(({ target, epIndex, from, through }) => {
399
- const before = baseline.episodes[epIndex].scenes.slice(from, through + 1);
400
- return {
401
- kind: "scene-span",
402
- address: `${target.parent}/${target.from}..${target.parent}/${target.through}`,
403
- before: scenesCounts(before),
404
- after: scenesCounts(target.scenes),
405
- ...idDiff(before.map((scene) => scene.scene_id), target.scenes.map((scene) => scene.scene_id)),
406
- untouchedSiblings: baseline.episodes[epIndex].scenes.length - before.length,
407
- };
408
- });
409
- const grouped = new Map();
410
- for (const item of resolved)
411
- grouped.set(item.epIndex, [...(grouped.get(item.epIndex) ?? []), item]);
412
- for (const [epIndex, spans] of grouped) {
413
- for (const { target, from, through } of [...spans].reverse()) {
414
- script.episodes[epIndex].scenes.splice(from, through - from + 1, ...structuredClone(target.scenes));
415
- }
416
- }
417
- return plans;
418
- }
419
- function applyActionSpans(baseline, script, targets) {
420
- const resolved = targets.map((target) => {
421
- const slash = target.parent.indexOf("/");
422
- if (slash < 1 || slash === target.parent.length - 1)
423
- fail("AUTHORING_SCENE_ADDRESS_INVALID", "Action-span parent is not a complete scene address.", [sourceLabel(target.source), target.parent], ["Use parent=ep_ID/scn_ID."]);
424
- const parent = target.parent.slice(0, slash);
425
- const sceneId = target.parent.slice(slash + 1);
426
- const [epIndex, scIndex] = sceneCoordinate(baseline, parent, sceneId);
427
- const scene = baseline.episodes[epIndex].scenes[scIndex];
428
- if (target.from > target.through)
429
- fail("AUTHORING_SPAN_REVERSED", "Action-span endpoints are reversed.", [sourceLabel(target.source), `${target.from}..${target.through}`], ["Swap from and through."]);
430
- if (target.through >= scene.actions.length)
431
- fail("AUTHORING_SPAN_ENDPOINT_NOT_FOUND", "Action-span endpoint is outside the current scene body.", [sourceLabel(target.source), `${target.from}..${target.through}`, `actions=${scene.actions.length}`], ["Use zero-based endpoints within the current body."]);
432
- if (target.actions.length === 0)
433
- fail("AUTHORING_EMPTY_SPAN", "Action-span replacement cannot be empty.", [sourceLabel(target.source)], ["Include at least one action."]);
434
- return { target, epIndex, scIndex, scene, from: target.from, through: target.through };
435
- });
436
- assertStrictOrder(resolved.map((item) => ({ coord: [item.epIndex, item.scIndex, item.from], source: item.target.source })), "Action spans are not in document order.");
437
- for (let index = 1; index < resolved.length; index += 1) {
438
- const previous = resolved[index - 1];
439
- const current = resolved[index];
440
- if (current.epIndex === previous.epIndex && current.scIndex === previous.scIndex && current.from <= previous.through) {
441
- fail("AUTHORING_SPAN_OVERLAP", "Action spans overlap.", [sourceLabel(current.target.source)], ["Use disjoint action spans."]);
442
- }
443
- }
444
- const plans = resolved.map(({ target, scene, from, through }) => ({
445
- kind: "action-span",
446
- address: `${target.parent}#${from}..${target.parent}#${through}`,
447
- before: { episodes: 0, scenes: 0, actions: through - from + 1 },
448
- after: { episodes: 0, scenes: 0, actions: target.actions.length },
449
- retainedIds: [],
450
- createdIds: [],
451
- removedIds: [],
452
- untouchedSiblings: scene.actions.length - (through - from + 1),
453
- }));
454
- const grouped = new Map();
455
- for (const item of resolved) {
456
- const key = `${item.epIndex}/${item.scIndex}`;
457
- grouped.set(key, [...(grouped.get(key) ?? []), item]);
458
- }
459
- for (const spans of grouped.values()) {
460
- for (const { target, epIndex, scIndex, from, through } of [...spans].reverse()) {
461
- script.episodes[epIndex].scenes[scIndex].actions.splice(from, through - from + 1, ...structuredClone(target.actions));
462
- }
463
- }
464
- return plans;
465
- }
466
- function assertUniqueStructureIds(script) {
467
- const episodeIds = new Set();
468
- const sceneIds = new Set();
469
- for (const episode of script.episodes) {
470
- if (episodeIds.has(episode.episode_id))
471
- fail("AUTHORING_EPISODE_ID_CONFLICT", "Episode ID occurs more than once.", [episode.episode_id], ["Use globally unique episode IDs."]);
472
- episodeIds.add(episode.episode_id);
473
- for (const scene of episode.scenes) {
474
- if (sceneIds.has(scene.scene_id))
475
- fail("AUTHORING_SCENE_ID_CONFLICT", "Scene ID occurs more than once.", [scene.scene_id], ["Use globally unique stable scene IDs."]);
476
- sceneIds.add(scene.scene_id);
477
- }
478
- }
479
- }
480
- function stableValidationPath(path, script) {
481
- const episodeMatch = /^\$\.episodes\[(\d+)]/.exec(path);
482
- if (episodeMatch === null)
483
- return path;
484
- const episode = script.episodes[Number(episodeMatch[1])];
485
- if (episode === undefined)
486
- return path;
487
- let stable = path.replace(episodeMatch[0], `$.episodes[${episode.episode_id}]`);
488
- const sceneMatch = /^(\$\.episodes\[\d+]\.scenes)\[(\d+)]/.exec(path);
489
- if (sceneMatch !== null) {
490
- const scene = episode.scenes[Number(sceneMatch[2])];
491
- if (scene !== undefined) {
492
- const oldPrefix = `${episodeMatch[0]}.scenes[${sceneMatch[2]}]`;
493
- stable = path.replace(oldPrefix, `$.episodes[${episode.episode_id}].scenes[${scene.scene_id}]`);
494
- }
495
- }
496
- return stable;
497
- }
498
- function validationKey(issue, script) {
499
- return `${issue.code}\u0000${stableValidationPath(issue.path, script)}\u0000${issue.message}`;
500
- }
501
- function authoredScope(authored) {
502
- const scope = {
503
- episodeIds: new Set(),
504
- sceneIds: new Set(),
505
- fullEpisodeIds: new Set(),
506
- fullSceneIds: new Set(),
507
- actionSpans: [],
508
- };
509
- const includeScene = (scene) => {
510
- scope.sceneIds.add(scene.scene_id);
511
- scope.fullSceneIds.add(scene.scene_id);
512
- };
513
- const includeEpisode = (episode) => {
514
- scope.episodeIds.add(episode.episode_id);
515
- scope.fullEpisodeIds.add(episode.episode_id);
516
- for (const scene of episode.scenes)
517
- includeScene(scene);
518
- };
519
- for (const target of authored) {
520
- if (target.kind === "script") {
521
- for (const episode of target.episodes)
522
- includeEpisode(episode);
523
- }
524
- else if (target.kind === "episode")
525
- includeEpisode(target.value);
526
- else if (target.kind === "episode-span") {
527
- for (const episode of target.episodes)
528
- includeEpisode(episode);
529
- }
530
- else if (target.kind === "scene")
531
- includeScene(target.value);
532
- else if (target.kind === "scene-span") {
533
- for (const scene of target.scenes)
534
- includeScene(scene);
535
- }
536
- else {
537
- scope.sceneIds.add(target.parent.split("/")[1] ?? "");
538
- scope.actionSpans.push(target);
539
- }
540
- }
541
- return scope;
542
- }
543
- function authoredCompletenessWarnings(before, after, scope) {
544
- const warnings = [];
545
- const beforeEpisodes = new Map(before?.episodes.map((episode) => [episode.episode_id, episode]) ?? []);
546
- const beforeScenes = new Map();
547
- for (const episode of before?.episodes ?? []) {
548
- for (const scene of episode.scenes)
549
- beforeScenes.set(scene.scene_id, scene);
550
- }
551
- const afterEpisodes = new Map(after.episodes.map((episode) => [episode.episode_id, episode]));
552
- const afterScenes = new Map();
553
- for (const episode of after.episodes) {
554
- for (const scene of episode.scenes)
555
- afterScenes.set(scene.scene_id, { episodeId: episode.episode_id, scene });
556
- }
557
- for (const episodeId of scope.fullEpisodeIds) {
558
- const episode = afterEpisodes.get(episodeId);
559
- if (episode === undefined || episode.scenes.length > 0)
560
- continue;
561
- const cleared = (beforeEpisodes.get(episodeId)?.scenes.length ?? 0) > 0;
562
- warnings.push({
563
- code: cleared ? "authoring_episode_cleared" : "authoring_empty_episode",
564
- path: `$.episodes[${episodeId}]`,
565
- message: cleared
566
- ? `authoring replaced episode ${episodeId} with an empty scene list`
567
- : `authored episode ${episodeId} has no scenes`,
568
- });
569
- }
570
- for (const sceneId of scope.fullSceneIds) {
571
- const located = afterScenes.get(sceneId);
572
- if (located === undefined)
573
- continue;
574
- const scenePath = `$.episodes[${located.episodeId}].scenes[${sceneId}]`;
575
- if (located.scene.actions.length === 0) {
576
- const cleared = (beforeScenes.get(sceneId)?.actions.length ?? 0) > 0;
577
- warnings.push({
578
- code: cleared ? "authoring_scene_cleared" : "authoring_empty_scene",
579
- path: scenePath,
580
- message: cleared
581
- ? `authoring replaced scene ${sceneId} with an empty body`
582
- : `authored scene ${sceneId} has an empty body`,
583
- });
584
- }
585
- located.scene.actions.forEach((action, index) => {
586
- if (action.content.trim() !== "")
587
- return;
588
- warnings.push({
589
- code: "authoring_empty_action_content",
590
- path: `${scenePath}.actions[${index}]`,
591
- message: "authored action content is empty",
592
- });
593
- });
594
- }
595
- for (const target of scope.actionSpans) {
596
- target.actions.forEach((action, index) => {
597
- if (action.content.trim() !== "")
598
- return;
599
- warnings.push({
600
- code: "authoring_empty_action_content",
601
- path: `${target.parent}#replacement[${index}]`,
602
- message: "authored action-span replacement contains an action with empty content",
603
- });
604
- });
605
- }
606
- return warnings;
607
- }
608
- function assertValidationAllowed(before, after, authored) {
609
- const result = validateScriptV3(after);
610
- const scope = authoredScope(authored);
611
- const withWarnings = () => ({
612
- ...result,
613
- warnings: [...result.warnings, ...authoredCompletenessWarnings(before, after, scope)],
614
- });
615
- if (result.ok || (before !== null && semanticEqual(before, after)))
616
- return withWarnings();
617
- const beforeKeys = new Set(before === null
618
- ? []
619
- : validateScriptV3(before).errors.map((issue) => validationKey(issue, before)));
620
- const blocking = result.errors.filter((issue) => {
621
- if (!beforeKeys.has(validationKey(issue, after)))
622
- return true;
623
- const episodeMatch = /^\$\.episodes\[(\d+)]/.exec(issue.path);
624
- if (!episodeMatch)
625
- return false;
626
- const episode = after.episodes[Number(episodeMatch[1])];
627
- if (episode === undefined)
628
- return true;
629
- if (scope.episodeIds.has(episode.episode_id))
630
- return true;
631
- const sceneMatch = /^\$\.episodes\[\d+]\.scenes\[(\d+)]/.exec(issue.path);
632
- const scene = sceneMatch === null ? undefined : episode.scenes[Number(sceneMatch[1])];
633
- return scene !== undefined && scope.sceneIds.has(scene.scene_id);
634
- });
635
- if (blocking.length > 0) {
636
- fail("AUTHORING_VALIDATION_FAILED", "The proposed script has blocking validation errors.", blocking.map((issue) => `${issue.path}: ${issue.code} ${issue.message}`), ["Repair the authoring source and rerun the plan."]);
637
- }
638
- return withWarnings();
639
- }
640
- function orphanAssets(script) {
641
- const referenced = new Set();
642
- for (const episode of script.episodes) {
643
- for (const scene of episode.scenes) {
644
- if (scene.location !== null)
645
- referenced.add(scene.location.location_id);
646
- for (const actor of scene.actors)
647
- referenced.add(actor.actor_id);
648
- for (const prop of scene.props)
649
- referenced.add(prop.prop_id);
650
- }
651
- }
652
- return [
653
- ...script.actors.map((asset) => asset.actor_id),
654
- ...script.locations.map((asset) => asset.location_id),
655
- ...script.props.map((asset) => asset.prop_id),
656
- ].filter((id) => !referenced.has(id));
657
- }
658
- function buildScriptTarget(document) {
659
- const target = document.targets[0];
660
- if (target?.kind !== "script")
661
- fail("AUTHORING_TARGET_MODE", "Script create requires exactly one script target.", [], ["Use a single <script> block."], EXIT_USAGE);
662
- for (const episode of target.episodes)
663
- assertEpisodeReferencesMaterialized(episode, target.source);
664
- const script = {
665
- version: 3,
666
- title: target.title,
667
- worldview: target.worldview,
668
- style: target.style,
669
- actors: [],
670
- locations: [],
671
- props: [],
672
- episodes: structuredClone(target.episodes),
673
- };
674
- if (target.worldviewRaw !== undefined)
675
- script.worldview_raw = target.worldviewRaw;
676
- if (target.synopsis !== undefined)
677
- script.synopsis = target.synopsis;
678
- if (target.logline !== undefined)
679
- script.logline = target.logline;
680
- if (target.theme !== undefined)
681
- script.theme = target.theme;
682
- if (target.mainCharacters !== undefined)
683
- script.main_characters = structuredClone(target.mainCharacters);
684
- if (target.extend !== undefined)
685
- script.extend = structuredClone(target.extend);
686
- const declarations = applyDeclarations(script, document.declarations);
687
- assertUniqueStructureIds(script);
688
- return { script, declarations };
689
- }
690
- export function applyAuthoring(current, document, mode) {
691
- if (document.targetKind === "script") {
692
- if (mode !== "create")
693
- fail("AUTHORING_TARGET_MODE", "Script targets support create only.", [mode], ["Use --create."], EXIT_USAGE);
694
- const built = buildScriptTarget(document);
695
- const script = built.script;
696
- if (current !== null && !semanticEqual(current, script)) {
697
- fail("AUTHORING_CREATE_CONFLICT", "The script target already exists with different content.", ["script"], ["Use episode replacement for an existing script, or write an identical script for a no-op retry."]);
698
- }
699
- const declarations = current === null
700
- ? built.declarations
701
- : {
702
- createdAssets: [],
703
- existingAssets: [...built.declarations.existingAssets, ...built.declarations.createdAssets],
704
- createdStates: [],
705
- existingStates: [...built.declarations.existingStates, ...built.declarations.createdStates],
706
- };
707
- const validation = assertValidationAllowed(current, script, document.targets);
708
- return {
709
- script,
710
- changed: current === null || !semanticEqual(current, script),
711
- declarations,
712
- targets: [{
713
- kind: "script",
714
- address: "global",
715
- before: current === null ? { episodes: 0, scenes: 0, actions: 0 } : episodesCounts(current.episodes),
716
- after: episodesCounts(script.episodes),
717
- ...idDiff(current?.episodes.map((episode) => episode.episode_id) ?? [], script.episodes.map((episode) => episode.episode_id)),
718
- untouchedSiblings: 0,
719
- }],
720
- retainedOrphanAssets: orphanAssets(script),
721
- validation,
722
- };
723
- }
724
- if (current === null) {
725
- fail("AUTHORING_SCRIPT_NOT_FOUND", "A local Script v3 file is required for this target kind.", ["<missing>"], ["Create a script first or select an existing --script-path."]);
726
- }
727
- if ((document.targetKind === "episode-span" || document.targetKind === "scene-span" || document.targetKind === "action-span") && mode !== "replace") {
728
- fail("AUTHORING_TARGET_MODE", `${document.targetKind} supports replace only.`, [mode], ["Use --replace."], EXIT_USAGE);
729
- }
730
- const baseline = structuredClone(current);
731
- const script = structuredClone(current);
732
- const declarations = applyDeclarations(script, document.declarations);
733
- let targets;
734
- switch (document.targetKind) {
735
- case "episode": {
736
- const selected = document.targets.flatMap((target) => target.kind === "episode" ? [target] : []);
737
- if (selected.length !== document.targets.length)
738
- fail("AUTHORING_TARGET_MODE", "Authoring targets are not homogeneous.", [], ["Keep one target kind per file."], EXIT_USAGE);
739
- targets = applyEpisodeTargets(baseline, script, selected, mode);
740
- break;
741
- }
742
- case "scene": {
743
- const selected = document.targets.flatMap((target) => target.kind === "scene" ? [target] : []);
744
- if (selected.length !== document.targets.length)
745
- fail("AUTHORING_TARGET_MODE", "Authoring targets are not homogeneous.", [], ["Keep one target kind per file."], EXIT_USAGE);
746
- targets = applySceneTargets(baseline, script, selected, mode);
747
- break;
748
- }
749
- case "episode-span": {
750
- const selected = document.targets.flatMap((target) => target.kind === "episode-span" ? [target] : []);
751
- if (selected.length !== document.targets.length)
752
- fail("AUTHORING_TARGET_MODE", "Authoring targets are not homogeneous.", [], ["Keep one target kind per file."], EXIT_USAGE);
753
- targets = applyEpisodeSpans(baseline, script, selected);
754
- break;
755
- }
756
- case "scene-span": {
757
- const selected = document.targets.flatMap((target) => target.kind === "scene-span" ? [target] : []);
758
- if (selected.length !== document.targets.length)
759
- fail("AUTHORING_TARGET_MODE", "Authoring targets are not homogeneous.", [], ["Keep one target kind per file."], EXIT_USAGE);
760
- targets = applySceneSpans(baseline, script, selected);
761
- break;
762
- }
763
- case "action-span": {
764
- const selected = document.targets.flatMap((target) => target.kind === "action-span" ? [target] : []);
765
- if (selected.length !== document.targets.length)
766
- fail("AUTHORING_TARGET_MODE", "Authoring targets are not homogeneous.", [], ["Keep one target kind per file."], EXIT_USAGE);
767
- targets = applyActionSpans(baseline, script, selected);
768
- break;
769
- }
770
- default:
771
- fail("AUTHORING_TARGET_MODE", "Unsupported authoring target.", [document.targetKind], ["Use a supported homogeneous target kind."]);
772
- }
773
- assertUniqueStructureIds(script);
774
- const validation = assertValidationAllowed(current, script, document.targets);
775
- return {
776
- script,
777
- changed: !semanticEqual(current, script),
778
- declarations,
779
- targets,
780
- retainedOrphanAssets: orphanAssets(script),
781
- validation,
782
- };
783
- }
784
- //# sourceMappingURL=apply.js.map