@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,823 +0,0 @@
1
- import { ACTION_TYPE_SET, IMPORTANCE_TIER_SET, NON_ACTOR_SPEAKER_KIND_SET, ROLE_TYPE_SET, } from "../../script/v3/types.js";
2
- import { authoringError, parseBracketRecord, } from "../shared/bracket.js";
3
- export { parseBracketRecord } from "../shared/bracket.js";
4
- function emptyModifiers() {
5
- return { extend: {}, extendPresent: false, aliases: [], aliasesPresent: false, phase: "extend" };
6
- }
7
- function hasModifiers(modifiers) {
8
- return modifiers.extendPresent
9
- || modifiers.aliasesPresent
10
- || modifiers.prompt !== undefined;
11
- }
12
- function extensionOrUndefined(modifiers) {
13
- return modifiers.extendPresent ? modifiers.extend : undefined;
14
- }
15
- function isJsonValue(value) {
16
- if (value === null)
17
- return true;
18
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
19
- return true;
20
- if (Array.isArray(value))
21
- return value.every(isJsonValue);
22
- if (typeof value !== "object")
23
- return false;
24
- return Object.values(value).every(isJsonValue);
25
- }
26
- function canonicalJson(value) {
27
- if (Array.isArray(value))
28
- return value.map(canonicalJson);
29
- if (value !== null && typeof value === "object") {
30
- const result = {};
31
- for (const key of Object.keys(value).sort())
32
- result[key] = canonicalJson(value[key]);
33
- return result;
34
- }
35
- return value;
36
- }
37
- function isImportance(value) {
38
- return value === "featured" || value === "background";
39
- }
40
- function isRoleType(value) {
41
- return value === "主角" || value === "配角";
42
- }
43
- function isNonActorSpeakerKind(value) {
44
- return value === "system" || value === "broadcast" || value === "offscreen" || value === "group";
45
- }
46
- function isAssetKind(value) {
47
- return value === "actor" || value === "location" || value === "prop";
48
- }
49
- function parsePositiveInteger(raw, source, label, allowZero) {
50
- if (!/^\d+$/.test(raw)) {
51
- throw authoringError(`${label} must be an integer.`, source, raw || "<empty>", `Use ${allowZero ? "a non-negative" : "a positive"} integer.`);
52
- }
53
- const value = Number(raw);
54
- if (!Number.isSafeInteger(value) || (allowZero ? value < 0 : value < 1)) {
55
- throw authoringError(`${label} is out of range.`, source, raw, `Use ${allowZero ? "a non-negative" : "a positive"} safe integer.`);
56
- }
57
- return value;
58
- }
59
- function parseTag(raw, line) {
60
- const text = raw.trim();
61
- if (!text.startsWith("<"))
62
- return null;
63
- const source = { line, column: raw.indexOf("<") + 1 };
64
- const closingMatch = /^<\/([a-z-]+)>$/.exec(text);
65
- if (closingMatch)
66
- return { name: closingMatch[1], closing: true, attrs: new Map(), source };
67
- const openMatch = /^<([a-z-]+)(?: ([^>]+))?>$/.exec(text);
68
- if (!openMatch) {
69
- throw authoringError("Block tag syntax is invalid.", source, raw, "Use <name key=value> or </name> on its own line.");
70
- }
71
- const attrs = new Map();
72
- const attrText = openMatch[2] ?? "";
73
- if (attrText) {
74
- for (const token of attrText.split(" ")) {
75
- if (!token) {
76
- throw authoringError("Block attributes must use one space separators.", source, raw, "Use canonical key=value attributes separated by one space.");
77
- }
78
- const match = /^([a-z]+)=([A-Za-z0-9_./#:-]+)$/.exec(token);
79
- if (!match) {
80
- throw authoringError("Block attribute syntax is invalid.", source, token, "Use unquoted canonical key=value attributes.");
81
- }
82
- if (attrs.has(match[1])) {
83
- throw authoringError("Block attribute is duplicated.", source, match[1], "Keep exactly one value for each attribute.");
84
- }
85
- attrs.set(match[1], match[2]);
86
- }
87
- }
88
- return { name: openMatch[1], closing: false, attrs, source };
89
- }
90
- function assertAttributes(tag, required, optional = []) {
91
- const allowed = new Set([...required, ...optional]);
92
- const unknown = [...tag.attrs.keys()].filter((key) => !allowed.has(key));
93
- const missing = required.filter((key) => !tag.attrs.has(key));
94
- if (unknown.length > 0 || missing.length > 0) {
95
- throw authoringError(`Attributes for <${tag.name}> are invalid.`, tag.source, `missing=${missing.join(",") || "-"} unknown=${unknown.join(",") || "-"}`, `Use ${[...required, ...optional].map((key) => `${key}=...`).join(" ")}.`);
96
- }
97
- }
98
- function speakerFromSlot(raw, source) {
99
- if (!raw) {
100
- throw authoringError("Speaker is required.", source, "<empty>", "Use act_ID[/state_ID] or system|broadcast|offscreen|group[:label].");
101
- }
102
- const slash = raw.indexOf("/");
103
- const actorId = slash >= 0 ? raw.slice(0, slash) : raw;
104
- if (/^act_[A-Za-z0-9_-]+$/.test(actorId)) {
105
- if (slash < 0)
106
- return { actor_id: actorId };
107
- const stateId = raw.slice(slash + 1);
108
- if (!stateId || stateId.includes("/")) {
109
- throw authoringError("Actor speaker state is invalid.", source, raw, "Use act_ID/state_ID.");
110
- }
111
- return { actor_id: actorId, state_id: stateId };
112
- }
113
- const colon = raw.indexOf(":");
114
- const kind = colon >= 0 ? raw.slice(0, colon) : raw;
115
- if (!NON_ACTOR_SPEAKER_KIND_SET.has(kind) || !isNonActorSpeakerKind(kind)) {
116
- throw authoringError("Speaker kind is invalid.", source, raw, "Use an actor ID or system, broadcast, offscreen, or group.");
117
- }
118
- if (colon < 0)
119
- return { kind };
120
- return { kind, label: raw.slice(colon + 1) };
121
- }
122
- function actionFromRecord(record, modifiers) {
123
- const map = {
124
- act: "action",
125
- dlg: "dialogue",
126
- think: "inner_thought",
127
- trans: "transition",
128
- };
129
- const type = map[record.type];
130
- if (type === undefined || !ACTION_TYPE_SET.has(type)) {
131
- throw authoringError("Body record type is invalid.", record.source, record.type, "Use [act], [dlg], [think], or [trans].");
132
- }
133
- const action = { type, content: record.content };
134
- if (type === "dialogue" || type === "inner_thought") {
135
- if (record.slots.length < 1 || record.slots.length > 2) {
136
- throw authoringError("Speaker record slots are invalid.", record.source, record.slots.join("|"), `Use [${record.type}|speaker|emotion?].`);
137
- }
138
- action.speaker = speakerFromSlot(record.slots[0], record.source);
139
- if (record.slots.length === 2)
140
- action.emotion = record.slots[1];
141
- }
142
- else {
143
- if (record.slots.length > 1) {
144
- throw authoringError("Body record slots are invalid.", record.source, record.slots.join("|"), `Use [${record.type}|emotion?].`);
145
- }
146
- if (record.slots.length === 1)
147
- action.emotion = record.slots[0];
148
- }
149
- const extend = extensionOrUndefined(modifiers);
150
- if (extend !== undefined)
151
- action.extend = extend;
152
- if (modifiers.aliasesPresent) {
153
- throw authoringError("Alias cannot modify an action.", modifiers.source ?? record.source, modifiers.aliases.join(","), "Use [alias] only before an asset declaration.");
154
- }
155
- if (modifiers.prompt !== undefined)
156
- action.transition_prompt = modifiers.prompt;
157
- return action;
158
- }
159
- class Parser {
160
- lines;
161
- index = 0;
162
- constructor(text) {
163
- this.lines = text.replace(/\r\n?/g, "\n").split("\n");
164
- }
165
- parse() {
166
- this.skipBlank();
167
- const root = this.takeOpen("authoring");
168
- assertAttributes(root, ["version"]);
169
- if (root.attrs.get("version") !== "1") {
170
- throw authoringError("Authoring version is unsupported.", root.source, root.attrs.get("version") ?? "<missing>", "Use <authoring version=1>.");
171
- }
172
- const declarations = [];
173
- const targets = [];
174
- let seenTarget = false;
175
- let pending = emptyModifiers();
176
- while (true) {
177
- this.skipBlank();
178
- if (this.peekClose("authoring")) {
179
- if (hasModifiers(pending))
180
- this.throwDangling(pending);
181
- this.takeClose("authoring");
182
- break;
183
- }
184
- const next = this.peekSemantic();
185
- if (next === null)
186
- throw this.eofError("authoring");
187
- if (next.record?.type === "extensions" || next.record?.type === "extend") {
188
- pending = this.addModifier(pending, this.takeRecord());
189
- continue;
190
- }
191
- if (next.tag?.name === "create" && !next.tag.closing) {
192
- if (seenTarget)
193
- throw authoringError("<create> must precede every target.", next.tag.source, "<create>", "Move the single <create> block before the targets.");
194
- if (hasModifiers(pending))
195
- this.throwUnsupportedModifiers(pending, "create");
196
- declarations.push(...this.parseCreate());
197
- seenTarget = true;
198
- continue;
199
- }
200
- seenTarget = true;
201
- targets.push(this.parseTarget(pending));
202
- pending = emptyModifiers();
203
- }
204
- this.skipBlank();
205
- if (this.index < this.lines.length) {
206
- const source = { line: this.index + 1, column: 1 };
207
- throw authoringError("Content exists after </authoring>.", source, this.lines[this.index], "Remove content outside the root block.");
208
- }
209
- if (targets.length === 0) {
210
- throw authoringError("Authoring file has no target.", root.source, "<authoring>", "Add one or more homogeneous target blocks.");
211
- }
212
- const targetKind = targets[0].kind;
213
- const mixed = targets.find((target) => target.kind !== targetKind);
214
- if (mixed !== undefined) {
215
- throw authoringError("Authoring targets are not homogeneous.", mixed.source, mixed.kind, `Keep only ${targetKind} targets in this file.`);
216
- }
217
- if (targetKind === "script" && targets.length !== 1) {
218
- throw authoringError("A script authoring file has exactly one target.", targets[1].source, "second <script>", "Keep one <script> target.");
219
- }
220
- return { version: 1, declarations, targets, targetKind };
221
- }
222
- parseCreate() {
223
- const tag = this.takeOpen("create");
224
- assertAttributes(tag, []);
225
- const declarations = [];
226
- let pending = emptyModifiers();
227
- while (true) {
228
- this.skipBlank();
229
- if (this.peekClose("create")) {
230
- if (hasModifiers(pending))
231
- this.throwDangling(pending);
232
- this.takeClose("create");
233
- return declarations;
234
- }
235
- const record = this.takeRecord();
236
- if (record.type === "extensions" || record.type === "extend" || record.type === "aliases" || record.type === "alias" || record.type === "prompt") {
237
- pending = this.addModifier(pending, record);
238
- continue;
239
- }
240
- if (record.type === "actor") {
241
- if (record.slots.length < 3 || record.slots.length > 4) {
242
- throw authoringError("Actor declaration slots are invalid.", record.source, record.slots.join("|"), "Use [actor|id|name|importance|role?] description.");
243
- }
244
- const [actorId, actorName, importance, role] = record.slots;
245
- if (!actorId || !actorName || !importance || !IMPORTANCE_TIER_SET.has(importance) || !isImportance(importance)) {
246
- throw authoringError("Actor declaration is invalid.", record.source, record.slots.join("|"), "Provide id, name, and featured|background importance.");
247
- }
248
- if (role !== undefined && (!ROLE_TYPE_SET.has(role) || !isRoleType(role))) {
249
- throw authoringError("Actor role is invalid.", record.source, role, "Use 主角 or 配角, or omit the slot.");
250
- }
251
- const value = {
252
- actor_id: actorId,
253
- actor_name: actorName,
254
- importance,
255
- description: record.content,
256
- states: [],
257
- };
258
- if (role !== undefined)
259
- value.role_type = role;
260
- if (pending.aliasesPresent)
261
- value.aliases = [...pending.aliases];
262
- const extend = extensionOrUndefined(pending);
263
- if (extend !== undefined)
264
- value.extend = extend;
265
- if (pending.prompt !== undefined)
266
- this.throwUnsupportedModifiers(pending, "actor");
267
- declarations.push({ declarationKind: "actor", value, source: record.source });
268
- pending = emptyModifiers();
269
- continue;
270
- }
271
- if (record.type === "location" || record.type === "prop") {
272
- if (record.slots.length !== 3) {
273
- throw authoringError(`${record.type} declaration slots are invalid.`, record.source, record.slots.join("|"), `Use [${record.type}|id|name|importance] description.`);
274
- }
275
- const [id, name, importance] = record.slots;
276
- if (!id || !name || !importance || !IMPORTANCE_TIER_SET.has(importance) || !isImportance(importance)) {
277
- throw authoringError(`${record.type} declaration is invalid.`, record.source, record.slots.join("|"), "Provide id, name, and featured|background importance.");
278
- }
279
- if (pending.prompt !== undefined)
280
- this.throwUnsupportedModifiers(pending, record.type);
281
- const extend = extensionOrUndefined(pending);
282
- if (record.type === "location") {
283
- const value = {
284
- location_id: id,
285
- location_name: name,
286
- importance,
287
- description: record.content,
288
- states: [],
289
- };
290
- if (pending.aliasesPresent)
291
- value.aliases = [...pending.aliases];
292
- if (extend !== undefined)
293
- value.extend = extend;
294
- declarations.push({ declarationKind: "location", value, source: record.source });
295
- }
296
- else {
297
- const value = {
298
- prop_id: id,
299
- prop_name: name,
300
- importance,
301
- description: record.content,
302
- states: [],
303
- };
304
- if (pending.aliasesPresent)
305
- value.aliases = [...pending.aliases];
306
- if (extend !== undefined)
307
- value.extend = extend;
308
- declarations.push({ declarationKind: "prop", value, source: record.source });
309
- }
310
- pending = emptyModifiers();
311
- continue;
312
- }
313
- if (record.type === "state") {
314
- if (record.slots.length !== 3) {
315
- throw authoringError("State declaration slots are invalid.", record.source, record.slots.join("|"), "Use [state|kind:asset_id|state_id|state_name] description.");
316
- }
317
- if (pending.aliasesPresent || pending.prompt !== undefined)
318
- this.throwUnsupportedModifiers(pending, "state");
319
- const [owner, stateId, stateName] = record.slots;
320
- const ownerMatch = /^(actor|location|prop):(.+)$/.exec(owner ?? "");
321
- const ownerKind = ownerMatch?.[1] ?? "";
322
- if (!ownerMatch || !isAssetKind(ownerKind) || !stateId || !stateName) {
323
- throw authoringError("State declaration is invalid.", record.source, record.slots.join("|"), "Use a typed owner and non-empty state ID/name.");
324
- }
325
- const value = { state_id: stateId, state_name: stateName, description: record.content };
326
- const extend = extensionOrUndefined(pending);
327
- if (extend !== undefined)
328
- value.extend = extend;
329
- declarations.push({
330
- declarationKind: "state",
331
- ownerKind,
332
- ownerId: ownerMatch[2],
333
- value,
334
- source: record.source,
335
- });
336
- pending = emptyModifiers();
337
- continue;
338
- }
339
- throw authoringError("Record is not allowed in <create>.", record.source, record.type, "Use actor, location, prop, state, or a supported prefix modifier.");
340
- }
341
- }
342
- parseTarget(modifiers) {
343
- const tag = this.peekTag();
344
- if (tag === null || tag.closing) {
345
- const source = tag?.source ?? { line: this.index + 1, column: 1 };
346
- throw authoringError("Expected a target block.", source, this.lines[this.index] ?? "<eof>", "Add a supported target block.");
347
- }
348
- if (modifiers.aliasesPresent || modifiers.prompt !== undefined)
349
- this.throwUnsupportedModifiers(modifiers, tag.name);
350
- switch (tag.name) {
351
- case "script": return this.parseScript(modifiers);
352
- case "episode": return { kind: "episode", value: this.parseEpisode(modifiers), source: tag.source, ...(extensionOrUndefined(modifiers) ? { extend: extensionOrUndefined(modifiers) } : {}) };
353
- case "episode-span": return this.parseEpisodeSpan(modifiers);
354
- case "scene": {
355
- assertAttributes(tag, ["id", "parent"]);
356
- const parent = tag.attrs.get("parent");
357
- return { kind: "scene", parent, value: this.parseScene(modifiers, true), source: tag.source, ...(extensionOrUndefined(modifiers) ? { extend: extensionOrUndefined(modifiers) } : {}) };
358
- }
359
- case "scene-span": return this.parseSceneSpan(modifiers);
360
- case "action-span": return this.parseActionSpan(modifiers);
361
- default:
362
- throw authoringError("Unknown target block.", tag.source, tag.name, "Use script, episode, episode-span, scene, scene-span, or action-span.");
363
- }
364
- }
365
- parseScript(modifiers) {
366
- const tag = this.takeOpen("script");
367
- assertAttributes(tag, []);
368
- const recordOrder = ["title", "worldview", "worldview-raw", "style", "synopsis", "logline", "theme", "main-characters", "main-character"];
369
- const values = new Map();
370
- const mainCharacters = [];
371
- const episodes = [];
372
- let lastRecord = -1;
373
- let episodesStarted = false;
374
- let pending = emptyModifiers();
375
- while (true) {
376
- this.skipBlank();
377
- if (this.peekClose("script")) {
378
- if (hasModifiers(pending))
379
- this.throwDangling(pending);
380
- this.takeClose("script");
381
- break;
382
- }
383
- const next = this.peekSemantic();
384
- if (next?.record !== undefined) {
385
- const record = this.takeRecord();
386
- if (record.type === "extensions" || record.type === "extend" || record.type === "aliases" || record.type === "alias" || record.type === "prompt") {
387
- pending = this.addModifier(pending, record);
388
- continue;
389
- }
390
- if (hasModifiers(pending))
391
- this.throwUnsupportedModifiers(pending, record.type);
392
- const order = recordOrder.indexOf(record.type);
393
- const repeatedMainCharacter = record.type === "main-character";
394
- if (episodesStarted || order < 0 || order < lastRecord || (!repeatedMainCharacter && values.has(record.type))) {
395
- throw authoringError("Metadata record in <script> is invalid or out of order.", record.source, record.type, `Use ${recordOrder.join(", ")} in canonical order before episode blocks.`);
396
- }
397
- lastRecord = order;
398
- if (record.type === "main-characters") {
399
- if (record.slots.length !== 0 || record.content !== "") {
400
- throw authoringError("Main characters marker is invalid.", record.source, record.content, "Use [main-characters] with no slots or content.");
401
- }
402
- values.set(record.type, "");
403
- }
404
- else if (repeatedMainCharacter) {
405
- if (record.slots.length !== 2 || !record.slots[0] || !record.slots[1] || record.content !== "") {
406
- throw authoringError("Main character record is invalid.", record.source, record.slots.join("|"), "Use [main-character|name|role] with no content.");
407
- }
408
- mainCharacters.push({ name: record.slots[0], role: record.slots[1] });
409
- }
410
- else {
411
- if (record.slots.length !== 0) {
412
- throw authoringError("Script metadata record has unexpected slots.", record.source, record.slots.join("|"), `Use [${record.type}] content.`);
413
- }
414
- values.set(record.type, record.content);
415
- }
416
- continue;
417
- }
418
- if (next?.tag === undefined || next.tag.closing || next.tag.name !== "episode") {
419
- const source = next?.tag?.source ?? { line: this.index + 1, column: 1 };
420
- throw authoringError("Unexpected member in <script>.", source, this.lines[this.index] ?? "<eof>", "Use metadata records followed by <episode> blocks.");
421
- }
422
- episodesStarted = true;
423
- episodes.push(this.parseEpisode(pending));
424
- pending = emptyModifiers();
425
- }
426
- const title = this.requiredMetadata(values, "title", tag.source);
427
- const worldview = this.requiredMetadata(values, "worldview", tag.source);
428
- const style = this.requiredMetadata(values, "style", tag.source);
429
- const extend = extensionOrUndefined(modifiers);
430
- return {
431
- kind: "script",
432
- title,
433
- worldview,
434
- style,
435
- ...(values.get("worldview-raw") !== undefined ? { worldviewRaw: values.get("worldview-raw") } : {}),
436
- ...(values.get("synopsis") !== undefined ? { synopsis: values.get("synopsis") } : {}),
437
- ...(values.get("logline") !== undefined ? { logline: values.get("logline") } : {}),
438
- ...(values.get("theme") !== undefined ? { theme: values.get("theme") } : {}),
439
- ...(values.has("main-characters") || mainCharacters.length > 0 ? { mainCharacters } : {}),
440
- episodes,
441
- source: tag.source,
442
- ...(extend !== undefined ? { extend } : {}),
443
- };
444
- }
445
- parseEpisode(modifiers) {
446
- const tag = this.takeOpen("episode");
447
- assertAttributes(tag, ["id"]);
448
- if (modifiers.aliasesPresent || modifiers.prompt !== undefined)
449
- this.throwUnsupportedModifiers(modifiers, "episode");
450
- const metadata = this.parseMetadataAndChildren("episode", ["title", "synopsis"], "scene", (childModifiers) => this.parseScene(childModifiers, false));
451
- const episode = { episode_id: tag.attrs.get("id"), scenes: metadata.children };
452
- if (metadata.values.has("title"))
453
- episode.title = metadata.values.get("title");
454
- if (metadata.values.has("synopsis"))
455
- episode.synopsis = metadata.values.get("synopsis");
456
- const extend = extensionOrUndefined(modifiers);
457
- if (extend !== undefined)
458
- episode.extend = extend;
459
- return episode;
460
- }
461
- parseScene(modifiers, root) {
462
- const tag = this.takeOpen("scene");
463
- assertAttributes(tag, root ? ["id", "parent"] : ["id"]);
464
- if (modifiers.aliasesPresent || modifiers.prompt !== undefined)
465
- this.throwUnsupportedModifiers(modifiers, "scene");
466
- let environment;
467
- let location;
468
- const actors = [];
469
- const props = [];
470
- let phase = "environment";
471
- let actions;
472
- while (true) {
473
- this.skipBlank();
474
- if (this.peekClose("scene")) {
475
- this.takeClose("scene");
476
- break;
477
- }
478
- const next = this.peekSemantic();
479
- if (next?.tag?.name === "body" && !next.tag.closing) {
480
- if (phase === "body")
481
- throw authoringError("Scene has more than one body.", next.tag.source, "<body>", "Keep exactly one <body>.");
482
- phase = "body";
483
- actions = this.parseBody();
484
- continue;
485
- }
486
- if (next?.record === undefined) {
487
- const source = next?.tag?.source ?? { line: this.index + 1, column: 1 };
488
- throw authoringError("Only scene records and <body> are allowed here.", source, this.lines[this.index] ?? "<eof>", "Use environment, location, cast, prop, then body.");
489
- }
490
- const record = this.takeRecord();
491
- if (record.type === "extensions" || record.type === "extend" || record.type === "aliases" || record.type === "alias" || record.type === "prompt") {
492
- throw authoringError("Scene prefix modifier must directly precede <scene>.", record.source, record.type, "Move the modifier before the <scene> opening tag.");
493
- }
494
- if (record.type === "environment") {
495
- if (phase !== "environment" || environment !== undefined || record.slots.length > 2) {
496
- throw authoringError("Environment record is out of order or invalid.", record.source, record.slots.join("|"), "Place at most one [environment|space?|time?] first.");
497
- }
498
- environment = {};
499
- if (record.slots.length >= 1 && record.slots[0] !== "")
500
- environment.space = record.slots[0];
501
- if (record.slots.length >= 2 && record.slots[1] !== "")
502
- environment.time = record.slots[1];
503
- continue;
504
- }
505
- if (record.type === "location") {
506
- if (phase === "cast" || phase === "prop" || phase === "body" || location !== undefined || record.slots.length > 2) {
507
- throw authoringError("Location record is out of order or invalid.", record.source, record.slots.join("|"), "Place exactly one [location|id?|state?] before cast.");
508
- }
509
- phase = "location";
510
- const id = record.slots[0];
511
- if (id === undefined || id === "")
512
- location = null;
513
- else
514
- location = record.slots.length === 2 ? { location_id: id, state_id: record.slots[1] } : { location_id: id };
515
- continue;
516
- }
517
- if (record.type === "cast") {
518
- if (location === undefined || phase === "prop" || phase === "body" || record.slots.length < 1 || record.slots.length > 2 || !record.slots[0]) {
519
- throw authoringError("Cast record is out of order or invalid.", record.source, record.slots.join("|"), "Place [cast|actor_id|state_id?] after location and before props.");
520
- }
521
- phase = "cast";
522
- actors.push(record.slots.length === 2 ? { actor_id: record.slots[0], state_id: record.slots[1] } : { actor_id: record.slots[0] });
523
- continue;
524
- }
525
- if (record.type === "prop") {
526
- if (location === undefined || phase === "body" || record.slots.length < 1 || record.slots.length > 2 || !record.slots[0]) {
527
- throw authoringError("Prop record is out of order or invalid.", record.source, record.slots.join("|"), "Place [prop|prop_id|state_id?] after cast and before body.");
528
- }
529
- phase = "prop";
530
- props.push(record.slots.length === 2 ? { prop_id: record.slots[0], state_id: record.slots[1] } : { prop_id: record.slots[0] });
531
- continue;
532
- }
533
- throw authoringError("Record is not allowed in a scene header.", record.source, record.type, "Use environment, location, cast, prop, or body records.");
534
- }
535
- if (location === undefined)
536
- throw authoringError("Scene location record is missing.", tag.source, `<scene id=${tag.attrs.get("id")}>`, "Add [location] or [location|loc_ID|state_ID].");
537
- if (actions === undefined)
538
- throw authoringError("Scene body is missing.", tag.source, `<scene id=${tag.attrs.get("id")}>`, "Add one <body> block.");
539
- const scene = { scene_id: tag.attrs.get("id"), location, actors, props, actions };
540
- if (environment !== undefined)
541
- scene.environment = environment;
542
- const extend = extensionOrUndefined(modifiers);
543
- if (extend !== undefined)
544
- scene.extend = extend;
545
- return scene;
546
- }
547
- parseBody() {
548
- const tag = this.takeOpen("body");
549
- assertAttributes(tag, []);
550
- const actions = [];
551
- let pending = emptyModifiers();
552
- while (true) {
553
- this.skipBlank();
554
- if (this.peekClose("body")) {
555
- if (hasModifiers(pending))
556
- this.throwDangling(pending);
557
- this.takeClose("body");
558
- return actions;
559
- }
560
- const record = this.takeRecord();
561
- if (record.type === "extensions" || record.type === "extend" || record.type === "aliases" || record.type === "prompt" || record.type === "alias") {
562
- pending = this.addModifier(pending, record);
563
- continue;
564
- }
565
- actions.push(actionFromRecord(record, pending));
566
- pending = emptyModifiers();
567
- }
568
- }
569
- parseEpisodeSpan(modifiers) {
570
- const tag = this.takeOpen("episode-span");
571
- assertAttributes(tag, ["from", "through"]);
572
- const episodes = this.parseOnlyChildren("episode-span", "episode", (childModifiers) => this.parseEpisode(childModifiers));
573
- const extend = extensionOrUndefined(modifiers);
574
- return {
575
- kind: "episode-span",
576
- from: tag.attrs.get("from"),
577
- through: tag.attrs.get("through"),
578
- episodes,
579
- source: tag.source,
580
- ...(extend !== undefined ? { extend } : {}),
581
- };
582
- }
583
- parseSceneSpan(modifiers) {
584
- const tag = this.takeOpen("scene-span");
585
- assertAttributes(tag, ["parent", "from", "through"]);
586
- const scenes = this.parseOnlyChildren("scene-span", "scene", (childModifiers) => this.parseScene(childModifiers, false));
587
- const extend = extensionOrUndefined(modifiers);
588
- return {
589
- kind: "scene-span",
590
- parent: tag.attrs.get("parent"),
591
- from: tag.attrs.get("from"),
592
- through: tag.attrs.get("through"),
593
- scenes,
594
- source: tag.source,
595
- ...(extend !== undefined ? { extend } : {}),
596
- };
597
- }
598
- parseActionSpan(modifiers) {
599
- const tag = this.takeOpen("action-span");
600
- assertAttributes(tag, ["parent", "from", "through"]);
601
- this.skipBlank();
602
- const actions = this.parseBody();
603
- this.skipBlank();
604
- this.takeClose("action-span");
605
- const extend = extensionOrUndefined(modifiers);
606
- return {
607
- kind: "action-span",
608
- parent: tag.attrs.get("parent"),
609
- from: parsePositiveInteger(tag.attrs.get("from"), tag.source, "action-span from", true),
610
- through: parsePositiveInteger(tag.attrs.get("through"), tag.source, "action-span through", true),
611
- actions,
612
- source: tag.source,
613
- ...(extend !== undefined ? { extend } : {}),
614
- };
615
- }
616
- parseMetadataAndChildren(block, recordOrder, childName, parseChild) {
617
- const values = new Map();
618
- const children = [];
619
- let lastRecord = -1;
620
- let childrenStarted = false;
621
- let pending = emptyModifiers();
622
- while (true) {
623
- this.skipBlank();
624
- if (this.peekClose(block)) {
625
- if (hasModifiers(pending))
626
- this.throwDangling(pending);
627
- this.takeClose(block);
628
- return { values, children };
629
- }
630
- const next = this.peekSemantic();
631
- if (next?.record !== undefined) {
632
- const record = this.takeRecord();
633
- if (record.type === "extensions" || record.type === "extend" || record.type === "aliases" || record.type === "alias" || record.type === "prompt") {
634
- pending = this.addModifier(pending, record);
635
- continue;
636
- }
637
- if (hasModifiers(pending))
638
- this.throwUnsupportedModifiers(pending, record.type);
639
- const order = recordOrder.indexOf(record.type);
640
- if (childrenStarted || order < 0 || order < lastRecord || values.has(record.type) || record.slots.length !== 0) {
641
- throw authoringError(`Metadata record in <${block}> is invalid or out of order.`, record.source, record.type, `Use each of ${recordOrder.join(", ")} at most once in canonical order before child blocks.`);
642
- }
643
- lastRecord = order;
644
- values.set(record.type, record.content);
645
- continue;
646
- }
647
- const tag = next?.tag;
648
- if (tag === undefined || tag.closing || tag.name !== childName) {
649
- const source = tag?.source ?? { line: this.index + 1, column: 1 };
650
- throw authoringError(`Unexpected member in <${block}>.`, source, this.lines[this.index] ?? "<eof>", `Use metadata records followed by <${childName}> blocks.`);
651
- }
652
- childrenStarted = true;
653
- children.push(parseChild(pending));
654
- pending = emptyModifiers();
655
- }
656
- }
657
- parseOnlyChildren(block, childName, parseChild) {
658
- const children = [];
659
- let pending = emptyModifiers();
660
- while (true) {
661
- this.skipBlank();
662
- if (this.peekClose(block)) {
663
- if (hasModifiers(pending))
664
- this.throwDangling(pending);
665
- this.takeClose(block);
666
- return children;
667
- }
668
- const next = this.peekSemantic();
669
- if (next?.record?.type === "extensions" || next?.record?.type === "extend") {
670
- pending = this.addModifier(pending, this.takeRecord());
671
- continue;
672
- }
673
- if (next?.tag === undefined || next.tag.closing || next.tag.name !== childName) {
674
- const source = next?.tag?.source ?? next?.record?.source ?? { line: this.index + 1, column: 1 };
675
- throw authoringError(`Only <${childName}> children are allowed in <${block}>.`, source, this.lines[this.index] ?? "<eof>", `Add complete <${childName}> blocks.`);
676
- }
677
- children.push(parseChild(pending));
678
- pending = emptyModifiers();
679
- }
680
- }
681
- addModifier(modifiers, record) {
682
- const next = {
683
- extend: { ...modifiers.extend },
684
- extendPresent: modifiers.extendPresent,
685
- aliases: [...modifiers.aliases],
686
- aliasesPresent: modifiers.aliasesPresent,
687
- phase: modifiers.phase,
688
- ...(modifiers.prompt !== undefined ? { prompt: modifiers.prompt } : {}),
689
- source: modifiers.source ?? record.source,
690
- };
691
- if (record.type === "extensions") {
692
- if (next.phase !== "extend" || next.extendPresent || record.slots.length !== 0 || record.content !== "") {
693
- throw authoringError("Extensions marker is invalid or out of order.", record.source, record.content || "<empty>", "Use one [extensions] marker before extension records.");
694
- }
695
- next.extendPresent = true;
696
- return next;
697
- }
698
- if (record.type === "extend") {
699
- if (next.phase !== "extend" || record.slots.length !== 1 || !record.slots[0]) {
700
- throw authoringError("Extend modifier is invalid or out of order.", record.source, record.slots.join("|"), "Place unique [extend|key] records first.");
701
- }
702
- const key = record.slots[0];
703
- if (Object.hasOwn(next.extend, key)) {
704
- throw authoringError("Extend key is duplicated.", record.source, key, "Keep one value for each extension key.");
705
- }
706
- let parsed;
707
- try {
708
- parsed = JSON.parse(record.content);
709
- }
710
- catch {
711
- throw authoringError("Extension value is not valid JSON.", record.source, record.content, "Use one canonical JSON value.");
712
- }
713
- if (!isJsonValue(parsed)) {
714
- throw authoringError("Extension value is not JSON-compatible.", record.source, record.content, "Use string, number, boolean, null, array, or object.");
715
- }
716
- next.extendPresent = true;
717
- next.extend[key] = canonicalJson(parsed);
718
- return next;
719
- }
720
- if (record.type === "aliases") {
721
- if (next.phase !== "extend" || next.aliasesPresent || record.slots.length !== 0 || record.content !== "") {
722
- throw authoringError("Aliases marker is invalid or out of order.", record.source, record.content || "<empty>", "Use one [aliases] marker after extensions and before alias records.");
723
- }
724
- next.phase = "alias";
725
- next.aliasesPresent = true;
726
- return next;
727
- }
728
- if (record.type === "alias") {
729
- if (next.phase === "prompt" || record.slots.length !== 0 || !record.content) {
730
- throw authoringError("Alias modifier is invalid or out of order.", record.source, record.content || "<empty>", "Place non-empty [alias] records after extensions and before prompt.");
731
- }
732
- next.phase = "alias";
733
- next.aliasesPresent = true;
734
- if (next.aliases.includes(record.content)) {
735
- throw authoringError("Alias is duplicated.", record.source, record.content, "Keep each alias once.");
736
- }
737
- next.aliases.push(record.content);
738
- return next;
739
- }
740
- if (record.type === "prompt") {
741
- if (next.prompt !== undefined || record.slots.length !== 3 || record.slots.some((slot) => !slot)) {
742
- throw authoringError("Prompt modifier is invalid.", record.source, record.slots.join("|"), "Use one [prompt|target|process|contrast] after extensions and aliases.");
743
- }
744
- if (!/^(?:actor:act_|location:loc_|prop:prp_)[A-Za-z0-9_-]+$/.test(record.slots[0])) {
745
- throw authoringError("Prompt target is invalid.", record.source, record.slots[0], "Use actor:act_ID, location:loc_ID, or prop:prp_ID.");
746
- }
747
- next.phase = "prompt";
748
- next.prompt = { target: record.slots[0], process: record.slots[1], contrast: record.slots[2] };
749
- return next;
750
- }
751
- throw authoringError("Unknown prefix modifier.", record.source, record.type, "Use extend, alias, or prompt.");
752
- }
753
- requiredMetadata(values, key, source) {
754
- const value = values.get(key);
755
- if (value === undefined)
756
- throw authoringError(`Script ${key} record is missing.`, source, `<script>`, `Add [${key}] in canonical metadata order.`);
757
- return value;
758
- }
759
- peekSemantic() {
760
- this.skipBlank();
761
- if (this.index >= this.lines.length)
762
- return null;
763
- const raw = this.lines[this.index];
764
- const tag = parseTag(raw, this.index + 1);
765
- if (tag !== null)
766
- return { tag };
767
- if (raw.trimStart().startsWith("["))
768
- return { record: parseBracketRecord(raw, this.index + 1) };
769
- const source = { line: this.index + 1, column: Math.max(1, raw.search(/\S/) + 1) };
770
- throw authoringError("Semantic line is neither a tag nor a bracket record.", source, raw, "Use only known tags, bracket records, or blank lines.");
771
- }
772
- peekTag() {
773
- return this.peekSemantic()?.tag ?? null;
774
- }
775
- takeRecord() {
776
- const item = this.peekSemantic();
777
- if (item?.record === undefined) {
778
- const source = item?.tag?.source ?? { line: this.index + 1, column: 1 };
779
- throw authoringError("Expected a bracket record.", source, this.lines[this.index] ?? "<eof>", "Use the record required at this position.");
780
- }
781
- this.index += 1;
782
- return item.record;
783
- }
784
- takeOpen(name) {
785
- const tag = this.peekTag();
786
- if (tag === null || tag.closing || tag.name !== name) {
787
- const source = tag?.source ?? { line: this.index + 1, column: 1 };
788
- throw authoringError(`Expected <${name}>.`, source, this.lines[this.index] ?? "<eof>", `Open <${name}> here.`);
789
- }
790
- this.index += 1;
791
- return tag;
792
- }
793
- takeClose(name) {
794
- const tag = this.peekTag();
795
- if (tag === null || !tag.closing || tag.name !== name) {
796
- const source = tag?.source ?? { line: this.index + 1, column: 1 };
797
- throw authoringError(`Expected </${name}>.`, source, this.lines[this.index] ?? "<eof>", `Close the current <${name}> block.`);
798
- }
799
- this.index += 1;
800
- return tag;
801
- }
802
- peekClose(name) {
803
- const tag = this.peekTag();
804
- return tag !== null && tag.closing && tag.name === name;
805
- }
806
- skipBlank() {
807
- while (this.index < this.lines.length && this.lines[this.index].trim() === "")
808
- this.index += 1;
809
- }
810
- eofError(block) {
811
- return authoringError(`Unexpected end of file inside <${block}>.`, { line: this.lines.length, column: 1 }, "<eof>", `Add </${block}>.`);
812
- }
813
- throwDangling(modifiers) {
814
- throw authoringError("Prefix modifier has no following node.", modifiers.source ?? { line: this.index + 1, column: 1 }, "dangling modifier", "Move it directly before a supported node.");
815
- }
816
- throwUnsupportedModifiers(modifiers, node) {
817
- throw authoringError("Prefix modifier does not apply to this node.", modifiers.source ?? { line: this.index + 1, column: 1 }, node, "Remove the unsupported modifier or move it before a supported node.");
818
- }
819
- }
820
- export function parseAuthoring(text) {
821
- return new Parser(text).parse();
822
- }
823
- //# sourceMappingURL=parser.js.map