braidio 0.0.97__tar.gz → 0.0.98__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.
Files changed (151) hide show
  1. {braidio-0.0.97 → braidio-0.0.98}/PKG-INFO +1 -1
  2. {braidio-0.0.97 → braidio-0.0.98}/braidio/bodies/__init__.py +2 -0
  3. {braidio-0.0.97 → braidio-0.0.98}/braidio/bodies/_render_nodes.py +41 -0
  4. {braidio-0.0.97 → braidio-0.0.98}/braidio/bodies/_tiers.py +3 -0
  5. {braidio-0.0.97 → braidio-0.0.98}/braidio/project.py +28 -5
  6. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/__init__.py +21 -1
  7. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_asset_refs.py +8 -1
  8. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_common.py +9 -1
  9. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_narration.py +75 -9
  10. braidio-0.0.98/braidio/transforms/_takes.py +408 -0
  11. {braidio-0.0.97 → braidio-0.0.98}/pyproject.toml +1 -1
  12. {braidio-0.0.97 → braidio-0.0.98}/tests/test_body_schema_stability.py +25 -6
  13. {braidio-0.0.97 → braidio-0.0.98}/tests/test_nw_app.py +2 -0
  14. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms.py +466 -0
  15. {braidio-0.0.97 → braidio-0.0.98}/.editorconfig +0 -0
  16. {braidio-0.0.97 → braidio-0.0.98}/.gitattributes +0 -0
  17. {braidio-0.0.97 → braidio-0.0.98}/.gitignore +0 -0
  18. {braidio-0.0.97 → braidio-0.0.98}/LICENSE +0 -0
  19. {braidio-0.0.97 → braidio-0.0.98}/README.md +0 -0
  20. {braidio-0.0.97 → braidio-0.0.98}/braidio/__init__.py +0 -0
  21. {braidio-0.0.97 → braidio-0.0.98}/braidio/_paths.py +0 -0
  22. {braidio-0.0.97 → braidio-0.0.98}/braidio/bodies/_domain.py +0 -0
  23. {braidio-0.0.97 → braidio-0.0.98}/braidio/bodies/_video.py +0 -0
  24. {braidio-0.0.97 → braidio-0.0.98}/braidio/captions.py +0 -0
  25. {braidio-0.0.97 → braidio-0.0.98}/braidio/compose.py +0 -0
  26. {braidio-0.0.97 → braidio-0.0.98}/braidio/conversation.py +0 -0
  27. {braidio-0.0.97 → braidio-0.0.98}/braidio/cost.py +0 -0
  28. {braidio-0.0.97 → braidio-0.0.98}/braidio/data/skills/braidio/SKILL.md +0 -0
  29. {braidio-0.0.97 → braidio-0.0.98}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
  30. {braidio-0.0.97 → braidio-0.0.98}/braidio/defaults.py +0 -0
  31. {braidio-0.0.97 → braidio-0.0.98}/braidio/delivery.py +0 -0
  32. {braidio-0.0.97 → braidio-0.0.98}/braidio/downloads.py +0 -0
  33. {braidio-0.0.97 → braidio-0.0.98}/braidio/formats.py +0 -0
  34. {braidio-0.0.97 → braidio-0.0.98}/braidio/genre.py +0 -0
  35. {braidio-0.0.97 → braidio-0.0.98}/braidio/importing/__init__.py +0 -0
  36. {braidio-0.0.97 → braidio-0.0.98}/braidio/importing/__main__.py +0 -0
  37. {braidio-0.0.97 → braidio-0.0.98}/braidio/importing/_catalog.py +0 -0
  38. {braidio-0.0.97 → braidio-0.0.98}/braidio/importing/_manifest.py +0 -0
  39. {braidio-0.0.97 → braidio-0.0.98}/braidio/importing/_writer.py +0 -0
  40. {braidio-0.0.97 → braidio-0.0.98}/braidio/kinds.py +0 -0
  41. {braidio-0.0.97 → braidio-0.0.98}/braidio/leveling.py +0 -0
  42. {braidio-0.0.97 → braidio-0.0.98}/braidio/markdown_script.py +0 -0
  43. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/__init__.py +0 -0
  44. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/_docs.py +0 -0
  45. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/_guide.py +0 -0
  46. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/_helpers.py +0 -0
  47. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/_media.py +0 -0
  48. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/credentials.py +0 -0
  49. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/metering.py +0 -0
  50. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/tools.py +0 -0
  51. {braidio-0.0.97 → braidio-0.0.98}/braidio/mcp/workspace.py +0 -0
  52. {braidio-0.0.97 → braidio-0.0.98}/braidio/multivoice.py +0 -0
  53. {braidio-0.0.97 → braidio-0.0.98}/braidio/music.py +0 -0
  54. {braidio-0.0.97 → braidio-0.0.98}/braidio/pacing.py +0 -0
  55. {braidio-0.0.97 → braidio-0.0.98}/braidio/provenance.py +0 -0
  56. {braidio-0.0.97 → braidio-0.0.98}/braidio/relevance.py +0 -0
  57. {braidio-0.0.97 → braidio-0.0.98}/braidio/render.py +0 -0
  58. {braidio-0.0.97 → braidio-0.0.98}/braidio/rights.py +0 -0
  59. {braidio-0.0.97 → braidio-0.0.98}/braidio/script.py +0 -0
  60. {braidio-0.0.97 → braidio-0.0.98}/braidio/sources.py +0 -0
  61. {braidio-0.0.97 → braidio-0.0.98}/braidio/structure.py +0 -0
  62. {braidio-0.0.97 → braidio-0.0.98}/braidio/style.py +0 -0
  63. {braidio-0.0.97 → braidio-0.0.98}/braidio/textprep.py +0 -0
  64. {braidio-0.0.97 → braidio-0.0.98}/braidio/timeline.py +0 -0
  65. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_dialogue.py +0 -0
  66. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_episode.py +0 -0
  67. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_ingest.py +0 -0
  68. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_segment.py +0 -0
  69. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_video_cut.py +0 -0
  70. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_video_panels.py +0 -0
  71. {braidio-0.0.97 → braidio-0.0.98}/braidio/transforms/_voice.py +0 -0
  72. {braidio-0.0.97 → braidio-0.0.98}/braidio/tts.py +0 -0
  73. {braidio-0.0.97 → braidio-0.0.98}/braidio/video.py +0 -0
  74. {braidio-0.0.97 → braidio-0.0.98}/braidio/voice_library.py +0 -0
  75. {braidio-0.0.97 → braidio-0.0.98}/braidio/weave.py +0 -0
  76. {braidio-0.0.97 → braidio-0.0.98}/braidio/weave_config.py +0 -0
  77. {braidio-0.0.97 → braidio-0.0.98}/conftest.py +0 -0
  78. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/Extraction and nw-App Design.md +0 -0
  79. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/research/commentary-formats-and-styles.md +0 -0
  80. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
  81. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
  82. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/README.md +0 -0
  83. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/anti-platitude-checklist.md +0 -0
  84. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/commentary-voice-guide.md +0 -0
  85. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/_style-groups.md +0 -0
  86. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/amanda-dobbins.md +0 -0
  87. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/david-sims.md +0 -0
  88. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/griffin-newman.md +0 -0
  89. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/helen-molesworth.md +0 -0
  90. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
  91. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
  92. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/john-mcwhorter.md +0 -0
  93. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/jon-caramanica.md +0 -0
  94. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/june-diane-raphael.md +0 -0
  95. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/karina-longworth.md +0 -0
  96. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/katy-hessel.md +0 -0
  97. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/louis-theroux.md +0 -0
  98. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/mallory-rubin.md +0 -0
  99. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/melvyn-bragg.md +0 -0
  100. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/michael-barbaro.md +0 -0
  101. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
  102. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/paul-scheer.md +0 -0
  103. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/sean-fennessey.md +0 -0
  104. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/talk-art.md +0 -0
  105. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/style/voices/yasi-salek.md +0 -0
  106. {braidio-0.0.97 → braidio-0.0.98}/misc/docs/youtube_ingest_credentials.md +0 -0
  107. {braidio-0.0.97 → braidio-0.0.98}/tests/_audio.py +0 -0
  108. {braidio-0.0.97 → braidio-0.0.98}/tests/test_conversation.py +0 -0
  109. {braidio-0.0.97 → braidio-0.0.98}/tests/test_cost.py +0 -0
  110. {braidio-0.0.97 → braidio-0.0.98}/tests/test_credits_card.py +0 -0
  111. {braidio-0.0.97 → braidio-0.0.98}/tests/test_defaults.py +0 -0
  112. {braidio-0.0.97 → braidio-0.0.98}/tests/test_delivery.py +0 -0
  113. {braidio-0.0.97 → braidio-0.0.98}/tests/test_downloads.py +0 -0
  114. {braidio-0.0.97 → braidio-0.0.98}/tests/test_expressiveness.py +0 -0
  115. {braidio-0.0.97 → braidio-0.0.98}/tests/test_formats.py +0 -0
  116. {braidio-0.0.97 → braidio-0.0.98}/tests/test_genre_placement.py +0 -0
  117. {braidio-0.0.97 → braidio-0.0.98}/tests/test_graph_speak.py +0 -0
  118. {braidio-0.0.97 → braidio-0.0.98}/tests/test_importing.py +0 -0
  119. {braidio-0.0.97 → braidio-0.0.98}/tests/test_leveling.py +0 -0
  120. {braidio-0.0.97 → braidio-0.0.98}/tests/test_markdown_script.py +0 -0
  121. {braidio-0.0.97 → braidio-0.0.98}/tests/test_mcp.py +0 -0
  122. {braidio-0.0.97 → braidio-0.0.98}/tests/test_mcp_caller_key.py +0 -0
  123. {braidio-0.0.97 → braidio-0.0.98}/tests/test_media_auth.py +0 -0
  124. {braidio-0.0.97 → braidio-0.0.98}/tests/test_multivoice.py +0 -0
  125. {braidio-0.0.97 → braidio-0.0.98}/tests/test_music.py +0 -0
  126. {braidio-0.0.97 → braidio-0.0.98}/tests/test_namespaced_source.py +0 -0
  127. {braidio-0.0.97 → braidio-0.0.98}/tests/test_pacing.py +0 -0
  128. {braidio-0.0.97 → braidio-0.0.98}/tests/test_packaging.py +0 -0
  129. {braidio-0.0.97 → braidio-0.0.98}/tests/test_render_settings.py +0 -0
  130. {braidio-0.0.97 → braidio-0.0.98}/tests/test_script.py +0 -0
  131. {braidio-0.0.97 → braidio-0.0.98}/tests/test_sources.py +0 -0
  132. {braidio-0.0.97 → braidio-0.0.98}/tests/test_speak_seam.py +0 -0
  133. {braidio-0.0.97 → braidio-0.0.98}/tests/test_structure.py +0 -0
  134. {braidio-0.0.97 → braidio-0.0.98}/tests/test_textprep_style.py +0 -0
  135. {braidio-0.0.97 → braidio-0.0.98}/tests/test_timeline.py +0 -0
  136. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms_dialogue.py +0 -0
  137. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms_episode_members.py +0 -0
  138. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms_rights.py +0 -0
  139. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms_secrets.py +0 -0
  140. {braidio-0.0.97 → braidio-0.0.98}/tests/test_transforms_structure.py +0 -0
  141. {braidio-0.0.97 → braidio-0.0.98}/tests/test_tts_api_key.py +0 -0
  142. {braidio-0.0.97 → braidio-0.0.98}/tests/test_turn_overlap.py +0 -0
  143. {braidio-0.0.97 → braidio-0.0.98}/tests/test_video.py +0 -0
  144. {braidio-0.0.97 → braidio-0.0.98}/tests/test_video_bodies.py +0 -0
  145. {braidio-0.0.97 → braidio-0.0.98}/tests/test_video_footage.py +0 -0
  146. {braidio-0.0.97 → braidio-0.0.98}/tests/test_video_transforms.py +0 -0
  147. {braidio-0.0.97 → braidio-0.0.98}/tests/test_voice_library.py +0 -0
  148. {braidio-0.0.97 → braidio-0.0.98}/tests/test_weave.py +0 -0
  149. {braidio-0.0.97 → braidio-0.0.98}/tests/test_weave_config.py +0 -0
  150. {braidio-0.0.97 → braidio-0.0.98}/tests/test_weave_master.py +0 -0
  151. {braidio-0.0.97 → braidio-0.0.98}/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.97
