@lingjingai/scriptctl 0.63.13 → 0.63.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/changes/0.63.14.md +7 -0
- package/changes/0.63.15.md +15 -0
- package/dist/bin.js +1 -20812
- package/dist/chunk-3LPIMYYI.js +823 -0
- package/dist/cli.d.ts +214 -5
- package/dist/cli.js +1 -187
- package/dist/review-agent.js +56 -3593
- package/package.json +12 -5
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js.map +0 -7
- package/dist/cli/register-authoring.d.ts +0 -4
- package/dist/cli/register-authoring.js +0 -35
- package/dist/cli/register-authoring.js.map +0 -1
- package/dist/cli/register-review.d.ts +0 -3
- package/dist/cli/register-review.js +0 -20
- package/dist/cli/register-review.js.map +0 -1
- package/dist/cli/register-script.d.ts +0 -3
- package/dist/cli/register-script.js +0 -297
- package/dist/cli/register-script.js.map +0 -1
- package/dist/cli/register-tools.d.ts +0 -3
- package/dist/cli/register-tools.js +0 -23
- package/dist/cli/register-tools.js.map +0 -1
- package/dist/cli/register-workflows.d.ts +0 -4
- package/dist/cli/register-workflows.js +0 -108
- package/dist/cli/register-workflows.js.map +0 -1
- package/dist/cli/registry.d.ts +0 -14
- package/dist/cli/registry.js +0 -65
- package/dist/cli/registry.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/common.d.ts +0 -93
- package/dist/common.js +0 -240
- package/dist/common.js.map +0 -1
- package/dist/domain/authoring/apply.d.ts +0 -1
- package/dist/domain/authoring/apply.js +0 -2
- package/dist/domain/authoring/apply.js.map +0 -1
- package/dist/domain/authoring/export.d.ts +0 -1
- package/dist/domain/authoring/export.js +0 -2
- package/dist/domain/authoring/export.js.map +0 -1
- package/dist/domain/authoring/parser.d.ts +0 -2
- package/dist/domain/authoring/parser.js +0 -3
- package/dist/domain/authoring/parser.js.map +0 -1
- package/dist/domain/authoring/serializer.d.ts +0 -1
- package/dist/domain/authoring/serializer.js +0 -2
- package/dist/domain/authoring/serializer.js.map +0 -1
- package/dist/domain/authoring/shared/bracket.d.ts +0 -4
- package/dist/domain/authoring/shared/bracket.js +0 -95
- package/dist/domain/authoring/shared/bracket.js.map +0 -1
- package/dist/domain/authoring/shared/types.d.ts +0 -12
- package/dist/domain/authoring/shared/types.js +0 -2
- package/dist/domain/authoring/shared/types.js.map +0 -1
- package/dist/domain/authoring/types.d.ts +0 -2
- package/dist/domain/authoring/types.js +0 -3
- package/dist/domain/authoring/types.js.map +0 -1
- package/dist/domain/authoring/v3/apply.d.ts +0 -33
- package/dist/domain/authoring/v3/apply.js +0 -784
- package/dist/domain/authoring/v3/apply.js.map +0 -1
- package/dist/domain/authoring/v3/export.d.ts +0 -7
- package/dist/domain/authoring/v3/export.js +0 -85
- package/dist/domain/authoring/v3/export.js.map +0 -1
- package/dist/domain/authoring/v3/parser.d.ts +0 -3
- package/dist/domain/authoring/v3/parser.js +0 -823
- package/dist/domain/authoring/v3/parser.js.map +0 -1
- package/dist/domain/authoring/v3/serializer.d.ts +0 -2
- package/dist/domain/authoring/v3/serializer.js +0 -244
- package/dist/domain/authoring/v3/serializer.js.map +0 -1
- package/dist/domain/authoring/v3/types.d.ts +0 -76
- package/dist/domain/authoring/v3/types.js +0 -2
- package/dist/domain/authoring/v3/types.js.map +0 -1
- package/dist/domain/authoring/v4/apply.d.ts +0 -40
- package/dist/domain/authoring/v4/apply.js +0 -451
- package/dist/domain/authoring/v4/apply.js.map +0 -1
- package/dist/domain/authoring/v4/parser.d.ts +0 -2
- package/dist/domain/authoring/v4/parser.js +0 -729
- package/dist/domain/authoring/v4/parser.js.map +0 -1
- package/dist/domain/authoring/v4/serializer.d.ts +0 -6
- package/dist/domain/authoring/v4/serializer.js +0 -280
- package/dist/domain/authoring/v4/serializer.js.map +0 -1
- package/dist/domain/authoring/v4/types.d.ts +0 -50
- package/dist/domain/authoring/v4/types.js +0 -2
- package/dist/domain/authoring/v4/types.js.map +0 -1
- package/dist/domain/creative-draft/compose.d.ts +0 -18
- package/dist/domain/creative-draft/compose.js +0 -448
- package/dist/domain/creative-draft/compose.js.map +0 -1
- package/dist/domain/ingest/apply-plan.d.ts +0 -23
- package/dist/domain/ingest/apply-plan.js +0 -210
- package/dist/domain/ingest/apply-plan.js.map +0 -1
- package/dist/domain/ingest/assembler.d.ts +0 -65
- package/dist/domain/ingest/assembler.js +0 -263
- package/dist/domain/ingest/assembler.js.map +0 -1
- package/dist/domain/ingest/asset-audit.d.ts +0 -50
- package/dist/domain/ingest/asset-audit.js +0 -196
- package/dist/domain/ingest/asset-audit.js.map +0 -1
- package/dist/domain/ingest/chunker.d.ts +0 -9
- package/dist/domain/ingest/chunker.js +0 -49
- package/dist/domain/ingest/chunker.js.map +0 -1
- package/dist/domain/ingest/environment.d.ts +0 -3
- package/dist/domain/ingest/environment.js +0 -32
- package/dist/domain/ingest/environment.js.map +0 -1
- package/dist/domain/ingest/evidence.d.ts +0 -5
- package/dist/domain/ingest/evidence.js +0 -66
- package/dist/domain/ingest/evidence.js.map +0 -1
- package/dist/domain/ingest/govern.d.ts +0 -3
- package/dist/domain/ingest/govern.js +0 -157
- package/dist/domain/ingest/govern.js.map +0 -1
- package/dist/domain/ingest/jsonl-parser.d.ts +0 -6
- package/dist/domain/ingest/jsonl-parser.js +0 -204
- package/dist/domain/ingest/jsonl-parser.js.map +0 -1
- package/dist/domain/ingest/markdown-parser.d.ts +0 -6
- package/dist/domain/ingest/markdown-parser.js +0 -187
- package/dist/domain/ingest/markdown-parser.js.map +0 -1
- package/dist/domain/ingest/production-validation.d.ts +0 -8
- package/dist/domain/ingest/production-validation.js +0 -37
- package/dist/domain/ingest/production-validation.js.map +0 -1
- package/dist/domain/ingest/records.d.ts +0 -72
- package/dist/domain/ingest/records.js +0 -10
- package/dist/domain/ingest/records.js.map +0 -1
- package/dist/domain/ingest/renumber.d.ts +0 -14
- package/dist/domain/ingest/renumber.js +0 -130
- package/dist/domain/ingest/renumber.js.map +0 -1
- package/dist/domain/ingest/serial-context.d.ts +0 -93
- package/dist/domain/ingest/serial-context.js +0 -355
- package/dist/domain/ingest/serial-context.js.map +0 -1
- package/dist/domain/ingest/state-identity.d.ts +0 -2
- package/dist/domain/ingest/state-identity.js +0 -3
- package/dist/domain/ingest/state-identity.js.map +0 -1
- package/dist/domain/ingest/state-reconcile.d.ts +0 -12
- package/dist/domain/ingest/state-reconcile.js +0 -92
- package/dist/domain/ingest/state-reconcile.js.map +0 -1
- package/dist/domain/ingest/validation.d.ts +0 -1
- package/dist/domain/ingest/validation.js +0 -2
- package/dist/domain/ingest/validation.js.map +0 -1
- package/dist/domain/ingest/video-apply.d.ts +0 -4
- package/dist/domain/ingest/video-apply.js +0 -128
- package/dist/domain/ingest/video-apply.js.map +0 -1
- package/dist/domain/ingest/video-context.d.ts +0 -64
- package/dist/domain/ingest/video-context.js +0 -480
- package/dist/domain/ingest/video-context.js.map +0 -1
- package/dist/domain/ingest/video-records.d.ts +0 -57
- package/dist/domain/ingest/video-records.js +0 -9
- package/dist/domain/ingest/video-records.js.map +0 -1
- package/dist/domain/ingest/video-serial-md.d.ts +0 -81
- package/dist/domain/ingest/video-serial-md.js +0 -297
- package/dist/domain/ingest/video-serial-md.js.map +0 -1
- package/dist/domain/ingest/video-source-evolution.d.ts +0 -25
- package/dist/domain/ingest/video-source-evolution.js +0 -40
- package/dist/domain/ingest/video-source-evolution.js.map +0 -1
- package/dist/domain/ingest/video-state-evidence.d.ts +0 -66
- package/dist/domain/ingest/video-state-evidence.js +0 -385
- package/dist/domain/ingest/video-state-evidence.js.map +0 -1
- package/dist/domain/ingest/video-timestamp.d.ts +0 -8
- package/dist/domain/ingest/video-timestamp.js +0 -26
- package/dist/domain/ingest/video-timestamp.js.map +0 -1
- package/dist/domain/loom/checkpointer.d.ts +0 -3
- package/dist/domain/loom/checkpointer.js +0 -30
- package/dist/domain/loom/checkpointer.js.map +0 -1
- package/dist/domain/loom/index.d.ts +0 -45
- package/dist/domain/loom/index.js +0 -277
- package/dist/domain/loom/index.js.map +0 -1
- package/dist/domain/loom/types.d.ts +0 -101
- package/dist/domain/loom/types.js +0 -2
- package/dist/domain/loom/types.js.map +0 -1
- package/dist/domain/script/address.d.ts +0 -1
- package/dist/domain/script/address.js +0 -2
- package/dist/domain/script/address.js.map +0 -1
- package/dist/domain/script/dispatch.d.ts +0 -18
- package/dist/domain/script/dispatch.js +0 -55
- package/dist/domain/script/dispatch.js.map +0 -1
- package/dist/domain/script/lookups.d.ts +0 -1
- package/dist/domain/script/lookups.js +0 -2
- package/dist/domain/script/lookups.js.map +0 -1
- package/dist/domain/script/migrations/registry.d.ts +0 -4
- package/dist/domain/script/migrations/registry.js +0 -76
- package/dist/domain/script/migrations/registry.js.map +0 -1
- package/dist/domain/script/migrations/types.d.ts +0 -17
- package/dist/domain/script/migrations/types.js +0 -2
- package/dist/domain/script/migrations/types.js.map +0 -1
- package/dist/domain/script/migrations/v3-to-v4.d.ts +0 -3
- package/dist/domain/script/migrations/v3-to-v4.js +0 -57
- package/dist/domain/script/migrations/v3-to-v4.js.map +0 -1
- package/dist/domain/script/names.d.ts +0 -1
- package/dist/domain/script/names.js +0 -2
- package/dist/domain/script/names.js.map +0 -1
- package/dist/domain/script/parse.d.ts +0 -1
- package/dist/domain/script/parse.js +0 -2
- package/dist/domain/script/parse.js.map +0 -1
- package/dist/domain/script/patch/apply.d.ts +0 -1
- package/dist/domain/script/patch/apply.js +0 -2
- package/dist/domain/script/patch/apply.js.map +0 -1
- package/dist/domain/script/patch/helpers.d.ts +0 -1
- package/dist/domain/script/patch/helpers.js +0 -2
- package/dist/domain/script/patch/helpers.js.map +0 -1
- package/dist/domain/script/patch/inline-speaker.d.ts +0 -1
- package/dist/domain/script/patch/inline-speaker.js +0 -2
- package/dist/domain/script/patch/inline-speaker.js.map +0 -1
- package/dist/domain/script/patch/ops-action.d.ts +0 -1
- package/dist/domain/script/patch/ops-action.js +0 -2
- package/dist/domain/script/patch/ops-action.js.map +0 -1
- package/dist/domain/script/patch/ops-asset.d.ts +0 -1
- package/dist/domain/script/patch/ops-asset.js +0 -2
- package/dist/domain/script/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/patch/ops-dialogue.d.ts +0 -1
- package/dist/domain/script/patch/ops-dialogue.js +0 -2
- package/dist/domain/script/patch/ops-dialogue.js.map +0 -1
- package/dist/domain/script/patch/ops-extend.d.ts +0 -1
- package/dist/domain/script/patch/ops-extend.js +0 -2
- package/dist/domain/script/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/patch/ops-meta.d.ts +0 -1
- package/dist/domain/script/patch/ops-meta.js +0 -2
- package/dist/domain/script/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/patch/ops-scene.d.ts +0 -1
- package/dist/domain/script/patch/ops-scene.js +0 -2
- package/dist/domain/script/patch/ops-scene.js.map +0 -1
- package/dist/domain/script/patch/ops-state.d.ts +0 -1
- package/dist/domain/script/patch/ops-state.js +0 -2
- package/dist/domain/script/patch/ops-state.js.map +0 -1
- package/dist/domain/script/patch/registry.d.ts +0 -1
- package/dist/domain/script/patch/registry.js +0 -2
- package/dist/domain/script/patch/registry.js.map +0 -1
- package/dist/domain/script/patch/types.d.ts +0 -1
- package/dist/domain/script/patch/types.js +0 -2
- package/dist/domain/script/patch/types.js.map +0 -1
- package/dist/domain/script/refs.d.ts +0 -1
- package/dist/domain/script/refs.js +0 -2
- package/dist/domain/script/refs.js.map +0 -1
- package/dist/domain/script/scene-refs.d.ts +0 -1
- package/dist/domain/script/scene-refs.js +0 -2
- package/dist/domain/script/scene-refs.js.map +0 -1
- package/dist/domain/script/schema.d.ts +0 -1
- package/dist/domain/script/schema.js +0 -2
- package/dist/domain/script/schema.js.map +0 -1
- package/dist/domain/script/selector.d.ts +0 -1
- package/dist/domain/script/selector.js +0 -2
- package/dist/domain/script/selector.js.map +0 -1
- package/dist/domain/script/shared/regex.d.ts +0 -2
- package/dist/domain/script/shared/regex.js +0 -7
- package/dist/domain/script/shared/regex.js.map +0 -1
- package/dist/domain/script/shared/types.d.ts +0 -1
- package/dist/domain/script/shared/types.js +0 -5
- package/dist/domain/script/shared/types.js.map +0 -1
- package/dist/domain/script/shared/validation.d.ts +0 -1
- package/dist/domain/script/shared/validation.js +0 -3
- package/dist/domain/script/shared/validation.js.map +0 -1
- package/dist/domain/script/shared.d.ts +0 -15
- package/dist/domain/script/shared.js +0 -35
- package/dist/domain/script/shared.js.map +0 -1
- package/dist/domain/script/text-util.d.ts +0 -7
- package/dist/domain/script/text-util.js +0 -95
- package/dist/domain/script/text-util.js.map +0 -1
- package/dist/domain/script/timestamp.d.ts +0 -1
- package/dist/domain/script/timestamp.js +0 -3
- package/dist/domain/script/timestamp.js.map +0 -1
- package/dist/domain/script/types.d.ts +0 -1
- package/dist/domain/script/types.js +0 -2
- package/dist/domain/script/types.js.map +0 -1
- package/dist/domain/script/v3/address.d.ts +0 -32
- package/dist/domain/script/v3/address.js +0 -136
- package/dist/domain/script/v3/address.js.map +0 -1
- package/dist/domain/script/v3/lookups.d.ts +0 -33
- package/dist/domain/script/v3/lookups.js +0 -316
- package/dist/domain/script/v3/lookups.js.map +0 -1
- package/dist/domain/script/v3/ordinal.d.ts +0 -8
- package/dist/domain/script/v3/ordinal.js +0 -91
- package/dist/domain/script/v3/ordinal.js.map +0 -1
- package/dist/domain/script/v3/parse.d.ts +0 -3
- package/dist/domain/script/v3/parse.js +0 -164
- package/dist/domain/script/v3/parse.js.map +0 -1
- package/dist/domain/script/v3/patch/apply.d.ts +0 -2
- package/dist/domain/script/v3/patch/apply.js +0 -31
- package/dist/domain/script/v3/patch/apply.js.map +0 -1
- package/dist/domain/script/v3/patch/helpers.d.ts +0 -15
- package/dist/domain/script/v3/patch/helpers.js +0 -155
- package/dist/domain/script/v3/patch/helpers.js.map +0 -1
- package/dist/domain/script/v3/patch/inline-speaker.d.ts +0 -2
- package/dist/domain/script/v3/patch/inline-speaker.js +0 -50
- package/dist/domain/script/v3/patch/inline-speaker.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-action.d.ts +0 -12
- package/dist/domain/script/v3/patch/ops-action.js +0 -355
- package/dist/domain/script/v3/patch/ops-action.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-asset.d.ts +0 -14
- package/dist/domain/script/v3/patch/ops-asset.js +0 -347
- package/dist/domain/script/v3/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-dialogue.d.ts +0 -2
- package/dist/domain/script/v3/patch/ops-dialogue.js +0 -21
- package/dist/domain/script/v3/patch/ops-dialogue.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-extend.d.ts +0 -8
- package/dist/domain/script/v3/patch/ops-extend.js +0 -122
- package/dist/domain/script/v3/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-meta.d.ts +0 -5
- package/dist/domain/script/v3/patch/ops-meta.js +0 -82
- package/dist/domain/script/v3/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-scene.d.ts +0 -6
- package/dist/domain/script/v3/patch/ops-scene.js +0 -351
- package/dist/domain/script/v3/patch/ops-scene.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-state.d.ts +0 -8
- package/dist/domain/script/v3/patch/ops-state.js +0 -155
- package/dist/domain/script/v3/patch/ops-state.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-timestamp.d.ts +0 -6
- package/dist/domain/script/v3/patch/ops-timestamp.js +0 -47
- package/dist/domain/script/v3/patch/ops-timestamp.js.map +0 -1
- package/dist/domain/script/v3/patch/registry.d.ts +0 -2
- package/dist/domain/script/v3/patch/registry.js +0 -56
- package/dist/domain/script/v3/patch/registry.js.map +0 -1
- package/dist/domain/script/v3/patch/types.d.ts +0 -10
- package/dist/domain/script/v3/patch/types.js +0 -2
- package/dist/domain/script/v3/patch/types.js.map +0 -1
- package/dist/domain/script/v3/refs.d.ts +0 -4
- package/dist/domain/script/v3/refs.js +0 -64
- package/dist/domain/script/v3/refs.js.map +0 -1
- package/dist/domain/script/v3/scene-refs.d.ts +0 -3
- package/dist/domain/script/v3/scene-refs.js +0 -35
- package/dist/domain/script/v3/scene-refs.js.map +0 -1
- package/dist/domain/script/v3/schema.d.ts +0 -6
- package/dist/domain/script/v3/schema.js +0 -58
- package/dist/domain/script/v3/schema.js.map +0 -1
- package/dist/domain/script/v3/selector.d.ts +0 -44
- package/dist/domain/script/v3/selector.js +0 -178
- package/dist/domain/script/v3/selector.js.map +0 -1
- package/dist/domain/script/v3/types.d.ts +0 -106
- package/dist/domain/script/v3/types.js +0 -2
- package/dist/domain/script/v3/types.js.map +0 -1
- package/dist/domain/script/v3/validation.d.ts +0 -2
- package/dist/domain/script/v3/validation.js +0 -2
- package/dist/domain/script/v3/validation.js.map +0 -1
- package/dist/domain/script/v4/address.d.ts +0 -61
- package/dist/domain/script/v4/address.js +0 -99
- package/dist/domain/script/v4/address.js.map +0 -1
- package/dist/domain/script/v4/factory.d.ts +0 -2
- package/dist/domain/script/v4/factory.js +0 -13
- package/dist/domain/script/v4/factory.js.map +0 -1
- package/dist/domain/script/v4/from-v3.d.ts +0 -29
- package/dist/domain/script/v4/from-v3.js +0 -307
- package/dist/domain/script/v4/from-v3.js.map +0 -1
- package/dist/domain/script/v4/ids.d.ts +0 -5
- package/dist/domain/script/v4/ids.js +0 -41
- package/dist/domain/script/v4/ids.js.map +0 -1
- package/dist/domain/script/v4/ordinal.d.ts +0 -3
- package/dist/domain/script/v4/ordinal.js +0 -66
- package/dist/domain/script/v4/ordinal.js.map +0 -1
- package/dist/domain/script/v4/parse.d.ts +0 -5
- package/dist/domain/script/v4/parse.js +0 -196
- package/dist/domain/script/v4/parse.js.map +0 -1
- package/dist/domain/script/v4/patch/apply.d.ts +0 -3
- package/dist/domain/script/v4/patch/apply.js +0 -24
- package/dist/domain/script/v4/patch/apply.js.map +0 -1
- package/dist/domain/script/v4/patch/helpers.d.ts +0 -32
- package/dist/domain/script/v4/patch/helpers.js +0 -138
- package/dist/domain/script/v4/patch/helpers.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-action.d.ts +0 -13
- package/dist/domain/script/v4/patch/ops-action.js +0 -351
- package/dist/domain/script/v4/patch/ops-action.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-asset.d.ts +0 -17
- package/dist/domain/script/v4/patch/ops-asset.js +0 -556
- package/dist/domain/script/v4/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-extend.d.ts +0 -11
- package/dist/domain/script/v4/patch/ops-extend.js +0 -103
- package/dist/domain/script/v4/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-meta.d.ts +0 -5
- package/dist/domain/script/v4/patch/ops-meta.js +0 -49
- package/dist/domain/script/v4/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-scene-ref.d.ts +0 -3
- package/dist/domain/script/v4/patch/ops-scene-ref.js +0 -74
- package/dist/domain/script/v4/patch/ops-scene-ref.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-structure.d.ts +0 -6
- package/dist/domain/script/v4/patch/ops-structure.js +0 -236
- package/dist/domain/script/v4/patch/ops-structure.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-timestamp.d.ts +0 -6
- package/dist/domain/script/v4/patch/ops-timestamp.js +0 -40
- package/dist/domain/script/v4/patch/ops-timestamp.js.map +0 -1
- package/dist/domain/script/v4/patch/registry.d.ts +0 -2
- package/dist/domain/script/v4/patch/registry.js +0 -53
- package/dist/domain/script/v4/patch/registry.js.map +0 -1
- package/dist/domain/script/v4/patch/schema.d.ts +0 -7
- package/dist/domain/script/v4/patch/schema.js +0 -77
- package/dist/domain/script/v4/patch/schema.js.map +0 -1
- package/dist/domain/script/v4/patch/types.d.ts +0 -10
- package/dist/domain/script/v4/patch/types.js +0 -2
- package/dist/domain/script/v4/patch/types.js.map +0 -1
- package/dist/domain/script/v4/selector.d.ts +0 -11
- package/dist/domain/script/v4/selector.js +0 -124
- package/dist/domain/script/v4/selector.js.map +0 -1
- package/dist/domain/script/v4/types.d.ts +0 -120
- package/dist/domain/script/v4/types.js +0 -2
- package/dist/domain/script/v4/types.js.map +0 -1
- package/dist/domain/script/v4/validation.d.ts +0 -2
- package/dist/domain/script/v4/validation.js +0 -2
- package/dist/domain/script/v4/validation.js.map +0 -1
- package/dist/failures.d.ts +0 -58
- package/dist/failures.js +0 -96
- package/dist/failures.js.map +0 -1
- package/dist/infra/converters.d.ts +0 -9
- package/dist/infra/converters.js +0 -689
- package/dist/infra/converters.js.map +0 -1
- package/dist/infra/env.d.ts +0 -2
- package/dist/infra/env.js +0 -81
- package/dist/infra/env.js.map +0 -1
- package/dist/infra/episode-title.d.ts +0 -4
- package/dist/infra/episode-title.js +0 -129
- package/dist/infra/episode-title.js.map +0 -1
- package/dist/infra/ingest/review-renderer.d.ts +0 -1
- package/dist/infra/ingest/review-renderer.js +0 -440
- package/dist/infra/ingest/review-renderer.js.map +0 -1
- package/dist/infra/ingest/source-resolver.d.ts +0 -21
- package/dist/infra/ingest/source-resolver.js +0 -51
- package/dist/infra/ingest/source-resolver.js.map +0 -1
- package/dist/infra/ingest/text-reader.d.ts +0 -3
- package/dist/infra/ingest/text-reader.js +0 -27
- package/dist/infra/ingest/text-reader.js.map +0 -1
- package/dist/infra/ingest/video-discovery.d.ts +0 -8
- package/dist/infra/ingest/video-discovery.js +0 -69
- package/dist/infra/ingest/video-discovery.js.map +0 -1
- package/dist/infra/ingest/video-source-snapshot.d.ts +0 -4
- package/dist/infra/ingest/video-source-snapshot.js +0 -47
- package/dist/infra/ingest/video-source-snapshot.js.map +0 -1
- package/dist/infra/ingest/video-state-evidence.d.ts +0 -14
- package/dist/infra/ingest/video-state-evidence.js +0 -140
- package/dist/infra/ingest/video-state-evidence.js.map +0 -1
- package/dist/infra/ingest/video-transcode.d.ts +0 -7
- package/dist/infra/ingest/video-transcode.js +0 -98
- package/dist/infra/ingest/video-transcode.js.map +0 -1
- package/dist/infra/ingest/workspace-lock.d.ts +0 -1
- package/dist/infra/ingest/workspace-lock.js +0 -32
- package/dist/infra/ingest/workspace-lock.js.map +0 -1
- package/dist/infra/ingest/workspace-store.d.ts +0 -18
- package/dist/infra/ingest/workspace-store.js +0 -70
- package/dist/infra/ingest/workspace-store.js.map +0 -1
- package/dist/infra/llm/anthropic-model.d.ts +0 -11
- package/dist/infra/llm/anthropic-model.js +0 -130
- package/dist/infra/llm/anthropic-model.js.map +0 -1
- package/dist/infra/llm/doubao-model.d.ts +0 -60
- package/dist/infra/llm/doubao-model.js +0 -249
- package/dist/infra/llm/doubao-model.js.map +0 -1
- package/dist/infra/llm/failure-mapping.d.ts +0 -6
- package/dist/infra/llm/failure-mapping.js +0 -146
- package/dist/infra/llm/failure-mapping.js.map +0 -1
- package/dist/infra/llm/gemini-upload.d.ts +0 -13
- package/dist/infra/llm/gemini-upload.js +0 -138
- package/dist/infra/llm/gemini-upload.js.map +0 -1
- package/dist/infra/llm/gemini-video-model.d.ts +0 -50
- package/dist/infra/llm/gemini-video-model.js +0 -371
- package/dist/infra/llm/gemini-video-model.js.map +0 -1
- package/dist/infra/llm/openai-compatible-model.d.ts +0 -14
- package/dist/infra/llm/openai-compatible-model.js +0 -207
- package/dist/infra/llm/openai-compatible-model.js.map +0 -1
- package/dist/infra/llm/retry.d.ts +0 -8
- package/dist/infra/llm/retry.js +0 -41
- package/dist/infra/llm/retry.js.map +0 -1
- package/dist/infra/local-script-output-store.d.ts +0 -43
- package/dist/infra/local-script-output-store.js +0 -168
- package/dist/infra/local-script-output-store.js.map +0 -1
- package/dist/infra/script-output-api.d.ts +0 -50
- package/dist/infra/script-output-api.js +0 -251
- package/dist/infra/script-output-api.js.map +0 -1
- package/dist/infra/script-output-store.d.ts +0 -152
- package/dist/infra/script-output-store.js +0 -114
- package/dist/infra/script-output-store.js.map +0 -1
- package/dist/infra/script-working-copy.d.ts +0 -23
- package/dist/infra/script-working-copy.js +0 -157
- package/dist/infra/script-working-copy.js.map +0 -1
- package/dist/infra/storage.d.ts +0 -35
- package/dist/infra/storage.js +0 -91
- package/dist/infra/storage.js.map +0 -1
- package/dist/llm/composition.d.ts +0 -5
- package/dist/llm/composition.js +0 -5
- package/dist/llm/composition.js.map +0 -1
- package/dist/llm/config.d.ts +0 -28
- package/dist/llm/config.js +0 -231
- package/dist/llm/config.js.map +0 -1
- package/dist/llm/registry.d.ts +0 -43
- package/dist/llm/registry.js +0 -69
- package/dist/llm/registry.js.map +0 -1
- package/dist/llm/router.d.ts +0 -46
- package/dist/llm/router.js +0 -512
- package/dist/llm/router.js.map +0 -1
- package/dist/llm/tasks/ingest/arc-summary.d.ts +0 -8
- package/dist/llm/tasks/ingest/arc-summary.js +0 -26
- package/dist/llm/tasks/ingest/arc-summary.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-audit.d.ts +0 -6
- package/dist/llm/tasks/ingest/asset-audit.js +0 -158
- package/dist/llm/tasks/ingest/asset-audit.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-curate.d.ts +0 -13
- package/dist/llm/tasks/ingest/asset-curate.js +0 -45
- package/dist/llm/tasks/ingest/asset-curate.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-extract.d.ts +0 -12
- package/dist/llm/tasks/ingest/asset-extract.js +0 -51
- package/dist/llm/tasks/ingest/asset-extract.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-govern.d.ts +0 -22
- package/dist/llm/tasks/ingest/asset-govern.js +0 -143
- package/dist/llm/tasks/ingest/asset-govern.js.map +0 -1
- package/dist/llm/tasks/ingest/body-start.d.ts +0 -10
- package/dist/llm/tasks/ingest/body-start.js +0 -41
- package/dist/llm/tasks/ingest/body-start.js.map +0 -1
- package/dist/llm/tasks/ingest/episode-assets.d.ts +0 -29
- package/dist/llm/tasks/ingest/episode-assets.js +0 -282
- package/dist/llm/tasks/ingest/episode-assets.js.map +0 -1
- package/dist/llm/tasks/ingest/mention-resolve.d.ts +0 -9
- package/dist/llm/tasks/ingest/mention-resolve.js +0 -39
- package/dist/llm/tasks/ingest/mention-resolve.js.map +0 -1
- package/dist/llm/tasks/ingest/name-fix.d.ts +0 -9
- package/dist/llm/tasks/ingest/name-fix.js +0 -56
- package/dist/llm/tasks/ingest/name-fix.js.map +0 -1
- package/dist/llm/tasks/ingest/state-reconcile.d.ts +0 -8
- package/dist/llm/tasks/ingest/state-reconcile.js +0 -44
- package/dist/llm/tasks/ingest/state-reconcile.js.map +0 -1
- package/dist/llm/tasks/ingest/text-normalize.d.ts +0 -10
- package/dist/llm/tasks/ingest/text-normalize.js +0 -122
- package/dist/llm/tasks/ingest/text-normalize.js.map +0 -1
- package/dist/llm/tasks/ingest/video-serial.d.ts +0 -14
- package/dist/llm/tasks/ingest/video-serial.js +0 -391
- package/dist/llm/tasks/ingest/video-serial.js.map +0 -1
- package/dist/llm/tasks/schemas.d.ts +0 -9
- package/dist/llm/tasks/schemas.js +0 -466
- package/dist/llm/tasks/schemas.js.map +0 -1
- package/dist/llm/types.d.ts +0 -178
- package/dist/llm/types.js +0 -44
- package/dist/llm/types.js.map +0 -1
- package/dist/output.d.ts +0 -3
- package/dist/output.js +0 -94
- package/dist/output.js.map +0 -1
- package/dist/package-root.d.ts +0 -2
- package/dist/package-root.js +0 -38
- package/dist/package-root.js.map +0 -1
- package/dist/review-agent.js.map +0 -7
- package/dist/usecases/changelog.d.ts +0 -9
- package/dist/usecases/changelog.js +0 -134
- package/dist/usecases/changelog.js.map +0 -1
- package/dist/usecases/doctor.d.ts +0 -2
- package/dist/usecases/doctor.js +0 -231
- package/dist/usecases/doctor.js.map +0 -1
- package/dist/usecases/ingest/body-start.d.ts +0 -8
- package/dist/usecases/ingest/body-start.js +0 -36
- package/dist/usecases/ingest/body-start.js.map +0 -1
- package/dist/usecases/ingest/command.d.ts +0 -5
- package/dist/usecases/ingest/command.js +0 -183
- package/dist/usecases/ingest/command.js.map +0 -1
- package/dist/usecases/ingest/failure.d.ts +0 -26
- package/dist/usecases/ingest/failure.js +0 -151
- package/dist/usecases/ingest/failure.js.map +0 -1
- package/dist/usecases/ingest/fanout.d.ts +0 -10
- package/dist/usecases/ingest/fanout.js +0 -23
- package/dist/usecases/ingest/fanout.js.map +0 -1
- package/dist/usecases/ingest/final-asset-audit.d.ts +0 -39
- package/dist/usecases/ingest/final-asset-audit.js +0 -88
- package/dist/usecases/ingest/final-asset-audit.js.map +0 -1
- package/dist/usecases/ingest/generate-video-state-evidence.d.ts +0 -23
- package/dist/usecases/ingest/generate-video-state-evidence.js +0 -124
- package/dist/usecases/ingest/generate-video-state-evidence.js.map +0 -1
- package/dist/usecases/ingest/pass4-mention-resolve.d.ts +0 -11
- package/dist/usecases/ingest/pass4-mention-resolve.js +0 -52
- package/dist/usecases/ingest/pass4-mention-resolve.js.map +0 -1
- package/dist/usecases/ingest/pass5-extract.d.ts +0 -7
- package/dist/usecases/ingest/pass5-extract.js +0 -51
- package/dist/usecases/ingest/pass5-extract.js.map +0 -1
- package/dist/usecases/ingest/pass5-govern.d.ts +0 -13
- package/dist/usecases/ingest/pass5-govern.js +0 -157
- package/dist/usecases/ingest/pass5-govern.js.map +0 -1
- package/dist/usecases/ingest/pipeline.d.ts +0 -28
- package/dist/usecases/ingest/pipeline.js +0 -335
- package/dist/usecases/ingest/pipeline.js.map +0 -1
- package/dist/usecases/ingest/publish-command.d.ts +0 -1
- package/dist/usecases/ingest/publish-command.js +0 -4
- package/dist/usecases/ingest/publish-command.js.map +0 -1
- package/dist/usecases/ingest/serial-govern.d.ts +0 -40
- package/dist/usecases/ingest/serial-govern.js +0 -488
- package/dist/usecases/ingest/serial-govern.js.map +0 -1
- package/dist/usecases/ingest/skip-video-episode.d.ts +0 -4
- package/dist/usecases/ingest/skip-video-episode.js +0 -120
- package/dist/usecases/ingest/skip-video-episode.js.map +0 -1
- package/dist/usecases/ingest/status.d.ts +0 -61
- package/dist/usecases/ingest/status.js +0 -347
- package/dist/usecases/ingest/status.js.map +0 -1
- package/dist/usecases/ingest/timings.d.ts +0 -51
- package/dist/usecases/ingest/timings.js +0 -68
- package/dist/usecases/ingest/timings.js.map +0 -1
- package/dist/usecases/ingest/usage-report.d.ts +0 -125
- package/dist/usecases/ingest/usage-report.js +0 -248
- package/dist/usecases/ingest/usage-report.js.map +0 -1
- package/dist/usecases/ingest/video-pipeline.d.ts +0 -81
- package/dist/usecases/ingest/video-pipeline.js +0 -547
- package/dist/usecases/ingest/video-pipeline.js.map +0 -1
- package/dist/usecases/ingest/video-skip-state.d.ts +0 -29
- package/dist/usecases/ingest/video-skip-state.js +0 -148
- package/dist/usecases/ingest/video-skip-state.js.map +0 -1
- package/dist/usecases/ingest/view-command.d.ts +0 -4
- package/dist/usecases/ingest/view-command.js +0 -67
- package/dist/usecases/ingest/view-command.js.map +0 -1
- package/dist/usecases/ingest/view-server.d.ts +0 -29
- package/dist/usecases/ingest/view-server.js +0 -364
- package/dist/usecases/ingest/view-server.js.map +0 -1
- package/dist/usecases/script/action-span.d.ts +0 -10
- package/dist/usecases/script/action-span.js +0 -42
- package/dist/usecases/script/action-span.js.map +0 -1
- package/dist/usecases/script/actions.d.ts +0 -3
- package/dist/usecases/script/actions.js +0 -184
- package/dist/usecases/script/actions.js.map +0 -1
- package/dist/usecases/script/actor.d.ts +0 -3
- package/dist/usecases/script/actor.js +0 -26
- package/dist/usecases/script/actor.js.map +0 -1
- package/dist/usecases/script/actors.d.ts +0 -3
- package/dist/usecases/script/actors.js +0 -25
- package/dist/usecases/script/actors.js.map +0 -1
- package/dist/usecases/script/add-actor.d.ts +0 -3
- package/dist/usecases/script/add-actor.js +0 -13
- package/dist/usecases/script/add-actor.js.map +0 -1
- package/dist/usecases/script/add-episode.d.ts +0 -3
- package/dist/usecases/script/add-episode.js +0 -9
- package/dist/usecases/script/add-episode.js.map +0 -1
- package/dist/usecases/script/add-location.d.ts +0 -3
- package/dist/usecases/script/add-location.js +0 -11
- package/dist/usecases/script/add-location.js.map +0 -1
- package/dist/usecases/script/add-prop.d.ts +0 -3
- package/dist/usecases/script/add-prop.js +0 -11
- package/dist/usecases/script/add-prop.js.map +0 -1
- package/dist/usecases/script/alias.d.ts +0 -3
- package/dist/usecases/script/alias.js +0 -39
- package/dist/usecases/script/alias.js.map +0 -1
- package/dist/usecases/script/assets.d.ts +0 -3
- package/dist/usecases/script/assets.js +0 -46
- package/dist/usecases/script/assets.js.map +0 -1
- package/dist/usecases/script/audit-assets.d.ts +0 -4
- package/dist/usecases/script/audit-assets.js +0 -37
- package/dist/usecases/script/audit-assets.js.map +0 -1
- package/dist/usecases/script/command-constraints.d.ts +0 -38
- package/dist/usecases/script/command-constraints.js +0 -143
- package/dist/usecases/script/command-constraints.js.map +0 -1
- package/dist/usecases/script/compose-creative-draft.d.ts +0 -3
- package/dist/usecases/script/compose-creative-draft.js +0 -106
- package/dist/usecases/script/compose-creative-draft.js.map +0 -1
- package/dist/usecases/script/context.d.ts +0 -3
- package/dist/usecases/script/context.js +0 -52
- package/dist/usecases/script/context.js.map +0 -1
- package/dist/usecases/script/create.d.ts +0 -3
- package/dist/usecases/script/create.js +0 -27
- package/dist/usecases/script/create.js.map +0 -1
- package/dist/usecases/script/delete.d.ts +0 -3
- package/dist/usecases/script/delete.js +0 -88
- package/dist/usecases/script/delete.js.map +0 -1
- package/dist/usecases/script/describe.d.ts +0 -3
- package/dist/usecases/script/describe.js +0 -32
- package/dist/usecases/script/describe.js.map +0 -1
- package/dist/usecases/script/dialogue.d.ts +0 -3
- package/dist/usecases/script/dialogue.js +0 -30
- package/dist/usecases/script/dialogue.js.map +0 -1
- package/dist/usecases/script/dispatch.d.ts +0 -3
- package/dist/usecases/script/dispatch.js +0 -10
- package/dist/usecases/script/dispatch.js.map +0 -1
- package/dist/usecases/script/do.d.ts +0 -3
- package/dist/usecases/script/do.js +0 -186
- package/dist/usecases/script/do.js.map +0 -1
- package/dist/usecases/script/emotion.d.ts +0 -3
- package/dist/usecases/script/emotion.js +0 -24
- package/dist/usecases/script/emotion.js.map +0 -1
- package/dist/usecases/script/episodes.d.ts +0 -3
- package/dist/usecases/script/episodes.js +0 -62
- package/dist/usecases/script/episodes.js.map +0 -1
- package/dist/usecases/script/export-authoring.d.ts +0 -4
- package/dist/usecases/script/export-authoring.js +0 -326
- package/dist/usecases/script/export-authoring.js.map +0 -1
- package/dist/usecases/script/extend.d.ts +0 -3
- package/dist/usecases/script/extend.js +0 -94
- package/dist/usecases/script/extend.js.map +0 -1
- package/dist/usecases/script/ids.d.ts +0 -3
- package/dist/usecases/script/ids.js +0 -148
- package/dist/usecases/script/ids.js.map +0 -1
- package/dist/usecases/script/importance.d.ts +0 -3
- package/dist/usecases/script/importance.js +0 -16
- package/dist/usecases/script/importance.js.map +0 -1
- package/dist/usecases/script/insert.d.ts +0 -3
- package/dist/usecases/script/insert.js +0 -127
- package/dist/usecases/script/insert.js.map +0 -1
- package/dist/usecases/script/issues.d.ts +0 -3
- package/dist/usecases/script/issues.js +0 -35
- package/dist/usecases/script/issues.js.map +0 -1
- package/dist/usecases/script/lib.d.ts +0 -152
- package/dist/usecases/script/lib.js +0 -1654
- package/dist/usecases/script/lib.js.map +0 -1
- package/dist/usecases/script/locations.d.ts +0 -3
- package/dist/usecases/script/locations.js +0 -25
- package/dist/usecases/script/locations.js.map +0 -1
- package/dist/usecases/script/merge.d.ts +0 -3
- package/dist/usecases/script/merge.js +0 -43
- package/dist/usecases/script/merge.js.map +0 -1
- package/dist/usecases/script/migrate.d.ts +0 -3
- package/dist/usecases/script/migrate.js +0 -210
- package/dist/usecases/script/migrate.js.map +0 -1
- package/dist/usecases/script/move.d.ts +0 -3
- package/dist/usecases/script/move.js +0 -50
- package/dist/usecases/script/move.js.map +0 -1
- package/dist/usecases/script/parenthetical.d.ts +0 -3
- package/dist/usecases/script/parenthetical.js +0 -52
- package/dist/usecases/script/parenthetical.js.map +0 -1
- package/dist/usecases/script/props.d.ts +0 -3
- package/dist/usecases/script/props.js +0 -25
- package/dist/usecases/script/props.js.map +0 -1
- package/dist/usecases/script/refs.d.ts +0 -3
- package/dist/usecases/script/refs.js +0 -111
- package/dist/usecases/script/refs.js.map +0 -1
- package/dist/usecases/script/rename.d.ts +0 -3
- package/dist/usecases/script/rename.js +0 -35
- package/dist/usecases/script/rename.js.map +0 -1
- package/dist/usecases/script/replace.d.ts +0 -3
- package/dist/usecases/script/replace.js +0 -33
- package/dist/usecases/script/replace.js.map +0 -1
- package/dist/usecases/script/review.d.ts +0 -3
- package/dist/usecases/script/review.js +0 -187
- package/dist/usecases/script/review.js.map +0 -1
- package/dist/usecases/script/role.d.ts +0 -3
- package/dist/usecases/script/role.js +0 -16
- package/dist/usecases/script/role.js.map +0 -1
- package/dist/usecases/script/scenes.d.ts +0 -3
- package/dist/usecases/script/scenes.js +0 -66
- package/dist/usecases/script/scenes.js.map +0 -1
- package/dist/usecases/script/script-patch.d.ts +0 -3
- package/dist/usecases/script/script-patch.js +0 -321
- package/dist/usecases/script/script-patch.js.map +0 -1
- package/dist/usecases/script/script-validate.d.ts +0 -3
- package/dist/usecases/script/script-validate.js +0 -27
- package/dist/usecases/script/script-validate.js.map +0 -1
- package/dist/usecases/script/session.d.ts +0 -62
- package/dist/usecases/script/session.js +0 -567
- package/dist/usecases/script/session.js.map +0 -1
- package/dist/usecases/script/split.d.ts +0 -3
- package/dist/usecases/script/split.js +0 -41
- package/dist/usecases/script/split.js.map +0 -1
- package/dist/usecases/script/state-add.d.ts +0 -3
- package/dist/usecases/script/state-add.js +0 -22
- package/dist/usecases/script/state-add.js.map +0 -1
- package/dist/usecases/script/state-delete.d.ts +0 -3
- package/dist/usecases/script/state-delete.js +0 -22
- package/dist/usecases/script/state-delete.js.map +0 -1
- package/dist/usecases/script/state-rename.d.ts +0 -3
- package/dist/usecases/script/state-rename.js +0 -16
- package/dist/usecases/script/state-rename.js.map +0 -1
- package/dist/usecases/script/states.d.ts +0 -3
- package/dist/usecases/script/states.js +0 -197
- package/dist/usecases/script/states.js.map +0 -1
- package/dist/usecases/script/summary.d.ts +0 -3
- package/dist/usecases/script/summary.js +0 -72
- package/dist/usecases/script/summary.js.map +0 -1
- package/dist/usecases/script/synopsis-generate.d.ts +0 -115
- package/dist/usecases/script/synopsis-generate.js +0 -776
- package/dist/usecases/script/synopsis-generate.js.map +0 -1
- package/dist/usecases/script/synopsis.d.ts +0 -3
- package/dist/usecases/script/synopsis.js +0 -45
- package/dist/usecases/script/synopsis.js.map +0 -1
- package/dist/usecases/script/timestamp-filter.d.ts +0 -4
- package/dist/usecases/script/timestamp-filter.js +0 -55
- package/dist/usecases/script/timestamp-filter.js.map +0 -1
- package/dist/usecases/script/timestamp.d.ts +0 -3
- package/dist/usecases/script/timestamp.js +0 -11
- package/dist/usecases/script/timestamp.js.map +0 -1
- package/dist/usecases/script/transition.d.ts +0 -3
- package/dist/usecases/script/transition.js +0 -23
- package/dist/usecases/script/transition.js.map +0 -1
- package/dist/usecases/script/type.d.ts +0 -3
- package/dist/usecases/script/type.js +0 -23
- package/dist/usecases/script/type.js.map +0 -1
- package/dist/usecases/script/v3/mutations.d.ts +0 -2
- package/dist/usecases/script/v3/mutations.js +0 -5
- package/dist/usecases/script/v3/mutations.js.map +0 -1
- package/dist/usecases/script/v4/mutations.d.ts +0 -2
- package/dist/usecases/script/v4/mutations.js +0 -6
- package/dist/usecases/script/v4/mutations.js.map +0 -1
- package/dist/usecases/script/v4/queries.d.ts +0 -15
- package/dist/usecases/script/v4/queries.js +0 -196
- package/dist/usecases/script/v4/queries.js.map +0 -1
- package/dist/usecases/script/working-copy.d.ts +0 -5
- package/dist/usecases/script/working-copy.js +0 -399
- package/dist/usecases/script/working-copy.js.map +0 -1
- package/dist/usecases/script/worldview.d.ts +0 -3
- package/dist/usecases/script/worldview.js +0 -17
- package/dist/usecases/script/worldview.js.map +0 -1
- package/dist/usecases/script/write-authoring.d.ts +0 -3
- package/dist/usecases/script/write-authoring.js +0 -263
- package/dist/usecases/script/write-authoring.js.map +0 -1
- package/dist/usecases/update.d.ts +0 -13
- package/dist/usecases/update.js +0 -128
- package/dist/usecases/update.js.map +0 -1
package/dist/infra/converters.js
DELETED
|
@@ -1,689 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import * as os from "node:os";
|
|
4
|
-
import JSZip from "jszip";
|
|
5
|
-
import { XMLParser } from "fast-xml-parser";
|
|
6
|
-
import { fmtId, readText, sha256File, sha256Text, writeText, } from "../common.js";
|
|
7
|
-
import { cleanEpisodeShortTitle, episodeNumberFromValue, isTechnicalEpisodeTitle, } from "./episode-title.js";
|
|
8
|
-
function strOf(v) {
|
|
9
|
-
if (v === null || v === undefined)
|
|
10
|
-
return "";
|
|
11
|
-
return String(v);
|
|
12
|
-
}
|
|
13
|
-
function isDict(v) {
|
|
14
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
15
|
-
}
|
|
16
|
-
function isList(v) {
|
|
17
|
-
return Array.isArray(v);
|
|
18
|
-
}
|
|
19
|
-
function asList(v) {
|
|
20
|
-
return Array.isArray(v) ? v : [];
|
|
21
|
-
}
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// Text formats
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
export function convertTxt(source) {
|
|
26
|
-
return readText(source).replace(/^/, "");
|
|
27
|
-
}
|
|
28
|
-
export function rowsToMergedLines(rows) {
|
|
29
|
-
if (rows.length === 0)
|
|
30
|
-
return "";
|
|
31
|
-
const lines = [];
|
|
32
|
-
let prevScene = "";
|
|
33
|
-
for (let i = 1; i < rows.length; i++) {
|
|
34
|
-
const row = rows[i];
|
|
35
|
-
const nonEmpty = row.filter((c) => c);
|
|
36
|
-
if (nonEmpty.length === 0)
|
|
37
|
-
continue;
|
|
38
|
-
const first = row[0] ?? "";
|
|
39
|
-
if (first.includes("🎬") || /第\s*\d+\s*集/.test(first)) {
|
|
40
|
-
lines.push(`\n${first}`);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
let scene = row.length > 1 ? row[1] ?? "" : "";
|
|
44
|
-
if (!scene)
|
|
45
|
-
scene = prevScene;
|
|
46
|
-
prevScene = scene;
|
|
47
|
-
const parts = [];
|
|
48
|
-
if (first)
|
|
49
|
-
parts.push(`${first}.`);
|
|
50
|
-
const remaining = row.slice(2).filter((c) => c);
|
|
51
|
-
if (scene && remaining.length > 0)
|
|
52
|
-
parts.push(`${scene},${remaining.join(" ")}`);
|
|
53
|
-
else if (scene)
|
|
54
|
-
parts.push(scene);
|
|
55
|
-
else
|
|
56
|
-
parts.push(...remaining);
|
|
57
|
-
lines.push(parts.join(" "));
|
|
58
|
-
}
|
|
59
|
-
return lines.join("\n");
|
|
60
|
-
}
|
|
61
|
-
function attrOf(node, key) {
|
|
62
|
-
const attrs = node[":@"];
|
|
63
|
-
if (!isDict(attrs))
|
|
64
|
-
return "";
|
|
65
|
-
return strOf(attrs[key]).trim();
|
|
66
|
-
}
|
|
67
|
-
function firstChildNode(node, childName) {
|
|
68
|
-
for (const [key, value] of Object.entries(node)) {
|
|
69
|
-
if (localName(key) === childName && isList(value))
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
function textFromOrderedNodes(items) {
|
|
75
|
-
const parts = [];
|
|
76
|
-
const walk = (value) => {
|
|
77
|
-
if (!isList(value))
|
|
78
|
-
return;
|
|
79
|
-
for (const item of value) {
|
|
80
|
-
if (!isDict(item))
|
|
81
|
-
continue;
|
|
82
|
-
for (const [key, child] of Object.entries(item)) {
|
|
83
|
-
if (key === "#text" && child !== null && child !== undefined) {
|
|
84
|
-
parts.push(strOf(child));
|
|
85
|
-
}
|
|
86
|
-
else if (key !== ":@" && isList(child)) {
|
|
87
|
-
walk(child);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
walk(items);
|
|
93
|
-
return parts.join("");
|
|
94
|
-
}
|
|
95
|
-
function parseXmlFile(xml) {
|
|
96
|
-
const parsed = xmlParser.parse(xml);
|
|
97
|
-
if (!isList(parsed))
|
|
98
|
-
throw new Error("xlsx xml part has an unexpected shape");
|
|
99
|
-
return parsed;
|
|
100
|
-
}
|
|
101
|
-
function findDescendantNodes(items, childName) {
|
|
102
|
-
const result = [];
|
|
103
|
-
const walk = (value) => {
|
|
104
|
-
const nodes = isList(value)
|
|
105
|
-
? value.filter(isDict)
|
|
106
|
-
: isDict(value)
|
|
107
|
-
? [value]
|
|
108
|
-
: [];
|
|
109
|
-
for (const item of nodes) {
|
|
110
|
-
for (const [key, child] of Object.entries(item)) {
|
|
111
|
-
if (localName(key) === childName && isList(child)) {
|
|
112
|
-
result.push(item);
|
|
113
|
-
}
|
|
114
|
-
if (isList(child))
|
|
115
|
-
walk(child);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
walk(items);
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
function columnIndexFromRef(cellRef) {
|
|
123
|
-
const match = /^[A-Z]+/i.exec(cellRef.trim());
|
|
124
|
-
if (!match)
|
|
125
|
-
return null;
|
|
126
|
-
let index = 0;
|
|
127
|
-
for (const ch of match[0].toUpperCase()) {
|
|
128
|
-
index = index * 26 + ch.charCodeAt(0) - 64;
|
|
129
|
-
}
|
|
130
|
-
return index - 1;
|
|
131
|
-
}
|
|
132
|
-
function normalizeXlsxPartPath(baseDir, target) {
|
|
133
|
-
const rawPath = target.startsWith("/") ? target.slice(1) : `${baseDir}/${target}`;
|
|
134
|
-
const parts = rawPath.split("/");
|
|
135
|
-
const out = [];
|
|
136
|
-
for (const part of parts) {
|
|
137
|
-
if (!part || part === ".")
|
|
138
|
-
continue;
|
|
139
|
-
if (part === "..")
|
|
140
|
-
out.pop();
|
|
141
|
-
else
|
|
142
|
-
out.push(part);
|
|
143
|
-
}
|
|
144
|
-
return out.join("/");
|
|
145
|
-
}
|
|
146
|
-
async function readZipText(zip, partPath) {
|
|
147
|
-
const file = zip.file(partPath);
|
|
148
|
-
return file ? file.async("string") : null;
|
|
149
|
-
}
|
|
150
|
-
async function loadSharedStrings(zip) {
|
|
151
|
-
const xml = await readZipText(zip, "xl/sharedStrings.xml");
|
|
152
|
-
if (!xml)
|
|
153
|
-
return [];
|
|
154
|
-
const parsed = parseXmlFile(xml);
|
|
155
|
-
const strings = [];
|
|
156
|
-
for (const si of findDescendantNodes(parsed, "si")) {
|
|
157
|
-
strings.push(textFromOrderedNodes(firstChildNode(si, "si") ?? []));
|
|
158
|
-
}
|
|
159
|
-
return strings;
|
|
160
|
-
}
|
|
161
|
-
async function loadWorkbookSheets(zip) {
|
|
162
|
-
const workbookXml = await readZipText(zip, "xl/workbook.xml");
|
|
163
|
-
const relsXml = await readZipText(zip, "xl/_rels/workbook.xml.rels");
|
|
164
|
-
if (!workbookXml || !relsXml)
|
|
165
|
-
throw new Error("xlsx missing workbook metadata");
|
|
166
|
-
const rels = new Map();
|
|
167
|
-
for (const rel of findDescendantNodes(parseXmlFile(relsXml), "Relationship")) {
|
|
168
|
-
const id = attrOf(rel, "@_Id");
|
|
169
|
-
const target = attrOf(rel, "@_Target");
|
|
170
|
-
if (id && target)
|
|
171
|
-
rels.set(id, normalizeXlsxPartPath("xl", target));
|
|
172
|
-
}
|
|
173
|
-
const sheets = [];
|
|
174
|
-
for (const sheet of findDescendantNodes(parseXmlFile(workbookXml), "sheet")) {
|
|
175
|
-
const name = attrOf(sheet, "@_name");
|
|
176
|
-
const relId = attrOf(sheet, "@_r:id");
|
|
177
|
-
const sheetPath = rels.get(relId);
|
|
178
|
-
if (name && sheetPath)
|
|
179
|
-
sheets.push({ name, path: sheetPath });
|
|
180
|
-
}
|
|
181
|
-
if (sheets.length === 0)
|
|
182
|
-
throw new Error("xlsx workbook contains no readable sheets");
|
|
183
|
-
return sheets;
|
|
184
|
-
}
|
|
185
|
-
function cellText(cell, sharedStrings) {
|
|
186
|
-
const type = attrOf(cell, "@_t");
|
|
187
|
-
if (type === "inlineStr") {
|
|
188
|
-
const inline = findDescendantNodes(cell, "is")[0];
|
|
189
|
-
const inlineNodes = inline ? firstChildNode(inline, "is") : null;
|
|
190
|
-
return inlineNodes ? textFromOrderedNodes(inlineNodes).trim() : "";
|
|
191
|
-
}
|
|
192
|
-
const value = findDescendantNodes(cell, "v")[0];
|
|
193
|
-
const valueNode = value ? firstChildNode(value, "v") : null;
|
|
194
|
-
const rawValue = valueNode ? textFromOrderedNodes(valueNode).trim() : "";
|
|
195
|
-
if (!rawValue && type === "str") {
|
|
196
|
-
const formulaString = findDescendantNodes(cell, "is")[0];
|
|
197
|
-
const formulaNodes = formulaString ? firstChildNode(formulaString, "is") : null;
|
|
198
|
-
return formulaNodes ? textFromOrderedNodes(formulaNodes).trim() : "";
|
|
199
|
-
}
|
|
200
|
-
if (type === "s") {
|
|
201
|
-
const index = Number.parseInt(rawValue, 10);
|
|
202
|
-
return Number.isInteger(index) ? (sharedStrings[index] ?? "").trim() : "";
|
|
203
|
-
}
|
|
204
|
-
if (type === "b")
|
|
205
|
-
return rawValue === "1" ? "TRUE" : rawValue === "0" ? "FALSE" : rawValue;
|
|
206
|
-
if (type === "str")
|
|
207
|
-
return rawValue;
|
|
208
|
-
return rawValue;
|
|
209
|
-
}
|
|
210
|
-
async function sheetToRowsFromBuffer(buffer) {
|
|
211
|
-
const zip = await JSZip.loadAsync(buffer);
|
|
212
|
-
const [sharedStrings, sheets] = await Promise.all([
|
|
213
|
-
loadSharedStrings(zip),
|
|
214
|
-
loadWorkbookSheets(zip),
|
|
215
|
-
]);
|
|
216
|
-
const result = [];
|
|
217
|
-
for (const sheet of sheets) {
|
|
218
|
-
const xml = await readZipText(zip, sheet.path);
|
|
219
|
-
if (!xml)
|
|
220
|
-
throw new Error(`xlsx missing worksheet part: ${sheet.path}`);
|
|
221
|
-
const rows = [];
|
|
222
|
-
for (const row of findDescendantNodes(parseXmlFile(xml), "row")) {
|
|
223
|
-
const cells = [];
|
|
224
|
-
for (const cell of findDescendantNodes(row, "c")) {
|
|
225
|
-
const ref = attrOf(cell, "@_r");
|
|
226
|
-
const index = ref ? columnIndexFromRef(ref) : null;
|
|
227
|
-
const text = cellText(cell, sharedStrings);
|
|
228
|
-
const targetIndex = index ?? cells.length;
|
|
229
|
-
while (cells.length < targetIndex)
|
|
230
|
-
cells.push("");
|
|
231
|
-
cells[targetIndex] = text.trim();
|
|
232
|
-
}
|
|
233
|
-
if (cells.some((c) => c))
|
|
234
|
-
rows.push(cells);
|
|
235
|
-
}
|
|
236
|
-
result.push({ name: sheet.name, rows });
|
|
237
|
-
}
|
|
238
|
-
return result;
|
|
239
|
-
}
|
|
240
|
-
export async function convertXlsx(source) {
|
|
241
|
-
const buf = fs.readFileSync(source);
|
|
242
|
-
const sheets = await sheetToRowsFromBuffer(buf);
|
|
243
|
-
const parts = [];
|
|
244
|
-
for (const sheet of sheets) {
|
|
245
|
-
if (sheet.rows.length === 0)
|
|
246
|
-
continue;
|
|
247
|
-
parts.push(`## ${sheet.name}\n`);
|
|
248
|
-
parts.push(rowsToMergedLines(sheet.rows));
|
|
249
|
-
}
|
|
250
|
-
return parts.join("\n\n");
|
|
251
|
-
}
|
|
252
|
-
// ---------------------------------------------------------------------------
|
|
253
|
-
// DOCX (jszip + fast-xml-parser)
|
|
254
|
-
// ---------------------------------------------------------------------------
|
|
255
|
-
const xmlParser = new XMLParser({
|
|
256
|
-
ignoreAttributes: false,
|
|
257
|
-
attributeNamePrefix: "@_",
|
|
258
|
-
preserveOrder: true,
|
|
259
|
-
trimValues: false,
|
|
260
|
-
textNodeName: "#text",
|
|
261
|
-
});
|
|
262
|
-
function localName(tag) {
|
|
263
|
-
const idx = tag.indexOf(":");
|
|
264
|
-
return idx >= 0 ? tag.slice(idx + 1) : tag;
|
|
265
|
-
}
|
|
266
|
-
function isParsedNode(node) {
|
|
267
|
-
return isDict(node);
|
|
268
|
-
}
|
|
269
|
-
function getChildren(node, tagPredicate) {
|
|
270
|
-
const out = [];
|
|
271
|
-
for (const key of Object.keys(node)) {
|
|
272
|
-
if (key.startsWith("@_") || key === "#text" || key === ":@")
|
|
273
|
-
continue;
|
|
274
|
-
if (tagPredicate(localName(key))) {
|
|
275
|
-
const value = node[key];
|
|
276
|
-
if (isList(value)) {
|
|
277
|
-
for (const item of value) {
|
|
278
|
-
if (isParsedNode(item))
|
|
279
|
-
out.push({ tag: key, node: item });
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
else if (isParsedNode(value)) {
|
|
283
|
-
out.push({ tag: key, node: value });
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return out;
|
|
288
|
-
}
|
|
289
|
-
function paragraphText(paragraphNode) {
|
|
290
|
-
const parts = [];
|
|
291
|
-
function walk(items) {
|
|
292
|
-
if (!isList(items))
|
|
293
|
-
return;
|
|
294
|
-
for (const item of items) {
|
|
295
|
-
if (!isDict(item))
|
|
296
|
-
continue;
|
|
297
|
-
for (const [key, value] of Object.entries(item)) {
|
|
298
|
-
if (key === ":@")
|
|
299
|
-
continue;
|
|
300
|
-
if (key === "#text" && typeof value === "string") {
|
|
301
|
-
// ignore — we look at w:t below
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
const local = localName(key);
|
|
305
|
-
if (local === "t") {
|
|
306
|
-
if (isList(value)) {
|
|
307
|
-
for (const inner of value) {
|
|
308
|
-
if (isDict(inner)) {
|
|
309
|
-
const txt = inner["#text"];
|
|
310
|
-
if (typeof txt === "string")
|
|
311
|
-
parts.push(txt);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
else if (local === "tab") {
|
|
317
|
-
parts.push("\t");
|
|
318
|
-
}
|
|
319
|
-
else if (local === "br" || local === "cr") {
|
|
320
|
-
parts.push("\n");
|
|
321
|
-
}
|
|
322
|
-
else if (isList(value)) {
|
|
323
|
-
walk(value);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
walk(paragraphNode);
|
|
329
|
-
return parts.join("").trim();
|
|
330
|
-
}
|
|
331
|
-
function tableText(tableNode) {
|
|
332
|
-
const rows = [];
|
|
333
|
-
for (const item of tableNode) {
|
|
334
|
-
if (!isDict(item))
|
|
335
|
-
continue;
|
|
336
|
-
for (const [key, value] of Object.entries(item)) {
|
|
337
|
-
if (localName(key) !== "tr")
|
|
338
|
-
continue;
|
|
339
|
-
const cells = [];
|
|
340
|
-
if (isList(value)) {
|
|
341
|
-
for (const cellItem of value) {
|
|
342
|
-
if (!isDict(cellItem))
|
|
343
|
-
continue;
|
|
344
|
-
for (const [ckey, cval] of Object.entries(cellItem)) {
|
|
345
|
-
if (localName(ckey) !== "tc")
|
|
346
|
-
continue;
|
|
347
|
-
if (isList(cval)) {
|
|
348
|
-
// find all w:p inside this w:tc
|
|
349
|
-
const paragraphs = [];
|
|
350
|
-
const collect = (items) => {
|
|
351
|
-
if (!isList(items))
|
|
352
|
-
return;
|
|
353
|
-
for (const x of items) {
|
|
354
|
-
if (!isDict(x))
|
|
355
|
-
continue;
|
|
356
|
-
for (const [k, v] of Object.entries(x)) {
|
|
357
|
-
if (localName(k) === "p" && isList(v)) {
|
|
358
|
-
const t = paragraphText(v);
|
|
359
|
-
if (t)
|
|
360
|
-
paragraphs.push(t);
|
|
361
|
-
}
|
|
362
|
-
else if (isList(v)) {
|
|
363
|
-
collect(v);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
collect(cval);
|
|
369
|
-
cells.push(paragraphs.join(" ").trim());
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (cells.some((c) => c))
|
|
375
|
-
rows.push(cells);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return rowsToMergedLines(rows);
|
|
379
|
-
}
|
|
380
|
-
async function extractEmbeddedXlsx(zip) {
|
|
381
|
-
const results = [];
|
|
382
|
-
const xlsxFiles = [];
|
|
383
|
-
zip.forEach((relativePath) => {
|
|
384
|
-
if (relativePath.includes("embeddings") && relativePath.endsWith(".xlsx")) {
|
|
385
|
-
xlsxFiles.push(relativePath);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
xlsxFiles.sort();
|
|
389
|
-
let index = 0;
|
|
390
|
-
for (const entry of xlsxFiles) {
|
|
391
|
-
index += 1;
|
|
392
|
-
const file = zip.file(entry);
|
|
393
|
-
if (!file)
|
|
394
|
-
continue;
|
|
395
|
-
const buf = await file.async("nodebuffer");
|
|
396
|
-
const sheets = await sheetToRowsFromBuffer(buf);
|
|
397
|
-
for (const sheet of sheets) {
|
|
398
|
-
if (sheet.rows.length > 0) {
|
|
399
|
-
results.push([`Embedded Sheet ${index}: ${sheet.name}`, rowsToMergedLines(sheet.rows)]);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return results;
|
|
404
|
-
}
|
|
405
|
-
export async function convertDocx(source) {
|
|
406
|
-
let zip;
|
|
407
|
-
try {
|
|
408
|
-
zip = await JSZip.loadAsync(fs.readFileSync(source));
|
|
409
|
-
}
|
|
410
|
-
catch (exc) {
|
|
411
|
-
throw new Error("source is not a valid docx zip file");
|
|
412
|
-
}
|
|
413
|
-
const documentXml = zip.file("word/document.xml");
|
|
414
|
-
if (!documentXml)
|
|
415
|
-
throw new Error("docx missing word/document.xml");
|
|
416
|
-
const xmlBytes = await documentXml.async("string");
|
|
417
|
-
const parsed = xmlParser.parse(xmlBytes);
|
|
418
|
-
// find <w:body> inside <w:document>
|
|
419
|
-
let body = null;
|
|
420
|
-
const findBody = (items) => {
|
|
421
|
-
if (!isList(items))
|
|
422
|
-
return;
|
|
423
|
-
for (const item of items) {
|
|
424
|
-
if (!isDict(item))
|
|
425
|
-
continue;
|
|
426
|
-
for (const [key, value] of Object.entries(item)) {
|
|
427
|
-
if (localName(key) === "body" && isList(value)) {
|
|
428
|
-
body = value;
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
if (isList(value))
|
|
432
|
-
findBody(value);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
findBody(parsed);
|
|
437
|
-
const parts = [];
|
|
438
|
-
if (body === null) {
|
|
439
|
-
const collectParagraphs = (items) => {
|
|
440
|
-
if (!isList(items))
|
|
441
|
-
return;
|
|
442
|
-
for (const item of items) {
|
|
443
|
-
if (!isDict(item))
|
|
444
|
-
continue;
|
|
445
|
-
for (const [key, value] of Object.entries(item)) {
|
|
446
|
-
if (localName(key) === "p" && isList(value)) {
|
|
447
|
-
const t = paragraphText(value);
|
|
448
|
-
if (t)
|
|
449
|
-
parts.push(t);
|
|
450
|
-
}
|
|
451
|
-
else if (isList(value)) {
|
|
452
|
-
collectParagraphs(value);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
collectParagraphs(parsed);
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
for (const child of body) {
|
|
461
|
-
if (!isDict(child))
|
|
462
|
-
continue;
|
|
463
|
-
for (const [key, value] of Object.entries(child)) {
|
|
464
|
-
if (key.startsWith("@_") || key === ":@" || key === "#text")
|
|
465
|
-
continue;
|
|
466
|
-
if (!isList(value))
|
|
467
|
-
continue;
|
|
468
|
-
const tag = localName(key);
|
|
469
|
-
if (tag === "p") {
|
|
470
|
-
const t = paragraphText(value);
|
|
471
|
-
if (t)
|
|
472
|
-
parts.push(t);
|
|
473
|
-
}
|
|
474
|
-
else if (tag === "tbl") {
|
|
475
|
-
const t = tableText(value);
|
|
476
|
-
if (t)
|
|
477
|
-
parts.push(t);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
const embedded = await extractEmbeddedXlsx(zip);
|
|
483
|
-
for (const [label, markdown] of embedded) {
|
|
484
|
-
parts.push(`\n## ${label}\n`);
|
|
485
|
-
parts.push(markdown);
|
|
486
|
-
}
|
|
487
|
-
return [parts.join("\n\n"), embedded.length > 0];
|
|
488
|
-
}
|
|
489
|
-
// ---------------------------------------------------------------------------
|
|
490
|
-
// JSON (script-like)
|
|
491
|
-
// ---------------------------------------------------------------------------
|
|
492
|
-
function assetIndex(items, idKey, nameKey, prefix) {
|
|
493
|
-
const result = new Map();
|
|
494
|
-
if (!isList(items))
|
|
495
|
-
return result;
|
|
496
|
-
for (let index = 0; index < items.length; index++) {
|
|
497
|
-
const item = items[index];
|
|
498
|
-
if (!isDict(item))
|
|
499
|
-
continue;
|
|
500
|
-
const rawId = item[idKey] ?? item["id"] ?? fmtId(prefix, index + 1);
|
|
501
|
-
const assetId = strOf(rawId).trim();
|
|
502
|
-
const rawName = item[nameKey] ?? item["name"] ?? assetId;
|
|
503
|
-
const name = strOf(rawName).trim();
|
|
504
|
-
if (assetId && name)
|
|
505
|
-
result.set(assetId, name);
|
|
506
|
-
}
|
|
507
|
-
return result;
|
|
508
|
-
}
|
|
509
|
-
function refId(ref, key) {
|
|
510
|
-
if (typeof ref === "string")
|
|
511
|
-
return ref;
|
|
512
|
-
if (isDict(ref))
|
|
513
|
-
return strOf(ref[key] ?? ref["id"]).trim();
|
|
514
|
-
return "";
|
|
515
|
-
}
|
|
516
|
-
function refNames(refs, index, key) {
|
|
517
|
-
if (!isList(refs))
|
|
518
|
-
return [];
|
|
519
|
-
const names = [];
|
|
520
|
-
for (const ref of refs) {
|
|
521
|
-
const name = index.get(refId(ref, key));
|
|
522
|
-
if (name && !names.includes(name))
|
|
523
|
-
names.push(name);
|
|
524
|
-
}
|
|
525
|
-
return names;
|
|
526
|
-
}
|
|
527
|
-
function firstRefName(refs, index, key) {
|
|
528
|
-
const names = refNames(refs, index, key);
|
|
529
|
-
return names[0] ?? "";
|
|
530
|
-
}
|
|
531
|
-
export async function convertJson(source) {
|
|
532
|
-
const text = readText(source).replace(/^/, "");
|
|
533
|
-
const data = JSON.parse(text);
|
|
534
|
-
if (!isDict(data) || !isList(data["episodes"])) {
|
|
535
|
-
throw new Error("JSON is not a script.json-like object with episodes[]");
|
|
536
|
-
}
|
|
537
|
-
const actors = assetIndex(data["actors"], "actor_id", "actor_name", "act");
|
|
538
|
-
const locations = assetIndex(data["locations"], "location_id", "location_name", "loc");
|
|
539
|
-
const props = assetIndex(data["props"], "prop_id", "prop_name", "prp");
|
|
540
|
-
const parts = [];
|
|
541
|
-
const title = strOf(data["title"] || path.basename(source, path.extname(source))).trim();
|
|
542
|
-
if (title)
|
|
543
|
-
parts.push(`# ${title}`);
|
|
544
|
-
const episodes = asList(data["episodes"]);
|
|
545
|
-
for (let epIndex = 0; epIndex < episodes.length; epIndex++) {
|
|
546
|
-
const episode = episodes[epIndex];
|
|
547
|
-
if (!isDict(episode))
|
|
548
|
-
continue;
|
|
549
|
-
const epNum = episodeNumberFromValue(episode["episode_id"]) ||
|
|
550
|
-
episodeNumberFromValue(episode["episode"]) ||
|
|
551
|
-
episodeNumberFromValue(episode["id"]) ||
|
|
552
|
-
epIndex + 1;
|
|
553
|
-
const rawEpTitle = strOf(episode["title"]).trim();
|
|
554
|
-
let epShortTitle = cleanEpisodeShortTitle(rawEpTitle);
|
|
555
|
-
if (isTechnicalEpisodeTitle(rawEpTitle))
|
|
556
|
-
epShortTitle = "";
|
|
557
|
-
parts.push(epShortTitle ? `\n第${epNum}集:${epShortTitle}` : `\n第${epNum}集`);
|
|
558
|
-
const scenes = asList(episode["scenes"]);
|
|
559
|
-
for (let sceneIndex = 0; sceneIndex < scenes.length; sceneIndex++) {
|
|
560
|
-
const scene = scenes[sceneIndex];
|
|
561
|
-
if (!isDict(scene))
|
|
562
|
-
continue;
|
|
563
|
-
const locName = firstRefName(scene["locations"], locations, "location_id") || "未知场景";
|
|
564
|
-
parts.push(`${epNum}-${sceneIndex + 1} 日 内 ${locName}`);
|
|
565
|
-
const actorNames = refNames(scene["actors"], actors, "actor_id");
|
|
566
|
-
if (actorNames.length > 0)
|
|
567
|
-
parts.push(`人物:${actorNames.join("、")}`);
|
|
568
|
-
const propNames = refNames(scene["props"], props, "prop_id");
|
|
569
|
-
if (propNames.length > 0)
|
|
570
|
-
parts.push(`道具:${propNames.join("、")}`);
|
|
571
|
-
for (const action of asList(scene["actions"])) {
|
|
572
|
-
if (!isDict(action))
|
|
573
|
-
continue;
|
|
574
|
-
const content = strOf(action["content"]).trim();
|
|
575
|
-
if (!content)
|
|
576
|
-
continue;
|
|
577
|
-
const actorName = actors.get(strOf(action["actor_id"]).trim()) ?? "";
|
|
578
|
-
if (action["type"] === "dialogue" && actorName) {
|
|
579
|
-
parts.push(`${actorName}:${content}`);
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
parts.push(content);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
return [parts.join("\n").trim() + "\n", false, "script"];
|
|
588
|
-
}
|
|
589
|
-
// ---------------------------------------------------------------------------
|
|
590
|
-
// Source preparation
|
|
591
|
-
// ---------------------------------------------------------------------------
|
|
592
|
-
export async function prepareSource(sourcePath, workspace) {
|
|
593
|
-
const ext = path.extname(sourcePath).toLowerCase();
|
|
594
|
-
let content;
|
|
595
|
-
let hasStoryboard = false;
|
|
596
|
-
let explicitMode = null;
|
|
597
|
-
if (ext === ".txt" || ext === ".md") {
|
|
598
|
-
content = convertTxt(sourcePath);
|
|
599
|
-
}
|
|
600
|
-
else if (ext === ".json") {
|
|
601
|
-
const [text, sb, mode] = await convertJson(sourcePath);
|
|
602
|
-
content = text;
|
|
603
|
-
hasStoryboard = sb;
|
|
604
|
-
explicitMode = mode;
|
|
605
|
-
}
|
|
606
|
-
else if (ext === ".docx") {
|
|
607
|
-
const [text, sb] = await convertDocx(sourcePath);
|
|
608
|
-
content = text;
|
|
609
|
-
hasStoryboard = sb;
|
|
610
|
-
}
|
|
611
|
-
else if (ext === ".xlsx") {
|
|
612
|
-
content = await convertXlsx(sourcePath);
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
throw new Error(`Unsupported file format: ${ext}`);
|
|
616
|
-
}
|
|
617
|
-
const sourceTextPath = path.join(workspace, "source.txt");
|
|
618
|
-
writeText(sourceTextPath, content);
|
|
619
|
-
const mode = explicitMode || (hasStoryboard ? "storyboard" : "script");
|
|
620
|
-
return {
|
|
621
|
-
projectName: path.basename(sourcePath, ext),
|
|
622
|
-
projectPath: path.resolve(workspace),
|
|
623
|
-
originalSourcePath: path.resolve(sourcePath),
|
|
624
|
-
sourceTextPath: path.resolve(sourceTextPath),
|
|
625
|
-
format: ext,
|
|
626
|
-
mode,
|
|
627
|
-
chars: Array.from(content).length,
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
export function makeSourceManifest(sourcePath, sourceTextPath, info) {
|
|
631
|
-
const text = readText(sourceTextPath);
|
|
632
|
-
const lineStarts = [];
|
|
633
|
-
let cursor = 0;
|
|
634
|
-
// Mirror Python splitlines(keepends=True)
|
|
635
|
-
const rawLines = [];
|
|
636
|
-
let start = 0;
|
|
637
|
-
let i = 0;
|
|
638
|
-
while (i < text.length) {
|
|
639
|
-
const ch = text[i];
|
|
640
|
-
if (ch === "\n") {
|
|
641
|
-
rawLines.push(text.slice(start, i + 1));
|
|
642
|
-
i += 1;
|
|
643
|
-
start = i;
|
|
644
|
-
}
|
|
645
|
-
else if (ch === "\r") {
|
|
646
|
-
if (text[i + 1] === "\n") {
|
|
647
|
-
rawLines.push(text.slice(start, i + 2));
|
|
648
|
-
i += 2;
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
rawLines.push(text.slice(start, i + 1));
|
|
652
|
-
i += 1;
|
|
653
|
-
}
|
|
654
|
-
start = i;
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
i += 1;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
if (start < text.length)
|
|
661
|
-
rawLines.push(text.slice(start));
|
|
662
|
-
for (const raw of rawLines) {
|
|
663
|
-
lineStarts.push(cursor);
|
|
664
|
-
cursor += raw.length;
|
|
665
|
-
}
|
|
666
|
-
const linesNoEnd = text.split(/\r\n|\r|\n/);
|
|
667
|
-
if (text.endsWith("\n") || text.endsWith("\r"))
|
|
668
|
-
linesNoEnd.pop();
|
|
669
|
-
return {
|
|
670
|
-
version: 1,
|
|
671
|
-
source_path: path.resolve(sourcePath),
|
|
672
|
-
source_name: path.basename(sourcePath),
|
|
673
|
-
source_ext: path.extname(sourcePath).toLowerCase(),
|
|
674
|
-
source_sha256: sha256File(sourcePath),
|
|
675
|
-
source_text_path: path.resolve(sourceTextPath),
|
|
676
|
-
source_text_sha256: sha256Text(text),
|
|
677
|
-
chars: text.length,
|
|
678
|
-
lines: linesNoEnd.length,
|
|
679
|
-
line_starts: lineStarts,
|
|
680
|
-
prepare: {
|
|
681
|
-
mode: info["mode"],
|
|
682
|
-
format: info["format"],
|
|
683
|
-
chars: info["chars"],
|
|
684
|
-
},
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
// suppress unused warnings on Node Buffer/Uint8Array helpers
|
|
688
|
-
void os;
|
|
689
|
-
//# sourceMappingURL=converters.js.map
|