braidio 0.0.97__tar.gz → 0.0.99__tar.gz
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.
- {braidio-0.0.97 → braidio-0.0.99}/PKG-INFO +1 -1
- {braidio-0.0.97 → braidio-0.0.99}/braidio/bodies/__init__.py +2 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/bodies/_render_nodes.py +41 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/bodies/_tiers.py +3 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/project.py +28 -5
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/__init__.py +48 -22
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_asset_refs.py +8 -1
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_common.py +76 -6
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_narration.py +75 -9
- braidio-0.0.99/braidio/transforms/_takes.py +408 -0
- {braidio-0.0.97 → braidio-0.0.99}/pyproject.toml +1 -1
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_body_schema_stability.py +25 -6
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_nw_app.py +2 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms.py +493 -6
- {braidio-0.0.97 → braidio-0.0.99}/.editorconfig +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/.gitattributes +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/.gitignore +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/LICENSE +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/README.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/__init__.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/_paths.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/bodies/_domain.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/captions.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/compose.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/conversation.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/cost.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/defaults.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/delivery.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/downloads.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/formats.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/genre.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/kinds.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/leveling.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/markdown_script.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/tools.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/multivoice.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/music.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/pacing.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/provenance.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/relevance.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/render.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/rights.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/script.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/sources.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/structure.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/style.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/textprep.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/timeline.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_episode.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_ingest.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_video_cut.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/transforms/_voice.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/tts.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/video.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/voice_library.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/weave.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/braidio/weave_config.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/conftest.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/README.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/_audio.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_conversation.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_cost.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_credits_card.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_defaults.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_delivery.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_downloads.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_formats.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_graph_speak.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_importing.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_leveling.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_mcp.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_media_auth.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_multivoice.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_music.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_pacing.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_packaging.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_render_settings.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_script.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_sources.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_speak_seam.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_structure.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_timeline.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms_rights.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_turn_overlap.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_video.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_video_footage.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_video_transforms.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_voice_library.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_weave.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_weave_config.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_weave_master.py +0 -0
- {braidio-0.0.97 → braidio-0.0.99}/tests/test_wire_descriptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: braidio
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.99
|
|
4
4
|
Summary: Weave narration with extracted media segments into audiovisual productions
|
|
5
5
|
Project-URL: Homepage, https://github.com/thorwhalen/braidio
|
|
6
6
|
Project-URL: Repository, https://github.com/thorwhalen/braidio
|
|
@@ -36,6 +36,7 @@ from braidio.bodies._render_nodes import ( # noqa: F401 (import registers)
|
|
|
36
36
|
DIALOGUE_RENDER_V1,
|
|
37
37
|
SEGMENT_EXTRACTION_V1,
|
|
38
38
|
EPISODE_RENDER_V1,
|
|
39
|
+
TAKE_OVERRIDE_V1,
|
|
39
40
|
WeaveConfigBodyV1,
|
|
40
41
|
ProductionStructureBodyV1,
|
|
41
42
|
RenderProfileBodyV1,
|
|
@@ -46,6 +47,7 @@ from braidio.bodies._render_nodes import ( # noqa: F401 (import registers)
|
|
|
46
47
|
DialogueRenderBodyV1,
|
|
47
48
|
SegmentExtractionBodyV1,
|
|
48
49
|
EpisodeRenderBodyV1,
|
|
50
|
+
TakeOverrideBodyV1,
|
|
49
51
|
RENDER_SCHEMAS,
|
|
50
52
|
NARRATION_SOURCE_TTS,
|
|
51
53
|
NARRATION_SOURCE_UPLOAD,
|
|
@@ -26,6 +26,10 @@ NARRATION_RENDER_V1 = "annot://schema/narration-render/v1"
|
|
|
26
26
|
DIALOGUE_RENDER_V1 = "annot://schema/dialogue-render/v1"
|
|
27
27
|
SEGMENT_EXTRACTION_V1 = "annot://schema/segment-extraction/v1"
|
|
28
28
|
EPISODE_RENDER_V1 = "annot://schema/episode-render/v1"
|
|
29
|
+
TAKE_OVERRIDE_V1 = "annot://schema/take-override/v1"
|
|
30
|
+
|
|
31
|
+
#: A lacing asset id: the lowercase hex SHA-256 of a file's bytes.
|
|
32
|
+
_ASSET_ID_PATTERN = r"^[0-9a-f]{64}$"
|
|
29
33
|
|
|
30
34
|
#: ``NarrationRenderBodyV1.source`` values: a synthesised take, or a recording
|
|
31
35
|
#: a person uploaded in its place.
|
|
@@ -293,6 +297,42 @@ class EpisodeRenderBodyV1(BaseModel):
|
|
|
293
297
|
)
|
|
294
298
|
|
|
295
299
|
|
|
300
|
+
class TakeOverrideBodyV1(BaseModel):
|
|
301
|
+
"""A person's recording, standing in for one narration beat's synthesized take.
|
|
302
|
+
|
|
303
|
+
An **authoring** decision, not a render: the beat's ``narration-render/v1``
|
|
304
|
+
is still produced by the narration transform, which reads this node and
|
|
305
|
+
completes the render from it instead of synthesizing (braidio#86). Keeping
|
|
306
|
+
the decision out of the render is what lets the render's ``cache_key``
|
|
307
|
+
honestly name the audio it holds (``upload:<artifact_id>``), so no render
|
|
308
|
+
cache can hand the recording to another beat, and no TTS node can
|
|
309
|
+
displace it.
|
|
310
|
+
|
|
311
|
+
One per beat (identity: ``beat_id``); a second replacement rewrites it
|
|
312
|
+
under the same id. ``text_digest`` is the SHA-256 of the beat text the
|
|
313
|
+
recording says: an override whose digest no longer matches the beat's
|
|
314
|
+
current text is ignored, so editing the words brings back synthesis.
|
|
315
|
+
"""
|
|
316
|
+
|
|
317
|
+
model_config = {"frozen": True, "extra": "forbid"}
|
|
318
|
+
|
|
319
|
+
beat_id: str = Field(..., description="Zero-padded beat key (e.g. '0007').")
|
|
320
|
+
artifact_id: str = Field(
|
|
321
|
+
...,
|
|
322
|
+
pattern=_ASSET_ID_PATTERN,
|
|
323
|
+
description="lacing Artifact asset_id (SHA-256) of the recording.",
|
|
324
|
+
)
|
|
325
|
+
url: str = Field(
|
|
326
|
+
..., description="file:// URL of the project's copy of the recording."
|
|
327
|
+
)
|
|
328
|
+
duration_s: float = Field(..., gt=0, description="Recording length, seconds.")
|
|
329
|
+
text_digest: str = Field(
|
|
330
|
+
...,
|
|
331
|
+
pattern=_ASSET_ID_PATTERN,
|
|
332
|
+
description="SHA-256 of the beat text the recording was made against.",
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
|
|
296
336
|
RENDER_SCHEMAS: dict[str, type[BaseModel]] = {
|
|
297
337
|
WEAVE_CONFIG_V1: WeaveConfigBodyV1,
|
|
298
338
|
PRODUCTION_STRUCTURE_V1: ProductionStructureBodyV1,
|
|
@@ -304,6 +344,7 @@ RENDER_SCHEMAS: dict[str, type[BaseModel]] = {
|
|
|
304
344
|
DIALOGUE_RENDER_V1: DialogueRenderBodyV1,
|
|
305
345
|
SEGMENT_EXTRACTION_V1: SegmentExtractionBodyV1,
|
|
306
346
|
EPISODE_RENDER_V1: EpisodeRenderBodyV1,
|
|
347
|
+
TAKE_OVERRIDE_V1: TakeOverrideBodyV1,
|
|
307
348
|
}
|
|
308
349
|
|
|
309
350
|
for _uri, _model in RENDER_SCHEMAS.items():
|
|
@@ -16,6 +16,8 @@ _AUDIO_CLIPS = Tier("audio-clips")
|
|
|
16
16
|
_NARRATIVE_BEATS = Tier("narrative-beats")
|
|
17
17
|
_DIALOGUE_BEATS = Tier("dialogue-beats")
|
|
18
18
|
_SCENE_BREAKS = Tier("scene-breaks")
|
|
19
|
+
# A person's recording standing in for a beat's take (braidio#86).
|
|
20
|
+
_TAKE_OVERRIDES = Tier("take-overrides")
|
|
19
21
|
# Render-provenance layers.
|
|
20
22
|
_WEAVE_CONFIGS = Tier("weave-configs")
|
|
21
23
|
_PRODUCTION_STRUCTURES = Tier("production-structures")
|
|
@@ -40,6 +42,7 @@ TIERS: tuple[Tier, ...] = (
|
|
|
40
42
|
_NARRATIVE_BEATS,
|
|
41
43
|
_DIALOGUE_BEATS,
|
|
42
44
|
_SCENE_BREAKS,
|
|
45
|
+
_TAKE_OVERRIDES,
|
|
43
46
|
_WEAVE_CONFIGS,
|
|
44
47
|
_PRODUCTION_STRUCTURES,
|
|
45
48
|
_RENDER_PROFILES,
|
|
@@ -26,6 +26,10 @@ from braidio.kinds import WeaveKind
|
|
|
26
26
|
#: braidio's own vocabulary (a host maps it to its tool name, prefix and all).
|
|
27
27
|
NEXT_STEP_SAVE_SCRIPT = ("save_script", "there is no script yet")
|
|
28
28
|
NEXT_STEP_WEAVE = ("weave_project", "the script has not been rendered yet")
|
|
29
|
+
NEXT_STEP_HEAR_TAKES = (
|
|
30
|
+
"weave_project",
|
|
31
|
+
"a recorded take is not in the mix yet — weave again to hear it",
|
|
32
|
+
)
|
|
29
33
|
NEXT_STEP_DONE = (
|
|
30
34
|
"weave_project",
|
|
31
35
|
"an episode is made — download it by its episode_id, or weave again after "
|
|
@@ -33,6 +37,13 @@ NEXT_STEP_DONE = (
|
|
|
33
37
|
)
|
|
34
38
|
|
|
35
39
|
|
|
40
|
+
def _pending_takes(project, *, episode) -> tuple:
|
|
41
|
+
"""Beats whose recorded take the current mix does not play (braidio#86)."""
|
|
42
|
+
from braidio.transforms._takes import pending_takes
|
|
43
|
+
|
|
44
|
+
return pending_takes(project, episode=episode)
|
|
45
|
+
|
|
46
|
+
|
|
36
47
|
def _tiers():
|
|
37
48
|
"""The tier names, from the one table the transforms write by (lazy: the
|
|
38
49
|
transforms package is heavy and this module is imported with ``braidio``)."""
|
|
@@ -93,10 +104,13 @@ class Project(nw.Project):
|
|
|
93
104
|
Counted, in muvid's shape: the script's beats by kind, how many episodes
|
|
94
105
|
were rendered, the current one as ``latest_episode`` (path-free; the
|
|
95
106
|
wire name predates "current", see :meth:`current_episode`), and the
|
|
96
|
-
next step as ``{"op", "why"}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
next step as ``{"op", "why"}``, plus ``pending_takes``: the beats whose
|
|
108
|
+
recorded take the mix does not play yet (braidio#86; empty unless a
|
|
109
|
+
take was replaced). Indexed tier reads — plus one freshness walk, only
|
|
110
|
+
once there is more than one episode to choose from — no file probe, so
|
|
111
|
+
it stays small however often the project is re-woven, and never names
|
|
112
|
+
a path. Two overrides for one beat are reported as the next step
|
|
113
|
+
(``restore_take``), not raised: a polled status door must answer.
|
|
100
114
|
|
|
101
115
|
>>> import tempfile
|
|
102
116
|
>>> with tempfile.TemporaryDirectory() as d:
|
|
@@ -116,7 +130,15 @@ class Project(nw.Project):
|
|
|
116
130
|
}
|
|
117
131
|
episodes = self.episodes()
|
|
118
132
|
current = self.current_episode(episodes=episodes)
|
|
119
|
-
|
|
133
|
+
try:
|
|
134
|
+
pending, broken = _pending_takes(self, episode=current), None
|
|
135
|
+
except ValueError as exc: # two overrides for one beat: say how out
|
|
136
|
+
pending, broken = (), str(exc)
|
|
137
|
+
if broken:
|
|
138
|
+
op, why = "restore_take", broken
|
|
139
|
+
elif pending and episodes:
|
|
140
|
+
op, why = NEXT_STEP_HEAR_TAKES
|
|
141
|
+
elif episodes:
|
|
120
142
|
op, why = NEXT_STEP_DONE
|
|
121
143
|
elif any(counts.values()):
|
|
122
144
|
op, why = NEXT_STEP_WEAVE
|
|
@@ -126,6 +148,7 @@ class Project(nw.Project):
|
|
|
126
148
|
**counts,
|
|
127
149
|
"episode_count": len(episodes),
|
|
128
150
|
"latest_episode": _episode_row(current) if current else None,
|
|
151
|
+
"pending_takes": list(pending),
|
|
129
152
|
"next_step": {"op": op, "why": why},
|
|
130
153
|
}
|
|
131
154
|
|
|
@@ -13,7 +13,9 @@ The chain (``sources → segments → weave``):
|
|
|
13
13
|
- ``beat_to_voice_assignment.default`` — narrative beat (+ weave-config) →
|
|
14
14
|
``voice-assignment/v1`` (deterministic; no synthesis).
|
|
15
15
|
- ``narration_render.tts`` — narrative beat (+ voice-assignment + config) →
|
|
16
|
-
``narration-render/v1`` (ElevenLabs TTS; cached by an explicit ``cache_key``)
|
|
16
|
+
``narration-render/v1`` (ElevenLabs TTS; cached by an explicit ``cache_key``),
|
|
17
|
+
or, for a beat with a ``take-override/v1`` (:func:`replace_take`), the
|
|
18
|
+
person's recording instead — no synthesis (braidio#86).
|
|
17
19
|
- ``dialogue_render.tts`` — dialogue beat (+ the singleton dialogue-cast) →
|
|
18
20
|
``dialogue-render/v1`` (ElevenLabs Text-to-Dialogue, one pass per exchange;
|
|
19
21
|
cached by an explicit ``cache_key``; thorwhalen/braidio#46).
|
|
@@ -42,6 +44,8 @@ from nw import TransformInputs
|
|
|
42
44
|
|
|
43
45
|
from braidio.transforms._common import (
|
|
44
46
|
ELEVENLABS_SECRET,
|
|
47
|
+
fresh_ids_pass,
|
|
48
|
+
note_output,
|
|
45
49
|
TIER_WEAVE_CONFIG,
|
|
46
50
|
TIER_PRODUCTION_STRUCTURE,
|
|
47
51
|
TIER_RENDER_PROFILE,
|
|
@@ -50,6 +54,7 @@ from braidio.transforms._common import (
|
|
|
50
54
|
TIER_NARRATIVE_BEAT,
|
|
51
55
|
TIER_DIALOGUE_BEAT,
|
|
52
56
|
TIER_SCENE_BREAK,
|
|
57
|
+
TIER_TAKE_OVERRIDE,
|
|
53
58
|
TIER_AUDIO_CLIP,
|
|
54
59
|
TIER_VOICE_ASSIGNMENT,
|
|
55
60
|
TIER_NARRATION_RENDER,
|
|
@@ -81,6 +86,15 @@ from braidio.transforms._episode import (
|
|
|
81
86
|
episode_timeline,
|
|
82
87
|
member_spans,
|
|
83
88
|
)
|
|
89
|
+
from braidio.transforms._takes import (
|
|
90
|
+
UPLOAD_CACHE_KEY_PREFIX,
|
|
91
|
+
TakePreview,
|
|
92
|
+
pending_takes,
|
|
93
|
+
preview_take,
|
|
94
|
+
replace_take,
|
|
95
|
+
restore_take,
|
|
96
|
+
take_override_for,
|
|
97
|
+
)
|
|
84
98
|
from braidio.transforms._video_panels import (
|
|
85
99
|
Pick,
|
|
86
100
|
as_pick,
|
|
@@ -129,6 +143,13 @@ __all__ = [
|
|
|
129
143
|
"member_spans",
|
|
130
144
|
"MemberSpan",
|
|
131
145
|
"episode_script",
|
|
146
|
+
"TakePreview",
|
|
147
|
+
"pending_takes",
|
|
148
|
+
"preview_take",
|
|
149
|
+
"replace_take",
|
|
150
|
+
"restore_take",
|
|
151
|
+
"take_override_for",
|
|
152
|
+
"UPLOAD_CACHE_KEY_PREFIX",
|
|
132
153
|
"mint_seed",
|
|
133
154
|
"panels_for_episode",
|
|
134
155
|
"picks_from_panels",
|
|
@@ -157,6 +178,7 @@ __all__ = [
|
|
|
157
178
|
"TIER_NARRATIVE_BEAT",
|
|
158
179
|
"TIER_DIALOGUE_BEAT",
|
|
159
180
|
"TIER_SCENE_BREAK",
|
|
181
|
+
"TIER_TAKE_OVERRIDE",
|
|
160
182
|
"TIER_AUDIO_CLIP",
|
|
161
183
|
"TIER_VOICE_ASSIGNMENT",
|
|
162
184
|
"TIER_NARRATION_RENDER",
|
|
@@ -361,29 +383,33 @@ def weave_project(
|
|
|
361
383
|
|
|
362
384
|
def run(transform, *primary, secrets=None):
|
|
363
385
|
results.append(_execute(transform, project, *primary, secrets=secrets))
|
|
364
|
-
|
|
386
|
+
out = results[-1].annotations[0]
|
|
387
|
+
note_output(project, out) # a node the held walk did not know: walk again
|
|
388
|
+
return out
|
|
365
389
|
|
|
366
390
|
render_by_authoring_id = {}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
391
|
+
# one freshness walk per write, not ~two per beat (braidio#171)
|
|
392
|
+
with fresh_ids_pass():
|
|
393
|
+
try:
|
|
394
|
+
for beat in ing.narration_beats:
|
|
395
|
+
run(voice, beat)
|
|
396
|
+
render_by_authoring_id[beat.id] = run(narration, beat, secrets=secrets)
|
|
397
|
+
for beat in ing.dialogue_beats:
|
|
398
|
+
render_by_authoring_id[beat.id] = run(dialogue, beat, secrets=secrets)
|
|
399
|
+
for clip in ing.audio_clips:
|
|
400
|
+
render_by_authoring_id[clip.id] = run(segment, clip)
|
|
401
|
+
|
|
402
|
+
# A scene break renders no node of its own — the authoring annotation
|
|
403
|
+
# IS the member, and the episode transform turns it into a sting or a
|
|
404
|
+
# pause.
|
|
405
|
+
members = tuple(
|
|
406
|
+
auth if kind == "scene_break" else render_by_authoring_id[auth.id]
|
|
407
|
+
for kind, auth in ing.ordered
|
|
408
|
+
)
|
|
409
|
+
woven = run(episode, *members)
|
|
410
|
+
except Exception as exc: # annotated and re-raised, never swallowed
|
|
411
|
+
exc.weave_receipt = WeaveReceipt.of(None, results, failed=True)
|
|
412
|
+
raise
|
|
387
413
|
return WeaveReceipt.of(woven, results) if return_receipt else woven
|
|
388
414
|
|
|
389
415
|
|
|
@@ -16,6 +16,12 @@ Declared:
|
|
|
16
16
|
``weave_to_episode.default`` takes this schema as an input, so only
|
|
17
17
|
``episode-render/v1`` gains the edge. The sting and bed bytes are hashed but not
|
|
18
18
|
registered in any artifact store: the edge names content, not a stored blob.
|
|
19
|
+
- ``take-override/v1`` → ``artifact_id``. One writer
|
|
20
|
+
(``_takes.replace_take``), which stores ``Artifact.from_path(recording).asset_id``,
|
|
21
|
+
and the body schema itself refuses anything but 64 lowercase hex. Only
|
|
22
|
+
``narration_render.tts`` takes this schema as an input, so a narration render
|
|
23
|
+
spoken by an uploaded recording names the recording's bytes in its provenance
|
|
24
|
+
(braidio#86).
|
|
19
25
|
|
|
20
26
|
Deliberately NOT declared (each is a decision, not an omission):
|
|
21
27
|
|
|
@@ -38,11 +44,12 @@ from __future__ import annotations
|
|
|
38
44
|
|
|
39
45
|
from nw.transforms import asset_fields, register_asset_refs
|
|
40
46
|
|
|
41
|
-
from braidio.bodies import PRODUCTION_STRUCTURE_V1
|
|
47
|
+
from braidio.bodies import PRODUCTION_STRUCTURE_V1, TAKE_OVERRIDE_V1
|
|
42
48
|
|
|
43
49
|
#: ``{body_schema_uri: dotted field paths}`` — the SSOT for what braidio declares.
|
|
44
50
|
ASSET_REF_FIELDS: dict[str, tuple[str, ...]] = {
|
|
45
51
|
PRODUCTION_STRUCTURE_V1: ("sting_asset_id", "bed_asset_id"),
|
|
52
|
+
TAKE_OVERRIDE_V1: ("artifact_id",),
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
|
|
@@ -17,7 +17,10 @@ Tier-name constants mirror :mod:`braidio.bodies._tiers`; body schemas live in
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import uuid
|
|
20
|
+
from contextlib import contextmanager
|
|
21
|
+
from contextvars import ContextVar
|
|
20
22
|
from pathlib import Path
|
|
23
|
+
from typing import Optional
|
|
21
24
|
from urllib.parse import urlparse
|
|
22
25
|
from urllib.request import url2pathname
|
|
23
26
|
|
|
@@ -32,6 +35,7 @@ TIER_SOURCE_MEDIA = "source-media"
|
|
|
32
35
|
TIER_NARRATIVE_BEAT = "narrative-beats"
|
|
33
36
|
TIER_DIALOGUE_BEAT = "dialogue-beats"
|
|
34
37
|
TIER_SCENE_BREAK = "scene-breaks"
|
|
38
|
+
TIER_TAKE_OVERRIDE = "take-overrides"
|
|
35
39
|
TIER_AUDIO_CLIP = "audio-clips"
|
|
36
40
|
TIER_VOICE_ASSIGNMENT = "voice-assignments"
|
|
37
41
|
TIER_NARRATION_RENDER = "narration-renders"
|
|
@@ -91,7 +95,10 @@ SINGLETON_TIERS = frozenset(
|
|
|
91
95
|
#: The tiers an ingest owns, in the order it writes them. A re-ingest reconciles
|
|
92
96
|
#: exactly these — a node here whose identity the new plan no longer names is
|
|
93
97
|
#: removed (its dependents then read ``upstream-missing``); the render tiers
|
|
94
|
-
#: are never touched by ingest.
|
|
98
|
+
#: are never touched by ingest. Nor is :data:`TIER_TAKE_OVERRIDE`: a person's
|
|
99
|
+
#: recording is authored by ``replace_take``, not by the script, so a script
|
|
100
|
+
#: re-ingest must leave it alone (braidio#86). Its identity is still its
|
|
101
|
+
#: ``beat_id`` (:func:`node_identity`), one override per beat.
|
|
95
102
|
AUTHORING_TIERS = (
|
|
96
103
|
TIER_WEAVE_CONFIG,
|
|
97
104
|
TIER_PRODUCTION_STRUCTURE,
|
|
@@ -128,6 +135,10 @@ RENDER_OUTPUT_KEYS = frozenset(
|
|
|
128
135
|
"height",
|
|
129
136
|
"fps",
|
|
130
137
|
"captions_artifact_id",
|
|
138
|
+
# NOT a narration take's ``source``: whether a beat is spoken by a
|
|
139
|
+
# person's recording is decided by the plan (a take-override node,
|
|
140
|
+
# braidio#86), so it is part of the planned value, and a TTS skeleton
|
|
141
|
+
# can never be matched to an uploaded render or vice versa.
|
|
131
142
|
}
|
|
132
143
|
)
|
|
133
144
|
|
|
@@ -186,9 +197,9 @@ def fresh_equivalent(project, skeleton: Annotation) -> Annotation | None:
|
|
|
186
197
|
(thorwhalen/braidio#51). Reuse is by *value*, never by id alone.
|
|
187
198
|
|
|
188
199
|
This is what makes re-running the weave idempotent — a no-op re-run adds
|
|
189
|
-
no voice-assignment, no render, no episode. It
|
|
190
|
-
per call,
|
|
191
|
-
|
|
200
|
+
no voice-assignment, no render, no episode. It reads :func:`fresh_ids`:
|
|
201
|
+
one full freshness walk per call, or one per write inside a
|
|
202
|
+
:func:`fresh_ids_pass` (braidio#171).
|
|
192
203
|
|
|
193
204
|
Only the annotation half of ``was_derived_from`` is compared. Since nw#55 a
|
|
194
205
|
declared input schema also contributes the artifact ids its body names
|
|
@@ -220,12 +231,71 @@ def fresh_equivalent(project, skeleton: Annotation) -> Annotation | None:
|
|
|
220
231
|
|
|
221
232
|
|
|
222
233
|
def fresh_ids(project) -> set:
|
|
223
|
-
"""The ids of every annotation nw's freshness walk verifies as fresh.
|
|
234
|
+
"""The ids of every annotation nw's freshness walk verifies as fresh.
|
|
235
|
+
|
|
236
|
+
One full walk of the graph, unless a :func:`fresh_ids_pass` is open, in
|
|
237
|
+
which case the walk is reused until :func:`note_output` drops it
|
|
238
|
+
(braidio#171).
|
|
239
|
+
"""
|
|
224
240
|
import nw
|
|
225
241
|
|
|
226
|
-
|
|
242
|
+
cache = _FRESH_PASS.get()
|
|
243
|
+
key = str(Path(project.root).resolve())
|
|
244
|
+
if cache is not None and key in cache:
|
|
245
|
+
return cache[key]
|
|
246
|
+
ids = {
|
|
227
247
|
v.annotation.id for v in nw.stale_verdicts_all(project.root) if not v.is_stale
|
|
228
248
|
}
|
|
249
|
+
if cache is not None:
|
|
250
|
+
cache[key] = ids
|
|
251
|
+
return ids
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
#: The walks a :func:`fresh_ids_pass` reuses, by project root (``None``: no pass).
|
|
255
|
+
_FRESH_PASS: ContextVar[Optional[dict]] = ContextVar("braidio_fresh_pass", default=None)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
@contextmanager
|
|
259
|
+
def fresh_ids_pass():
|
|
260
|
+
"""Reuse one freshness walk per project until something is written.
|
|
261
|
+
|
|
262
|
+
Freshness changes only through a write, and adding a node changes no
|
|
263
|
+
*other* node's freshness (it is a function of each node's own parents),
|
|
264
|
+
so a pass that writes nothing needs one walk however many lookups it does.
|
|
265
|
+
The driver reports each stage's output with :func:`note_output`, which
|
|
266
|
+
drops the walk when that output is a node it did not know (a write);
|
|
267
|
+
``weave_project`` does, so a no-op re-weave is one walk instead of about
|
|
268
|
+
two per beat (braidio#171). Nested passes share the outer one. Two weaves
|
|
269
|
+
of ONE project at once were already racy (no per-project lock); a pass
|
|
270
|
+
widens the stale window from one lookup to the pass.
|
|
271
|
+
"""
|
|
272
|
+
if _FRESH_PASS.get() is not None:
|
|
273
|
+
yield
|
|
274
|
+
return
|
|
275
|
+
token = _FRESH_PASS.set({})
|
|
276
|
+
try:
|
|
277
|
+
yield
|
|
278
|
+
finally:
|
|
279
|
+
_FRESH_PASS.reset(token)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def note_output(project, annotation) -> None:
|
|
283
|
+
"""Tell the open pass a stage produced ``annotation``.
|
|
284
|
+
|
|
285
|
+
A node the held walk does not know as fresh was just written (a new or an
|
|
286
|
+
adopted render), so the walk is dropped and the next lookup walks again.
|
|
287
|
+
Nothing is walked here: with no walk held there is nothing to drop, which
|
|
288
|
+
keeps a first weave (no candidates, no lookups) free of walks it never
|
|
289
|
+
needed (braidio#171 review). Only correct for a driver whose stages return
|
|
290
|
+
the node they wrote, as every braidio transform does.
|
|
291
|
+
"""
|
|
292
|
+
cache = _FRESH_PASS.get()
|
|
293
|
+
if cache is None:
|
|
294
|
+
return
|
|
295
|
+
key = str(Path(project.root).resolve())
|
|
296
|
+
held = cache.get(key)
|
|
297
|
+
if held is not None and annotation.id not in held:
|
|
298
|
+
del cache[key]
|
|
229
299
|
|
|
230
300
|
|
|
231
301
|
def freshest(project, annotations):
|
|
@@ -6,6 +6,15 @@ the audio-affecting inputs; ``execute`` synthesizes via ``braidio.narrate``
|
|
|
6
6
|
(ElevenLabs), unless an identical ``cache_key`` already has an artifact
|
|
7
7
|
(compare-and-skip). It derives from ``[beat, voice-assignment, weave-config]``.
|
|
8
8
|
|
|
9
|
+
A beat a person recorded is the exception (braidio#86): when the beat has a
|
|
10
|
+
``take-override/v1`` made against its current text
|
|
11
|
+
(:func:`braidio.transforms._takes.take_override_for`), the render derives from
|
|
12
|
+
``[beat, voice-assignment, take-override]`` instead, its ``cache_key`` is
|
|
13
|
+
``upload:<artifact_id>`` and ``source`` is ``"upload"``, and ``execute``
|
|
14
|
+
completes it from the recording: no synthesis, no spend. The weave-config is
|
|
15
|
+
not a parent then, because nothing it decides reaches a recording; the
|
|
16
|
+
voice-assignment still is, because the episode reads the speaker from it.
|
|
17
|
+
|
|
9
18
|
The skeleton's ``provenance.was_derived_from`` records exactly those inputs;
|
|
10
19
|
``execute`` re-resolves them from the graph (it receives no ``inputs``) and
|
|
11
20
|
writes the completed node through ``project.graph`` so ``nw.stale_after``
|
|
@@ -36,6 +45,8 @@ from braidio.bodies._render_nodes import (
|
|
|
36
45
|
WEAVE_CONFIG_V1,
|
|
37
46
|
VOICE_ASSIGNMENT_V1,
|
|
38
47
|
NARRATION_RENDER_V1,
|
|
48
|
+
NARRATION_SOURCE_UPLOAD,
|
|
49
|
+
TAKE_OVERRIDE_V1,
|
|
39
50
|
NarrationRenderBodyV1,
|
|
40
51
|
)
|
|
41
52
|
from braidio.cost import backend_cost_usd
|
|
@@ -53,6 +64,7 @@ from braidio.transforms._common import (
|
|
|
53
64
|
TIER_VOICE_ASSIGNMENT,
|
|
54
65
|
TIER_WEAVE_CONFIG,
|
|
55
66
|
TIER_NARRATION_RENDER,
|
|
67
|
+
TIER_TAKE_OVERRIDE,
|
|
56
68
|
beat_ordinal,
|
|
57
69
|
singleton,
|
|
58
70
|
graph_index,
|
|
@@ -66,6 +78,7 @@ from braidio.transforms._common import (
|
|
|
66
78
|
file_url,
|
|
67
79
|
elevenlabs_key,
|
|
68
80
|
)
|
|
81
|
+
from braidio.transforms._takes import take_override_for, upload_cache_key
|
|
69
82
|
|
|
70
83
|
from braidio.transforms._voice import current_voice_assignment
|
|
71
84
|
|
|
@@ -227,29 +240,45 @@ def _render_inputs(beat, va, cfg) -> _RenderInputs:
|
|
|
227
240
|
|
|
228
241
|
@register_transform(NAME)
|
|
229
242
|
class NarrationRenderTTS(BaseTransform):
|
|
230
|
-
"""Narrative beat (+ voice-assignment + weave-config
|
|
243
|
+
"""Narrative beat (+ voice-assignment + weave-config, or + its take-override)
|
|
244
|
+
→ ``narration-render/v1``."""
|
|
231
245
|
|
|
232
246
|
name = NAME
|
|
233
|
-
input_kinds = (
|
|
247
|
+
input_kinds = (
|
|
248
|
+
NARRATIVE_BEAT_V1,
|
|
249
|
+
VOICE_ASSIGNMENT_V1,
|
|
250
|
+
WEAVE_CONFIG_V1,
|
|
251
|
+
TAKE_OVERRIDE_V1,
|
|
252
|
+
)
|
|
234
253
|
output_kind = NARRATION_RENDER_V1
|
|
235
254
|
|
|
236
255
|
def plan(
|
|
237
256
|
self, project, inputs: TransformInputs, *, params=None
|
|
238
257
|
) -> tuple[Plan, tuple[Annotation, ...]]:
|
|
239
258
|
beat = inputs.primary[0]
|
|
240
|
-
cfg = singleton(project, TIER_WEAVE_CONFIG)
|
|
241
259
|
va = current_voice_assignment(project, beat)
|
|
242
|
-
|
|
260
|
+
override = take_override_for(project, beat)
|
|
261
|
+
if override is not None:
|
|
262
|
+
# A person's recording speaks this beat: the key names those bytes
|
|
263
|
+
# and nothing a synthesis setting decides (braidio#86).
|
|
264
|
+
body = NarrationRenderBodyV1(
|
|
265
|
+
cache_key=upload_cache_key(override.body["artifact_id"]),
|
|
266
|
+
source=NARRATION_SOURCE_UPLOAD,
|
|
267
|
+
)
|
|
268
|
+
context = {VOICE_ASSIGNMENT_V1: (va,), TAKE_OVERRIDE_V1: (override,)}
|
|
269
|
+
else:
|
|
270
|
+
cfg = singleton(project, TIER_WEAVE_CONFIG)
|
|
271
|
+
body = NarrationRenderBodyV1(
|
|
272
|
+
cache_key=_render_inputs(beat, va, cfg).cache_key(self)
|
|
273
|
+
)
|
|
274
|
+
context = {VOICE_ASSIGNMENT_V1: (va,), WEAVE_CONFIG_V1: (cfg,)}
|
|
243
275
|
|
|
244
|
-
full = TransformInputs(
|
|
245
|
-
primary=(beat,),
|
|
246
|
-
context={VOICE_ASSIGNMENT_V1: (va,), WEAVE_CONFIG_V1: (cfg,)},
|
|
247
|
-
)
|
|
276
|
+
full = TransformInputs(primary=(beat,), context=context)
|
|
248
277
|
skeleton = Annotation(
|
|
249
278
|
id=uuid.uuid4(),
|
|
250
279
|
tier=TIER_NARRATION_RENDER,
|
|
251
280
|
reference=beat.reference,
|
|
252
|
-
body=
|
|
281
|
+
body=body.model_dump(),
|
|
253
282
|
body_schema_uri=NARRATION_RENDER_V1,
|
|
254
283
|
provenance=derive_provenance(self, full, attributed_to="agent:braidio"),
|
|
255
284
|
)
|
|
@@ -268,6 +297,11 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
268
297
|
skel = skeleton[0]
|
|
269
298
|
cache_key = skel.body["cache_key"]
|
|
270
299
|
parents = resolve_parents(skel, graph_index(project))
|
|
300
|
+
override = next((p for p in parents if p.tier == TIER_TAKE_OVERRIDE), None)
|
|
301
|
+
if override is not None:
|
|
302
|
+
return _speak_from_override(
|
|
303
|
+
project, skel, override, reuse=use_cache and not force
|
|
304
|
+
)
|
|
271
305
|
beat = require_tier(parents, TIER_NARRATIVE_BEAT)
|
|
272
306
|
va = require_tier(parents, TIER_VOICE_ASSIGNMENT)
|
|
273
307
|
cfg = require_tier(parents, TIER_WEAVE_CONFIG)
|
|
@@ -351,3 +385,35 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
351
385
|
cache_hit_savings_usd=estimate if was_cached else 0.0,
|
|
352
386
|
has_unknown_costs=cost is None,
|
|
353
387
|
)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _speak_from_override(
|
|
391
|
+
project, skel: Annotation, override: Annotation, *, reuse: bool
|
|
392
|
+
) -> TransformResult:
|
|
393
|
+
"""Complete ``skel`` from a person's recording: no synthesis, nothing spent.
|
|
394
|
+
|
|
395
|
+
Never through ``cached_output``: the recording is this beat's alone, and
|
|
396
|
+
its node is the override, not some render that happens to share a key.
|
|
397
|
+
``cache_hit_savings_usd`` stays ``0.0`` too: no synthesis was avoided by a
|
|
398
|
+
cache, a person chose not to have one.
|
|
399
|
+
"""
|
|
400
|
+
existing = fresh_equivalent(project, skel) if reuse else None
|
|
401
|
+
if existing is None:
|
|
402
|
+
existing = skel.model_copy(
|
|
403
|
+
update={
|
|
404
|
+
"body": {
|
|
405
|
+
**skel.body,
|
|
406
|
+
"artifact_id": override.body["artifact_id"],
|
|
407
|
+
"url": override.body["url"],
|
|
408
|
+
"duration_s": float(override.body["duration_s"]),
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
project.graph.add_annotation(existing)
|
|
413
|
+
return TransformResult(
|
|
414
|
+
annotations=(existing,),
|
|
415
|
+
artifacts=(),
|
|
416
|
+
cost_usd_actual=0.0,
|
|
417
|
+
cache_hit_savings_usd=0.0,
|
|
418
|
+
has_unknown_costs=False,
|
|
419
|
+
)
|