@lingjingai/scriptctl 0.49.16 → 0.50.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 +8 -2
- package/changes/0.50.0.md +63 -0
- package/changes/unreleased.md +2 -1
- package/dist/cli.js +26 -5
- package/dist/cli.js.map +1 -1
- package/dist/domain/authoring/apply.d.ts +1 -33
- package/dist/domain/authoring/apply.js +1 -783
- package/dist/domain/authoring/apply.js.map +1 -1
- package/dist/domain/authoring/export.d.ts +1 -7
- package/dist/domain/authoring/export.js +1 -84
- package/dist/domain/authoring/export.js.map +1 -1
- package/dist/domain/authoring/parser.d.ts +2 -3
- package/dist/domain/authoring/parser.js +2 -914
- package/dist/domain/authoring/parser.js.map +1 -1
- package/dist/domain/authoring/serializer.d.ts +1 -2
- package/dist/domain/authoring/serializer.js +1 -243
- package/dist/domain/authoring/serializer.js.map +1 -1
- package/dist/domain/authoring/shared/bracket.d.ts +4 -0
- package/dist/domain/authoring/shared/bracket.js +95 -0
- package/dist/domain/authoring/shared/bracket.js.map +1 -0
- package/dist/domain/authoring/shared/types.d.ts +12 -0
- package/dist/domain/authoring/shared/types.js +2 -0
- package/dist/domain/authoring/shared/types.js.map +1 -0
- package/dist/domain/authoring/types.d.ts +2 -87
- package/dist/domain/authoring/types.js +2 -1
- package/dist/domain/authoring/types.js.map +1 -1
- package/dist/domain/authoring/v3/apply.d.ts +33 -0
- package/dist/domain/authoring/v3/apply.js +784 -0
- package/dist/domain/authoring/v3/apply.js.map +1 -0
- package/dist/domain/authoring/v3/export.d.ts +7 -0
- package/dist/domain/authoring/v3/export.js +85 -0
- package/dist/domain/authoring/v3/export.js.map +1 -0
- package/dist/domain/authoring/v3/parser.d.ts +3 -0
- package/dist/domain/authoring/v3/parser.js +823 -0
- package/dist/domain/authoring/v3/parser.js.map +1 -0
- package/dist/domain/authoring/v3/serializer.d.ts +2 -0
- package/dist/domain/authoring/v3/serializer.js +244 -0
- package/dist/domain/authoring/v3/serializer.js.map +1 -0
- package/dist/domain/authoring/v3/types.d.ts +76 -0
- package/dist/domain/authoring/v3/types.js +2 -0
- package/dist/domain/authoring/v3/types.js.map +1 -0
- package/dist/domain/authoring/v4/apply.d.ts +40 -0
- package/dist/domain/authoring/v4/apply.js +451 -0
- package/dist/domain/authoring/v4/apply.js.map +1 -0
- package/dist/domain/authoring/v4/parser.d.ts +2 -0
- package/dist/domain/authoring/v4/parser.js +729 -0
- package/dist/domain/authoring/v4/parser.js.map +1 -0
- package/dist/domain/authoring/v4/serializer.d.ts +6 -0
- package/dist/domain/authoring/v4/serializer.js +280 -0
- package/dist/domain/authoring/v4/serializer.js.map +1 -0
- package/dist/domain/authoring/v4/types.d.ts +50 -0
- package/dist/domain/authoring/v4/types.js +2 -0
- package/dist/domain/authoring/v4/types.js.map +1 -0
- package/dist/domain/ingest/apply-plan.d.ts +1 -1
- package/dist/domain/ingest/assembler.d.ts +9 -0
- package/dist/domain/ingest/assembler.js +98 -36
- package/dist/domain/ingest/assembler.js.map +1 -1
- package/dist/domain/ingest/asset-audit.d.ts +50 -0
- package/dist/domain/ingest/asset-audit.js +196 -0
- package/dist/domain/ingest/asset-audit.js.map +1 -0
- package/dist/domain/ingest/production-validation.d.ts +5 -4
- package/dist/domain/ingest/production-validation.js +10 -25
- package/dist/domain/ingest/production-validation.js.map +1 -1
- package/dist/domain/ingest/records.d.ts +1 -1
- package/dist/domain/ingest/records.js +1 -1
- package/dist/domain/ingest/records.js.map +1 -1
- package/dist/domain/ingest/serial-context.d.ts +1 -1
- package/dist/domain/ingest/validation.d.ts +1 -11
- package/dist/domain/ingest/validation.js +1 -199
- package/dist/domain/ingest/validation.js.map +1 -1
- package/dist/domain/ingest/video-apply.js +68 -45
- package/dist/domain/ingest/video-apply.js.map +1 -1
- package/dist/domain/script/address.d.ts +1 -32
- package/dist/domain/script/address.js +1 -144
- package/dist/domain/script/address.js.map +1 -1
- package/dist/domain/script/dispatch.d.ts +14 -0
- package/dist/domain/script/dispatch.js +47 -0
- package/dist/domain/script/dispatch.js.map +1 -0
- package/dist/domain/script/lookups.d.ts +1 -33
- package/dist/domain/script/lookups.js +1 -316
- package/dist/domain/script/lookups.js.map +1 -1
- package/dist/domain/script/parse.d.ts +1 -3
- package/dist/domain/script/parse.js +1 -164
- package/dist/domain/script/parse.js.map +1 -1
- package/dist/domain/script/patch/apply.d.ts +1 -2
- package/dist/domain/script/patch/apply.js +1 -30
- package/dist/domain/script/patch/apply.js.map +1 -1
- package/dist/domain/script/patch/helpers.d.ts +1 -17
- package/dist/domain/script/patch/helpers.js +1 -210
- package/dist/domain/script/patch/helpers.js.map +1 -1
- package/dist/domain/script/patch/inline-speaker.d.ts +1 -2
- package/dist/domain/script/patch/inline-speaker.js +1 -49
- package/dist/domain/script/patch/inline-speaker.js.map +1 -1
- package/dist/domain/script/patch/ops-action.d.ts +1 -12
- package/dist/domain/script/patch/ops-action.js +1 -366
- package/dist/domain/script/patch/ops-action.js.map +1 -1
- package/dist/domain/script/patch/ops-asset.d.ts +1 -14
- package/dist/domain/script/patch/ops-asset.js +1 -364
- package/dist/domain/script/patch/ops-asset.js.map +1 -1
- package/dist/domain/script/patch/ops-dialogue.d.ts +1 -2
- package/dist/domain/script/patch/ops-dialogue.js +1 -25
- package/dist/domain/script/patch/ops-dialogue.js.map +1 -1
- package/dist/domain/script/patch/ops-extend.d.ts +1 -8
- package/dist/domain/script/patch/ops-extend.js +1 -110
- package/dist/domain/script/patch/ops-extend.js.map +1 -1
- package/dist/domain/script/patch/ops-meta.d.ts +1 -5
- package/dist/domain/script/patch/ops-meta.js +1 -81
- package/dist/domain/script/patch/ops-meta.js.map +1 -1
- package/dist/domain/script/patch/ops-scene.d.ts +1 -6
- package/dist/domain/script/patch/ops-scene.js +1 -350
- package/dist/domain/script/patch/ops-scene.js.map +1 -1
- package/dist/domain/script/patch/ops-state.d.ts +1 -8
- package/dist/domain/script/patch/ops-state.js +1 -164
- package/dist/domain/script/patch/ops-state.js.map +1 -1
- package/dist/domain/script/patch/registry.d.ts +1 -2
- package/dist/domain/script/patch/registry.js +1 -52
- package/dist/domain/script/patch/registry.js.map +1 -1
- package/dist/domain/script/patch/types.d.ts +1 -10
- package/dist/domain/script/patch/types.js +1 -1
- package/dist/domain/script/patch/types.js.map +1 -1
- package/dist/domain/script/refs.d.ts +1 -4
- package/dist/domain/script/refs.js +1 -63
- package/dist/domain/script/refs.js.map +1 -1
- package/dist/domain/script/scene-refs.d.ts +1 -3
- package/dist/domain/script/scene-refs.js +1 -34
- package/dist/domain/script/scene-refs.js.map +1 -1
- package/dist/domain/script/schema.d.ts +1 -6
- package/dist/domain/script/schema.js +1 -55
- package/dist/domain/script/schema.js.map +1 -1
- package/dist/domain/script/selector.d.ts +1 -45
- package/dist/domain/script/selector.js +1 -184
- package/dist/domain/script/selector.js.map +1 -1
- package/dist/domain/script/shared/regex.d.ts +2 -0
- package/dist/domain/script/shared/regex.js +7 -0
- package/dist/domain/script/shared/regex.js.map +1 -0
- package/dist/domain/script/shared/types.d.ts +18 -0
- package/dist/domain/script/shared/types.js +9 -0
- package/dist/domain/script/shared/types.js.map +1 -0
- package/dist/domain/script/shared/validation.d.ts +10 -0
- package/dist/domain/script/shared/validation.js +2 -0
- package/dist/domain/script/shared/validation.js.map +1 -0
- package/dist/domain/script/types.d.ts +1 -123
- package/dist/domain/script/types.js +1 -8
- package/dist/domain/script/types.js.map +1 -1
- package/dist/domain/script/v3/address.d.ts +32 -0
- package/dist/domain/script/v3/address.js +145 -0
- package/dist/domain/script/v3/address.js.map +1 -0
- package/dist/domain/script/v3/lookups.d.ts +33 -0
- package/dist/domain/script/v3/lookups.js +317 -0
- package/dist/domain/script/v3/lookups.js.map +1 -0
- package/dist/domain/script/v3/ordinal.d.ts +8 -0
- package/dist/domain/script/v3/ordinal.js +92 -0
- package/dist/domain/script/v3/ordinal.js.map +1 -0
- package/dist/domain/script/v3/parse.d.ts +3 -0
- package/dist/domain/script/v3/parse.js +165 -0
- package/dist/domain/script/v3/parse.js.map +1 -0
- package/dist/domain/script/v3/patch/apply.d.ts +2 -0
- package/dist/domain/script/v3/patch/apply.js +31 -0
- package/dist/domain/script/v3/patch/apply.js.map +1 -0
- package/dist/domain/script/v3/patch/helpers.d.ts +17 -0
- package/dist/domain/script/v3/patch/helpers.js +211 -0
- package/dist/domain/script/v3/patch/helpers.js.map +1 -0
- package/dist/domain/script/v3/patch/inline-speaker.d.ts +2 -0
- package/dist/domain/script/v3/patch/inline-speaker.js +50 -0
- package/dist/domain/script/v3/patch/inline-speaker.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-action.d.ts +12 -0
- package/dist/domain/script/v3/patch/ops-action.js +367 -0
- package/dist/domain/script/v3/patch/ops-action.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-asset.d.ts +14 -0
- package/dist/domain/script/v3/patch/ops-asset.js +365 -0
- package/dist/domain/script/v3/patch/ops-asset.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-dialogue.d.ts +2 -0
- package/dist/domain/script/v3/patch/ops-dialogue.js +26 -0
- package/dist/domain/script/v3/patch/ops-dialogue.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-extend.d.ts +8 -0
- package/dist/domain/script/v3/patch/ops-extend.js +111 -0
- package/dist/domain/script/v3/patch/ops-extend.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-meta.d.ts +5 -0
- package/dist/domain/script/v3/patch/ops-meta.js +82 -0
- package/dist/domain/script/v3/patch/ops-meta.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-scene.d.ts +6 -0
- package/dist/domain/script/v3/patch/ops-scene.js +351 -0
- package/dist/domain/script/v3/patch/ops-scene.js.map +1 -0
- package/dist/domain/script/v3/patch/ops-state.d.ts +8 -0
- package/dist/domain/script/v3/patch/ops-state.js +165 -0
- package/dist/domain/script/v3/patch/ops-state.js.map +1 -0
- package/dist/domain/script/v3/patch/registry.d.ts +2 -0
- package/dist/domain/script/v3/patch/registry.js +53 -0
- package/dist/domain/script/v3/patch/registry.js.map +1 -0
- package/dist/domain/script/v3/patch/types.d.ts +10 -0
- package/dist/domain/script/v3/patch/types.js +2 -0
- package/dist/domain/script/v3/patch/types.js.map +1 -0
- package/dist/domain/script/v3/refs.d.ts +4 -0
- package/dist/domain/script/v3/refs.js +64 -0
- package/dist/domain/script/v3/refs.js.map +1 -0
- package/dist/domain/script/v3/scene-refs.d.ts +3 -0
- package/dist/domain/script/v3/scene-refs.js +35 -0
- package/dist/domain/script/v3/scene-refs.js.map +1 -0
- package/dist/domain/script/v3/schema.d.ts +6 -0
- package/dist/domain/script/v3/schema.js +56 -0
- package/dist/domain/script/v3/schema.js.map +1 -0
- package/dist/domain/script/v3/selector.d.ts +44 -0
- package/dist/domain/script/v3/selector.js +180 -0
- package/dist/domain/script/v3/selector.js.map +1 -0
- package/dist/domain/script/v3/types.d.ts +106 -0
- package/dist/domain/script/v3/types.js +2 -0
- package/dist/domain/script/v3/types.js.map +1 -0
- package/dist/domain/script/v3/validation.d.ts +3 -0
- package/dist/domain/script/v3/validation.js +200 -0
- package/dist/domain/script/v3/validation.js.map +1 -0
- package/dist/domain/script/v4/address.d.ts +61 -0
- package/dist/domain/script/v4/address.js +100 -0
- package/dist/domain/script/v4/address.js.map +1 -0
- package/dist/domain/script/v4/factory.d.ts +2 -0
- package/dist/domain/script/v4/factory.js +13 -0
- package/dist/domain/script/v4/factory.js.map +1 -0
- package/dist/domain/script/v4/from-v3.d.ts +29 -0
- package/dist/domain/script/v4/from-v3.js +307 -0
- package/dist/domain/script/v4/from-v3.js.map +1 -0
- package/dist/domain/script/v4/ids.d.ts +27 -0
- package/dist/domain/script/v4/ids.js +63 -0
- package/dist/domain/script/v4/ids.js.map +1 -0
- package/dist/domain/script/v4/ordinal.d.ts +3 -0
- package/dist/domain/script/v4/ordinal.js +67 -0
- package/dist/domain/script/v4/ordinal.js.map +1 -0
- package/dist/domain/script/v4/parse.d.ts +3 -0
- package/dist/domain/script/v4/parse.js +18 -0
- package/dist/domain/script/v4/parse.js.map +1 -0
- package/dist/domain/script/v4/patch/apply.d.ts +3 -0
- package/dist/domain/script/v4/patch/apply.js +24 -0
- package/dist/domain/script/v4/patch/apply.js.map +1 -0
- package/dist/domain/script/v4/patch/helpers.d.ts +32 -0
- package/dist/domain/script/v4/patch/helpers.js +139 -0
- package/dist/domain/script/v4/patch/helpers.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-action.d.ts +13 -0
- package/dist/domain/script/v4/patch/ops-action.js +379 -0
- package/dist/domain/script/v4/patch/ops-action.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-asset.d.ts +17 -0
- package/dist/domain/script/v4/patch/ops-asset.js +617 -0
- package/dist/domain/script/v4/patch/ops-asset.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-extend.d.ts +11 -0
- package/dist/domain/script/v4/patch/ops-extend.js +86 -0
- package/dist/domain/script/v4/patch/ops-extend.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-meta.d.ts +5 -0
- package/dist/domain/script/v4/patch/ops-meta.js +49 -0
- package/dist/domain/script/v4/patch/ops-meta.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-scene-ref.d.ts +3 -0
- package/dist/domain/script/v4/patch/ops-scene-ref.js +98 -0
- package/dist/domain/script/v4/patch/ops-scene-ref.js.map +1 -0
- package/dist/domain/script/v4/patch/ops-structure.d.ts +6 -0
- package/dist/domain/script/v4/patch/ops-structure.js +236 -0
- package/dist/domain/script/v4/patch/ops-structure.js.map +1 -0
- package/dist/domain/script/v4/patch/registry.d.ts +2 -0
- package/dist/domain/script/v4/patch/registry.js +50 -0
- package/dist/domain/script/v4/patch/registry.js.map +1 -0
- package/dist/domain/script/v4/patch/schema.d.ts +7 -0
- package/dist/domain/script/v4/patch/schema.js +75 -0
- package/dist/domain/script/v4/patch/schema.js.map +1 -0
- package/dist/domain/script/v4/patch/types.d.ts +10 -0
- package/dist/domain/script/v4/patch/types.js +2 -0
- package/dist/domain/script/v4/patch/types.js.map +1 -0
- package/dist/domain/script/v4/selector.d.ts +11 -0
- package/dist/domain/script/v4/selector.js +125 -0
- package/dist/domain/script/v4/selector.js.map +1 -0
- package/dist/domain/script/v4/types.d.ts +120 -0
- package/dist/domain/script/v4/types.js +2 -0
- package/dist/domain/script/v4/types.js.map +1 -0
- package/dist/domain/script/v4/validation.d.ts +2 -0
- package/dist/domain/script/v4/validation.js +378 -0
- package/dist/domain/script/v4/validation.js.map +1 -0
- package/dist/help-text.js +146 -114
- package/dist/help-text.js.map +1 -1
- package/dist/llm/config.js +2 -0
- package/dist/llm/config.js.map +1 -1
- package/dist/llm/registry.d.ts +1 -0
- package/dist/llm/registry.js +3 -0
- package/dist/llm/registry.js.map +1 -1
- package/dist/llm/tasks/ingest/asset-audit.d.ts +6 -0
- package/dist/llm/tasks/ingest/asset-audit.js +164 -0
- package/dist/llm/tasks/ingest/asset-audit.js.map +1 -0
- package/dist/llm/tasks/ingest/asset-curate.d.ts +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.js.map +1 -1
- package/dist/usecases/ingest/command.js +1 -1
- package/dist/usecases/ingest/final-asset-audit.d.ts +39 -0
- package/dist/usecases/ingest/final-asset-audit.js +88 -0
- package/dist/usecases/ingest/final-asset-audit.js.map +1 -0
- package/dist/usecases/ingest/pipeline.js +62 -11
- package/dist/usecases/ingest/pipeline.js.map +1 -1
- package/dist/usecases/ingest/serial-govern.d.ts +2 -1
- package/dist/usecases/ingest/serial-govern.js +11 -4
- package/dist/usecases/ingest/serial-govern.js.map +1 -1
- package/dist/usecases/ingest/video-pipeline.js +100 -14
- package/dist/usecases/ingest/video-pipeline.js.map +1 -1
- package/dist/usecases/ingest/view-server.js +2 -2
- package/dist/usecases/ingest/view-server.js.map +1 -1
- package/dist/usecases/script/actions.js +101 -5
- package/dist/usecases/script/actions.js.map +1 -1
- package/dist/usecases/script/actors.js +16 -7
- package/dist/usecases/script/actors.js.map +1 -1
- package/dist/usecases/script/alias.js +7 -6
- package/dist/usecases/script/alias.js.map +1 -1
- package/dist/usecases/script/assets.js +18 -2
- package/dist/usecases/script/assets.js.map +1 -1
- package/dist/usecases/script/audit-assets.d.ts +4 -0
- package/dist/usecases/script/audit-assets.js +40 -0
- package/dist/usecases/script/audit-assets.js.map +1 -0
- package/dist/usecases/script/command-constraints.d.ts +36 -0
- package/dist/usecases/script/command-constraints.js +115 -0
- package/dist/usecases/script/command-constraints.js.map +1 -0
- package/dist/usecases/script/context.js +31 -4
- package/dist/usecases/script/context.js.map +1 -1
- package/dist/usecases/script/create.js +2 -2
- package/dist/usecases/script/create.js.map +1 -1
- package/dist/usecases/script/delete.js +6 -3
- package/dist/usecases/script/delete.js.map +1 -1
- package/dist/usecases/script/describe.js +7 -4
- package/dist/usecases/script/describe.js.map +1 -1
- package/dist/usecases/script/dialogue.js +15 -5
- package/dist/usecases/script/dialogue.js.map +1 -1
- package/dist/usecases/script/dispatch.d.ts +3 -0
- package/dist/usecases/script/dispatch.js +10 -0
- package/dist/usecases/script/dispatch.js.map +1 -0
- package/dist/usecases/script/do.js +74 -11
- package/dist/usecases/script/do.js.map +1 -1
- package/dist/usecases/script/emotion.js +14 -3
- package/dist/usecases/script/emotion.js.map +1 -1
- package/dist/usecases/script/episodes.js +15 -4
- package/dist/usecases/script/episodes.js.map +1 -1
- package/dist/usecases/script/export-authoring.js +35 -11
- package/dist/usecases/script/export-authoring.js.map +1 -1
- package/dist/usecases/script/extend.js +23 -15
- package/dist/usecases/script/extend.js.map +1 -1
- package/dist/usecases/script/ids.js +53 -10
- package/dist/usecases/script/ids.js.map +1 -1
- package/dist/usecases/script/insert.js +74 -38
- package/dist/usecases/script/insert.js.map +1 -1
- package/dist/usecases/script/lib.d.ts +50 -1
- package/dist/usecases/script/lib.js +599 -61
- package/dist/usecases/script/lib.js.map +1 -1
- package/dist/usecases/script/locations.js +16 -7
- package/dist/usecases/script/locations.js.map +1 -1
- package/dist/usecases/script/merge.js +8 -5
- package/dist/usecases/script/merge.js.map +1 -1
- package/dist/usecases/script/move.js +24 -5
- package/dist/usecases/script/move.js.map +1 -1
- package/dist/usecases/script/parenthetical.d.ts +3 -0
- package/dist/usecases/script/parenthetical.js +55 -0
- package/dist/usecases/script/parenthetical.js.map +1 -0
- package/dist/usecases/script/props.js +16 -7
- package/dist/usecases/script/props.js.map +1 -1
- package/dist/usecases/script/refs.js +44 -0
- package/dist/usecases/script/refs.js.map +1 -1
- package/dist/usecases/script/rename.js +7 -4
- package/dist/usecases/script/rename.js.map +1 -1
- package/dist/usecases/script/scenes.js +32 -6
- package/dist/usecases/script/scenes.js.map +1 -1
- package/dist/usecases/script/script-patch.js +180 -16
- package/dist/usecases/script/script-patch.js.map +1 -1
- package/dist/usecases/script/session.d.ts +3 -0
- package/dist/usecases/script/session.js +25 -5
- package/dist/usecases/script/session.js.map +1 -1
- package/dist/usecases/script/split.js +12 -6
- package/dist/usecases/script/split.js.map +1 -1
- package/dist/usecases/script/states.js +45 -1
- package/dist/usecases/script/states.js.map +1 -1
- package/dist/usecases/script/synopsis.js +11 -4
- package/dist/usecases/script/synopsis.js.map +1 -1
- package/dist/usecases/script/v3/mutations.d.ts +2 -0
- package/dist/usecases/script/v3/mutations.js +5 -0
- package/dist/usecases/script/v3/mutations.js.map +1 -0
- package/dist/usecases/script/v4/mutations.d.ts +2 -0
- package/dist/usecases/script/v4/mutations.js +6 -0
- package/dist/usecases/script/v4/mutations.js.map +1 -0
- package/dist/usecases/script/v4/queries.d.ts +14 -0
- package/dist/usecases/script/v4/queries.js +154 -0
- package/dist/usecases/script/v4/queries.js.map +1 -0
- package/dist/usecases/script/working-copy.js +3 -3
- package/dist/usecases/script/working-copy.js.map +1 -1
- package/dist/usecases/script/write-authoring.js +99 -5
- package/dist/usecases/script/write-authoring.js.map +1 -1
- package/package.json +3 -2
- package/skills/scriptctl/SKILL.md +122 -282
- package/skills/scriptctl/references/atomic-edit-workflow.md +23 -38
- package/skills/scriptctl/references/bulk-authoring.md +35 -154
- package/skills/scriptctl/references/ingest-workflow.md +12 -11
- package/skills/scriptctl/references/production-writing-standard.md +38 -67
- package/skills/scriptctl/references/state-reference-repair.md +19 -42
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
-
import { CliError, EXIT_INPUT, EXIT_OK, EXIT_USAGE, scriptJsonPath, } from "../../common.js";
|
|
3
|
-
import {
|
|
2
|
+
import { CliError, EXIT_INPUT, EXIT_OK, EXIT_USAGE, exists, scriptJsonPath, } from "../../common.js";
|
|
3
|
+
import { requireScriptDocument } from "../../domain/script/dispatch.js";
|
|
4
|
+
import { generateV4Ids } from "../../domain/script/v4/ids.js";
|
|
4
5
|
import { strOf } from "../../domain/script/shared.js";
|
|
5
6
|
const PREFIX = {
|
|
6
7
|
actor: "act",
|
|
@@ -9,6 +10,7 @@ const PREFIX = {
|
|
|
9
10
|
state: "st",
|
|
10
11
|
episode: "ep",
|
|
11
12
|
scene: "scn",
|
|
13
|
+
action: "ac",
|
|
12
14
|
};
|
|
13
15
|
function isIdKind(value) {
|
|
14
16
|
return value === "actor"
|
|
@@ -16,34 +18,37 @@ function isIdKind(value) {
|
|
|
16
18
|
|| value === "prop"
|
|
17
19
|
|| value === "state"
|
|
18
20
|
|| value === "episode"
|
|
19
|
-
|| value === "scene"
|
|
21
|
+
|| value === "scene"
|
|
22
|
+
|| value === "action";
|
|
20
23
|
}
|
|
21
24
|
function usage(message, received) {
|
|
22
25
|
throw new CliError("IDS BLOCKED: invalid invocation", message, {
|
|
23
26
|
exitCode: EXIT_USAGE,
|
|
24
27
|
errorCode: "IDS_USAGE_INVALID",
|
|
25
|
-
required: ["--kind actor|location|prop|state|episode|scene", "--count <positive integer>"],
|
|
28
|
+
required: ["--kind actor|location|prop|state|episode|scene|action", "--count <positive integer>"],
|
|
26
29
|
received,
|
|
27
30
|
nextSteps: ["Pass one canonical ID kind and the number of candidate IDs needed."],
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
33
|
function readScript(opts) {
|
|
31
34
|
const scriptPath = scriptJsonPath(opts);
|
|
35
|
+
if (!exists(scriptPath))
|
|
36
|
+
return null;
|
|
32
37
|
let parsed;
|
|
33
38
|
try {
|
|
34
39
|
parsed = JSON.parse(fs.readFileSync(scriptPath, "utf-8"));
|
|
35
40
|
}
|
|
36
41
|
catch (error) {
|
|
37
|
-
throw new CliError("IDS BLOCKED: local script unavailable", "The local
|
|
42
|
+
throw new CliError("IDS BLOCKED: local script unavailable", "The local script file cannot be read.", {
|
|
38
43
|
exitCode: EXIT_INPUT,
|
|
39
44
|
errorCode: "SCRIPT_JSON_UNAVAILABLE",
|
|
40
45
|
received: [scriptPath, error instanceof Error ? error.message : String(error)],
|
|
41
|
-
nextSteps: ["
|
|
46
|
+
nextSteps: ["Fix the local JSON file, or pass a path that does not exist to generate unbound v4 candidates."],
|
|
42
47
|
});
|
|
43
48
|
}
|
|
44
|
-
return
|
|
49
|
+
return requireScriptDocument(parsed);
|
|
45
50
|
}
|
|
46
|
-
function
|
|
51
|
+
function existingIdsV3(script, kind) {
|
|
47
52
|
if (kind === "actor")
|
|
48
53
|
return script.actors.map((asset) => asset.actor_id);
|
|
49
54
|
if (kind === "location")
|
|
@@ -60,7 +65,7 @@ function existingIds(script, kind) {
|
|
|
60
65
|
...script.props.flatMap((asset) => asset.states.map((state) => state.state_id)),
|
|
61
66
|
].filter((id) => id !== "default");
|
|
62
67
|
}
|
|
63
|
-
function
|
|
68
|
+
function allocateV3(ids, prefix, count) {
|
|
64
69
|
const pattern = new RegExp(`^${prefix}_(\\d+)$`);
|
|
65
70
|
let maximum = 0;
|
|
66
71
|
for (const id of ids) {
|
|
@@ -73,6 +78,26 @@ function allocate(ids, prefix, count) {
|
|
|
73
78
|
return `${prefix}_${String(value).padStart(3, "0")}`;
|
|
74
79
|
});
|
|
75
80
|
}
|
|
81
|
+
function existingIdsV4(script, kind) {
|
|
82
|
+
if (kind === "actor")
|
|
83
|
+
return script.actors.map((asset) => asset.actor_id);
|
|
84
|
+
if (kind === "location")
|
|
85
|
+
return script.locations.map((asset) => asset.location_id);
|
|
86
|
+
if (kind === "prop")
|
|
87
|
+
return script.props.map((asset) => asset.prop_id);
|
|
88
|
+
if (kind === "episode")
|
|
89
|
+
return script.episodes.map((episode) => episode.episode_id);
|
|
90
|
+
if (kind === "scene")
|
|
91
|
+
return script.episodes.flatMap((episode) => episode.scenes.map((scene) => scene.scene_id));
|
|
92
|
+
if (kind === "action") {
|
|
93
|
+
return script.episodes.flatMap((episode) => episode.scenes.flatMap((scene) => scene.actions.map((action) => action.action_id)));
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
...script.actors.flatMap((asset) => asset.states.map((state) => state.state_id)),
|
|
97
|
+
...script.locations.flatMap((asset) => asset.states.map((state) => state.state_id)),
|
|
98
|
+
...script.props.flatMap((asset) => asset.states.map((state) => state.state_id)),
|
|
99
|
+
].filter((id) => id !== "default");
|
|
100
|
+
}
|
|
76
101
|
export function commandIds(opts) {
|
|
77
102
|
const rawKind = strOf(opts["kind"]).trim();
|
|
78
103
|
if (!isIdKind(rawKind))
|
|
@@ -85,7 +110,24 @@ export function commandIds(opts) {
|
|
|
85
110
|
if (!Number.isSafeInteger(count))
|
|
86
111
|
usage("ID count is outside the safe integer range.", [rawCount]);
|
|
87
112
|
const script = readScript(opts);
|
|
88
|
-
|
|
113
|
+
let candidates;
|
|
114
|
+
let scriptVersion;
|
|
115
|
+
if (script?.version === 3) {
|
|
116
|
+
scriptVersion = 3;
|
|
117
|
+
if (kind === "action") {
|
|
118
|
+
throw new CliError("IDS BLOCKED: Script v3 has no Action IDs", "Action IDs belong to Script v4.", {
|
|
119
|
+
exitCode: EXIT_USAGE,
|
|
120
|
+
errorCode: "V3_ACTION_ID_UNSUPPORTED",
|
|
121
|
+
nextSteps: ["Generate unbound v4 candidates without an existing v3 --script-path."],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
candidates = allocateV3(existingIdsV3(script, kind), PREFIX[kind], count);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
scriptVersion = script?.version ?? null;
|
|
128
|
+
const existing = script === null ? new Set() : new Set(existingIdsV4(script, kind));
|
|
129
|
+
candidates = generateV4Ids(kind, count, existing);
|
|
130
|
+
}
|
|
89
131
|
const rows = candidates.map((id) => ({ addr: id, kind, id }));
|
|
90
132
|
const report = {
|
|
91
133
|
title: "IDS",
|
|
@@ -95,6 +137,7 @@ export function commandIds(opts) {
|
|
|
95
137
|
kind,
|
|
96
138
|
count,
|
|
97
139
|
reserved: false,
|
|
140
|
+
script_version: scriptVersion,
|
|
98
141
|
};
|
|
99
142
|
return [report, EXIT_OK];
|
|
100
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../../src/usecases/script/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../../src/usecases/script/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,MAAM,EACN,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAuB,MAAM,iCAAiC,CAAC;AAE7F,OAAO,EAAE,aAAa,EAAiB,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,KAAK,EAAa,MAAM,+BAA+B,CAAC;AAEjE,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,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;gBAChG,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,0BAA0B;gBACrC,SAAS,EAAE,CAAC,sEAAsE,CAAC;aACpF,CAAC,CAAC;QACL,CAAC;QACD,UAAU,GAAG,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC;SAAM,CAAC;QACN,aAAa,GAAG,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,EAAU,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5F,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAW;QACrB,KAAK,EAAE,KAAK;QACZ,EAAE,EAAE,KAAK;QACT,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QACnC,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,QAAQ,EAAE,KAAK;QACf,cAAc,EAAE,aAAa;KAC9B,CAAC;IACF,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { CliError, EXIT_USAGE, } from "../../common.js";
|
|
2
2
|
import { parseAnyAddress, } from "../../domain/script/address.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { parseV4Address } from "../../domain/script/v4/address.js";
|
|
4
|
+
import { asList, strOf, } from "../../domain/script/shared.js";
|
|
5
|
+
import { loadScriptForEdit, } from "./session.js";
|
|
6
|
+
import { applySingleScriptOpToSession, } from "./lib.js";
|
|
7
|
+
import { assertInsertCommandFlags } from "./command-constraints.js";
|
|
8
|
+
function repeatedStrings(raw) {
|
|
9
|
+
if (raw === undefined)
|
|
10
|
+
return [];
|
|
11
|
+
return Array.isArray(raw) ? raw.map(strOf) : [strOf(raw)];
|
|
12
|
+
}
|
|
13
|
+
function insertFlags(opts) {
|
|
14
|
+
return {
|
|
15
|
+
type: opts["type"],
|
|
16
|
+
content: opts["content"],
|
|
17
|
+
emotion: opts["emotion"],
|
|
18
|
+
parenthetical: opts["parenthetical"],
|
|
19
|
+
actionId: opts["action_id"],
|
|
20
|
+
at: opts["at_index"] ?? opts["at"],
|
|
21
|
+
before: opts["before"],
|
|
22
|
+
after: opts["after"],
|
|
23
|
+
actor: opts["actor_id"] ?? opts["actor"],
|
|
24
|
+
speaker: opts["speaker_id"] ?? opts["speaker"],
|
|
25
|
+
speakerState: opts["speaker_state"],
|
|
26
|
+
kind: opts["kind"],
|
|
27
|
+
label: opts["label"],
|
|
28
|
+
location: opts["location"],
|
|
29
|
+
time: opts["time"],
|
|
30
|
+
space: opts["space"],
|
|
31
|
+
sceneId: opts["scene_id"],
|
|
32
|
+
states: repeatedStrings(opts["state"]),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
5
35
|
export async function commandInsert(opts) {
|
|
6
36
|
const args = asList(opts["_args"]);
|
|
7
37
|
if (args.length < 1) {
|
|
@@ -13,45 +43,51 @@ export async function commandInsert(opts) {
|
|
|
13
43
|
errorCode: "ADDRESS_MISSING",
|
|
14
44
|
});
|
|
15
45
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const allow = new Set(allowed);
|
|
37
|
-
const bad = [];
|
|
38
|
-
for (const f of Object.keys(flagsUsed)) {
|
|
39
|
-
if (flagsUsed[f] && !allow.has(f))
|
|
40
|
-
bad.push(`--${f}`);
|
|
46
|
+
const session = await loadScriptForEdit(opts);
|
|
47
|
+
const flags = insertFlags(opts);
|
|
48
|
+
if (session.version === 4) {
|
|
49
|
+
const addr = parseV4Address(args[0]);
|
|
50
|
+
if (addr.kind === "scene") {
|
|
51
|
+
assertInsertCommandFlags(session.version, "action", flags);
|
|
52
|
+
return applySingleScriptOpToSession(session, opts, {
|
|
53
|
+
op: "action.insert",
|
|
54
|
+
at: addr.id,
|
|
55
|
+
action_id: opts["action_id"],
|
|
56
|
+
type: opts["type"],
|
|
57
|
+
content: opts["content"],
|
|
58
|
+
parenthetical: opts["parenthetical"],
|
|
59
|
+
before: opts["before"],
|
|
60
|
+
after: opts["after"],
|
|
61
|
+
actor_id: opts["actor_id"] ?? opts["actor"],
|
|
62
|
+
state_id: opts["speaker_state"],
|
|
63
|
+
kind: opts["kind"],
|
|
64
|
+
label: opts["label"],
|
|
65
|
+
});
|
|
41
66
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
if (addr.kind === "episode") {
|
|
68
|
+
assertInsertCommandFlags(session.version, "scene", flags);
|
|
69
|
+
return applySingleScriptOpToSession(session, opts, {
|
|
70
|
+
op: "scene.insert",
|
|
71
|
+
at: addr.id,
|
|
72
|
+
location: opts["location"],
|
|
73
|
+
location_state_ids: flags.states,
|
|
74
|
+
time: opts["time"],
|
|
75
|
+
space: opts["space"],
|
|
76
|
+
scene_id: opts["scene_id"],
|
|
77
|
+
before: opts["before"],
|
|
78
|
+
after: opts["after"],
|
|
49
79
|
});
|
|
50
80
|
}
|
|
81
|
+
throw new CliError("INSERT BLOCKED: v4 parent address required", "Insert targets a v4 episode or scene ID.", {
|
|
82
|
+
exitCode: EXIT_USAGE,
|
|
83
|
+
errorCode: "ADDRESS_UNSUPPORTED",
|
|
84
|
+
received: [args[0]],
|
|
85
|
+
});
|
|
51
86
|
}
|
|
87
|
+
const addr = parseAnyAddress(args[0]);
|
|
52
88
|
if (addr.kind === "scene") {
|
|
53
|
-
|
|
54
|
-
return
|
|
89
|
+
assertInsertCommandFlags(session.version, "action", flags);
|
|
90
|
+
return applySingleScriptOpToSession(session, opts, {
|
|
55
91
|
op: "action.insert",
|
|
56
92
|
at: args[0],
|
|
57
93
|
type: opts["type"],
|
|
@@ -67,8 +103,8 @@ export async function commandInsert(opts) {
|
|
|
67
103
|
});
|
|
68
104
|
}
|
|
69
105
|
if (addr.kind === "episode") {
|
|
70
|
-
|
|
71
|
-
return
|
|
106
|
+
assertInsertCommandFlags(session.version, "scene", flags);
|
|
107
|
+
return applySingleScriptOpToSession(session, opts, {
|
|
72
108
|
op: "scene.insert",
|
|
73
109
|
at: addr.episodeId,
|
|
74
110
|
location: opts["location"],
|
|
@@ -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;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAWnE,OAAO,EACL,MAAM,EAIN,KAAK,GACN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL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E,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,4 +1,5 @@
|
|
|
1
1
|
import { CliError, type Report } from "../../common.js";
|
|
2
|
+
import { validateScriptV4 } from "../../domain/script/v4/validation.js";
|
|
2
3
|
import { type InSelector } from "../../domain/script/selector.js";
|
|
3
4
|
import { sortDeep } from "../../domain/script/text-util.js";
|
|
4
5
|
import { type Dict } from "../../domain/script/shared.js";
|
|
@@ -44,7 +45,7 @@ export declare function dialogueTemplate(f: {
|
|
|
44
45
|
kind?: unknown;
|
|
45
46
|
label?: unknown;
|
|
46
47
|
}): Dict;
|
|
47
|
-
export declare function lineToOp(verb: string, args: string[], flags: Dict): Dict;
|
|
48
|
+
export declare function lineToOp(verb: string, args: string[], flags: Dict, scriptVersion?: 3 | 4): Dict;
|
|
48
49
|
export declare function actionAddress(epId: string, sceneId: string, idx: number): string;
|
|
49
50
|
export declare function actionTimestamp(action: Dict): string;
|
|
50
51
|
export declare function sceneTimeSpan(scene: Dict): {
|
|
@@ -54,9 +55,57 @@ export declare function sceneTimeSpan(scene: Dict): {
|
|
|
54
55
|
export declare function actionDisplayFields(epId: string, sceneId: string, idx: number, action: Dict): Record<string, unknown>;
|
|
55
56
|
export declare function formatInspectAction(epId: string, sceneId: string, idx: number, action: Dict): string;
|
|
56
57
|
export declare const SKIPPABLE_EDIT_CODES: Set<string>;
|
|
58
|
+
export declare function applyPatchOperationsForSession(session: ScriptEditSession, source: string, operations: Dict[]): string[];
|
|
59
|
+
export interface V4MutationCounts {
|
|
60
|
+
episodes: number;
|
|
61
|
+
scenes: number;
|
|
62
|
+
actions: number;
|
|
63
|
+
actors: number;
|
|
64
|
+
locations: number;
|
|
65
|
+
props: number;
|
|
66
|
+
states: number;
|
|
67
|
+
}
|
|
68
|
+
export interface V4MutationPlanStep {
|
|
69
|
+
index: number;
|
|
70
|
+
operation: Dict;
|
|
71
|
+
targets: string[];
|
|
72
|
+
status: "applied" | "skipped";
|
|
73
|
+
before: V4MutationCounts;
|
|
74
|
+
after: V4MutationCounts;
|
|
75
|
+
created_ids: string[];
|
|
76
|
+
removed_ids: string[];
|
|
77
|
+
retained_ids: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface V4MutationPlan {
|
|
80
|
+
version: 1;
|
|
81
|
+
script_version: 4;
|
|
82
|
+
baseline: string;
|
|
83
|
+
operations: Dict[];
|
|
84
|
+
targets: string[];
|
|
85
|
+
steps: V4MutationPlanStep[];
|
|
86
|
+
before: V4MutationCounts;
|
|
87
|
+
after: V4MutationCounts;
|
|
88
|
+
created_ids: string[];
|
|
89
|
+
removed_ids: string[];
|
|
90
|
+
retained_ids: string[];
|
|
91
|
+
untouched_ids: string[];
|
|
92
|
+
validation: ReturnType<typeof validateScriptV4>;
|
|
93
|
+
}
|
|
94
|
+
export interface V4MutationPlanResult {
|
|
95
|
+
plan: V4MutationPlan;
|
|
96
|
+
digest: string;
|
|
97
|
+
applied: string[];
|
|
98
|
+
}
|
|
99
|
+
export declare function buildV4MutationPlan(session: ScriptEditSession, operations: Dict[], options?: {
|
|
100
|
+
skipCodes?: ReadonlySet<string>;
|
|
101
|
+
}): V4MutationPlanResult;
|
|
102
|
+
export declare function assertV4PlanHasExplicitNewIds(operations: Dict[]): void;
|
|
103
|
+
export declare function applySingleScriptOpToSession(session: ScriptEditSession, opts: Dict, op: Dict): Promise<[Report, number]>;
|
|
104
|
+
export declare function applyScriptOpsToSession(session: ScriptEditSession, opts: Dict, operations: Dict[]): Promise<[Report, number]>;
|
|
57
105
|
export declare function applySingleScriptOp(opts: Dict, op: Dict): Promise<[Report, number]>;
|
|
58
106
|
export declare function summarizeScriptOp(_script: Dict, op: Dict): string;
|
|
59
107
|
export declare function regexPattern(raw: string): string;
|
|
108
|
+
export declare function applySelectorEditsToSession(session: ScriptEditSession, opts: Dict, template: Dict, verbLabel: string): Promise<[Report, number]>;
|
|
60
109
|
export declare function applySelectorEdits(opts: Dict, template: Dict, verbLabel: string): Promise<[Report, number]>;
|
|
61
110
|
export { sortDeep };
|
|
62
111
|
export declare function actionActorId(action: Dict): string;
|