@lingjingai/scriptctl 0.63.14 → 0.63.16

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 (781) hide show
  1. package/README.md +12 -1
  2. package/changes/0.63.15.md +15 -0
  3. package/dist/bin.js +1 -20844
  4. package/dist/chunk-YOCQDDQC.js +823 -0
  5. package/dist/cli.d.ts +214 -5
  6. package/dist/cli.js +1 -187
  7. package/dist/review-agent.js +60 -3593
  8. package/package.json +17 -9
  9. package/skills/scriptctl/SKILL.md +2 -0
  10. package/skills/scriptctl/references/ingest-workflow.md +4 -0
  11. package/skills/scriptctl/references/production-writing-standard.md +10 -1
  12. package/skills/scriptctl/references/state-reference-repair.md +8 -0
  13. package/dist/bin.d.ts +0 -2
  14. package/dist/bin.js.map +0 -7
  15. package/dist/cli/register-authoring.d.ts +0 -4
  16. package/dist/cli/register-authoring.js +0 -35
  17. package/dist/cli/register-authoring.js.map +0 -1
  18. package/dist/cli/register-review.d.ts +0 -3
  19. package/dist/cli/register-review.js +0 -20
  20. package/dist/cli/register-review.js.map +0 -1
  21. package/dist/cli/register-script.d.ts +0 -3
  22. package/dist/cli/register-script.js +0 -297
  23. package/dist/cli/register-script.js.map +0 -1
  24. package/dist/cli/register-tools.d.ts +0 -3
  25. package/dist/cli/register-tools.js +0 -23
  26. package/dist/cli/register-tools.js.map +0 -1
  27. package/dist/cli/register-workflows.d.ts +0 -4
  28. package/dist/cli/register-workflows.js +0 -108
  29. package/dist/cli/register-workflows.js.map +0 -1
  30. package/dist/cli/registry.d.ts +0 -14
  31. package/dist/cli/registry.js +0 -65
  32. package/dist/cli/registry.js.map +0 -1
  33. package/dist/cli.js.map +0 -1
  34. package/dist/common.d.ts +0 -93
  35. package/dist/common.js +0 -240
  36. package/dist/common.js.map +0 -1
  37. package/dist/domain/authoring/apply.d.ts +0 -1
  38. package/dist/domain/authoring/apply.js +0 -2
  39. package/dist/domain/authoring/apply.js.map +0 -1
  40. package/dist/domain/authoring/export.d.ts +0 -1
  41. package/dist/domain/authoring/export.js +0 -2
  42. package/dist/domain/authoring/export.js.map +0 -1
  43. package/dist/domain/authoring/parser.d.ts +0 -2
  44. package/dist/domain/authoring/parser.js +0 -3
  45. package/dist/domain/authoring/parser.js.map +0 -1
  46. package/dist/domain/authoring/serializer.d.ts +0 -1
  47. package/dist/domain/authoring/serializer.js +0 -2
  48. package/dist/domain/authoring/serializer.js.map +0 -1
  49. package/dist/domain/authoring/shared/bracket.d.ts +0 -4
  50. package/dist/domain/authoring/shared/bracket.js +0 -95
  51. package/dist/domain/authoring/shared/bracket.js.map +0 -1
  52. package/dist/domain/authoring/shared/types.d.ts +0 -12
  53. package/dist/domain/authoring/shared/types.js +0 -2
  54. package/dist/domain/authoring/shared/types.js.map +0 -1
  55. package/dist/domain/authoring/types.d.ts +0 -2
  56. package/dist/domain/authoring/types.js +0 -3
  57. package/dist/domain/authoring/types.js.map +0 -1
  58. package/dist/domain/authoring/v3/apply.d.ts +0 -33
  59. package/dist/domain/authoring/v3/apply.js +0 -784
  60. package/dist/domain/authoring/v3/apply.js.map +0 -1
  61. package/dist/domain/authoring/v3/export.d.ts +0 -7
  62. package/dist/domain/authoring/v3/export.js +0 -85
  63. package/dist/domain/authoring/v3/export.js.map +0 -1
  64. package/dist/domain/authoring/v3/parser.d.ts +0 -3
  65. package/dist/domain/authoring/v3/parser.js +0 -823
  66. package/dist/domain/authoring/v3/parser.js.map +0 -1
  67. package/dist/domain/authoring/v3/serializer.d.ts +0 -2
  68. package/dist/domain/authoring/v3/serializer.js +0 -244
  69. package/dist/domain/authoring/v3/serializer.js.map +0 -1
  70. package/dist/domain/authoring/v3/types.d.ts +0 -76
  71. package/dist/domain/authoring/v3/types.js +0 -2
  72. package/dist/domain/authoring/v3/types.js.map +0 -1
  73. package/dist/domain/authoring/v4/apply.d.ts +0 -40
  74. package/dist/domain/authoring/v4/apply.js +0 -451
  75. package/dist/domain/authoring/v4/apply.js.map +0 -1
  76. package/dist/domain/authoring/v4/parser.d.ts +0 -2
  77. package/dist/domain/authoring/v4/parser.js +0 -729
  78. package/dist/domain/authoring/v4/parser.js.map +0 -1
  79. package/dist/domain/authoring/v4/serializer.d.ts +0 -6
  80. package/dist/domain/authoring/v4/serializer.js +0 -280
  81. package/dist/domain/authoring/v4/serializer.js.map +0 -1
  82. package/dist/domain/authoring/v4/types.d.ts +0 -50
  83. package/dist/domain/authoring/v4/types.js +0 -2
  84. package/dist/domain/authoring/v4/types.js.map +0 -1
  85. package/dist/domain/creative-draft/compose.d.ts +0 -18
  86. package/dist/domain/creative-draft/compose.js +0 -448
  87. package/dist/domain/creative-draft/compose.js.map +0 -1
  88. package/dist/domain/ingest/apply-plan.d.ts +0 -23
  89. package/dist/domain/ingest/apply-plan.js +0 -210
  90. package/dist/domain/ingest/apply-plan.js.map +0 -1
  91. package/dist/domain/ingest/assembler.d.ts +0 -65
  92. package/dist/domain/ingest/assembler.js +0 -263
  93. package/dist/domain/ingest/assembler.js.map +0 -1
  94. package/dist/domain/ingest/asset-audit.d.ts +0 -50
  95. package/dist/domain/ingest/asset-audit.js +0 -196
  96. package/dist/domain/ingest/asset-audit.js.map +0 -1
  97. package/dist/domain/ingest/chunker.d.ts +0 -9
  98. package/dist/domain/ingest/chunker.js +0 -49
  99. package/dist/domain/ingest/chunker.js.map +0 -1
  100. package/dist/domain/ingest/environment.d.ts +0 -3
  101. package/dist/domain/ingest/environment.js +0 -32
  102. package/dist/domain/ingest/environment.js.map +0 -1
  103. package/dist/domain/ingest/evidence.d.ts +0 -5
  104. package/dist/domain/ingest/evidence.js +0 -66
  105. package/dist/domain/ingest/evidence.js.map +0 -1
  106. package/dist/domain/ingest/govern.d.ts +0 -3
  107. package/dist/domain/ingest/govern.js +0 -157
  108. package/dist/domain/ingest/govern.js.map +0 -1
  109. package/dist/domain/ingest/jsonl-parser.d.ts +0 -6
  110. package/dist/domain/ingest/jsonl-parser.js +0 -204
  111. package/dist/domain/ingest/jsonl-parser.js.map +0 -1
  112. package/dist/domain/ingest/markdown-parser.d.ts +0 -6
  113. package/dist/domain/ingest/markdown-parser.js +0 -187
  114. package/dist/domain/ingest/markdown-parser.js.map +0 -1
  115. package/dist/domain/ingest/production-validation.d.ts +0 -8
  116. package/dist/domain/ingest/production-validation.js +0 -37
  117. package/dist/domain/ingest/production-validation.js.map +0 -1
  118. package/dist/domain/ingest/records.d.ts +0 -72
  119. package/dist/domain/ingest/records.js +0 -10
  120. package/dist/domain/ingest/records.js.map +0 -1
  121. package/dist/domain/ingest/renumber.d.ts +0 -14
  122. package/dist/domain/ingest/renumber.js +0 -130
  123. package/dist/domain/ingest/renumber.js.map +0 -1
  124. package/dist/domain/ingest/serial-context.d.ts +0 -93
  125. package/dist/domain/ingest/serial-context.js +0 -355
  126. package/dist/domain/ingest/serial-context.js.map +0 -1
  127. package/dist/domain/ingest/state-identity.d.ts +0 -2
  128. package/dist/domain/ingest/state-identity.js +0 -3
  129. package/dist/domain/ingest/state-identity.js.map +0 -1
  130. package/dist/domain/ingest/state-reconcile.d.ts +0 -12
  131. package/dist/domain/ingest/state-reconcile.js +0 -92
  132. package/dist/domain/ingest/state-reconcile.js.map +0 -1
  133. package/dist/domain/ingest/validation.d.ts +0 -1
  134. package/dist/domain/ingest/validation.js +0 -2
  135. package/dist/domain/ingest/validation.js.map +0 -1
  136. package/dist/domain/ingest/video-apply.d.ts +0 -4
  137. package/dist/domain/ingest/video-apply.js +0 -128
  138. package/dist/domain/ingest/video-apply.js.map +0 -1
  139. package/dist/domain/ingest/video-context.d.ts +0 -64
  140. package/dist/domain/ingest/video-context.js +0 -480
  141. package/dist/domain/ingest/video-context.js.map +0 -1
  142. package/dist/domain/ingest/video-records.d.ts +0 -57
  143. package/dist/domain/ingest/video-records.js +0 -9
  144. package/dist/domain/ingest/video-records.js.map +0 -1
  145. package/dist/domain/ingest/video-serial-md.d.ts +0 -81
  146. package/dist/domain/ingest/video-serial-md.js +0 -297
  147. package/dist/domain/ingest/video-serial-md.js.map +0 -1
  148. package/dist/domain/ingest/video-source-evolution.d.ts +0 -25
  149. package/dist/domain/ingest/video-source-evolution.js +0 -40
  150. package/dist/domain/ingest/video-source-evolution.js.map +0 -1
  151. package/dist/domain/ingest/video-state-evidence.d.ts +0 -66
  152. package/dist/domain/ingest/video-state-evidence.js +0 -385
  153. package/dist/domain/ingest/video-state-evidence.js.map +0 -1
  154. package/dist/domain/ingest/video-timestamp.d.ts +0 -8
  155. package/dist/domain/ingest/video-timestamp.js +0 -26
  156. package/dist/domain/ingest/video-timestamp.js.map +0 -1
  157. package/dist/domain/loom/checkpointer.d.ts +0 -3
  158. package/dist/domain/loom/checkpointer.js +0 -30
  159. package/dist/domain/loom/checkpointer.js.map +0 -1
  160. package/dist/domain/loom/index.d.ts +0 -45
  161. package/dist/domain/loom/index.js +0 -277
  162. package/dist/domain/loom/index.js.map +0 -1
  163. package/dist/domain/loom/types.d.ts +0 -101
  164. package/dist/domain/loom/types.js +0 -2
  165. package/dist/domain/loom/types.js.map +0 -1
  166. package/dist/domain/script/address.d.ts +0 -1
  167. package/dist/domain/script/address.js +0 -2
  168. package/dist/domain/script/address.js.map +0 -1
  169. package/dist/domain/script/dispatch.d.ts +0 -18
  170. package/dist/domain/script/dispatch.js +0 -55
  171. package/dist/domain/script/dispatch.js.map +0 -1
  172. package/dist/domain/script/lookups.d.ts +0 -1
  173. package/dist/domain/script/lookups.js +0 -2
  174. package/dist/domain/script/lookups.js.map +0 -1
  175. package/dist/domain/script/migrations/registry.d.ts +0 -4
  176. package/dist/domain/script/migrations/registry.js +0 -76
  177. package/dist/domain/script/migrations/registry.js.map +0 -1
  178. package/dist/domain/script/migrations/types.d.ts +0 -17
  179. package/dist/domain/script/migrations/types.js +0 -2
  180. package/dist/domain/script/migrations/types.js.map +0 -1
  181. package/dist/domain/script/migrations/v3-to-v4.d.ts +0 -3
  182. package/dist/domain/script/migrations/v3-to-v4.js +0 -57
  183. package/dist/domain/script/migrations/v3-to-v4.js.map +0 -1
  184. package/dist/domain/script/names.d.ts +0 -1
  185. package/dist/domain/script/names.js +0 -2
  186. package/dist/domain/script/names.js.map +0 -1
  187. package/dist/domain/script/parse.d.ts +0 -1
  188. package/dist/domain/script/parse.js +0 -2
  189. package/dist/domain/script/parse.js.map +0 -1
  190. package/dist/domain/script/patch/apply.d.ts +0 -1
  191. package/dist/domain/script/patch/apply.js +0 -2
  192. package/dist/domain/script/patch/apply.js.map +0 -1
  193. package/dist/domain/script/patch/helpers.d.ts +0 -1
  194. package/dist/domain/script/patch/helpers.js +0 -2
  195. package/dist/domain/script/patch/helpers.js.map +0 -1
  196. package/dist/domain/script/patch/inline-speaker.d.ts +0 -1
  197. package/dist/domain/script/patch/inline-speaker.js +0 -2
  198. package/dist/domain/script/patch/inline-speaker.js.map +0 -1
  199. package/dist/domain/script/patch/ops-action.d.ts +0 -1
  200. package/dist/domain/script/patch/ops-action.js +0 -2
  201. package/dist/domain/script/patch/ops-action.js.map +0 -1
  202. package/dist/domain/script/patch/ops-asset.d.ts +0 -1
  203. package/dist/domain/script/patch/ops-asset.js +0 -2
  204. package/dist/domain/script/patch/ops-asset.js.map +0 -1
  205. package/dist/domain/script/patch/ops-dialogue.d.ts +0 -1
  206. package/dist/domain/script/patch/ops-dialogue.js +0 -2
  207. package/dist/domain/script/patch/ops-dialogue.js.map +0 -1
  208. package/dist/domain/script/patch/ops-extend.d.ts +0 -1
  209. package/dist/domain/script/patch/ops-extend.js +0 -2
  210. package/dist/domain/script/patch/ops-extend.js.map +0 -1
  211. package/dist/domain/script/patch/ops-meta.d.ts +0 -1
  212. package/dist/domain/script/patch/ops-meta.js +0 -2
  213. package/dist/domain/script/patch/ops-meta.js.map +0 -1
  214. package/dist/domain/script/patch/ops-scene.d.ts +0 -1
  215. package/dist/domain/script/patch/ops-scene.js +0 -2
  216. package/dist/domain/script/patch/ops-scene.js.map +0 -1
  217. package/dist/domain/script/patch/ops-state.d.ts +0 -1
  218. package/dist/domain/script/patch/ops-state.js +0 -2
  219. package/dist/domain/script/patch/ops-state.js.map +0 -1
  220. package/dist/domain/script/patch/registry.d.ts +0 -1
  221. package/dist/domain/script/patch/registry.js +0 -2
  222. package/dist/domain/script/patch/registry.js.map +0 -1
  223. package/dist/domain/script/patch/types.d.ts +0 -1
  224. package/dist/domain/script/patch/types.js +0 -2
  225. package/dist/domain/script/patch/types.js.map +0 -1
  226. package/dist/domain/script/refs.d.ts +0 -1
  227. package/dist/domain/script/refs.js +0 -2
  228. package/dist/domain/script/refs.js.map +0 -1
  229. package/dist/domain/script/scene-refs.d.ts +0 -1
  230. package/dist/domain/script/scene-refs.js +0 -2
  231. package/dist/domain/script/scene-refs.js.map +0 -1
  232. package/dist/domain/script/schema.d.ts +0 -1
  233. package/dist/domain/script/schema.js +0 -2
  234. package/dist/domain/script/schema.js.map +0 -1
  235. package/dist/domain/script/selector.d.ts +0 -1
  236. package/dist/domain/script/selector.js +0 -2
  237. package/dist/domain/script/selector.js.map +0 -1
  238. package/dist/domain/script/shared/regex.d.ts +0 -2
  239. package/dist/domain/script/shared/regex.js +0 -7
  240. package/dist/domain/script/shared/regex.js.map +0 -1
  241. package/dist/domain/script/shared/types.d.ts +0 -1
  242. package/dist/domain/script/shared/types.js +0 -5
  243. package/dist/domain/script/shared/types.js.map +0 -1
  244. package/dist/domain/script/shared/validation.d.ts +0 -1
  245. package/dist/domain/script/shared/validation.js +0 -3
  246. package/dist/domain/script/shared/validation.js.map +0 -1
  247. package/dist/domain/script/shared.d.ts +0 -15
  248. package/dist/domain/script/shared.js +0 -35
  249. package/dist/domain/script/shared.js.map +0 -1
  250. package/dist/domain/script/text-util.d.ts +0 -7
  251. package/dist/domain/script/text-util.js +0 -95
  252. package/dist/domain/script/text-util.js.map +0 -1
  253. package/dist/domain/script/timestamp.d.ts +0 -1
  254. package/dist/domain/script/timestamp.js +0 -3
  255. package/dist/domain/script/timestamp.js.map +0 -1
  256. package/dist/domain/script/types.d.ts +0 -1
  257. package/dist/domain/script/types.js +0 -2
  258. package/dist/domain/script/types.js.map +0 -1
  259. package/dist/domain/script/v3/address.d.ts +0 -32
  260. package/dist/domain/script/v3/address.js +0 -136
  261. package/dist/domain/script/v3/address.js.map +0 -1
  262. package/dist/domain/script/v3/lookups.d.ts +0 -33
  263. package/dist/domain/script/v3/lookups.js +0 -316
  264. package/dist/domain/script/v3/lookups.js.map +0 -1
  265. package/dist/domain/script/v3/ordinal.d.ts +0 -8
  266. package/dist/domain/script/v3/ordinal.js +0 -91
  267. package/dist/domain/script/v3/ordinal.js.map +0 -1
  268. package/dist/domain/script/v3/parse.d.ts +0 -3
  269. package/dist/domain/script/v3/parse.js +0 -164
  270. package/dist/domain/script/v3/parse.js.map +0 -1
  271. package/dist/domain/script/v3/patch/apply.d.ts +0 -2
  272. package/dist/domain/script/v3/patch/apply.js +0 -31
  273. package/dist/domain/script/v3/patch/apply.js.map +0 -1
  274. package/dist/domain/script/v3/patch/helpers.d.ts +0 -15
  275. package/dist/domain/script/v3/patch/helpers.js +0 -155
  276. package/dist/domain/script/v3/patch/helpers.js.map +0 -1
  277. package/dist/domain/script/v3/patch/inline-speaker.d.ts +0 -2
  278. package/dist/domain/script/v3/patch/inline-speaker.js +0 -50
  279. package/dist/domain/script/v3/patch/inline-speaker.js.map +0 -1
  280. package/dist/domain/script/v3/patch/ops-action.d.ts +0 -12
  281. package/dist/domain/script/v3/patch/ops-action.js +0 -355
  282. package/dist/domain/script/v3/patch/ops-action.js.map +0 -1
  283. package/dist/domain/script/v3/patch/ops-asset.d.ts +0 -14
  284. package/dist/domain/script/v3/patch/ops-asset.js +0 -347
  285. package/dist/domain/script/v3/patch/ops-asset.js.map +0 -1
  286. package/dist/domain/script/v3/patch/ops-dialogue.d.ts +0 -2
  287. package/dist/domain/script/v3/patch/ops-dialogue.js +0 -21
  288. package/dist/domain/script/v3/patch/ops-dialogue.js.map +0 -1
  289. package/dist/domain/script/v3/patch/ops-extend.d.ts +0 -8
  290. package/dist/domain/script/v3/patch/ops-extend.js +0 -122
  291. package/dist/domain/script/v3/patch/ops-extend.js.map +0 -1
  292. package/dist/domain/script/v3/patch/ops-meta.d.ts +0 -5
  293. package/dist/domain/script/v3/patch/ops-meta.js +0 -82
  294. package/dist/domain/script/v3/patch/ops-meta.js.map +0 -1
  295. package/dist/domain/script/v3/patch/ops-scene.d.ts +0 -6
  296. package/dist/domain/script/v3/patch/ops-scene.js +0 -351
  297. package/dist/domain/script/v3/patch/ops-scene.js.map +0 -1
  298. package/dist/domain/script/v3/patch/ops-state.d.ts +0 -8
  299. package/dist/domain/script/v3/patch/ops-state.js +0 -155
  300. package/dist/domain/script/v3/patch/ops-state.js.map +0 -1
  301. package/dist/domain/script/v3/patch/ops-timestamp.d.ts +0 -6
  302. package/dist/domain/script/v3/patch/ops-timestamp.js +0 -47
  303. package/dist/domain/script/v3/patch/ops-timestamp.js.map +0 -1
  304. package/dist/domain/script/v3/patch/registry.d.ts +0 -2
  305. package/dist/domain/script/v3/patch/registry.js +0 -56
  306. package/dist/domain/script/v3/patch/registry.js.map +0 -1
  307. package/dist/domain/script/v3/patch/types.d.ts +0 -10
  308. package/dist/domain/script/v3/patch/types.js +0 -2
  309. package/dist/domain/script/v3/patch/types.js.map +0 -1
  310. package/dist/domain/script/v3/refs.d.ts +0 -4
  311. package/dist/domain/script/v3/refs.js +0 -64
  312. package/dist/domain/script/v3/refs.js.map +0 -1
  313. package/dist/domain/script/v3/scene-refs.d.ts +0 -3
  314. package/dist/domain/script/v3/scene-refs.js +0 -35
  315. package/dist/domain/script/v3/scene-refs.js.map +0 -1
  316. package/dist/domain/script/v3/schema.d.ts +0 -6
  317. package/dist/domain/script/v3/schema.js +0 -58
  318. package/dist/domain/script/v3/schema.js.map +0 -1
  319. package/dist/domain/script/v3/selector.d.ts +0 -44
  320. package/dist/domain/script/v3/selector.js +0 -178
  321. package/dist/domain/script/v3/selector.js.map +0 -1
  322. package/dist/domain/script/v3/types.d.ts +0 -106
  323. package/dist/domain/script/v3/types.js +0 -2
  324. package/dist/domain/script/v3/types.js.map +0 -1
  325. package/dist/domain/script/v3/validation.d.ts +0 -2
  326. package/dist/domain/script/v3/validation.js +0 -2
  327. package/dist/domain/script/v3/validation.js.map +0 -1
  328. package/dist/domain/script/v4/address.d.ts +0 -61
  329. package/dist/domain/script/v4/address.js +0 -99
  330. package/dist/domain/script/v4/address.js.map +0 -1
  331. package/dist/domain/script/v4/factory.d.ts +0 -2
  332. package/dist/domain/script/v4/factory.js +0 -13
  333. package/dist/domain/script/v4/factory.js.map +0 -1
  334. package/dist/domain/script/v4/from-v3.d.ts +0 -29
  335. package/dist/domain/script/v4/from-v3.js +0 -307
  336. package/dist/domain/script/v4/from-v3.js.map +0 -1
  337. package/dist/domain/script/v4/ids.d.ts +0 -5
  338. package/dist/domain/script/v4/ids.js +0 -41
  339. package/dist/domain/script/v4/ids.js.map +0 -1
  340. package/dist/domain/script/v4/ordinal.d.ts +0 -3
  341. package/dist/domain/script/v4/ordinal.js +0 -66
  342. package/dist/domain/script/v4/ordinal.js.map +0 -1
  343. package/dist/domain/script/v4/parse.d.ts +0 -5
  344. package/dist/domain/script/v4/parse.js +0 -196
  345. package/dist/domain/script/v4/parse.js.map +0 -1
  346. package/dist/domain/script/v4/patch/apply.d.ts +0 -3
  347. package/dist/domain/script/v4/patch/apply.js +0 -24
  348. package/dist/domain/script/v4/patch/apply.js.map +0 -1
  349. package/dist/domain/script/v4/patch/helpers.d.ts +0 -32
  350. package/dist/domain/script/v4/patch/helpers.js +0 -138
  351. package/dist/domain/script/v4/patch/helpers.js.map +0 -1
  352. package/dist/domain/script/v4/patch/ops-action.d.ts +0 -13
  353. package/dist/domain/script/v4/patch/ops-action.js +0 -351
  354. package/dist/domain/script/v4/patch/ops-action.js.map +0 -1
  355. package/dist/domain/script/v4/patch/ops-asset.d.ts +0 -17
  356. package/dist/domain/script/v4/patch/ops-asset.js +0 -556
  357. package/dist/domain/script/v4/patch/ops-asset.js.map +0 -1
  358. package/dist/domain/script/v4/patch/ops-extend.d.ts +0 -11
  359. package/dist/domain/script/v4/patch/ops-extend.js +0 -103
  360. package/dist/domain/script/v4/patch/ops-extend.js.map +0 -1
  361. package/dist/domain/script/v4/patch/ops-meta.d.ts +0 -5
  362. package/dist/domain/script/v4/patch/ops-meta.js +0 -49
  363. package/dist/domain/script/v4/patch/ops-meta.js.map +0 -1
  364. package/dist/domain/script/v4/patch/ops-scene-ref.d.ts +0 -3
  365. package/dist/domain/script/v4/patch/ops-scene-ref.js +0 -74
  366. package/dist/domain/script/v4/patch/ops-scene-ref.js.map +0 -1
  367. package/dist/domain/script/v4/patch/ops-structure.d.ts +0 -6
  368. package/dist/domain/script/v4/patch/ops-structure.js +0 -236
  369. package/dist/domain/script/v4/patch/ops-structure.js.map +0 -1
  370. package/dist/domain/script/v4/patch/ops-timestamp.d.ts +0 -6
  371. package/dist/domain/script/v4/patch/ops-timestamp.js +0 -40
  372. package/dist/domain/script/v4/patch/ops-timestamp.js.map +0 -1
  373. package/dist/domain/script/v4/patch/registry.d.ts +0 -2
  374. package/dist/domain/script/v4/patch/registry.js +0 -53
  375. package/dist/domain/script/v4/patch/registry.js.map +0 -1
  376. package/dist/domain/script/v4/patch/schema.d.ts +0 -7
  377. package/dist/domain/script/v4/patch/schema.js +0 -77
  378. package/dist/domain/script/v4/patch/schema.js.map +0 -1
  379. package/dist/domain/script/v4/patch/types.d.ts +0 -10
  380. package/dist/domain/script/v4/patch/types.js +0 -2
  381. package/dist/domain/script/v4/patch/types.js.map +0 -1
  382. package/dist/domain/script/v4/selector.d.ts +0 -11
  383. package/dist/domain/script/v4/selector.js +0 -124
  384. package/dist/domain/script/v4/selector.js.map +0 -1
  385. package/dist/domain/script/v4/types.d.ts +0 -120
  386. package/dist/domain/script/v4/types.js +0 -2
  387. package/dist/domain/script/v4/types.js.map +0 -1
  388. package/dist/domain/script/v4/validation.d.ts +0 -2
  389. package/dist/domain/script/v4/validation.js +0 -2
  390. package/dist/domain/script/v4/validation.js.map +0 -1
  391. package/dist/failures.d.ts +0 -58
  392. package/dist/failures.js +0 -96
  393. package/dist/failures.js.map +0 -1
  394. package/dist/infra/converters.d.ts +0 -9
  395. package/dist/infra/converters.js +0 -689
  396. package/dist/infra/converters.js.map +0 -1
  397. package/dist/infra/env.d.ts +0 -2
  398. package/dist/infra/env.js +0 -81
  399. package/dist/infra/env.js.map +0 -1
  400. package/dist/infra/episode-title.d.ts +0 -4
  401. package/dist/infra/episode-title.js +0 -129
  402. package/dist/infra/episode-title.js.map +0 -1
  403. package/dist/infra/ingest/review-renderer.d.ts +0 -1
  404. package/dist/infra/ingest/review-renderer.js +0 -440
  405. package/dist/infra/ingest/review-renderer.js.map +0 -1
  406. package/dist/infra/ingest/source-resolver.d.ts +0 -21
  407. package/dist/infra/ingest/source-resolver.js +0 -51
  408. package/dist/infra/ingest/source-resolver.js.map +0 -1
  409. package/dist/infra/ingest/text-reader.d.ts +0 -3
  410. package/dist/infra/ingest/text-reader.js +0 -27
  411. package/dist/infra/ingest/text-reader.js.map +0 -1
  412. package/dist/infra/ingest/video-discovery.d.ts +0 -8
  413. package/dist/infra/ingest/video-discovery.js +0 -69
  414. package/dist/infra/ingest/video-discovery.js.map +0 -1
  415. package/dist/infra/ingest/video-source-snapshot.d.ts +0 -4
  416. package/dist/infra/ingest/video-source-snapshot.js +0 -47
  417. package/dist/infra/ingest/video-source-snapshot.js.map +0 -1
  418. package/dist/infra/ingest/video-state-evidence.d.ts +0 -14
  419. package/dist/infra/ingest/video-state-evidence.js +0 -140
  420. package/dist/infra/ingest/video-state-evidence.js.map +0 -1
  421. package/dist/infra/ingest/video-transcode.d.ts +0 -7
  422. package/dist/infra/ingest/video-transcode.js +0 -98
  423. package/dist/infra/ingest/video-transcode.js.map +0 -1
  424. package/dist/infra/ingest/workspace-lock.d.ts +0 -1
  425. package/dist/infra/ingest/workspace-lock.js +0 -32
  426. package/dist/infra/ingest/workspace-lock.js.map +0 -1
  427. package/dist/infra/ingest/workspace-store.d.ts +0 -18
  428. package/dist/infra/ingest/workspace-store.js +0 -70
  429. package/dist/infra/ingest/workspace-store.js.map +0 -1
  430. package/dist/infra/llm/anthropic-model.d.ts +0 -11
  431. package/dist/infra/llm/anthropic-model.js +0 -130
  432. package/dist/infra/llm/anthropic-model.js.map +0 -1
  433. package/dist/infra/llm/doubao-model.d.ts +0 -60
  434. package/dist/infra/llm/doubao-model.js +0 -249
  435. package/dist/infra/llm/doubao-model.js.map +0 -1
  436. package/dist/infra/llm/failure-mapping.d.ts +0 -6
  437. package/dist/infra/llm/failure-mapping.js +0 -146
  438. package/dist/infra/llm/failure-mapping.js.map +0 -1
  439. package/dist/infra/llm/gemini-upload.d.ts +0 -13
  440. package/dist/infra/llm/gemini-upload.js +0 -138
  441. package/dist/infra/llm/gemini-upload.js.map +0 -1
  442. package/dist/infra/llm/gemini-video-model.d.ts +0 -50
  443. package/dist/infra/llm/gemini-video-model.js +0 -371
  444. package/dist/infra/llm/gemini-video-model.js.map +0 -1
  445. package/dist/infra/llm/openai-compatible-model.d.ts +0 -14
  446. package/dist/infra/llm/openai-compatible-model.js +0 -207
  447. package/dist/infra/llm/openai-compatible-model.js.map +0 -1
  448. package/dist/infra/llm/retry.d.ts +0 -8
  449. package/dist/infra/llm/retry.js +0 -41
  450. package/dist/infra/llm/retry.js.map +0 -1
  451. package/dist/infra/local-script-output-store.d.ts +0 -43
  452. package/dist/infra/local-script-output-store.js +0 -168
  453. package/dist/infra/local-script-output-store.js.map +0 -1
  454. package/dist/infra/script-output-api.d.ts +0 -50
  455. package/dist/infra/script-output-api.js +0 -251
  456. package/dist/infra/script-output-api.js.map +0 -1
  457. package/dist/infra/script-output-store.d.ts +0 -152
  458. package/dist/infra/script-output-store.js +0 -114
  459. package/dist/infra/script-output-store.js.map +0 -1
  460. package/dist/infra/script-working-copy.d.ts +0 -23
  461. package/dist/infra/script-working-copy.js +0 -157
  462. package/dist/infra/script-working-copy.js.map +0 -1
  463. package/dist/infra/storage.d.ts +0 -35
  464. package/dist/infra/storage.js +0 -91
  465. package/dist/infra/storage.js.map +0 -1
  466. package/dist/llm/composition.d.ts +0 -5
  467. package/dist/llm/composition.js +0 -5
  468. package/dist/llm/composition.js.map +0 -1
  469. package/dist/llm/config.d.ts +0 -28
  470. package/dist/llm/config.js +0 -231
  471. package/dist/llm/config.js.map +0 -1
  472. package/dist/llm/registry.d.ts +0 -43
  473. package/dist/llm/registry.js +0 -69
  474. package/dist/llm/registry.js.map +0 -1
  475. package/dist/llm/router.d.ts +0 -46
  476. package/dist/llm/router.js +0 -512
  477. package/dist/llm/router.js.map +0 -1
  478. package/dist/llm/tasks/ingest/arc-summary.d.ts +0 -8
  479. package/dist/llm/tasks/ingest/arc-summary.js +0 -26
  480. package/dist/llm/tasks/ingest/arc-summary.js.map +0 -1
  481. package/dist/llm/tasks/ingest/asset-audit.d.ts +0 -6
  482. package/dist/llm/tasks/ingest/asset-audit.js +0 -158
  483. package/dist/llm/tasks/ingest/asset-audit.js.map +0 -1
  484. package/dist/llm/tasks/ingest/asset-curate.d.ts +0 -13
  485. package/dist/llm/tasks/ingest/asset-curate.js +0 -45
  486. package/dist/llm/tasks/ingest/asset-curate.js.map +0 -1
  487. package/dist/llm/tasks/ingest/asset-extract.d.ts +0 -12
  488. package/dist/llm/tasks/ingest/asset-extract.js +0 -51
  489. package/dist/llm/tasks/ingest/asset-extract.js.map +0 -1
  490. package/dist/llm/tasks/ingest/asset-govern.d.ts +0 -22
  491. package/dist/llm/tasks/ingest/asset-govern.js +0 -143
  492. package/dist/llm/tasks/ingest/asset-govern.js.map +0 -1
  493. package/dist/llm/tasks/ingest/body-start.d.ts +0 -10
  494. package/dist/llm/tasks/ingest/body-start.js +0 -41
  495. package/dist/llm/tasks/ingest/body-start.js.map +0 -1
  496. package/dist/llm/tasks/ingest/episode-assets.d.ts +0 -29
  497. package/dist/llm/tasks/ingest/episode-assets.js +0 -282
  498. package/dist/llm/tasks/ingest/episode-assets.js.map +0 -1
  499. package/dist/llm/tasks/ingest/mention-resolve.d.ts +0 -9
  500. package/dist/llm/tasks/ingest/mention-resolve.js +0 -39
  501. package/dist/llm/tasks/ingest/mention-resolve.js.map +0 -1
  502. package/dist/llm/tasks/ingest/name-fix.d.ts +0 -9
  503. package/dist/llm/tasks/ingest/name-fix.js +0 -56
  504. package/dist/llm/tasks/ingest/name-fix.js.map +0 -1
  505. package/dist/llm/tasks/ingest/state-reconcile.d.ts +0 -8
  506. package/dist/llm/tasks/ingest/state-reconcile.js +0 -44
  507. package/dist/llm/tasks/ingest/state-reconcile.js.map +0 -1
  508. package/dist/llm/tasks/ingest/text-normalize.d.ts +0 -10
  509. package/dist/llm/tasks/ingest/text-normalize.js +0 -122
  510. package/dist/llm/tasks/ingest/text-normalize.js.map +0 -1
  511. package/dist/llm/tasks/ingest/video-serial.d.ts +0 -24
  512. package/dist/llm/tasks/ingest/video-serial.js +0 -416
  513. package/dist/llm/tasks/ingest/video-serial.js.map +0 -1
  514. package/dist/llm/tasks/schemas.d.ts +0 -9
  515. package/dist/llm/tasks/schemas.js +0 -466
  516. package/dist/llm/tasks/schemas.js.map +0 -1
  517. package/dist/llm/types.d.ts +0 -178
  518. package/dist/llm/types.js +0 -44
  519. package/dist/llm/types.js.map +0 -1
  520. package/dist/output.d.ts +0 -3
  521. package/dist/output.js +0 -94
  522. package/dist/output.js.map +0 -1
  523. package/dist/package-root.d.ts +0 -2
  524. package/dist/package-root.js +0 -38
  525. package/dist/package-root.js.map +0 -1
  526. package/dist/review-agent.js.map +0 -7
  527. package/dist/usecases/changelog.d.ts +0 -9
  528. package/dist/usecases/changelog.js +0 -134
  529. package/dist/usecases/changelog.js.map +0 -1
  530. package/dist/usecases/doctor.d.ts +0 -2
  531. package/dist/usecases/doctor.js +0 -231
  532. package/dist/usecases/doctor.js.map +0 -1
  533. package/dist/usecases/ingest/body-start.d.ts +0 -8
  534. package/dist/usecases/ingest/body-start.js +0 -36
  535. package/dist/usecases/ingest/body-start.js.map +0 -1
  536. package/dist/usecases/ingest/command.d.ts +0 -5
  537. package/dist/usecases/ingest/command.js +0 -183
  538. package/dist/usecases/ingest/command.js.map +0 -1
  539. package/dist/usecases/ingest/failure.d.ts +0 -26
  540. package/dist/usecases/ingest/failure.js +0 -153
  541. package/dist/usecases/ingest/failure.js.map +0 -1
  542. package/dist/usecases/ingest/fanout.d.ts +0 -10
  543. package/dist/usecases/ingest/fanout.js +0 -23
  544. package/dist/usecases/ingest/fanout.js.map +0 -1
  545. package/dist/usecases/ingest/final-asset-audit.d.ts +0 -39
  546. package/dist/usecases/ingest/final-asset-audit.js +0 -88
  547. package/dist/usecases/ingest/final-asset-audit.js.map +0 -1
  548. package/dist/usecases/ingest/generate-video-state-evidence.d.ts +0 -23
  549. package/dist/usecases/ingest/generate-video-state-evidence.js +0 -124
  550. package/dist/usecases/ingest/generate-video-state-evidence.js.map +0 -1
  551. package/dist/usecases/ingest/pass4-mention-resolve.d.ts +0 -11
  552. package/dist/usecases/ingest/pass4-mention-resolve.js +0 -52
  553. package/dist/usecases/ingest/pass4-mention-resolve.js.map +0 -1
  554. package/dist/usecases/ingest/pass5-extract.d.ts +0 -7
  555. package/dist/usecases/ingest/pass5-extract.js +0 -51
  556. package/dist/usecases/ingest/pass5-extract.js.map +0 -1
  557. package/dist/usecases/ingest/pass5-govern.d.ts +0 -13
  558. package/dist/usecases/ingest/pass5-govern.js +0 -157
  559. package/dist/usecases/ingest/pass5-govern.js.map +0 -1
  560. package/dist/usecases/ingest/pipeline.d.ts +0 -28
  561. package/dist/usecases/ingest/pipeline.js +0 -335
  562. package/dist/usecases/ingest/pipeline.js.map +0 -1
  563. package/dist/usecases/ingest/publish-command.d.ts +0 -1
  564. package/dist/usecases/ingest/publish-command.js +0 -4
  565. package/dist/usecases/ingest/publish-command.js.map +0 -1
  566. package/dist/usecases/ingest/serial-govern.d.ts +0 -40
  567. package/dist/usecases/ingest/serial-govern.js +0 -488
  568. package/dist/usecases/ingest/serial-govern.js.map +0 -1
  569. package/dist/usecases/ingest/skip-video-episode.d.ts +0 -4
  570. package/dist/usecases/ingest/skip-video-episode.js +0 -120
  571. package/dist/usecases/ingest/skip-video-episode.js.map +0 -1
  572. package/dist/usecases/ingest/status.d.ts +0 -61
  573. package/dist/usecases/ingest/status.js +0 -347
  574. package/dist/usecases/ingest/status.js.map +0 -1
  575. package/dist/usecases/ingest/timings.d.ts +0 -51
  576. package/dist/usecases/ingest/timings.js +0 -68
  577. package/dist/usecases/ingest/timings.js.map +0 -1
  578. package/dist/usecases/ingest/usage-report.d.ts +0 -125
  579. package/dist/usecases/ingest/usage-report.js +0 -248
  580. package/dist/usecases/ingest/usage-report.js.map +0 -1
  581. package/dist/usecases/ingest/video-pipeline.d.ts +0 -81
  582. package/dist/usecases/ingest/video-pipeline.js +0 -548
  583. package/dist/usecases/ingest/video-pipeline.js.map +0 -1
  584. package/dist/usecases/ingest/video-skip-state.d.ts +0 -29
  585. package/dist/usecases/ingest/video-skip-state.js +0 -148
  586. package/dist/usecases/ingest/video-skip-state.js.map +0 -1
  587. package/dist/usecases/ingest/view-command.d.ts +0 -4
  588. package/dist/usecases/ingest/view-command.js +0 -67
  589. package/dist/usecases/ingest/view-command.js.map +0 -1
  590. package/dist/usecases/ingest/view-server.d.ts +0 -29
  591. package/dist/usecases/ingest/view-server.js +0 -364
  592. package/dist/usecases/ingest/view-server.js.map +0 -1
  593. package/dist/usecases/script/action-span.d.ts +0 -10
  594. package/dist/usecases/script/action-span.js +0 -42
  595. package/dist/usecases/script/action-span.js.map +0 -1
  596. package/dist/usecases/script/actions.d.ts +0 -3
  597. package/dist/usecases/script/actions.js +0 -184
  598. package/dist/usecases/script/actions.js.map +0 -1
  599. package/dist/usecases/script/actor.d.ts +0 -3
  600. package/dist/usecases/script/actor.js +0 -26
  601. package/dist/usecases/script/actor.js.map +0 -1
  602. package/dist/usecases/script/actors.d.ts +0 -3
  603. package/dist/usecases/script/actors.js +0 -25
  604. package/dist/usecases/script/actors.js.map +0 -1
  605. package/dist/usecases/script/add-actor.d.ts +0 -3
  606. package/dist/usecases/script/add-actor.js +0 -13
  607. package/dist/usecases/script/add-actor.js.map +0 -1
  608. package/dist/usecases/script/add-episode.d.ts +0 -3
  609. package/dist/usecases/script/add-episode.js +0 -9
  610. package/dist/usecases/script/add-episode.js.map +0 -1
  611. package/dist/usecases/script/add-location.d.ts +0 -3
  612. package/dist/usecases/script/add-location.js +0 -11
  613. package/dist/usecases/script/add-location.js.map +0 -1
  614. package/dist/usecases/script/add-prop.d.ts +0 -3
  615. package/dist/usecases/script/add-prop.js +0 -11
  616. package/dist/usecases/script/add-prop.js.map +0 -1
  617. package/dist/usecases/script/alias.d.ts +0 -3
  618. package/dist/usecases/script/alias.js +0 -39
  619. package/dist/usecases/script/alias.js.map +0 -1
  620. package/dist/usecases/script/assets.d.ts +0 -3
  621. package/dist/usecases/script/assets.js +0 -46
  622. package/dist/usecases/script/assets.js.map +0 -1
  623. package/dist/usecases/script/audit-assets.d.ts +0 -4
  624. package/dist/usecases/script/audit-assets.js +0 -37
  625. package/dist/usecases/script/audit-assets.js.map +0 -1
  626. package/dist/usecases/script/command-constraints.d.ts +0 -38
  627. package/dist/usecases/script/command-constraints.js +0 -143
  628. package/dist/usecases/script/command-constraints.js.map +0 -1
  629. package/dist/usecases/script/compose-creative-draft.d.ts +0 -3
  630. package/dist/usecases/script/compose-creative-draft.js +0 -106
  631. package/dist/usecases/script/compose-creative-draft.js.map +0 -1
  632. package/dist/usecases/script/context.d.ts +0 -3
  633. package/dist/usecases/script/context.js +0 -52
  634. package/dist/usecases/script/context.js.map +0 -1
  635. package/dist/usecases/script/create.d.ts +0 -3
  636. package/dist/usecases/script/create.js +0 -27
  637. package/dist/usecases/script/create.js.map +0 -1
  638. package/dist/usecases/script/delete.d.ts +0 -3
  639. package/dist/usecases/script/delete.js +0 -88
  640. package/dist/usecases/script/delete.js.map +0 -1
  641. package/dist/usecases/script/describe.d.ts +0 -3
  642. package/dist/usecases/script/describe.js +0 -32
  643. package/dist/usecases/script/describe.js.map +0 -1
  644. package/dist/usecases/script/dialogue.d.ts +0 -3
  645. package/dist/usecases/script/dialogue.js +0 -30
  646. package/dist/usecases/script/dialogue.js.map +0 -1
  647. package/dist/usecases/script/dispatch.d.ts +0 -3
  648. package/dist/usecases/script/dispatch.js +0 -10
  649. package/dist/usecases/script/dispatch.js.map +0 -1
  650. package/dist/usecases/script/do.d.ts +0 -3
  651. package/dist/usecases/script/do.js +0 -186
  652. package/dist/usecases/script/do.js.map +0 -1
  653. package/dist/usecases/script/emotion.d.ts +0 -3
  654. package/dist/usecases/script/emotion.js +0 -24
  655. package/dist/usecases/script/emotion.js.map +0 -1
  656. package/dist/usecases/script/episodes.d.ts +0 -3
  657. package/dist/usecases/script/episodes.js +0 -62
  658. package/dist/usecases/script/episodes.js.map +0 -1
  659. package/dist/usecases/script/export-authoring.d.ts +0 -4
  660. package/dist/usecases/script/export-authoring.js +0 -326
  661. package/dist/usecases/script/export-authoring.js.map +0 -1
  662. package/dist/usecases/script/extend.d.ts +0 -3
  663. package/dist/usecases/script/extend.js +0 -94
  664. package/dist/usecases/script/extend.js.map +0 -1
  665. package/dist/usecases/script/ids.d.ts +0 -3
  666. package/dist/usecases/script/ids.js +0 -148
  667. package/dist/usecases/script/ids.js.map +0 -1
  668. package/dist/usecases/script/importance.d.ts +0 -3
  669. package/dist/usecases/script/importance.js +0 -16
  670. package/dist/usecases/script/importance.js.map +0 -1
  671. package/dist/usecases/script/insert.d.ts +0 -3
  672. package/dist/usecases/script/insert.js +0 -127
  673. package/dist/usecases/script/insert.js.map +0 -1
  674. package/dist/usecases/script/issues.d.ts +0 -3
  675. package/dist/usecases/script/issues.js +0 -35
  676. package/dist/usecases/script/issues.js.map +0 -1
  677. package/dist/usecases/script/lib.d.ts +0 -152
  678. package/dist/usecases/script/lib.js +0 -1654
  679. package/dist/usecases/script/lib.js.map +0 -1
  680. package/dist/usecases/script/locations.d.ts +0 -3
  681. package/dist/usecases/script/locations.js +0 -25
  682. package/dist/usecases/script/locations.js.map +0 -1
  683. package/dist/usecases/script/merge.d.ts +0 -3
  684. package/dist/usecases/script/merge.js +0 -43
  685. package/dist/usecases/script/merge.js.map +0 -1
  686. package/dist/usecases/script/migrate.d.ts +0 -3
  687. package/dist/usecases/script/migrate.js +0 -210
  688. package/dist/usecases/script/migrate.js.map +0 -1
  689. package/dist/usecases/script/move.d.ts +0 -3
  690. package/dist/usecases/script/move.js +0 -50
  691. package/dist/usecases/script/move.js.map +0 -1
  692. package/dist/usecases/script/parenthetical.d.ts +0 -3
  693. package/dist/usecases/script/parenthetical.js +0 -52
  694. package/dist/usecases/script/parenthetical.js.map +0 -1
  695. package/dist/usecases/script/props.d.ts +0 -3
  696. package/dist/usecases/script/props.js +0 -25
  697. package/dist/usecases/script/props.js.map +0 -1
  698. package/dist/usecases/script/refs.d.ts +0 -3
  699. package/dist/usecases/script/refs.js +0 -111
  700. package/dist/usecases/script/refs.js.map +0 -1
  701. package/dist/usecases/script/rename.d.ts +0 -3
  702. package/dist/usecases/script/rename.js +0 -35
  703. package/dist/usecases/script/rename.js.map +0 -1
  704. package/dist/usecases/script/replace.d.ts +0 -3
  705. package/dist/usecases/script/replace.js +0 -33
  706. package/dist/usecases/script/replace.js.map +0 -1
  707. package/dist/usecases/script/review.d.ts +0 -3
  708. package/dist/usecases/script/review.js +0 -187
  709. package/dist/usecases/script/review.js.map +0 -1
  710. package/dist/usecases/script/role.d.ts +0 -3
  711. package/dist/usecases/script/role.js +0 -16
  712. package/dist/usecases/script/role.js.map +0 -1
  713. package/dist/usecases/script/scenes.d.ts +0 -3
  714. package/dist/usecases/script/scenes.js +0 -66
  715. package/dist/usecases/script/scenes.js.map +0 -1
  716. package/dist/usecases/script/script-patch.d.ts +0 -3
  717. package/dist/usecases/script/script-patch.js +0 -321
  718. package/dist/usecases/script/script-patch.js.map +0 -1
  719. package/dist/usecases/script/script-validate.d.ts +0 -3
  720. package/dist/usecases/script/script-validate.js +0 -27
  721. package/dist/usecases/script/script-validate.js.map +0 -1
  722. package/dist/usecases/script/session.d.ts +0 -62
  723. package/dist/usecases/script/session.js +0 -567
  724. package/dist/usecases/script/session.js.map +0 -1
  725. package/dist/usecases/script/split.d.ts +0 -3
  726. package/dist/usecases/script/split.js +0 -41
  727. package/dist/usecases/script/split.js.map +0 -1
  728. package/dist/usecases/script/state-add.d.ts +0 -3
  729. package/dist/usecases/script/state-add.js +0 -22
  730. package/dist/usecases/script/state-add.js.map +0 -1
  731. package/dist/usecases/script/state-delete.d.ts +0 -3
  732. package/dist/usecases/script/state-delete.js +0 -22
  733. package/dist/usecases/script/state-delete.js.map +0 -1
  734. package/dist/usecases/script/state-rename.d.ts +0 -3
  735. package/dist/usecases/script/state-rename.js +0 -16
  736. package/dist/usecases/script/state-rename.js.map +0 -1
  737. package/dist/usecases/script/states.d.ts +0 -3
  738. package/dist/usecases/script/states.js +0 -197
  739. package/dist/usecases/script/states.js.map +0 -1
  740. package/dist/usecases/script/summary.d.ts +0 -3
  741. package/dist/usecases/script/summary.js +0 -72
  742. package/dist/usecases/script/summary.js.map +0 -1
  743. package/dist/usecases/script/synopsis-generate.d.ts +0 -115
  744. package/dist/usecases/script/synopsis-generate.js +0 -776
  745. package/dist/usecases/script/synopsis-generate.js.map +0 -1
  746. package/dist/usecases/script/synopsis.d.ts +0 -3
  747. package/dist/usecases/script/synopsis.js +0 -45
  748. package/dist/usecases/script/synopsis.js.map +0 -1
  749. package/dist/usecases/script/timestamp-filter.d.ts +0 -4
  750. package/dist/usecases/script/timestamp-filter.js +0 -55
  751. package/dist/usecases/script/timestamp-filter.js.map +0 -1
  752. package/dist/usecases/script/timestamp.d.ts +0 -3
  753. package/dist/usecases/script/timestamp.js +0 -11
  754. package/dist/usecases/script/timestamp.js.map +0 -1
  755. package/dist/usecases/script/transition.d.ts +0 -3
  756. package/dist/usecases/script/transition.js +0 -23
  757. package/dist/usecases/script/transition.js.map +0 -1
  758. package/dist/usecases/script/type.d.ts +0 -3
  759. package/dist/usecases/script/type.js +0 -23
  760. package/dist/usecases/script/type.js.map +0 -1
  761. package/dist/usecases/script/v3/mutations.d.ts +0 -2
  762. package/dist/usecases/script/v3/mutations.js +0 -5
  763. package/dist/usecases/script/v3/mutations.js.map +0 -1
  764. package/dist/usecases/script/v4/mutations.d.ts +0 -2
  765. package/dist/usecases/script/v4/mutations.js +0 -6
  766. package/dist/usecases/script/v4/mutations.js.map +0 -1
  767. package/dist/usecases/script/v4/queries.d.ts +0 -15
  768. package/dist/usecases/script/v4/queries.js +0 -196
  769. package/dist/usecases/script/v4/queries.js.map +0 -1
  770. package/dist/usecases/script/working-copy.d.ts +0 -5
  771. package/dist/usecases/script/working-copy.js +0 -399
  772. package/dist/usecases/script/working-copy.js.map +0 -1
  773. package/dist/usecases/script/worldview.d.ts +0 -3
  774. package/dist/usecases/script/worldview.js +0 -17
  775. package/dist/usecases/script/worldview.js.map +0 -1
  776. package/dist/usecases/script/write-authoring.d.ts +0 -3
  777. package/dist/usecases/script/write-authoring.js +0 -263
  778. package/dist/usecases/script/write-authoring.js.map +0 -1
  779. package/dist/usecases/update.d.ts +0 -13
  780. package/dist/usecases/update.js +0 -128
  781. 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