@lingjingai/scriptctl 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -5
- package/changes/0.35.0.md +22 -0
- package/changes/0.36.0.md +22 -0
- package/changes/unreleased.md +3 -5
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +56 -128
- package/dist/cli.js.map +1 -1
- package/dist/common.d.ts +0 -16
- package/dist/common.js +2 -342
- package/dist/common.js.map +1 -1
- package/dist/domain/ingest/apply-plan.d.ts +23 -0
- package/dist/domain/ingest/apply-plan.js +210 -0
- package/dist/domain/ingest/apply-plan.js.map +1 -0
- package/dist/domain/ingest/assembler.d.ts +57 -0
- package/dist/domain/ingest/assembler.js +181 -0
- package/dist/domain/ingest/assembler.js.map +1 -0
- package/dist/domain/ingest/chunker.d.ts +9 -0
- package/dist/domain/ingest/chunker.js +38 -0
- package/dist/domain/ingest/chunker.js.map +1 -0
- package/dist/domain/ingest/evidence.d.ts +5 -0
- package/dist/domain/ingest/evidence.js +66 -0
- package/dist/domain/ingest/evidence.js.map +1 -0
- package/dist/domain/ingest/govern.d.ts +3 -0
- package/dist/domain/ingest/govern.js +127 -0
- package/dist/domain/ingest/govern.js.map +1 -0
- package/dist/domain/ingest/jsonl-parser.d.ts +6 -0
- package/dist/domain/ingest/jsonl-parser.js +187 -0
- package/dist/domain/ingest/jsonl-parser.js.map +1 -0
- package/dist/domain/ingest/markdown-parser.d.ts +6 -0
- package/dist/domain/ingest/markdown-parser.js +186 -0
- package/dist/domain/ingest/markdown-parser.js.map +1 -0
- package/dist/domain/ingest/records.d.ts +71 -0
- package/dist/domain/ingest/records.js +9 -0
- package/dist/domain/ingest/records.js.map +1 -0
- package/dist/domain/ingest/renumber.d.ts +14 -0
- package/dist/domain/ingest/renumber.js +130 -0
- package/dist/domain/ingest/renumber.js.map +1 -0
- package/dist/domain/ingest/script-v3.d.ts +94 -0
- package/dist/domain/ingest/script-v3.js +7 -0
- package/dist/domain/ingest/script-v3.js.map +1 -0
- package/dist/domain/ingest/state-reconcile.d.ts +11 -0
- package/dist/domain/ingest/state-reconcile.js +90 -0
- package/dist/domain/ingest/state-reconcile.js.map +1 -0
- package/dist/domain/ingest/validation.d.ts +11 -0
- package/dist/domain/ingest/validation.js +168 -0
- package/dist/domain/ingest/validation.js.map +1 -0
- package/dist/domain/ingest/video-aggregate.d.ts +23 -0
- package/dist/domain/ingest/video-aggregate.js +89 -0
- package/dist/domain/ingest/video-aggregate.js.map +1 -0
- package/dist/domain/ingest/video-apply.d.ts +37 -0
- package/dist/domain/ingest/video-apply.js +236 -0
- package/dist/domain/ingest/video-apply.js.map +1 -0
- package/dist/domain/ingest/video-md-parser.d.ts +2 -0
- package/dist/domain/ingest/video-md-parser.js +233 -0
- package/dist/domain/ingest/video-md-parser.js.map +1 -0
- package/dist/domain/ingest/video-records.d.ts +56 -0
- package/dist/domain/ingest/video-records.js +9 -0
- package/dist/domain/ingest/video-records.js.map +1 -0
- package/dist/domain/loom/index.d.ts +2 -1
- package/dist/domain/loom/index.js +12 -10
- package/dist/domain/loom/index.js.map +1 -1
- package/dist/domain/loom/types.d.ts +3 -2
- package/dist/domain/script/lookups.d.ts +3 -2
- package/dist/domain/script/lookups.js +25 -8
- package/dist/domain/script/lookups.js.map +1 -1
- package/dist/domain/script/patch/apply.js +2 -2
- package/dist/domain/script/patch/apply.js.map +1 -1
- package/dist/domain/script/patch/helpers.d.ts +3 -7
- package/dist/domain/script/patch/helpers.js +23 -96
- package/dist/domain/script/patch/helpers.js.map +1 -1
- package/dist/domain/script/patch/ops-action.d.ts +0 -2
- package/dist/domain/script/patch/ops-action.js +34 -100
- package/dist/domain/script/patch/ops-action.js.map +1 -1
- package/dist/domain/script/patch/ops-asset.d.ts +1 -0
- package/dist/domain/script/patch/ops-asset.js +102 -155
- package/dist/domain/script/patch/ops-asset.js.map +1 -1
- package/dist/domain/script/patch/ops-dialogue.d.ts +1 -4
- package/dist/domain/script/patch/ops-dialogue.js +43 -220
- package/dist/domain/script/patch/ops-dialogue.js.map +1 -1
- package/dist/domain/script/patch/ops-extend.js +8 -2
- package/dist/domain/script/patch/ops-extend.js.map +1 -1
- package/dist/domain/script/patch/ops-meta.js.map +1 -1
- package/dist/domain/script/patch/ops-scene.js +26 -39
- package/dist/domain/script/patch/ops-scene.js.map +1 -1
- package/dist/domain/script/patch/ops-state.d.ts +3 -3
- package/dist/domain/script/patch/ops-state.js +33 -49
- package/dist/domain/script/patch/ops-state.js.map +1 -1
- package/dist/domain/script/patch/registry.js +9 -13
- package/dist/domain/script/patch/registry.js.map +1 -1
- package/dist/domain/script/refs.js +23 -111
- package/dist/domain/script/refs.js.map +1 -1
- package/dist/domain/script/scene-refs.d.ts +3 -0
- package/dist/domain/script/scene-refs.js +35 -0
- package/dist/domain/script/scene-refs.js.map +1 -0
- package/dist/domain/script/schema.js +17 -21
- package/dist/domain/script/schema.js.map +1 -1
- package/dist/domain/script/text-util.d.ts +7 -0
- package/dist/domain/script/text-util.js +91 -0
- package/dist/domain/script/text-util.js.map +1 -0
- package/dist/help-text.js +145 -414
- package/dist/help-text.js.map +1 -1
- package/dist/infra/converters.js +1 -1
- package/dist/infra/converters.js.map +1 -1
- package/dist/infra/episode-title.d.ts +4 -0
- package/dist/infra/episode-title.js +129 -0
- package/dist/infra/episode-title.js.map +1 -0
- package/dist/infra/ingest/review-renderer.d.ts +1 -0
- package/dist/infra/ingest/review-renderer.js +431 -0
- package/dist/infra/ingest/review-renderer.js.map +1 -0
- package/dist/infra/ingest/source-resolver.d.ts +21 -0
- package/dist/infra/ingest/source-resolver.js +51 -0
- package/dist/infra/ingest/source-resolver.js.map +1 -0
- package/dist/infra/ingest/text-reader.d.ts +3 -0
- package/dist/infra/ingest/text-reader.js +27 -0
- package/dist/infra/ingest/text-reader.js.map +1 -0
- package/dist/infra/ingest/video-discovery.d.ts +8 -0
- package/dist/infra/ingest/video-discovery.js +60 -0
- package/dist/infra/ingest/video-discovery.js.map +1 -0
- package/dist/infra/ingest/workspace-store.d.ts +18 -0
- package/dist/infra/ingest/workspace-store.js +70 -0
- package/dist/infra/ingest/workspace-store.js.map +1 -0
- package/dist/infra/llm/anthropic-model.d.ts +11 -0
- package/dist/infra/llm/anthropic-model.js +109 -0
- package/dist/infra/llm/anthropic-model.js.map +1 -0
- package/dist/infra/llm/gemini-upload.d.ts +9 -0
- package/dist/infra/llm/gemini-upload.js +94 -0
- package/dist/infra/llm/gemini-upload.js.map +1 -0
- package/dist/infra/llm/gemini-video-model.d.ts +47 -0
- package/dist/infra/llm/gemini-video-model.js +167 -0
- package/dist/infra/llm/gemini-video-model.js.map +1 -0
- package/dist/infra/llm/openai-compatible-model.d.ts +13 -0
- package/dist/infra/llm/openai-compatible-model.js +143 -0
- package/dist/infra/llm/openai-compatible-model.js.map +1 -0
- package/dist/infra/llm/proxy.d.ts +1 -0
- package/dist/infra/llm/proxy.js +30 -0
- package/dist/infra/llm/proxy.js.map +1 -0
- package/dist/infra/llm/retry.d.ts +5 -0
- package/dist/infra/llm/retry.js +20 -0
- package/dist/infra/llm/retry.js.map +1 -0
- package/dist/llm/composition.d.ts +5 -0
- package/dist/llm/composition.js +5 -0
- package/dist/llm/composition.js.map +1 -0
- package/dist/llm/config.d.ts +26 -0
- package/dist/llm/config.js +201 -0
- package/dist/llm/config.js.map +1 -0
- package/dist/llm/registry.d.ts +44 -0
- package/dist/llm/registry.js +48 -0
- package/dist/llm/registry.js.map +1 -0
- package/dist/llm/router.d.ts +23 -0
- package/dist/llm/router.js +0 -0
- package/dist/llm/router.js.map +1 -0
- package/dist/llm/tasks/ingest/asset-curate.d.ts +13 -0
- package/dist/llm/tasks/ingest/asset-curate.js +45 -0
- package/dist/llm/tasks/ingest/asset-curate.js.map +1 -0
- package/dist/llm/tasks/ingest/asset-extract.d.ts +12 -0
- package/dist/llm/tasks/ingest/asset-extract.js +51 -0
- package/dist/llm/tasks/ingest/asset-extract.js.map +1 -0
- package/dist/llm/tasks/ingest/asset-govern.d.ts +22 -0
- package/dist/llm/tasks/ingest/asset-govern.js +143 -0
- package/dist/llm/tasks/ingest/asset-govern.js.map +1 -0
- package/dist/llm/tasks/ingest/mention-resolve.d.ts +9 -0
- package/dist/llm/tasks/ingest/mention-resolve.js +39 -0
- package/dist/llm/tasks/ingest/mention-resolve.js.map +1 -0
- package/dist/llm/tasks/ingest/plot-speaker.d.ts +11 -0
- package/dist/llm/tasks/ingest/plot-speaker.js +72 -0
- package/dist/llm/tasks/ingest/plot-speaker.js.map +1 -0
- package/dist/llm/tasks/ingest/roster-merge.d.ts +46 -0
- package/dist/llm/tasks/ingest/roster-merge.js +235 -0
- package/dist/llm/tasks/ingest/roster-merge.js.map +1 -0
- package/dist/llm/tasks/ingest/state-merge.d.ts +10 -0
- package/dist/llm/tasks/ingest/state-merge.js +84 -0
- package/dist/llm/tasks/ingest/state-merge.js.map +1 -0
- package/dist/llm/tasks/ingest/state-reconcile.d.ts +8 -0
- package/dist/llm/tasks/ingest/state-reconcile.js +44 -0
- package/dist/llm/tasks/ingest/state-reconcile.js.map +1 -0
- package/dist/llm/tasks/ingest/text-normalize.d.ts +10 -0
- package/dist/llm/tasks/ingest/text-normalize.js +89 -0
- package/dist/llm/tasks/ingest/text-normalize.js.map +1 -0
- package/dist/llm/tasks/ingest/video-correct.d.ts +30 -0
- package/dist/llm/tasks/ingest/video-correct.js +144 -0
- package/dist/llm/tasks/ingest/video-correct.js.map +1 -0
- package/dist/llm/tasks/ingest/video-transcribe.d.ts +4 -0
- package/dist/llm/tasks/ingest/video-transcribe.js +105 -0
- package/dist/llm/tasks/ingest/video-transcribe.js.map +1 -0
- package/dist/llm/tasks/schemas.d.ts +5 -0
- package/dist/llm/tasks/schemas.js +107 -0
- package/dist/llm/tasks/schemas.js.map +1 -0
- package/dist/llm/types.d.ts +97 -0
- package/dist/llm/types.js +13 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/usecases/doctor.d.ts +1 -1
- package/dist/usecases/doctor.js +36 -9
- package/dist/usecases/doctor.js.map +1 -1
- package/dist/usecases/ingest/command.d.ts +5 -0
- package/dist/usecases/ingest/command.js +57 -0
- package/dist/usecases/ingest/command.js.map +1 -0
- package/dist/usecases/ingest/fanout.d.ts +10 -0
- package/dist/usecases/ingest/fanout.js +23 -0
- package/dist/usecases/ingest/fanout.js.map +1 -0
- package/dist/usecases/ingest/pass4-mention-resolve.d.ts +11 -0
- package/dist/usecases/ingest/pass4-mention-resolve.js +52 -0
- package/dist/usecases/ingest/pass4-mention-resolve.js.map +1 -0
- package/dist/usecases/ingest/pass5-extract.d.ts +7 -0
- package/dist/usecases/ingest/pass5-extract.js +50 -0
- package/dist/usecases/ingest/pass5-extract.js.map +1 -0
- package/dist/usecases/ingest/pass5-govern.d.ts +13 -0
- package/dist/usecases/ingest/pass5-govern.js +155 -0
- package/dist/usecases/ingest/pass5-govern.js.map +1 -0
- package/dist/usecases/ingest/pipeline.d.ts +28 -0
- package/dist/usecases/ingest/pipeline.js +144 -0
- package/dist/usecases/ingest/pipeline.js.map +1 -0
- package/dist/usecases/ingest/publish-command.d.ts +4 -0
- package/dist/usecases/ingest/publish-command.js +77 -0
- package/dist/usecases/ingest/publish-command.js.map +1 -0
- package/dist/usecases/ingest/status.d.ts +39 -0
- package/dist/usecases/ingest/status.js +155 -0
- package/dist/usecases/ingest/status.js.map +1 -0
- package/dist/usecases/ingest/video-pass3.d.ts +26 -0
- package/dist/usecases/ingest/video-pass3.js +0 -0
- package/dist/usecases/ingest/video-pass3.js.map +1 -0
- package/dist/usecases/ingest/video-pipeline.d.ts +32 -0
- package/dist/usecases/ingest/video-pipeline.js +202 -0
- package/dist/usecases/ingest/video-pipeline.js.map +1 -0
- package/dist/usecases/ingest/view-command.d.ts +4 -0
- package/dist/usecases/ingest/view-command.js +51 -0
- package/dist/usecases/ingest/view-command.js.map +1 -0
- package/dist/usecases/script/actions.js +2 -2
- package/dist/usecases/script/actions.js.map +1 -1
- package/dist/usecases/script/actor.js.map +1 -1
- package/dist/usecases/script/actors.js +1 -0
- package/dist/usecases/script/actors.js.map +1 -1
- package/dist/usecases/script/add-actor.js.map +1 -1
- package/dist/usecases/script/add-episode.js.map +1 -1
- package/dist/usecases/script/add-location.js.map +1 -1
- package/dist/usecases/script/add-prop.js.map +1 -1
- package/dist/usecases/script/alias.js.map +1 -1
- package/dist/usecases/script/assets.js +2 -1
- package/dist/usecases/script/assets.js.map +1 -1
- package/dist/usecases/script/context.js.map +1 -1
- package/dist/usecases/script/create.js +3 -6
- package/dist/usecases/script/create.js.map +1 -1
- package/dist/usecases/script/delete.js.map +1 -1
- package/dist/usecases/script/describe.js.map +1 -1
- package/dist/usecases/script/dialogue.js +6 -13
- package/dist/usecases/script/dialogue.js.map +1 -1
- package/dist/usecases/script/do.js +1 -1
- package/dist/usecases/script/do.js.map +1 -1
- package/dist/usecases/script/episodes.js.map +1 -1
- package/dist/usecases/script/{add-speaker.d.ts → importance.d.ts} +1 -1
- package/dist/usecases/script/importance.js +17 -0
- package/dist/usecases/script/importance.js.map +1 -0
- package/dist/usecases/script/insert.js.map +1 -1
- package/dist/usecases/script/issues.js.map +1 -1
- package/dist/usecases/script/lib.d.ts +19 -6
- package/dist/usecases/script/lib.js +173 -99
- package/dist/usecases/script/lib.js.map +1 -1
- package/dist/usecases/script/locations.js +1 -0
- package/dist/usecases/script/locations.js.map +1 -1
- package/dist/usecases/script/merge.js.map +1 -1
- package/dist/usecases/script/move.js.map +1 -1
- package/dist/usecases/script/props.js +1 -0
- package/dist/usecases/script/props.js.map +1 -1
- package/dist/usecases/script/refs.js.map +1 -1
- package/dist/usecases/script/rename.js.map +1 -1
- package/dist/usecases/script/replace.js.map +1 -1
- package/dist/usecases/script/role.js.map +1 -1
- package/dist/usecases/script/scenes.js +8 -15
- package/dist/usecases/script/scenes.js.map +1 -1
- package/dist/usecases/script/script-patch.js +1 -1
- package/dist/usecases/script/script-patch.js.map +1 -1
- package/dist/usecases/script/script-validate.js +1 -1
- package/dist/usecases/script/script-validate.js.map +1 -1
- package/dist/usecases/script/session.d.ts +4 -4
- package/dist/usecases/script/session.js +57 -78
- package/dist/usecases/script/session.js.map +1 -1
- package/dist/usecases/script/split.js.map +1 -1
- package/dist/usecases/script/state-add.js.map +1 -1
- package/dist/usecases/script/state-delete.js.map +1 -1
- package/dist/usecases/script/state-rename.js.map +1 -1
- package/dist/usecases/script/states.js +58 -13
- package/dist/usecases/script/states.js.map +1 -1
- package/dist/usecases/script/summary.js +8 -0
- package/dist/usecases/script/summary.js.map +1 -1
- package/dist/usecases/script/synopsis-generate.d.ts +4 -5
- package/dist/usecases/script/synopsis-generate.js +30 -46
- package/dist/usecases/script/synopsis-generate.js.map +1 -1
- package/dist/usecases/script/transition.js.map +1 -1
- package/dist/usecases/script/type.js.map +1 -1
- package/dist/usecases/script/worldview.js.map +1 -1
- package/package.json +11 -3
- package/scripts/install-skill.mjs +120 -0
- package/skills/scriptctl/SKILL.md +293 -0
- package/skills/scriptctl/references/atomic-write-workflow.md +117 -0
- package/skills/scriptctl/references/ingest-workflow.md +85 -0
- package/skills/scriptctl/references/state-reference-repair.md +59 -0
- package/dist/domain/direct/runner.d.ts +0 -25
- package/dist/domain/direct/runner.js +0 -88
- package/dist/domain/direct/runner.js.map +0 -1
- package/dist/domain/direct/stage.d.ts +0 -108
- package/dist/domain/direct/stage.js +0 -134
- package/dist/domain/direct/stage.js.map +0 -1
- package/dist/domain/direct/stages/asset-curation.d.ts +0 -2
- package/dist/domain/direct/stages/asset-curation.js +0 -10
- package/dist/domain/direct/stages/asset-curation.js.map +0 -1
- package/dist/domain/direct/stages/batch-extract.d.ts +0 -2
- package/dist/domain/direct/stages/batch-extract.js +0 -12
- package/dist/domain/direct/stages/batch-extract.js.map +0 -1
- package/dist/domain/direct/stages/batch-plan.d.ts +0 -2
- package/dist/domain/direct/stages/batch-plan.js +0 -9
- package/dist/domain/direct/stages/batch-plan.js.map +0 -1
- package/dist/domain/direct/stages/episode-merge.d.ts +0 -2
- package/dist/domain/direct/stages/episode-merge.js +0 -11
- package/dist/domain/direct/stages/episode-merge.js.map +0 -1
- package/dist/domain/direct/stages/episode-plan.d.ts +0 -2
- package/dist/domain/direct/stages/episode-plan.js +0 -9
- package/dist/domain/direct/stages/episode-plan.js.map +0 -1
- package/dist/domain/direct/stages/episode-synopsis.d.ts +0 -2
- package/dist/domain/direct/stages/episode-synopsis.js +0 -12
- package/dist/domain/direct/stages/episode-synopsis.js.map +0 -1
- package/dist/domain/direct/stages/episode-titles.d.ts +0 -2
- package/dist/domain/direct/stages/episode-titles.js +0 -12
- package/dist/domain/direct/stages/episode-titles.js.map +0 -1
- package/dist/domain/direct/stages/index.d.ts +0 -19
- package/dist/domain/direct/stages/index.js +0 -41
- package/dist/domain/direct/stages/index.js.map +0 -1
- package/dist/domain/direct/stages/metadata.d.ts +0 -2
- package/dist/domain/direct/stages/metadata.js +0 -11
- package/dist/domain/direct/stages/metadata.js.map +0 -1
- package/dist/domain/direct/stages/script-merge.d.ts +0 -2
- package/dist/domain/direct/stages/script-merge.js +0 -15
- package/dist/domain/direct/stages/script-merge.js.map +0 -1
- package/dist/domain/direct/stages/script-synopsis.d.ts +0 -2
- package/dist/domain/direct/stages/script-synopsis.js +0 -12
- package/dist/domain/direct/stages/script-synopsis.js.map +0 -1
- package/dist/domain/direct/stages/source-prepare.d.ts +0 -2
- package/dist/domain/direct/stages/source-prepare.js +0 -9
- package/dist/domain/direct/stages/source-prepare.js.map +0 -1
- package/dist/domain/direct/stages/state-binding.d.ts +0 -2
- package/dist/domain/direct/stages/state-binding.js +0 -9
- package/dist/domain/direct/stages/state-binding.js.map +0 -1
- package/dist/domain/direct/stages/state-curation.d.ts +0 -2
- package/dist/domain/direct/stages/state-curation.js +0 -10
- package/dist/domain/direct/stages/state-curation.js.map +0 -1
- package/dist/domain/direct/stages/validate.d.ts +0 -2
- package/dist/domain/direct/stages/validate.js +0 -10
- package/dist/domain/direct/stages/validate.js.map +0 -1
- package/dist/domain/direct-core.d.ts +0 -313
- package/dist/domain/direct-core.js +0 -8516
- package/dist/domain/direct-core.js.map +0 -1
- package/dist/domain/script/validate.d.ts +0 -22
- package/dist/domain/script/validate.js +0 -997
- package/dist/domain/script/validate.js.map +0 -1
- package/dist/infra/providers.d.ts +0 -97
- package/dist/infra/providers.js +0 -1396
- package/dist/infra/providers.js.map +0 -1
- package/dist/usecases/direct.d.ts +0 -27
- package/dist/usecases/direct.js +0 -4172
- package/dist/usecases/direct.js.map +0 -1
- package/dist/usecases/parse.d.ts +0 -15
- package/dist/usecases/parse.js +0 -429
- package/dist/usecases/parse.js.map +0 -1
- package/dist/usecases/script/add-speaker.js +0 -22
- package/dist/usecases/script/add-speaker.js.map +0 -1
- package/dist/usecases/script/export.d.ts +0 -3
- package/dist/usecases/script/export.js +0 -111
- package/dist/usecases/script/export.js.map +0 -1
- package/dist/usecases/script/overlap.d.ts +0 -3
- package/dist/usecases/script/overlap.js +0 -21
- package/dist/usecases/script/overlap.js.map +0 -1
- package/dist/usecases/script/speakers.d.ts +0 -3
- package/dist/usecases/script/speakers.js +0 -28
- package/dist/usecases/script/speakers.js.map +0 -1
- package/dist/usecases/script/state-change.d.ts +0 -3
- package/dist/usecases/script/state-change.js +0 -24
- package/dist/usecases/script/state-change.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Report } from "../../common.js";
|
|
2
2
|
import { type Dict } from "../../domain/script/shared.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function commandImportance(opts: Dict): Promise<[Report, number]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CliError, EXIT_USAGE } from "../../common.js";
|
|
2
|
+
import { asList } from "../../domain/script/shared.js";
|
|
3
|
+
import { applySingleScriptOp } from "./lib.js";
|
|
4
|
+
export async function commandImportance(opts) {
|
|
5
|
+
const args = asList(opts["_args"]);
|
|
6
|
+
if (args.length < 2) {
|
|
7
|
+
throw new CliError("VERB BLOCKED: Importance args missing", "Importance args missing.", {
|
|
8
|
+
exitCode: EXIT_USAGE,
|
|
9
|
+
required: ["<kind:id> <featured|background>"],
|
|
10
|
+
received: args,
|
|
11
|
+
nextSteps: ["Example: scriptctl importance actor:act_001 background"],
|
|
12
|
+
errorCode: "ARGS_MISSING",
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return applySingleScriptOp(opts, { op: "importance.set", target: args[0], importance: args[1] });
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=importance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importance.js","sourceRoot":"","sources":["../../../src/usecases/script/importance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAa,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAU;IAChD,MAAM,IAAI,GAAG,MAAM,CAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,QAAQ,CAAC,uCAAuC,EAAE,0BAA0B,EAAE;YACtF,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,CAAC,iCAAiC,CAAC;YAC7C,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,CAAC,wDAAwD,CAAC;YACrE,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../../src/usecases/script/insert.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAKR,UAAU,GASX,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACL,eAAe,GAKhB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../../src/usecases/script/insert.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAKR,UAAU,GASX,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACL,eAAe,GAKhB,MAAM,gCAAgC,CAAC;AAWxC,OAAO,EACL,MAAM,GAKP,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAC+I,mBAAmB,GACxK,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAU;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,QAAQ,CAAC,sCAAsC,EAAE,yBAAyB,EAAE;YACpF,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,CAAC,iEAAiE,CAAC;YAC7E,QAAQ,EAAE,CAAC,SAAS,CAAC;YACrB,SAAS,EAAE,CAAC,0EAA0E,CAAC;YACvF,SAAS,EAAE,iBAAiB;SAC7B,CAAC,CAAC;IACL,CAAC;IACD,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,sEAAsE;IACtE,aAAa;IACb,uEAAuE;IACvE,yEAAyE;IACzE,qEAAqE;IACrE,MAAM,SAAS,GAAG;QAChB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS;QAChC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,SAAS;QACtC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,SAAS;QACtC,KAAK,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,SAAS;QACxD,OAAO,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,SAAS;QAC9D,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,SAAS;QACxC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS;QAChC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;QAClC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,SAAS;KAC3C,CAAC;IACF,SAAS,WAAW,CAAC,IAAY,EAAE,OAAsC;QACvE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,OAAO,CAAC,CAAC;QACvC,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAkC,EAAE,CAAC;YACxE,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,QAAQ,CAAC,mCAAmC,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,IAAI,UAAU,EAAE;gBAC/G,QAAQ,EAAE,UAAU;gBACpB,QAAQ,EAAE,CAAC,OAAO,IAAI,YAAY,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7E,QAAQ,EAAE,GAAG;gBACb,SAAS,EAAE,CAAC,yCAAyC,CAAC;gBACtD,SAAS,EAAE,qBAAqB;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC1B,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;QAC1E,OAAO,mBAAmB,CAAC,IAAI,EAAE;YAC/B,EAAE,EAAE,eAAe;YACnB,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;YACX,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;YACxB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;YACxB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;YACxC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;YACpB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC;YAC3C,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC;SAClD,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,WAAW,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAChE,OAAO,mBAAmB,CAAC,IAAI,EAAE;YAC/B,EAAE,EAAE,cAAc;YAClB,EAAE,EAAE,IAAI,CAAC,SAAS;YAClB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;YAC1B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAClB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;YACpB,wEAAwE;YACxE,yEAAyE;YACzE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;YACxC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;SACrB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,IAAI,QAAQ,CAAC,qDAAqD,EAAE,wCAAwC,EAAE;QAClH,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,CAAC,yDAAyD,CAAC;QACrE,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;QACpB,SAAS,EAAE,CAAC,kCAAkC,CAAC;QAC/C,SAAS,EAAE,qBAAqB;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../../src/usecases/script/issues.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,OAAO,GAWR,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../../src/usecases/script/issues.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,OAAO,GAWR,MAAM,iBAAiB,CAAC;AA6BzB,OAAO,EACL,MAAM,EAIN,KAAK,GACN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,iBAAiB,EAAE,eAAe,GAEnC,MAAM,cAAc,CAAC;AACtB,OAAO,EAC6P,WAAW,GAC9Q,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAU;IAC5C,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACvD,IAAI,cAAc,IAAI,cAAc,KAAK,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAAE,SAAS;QAC5E,IAAI,UAAU,IAAI,UAAU,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAAE,SAAS;QAChE,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC;YACrD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS;gBAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC;AAED,+EAA+E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliError, type Report } from "../../common.js";
|
|
2
2
|
import { type InSelector } from "../../domain/script/selector.js";
|
|
3
|
-
import { sortDeep } from "../../domain/
|
|
3
|
+
import { sortDeep } from "../../domain/script/text-util.js";
|
|
4
4
|
import { type Dict } from "../../domain/script/shared.js";
|
|
5
5
|
import { ScriptEditSession } from "./session.js";
|
|
6
6
|
export interface DoToken {
|
|
@@ -37,11 +37,18 @@ export declare function contextTemplate(target: string, f: {
|
|
|
37
37
|
clear?: boolean;
|
|
38
38
|
remove?: boolean;
|
|
39
39
|
}): Dict;
|
|
40
|
-
export declare function dialogueTemplate(
|
|
41
|
-
|
|
40
|
+
export declare function dialogueTemplate(f: {
|
|
41
|
+
actor?: unknown;
|
|
42
|
+
kind?: unknown;
|
|
43
|
+
label?: unknown;
|
|
42
44
|
}): Dict;
|
|
43
45
|
export declare function lineToOp(verb: string, args: string[], flags: Dict): Dict;
|
|
44
46
|
export declare function actionAddress(epId: string, sceneId: string, idx: number): string;
|
|
47
|
+
export declare function actionTimestamp(action: Dict): string;
|
|
48
|
+
export declare function sceneTimeSpan(scene: Dict): {
|
|
49
|
+
t_start: string;
|
|
50
|
+
t_end: string;
|
|
51
|
+
};
|
|
45
52
|
export declare function actionDisplayFields(epId: string, sceneId: string, idx: number, action: Dict): Record<string, unknown>;
|
|
46
53
|
export declare function formatInspectAction(epId: string, sceneId: string, idx: number, action: Dict): string;
|
|
47
54
|
export declare const SKIPPABLE_EDIT_CODES: Set<string>;
|
|
@@ -50,9 +57,9 @@ export declare function summarizeScriptOp(_script: Dict, op: Dict): string;
|
|
|
50
57
|
export declare function regexPattern(raw: string): string;
|
|
51
58
|
export declare function applySelectorEdits(opts: Dict, template: Dict, verbLabel: string): Promise<[Report, number]>;
|
|
52
59
|
export { sortDeep };
|
|
53
|
-
export declare function
|
|
54
|
-
export declare function
|
|
55
|
-
export declare function actorIdsInAction(action: Dict
|
|
60
|
+
export declare function actionActorId(action: Dict): string;
|
|
61
|
+
export declare function actionSpeakerLabel(action: Dict, actorNames?: Map<string, string>): string;
|
|
62
|
+
export declare function actorIdsInAction(action: Dict): Set<string>;
|
|
56
63
|
export declare function buildGrepMatcher(raw: string): ((hay: string) => boolean) | null;
|
|
57
64
|
export declare function buildReport(op: string, title: string, lines: string[], artifactLabel: string): Report;
|
|
58
65
|
export declare function synopsisPreview(text: string, limit: number): string;
|
|
@@ -72,10 +79,16 @@ export interface ActionTarget {
|
|
|
72
79
|
export declare const HAS_FILTERS: Set<string>;
|
|
73
80
|
export declare function resolveActionTargets(script: Dict, opts: Dict): ActionTarget[];
|
|
74
81
|
export declare function selectionHasAnyFilter(opts: Dict): boolean;
|
|
82
|
+
export declare function compactEpisodeRanges(ids: Iterable<string>): string;
|
|
83
|
+
export declare function assetAppearanceCounts(script: Dict, kind: "actor" | "location" | "prop"): Map<string, {
|
|
84
|
+
episodes: Set<string>;
|
|
85
|
+
scenes: number;
|
|
86
|
+
}>;
|
|
75
87
|
export declare function listAssetsByKind(script: Dict, kind: "actor" | "location" | "prop", opts: {
|
|
76
88
|
id: string;
|
|
77
89
|
name: string;
|
|
78
90
|
selector: InSelector;
|
|
91
|
+
counts?: boolean;
|
|
79
92
|
}): string[];
|
|
80
93
|
export declare function splitSpeakerList(raw: unknown): string[];
|
|
81
94
|
export declare function blankCreateReport(session: ScriptEditSession, validation: Dict, idempotent: boolean | null): Report;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CliError, EXIT_NEEDS_AGENT, EXIT_OK, EXIT_USAGE, } from "../../common.js";
|
|
2
2
|
import { applyPatchOperations } from "../../domain/script/patch/apply.js";
|
|
3
3
|
import { renumberSceneIds } from "../../domain/script/lookups.js";
|
|
4
|
+
import { sceneRefs } from "../../domain/script/scene-refs.js";
|
|
4
5
|
import { isDangerousRegex, MAX_GREP_PATTERN_LEN, parseInSelector, selectorSingleActionPoint, WHOLE_SCRIPT, } from "../../domain/script/selector.js";
|
|
5
6
|
import { parseAnyAddress, } from "../../domain/script/address.js";
|
|
6
|
-
import { summarizeIssues
|
|
7
|
-
import { sortDeep } from "../../domain/
|
|
8
|
-
import { asList, isDict, strOf, } from "../../domain/script/shared.js";
|
|
7
|
+
import { summarizeIssues } from "../../domain/script/text-util.js";
|
|
8
|
+
import { sortDeep } from "../../domain/script/text-util.js";
|
|
9
|
+
import { asList, idNum, isDict, strOf, } from "../../domain/script/shared.js";
|
|
9
10
|
import { loadScriptForEdit, validateSession, saveScriptSession, syncValidationResult, scriptSourceText, } from "./session.js";
|
|
10
11
|
export function tokenizeLine(line) {
|
|
11
12
|
const out = [];
|
|
@@ -73,16 +74,14 @@ function isDoFlag(t) {
|
|
|
73
74
|
// Per-verb flag arity. Everything else takes the next token as its value.
|
|
74
75
|
export const DO_BOOL_FLAGS = {
|
|
75
76
|
replace: new Set(["all", "regex"]),
|
|
76
|
-
"state-change": new Set(["clear"]),
|
|
77
77
|
transition: new Set(["clear"]),
|
|
78
78
|
emotion: new Set(["clear"]),
|
|
79
|
-
|
|
79
|
+
"scene-ref": new Set(["clear", "remove"]),
|
|
80
80
|
delete: new Set(["force"]),
|
|
81
81
|
extend: new Set(["clear", "json-value"]),
|
|
82
82
|
};
|
|
83
83
|
export const DO_REPEAT_FLAGS = {
|
|
84
84
|
alias: new Set(["add", "remove"]),
|
|
85
|
-
overlap: new Set(["line"]),
|
|
86
85
|
"add-actor": new Set(["alias"]),
|
|
87
86
|
};
|
|
88
87
|
function pushFlag(flags, repeats, name, val) {
|
|
@@ -175,9 +174,11 @@ export function stateChangeTemplate(target, f) {
|
|
|
175
174
|
nextSteps: ["Pick exactly one flag."], errorCode: "STATE_CHANGE_FLAG_MISSING",
|
|
176
175
|
});
|
|
177
176
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
:
|
|
177
|
+
// v3 has no per-action state_changes; state lives on scene.ref.* only.
|
|
178
|
+
throw new CliError("VERB BLOCKED: state-change removed", "state-change was removed in v3; set a scene ref's state instead.", {
|
|
179
|
+
exitCode: EXIT_USAGE, required: ["scene-ref state edit"], received: ["state-change"],
|
|
180
|
+
nextSteps: ["Use `scene-ref <ep/scn> <kind:id> --state <state_id>` (op scene.ref.set)."], errorCode: "STATE_CHANGE_REMOVED",
|
|
181
|
+
});
|
|
181
182
|
}
|
|
182
183
|
export function transitionTemplate(target, f) {
|
|
183
184
|
const setBoth = f.process !== undefined || f.contrast !== undefined;
|
|
@@ -242,13 +243,24 @@ export function contextTemplate(target, f) {
|
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
245
|
if (removeSet)
|
|
245
|
-
return { op: "
|
|
246
|
+
return { op: "scene.ref.remove", target };
|
|
246
247
|
if (clearSet)
|
|
247
|
-
return { op: "
|
|
248
|
-
return { op: "
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
return { op: "scene.ref.clear", target };
|
|
249
|
+
return { op: "scene.ref.set", target, state: f.state === "none" ? "" : f.state };
|
|
250
|
+
}
|
|
251
|
+
// v3 dialogue speaker: a single inline speaker — an actor, OR a non-actor kind
|
|
252
|
+
// (system|broadcast|offscreen|group) with an optional label.
|
|
253
|
+
export function dialogueTemplate(f) {
|
|
254
|
+
const actorId = strOf(f.actor).trim();
|
|
255
|
+
const speakerKind = strOf(f.kind).trim();
|
|
256
|
+
if (actorId)
|
|
257
|
+
return { op: "dialogue.speaker.set", actor_id: actorId };
|
|
258
|
+
if (speakerKind)
|
|
259
|
+
return { op: "dialogue.speaker.set", kind: speakerKind, label: strOf(f.label).trim() || undefined };
|
|
260
|
+
throw new CliError("VERB BLOCKED: dialogue speaker missing", "dialogue: pass --actor <id> or --kind <system|broadcast|offscreen|group>.", {
|
|
261
|
+
exitCode: EXIT_USAGE, required: ["--actor <actor_id> or --kind <non-actor kind>"], received: ["<missing>"],
|
|
262
|
+
nextSteps: ["Set --actor for an actor line, or --kind for a non-actor line."], errorCode: "DIALOGUE_SPEAKER_MISSING",
|
|
263
|
+
});
|
|
252
264
|
}
|
|
253
265
|
// Translate one parsed verb line into a patch op dict (the SAME ops `patch`
|
|
254
266
|
// consumes). `do` = the human/agent-friendly notation for those ops: no JSON,
|
|
@@ -266,18 +278,14 @@ export function lineToOp(verb, args, flags) {
|
|
|
266
278
|
return { op: "action.type.set", at: a0, type: a1 };
|
|
267
279
|
case "actor":
|
|
268
280
|
return { op: "action.actor.set", at: a0, actor_id: a1 };
|
|
269
|
-
case "state-change":
|
|
270
|
-
return { ...stateChangeTemplate(a1, { to: flags["to"], from: flags["from"], effective: flags["effective"], clear: Boolean(flags["clear"]) }), at: a0 };
|
|
271
281
|
case "transition":
|
|
272
282
|
return { ...transitionTemplate(a1, { process: flags["process"], contrast: flags["contrast"], clear: Boolean(flags["clear"]) }), at: a0 };
|
|
273
283
|
case "emotion":
|
|
274
284
|
return { ...emotionTemplate({ emotion: args[1], clear: Boolean(flags["clear"]) }), at: a0 };
|
|
275
|
-
case "
|
|
285
|
+
case "scene-ref":
|
|
276
286
|
return { ...contextTemplate(a1, { state: flags["state"], clear: Boolean(flags["clear"]), remove: Boolean(flags["remove"]) }), at: a0 };
|
|
277
287
|
case "dialogue":
|
|
278
|
-
return { ...dialogueTemplate(
|
|
279
|
-
case "overlap":
|
|
280
|
-
return { op: "dialogue.overlap", at: a0, lines: flags["line"] ?? [] };
|
|
288
|
+
return { ...dialogueTemplate({ actor: flags["actor"], kind: flags["kind"], label: flags["label"] }), at: a0 };
|
|
281
289
|
case "rename":
|
|
282
290
|
return { op: "asset.rename", target: a0, name: a1 };
|
|
283
291
|
case "role":
|
|
@@ -350,8 +358,8 @@ export function lineToOp(verb, args, flags) {
|
|
|
350
358
|
return { op: "prop.add", name: a0, description: flags["description"] };
|
|
351
359
|
case "add-episode":
|
|
352
360
|
return { op: "episode.add", title: flags["title"], episode_id: flags["id"] };
|
|
353
|
-
case "
|
|
354
|
-
return { op: "
|
|
361
|
+
case "importance":
|
|
362
|
+
return { op: "importance.set", target: a0, importance: a1 };
|
|
355
363
|
case "split":
|
|
356
364
|
return { op: "scene.split", at: a0, at_index: flags["at"], new_scene_id: flags["new-scene-id"] };
|
|
357
365
|
case "delete": {
|
|
@@ -360,8 +368,6 @@ export function lineToOp(verb, args, flags) {
|
|
|
360
368
|
return { op: "action.delete", at: a0 };
|
|
361
369
|
if (addr.kind === "scene")
|
|
362
370
|
return { op: "scene.delete", at: a0, force: Boolean(flags["force"]) };
|
|
363
|
-
if (addr.kind === "speaker")
|
|
364
|
-
return { op: "speaker.delete", target: a0, strategy: flags["strategy"], replacement: flags["replacement"] };
|
|
365
371
|
if (addr.kind === "asset")
|
|
366
372
|
return { op: "asset.delete", target: a0, strategy: flags["strategy"], replacement: flags["replacement"] };
|
|
367
373
|
throw doErr(`delete cannot operate on a ${addr.kind} address (${a0}); episodes/states have no delete op`);
|
|
@@ -399,23 +405,43 @@ export function lineToOp(verb, args, flags) {
|
|
|
399
405
|
export function actionAddress(epId, sceneId, idx) {
|
|
400
406
|
return `${epId}/${sceneId}#${idx}`;
|
|
401
407
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
// The action's authored timeline position, carried in extend.timestamp as a
|
|
409
|
+
// "M:SS" / "MM:SS" string (episode-local by convention). Empty string when the
|
|
410
|
+
// action carries no timestamp. This is the anchor event-level alignment reads:
|
|
411
|
+
// an event's span is the delta between its first and last action timestamp.
|
|
412
|
+
export function actionTimestamp(action) {
|
|
413
|
+
const extend = isDict(action["extend"]) ? action["extend"] : {};
|
|
414
|
+
return strOf(extend["timestamp"]).trim();
|
|
415
|
+
}
|
|
416
|
+
// First and last non-empty action timestamps within a scene, in document order.
|
|
417
|
+
// Timestamps are monotonic within an episode, so first = t_start, last = t_end.
|
|
418
|
+
export function sceneTimeSpan(scene) {
|
|
419
|
+
let t_start = "";
|
|
420
|
+
let t_end = "";
|
|
421
|
+
for (const action of asList(scene["actions"])) {
|
|
422
|
+
const ts = actionTimestamp(action);
|
|
423
|
+
if (!ts)
|
|
424
|
+
continue;
|
|
425
|
+
if (!t_start)
|
|
426
|
+
t_start = ts;
|
|
427
|
+
t_end = ts;
|
|
410
428
|
}
|
|
429
|
+
return { t_start, t_end };
|
|
430
|
+
}
|
|
431
|
+
export function actionDisplayFields(epId, sceneId, idx, action) {
|
|
432
|
+
const actorId = actionActorId(action);
|
|
433
|
+
const s = isDict(action["speaker"]) ? action["speaker"] : null;
|
|
434
|
+
// For a non-actor speaker ({kind,label}) surface it under `speaker`; an actor
|
|
435
|
+
// line surfaces under `actor` (its id). Narrative lines have neither.
|
|
436
|
+
const speaker = s && !actorId ? (strOf(s["label"]).trim() || strOf(s["kind"]).trim()) : "";
|
|
411
437
|
return {
|
|
412
438
|
addr: actionAddress(epId, sceneId, idx),
|
|
439
|
+
timestamp: actionTimestamp(action),
|
|
413
440
|
type: strOf(action["type"]).trim() || "action",
|
|
414
|
-
|
|
415
|
-
speaker: speakerId,
|
|
441
|
+
speaker,
|
|
416
442
|
actor: actorId,
|
|
417
443
|
emotion: strOf(action["emotion"]).trim(),
|
|
418
|
-
content,
|
|
444
|
+
content: strOf(action["content"]),
|
|
419
445
|
};
|
|
420
446
|
}
|
|
421
447
|
export function formatInspectAction(epId, sceneId, idx, action) {
|
|
@@ -431,8 +457,9 @@ export function formatInspectAction(epId, sceneId, idx, action) {
|
|
|
431
457
|
const actorId = strOf(fields["actor"]);
|
|
432
458
|
const who = speakerId || actorId;
|
|
433
459
|
const emotion = strOf(fields["emotion"]);
|
|
460
|
+
const timestamp = strOf(fields["timestamp"]);
|
|
434
461
|
const content = strOf(fields["content"]);
|
|
435
|
-
const meta = [tag, emotion ? `emotion=${emotion}` : "", who].filter((v) => v).join(" ");
|
|
462
|
+
const meta = [tag, timestamp ? `t=${timestamp}` : "", emotion ? `emotion=${emotion}` : "", who].filter((v) => v).join(" ");
|
|
436
463
|
const prefix = `${addr} [${meta}]`;
|
|
437
464
|
return content ? `${prefix} ${content}` : prefix;
|
|
438
465
|
}
|
|
@@ -490,8 +517,10 @@ export function summarizeScriptOp(_script, op) {
|
|
|
490
517
|
return `已更新分集梗概 ${op["episode_id"] ?? op["target"] ?? op["at"]}`;
|
|
491
518
|
if (kind === "state.add")
|
|
492
519
|
return `已为 ${op["target"]} 新增状态 ${op["state_id"]}: ${op["name"] || op["state_name"]}`;
|
|
493
|
-
if (kind === "
|
|
494
|
-
return
|
|
520
|
+
if (kind === "importance.set")
|
|
521
|
+
return `已将 ${op["target"]} 重要度设为 ${op["importance"]}`;
|
|
522
|
+
if (kind === "scene.ref.set")
|
|
523
|
+
return `已在 ${op["at"]} 设置引用 ${op["target"]}${op["state"] ? `(状态 ${op["state"]})` : ""}`;
|
|
495
524
|
if (kind === "extend.set")
|
|
496
525
|
return `已在 ${op["at"]} 设置 extend.${op["key"]}`;
|
|
497
526
|
if (kind === "extend.clear")
|
|
@@ -608,46 +637,34 @@ export { sortDeep };
|
|
|
608
637
|
// / --speaker / --severity / --code / --has-{actor,location,prop}).
|
|
609
638
|
// Resolve the speaker_id → source actor mapping once per call. Used by
|
|
610
639
|
// commandActions's --actor filter when the action speaks via a speaker.
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const id = strOf(line["speaker_id"]).trim();
|
|
636
|
-
if (id)
|
|
637
|
-
ids.add(id);
|
|
638
|
-
}
|
|
639
|
-
return ids;
|
|
640
|
-
}
|
|
641
|
-
export function actorIdsInAction(action, speakerToActor) {
|
|
640
|
+
// v3: a dialogue line carries a single inline speaker — an actor ({actor_id})
|
|
641
|
+
// or a non-actor source ({kind, label?}). These read that shape.
|
|
642
|
+
// The actor id behind an action's speaker, or "" for a non-actor / narrative line.
|
|
643
|
+
export function actionActorId(action) {
|
|
644
|
+
const s = action["speaker"];
|
|
645
|
+
if (isDict(s) && strOf(s["actor_id"]).trim())
|
|
646
|
+
return strOf(s["actor_id"]).trim();
|
|
647
|
+
return "";
|
|
648
|
+
}
|
|
649
|
+
// A human label for the speaker: the actor's name (resolved via `names`), or a
|
|
650
|
+
// non-actor kind's label / kind, or "" when the line has no speaker.
|
|
651
|
+
export function actionSpeakerLabel(action, actorNames) {
|
|
652
|
+
const s = action["speaker"];
|
|
653
|
+
if (!isDict(s))
|
|
654
|
+
return "";
|
|
655
|
+
const actorId = strOf(s["actor_id"]).trim();
|
|
656
|
+
if (actorId)
|
|
657
|
+
return actorNames?.get(actorId) || actorId;
|
|
658
|
+
const kind = strOf(s["kind"]).trim();
|
|
659
|
+
if (kind)
|
|
660
|
+
return strOf(s["label"]).trim() || kind;
|
|
661
|
+
return "";
|
|
662
|
+
}
|
|
663
|
+
export function actorIdsInAction(action) {
|
|
642
664
|
const ids = new Set();
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
645
|
-
ids.add(
|
|
646
|
-
for (const spkId of speakerIdsInAction(action)) {
|
|
647
|
-
const actor = speakerToActor.get(spkId);
|
|
648
|
-
if (actor)
|
|
649
|
-
ids.add(actor);
|
|
650
|
-
}
|
|
665
|
+
const id = actionActorId(action);
|
|
666
|
+
if (id)
|
|
667
|
+
ids.add(id);
|
|
651
668
|
return ids;
|
|
652
669
|
}
|
|
653
670
|
// Build a grep matcher. /pattern/flags → RegExp, otherwise literal substring.
|
|
@@ -718,7 +735,7 @@ export function nameMaps(script) {
|
|
|
718
735
|
return out;
|
|
719
736
|
}
|
|
720
737
|
export function formatScene(epId, scene, names) {
|
|
721
|
-
const ctx =
|
|
738
|
+
const ctx = sceneRefs(scene);
|
|
722
739
|
const env = isDict(scene["environment"]) ? scene["environment"] : {};
|
|
723
740
|
const space = strOf(env["space"]) || "-";
|
|
724
741
|
const time = strOf(env["time"]) || "-";
|
|
@@ -735,9 +752,11 @@ export function formatScene(epId, scene, names) {
|
|
|
735
752
|
return `${id}(${names.prop.get(id) || "?"})`;
|
|
736
753
|
});
|
|
737
754
|
const actionCount = asList(scene["actions"]).length;
|
|
738
|
-
|
|
755
|
+
const { t_start, t_end } = sceneTimeSpan(scene);
|
|
756
|
+
const timePart = t_start || t_end ? ` t=${t_start || "?"}..${t_end || "?"}` : "";
|
|
757
|
+
return `${epId}/${scene["scene_id"]} [${space} ${time}] location=${locations.join(",") || "-"} actors=${actors.join(",") || "-"} props=${props.join(",") || "-"} actions=${actionCount}${timePart}`;
|
|
739
758
|
}
|
|
740
|
-
export const HAS_FILTERS = new Set(["
|
|
759
|
+
export const HAS_FILTERS = new Set(["transition", "speaker"]);
|
|
741
760
|
// Resolve a selection (--in range/region selector + --type/--actor/--speaker/
|
|
742
761
|
// --grep/--has predicates, AND-combined) to the matching actions, in document
|
|
743
762
|
// order. The single matcher behind both `actions` queries and selector-driven
|
|
@@ -747,7 +766,6 @@ export function resolveActionTargets(script, opts) {
|
|
|
747
766
|
const selector = parseInSelector(strOf(opts["in"]));
|
|
748
767
|
const typeFilter = strOf(opts["type"]).trim();
|
|
749
768
|
const actorFilter = strOf(opts["actor"]).trim();
|
|
750
|
-
const speakerFilter = strOf(opts["speaker"]).trim();
|
|
751
769
|
const hasFilter = strOf(opts["has"]).trim();
|
|
752
770
|
// Whitelist --has: silently accepting unknown values means a typo like
|
|
753
771
|
// "state_changes" (underscore) passed the filter-missing guard but bypassed
|
|
@@ -762,7 +780,6 @@ export function resolveActionTargets(script, opts) {
|
|
|
762
780
|
});
|
|
763
781
|
}
|
|
764
782
|
const grepMatcher = buildGrepMatcher(strOf(opts["grep"]));
|
|
765
|
-
const speakerToActor = (actorFilter || speakerFilter) ? speakerSourceActorMap(script) : new Map();
|
|
766
783
|
const out = [];
|
|
767
784
|
for (const ep of asList(script["episodes"])) {
|
|
768
785
|
const epId = strOf(ep["episode_id"]);
|
|
@@ -777,23 +794,14 @@ export function resolveActionTargets(script, opts) {
|
|
|
777
794
|
const a = actions[i];
|
|
778
795
|
if (typeFilter && strOf(a["type"]).trim() !== typeFilter)
|
|
779
796
|
continue;
|
|
780
|
-
if (
|
|
781
|
-
continue;
|
|
782
|
-
if (actorFilter && !actorIdsInAction(a, speakerToActor).has(actorFilter))
|
|
783
|
-
continue;
|
|
784
|
-
if (hasFilter === "state-changes" && asList(a["state_changes"]).length === 0)
|
|
797
|
+
if (actorFilter && !actorIdsInAction(a).has(actorFilter))
|
|
785
798
|
continue;
|
|
786
799
|
if (hasFilter === "transition" && !isDict(a["transition_prompt"]))
|
|
787
800
|
continue;
|
|
788
|
-
if (hasFilter === "
|
|
801
|
+
if (hasFilter === "speaker" && !isDict(a["speaker"]))
|
|
802
|
+
continue;
|
|
803
|
+
if (grepMatcher && !grepMatcher(strOf(a["content"])))
|
|
789
804
|
continue;
|
|
790
|
-
if (grepMatcher) {
|
|
791
|
-
let hay = strOf(a["content"]);
|
|
792
|
-
for (const line of asList(a["lines"]))
|
|
793
|
-
hay += "\n" + strOf(line["content"]);
|
|
794
|
-
if (!grepMatcher(hay))
|
|
795
|
-
continue;
|
|
796
|
-
}
|
|
797
805
|
out.push({ epId, sceneId, idx: i, action: a });
|
|
798
806
|
}
|
|
799
807
|
}
|
|
@@ -804,7 +812,60 @@ export function resolveActionTargets(script, opts) {
|
|
|
804
812
|
export function selectionHasAnyFilter(opts) {
|
|
805
813
|
return Boolean(!parseInSelector(strOf(opts["in"])).isEmpty ||
|
|
806
814
|
strOf(opts["grep"]) || strOf(opts["type"]).trim() || strOf(opts["actor"]).trim() ||
|
|
807
|
-
strOf(opts["
|
|
815
|
+
strOf(opts["has"]).trim());
|
|
816
|
+
}
|
|
817
|
+
// Collapse a set of episode ids into sorted, comma-joined ranges:
|
|
818
|
+
// {ep_001, ep_002, ep_003, ep_007} → "ep_001..ep_003,ep_007". Keeps the state
|
|
819
|
+
// arc / appearance lines readable even when an item spans dozens of episodes.
|
|
820
|
+
export function compactEpisodeRanges(ids) {
|
|
821
|
+
const nums = [...new Set([...ids])]
|
|
822
|
+
.map((id) => ({ id, n: idNum(id, "ep") }))
|
|
823
|
+
.filter((x) => Number.isFinite(x.n))
|
|
824
|
+
.sort((a, b) => a.n - b.n);
|
|
825
|
+
if (nums.length === 0)
|
|
826
|
+
return "";
|
|
827
|
+
const parts = [];
|
|
828
|
+
let start = nums[0];
|
|
829
|
+
let prev = nums[0];
|
|
830
|
+
const flush = () => parts.push(start.id === prev.id ? start.id : `${start.id}..${prev.id}`);
|
|
831
|
+
for (let i = 1; i < nums.length; i++) {
|
|
832
|
+
const cur = nums[i];
|
|
833
|
+
if (cur.n === prev.n + 1) {
|
|
834
|
+
prev = cur;
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
flush();
|
|
838
|
+
start = cur;
|
|
839
|
+
prev = cur;
|
|
840
|
+
}
|
|
841
|
+
flush();
|
|
842
|
+
return parts.join(",");
|
|
843
|
+
}
|
|
844
|
+
// One pass over scene context: for each asset id of `kind`, the set of episodes
|
|
845
|
+
// and count of scenes it is referenced in. "Appearance" = presence in a scene's
|
|
846
|
+
// context (the canonical who/what-is-in-this-scene list direct-init populates).
|
|
847
|
+
export function assetAppearanceCounts(script, kind) {
|
|
848
|
+
const idKey = kind === "actor" ? "actor_id" : kind === "location" ? "location_id" : "prop_id";
|
|
849
|
+
const pluralKey = kind === "actor" ? "actors" : kind === "location" ? "locations" : "props";
|
|
850
|
+
const out = new Map();
|
|
851
|
+
for (const ep of asList(script["episodes"])) {
|
|
852
|
+
const epId = strOf(ep["episode_id"]);
|
|
853
|
+
for (const scene of asList(ep["scenes"])) {
|
|
854
|
+
const ctx = sceneRefs(scene);
|
|
855
|
+
const seen = new Set();
|
|
856
|
+
for (const ref of asList(ctx[pluralKey])) {
|
|
857
|
+
const id = strOf(ref[idKey]);
|
|
858
|
+
if (!id || seen.has(id))
|
|
859
|
+
continue;
|
|
860
|
+
seen.add(id);
|
|
861
|
+
const entry = out.get(id) ?? { episodes: new Set(), scenes: 0 };
|
|
862
|
+
entry.episodes.add(epId);
|
|
863
|
+
entry.scenes += 1;
|
|
864
|
+
out.set(id, entry);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return out;
|
|
808
869
|
}
|
|
809
870
|
export function listAssetsByKind(script, kind, opts) {
|
|
810
871
|
const lines = [];
|
|
@@ -838,19 +899,22 @@ export function listAssetsByKind(script, kind, opts) {
|
|
|
838
899
|
// scene. Legacy narrowing is implemented for actor only.
|
|
839
900
|
if (kind === "actor") {
|
|
840
901
|
const a = asList(scene["actions"])[single.idx];
|
|
841
|
-
const aid = a ?
|
|
902
|
+
const aid = a ? actionActorId(a) : "";
|
|
842
903
|
if (aid)
|
|
843
904
|
scopeIds.add(aid);
|
|
844
905
|
}
|
|
845
906
|
continue;
|
|
846
907
|
}
|
|
847
|
-
const ctx =
|
|
908
|
+
const ctx = sceneRefs(scene);
|
|
848
909
|
for (const ref of asList(ctx[pluralKey])) {
|
|
849
910
|
scopeIds.add(strOf(ref[idKey]));
|
|
850
911
|
}
|
|
851
912
|
}
|
|
852
913
|
}
|
|
853
914
|
}
|
|
915
|
+
// Appearance counts (scenes / episodes) computed in one pass, only when asked
|
|
916
|
+
// — keeps the default listing lean.
|
|
917
|
+
const appearances = opts.counts ? assetAppearanceCounts(script, kind) : null;
|
|
854
918
|
for (const asset of asList(script[key])) {
|
|
855
919
|
const id = strOf(asset[idKey]);
|
|
856
920
|
const name = strOf(asset[nameKey]);
|
|
@@ -862,14 +926,24 @@ export function listAssetsByKind(script, kind, opts) {
|
|
|
862
926
|
continue;
|
|
863
927
|
const aliases = asList(asset["aliases"]).map((s) => strOf(s));
|
|
864
928
|
const role = strOf(asset["role_type"]);
|
|
929
|
+
const importance = strOf(asset["importance"]);
|
|
865
930
|
const descPresent = strOf(asset["description"]).trim() ? "yes" : "missing";
|
|
866
931
|
const states = asList(asset["states"]).length;
|
|
867
932
|
const extra = [];
|
|
868
933
|
if (aliases.length > 0)
|
|
869
934
|
extra.push(`aliases=(${aliases.join(",")})`);
|
|
935
|
+
if (importance)
|
|
936
|
+
extra.push(`importance=${importance}`);
|
|
870
937
|
if (role)
|
|
871
938
|
extra.push(`role=${role}`);
|
|
872
939
|
extra.push(`states=${states}`, `description=${descPresent}`);
|
|
940
|
+
if (appearances) {
|
|
941
|
+
const seen = appearances.get(id);
|
|
942
|
+
const eps = seen ? seen.episodes.size : 0;
|
|
943
|
+
const scns = seen ? seen.scenes : 0;
|
|
944
|
+
const arc = seen && eps > 0 ? ` episodes=${compactEpisodeRanges(seen.episodes)}` : "";
|
|
945
|
+
extra.push(`scenes=${scns}`, `episodes_count=${eps}${arc}`);
|
|
946
|
+
}
|
|
873
947
|
lines.push(`${kind} ${id}: ${name || "-"} ${extra.join(" ")}`);
|
|
874
948
|
}
|
|
875
949
|
return lines;
|