3
+ Version: 0.0.98
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"}``. Indexed tier reads — plus one freshness
97
- walk, only once there is more than one episode to choose from — no file
98
- probe, and no per-item list, so it stays small however often the
99
- project is re-woven, and never names a path.
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
- if episodes:
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).
@@ -50,6 +52,7 @@ from braidio.transforms._common import (
50
52
  TIER_NARRATIVE_BEAT,
51
53
  TIER_DIALOGUE_BEAT,
52
54
  TIER_SCENE_BREAK,
55
+ TIER_TAKE_OVERRIDE,
53
56
  TIER_AUDIO_CLIP,
54
57
  TIER_VOICE_ASSIGNMENT,
55
58
  TIER_NARRATION_RENDER,
@@ -81,6 +84,15 @@ from braidio.transforms._episode import (
81
84
  episode_timeline,
82
85
  member_spans,
83
86
  )
87
+ from braidio.transforms._takes import (
88
+ UPLOAD_CACHE_KEY_PREFIX,
89
+ TakePreview,
90
+ pending_takes,
91
+ preview_take,
92
+ replace_take,
93
+ restore_take,
94
+ take_override_for,
95
+ )
84
96
  from braidio.transforms._video_panels import (
85
97
  Pick,
86
98
  as_pick,
@@ -129,6 +141,13 @@ __all__ = [
129
141
  "member_spans",
130
142
  "MemberSpan",
131
143
  "episode_script",
144
+ "TakePreview",
145
+ "pending_takes",
146
+ "preview_take",
147
+ "replace_take",
148
+ "restore_take",
149
+ "take_override_for",
150
+ "UPLOAD_CACHE_KEY_PREFIX",
132
151
  "mint_seed",
133
152
  "panels_for_episode",
134
153
  "picks_from_panels",
@@ -157,6 +176,7 @@ __all__ = [
157
176
  "TIER_NARRATIVE_BEAT",
158
177
  "TIER_DIALOGUE_BEAT",
159
178
  "TIER_SCENE_BREAK",
179
+ "TIER_TAKE_OVERRIDE",
160
180
  "TIER_AUDIO_CLIP",
161
181
  "TIER_VOICE_ASSIGNMENT",
162
182
  "TIER_NARRATION_RENDER",
@@ -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
 
@@ -32,6 +32,7 @@ TIER_SOURCE_MEDIA = "source-media"
32
32
  TIER_NARRATIVE_BEAT = "narrative-beats"
33
33
  TIER_DIALOGUE_BEAT = "dialogue-beats"
34
34
  TIER_SCENE_BREAK = "scene-breaks"
35
+ TIER_TAKE_OVERRIDE = "take-overrides"
35
36
  TIER_AUDIO_CLIP = "audio-clips"
36
37
  TIER_VOICE_ASSIGNMENT = "voice-assignments"
37
38
  TIER_NARRATION_RENDER = "narration-renders"
@@ -91,7 +92,10 @@ SINGLETON_TIERS = frozenset(
91
92
  #: The tiers an ingest owns, in the order it writes them. A re-ingest reconciles
92
93
  #: exactly these — a node here whose identity the new plan no longer names is
93
94
  #: removed (its dependents then read ``upstream-missing``); the render tiers
94
- #: are never touched by ingest.
95
+ #: are never touched by ingest. Nor is :data:`TIER_TAKE_OVERRIDE`: a person's
96
+ #: recording is authored by ``replace_take``, not by the script, so a script
97
+ #: re-ingest must leave it alone (braidio#86). Its identity is still its
98
+ #: ``beat_id`` (:func:`node_identity`), one override per beat.
95
99
  AUTHORING_TIERS = (
96
100
  TIER_WEAVE_CONFIG,
97
101
  TIER_PRODUCTION_STRUCTURE,
@@ -128,6 +132,10 @@ RENDER_OUTPUT_KEYS = frozenset(
128
132
  "height",
129
133
  "fps",
130
134
  "captions_artifact_id",
135
+ # NOT a narration take's ``source``: whether a beat is spoken by a
136
+ # person's recording is decided by the plan (a take-override node,
137
+ # braidio#86), so it is part of the planned value, and a TTS skeleton
138
+ # can never be matched to an uploaded render or vice versa.
131
139
  }
132
140
  )
133
141
 
@@ -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) → ``narration-render/v1``."""
243
+ """Narrative beat (+ voice-assignment + weave-config, or + its take-override)
244
+ → ``narration-render/v1``."""
231
245
 
232
246
  name = NAME
233
- input_kinds = (NARRATIVE_BEAT_V1, VOICE_ASSIGNMENT_V1, WEAVE_CONFIG_V1)
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
- cache_key = _render_inputs(beat, va, cfg).cache_key(self)
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=NarrationRenderBodyV1(cache_key=cache_key).model_dump(),
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
+ )