@lingjingai/scriptctl 0.63.14 → 0.63.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/changes/0.63.15.md +15 -0
- package/dist/bin.js +1 -20844
- package/dist/chunk-YOCQDDQC.js +823 -0
- package/dist/cli.d.ts +214 -5
- package/dist/cli.js +1 -187
- package/dist/review-agent.js +60 -3593
- package/package.json +17 -9
- package/skills/scriptctl/SKILL.md +2 -0
- package/skills/scriptctl/references/ingest-workflow.md +4 -0
- package/skills/scriptctl/references/production-writing-standard.md +10 -1
- package/skills/scriptctl/references/state-reference-repair.md +8 -0
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js.map +0 -7
- package/dist/cli/register-authoring.d.ts +0 -4
- package/dist/cli/register-authoring.js +0 -35
- package/dist/cli/register-authoring.js.map +0 -1
- package/dist/cli/register-review.d.ts +0 -3
- package/dist/cli/register-review.js +0 -20
- package/dist/cli/register-review.js.map +0 -1
- package/dist/cli/register-script.d.ts +0 -3
- package/dist/cli/register-script.js +0 -297
- package/dist/cli/register-script.js.map +0 -1
- package/dist/cli/register-tools.d.ts +0 -3
- package/dist/cli/register-tools.js +0 -23
- package/dist/cli/register-tools.js.map +0 -1
- package/dist/cli/register-workflows.d.ts +0 -4
- package/dist/cli/register-workflows.js +0 -108
- package/dist/cli/register-workflows.js.map +0 -1
- package/dist/cli/registry.d.ts +0 -14
- package/dist/cli/registry.js +0 -65
- package/dist/cli/registry.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/common.d.ts +0 -93
- package/dist/common.js +0 -240
- package/dist/common.js.map +0 -1
- package/dist/domain/authoring/apply.d.ts +0 -1
- package/dist/domain/authoring/apply.js +0 -2
- package/dist/domain/authoring/apply.js.map +0 -1
- package/dist/domain/authoring/export.d.ts +0 -1
- package/dist/domain/authoring/export.js +0 -2
- package/dist/domain/authoring/export.js.map +0 -1
- package/dist/domain/authoring/parser.d.ts +0 -2
- package/dist/domain/authoring/parser.js +0 -3
- package/dist/domain/authoring/parser.js.map +0 -1
- package/dist/domain/authoring/serializer.d.ts +0 -1
- package/dist/domain/authoring/serializer.js +0 -2
- package/dist/domain/authoring/serializer.js.map +0 -1
- package/dist/domain/authoring/shared/bracket.d.ts +0 -4
- package/dist/domain/authoring/shared/bracket.js +0 -95
- package/dist/domain/authoring/shared/bracket.js.map +0 -1
- package/dist/domain/authoring/shared/types.d.ts +0 -12
- package/dist/domain/authoring/shared/types.js +0 -2
- package/dist/domain/authoring/shared/types.js.map +0 -1
- package/dist/domain/authoring/types.d.ts +0 -2
- package/dist/domain/authoring/types.js +0 -3
- package/dist/domain/authoring/types.js.map +0 -1
- package/dist/domain/authoring/v3/apply.d.ts +0 -33
- package/dist/domain/authoring/v3/apply.js +0 -784
- package/dist/domain/authoring/v3/apply.js.map +0 -1
- package/dist/domain/authoring/v3/export.d.ts +0 -7
- package/dist/domain/authoring/v3/export.js +0 -85
- package/dist/domain/authoring/v3/export.js.map +0 -1
- package/dist/domain/authoring/v3/parser.d.ts +0 -3
- package/dist/domain/authoring/v3/parser.js +0 -823
- package/dist/domain/authoring/v3/parser.js.map +0 -1
- package/dist/domain/authoring/v3/serializer.d.ts +0 -2
- package/dist/domain/authoring/v3/serializer.js +0 -244
- package/dist/domain/authoring/v3/serializer.js.map +0 -1
- package/dist/domain/authoring/v3/types.d.ts +0 -76
- package/dist/domain/authoring/v3/types.js +0 -2
- package/dist/domain/authoring/v3/types.js.map +0 -1
- package/dist/domain/authoring/v4/apply.d.ts +0 -40
- package/dist/domain/authoring/v4/apply.js +0 -451
- package/dist/domain/authoring/v4/apply.js.map +0 -1
- package/dist/domain/authoring/v4/parser.d.ts +0 -2
- package/dist/domain/authoring/v4/parser.js +0 -729
- package/dist/domain/authoring/v4/parser.js.map +0 -1
- package/dist/domain/authoring/v4/serializer.d.ts +0 -6
- package/dist/domain/authoring/v4/serializer.js +0 -280
- package/dist/domain/authoring/v4/serializer.js.map +0 -1
- package/dist/domain/authoring/v4/types.d.ts +0 -50
- package/dist/domain/authoring/v4/types.js +0 -2
- package/dist/domain/authoring/v4/types.js.map +0 -1
- package/dist/domain/creative-draft/compose.d.ts +0 -18
- package/dist/domain/creative-draft/compose.js +0 -448
- package/dist/domain/creative-draft/compose.js.map +0 -1
- package/dist/domain/ingest/apply-plan.d.ts +0 -23
- package/dist/domain/ingest/apply-plan.js +0 -210
- package/dist/domain/ingest/apply-plan.js.map +0 -1
- package/dist/domain/ingest/assembler.d.ts +0 -65
- package/dist/domain/ingest/assembler.js +0 -263
- package/dist/domain/ingest/assembler.js.map +0 -1
- package/dist/domain/ingest/asset-audit.d.ts +0 -50
- package/dist/domain/ingest/asset-audit.js +0 -196
- package/dist/domain/ingest/asset-audit.js.map +0 -1
- package/dist/domain/ingest/chunker.d.ts +0 -9
- package/dist/domain/ingest/chunker.js +0 -49
- package/dist/domain/ingest/chunker.js.map +0 -1
- package/dist/domain/ingest/environment.d.ts +0 -3
- package/dist/domain/ingest/environment.js +0 -32
- package/dist/domain/ingest/environment.js.map +0 -1
- package/dist/domain/ingest/evidence.d.ts +0 -5
- package/dist/domain/ingest/evidence.js +0 -66
- package/dist/domain/ingest/evidence.js.map +0 -1
- package/dist/domain/ingest/govern.d.ts +0 -3
- package/dist/domain/ingest/govern.js +0 -157
- package/dist/domain/ingest/govern.js.map +0 -1
- package/dist/domain/ingest/jsonl-parser.d.ts +0 -6
- package/dist/domain/ingest/jsonl-parser.js +0 -204
- package/dist/domain/ingest/jsonl-parser.js.map +0 -1
- package/dist/domain/ingest/markdown-parser.d.ts +0 -6
- package/dist/domain/ingest/markdown-parser.js +0 -187
- package/dist/domain/ingest/markdown-parser.js.map +0 -1
- package/dist/domain/ingest/production-validation.d.ts +0 -8
- package/dist/domain/ingest/production-validation.js +0 -37
- package/dist/domain/ingest/production-validation.js.map +0 -1
- package/dist/domain/ingest/records.d.ts +0 -72
- package/dist/domain/ingest/records.js +0 -10
- package/dist/domain/ingest/records.js.map +0 -1
- package/dist/domain/ingest/renumber.d.ts +0 -14
- package/dist/domain/ingest/renumber.js +0 -130
- package/dist/domain/ingest/renumber.js.map +0 -1
- package/dist/domain/ingest/serial-context.d.ts +0 -93
- package/dist/domain/ingest/serial-context.js +0 -355
- package/dist/domain/ingest/serial-context.js.map +0 -1
- package/dist/domain/ingest/state-identity.d.ts +0 -2
- package/dist/domain/ingest/state-identity.js +0 -3
- package/dist/domain/ingest/state-identity.js.map +0 -1
- package/dist/domain/ingest/state-reconcile.d.ts +0 -12
- package/dist/domain/ingest/state-reconcile.js +0 -92
- package/dist/domain/ingest/state-reconcile.js.map +0 -1
- package/dist/domain/ingest/validation.d.ts +0 -1
- package/dist/domain/ingest/validation.js +0 -2
- package/dist/domain/ingest/validation.js.map +0 -1
- package/dist/domain/ingest/video-apply.d.ts +0 -4
- package/dist/domain/ingest/video-apply.js +0 -128
- package/dist/domain/ingest/video-apply.js.map +0 -1
- package/dist/domain/ingest/video-context.d.ts +0 -64
- package/dist/domain/ingest/video-context.js +0 -480
- package/dist/domain/ingest/video-context.js.map +0 -1
- package/dist/domain/ingest/video-records.d.ts +0 -57
- package/dist/domain/ingest/video-records.js +0 -9
- package/dist/domain/ingest/video-records.js.map +0 -1
- package/dist/domain/ingest/video-serial-md.d.ts +0 -81
- package/dist/domain/ingest/video-serial-md.js +0 -297
- package/dist/domain/ingest/video-serial-md.js.map +0 -1
- package/dist/domain/ingest/video-source-evolution.d.ts +0 -25
- package/dist/domain/ingest/video-source-evolution.js +0 -40
- package/dist/domain/ingest/video-source-evolution.js.map +0 -1
- package/dist/domain/ingest/video-state-evidence.d.ts +0 -66
- package/dist/domain/ingest/video-state-evidence.js +0 -385
- package/dist/domain/ingest/video-state-evidence.js.map +0 -1
- package/dist/domain/ingest/video-timestamp.d.ts +0 -8
- package/dist/domain/ingest/video-timestamp.js +0 -26
- package/dist/domain/ingest/video-timestamp.js.map +0 -1
- package/dist/domain/loom/checkpointer.d.ts +0 -3
- package/dist/domain/loom/checkpointer.js +0 -30
- package/dist/domain/loom/checkpointer.js.map +0 -1
- package/dist/domain/loom/index.d.ts +0 -45
- package/dist/domain/loom/index.js +0 -277
- package/dist/domain/loom/index.js.map +0 -1
- package/dist/domain/loom/types.d.ts +0 -101
- package/dist/domain/loom/types.js +0 -2
- package/dist/domain/loom/types.js.map +0 -1
- package/dist/domain/script/address.d.ts +0 -1
- package/dist/domain/script/address.js +0 -2
- package/dist/domain/script/address.js.map +0 -1
- package/dist/domain/script/dispatch.d.ts +0 -18
- package/dist/domain/script/dispatch.js +0 -55
- package/dist/domain/script/dispatch.js.map +0 -1
- package/dist/domain/script/lookups.d.ts +0 -1
- package/dist/domain/script/lookups.js +0 -2
- package/dist/domain/script/lookups.js.map +0 -1
- package/dist/domain/script/migrations/registry.d.ts +0 -4
- package/dist/domain/script/migrations/registry.js +0 -76
- package/dist/domain/script/migrations/registry.js.map +0 -1
- package/dist/domain/script/migrations/types.d.ts +0 -17
- package/dist/domain/script/migrations/types.js +0 -2
- package/dist/domain/script/migrations/types.js.map +0 -1
- package/dist/domain/script/migrations/v3-to-v4.d.ts +0 -3
- package/dist/domain/script/migrations/v3-to-v4.js +0 -57
- package/dist/domain/script/migrations/v3-to-v4.js.map +0 -1
- package/dist/domain/script/names.d.ts +0 -1
- package/dist/domain/script/names.js +0 -2
- package/dist/domain/script/names.js.map +0 -1
- package/dist/domain/script/parse.d.ts +0 -1
- package/dist/domain/script/parse.js +0 -2
- package/dist/domain/script/parse.js.map +0 -1
- package/dist/domain/script/patch/apply.d.ts +0 -1
- package/dist/domain/script/patch/apply.js +0 -2
- package/dist/domain/script/patch/apply.js.map +0 -1
- package/dist/domain/script/patch/helpers.d.ts +0 -1
- package/dist/domain/script/patch/helpers.js +0 -2
- package/dist/domain/script/patch/helpers.js.map +0 -1
- package/dist/domain/script/patch/inline-speaker.d.ts +0 -1
- package/dist/domain/script/patch/inline-speaker.js +0 -2
- package/dist/domain/script/patch/inline-speaker.js.map +0 -1
- package/dist/domain/script/patch/ops-action.d.ts +0 -1
- package/dist/domain/script/patch/ops-action.js +0 -2
- package/dist/domain/script/patch/ops-action.js.map +0 -1
- package/dist/domain/script/patch/ops-asset.d.ts +0 -1
- package/dist/domain/script/patch/ops-asset.js +0 -2
- package/dist/domain/script/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/patch/ops-dialogue.d.ts +0 -1
- package/dist/domain/script/patch/ops-dialogue.js +0 -2
- package/dist/domain/script/patch/ops-dialogue.js.map +0 -1
- package/dist/domain/script/patch/ops-extend.d.ts +0 -1
- package/dist/domain/script/patch/ops-extend.js +0 -2
- package/dist/domain/script/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/patch/ops-meta.d.ts +0 -1
- package/dist/domain/script/patch/ops-meta.js +0 -2
- package/dist/domain/script/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/patch/ops-scene.d.ts +0 -1
- package/dist/domain/script/patch/ops-scene.js +0 -2
- package/dist/domain/script/patch/ops-scene.js.map +0 -1
- package/dist/domain/script/patch/ops-state.d.ts +0 -1
- package/dist/domain/script/patch/ops-state.js +0 -2
- package/dist/domain/script/patch/ops-state.js.map +0 -1
- package/dist/domain/script/patch/registry.d.ts +0 -1
- package/dist/domain/script/patch/registry.js +0 -2
- package/dist/domain/script/patch/registry.js.map +0 -1
- package/dist/domain/script/patch/types.d.ts +0 -1
- package/dist/domain/script/patch/types.js +0 -2
- package/dist/domain/script/patch/types.js.map +0 -1
- package/dist/domain/script/refs.d.ts +0 -1
- package/dist/domain/script/refs.js +0 -2
- package/dist/domain/script/refs.js.map +0 -1
- package/dist/domain/script/scene-refs.d.ts +0 -1
- package/dist/domain/script/scene-refs.js +0 -2
- package/dist/domain/script/scene-refs.js.map +0 -1
- package/dist/domain/script/schema.d.ts +0 -1
- package/dist/domain/script/schema.js +0 -2
- package/dist/domain/script/schema.js.map +0 -1
- package/dist/domain/script/selector.d.ts +0 -1
- package/dist/domain/script/selector.js +0 -2
- package/dist/domain/script/selector.js.map +0 -1
- package/dist/domain/script/shared/regex.d.ts +0 -2
- package/dist/domain/script/shared/regex.js +0 -7
- package/dist/domain/script/shared/regex.js.map +0 -1
- package/dist/domain/script/shared/types.d.ts +0 -1
- package/dist/domain/script/shared/types.js +0 -5
- package/dist/domain/script/shared/types.js.map +0 -1
- package/dist/domain/script/shared/validation.d.ts +0 -1
- package/dist/domain/script/shared/validation.js +0 -3
- package/dist/domain/script/shared/validation.js.map +0 -1
- package/dist/domain/script/shared.d.ts +0 -15
- package/dist/domain/script/shared.js +0 -35
- package/dist/domain/script/shared.js.map +0 -1
- package/dist/domain/script/text-util.d.ts +0 -7
- package/dist/domain/script/text-util.js +0 -95
- package/dist/domain/script/text-util.js.map +0 -1
- package/dist/domain/script/timestamp.d.ts +0 -1
- package/dist/domain/script/timestamp.js +0 -3
- package/dist/domain/script/timestamp.js.map +0 -1
- package/dist/domain/script/types.d.ts +0 -1
- package/dist/domain/script/types.js +0 -2
- package/dist/domain/script/types.js.map +0 -1
- package/dist/domain/script/v3/address.d.ts +0 -32
- package/dist/domain/script/v3/address.js +0 -136
- package/dist/domain/script/v3/address.js.map +0 -1
- package/dist/domain/script/v3/lookups.d.ts +0 -33
- package/dist/domain/script/v3/lookups.js +0 -316
- package/dist/domain/script/v3/lookups.js.map +0 -1
- package/dist/domain/script/v3/ordinal.d.ts +0 -8
- package/dist/domain/script/v3/ordinal.js +0 -91
- package/dist/domain/script/v3/ordinal.js.map +0 -1
- package/dist/domain/script/v3/parse.d.ts +0 -3
- package/dist/domain/script/v3/parse.js +0 -164
- package/dist/domain/script/v3/parse.js.map +0 -1
- package/dist/domain/script/v3/patch/apply.d.ts +0 -2
- package/dist/domain/script/v3/patch/apply.js +0 -31
- package/dist/domain/script/v3/patch/apply.js.map +0 -1
- package/dist/domain/script/v3/patch/helpers.d.ts +0 -15
- package/dist/domain/script/v3/patch/helpers.js +0 -155
- package/dist/domain/script/v3/patch/helpers.js.map +0 -1
- package/dist/domain/script/v3/patch/inline-speaker.d.ts +0 -2
- package/dist/domain/script/v3/patch/inline-speaker.js +0 -50
- package/dist/domain/script/v3/patch/inline-speaker.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-action.d.ts +0 -12
- package/dist/domain/script/v3/patch/ops-action.js +0 -355
- package/dist/domain/script/v3/patch/ops-action.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-asset.d.ts +0 -14
- package/dist/domain/script/v3/patch/ops-asset.js +0 -347
- package/dist/domain/script/v3/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-dialogue.d.ts +0 -2
- package/dist/domain/script/v3/patch/ops-dialogue.js +0 -21
- package/dist/domain/script/v3/patch/ops-dialogue.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-extend.d.ts +0 -8
- package/dist/domain/script/v3/patch/ops-extend.js +0 -122
- package/dist/domain/script/v3/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-meta.d.ts +0 -5
- package/dist/domain/script/v3/patch/ops-meta.js +0 -82
- package/dist/domain/script/v3/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-scene.d.ts +0 -6
- package/dist/domain/script/v3/patch/ops-scene.js +0 -351
- package/dist/domain/script/v3/patch/ops-scene.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-state.d.ts +0 -8
- package/dist/domain/script/v3/patch/ops-state.js +0 -155
- package/dist/domain/script/v3/patch/ops-state.js.map +0 -1
- package/dist/domain/script/v3/patch/ops-timestamp.d.ts +0 -6
- package/dist/domain/script/v3/patch/ops-timestamp.js +0 -47
- package/dist/domain/script/v3/patch/ops-timestamp.js.map +0 -1
- package/dist/domain/script/v3/patch/registry.d.ts +0 -2
- package/dist/domain/script/v3/patch/registry.js +0 -56
- package/dist/domain/script/v3/patch/registry.js.map +0 -1
- package/dist/domain/script/v3/patch/types.d.ts +0 -10
- package/dist/domain/script/v3/patch/types.js +0 -2
- package/dist/domain/script/v3/patch/types.js.map +0 -1
- package/dist/domain/script/v3/refs.d.ts +0 -4
- package/dist/domain/script/v3/refs.js +0 -64
- package/dist/domain/script/v3/refs.js.map +0 -1
- package/dist/domain/script/v3/scene-refs.d.ts +0 -3
- package/dist/domain/script/v3/scene-refs.js +0 -35
- package/dist/domain/script/v3/scene-refs.js.map +0 -1
- package/dist/domain/script/v3/schema.d.ts +0 -6
- package/dist/domain/script/v3/schema.js +0 -58
- package/dist/domain/script/v3/schema.js.map +0 -1
- package/dist/domain/script/v3/selector.d.ts +0 -44
- package/dist/domain/script/v3/selector.js +0 -178
- package/dist/domain/script/v3/selector.js.map +0 -1
- package/dist/domain/script/v3/types.d.ts +0 -106
- package/dist/domain/script/v3/types.js +0 -2
- package/dist/domain/script/v3/types.js.map +0 -1
- package/dist/domain/script/v3/validation.d.ts +0 -2
- package/dist/domain/script/v3/validation.js +0 -2
- package/dist/domain/script/v3/validation.js.map +0 -1
- package/dist/domain/script/v4/address.d.ts +0 -61
- package/dist/domain/script/v4/address.js +0 -99
- package/dist/domain/script/v4/address.js.map +0 -1
- package/dist/domain/script/v4/factory.d.ts +0 -2
- package/dist/domain/script/v4/factory.js +0 -13
- package/dist/domain/script/v4/factory.js.map +0 -1
- package/dist/domain/script/v4/from-v3.d.ts +0 -29
- package/dist/domain/script/v4/from-v3.js +0 -307
- package/dist/domain/script/v4/from-v3.js.map +0 -1
- package/dist/domain/script/v4/ids.d.ts +0 -5
- package/dist/domain/script/v4/ids.js +0 -41
- package/dist/domain/script/v4/ids.js.map +0 -1
- package/dist/domain/script/v4/ordinal.d.ts +0 -3
- package/dist/domain/script/v4/ordinal.js +0 -66
- package/dist/domain/script/v4/ordinal.js.map +0 -1
- package/dist/domain/script/v4/parse.d.ts +0 -5
- package/dist/domain/script/v4/parse.js +0 -196
- package/dist/domain/script/v4/parse.js.map +0 -1
- package/dist/domain/script/v4/patch/apply.d.ts +0 -3
- package/dist/domain/script/v4/patch/apply.js +0 -24
- package/dist/domain/script/v4/patch/apply.js.map +0 -1
- package/dist/domain/script/v4/patch/helpers.d.ts +0 -32
- package/dist/domain/script/v4/patch/helpers.js +0 -138
- package/dist/domain/script/v4/patch/helpers.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-action.d.ts +0 -13
- package/dist/domain/script/v4/patch/ops-action.js +0 -351
- package/dist/domain/script/v4/patch/ops-action.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-asset.d.ts +0 -17
- package/dist/domain/script/v4/patch/ops-asset.js +0 -556
- package/dist/domain/script/v4/patch/ops-asset.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-extend.d.ts +0 -11
- package/dist/domain/script/v4/patch/ops-extend.js +0 -103
- package/dist/domain/script/v4/patch/ops-extend.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-meta.d.ts +0 -5
- package/dist/domain/script/v4/patch/ops-meta.js +0 -49
- package/dist/domain/script/v4/patch/ops-meta.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-scene-ref.d.ts +0 -3
- package/dist/domain/script/v4/patch/ops-scene-ref.js +0 -74
- package/dist/domain/script/v4/patch/ops-scene-ref.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-structure.d.ts +0 -6
- package/dist/domain/script/v4/patch/ops-structure.js +0 -236
- package/dist/domain/script/v4/patch/ops-structure.js.map +0 -1
- package/dist/domain/script/v4/patch/ops-timestamp.d.ts +0 -6
- package/dist/domain/script/v4/patch/ops-timestamp.js +0 -40
- package/dist/domain/script/v4/patch/ops-timestamp.js.map +0 -1
- package/dist/domain/script/v4/patch/registry.d.ts +0 -2
- package/dist/domain/script/v4/patch/registry.js +0 -53
- package/dist/domain/script/v4/patch/registry.js.map +0 -1
- package/dist/domain/script/v4/patch/schema.d.ts +0 -7
- package/dist/domain/script/v4/patch/schema.js +0 -77
- package/dist/domain/script/v4/patch/schema.js.map +0 -1
- package/dist/domain/script/v4/patch/types.d.ts +0 -10
- package/dist/domain/script/v4/patch/types.js +0 -2
- package/dist/domain/script/v4/patch/types.js.map +0 -1
- package/dist/domain/script/v4/selector.d.ts +0 -11
- package/dist/domain/script/v4/selector.js +0 -124
- package/dist/domain/script/v4/selector.js.map +0 -1
- package/dist/domain/script/v4/types.d.ts +0 -120
- package/dist/domain/script/v4/types.js +0 -2
- package/dist/domain/script/v4/types.js.map +0 -1
- package/dist/domain/script/v4/validation.d.ts +0 -2
- package/dist/domain/script/v4/validation.js +0 -2
- package/dist/domain/script/v4/validation.js.map +0 -1
- package/dist/failures.d.ts +0 -58
- package/dist/failures.js +0 -96
- package/dist/failures.js.map +0 -1
- package/dist/infra/converters.d.ts +0 -9
- package/dist/infra/converters.js +0 -689
- package/dist/infra/converters.js.map +0 -1
- package/dist/infra/env.d.ts +0 -2
- package/dist/infra/env.js +0 -81
- package/dist/infra/env.js.map +0 -1
- package/dist/infra/episode-title.d.ts +0 -4
- package/dist/infra/episode-title.js +0 -129
- package/dist/infra/episode-title.js.map +0 -1
- package/dist/infra/ingest/review-renderer.d.ts +0 -1
- package/dist/infra/ingest/review-renderer.js +0 -440
- package/dist/infra/ingest/review-renderer.js.map +0 -1
- package/dist/infra/ingest/source-resolver.d.ts +0 -21
- package/dist/infra/ingest/source-resolver.js +0 -51
- package/dist/infra/ingest/source-resolver.js.map +0 -1
- package/dist/infra/ingest/text-reader.d.ts +0 -3
- package/dist/infra/ingest/text-reader.js +0 -27
- package/dist/infra/ingest/text-reader.js.map +0 -1
- package/dist/infra/ingest/video-discovery.d.ts +0 -8
- package/dist/infra/ingest/video-discovery.js +0 -69
- package/dist/infra/ingest/video-discovery.js.map +0 -1
- package/dist/infra/ingest/video-source-snapshot.d.ts +0 -4
- package/dist/infra/ingest/video-source-snapshot.js +0 -47
- package/dist/infra/ingest/video-source-snapshot.js.map +0 -1
- package/dist/infra/ingest/video-state-evidence.d.ts +0 -14
- package/dist/infra/ingest/video-state-evidence.js +0 -140
- package/dist/infra/ingest/video-state-evidence.js.map +0 -1
- package/dist/infra/ingest/video-transcode.d.ts +0 -7
- package/dist/infra/ingest/video-transcode.js +0 -98
- package/dist/infra/ingest/video-transcode.js.map +0 -1
- package/dist/infra/ingest/workspace-lock.d.ts +0 -1
- package/dist/infra/ingest/workspace-lock.js +0 -32
- package/dist/infra/ingest/workspace-lock.js.map +0 -1
- package/dist/infra/ingest/workspace-store.d.ts +0 -18
- package/dist/infra/ingest/workspace-store.js +0 -70
- package/dist/infra/ingest/workspace-store.js.map +0 -1
- package/dist/infra/llm/anthropic-model.d.ts +0 -11
- package/dist/infra/llm/anthropic-model.js +0 -130
- package/dist/infra/llm/anthropic-model.js.map +0 -1
- package/dist/infra/llm/doubao-model.d.ts +0 -60
- package/dist/infra/llm/doubao-model.js +0 -249
- package/dist/infra/llm/doubao-model.js.map +0 -1
- package/dist/infra/llm/failure-mapping.d.ts +0 -6
- package/dist/infra/llm/failure-mapping.js +0 -146
- package/dist/infra/llm/failure-mapping.js.map +0 -1
- package/dist/infra/llm/gemini-upload.d.ts +0 -13
- package/dist/infra/llm/gemini-upload.js +0 -138
- package/dist/infra/llm/gemini-upload.js.map +0 -1
- package/dist/infra/llm/gemini-video-model.d.ts +0 -50
- package/dist/infra/llm/gemini-video-model.js +0 -371
- package/dist/infra/llm/gemini-video-model.js.map +0 -1
- package/dist/infra/llm/openai-compatible-model.d.ts +0 -14
- package/dist/infra/llm/openai-compatible-model.js +0 -207
- package/dist/infra/llm/openai-compatible-model.js.map +0 -1
- package/dist/infra/llm/retry.d.ts +0 -8
- package/dist/infra/llm/retry.js +0 -41
- package/dist/infra/llm/retry.js.map +0 -1
- package/dist/infra/local-script-output-store.d.ts +0 -43
- package/dist/infra/local-script-output-store.js +0 -168
- package/dist/infra/local-script-output-store.js.map +0 -1
- package/dist/infra/script-output-api.d.ts +0 -50
- package/dist/infra/script-output-api.js +0 -251
- package/dist/infra/script-output-api.js.map +0 -1
- package/dist/infra/script-output-store.d.ts +0 -152
- package/dist/infra/script-output-store.js +0 -114
- package/dist/infra/script-output-store.js.map +0 -1
- package/dist/infra/script-working-copy.d.ts +0 -23
- package/dist/infra/script-working-copy.js +0 -157
- package/dist/infra/script-working-copy.js.map +0 -1
- package/dist/infra/storage.d.ts +0 -35
- package/dist/infra/storage.js +0 -91
- package/dist/infra/storage.js.map +0 -1
- package/dist/llm/composition.d.ts +0 -5
- package/dist/llm/composition.js +0 -5
- package/dist/llm/composition.js.map +0 -1
- package/dist/llm/config.d.ts +0 -28
- package/dist/llm/config.js +0 -231
- package/dist/llm/config.js.map +0 -1
- package/dist/llm/registry.d.ts +0 -43
- package/dist/llm/registry.js +0 -69
- package/dist/llm/registry.js.map +0 -1
- package/dist/llm/router.d.ts +0 -46
- package/dist/llm/router.js +0 -512
- package/dist/llm/router.js.map +0 -1
- package/dist/llm/tasks/ingest/arc-summary.d.ts +0 -8
- package/dist/llm/tasks/ingest/arc-summary.js +0 -26
- package/dist/llm/tasks/ingest/arc-summary.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-audit.d.ts +0 -6
- package/dist/llm/tasks/ingest/asset-audit.js +0 -158
- package/dist/llm/tasks/ingest/asset-audit.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-curate.d.ts +0 -13
- package/dist/llm/tasks/ingest/asset-curate.js +0 -45
- package/dist/llm/tasks/ingest/asset-curate.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-extract.d.ts +0 -12
- package/dist/llm/tasks/ingest/asset-extract.js +0 -51
- package/dist/llm/tasks/ingest/asset-extract.js.map +0 -1
- package/dist/llm/tasks/ingest/asset-govern.d.ts +0 -22
- package/dist/llm/tasks/ingest/asset-govern.js +0 -143
- package/dist/llm/tasks/ingest/asset-govern.js.map +0 -1
- package/dist/llm/tasks/ingest/body-start.d.ts +0 -10
- package/dist/llm/tasks/ingest/body-start.js +0 -41
- package/dist/llm/tasks/ingest/body-start.js.map +0 -1
- package/dist/llm/tasks/ingest/episode-assets.d.ts +0 -29
- package/dist/llm/tasks/ingest/episode-assets.js +0 -282
- package/dist/llm/tasks/ingest/episode-assets.js.map +0 -1
- package/dist/llm/tasks/ingest/mention-resolve.d.ts +0 -9
- package/dist/llm/tasks/ingest/mention-resolve.js +0 -39
- package/dist/llm/tasks/ingest/mention-resolve.js.map +0 -1
- package/dist/llm/tasks/ingest/name-fix.d.ts +0 -9
- package/dist/llm/tasks/ingest/name-fix.js +0 -56
- package/dist/llm/tasks/ingest/name-fix.js.map +0 -1
- package/dist/llm/tasks/ingest/state-reconcile.d.ts +0 -8
- package/dist/llm/tasks/ingest/state-reconcile.js +0 -44
- package/dist/llm/tasks/ingest/state-reconcile.js.map +0 -1
- package/dist/llm/tasks/ingest/text-normalize.d.ts +0 -10
- package/dist/llm/tasks/ingest/text-normalize.js +0 -122
- package/dist/llm/tasks/ingest/text-normalize.js.map +0 -1
- package/dist/llm/tasks/ingest/video-serial.d.ts +0 -24
- package/dist/llm/tasks/ingest/video-serial.js +0 -416
- package/dist/llm/tasks/ingest/video-serial.js.map +0 -1
- package/dist/llm/tasks/schemas.d.ts +0 -9
- package/dist/llm/tasks/schemas.js +0 -466
- package/dist/llm/tasks/schemas.js.map +0 -1
- package/dist/llm/types.d.ts +0 -178
- package/dist/llm/types.js +0 -44
- package/dist/llm/types.js.map +0 -1
- package/dist/output.d.ts +0 -3
- package/dist/output.js +0 -94
- package/dist/output.js.map +0 -1
- package/dist/package-root.d.ts +0 -2
- package/dist/package-root.js +0 -38
- package/dist/package-root.js.map +0 -1
- package/dist/review-agent.js.map +0 -7
- package/dist/usecases/changelog.d.ts +0 -9
- package/dist/usecases/changelog.js +0 -134
- package/dist/usecases/changelog.js.map +0 -1
- package/dist/usecases/doctor.d.ts +0 -2
- package/dist/usecases/doctor.js +0 -231
- package/dist/usecases/doctor.js.map +0 -1
- package/dist/usecases/ingest/body-start.d.ts +0 -8
- package/dist/usecases/ingest/body-start.js +0 -36
- package/dist/usecases/ingest/body-start.js.map +0 -1
- package/dist/usecases/ingest/command.d.ts +0 -5
- package/dist/usecases/ingest/command.js +0 -183
- package/dist/usecases/ingest/command.js.map +0 -1
- package/dist/usecases/ingest/failure.d.ts +0 -26
- package/dist/usecases/ingest/failure.js +0 -153
- package/dist/usecases/ingest/failure.js.map +0 -1
- package/dist/usecases/ingest/fanout.d.ts +0 -10
- package/dist/usecases/ingest/fanout.js +0 -23
- package/dist/usecases/ingest/fanout.js.map +0 -1
- package/dist/usecases/ingest/final-asset-audit.d.ts +0 -39
- package/dist/usecases/ingest/final-asset-audit.js +0 -88
- package/dist/usecases/ingest/final-asset-audit.js.map +0 -1
- package/dist/usecases/ingest/generate-video-state-evidence.d.ts +0 -23
- package/dist/usecases/ingest/generate-video-state-evidence.js +0 -124
- package/dist/usecases/ingest/generate-video-state-evidence.js.map +0 -1
- package/dist/usecases/ingest/pass4-mention-resolve.d.ts +0 -11
- package/dist/usecases/ingest/pass4-mention-resolve.js +0 -52
- package/dist/usecases/ingest/pass4-mention-resolve.js.map +0 -1
- package/dist/usecases/ingest/pass5-extract.d.ts +0 -7
- package/dist/usecases/ingest/pass5-extract.js +0 -51
- package/dist/usecases/ingest/pass5-extract.js.map +0 -1
- package/dist/usecases/ingest/pass5-govern.d.ts +0 -13
- package/dist/usecases/ingest/pass5-govern.js +0 -157
- package/dist/usecases/ingest/pass5-govern.js.map +0 -1
- package/dist/usecases/ingest/pipeline.d.ts +0 -28
- package/dist/usecases/ingest/pipeline.js +0 -335
- package/dist/usecases/ingest/pipeline.js.map +0 -1
- package/dist/usecases/ingest/publish-command.d.ts +0 -1
- package/dist/usecases/ingest/publish-command.js +0 -4
- package/dist/usecases/ingest/publish-command.js.map +0 -1
- package/dist/usecases/ingest/serial-govern.d.ts +0 -40
- package/dist/usecases/ingest/serial-govern.js +0 -488
- package/dist/usecases/ingest/serial-govern.js.map +0 -1
- package/dist/usecases/ingest/skip-video-episode.d.ts +0 -4
- package/dist/usecases/ingest/skip-video-episode.js +0 -120
- package/dist/usecases/ingest/skip-video-episode.js.map +0 -1
- package/dist/usecases/ingest/status.d.ts +0 -61
- package/dist/usecases/ingest/status.js +0 -347
- package/dist/usecases/ingest/status.js.map +0 -1
- package/dist/usecases/ingest/timings.d.ts +0 -51
- package/dist/usecases/ingest/timings.js +0 -68
- package/dist/usecases/ingest/timings.js.map +0 -1
- package/dist/usecases/ingest/usage-report.d.ts +0 -125
- package/dist/usecases/ingest/usage-report.js +0 -248
- package/dist/usecases/ingest/usage-report.js.map +0 -1
- package/dist/usecases/ingest/video-pipeline.d.ts +0 -81
- package/dist/usecases/ingest/video-pipeline.js +0 -548
- package/dist/usecases/ingest/video-pipeline.js.map +0 -1
- package/dist/usecases/ingest/video-skip-state.d.ts +0 -29
- package/dist/usecases/ingest/video-skip-state.js +0 -148
- package/dist/usecases/ingest/video-skip-state.js.map +0 -1
- package/dist/usecases/ingest/view-command.d.ts +0 -4
- package/dist/usecases/ingest/view-command.js +0 -67
- package/dist/usecases/ingest/view-command.js.map +0 -1
- package/dist/usecases/ingest/view-server.d.ts +0 -29
- package/dist/usecases/ingest/view-server.js +0 -364
- package/dist/usecases/ingest/view-server.js.map +0 -1
- package/dist/usecases/script/action-span.d.ts +0 -10
- package/dist/usecases/script/action-span.js +0 -42
- package/dist/usecases/script/action-span.js.map +0 -1
- package/dist/usecases/script/actions.d.ts +0 -3
- package/dist/usecases/script/actions.js +0 -184
- package/dist/usecases/script/actions.js.map +0 -1
- package/dist/usecases/script/actor.d.ts +0 -3
- package/dist/usecases/script/actor.js +0 -26
- package/dist/usecases/script/actor.js.map +0 -1
- package/dist/usecases/script/actors.d.ts +0 -3
- package/dist/usecases/script/actors.js +0 -25
- package/dist/usecases/script/actors.js.map +0 -1
- package/dist/usecases/script/add-actor.d.ts +0 -3
- package/dist/usecases/script/add-actor.js +0 -13
- package/dist/usecases/script/add-actor.js.map +0 -1
- package/dist/usecases/script/add-episode.d.ts +0 -3
- package/dist/usecases/script/add-episode.js +0 -9
- package/dist/usecases/script/add-episode.js.map +0 -1
- package/dist/usecases/script/add-location.d.ts +0 -3
- package/dist/usecases/script/add-location.js +0 -11
- package/dist/usecases/script/add-location.js.map +0 -1
- package/dist/usecases/script/add-prop.d.ts +0 -3
- package/dist/usecases/script/add-prop.js +0 -11
- package/dist/usecases/script/add-prop.js.map +0 -1
- package/dist/usecases/script/alias.d.ts +0 -3
- package/dist/usecases/script/alias.js +0 -39
- package/dist/usecases/script/alias.js.map +0 -1
- package/dist/usecases/script/assets.d.ts +0 -3
- package/dist/usecases/script/assets.js +0 -46
- package/dist/usecases/script/assets.js.map +0 -1
- package/dist/usecases/script/audit-assets.d.ts +0 -4
- package/dist/usecases/script/audit-assets.js +0 -37
- package/dist/usecases/script/audit-assets.js.map +0 -1
- package/dist/usecases/script/command-constraints.d.ts +0 -38
- package/dist/usecases/script/command-constraints.js +0 -143
- package/dist/usecases/script/command-constraints.js.map +0 -1
- package/dist/usecases/script/compose-creative-draft.d.ts +0 -3
- package/dist/usecases/script/compose-creative-draft.js +0 -106
- package/dist/usecases/script/compose-creative-draft.js.map +0 -1
- package/dist/usecases/script/context.d.ts +0 -3
- package/dist/usecases/script/context.js +0 -52
- package/dist/usecases/script/context.js.map +0 -1
- package/dist/usecases/script/create.d.ts +0 -3
- package/dist/usecases/script/create.js +0 -27
- package/dist/usecases/script/create.js.map +0 -1
- package/dist/usecases/script/delete.d.ts +0 -3
- package/dist/usecases/script/delete.js +0 -88
- package/dist/usecases/script/delete.js.map +0 -1
- package/dist/usecases/script/describe.d.ts +0 -3
- package/dist/usecases/script/describe.js +0 -32
- package/dist/usecases/script/describe.js.map +0 -1
- package/dist/usecases/script/dialogue.d.ts +0 -3
- package/dist/usecases/script/dialogue.js +0 -30
- package/dist/usecases/script/dialogue.js.map +0 -1
- package/dist/usecases/script/dispatch.d.ts +0 -3
- package/dist/usecases/script/dispatch.js +0 -10
- package/dist/usecases/script/dispatch.js.map +0 -1
- package/dist/usecases/script/do.d.ts +0 -3
- package/dist/usecases/script/do.js +0 -186
- package/dist/usecases/script/do.js.map +0 -1
- package/dist/usecases/script/emotion.d.ts +0 -3
- package/dist/usecases/script/emotion.js +0 -24
- package/dist/usecases/script/emotion.js.map +0 -1
- package/dist/usecases/script/episodes.d.ts +0 -3
- package/dist/usecases/script/episodes.js +0 -62
- package/dist/usecases/script/episodes.js.map +0 -1
- package/dist/usecases/script/export-authoring.d.ts +0 -4
- package/dist/usecases/script/export-authoring.js +0 -326
- package/dist/usecases/script/export-authoring.js.map +0 -1
- package/dist/usecases/script/extend.d.ts +0 -3
- package/dist/usecases/script/extend.js +0 -94
- package/dist/usecases/script/extend.js.map +0 -1
- package/dist/usecases/script/ids.d.ts +0 -3
- package/dist/usecases/script/ids.js +0 -148
- package/dist/usecases/script/ids.js.map +0 -1
- package/dist/usecases/script/importance.d.ts +0 -3
- package/dist/usecases/script/importance.js +0 -16
- package/dist/usecases/script/importance.js.map +0 -1
- package/dist/usecases/script/insert.d.ts +0 -3
- package/dist/usecases/script/insert.js +0 -127
- package/dist/usecases/script/insert.js.map +0 -1
- package/dist/usecases/script/issues.d.ts +0 -3
- package/dist/usecases/script/issues.js +0 -35
- package/dist/usecases/script/issues.js.map +0 -1
- package/dist/usecases/script/lib.d.ts +0 -152
- package/dist/usecases/script/lib.js +0 -1654
- package/dist/usecases/script/lib.js.map +0 -1
- package/dist/usecases/script/locations.d.ts +0 -3
- package/dist/usecases/script/locations.js +0 -25
- package/dist/usecases/script/locations.js.map +0 -1
- package/dist/usecases/script/merge.d.ts +0 -3
- package/dist/usecases/script/merge.js +0 -43
- package/dist/usecases/script/merge.js.map +0 -1
- package/dist/usecases/script/migrate.d.ts +0 -3
- package/dist/usecases/script/migrate.js +0 -210
- package/dist/usecases/script/migrate.js.map +0 -1
- package/dist/usecases/script/move.d.ts +0 -3
- package/dist/usecases/script/move.js +0 -50
- package/dist/usecases/script/move.js.map +0 -1
- package/dist/usecases/script/parenthetical.d.ts +0 -3
- package/dist/usecases/script/parenthetical.js +0 -52
- package/dist/usecases/script/parenthetical.js.map +0 -1
- package/dist/usecases/script/props.d.ts +0 -3
- package/dist/usecases/script/props.js +0 -25
- package/dist/usecases/script/props.js.map +0 -1
- package/dist/usecases/script/refs.d.ts +0 -3
- package/dist/usecases/script/refs.js +0 -111
- package/dist/usecases/script/refs.js.map +0 -1
- package/dist/usecases/script/rename.d.ts +0 -3
- package/dist/usecases/script/rename.js +0 -35
- package/dist/usecases/script/rename.js.map +0 -1
- package/dist/usecases/script/replace.d.ts +0 -3
- package/dist/usecases/script/replace.js +0 -33
- package/dist/usecases/script/replace.js.map +0 -1
- package/dist/usecases/script/review.d.ts +0 -3
- package/dist/usecases/script/review.js +0 -187
- package/dist/usecases/script/review.js.map +0 -1
- package/dist/usecases/script/role.d.ts +0 -3
- package/dist/usecases/script/role.js +0 -16
- package/dist/usecases/script/role.js.map +0 -1
- package/dist/usecases/script/scenes.d.ts +0 -3
- package/dist/usecases/script/scenes.js +0 -66
- package/dist/usecases/script/scenes.js.map +0 -1
- package/dist/usecases/script/script-patch.d.ts +0 -3
- package/dist/usecases/script/script-patch.js +0 -321
- package/dist/usecases/script/script-patch.js.map +0 -1
- package/dist/usecases/script/script-validate.d.ts +0 -3
- package/dist/usecases/script/script-validate.js +0 -27
- package/dist/usecases/script/script-validate.js.map +0 -1
- package/dist/usecases/script/session.d.ts +0 -62
- package/dist/usecases/script/session.js +0 -567
- package/dist/usecases/script/session.js.map +0 -1
- package/dist/usecases/script/split.d.ts +0 -3
- package/dist/usecases/script/split.js +0 -41
- package/dist/usecases/script/split.js.map +0 -1
- package/dist/usecases/script/state-add.d.ts +0 -3
- package/dist/usecases/script/state-add.js +0 -22
- package/dist/usecases/script/state-add.js.map +0 -1
- package/dist/usecases/script/state-delete.d.ts +0 -3
- package/dist/usecases/script/state-delete.js +0 -22
- package/dist/usecases/script/state-delete.js.map +0 -1
- package/dist/usecases/script/state-rename.d.ts +0 -3
- package/dist/usecases/script/state-rename.js +0 -16
- package/dist/usecases/script/state-rename.js.map +0 -1
- package/dist/usecases/script/states.d.ts +0 -3
- package/dist/usecases/script/states.js +0 -197
- package/dist/usecases/script/states.js.map +0 -1
- package/dist/usecases/script/summary.d.ts +0 -3
- package/dist/usecases/script/summary.js +0 -72
- package/dist/usecases/script/summary.js.map +0 -1
- package/dist/usecases/script/synopsis-generate.d.ts +0 -115
- package/dist/usecases/script/synopsis-generate.js +0 -776
- package/dist/usecases/script/synopsis-generate.js.map +0 -1
- package/dist/usecases/script/synopsis.d.ts +0 -3
- package/dist/usecases/script/synopsis.js +0 -45
- package/dist/usecases/script/synopsis.js.map +0 -1
- package/dist/usecases/script/timestamp-filter.d.ts +0 -4
- package/dist/usecases/script/timestamp-filter.js +0 -55
- package/dist/usecases/script/timestamp-filter.js.map +0 -1
- package/dist/usecases/script/timestamp.d.ts +0 -3
- package/dist/usecases/script/timestamp.js +0 -11
- package/dist/usecases/script/timestamp.js.map +0 -1
- package/dist/usecases/script/transition.d.ts +0 -3
- package/dist/usecases/script/transition.js +0 -23
- package/dist/usecases/script/transition.js.map +0 -1
- package/dist/usecases/script/type.d.ts +0 -3
- package/dist/usecases/script/type.js +0 -23
- package/dist/usecases/script/type.js.map +0 -1
- package/dist/usecases/script/v3/mutations.d.ts +0 -2
- package/dist/usecases/script/v3/mutations.js +0 -5
- package/dist/usecases/script/v3/mutations.js.map +0 -1
- package/dist/usecases/script/v4/mutations.d.ts +0 -2
- package/dist/usecases/script/v4/mutations.js +0 -6
- package/dist/usecases/script/v4/mutations.js.map +0 -1
- package/dist/usecases/script/v4/queries.d.ts +0 -15
- package/dist/usecases/script/v4/queries.js +0 -196
- package/dist/usecases/script/v4/queries.js.map +0 -1
- package/dist/usecases/script/working-copy.d.ts +0 -5
- package/dist/usecases/script/working-copy.js +0 -399
- package/dist/usecases/script/working-copy.js.map +0 -1
- package/dist/usecases/script/worldview.d.ts +0 -3
- package/dist/usecases/script/worldview.js +0 -17
- package/dist/usecases/script/worldview.js.map +0 -1
- package/dist/usecases/script/write-authoring.d.ts +0 -3
- package/dist/usecases/script/write-authoring.js +0 -263
- package/dist/usecases/script/write-authoring.js.map +0 -1
- package/dist/usecases/update.d.ts +0 -13
- package/dist/usecases/update.js +0 -128
- package/dist/usecases/update.js.map +0 -1
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
// fast-json-patch ships as CommonJS with no named ESM exports, so under Node's
|
|
2
|
-
// ESM resolver only the default (the module.exports object) is available. Pull
|
|
3
|
-
// `compare` off it rather than importing it by name (which fails at runtime).
|
|
4
|
-
import fastJsonPatch from "fast-json-patch";
|
|
5
|
-
const { compare } = fastJsonPatch;
|
|
6
|
-
import { ScriptOutputApiError, } from "./script-output-store.js";
|
|
7
|
-
// Re-export the shared error/types so existing callers that import them from
|
|
8
|
-
// this module keep compiling. New code should import directly from
|
|
9
|
-
// ./script-output-store.js — the shared module is the single source of truth.
|
|
10
|
-
export { ScriptOutputApiError, } from "./script-output-store.js";
|
|
11
|
-
const SCRIPT_OUTPUT_PREFIX = "/api/anime/workbench/script-output/project-groups";
|
|
12
|
-
// V2 adds an isolated publish endpoint while preserving the legacy PUT/PATCH
|
|
13
|
-
// contracts. Same gateway base + the same
|
|
14
|
-
// X-Access-Key auth as V1; only the path prefix and the write shape differ.
|
|
15
|
-
const SCRIPT_V2_PREFIX = "/api/anime/workbench/v2/script/project-groups";
|
|
16
|
-
// Project-group metadata lives on a DIFFERENT controller (not under the
|
|
17
|
-
// script-output prefix). Same gateway base + X-Access-Key auth, same
|
|
18
|
-
// {code,msg,data} envelope. "有值才更新": send only the fields we want changed.
|
|
19
|
-
const PROJECT_GROUP_UPDATE_PATH = "/api/anime/workbench/projectGroup/updateProjectGroupInfo";
|
|
20
|
-
// Best-effort metadata write — keep its timeout short so a hung gateway can't
|
|
21
|
-
// stall init's exit for the full 30s default the script writes use.
|
|
22
|
-
const PROJECT_GROUP_UPDATE_TIMEOUT_MS = 5000;
|
|
23
|
-
const IMPORT_BODY_LIMIT_BYTES = 8 * 1024 * 1024;
|
|
24
|
-
export function normalizeGatewayBase(value) {
|
|
25
|
-
let base = value.trim().replace(/\/+$/, "");
|
|
26
|
-
for (const suffix of ["/api/anime/workbench", "/api/sandbox"]) {
|
|
27
|
-
if (base.endsWith(suffix)) {
|
|
28
|
-
base = base.slice(0, -suffix.length);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return base.replace(/\/+$/, "");
|
|
33
|
-
}
|
|
34
|
-
export function quotePath(value) {
|
|
35
|
-
return encodeURIComponent(String(value));
|
|
36
|
-
}
|
|
37
|
-
function apiErrorFromText(text, status, path) {
|
|
38
|
-
if (status === 404 && path.includes("/imports")) {
|
|
39
|
-
return new ScriptOutputApiError("backend lacks episode import API", { status, payload: text });
|
|
40
|
-
}
|
|
41
|
-
let payload = null;
|
|
42
|
-
try {
|
|
43
|
-
payload = text ? JSON.parse(text) : null;
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
payload = null;
|
|
47
|
-
}
|
|
48
|
-
if (payload && typeof payload === "object") {
|
|
49
|
-
const obj = payload;
|
|
50
|
-
const message = String(obj.msg ?? obj.message ?? `HTTP ${status}`);
|
|
51
|
-
return new ScriptOutputApiError(message, { status, code: obj.code ?? null, payload: obj });
|
|
52
|
-
}
|
|
53
|
-
return new ScriptOutputApiError(text || `HTTP ${status}`, { status, payload: text });
|
|
54
|
-
}
|
|
55
|
-
function assertImportBodySize(label, body) {
|
|
56
|
-
const bytes = Buffer.byteLength(JSON.stringify(body), "utf8");
|
|
57
|
-
if (bytes <= IMPORT_BODY_LIMIT_BYTES)
|
|
58
|
-
return;
|
|
59
|
-
// V2 sends the whole document (root) or an RFC6902 diff (patch) in one body —
|
|
60
|
-
// neither is chunkable by episode/scene, so keep the message generic.
|
|
61
|
-
throw new ScriptOutputApiError(`script ${label} body too large: ${bytes} bytes (limit ${IMPORT_BODY_LIMIT_BYTES})`);
|
|
62
|
-
}
|
|
63
|
-
// Shared gateway transport for both V1 (RemoteScriptOutputStore) and V2
|
|
64
|
-
// (ScriptV2OutputStore): same X-Access-Key auth, same timeout/abort handling,
|
|
65
|
-
// same `{code,msg,data}` envelope unwrap and `剧本不存在` → null (allowMissing)
|
|
66
|
-
// convention. Extracted so the two stores can't drift on error handling.
|
|
67
|
-
async function gatewayRequest(gatewayBase, accessKey, timeoutMs, method, path, opts = {}) {
|
|
68
|
-
const rawBody = opts.body === undefined ? undefined : JSON.stringify(opts.body);
|
|
69
|
-
const headers = {
|
|
70
|
-
Accept: "application/json",
|
|
71
|
-
"X-Access-Key": accessKey,
|
|
72
|
-
};
|
|
73
|
-
if (rawBody !== undefined)
|
|
74
|
-
headers["Content-Type"] = "application/json; charset=utf-8";
|
|
75
|
-
const controller = new AbortController();
|
|
76
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
77
|
-
let status;
|
|
78
|
-
let text;
|
|
79
|
-
try {
|
|
80
|
-
const response = await fetch(`${gatewayBase}${path}`, {
|
|
81
|
-
method,
|
|
82
|
-
headers,
|
|
83
|
-
body: rawBody,
|
|
84
|
-
signal: controller.signal,
|
|
85
|
-
});
|
|
86
|
-
status = response.status;
|
|
87
|
-
text = await response.text();
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
91
|
-
throw new ScriptOutputApiError("Gateway request timed out");
|
|
92
|
-
}
|
|
93
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
94
|
-
throw new ScriptOutputApiError(`Gateway request failed: ${reason}`);
|
|
95
|
-
}
|
|
96
|
-
finally {
|
|
97
|
-
clearTimeout(timer);
|
|
98
|
-
}
|
|
99
|
-
if (status >= 400)
|
|
100
|
-
throw apiErrorFromText(text, status, path);
|
|
101
|
-
let payload = null;
|
|
102
|
-
if (text) {
|
|
103
|
-
try {
|
|
104
|
-
payload = JSON.parse(text);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
throw new ScriptOutputApiError("Gateway response is not valid JSON", { status, payload: text });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (payload === null)
|
|
111
|
-
return null;
|
|
112
|
-
if (typeof payload !== "object")
|
|
113
|
-
return payload;
|
|
114
|
-
const obj = payload;
|
|
115
|
-
const code = obj.code;
|
|
116
|
-
if (code !== undefined && code !== null && String(code) !== "200") {
|
|
117
|
-
const message = String(obj.msg ?? obj.message ?? "script-output API failed");
|
|
118
|
-
if (opts.allowMissing && typeof message === "string" && message.includes("剧本不存在"))
|
|
119
|
-
return null;
|
|
120
|
-
throw new ScriptOutputApiError(message, { status, code: code, payload: obj });
|
|
121
|
-
}
|
|
122
|
-
if ("data" in obj)
|
|
123
|
-
return obj.data;
|
|
124
|
-
return obj;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* V2 script-output store. Same gateway base + X-Access-Key auth as V1, but:
|
|
128
|
-
* - publishPatch uses the dedicated strict-CAS publish endpoint.
|
|
129
|
-
* - replaceScript and patchScript retain the legacy endpoint contracts.
|
|
130
|
-
* - patchScript sends an RFC6902 PATCH (the compare() diff of old→edited),
|
|
131
|
-
* which V1 cannot do (it degrades to a whole-document replace).
|
|
132
|
-
*
|
|
133
|
-
* Selected over V1 by the `SCRIPT_OUTPUT_API_VERSION=v2` env (see
|
|
134
|
-
* remoteScriptOutputStoreFromEnv). Endpoints:
|
|
135
|
-
* GET {prefix}/{projectGroupNo}
|
|
136
|
-
* GET {prefix}/{projectGroupNo}/revision
|
|
137
|
-
* GET {prefix}/{projectGroupNo}/snapshot
|
|
138
|
-
* PATCH {prefix}/{projectGroupNo}/publish { baseRevision, patch, validation }
|
|
139
|
-
* PATCH {prefix}/{projectGroupNo} RFC6902 patch array (wrapped with requestId)
|
|
140
|
-
* DELETE {prefix}/{projectGroupNo}
|
|
141
|
-
*/
|
|
142
|
-
export class ScriptV2OutputStore {
|
|
143
|
-
gatewayBase;
|
|
144
|
-
projectGroupNo;
|
|
145
|
-
accessKey;
|
|
146
|
-
timeoutMs;
|
|
147
|
-
constructor(opts) {
|
|
148
|
-
this.gatewayBase = opts.gatewayBase;
|
|
149
|
-
this.projectGroupNo = opts.projectGroupNo;
|
|
150
|
-
this.accessKey = opts.accessKey;
|
|
151
|
-
// checkout/publish may transfer a full large snapshot over a weak network.
|
|
152
|
-
this.timeoutMs = opts.timeoutMs ?? 300_000;
|
|
153
|
-
}
|
|
154
|
-
static fromEnv(projectGroupNo) {
|
|
155
|
-
const resolved = (projectGroupNo ?? process.env.SANDBOX_PROJECT_GROUP_NO ?? "").trim();
|
|
156
|
-
if (!resolved) {
|
|
157
|
-
throw new ScriptOutputApiError("projectGroupNo missing; pass --project-group-no or set SANDBOX_PROJECT_GROUP_NO", { configMissing: "project" });
|
|
158
|
-
}
|
|
159
|
-
const gatewayBase = normalizeGatewayBase(process.env.AWB_BASE_URL || "");
|
|
160
|
-
if (!gatewayBase) {
|
|
161
|
-
throw new ScriptOutputApiError("gateway URL missing; set AWB_BASE_URL", { configMissing: "gateway" });
|
|
162
|
-
}
|
|
163
|
-
const accessKey = (process.env.LINGJING_AWB_ACCESS_KEY || "").trim();
|
|
164
|
-
if (!accessKey) {
|
|
165
|
-
throw new ScriptOutputApiError("access key missing; set LINGJING_AWB_ACCESS_KEY", { configMissing: "access" });
|
|
166
|
-
}
|
|
167
|
-
return new ScriptV2OutputStore({ gatewayBase, projectGroupNo: resolved, accessKey });
|
|
168
|
-
}
|
|
169
|
-
get projectPrefix() {
|
|
170
|
-
return `${SCRIPT_V2_PREFIX}/${quotePath(this.projectGroupNo)}`;
|
|
171
|
-
}
|
|
172
|
-
async getScript() {
|
|
173
|
-
return (await this.request("GET", this.projectPrefix, { allowMissing: true }));
|
|
174
|
-
}
|
|
175
|
-
async getRevision() {
|
|
176
|
-
return (await this.request("GET", `${this.projectPrefix}/revision`, { allowMissing: true }));
|
|
177
|
-
}
|
|
178
|
-
async getSnapshot() {
|
|
179
|
-
return (await this.request("GET", `${this.projectPrefix}/snapshot`, { allowMissing: true }));
|
|
180
|
-
}
|
|
181
|
-
async publishPatch(opts) {
|
|
182
|
-
return (await this.request("PATCH", `${this.projectPrefix}/publish`, {
|
|
183
|
-
body: {
|
|
184
|
-
baseRevision: opts.baseRevision,
|
|
185
|
-
patch: compare(opts.old, opts.edited),
|
|
186
|
-
validation: opts.validation,
|
|
187
|
-
},
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
async replaceScript(opts) {
|
|
191
|
-
// V2 takes the whole script in one PUT — assert the same body-size limit as
|
|
192
|
-
// V1's begin body so an oversized document fails fast with the same error.
|
|
193
|
-
const body = {
|
|
194
|
-
requestId: opts.requestId,
|
|
195
|
-
baseRevision: opts.baseRevision,
|
|
196
|
-
source: opts.source ?? "ctl",
|
|
197
|
-
script: opts.script,
|
|
198
|
-
};
|
|
199
|
-
assertImportBodySize("root", body);
|
|
200
|
-
return (await this.request("PUT", this.projectPrefix, { body }));
|
|
201
|
-
}
|
|
202
|
-
// True incremental edit: send the RFC6902 diff of old→edited. An empty diff
|
|
203
|
-
// (no observable change) still goes through so the gateway can bump/no-op the
|
|
204
|
-
// revision consistently with replaceScript's idempotency contract.
|
|
205
|
-
async patchScript(opts) {
|
|
206
|
-
const patch = compare(opts.old, opts.edited);
|
|
207
|
-
const body = {
|
|
208
|
-
requestId: opts.requestId,
|
|
209
|
-
baseRevision: opts.baseRevision,
|
|
210
|
-
source: opts.source ?? "ctl",
|
|
211
|
-
patch,
|
|
212
|
-
};
|
|
213
|
-
// patchScript is now the primary save path — guard the diff body against the
|
|
214
|
-
// same import-size limit replaceScript uses, so an oversized edit fails fast
|
|
215
|
-
// with a clear error instead of an opaque gateway/Spring 413.
|
|
216
|
-
assertImportBodySize("patch", body);
|
|
217
|
-
return (await this.request("PATCH", this.projectPrefix, { body }));
|
|
218
|
-
}
|
|
219
|
-
async saveValidationResult(opts) {
|
|
220
|
-
// V2 has its own validation-result endpoint (the script lives in script_v2,
|
|
221
|
-
// not the V1 tables, so the V1 path would 404 "剧本不存在"). Same body shape;
|
|
222
|
-
// the V2 backend persists status/summary on the row and ignores issues.
|
|
223
|
-
return (await this.request("POST", `${SCRIPT_V2_PREFIX}/${quotePath(this.projectGroupNo)}/validation-result`, {
|
|
224
|
-
body: {
|
|
225
|
-
revision: opts.revision,
|
|
226
|
-
validationStatus: opts.validationStatus,
|
|
227
|
-
validationSummary: opts.validationSummary,
|
|
228
|
-
issues: opts.issues,
|
|
229
|
-
},
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
// Best-effort: set the project group's episode_count. Only episodeCount is
|
|
233
|
-
// sent so the cover key is left untouched ("有值才更新"). Callers wrap this in
|
|
234
|
-
// syncEpisodeCount, which swallows failures — never let it fail a script write.
|
|
235
|
-
async updateEpisodeCount(episodeCount) {
|
|
236
|
-
await gatewayRequest(this.gatewayBase, this.accessKey, Math.min(this.timeoutMs, PROJECT_GROUP_UPDATE_TIMEOUT_MS), "POST", PROJECT_GROUP_UPDATE_PATH, { body: { projectGroupNo: this.projectGroupNo, episodeCount } });
|
|
237
|
-
}
|
|
238
|
-
async request(method, path, opts = {}) {
|
|
239
|
-
return gatewayRequest(this.gatewayBase, this.accessKey, this.timeoutMs, method, path, opts);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Build the remote script-output store. The CLI is V2-only: every write goes to
|
|
244
|
-
* the single-PUT / incremental-PATCH blob store, the same backend the frontend
|
|
245
|
-
* writes to — so the two never split-brain across V1/V2. The legacy begin→commit
|
|
246
|
-
* V1 client was removed; there is no version flag.
|
|
247
|
-
*/
|
|
248
|
-
export function remoteScriptOutputStoreFromEnv(projectGroupNo) {
|
|
249
|
-
return ScriptV2OutputStore.fromEnv(projectGroupNo);
|
|
250
|
-
}
|
|
251
|
-
//# sourceMappingURL=script-output-api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script-output-api.js","sourceRoot":"","sources":["../../src/infra/script-output-api.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,MAAM,EAAE,OAAO,EAAE,GAAG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B;gBACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;gBACzC,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;SACF,CACF,CAAmC,CAAC;IACvC,CAAC;IAED,2EAA2E;IAC3E,0EAA0E;IAC1E,gFAAgF;IAChF,KAAK,CAAC,kBAAkB,CAAC,YAAoB;QAC3C,MAAM,cAAc,CAClB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,+BAA+B,CAAC,EACzD,MAAM,EACN,yBAAyB,EACzB,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,EAAE,EAAE,CAChE,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO,CACnB,MAAc,EACd,IAAY,EACZ,OAAmD,EAAE;QAErD,OAAO,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9F,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,cAA8B;IAC3E,OAAO,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
export type ConfigMissingSlot = "gateway" | "access" | "project" | "output";
|
|
2
|
-
export interface ScriptOutputApiErrorOptions {
|
|
3
|
-
status?: number | null;
|
|
4
|
-
code?: number | string | null;
|
|
5
|
-
payload?: unknown;
|
|
6
|
-
/**
|
|
7
|
-
* Which env var was missing when fromEnv() failed — used by apiErrorToCli to
|
|
8
|
-
* route the failure into a sanitized public error. Kept as a stable token
|
|
9
|
-
* (not the raw env name) so apiErrorToCli doesn't need to parse messages.
|
|
10
|
-
* "output" is the local-mode slot (SCRIPTCTL_OUTPUT_DIR missing or unwritable).
|
|
11
|
-
*/
|
|
12
|
-
configMissing?: ConfigMissingSlot;
|
|
13
|
-
}
|
|
14
|
-
export declare class ScriptOutputApiError extends Error {
|
|
15
|
-
readonly status: number | null;
|
|
16
|
-
readonly code: number | string | null;
|
|
17
|
-
readonly payload: unknown;
|
|
18
|
-
readonly configMissing: ConfigMissingSlot | null;
|
|
19
|
-
constructor(message: string, opts?: ScriptOutputApiErrorOptions);
|
|
20
|
-
}
|
|
21
|
-
export interface ReplaceScriptOptions {
|
|
22
|
-
requestId: string;
|
|
23
|
-
baseRevision: number;
|
|
24
|
-
script: Record<string, unknown>;
|
|
25
|
-
source?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ScriptSnapshot {
|
|
28
|
-
projectGroupNo: string;
|
|
29
|
-
script: Record<string, unknown>;
|
|
30
|
-
revision: number;
|
|
31
|
-
validationStatus?: string | null;
|
|
32
|
-
validationSummary?: Record<string, unknown> | null;
|
|
33
|
-
updatedAt?: string | null;
|
|
34
|
-
}
|
|
35
|
-
export interface PublishPatchOptions {
|
|
36
|
-
baseRevision: number;
|
|
37
|
-
old: Record<string, unknown>;
|
|
38
|
-
edited: Record<string, unknown>;
|
|
39
|
-
validation: {
|
|
40
|
-
status: "valid";
|
|
41
|
-
summary: Record<string, unknown>;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Incremental edit: publish the RFC6902 diff between the loaded script and the
|
|
46
|
-
* locally-edited script, instead of re-uploading the whole document. `old` is
|
|
47
|
-
* the script as loaded (the edit baseline), `edited` is the post-mutation
|
|
48
|
-
* script. Implementations compute `compare(old, edited)` and send the patch.
|
|
49
|
-
*
|
|
50
|
-
* V1 backends have no incremental endpoint, so their implementation degrades to
|
|
51
|
-
* a whole-document `replaceScript(edited)` — callers get the same observable
|
|
52
|
-
* result (a new revision) regardless of which store is wired, so editing
|
|
53
|
-
* usecases can always call `patchScript` without branching on the backend.
|
|
54
|
-
*/
|
|
55
|
-
export interface PatchScriptOptions {
|
|
56
|
-
requestId: string;
|
|
57
|
-
baseRevision: number;
|
|
58
|
-
old: Record<string, unknown>;
|
|
59
|
-
edited: Record<string, unknown>;
|
|
60
|
-
source?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface SaveValidationOptions {
|
|
63
|
-
revision: number;
|
|
64
|
-
validationStatus: string;
|
|
65
|
-
validationSummary: Record<string, unknown>;
|
|
66
|
-
issues: Array<Record<string, unknown>>;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Abstract "published script storage" used by usecases. Two implementations:
|
|
70
|
-
* - RemoteScriptOutputStore: HTTP gateway (production)
|
|
71
|
-
* - LocalScriptOutputStore: filesystem (local debugging)
|
|
72
|
-
*
|
|
73
|
-
* Implementations are selected by the `scriptOutputClient()` factory based on
|
|
74
|
-
* `SCRIPTCTL_OUTPUT_MODE`. Usecase code only touches this interface, so the
|
|
75
|
-
* mode switch is invisible above this layer.
|
|
76
|
-
*/
|
|
77
|
-
export interface ScriptOutputStore {
|
|
78
|
-
/**
|
|
79
|
-
* Stable identifier for the underlying store. For the remote backend this is
|
|
80
|
-
* the gateway-side project group id; for the local backend it is the store
|
|
81
|
-
* directory path. Used in artifact labels and "not found" error context.
|
|
82
|
-
*/
|
|
83
|
-
readonly projectGroupNo: string;
|
|
84
|
-
getScript(): Promise<Record<string, unknown> | null>;
|
|
85
|
-
getRevision(): Promise<Record<string, unknown> | null>;
|
|
86
|
-
replaceScript(opts: ReplaceScriptOptions): Promise<Record<string, unknown>>;
|
|
87
|
-
/**
|
|
88
|
-
* Apply an incremental edit. V2 stores send an RFC6902 PATCH; V1 stores fall
|
|
89
|
-
* back to a whole-document replace. Both return the same revision envelope as
|
|
90
|
-
* `replaceScript`, so editing usecases never branch on the backend version.
|
|
91
|
-
*/
|
|
92
|
-
patchScript(opts: PatchScriptOptions): Promise<Record<string, unknown>>;
|
|
93
|
-
saveValidationResult(opts: SaveValidationOptions): Promise<Record<string, unknown> | null>;
|
|
94
|
-
/**
|
|
95
|
-
* Best-effort write of the project group's `episode_count` (the column the
|
|
96
|
-
* home page "我的项目" card reads). Optional: only the remote gateway store
|
|
97
|
-
* implements it — the local store omits it. Callers MUST treat a rejection as
|
|
98
|
-
* non-fatal; project-group metadata must never fail the primary script write.
|
|
99
|
-
*/
|
|
100
|
-
updateEpisodeCount?(episodeCount: number): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
export declare function syncEpisodeCount(client: ScriptOutputStore, episodeCount: number): Promise<void>;
|
|
103
|
-
export type OutputMode = "local" | "remote";
|
|
104
|
-
/**
|
|
105
|
-
* Single source of truth for output-target resolution. The CLI core is
|
|
106
|
-
* UNBOUND: a bare invocation with no per-call flag and no `SCRIPTCTL_OUTPUT_MODE`
|
|
107
|
-
* env resolves to `mode: null` (the caller then errors) rather than silently
|
|
108
|
-
* defaulting to the remote gateway. "Where does this write land" must always be
|
|
109
|
-
* an explicit decision — never inferred from ambient gateway credentials.
|
|
110
|
-
*
|
|
111
|
-
* Precedence: per-call flag (`--remote` / `--local`) > `SCRIPTCTL_OUTPUT_MODE`
|
|
112
|
-
* env (an explicit binding) > a project group in scope (`SANDBOX_PROJECT_GROUP_NO`
|
|
113
|
-
* env, which the sandbox injects, or a `--project-group-no` flag → infer remote)
|
|
114
|
-
* > none.
|
|
115
|
-
*
|
|
116
|
-
* The project-group inference is what keeps the sandbox zero-config: the backend
|
|
117
|
-
* already injects `SANDBOX_PROJECT_GROUP_NO`, so a bare command there resolves to
|
|
118
|
-
* remote without any extra binding. A dev box without that var stays unbound. A
|
|
119
|
-
* *typo* in `SCRIPTCTL_OUTPUT_MODE` is "explicit but broken" → it errors rather
|
|
120
|
-
* than falling through to inference, so a misconfiguration isn't silently masked.
|
|
121
|
-
*
|
|
122
|
-
* Returns:
|
|
123
|
-
* - mode: "local" | "remote" | null (null = unresolved → caller errors)
|
|
124
|
-
* - conflict: both `--remote` and `--local` were passed (mutually exclusive)
|
|
125
|
-
*
|
|
126
|
-
* Pure (never throws). `resolveOutputModeOrThrow` wraps it with the CliError
|
|
127
|
-
* contract so the conflict / no-target handling lives in exactly one place.
|
|
128
|
-
*/
|
|
129
|
-
export declare function resolveOutputMode(flags?: {
|
|
130
|
-
remote?: unknown;
|
|
131
|
-
local?: unknown;
|
|
132
|
-
projectGroupNo?: unknown;
|
|
133
|
-
}): {
|
|
134
|
-
mode: OutputMode | null;
|
|
135
|
-
conflict: boolean;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Resolve the store mode or throw the canonical CliError. Single source of truth
|
|
139
|
-
* for the "where does a STORE write land" contract, shared by every store
|
|
140
|
-
* builder (scriptOutputClient, parse's makeOutputStore, commandExport, …):
|
|
141
|
-
* - `--remote` + `--local` → TARGET_FLAG_CONFLICT
|
|
142
|
-
* - nothing resolvable → SCRIPT_NO_TARGET (the CLI is unbound; refuse
|
|
143
|
-
* to guess — names only public flags, never the
|
|
144
|
-
* env var, to keep the mode concept out of
|
|
145
|
-
* agent-facing output)
|
|
146
|
-
* Returns a non-null OutputMode on success.
|
|
147
|
-
*/
|
|
148
|
-
export declare function resolveOutputModeOrThrow(flags?: {
|
|
149
|
-
remote?: unknown;
|
|
150
|
-
local?: unknown;
|
|
151
|
-
projectGroupNo?: unknown;
|
|
152
|
-
}): OutputMode;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { CliError, EXIT_INPUT, EXIT_USAGE } from "../common.js";
|
|
2
|
-
export class ScriptOutputApiError extends Error {
|
|
3
|
-
status;
|
|
4
|
-
code;
|
|
5
|
-
payload;
|
|
6
|
-
configMissing;
|
|
7
|
-
constructor(message, opts = {}) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "ScriptOutputApiError";
|
|
10
|
-
this.status = opts.status ?? null;
|
|
11
|
-
this.code = opts.code ?? null;
|
|
12
|
-
this.payload = opts.payload;
|
|
13
|
-
this.configMissing = opts.configMissing ?? null;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Push the project group's episode count after a script write. Best-effort by
|
|
17
|
-
// design: the home-page episode_count is non-essential metadata, so a failure
|
|
18
|
-
// (auth, network, backend lacking the endpoint) is swallowed and never rolls
|
|
19
|
-
// back or surfaces above the primary script save. No-op on stores without the
|
|
20
|
-
// optional method (the local store).
|
|
21
|
-
export async function syncEpisodeCount(client, episodeCount) {
|
|
22
|
-
if (!client.updateEpisodeCount)
|
|
23
|
-
return;
|
|
24
|
-
try {
|
|
25
|
-
await client.updateEpisodeCount(episodeCount);
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// ponytail: best-effort metadata — keep it off agent-facing output.
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Single source of truth for output-target resolution. The CLI core is
|
|
33
|
-
* UNBOUND: a bare invocation with no per-call flag and no `SCRIPTCTL_OUTPUT_MODE`
|
|
34
|
-
* env resolves to `mode: null` (the caller then errors) rather than silently
|
|
35
|
-
* defaulting to the remote gateway. "Where does this write land" must always be
|
|
36
|
-
* an explicit decision — never inferred from ambient gateway credentials.
|
|
37
|
-
*
|
|
38
|
-
* Precedence: per-call flag (`--remote` / `--local`) > `SCRIPTCTL_OUTPUT_MODE`
|
|
39
|
-
* env (an explicit binding) > a project group in scope (`SANDBOX_PROJECT_GROUP_NO`
|
|
40
|
-
* env, which the sandbox injects, or a `--project-group-no` flag → infer remote)
|
|
41
|
-
* > none.
|
|
42
|
-
*
|
|
43
|
-
* The project-group inference is what keeps the sandbox zero-config: the backend
|
|
44
|
-
* already injects `SANDBOX_PROJECT_GROUP_NO`, so a bare command there resolves to
|
|
45
|
-
* remote without any extra binding. A dev box without that var stays unbound. A
|
|
46
|
-
* *typo* in `SCRIPTCTL_OUTPUT_MODE` is "explicit but broken" → it errors rather
|
|
47
|
-
* than falling through to inference, so a misconfiguration isn't silently masked.
|
|
48
|
-
*
|
|
49
|
-
* Returns:
|
|
50
|
-
* - mode: "local" | "remote" | null (null = unresolved → caller errors)
|
|
51
|
-
* - conflict: both `--remote` and `--local` were passed (mutually exclusive)
|
|
52
|
-
*
|
|
53
|
-
* Pure (never throws). `resolveOutputModeOrThrow` wraps it with the CliError
|
|
54
|
-
* contract so the conflict / no-target handling lives in exactly one place.
|
|
55
|
-
*/
|
|
56
|
-
export function resolveOutputMode(flags) {
|
|
57
|
-
const remoteFlag = Boolean(flags?.remote);
|
|
58
|
-
const localFlag = Boolean(flags?.local);
|
|
59
|
-
if (remoteFlag && localFlag)
|
|
60
|
-
return { mode: null, conflict: true };
|
|
61
|
-
if (remoteFlag)
|
|
62
|
-
return { mode: "remote", conflict: false };
|
|
63
|
-
if (localFlag)
|
|
64
|
-
return { mode: "local", conflict: false };
|
|
65
|
-
const raw = (process.env.SCRIPTCTL_OUTPUT_MODE ?? "").trim().toLowerCase();
|
|
66
|
-
if (raw === "local" || raw === "remote")
|
|
67
|
-
return { mode: raw, conflict: false };
|
|
68
|
-
if (raw !== "") {
|
|
69
|
-
// Unrecognized non-empty value (a typo like "loca"): explicit but broken —
|
|
70
|
-
// error rather than silently routing anywhere (including via inference).
|
|
71
|
-
return { mode: null, conflict: false };
|
|
72
|
-
}
|
|
73
|
-
// `SCRIPTCTL_OUTPUT_MODE` unset: infer remote when a project group is in scope.
|
|
74
|
-
// The presence of a project group identifier is a strong, specific signal of
|
|
75
|
-
// remote intent (the sandbox marker / an explicit `--project-group-no`), unlike
|
|
76
|
-
// generic ambient gateway credentials which must never imply a target.
|
|
77
|
-
const pgFlag = typeof flags?.projectGroupNo === "string" ? flags.projectGroupNo.trim() : "";
|
|
78
|
-
const pgEnv = (process.env.SANDBOX_PROJECT_GROUP_NO ?? "").trim();
|
|
79
|
-
if (pgFlag !== "" || pgEnv !== "")
|
|
80
|
-
return { mode: "remote", conflict: false };
|
|
81
|
-
return { mode: null, conflict: false };
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Resolve the store mode or throw the canonical CliError. Single source of truth
|
|
85
|
-
* for the "where does a STORE write land" contract, shared by every store
|
|
86
|
-
* builder (scriptOutputClient, parse's makeOutputStore, commandExport, …):
|
|
87
|
-
* - `--remote` + `--local` → TARGET_FLAG_CONFLICT
|
|
88
|
-
* - nothing resolvable → SCRIPT_NO_TARGET (the CLI is unbound; refuse
|
|
89
|
-
* to guess — names only public flags, never the
|
|
90
|
-
* env var, to keep the mode concept out of
|
|
91
|
-
* agent-facing output)
|
|
92
|
-
* Returns a non-null OutputMode on success.
|
|
93
|
-
*/
|
|
94
|
-
export function resolveOutputModeOrThrow(flags) {
|
|
95
|
-
const resolved = resolveOutputMode(flags);
|
|
96
|
-
if (resolved.conflict) {
|
|
97
|
-
throw new CliError("--remote and --local are mutually exclusive.", {
|
|
98
|
-
exitCode: EXIT_USAGE,
|
|
99
|
-
errorCode: "TARGET_FLAG_CONFLICT",
|
|
100
|
-
hint: "Drop one of the two flags and retry.",
|
|
101
|
-
data: { expected: ["exactly one of --remote (publish to the project DB) or --local (write a local store)"], actual: ["--remote and --local"] },
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (resolved.mode === null) {
|
|
105
|
-
throw new CliError("No output target was selected, so this command has nowhere to read or write.", {
|
|
106
|
-
exitCode: EXIT_INPUT,
|
|
107
|
-
errorCode: "SCRIPT_NO_TARGET",
|
|
108
|
-
hint: "Pass `--script-path <file.json>` to read/write a local script file,",
|
|
109
|
-
data: { expected: ["an explicit output target"], actual: ["no --script-path, no --remote/--local, and no bound default"] },
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return resolved.mode;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=script-output-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script-output-store.js","sourceRoot":"","sources":["../../src/infra/script-output-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiBhE,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,MAAM,CAAgB;IACtB,IAAI,CAA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ACjC,IAAI,EAAE,sCAAsC;YAC5C,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,sFAAsF,CAAC,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,EAAE;SAC/I,CAAC,CAAC;IACX,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,IAAI,QAAQ,CAAC,8EAA8E,EAAE;YAC3F,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,kBAAkB;YAC7B,IAAI,EAAE,qEAAqE;YAC3E,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC,6DAA6D,CAAC,EAAE;SAC3H,CAAC,CAAC;IACX,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface WorkingCopyMetadata {
|
|
2
|
-
schemaVersion: 1;
|
|
3
|
-
projectGroupNo: string;
|
|
4
|
-
apiBaseUrl: string;
|
|
5
|
-
baseRevision: number;
|
|
6
|
-
baseContentHash: string;
|
|
7
|
-
}
|
|
8
|
-
export interface WorkingCopyPaths {
|
|
9
|
-
scriptPath: string;
|
|
10
|
-
stateDir: string;
|
|
11
|
-
metadataPath: string;
|
|
12
|
-
lockPath: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function semanticScriptHash(script: unknown): string;
|
|
15
|
-
export declare function localFileFingerprint(filePath: string): string | null;
|
|
16
|
-
export declare function assertLocalFileFingerprint(filePath: string, expected: string | null): void;
|
|
17
|
-
export declare function workingCopyPaths(rawScriptPath: string): WorkingCopyPaths;
|
|
18
|
-
export declare function withScriptFileLock<T>(rawScriptPath: string, operation: () => Promise<T>): Promise<T>;
|
|
19
|
-
export declare function atomicWriteJson(filePath: string, value: unknown): void;
|
|
20
|
-
export declare function atomicWriteText(filePath: string, content: string): void;
|
|
21
|
-
export declare function readWorkingCopyMetadata(rawScriptPath: string): WorkingCopyMetadata | null;
|
|
22
|
-
export declare function writeWorkingCopyMetadata(rawScriptPath: string, metadata: WorkingCopyMetadata): void;
|
|
23
|
-
export declare function assertScriptUnchanged(scriptPath: string, expectedHash: string): void;
|