@serene-pub/contracts 0.6.0-pr-5 → 0.6.0-pr-7

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/dist/oracles.d.ts CHANGED
@@ -340,6 +340,21 @@ export declare const generateText: import("@serene-pub/sdk").Pinned<import("@ser
340
340
  readonly shape: string;
341
341
  readonly description: "The sampling settings — temperature and friends — used for this request.";
342
342
  };
343
+ /**
344
+ * 🚧 **Speech sampling** (O7, evolved in place 2026-10-21): the
345
+ * second sampling slot a call takes when its `outputs` ask for
346
+ * audio — the TTS vocabulary (voice, speed, …) beside the text one
347
+ * above, one sampling per kind written. Read only when audio is
348
+ * asked for; unset, it is the Narration loadout's (`text->audio`
349
+ * default) sampling. ⚠ Not `sampling`: that one says how the reply
350
+ * is WRITTEN, this one how it is SPOKEN.
351
+ * @ruling O7
352
+ */
353
+ readonly speechSampling: {
354
+ readonly kind: "sampling";
355
+ readonly shape: string;
356
+ readonly description: "How a spoken reply sounds — the voice and its speed. Read only when this step asks for audio.";
357
+ };
343
358
  /**
344
359
  * ⚠ No `prompts` slot, and there was one — `system` and
345
360
  * `postHistory`, "the written instructions sent with every request
@@ -371,6 +386,27 @@ export declare const generateText: import("@serene-pub/sdk").Pinned<import("@ser
371
386
  readonly description: "Sequences that end the reply the moment the model writes one. One per line.";
372
387
  };
373
388
  readonly streaming: FieldDecl<import("@serene-pub/sdk").FieldType, readonly string[]>;
389
+ /**
390
+ * 🚧 The **requested outputs** (O6, evolved in place
391
+ * 2026-10-20 — no @2 before 0.7): the kinds this call asks
392
+ * the model to write, in order. `['text']` — today's reply
393
+ * — unless stated. Asking for `audio` beside text makes the
394
+ * connection's requirement `text->text+audio`
395
+ * (`requirementForOutputs`): the bind check and fit derive
396
+ * it from here, and refuse in words where no reachable model
397
+ * writes audio. Open by kind (O1).
398
+ * @ruling O6
399
+ */
400
+ readonly outputs: {
401
+ readonly type: "string[]";
402
+ readonly label: {
403
+ readonly en: "Outputs";
404
+ };
405
+ readonly description: {
406
+ readonly en: "What the model is asked to write, in order — text, and audio for a spoken reply. Text unless set.";
407
+ };
408
+ readonly default: readonly ["text"];
409
+ };
374
410
  };
375
411
  };
376
412
  } | undefined;
@@ -593,15 +629,66 @@ export declare const generateJson: import("@serene-pub/sdk").Pinned<import("@ser
593
629
  readonly description: "Sequences that end the reply the moment the model writes one. One per line.";
594
630
  };
595
631
  readonly streaming: FieldDecl<import("@serene-pub/sdk").FieldType, readonly string[]>;
632
+ /**
633
+ * 🚧 An empty answer read as an unreadable one (the Dungeon
634
+ * Crawler 100-turn walk, B7): `json` null and `parseError`
635
+ * saying the model returned nothing, and the step goes on —
636
+ * so a check placed after it can ask once more and then go on
637
+ * without the answer. Off (the default), an empty answer halts
638
+ * the run, as it always has. `@1` evolves in place.
639
+ */
640
+ readonly emptyIsUnreadable: {
641
+ readonly type: "boolean";
642
+ readonly default: false;
643
+ readonly label: {
644
+ readonly en: "Go on after an empty answer";
645
+ };
646
+ readonly description: {
647
+ readonly en: "Read an empty answer as one that could not be read, and carry on, instead of stopping the run.";
648
+ };
649
+ };
596
650
  };
597
651
  };
598
652
  } | undefined;
599
653
  }>;
600
- /** @experimental */
654
+ /**
655
+ * 🚧 **Speak** — a line's script in, its audio out (PLAN-speech-connections-
656
+ * and-timbre §10–§11; seam S3, evolved in place and bound 2026-10-28).
657
+ *
658
+ * Reads `cues` (`core:task/cue-lines@1`'s script), groups consecutive cues
659
+ * that share a voice and an inflection, renders each group through the line
660
+ * `template`, and makes one call per group — `speaker` cues in the speaker's
661
+ * voice, `narrator` cues in the session's narrator voice, `silent` cues never
662
+ * sent — joining the audio with a fixed `gapMs` gap. Publishes the audio, the
663
+ * `cueMap` (where each cue sits in it), `spokenAs` (voice, model, applied,
664
+ * ignored) and `meta`, the three assembled as the `SpokenMeta` record
665
+ * `core:outlet/attach-audio@1` keeps on the line. Deterministic: the same line,
666
+ * label and templates make the same requests, byte for byte.
667
+ *
668
+ * Never picks a connection: unset, the `loadout` is the `text->audio`
669
+ * default — the **Narration** loadout, the one global speaking pair (ruled
670
+ * 2026-10-28). `skipCodeBlocks` left with the cue task, which drops code.
671
+ * @experimental
672
+ */
601
673
  export declare const speak: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
602
674
  main: string;
603
675
  audio: string;
676
+ cueMap: string;
677
+ spokenAs: string;
678
+ /** 🚧 `SpokenMeta` — the record attach-audio keeps on the line. */
679
+ meta: string;
604
680
  }, {
681
+ /** 🚧 The script — `Cue[]` from `core:task/cue-lines@1`. */
682
+ cues: string;
683
+ /** Whose line it is: `speaker` cues speak in this participant's voice. */
684
+ speaker: string;
685
+ /** ISO 639-1. Absent: the voice's timbre language, then the session's, then the pub's. */
686
+ language: string;
687
+ /**
688
+ * ⏳ The one-release alias: a bare text, read as one cue in the
689
+ * speaker's voice when `cues` is not wired. Expires the release
690
+ * after speech ships.
691
+ */
605
692
  text: string;
606
693
  }, "core:oracle/speak@1"> & {
607
694
  kind: 'oracle';
@@ -621,18 +708,244 @@ export declare const speak: import("@serene-pub/sdk").Pinned<import("@serene-pub
621
708
  readonly quick: true;
622
709
  readonly shape: string;
623
710
  };
711
+ /**
712
+ * 🚧 The written **direction** — the timbre description, the
713
+ * inflection sentence (`{{ inflectionSentence }}`), the genre's tone
714
+ * line. Rendered only for a model that takes a written direction
715
+ * (`controls.instruction`); any other reports `direction` ignored.
716
+ */
717
+ readonly prompts: {
718
+ readonly kind: "prompts";
719
+ readonly facet: "prompts";
720
+ readonly description: "How the voice is directed — sent only to a voice model that takes written direction.";
721
+ readonly fields: {
722
+ readonly direction: {
723
+ readonly type: "text";
724
+ };
725
+ };
726
+ };
727
+ /** 🚧 The **line template**: renders one group of cues into the text of one call. */
624
728
  readonly template: {
625
729
  readonly kind: "template";
626
730
  readonly engine: string;
627
731
  readonly facet: "templates";
732
+ readonly variables: {
733
+ readonly cues: {
734
+ readonly type: 'list';
735
+ readonly description: 'The cues of this group, in order — each { text, kind, voice, speaker?, inflection?, markers?, emphasis? }.';
736
+ readonly of: {
737
+ readonly type: 'object';
738
+ readonly fields: {
739
+ readonly text: {
740
+ readonly type: 'string';
741
+ };
742
+ readonly kind: {
743
+ readonly type: 'string';
744
+ readonly description: 'dialogue, narration, action or aside.';
745
+ };
746
+ readonly voice: {
747
+ readonly type: 'string';
748
+ readonly description: 'speaker, narrator or silent.';
749
+ };
750
+ readonly speaker: {
751
+ readonly type: 'string';
752
+ readonly optional: true;
753
+ };
754
+ readonly inflection: {
755
+ readonly type: 'string';
756
+ readonly optional: true;
757
+ };
758
+ readonly markers: {
759
+ readonly type: 'list';
760
+ readonly of: {
761
+ readonly type: 'string';
762
+ };
763
+ readonly optional: true;
764
+ };
765
+ readonly emphasis: {
766
+ readonly type: 'string';
767
+ readonly optional: true;
768
+ };
769
+ };
770
+ };
771
+ };
772
+ readonly speaker: {
773
+ readonly type: 'object';
774
+ readonly description: 'Who the line belongs to.';
775
+ readonly fields: {
776
+ readonly ref: {
777
+ readonly type: 'string';
778
+ readonly description: 'The participant ref — character:12, user:3, narrator.';
779
+ };
780
+ readonly name: {
781
+ readonly type: 'string';
782
+ readonly optional: true;
783
+ };
784
+ };
785
+ };
786
+ readonly voice: {
787
+ readonly type: 'string';
788
+ readonly description: "This group's voice — speaker or narrator. Never a service's voice id.";
789
+ };
790
+ readonly controls: {
791
+ readonly type: 'object';
792
+ readonly description: 'What the resolved model takes: prose instruction, inline tags, several speakers.';
793
+ readonly fields: {
794
+ readonly instruction: {
795
+ readonly type: 'string';
796
+ readonly optional: true;
797
+ readonly description: "'prose' when the model takes a written direction.";
798
+ };
799
+ readonly tags: {
800
+ readonly type: 'object';
801
+ readonly optional: true;
802
+ readonly description: 'Present when the model takes inline tags.';
803
+ readonly fields: {
804
+ readonly syntax: {
805
+ readonly type: 'string';
806
+ };
807
+ readonly vocabulary: {
808
+ readonly type: 'list';
809
+ readonly of: {
810
+ readonly type: 'string';
811
+ };
812
+ readonly optional: true;
813
+ readonly description: 'Absent when any tag is taken.';
814
+ };
815
+ };
816
+ };
817
+ readonly multiSpeaker: {
818
+ readonly type: 'boolean';
819
+ readonly optional: true;
820
+ };
821
+ readonly language: {
822
+ readonly type: 'list';
823
+ readonly of: {
824
+ readonly type: 'string';
825
+ };
826
+ readonly optional: true;
827
+ };
828
+ };
829
+ };
830
+ };
831
+ readonly description: "Which parts of a line are spoken, and how each one reads. Whole line, Dialogue only and Narration only ship.";
832
+ };
833
+ /** 🚧 How an inflection reads as a direction and as an inline tag (§11.3). */
834
+ readonly variables: {
835
+ readonly kind: "variables";
836
+ readonly facet: "variables";
837
+ readonly description: "How an inflection reads — as a sentence directing the voice, and as an inline tag.";
838
+ readonly renders: {
839
+ readonly inflectionSentence: "core:var/inflection-sentence@1";
840
+ readonly inflectionTag: "core:var/inflection-tag@1";
841
+ };
628
842
  };
843
+ /**
844
+ * No `facet`, like the image step's: both decide how the audio is
845
+ * made and joined, not what the voice is asked for.
846
+ */
629
847
  readonly params: {
630
848
  readonly kind: "parameters";
631
- readonly facet: "weights";
632
849
  readonly schema: {
633
- readonly skipCodeBlocks: {
850
+ readonly streaming: {
634
851
  readonly type: "boolean";
635
- readonly default: true;
852
+ readonly default: false;
853
+ readonly label: {
854
+ readonly en: "Stream speech";
855
+ };
856
+ readonly description: {
857
+ readonly en: "Hand each part of the line on as it is made, where the voice model can (audio_streaming). Off makes the whole line first.";
858
+ };
859
+ };
860
+ readonly gapMs: {
861
+ readonly type: "number";
862
+ readonly default: 200;
863
+ readonly min: 0;
864
+ readonly max: 2000;
865
+ readonly label: {
866
+ readonly en: "Pause between parts (ms)";
867
+ };
868
+ readonly description: {
869
+ readonly en: "The silence put between two parts of a line spoken in separate calls — a change of voice or of inflection.";
870
+ };
871
+ };
872
+ };
873
+ };
874
+ } | undefined;
875
+ }>;
876
+ /**
877
+ * 🚧 **Transcribe audio** (O9, 2026-10-21) — the explicit step that turns a
878
+ * sound the reply cannot hear into the words it says, BEFORE placement.
879
+ *
880
+ * Reads the transcript's files by message (`core:query/history-attachments@1`)
881
+ * and what the reply's call HEARS — `hears`, the `reads` the context budget
882
+ * publishes off the same pair (`ConnectionReadsV1`). Each audio file within
883
+ * `mediaLookback` messages of the end that the call cannot hear and that has
884
+ * no transcript yet is sent to this step's own model (`audio->text`, the
885
+ * Transcription loadout); the words are cached on the file, so a file is
886
+ * heard once, and handed on as `transcript` (and `text`, when the person gave
887
+ * no description). Placement then names the file with its words:
888
+ * `[audio: note.mp3 — "…"]`.
889
+ *
890
+ * Never silent, never a refusal of the reply: a call that hears audio itself,
891
+ * a transcript with no audio, and a cached transcript send nothing; with no
892
+ * model set up to transcribe, the files pass through untouched and `notes`
893
+ * says so on the receipt. `attachments` is the same record, transcripts
894
+ * filled in — wire it into `place-attachments@1` in place of the query's.
895
+ * ⚠ Not `speak@1` — that one SPEAKS; this one HEARS.
896
+ * @experimental
897
+ * @ruling O9
898
+ */
899
+ export declare const transcribeAudio: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
900
+ main: string;
901
+ /** The same files, transcripts filled in. */
902
+ attachments: string;
903
+ /** Sentences for the receipt: what was transcribed, and what was not and why. */
904
+ notes: string;
905
+ }, {
906
+ /** The processed lines, for which messages are within the lookback. */
907
+ messages: string;
908
+ /** The files by message, from `core:query/history-attachments@1`. */
909
+ attachments: string;
910
+ /** What the reply's call reads — `context-budget@1`'s `reads`. */
911
+ hears: string;
912
+ }, "core:oracle/transcribe-audio@1"> & {
913
+ kind: 'oracle';
914
+ slots?: {
915
+ readonly loadout: {
916
+ readonly kind: 'loadout';
917
+ readonly quick: true;
918
+ };
919
+ readonly connection: {
920
+ readonly kind: "connection";
921
+ readonly quick: true;
922
+ readonly shape: string;
923
+ readonly requires: readonly ["audio->text"];
924
+ readonly description: "Which model hears the audio the reply cannot.";
925
+ };
926
+ readonly params: {
927
+ readonly kind: "parameters";
928
+ readonly facet: "weights";
929
+ readonly schema: {
930
+ readonly mediaLookback: {
931
+ readonly type: "integer";
932
+ readonly min: 0;
933
+ readonly default: 10;
934
+ readonly label: {
935
+ readonly en: "Media lookback (messages)";
936
+ };
937
+ readonly description: {
938
+ readonly en: "Audio in the last this-many messages is transcribed when the reply cannot hear it; older audio is sent as its name. Match the placement step.";
939
+ };
940
+ };
941
+ readonly language: {
942
+ readonly type: "string";
943
+ readonly label: {
944
+ readonly en: "Language";
945
+ };
946
+ readonly description: {
947
+ readonly en: "The language spoken, as a code such as \"en\" or \"fr\". Empty lets the model detect it.";
948
+ };
636
949
  };
637
950
  };
638
951
  };
package/dist/oracles.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { S, tf, IoKinds } from '@serene-pub/sdk';
9
9
  import { jinja2 } from '@serene-pub/sdk';
10
+ import { SPOKEN_LINE_TEMPLATE_SCOPE } from '@serene-pub/sdk';
10
11
  import { describeOracleDefinition, pin } from '@serene-pub/sdk';
11
12
  /**
12
13
  * How a provider node wants its request sent.
@@ -449,6 +450,21 @@ export const generateText = pin(describeOracleDefinition({
449
450
  shape: S.textGen,
450
451
  description: 'The sampling settings — temperature and friends — used for this request.',
451
452
  },
453
+ /**
454
+ * 🚧 **Speech sampling** (O7, evolved in place 2026-10-21): the
455
+ * second sampling slot a call takes when its `outputs` ask for
456
+ * audio — the TTS vocabulary (voice, speed, …) beside the text one
457
+ * above, one sampling per kind written. Read only when audio is
458
+ * asked for; unset, it is the Narration loadout's (`text->audio`
459
+ * default) sampling. ⚠ Not `sampling`: that one says how the reply
460
+ * is WRITTEN, this one how it is SPOKEN.
461
+ * @ruling O7
462
+ */
463
+ speechSampling: {
464
+ kind: 'sampling',
465
+ shape: S.tts,
466
+ description: 'How a spoken reply sounds — the voice and its speed. Read only when this step asks for audio.',
467
+ },
452
468
  /**
453
469
  * ⚠ No `prompts` slot, and there was one — `system` and
454
470
  * `postHistory`, "the written instructions sent with every request
@@ -480,6 +496,25 @@ export const generateText = pin(describeOracleDefinition({
480
496
  description: 'Sequences that end the reply the moment the model writes one. One per line.',
481
497
  },
482
498
  streaming: streamingParam(),
499
+ /**
500
+ * 🚧 The **requested outputs** (O6, evolved in place
501
+ * 2026-10-20 — no @2 before 0.7): the kinds this call asks
502
+ * the model to write, in order. `['text']` — today's reply
503
+ * — unless stated. Asking for `audio` beside text makes the
504
+ * connection's requirement `text->text+audio`
505
+ * (`requirementForOutputs`): the bind check and fit derive
506
+ * it from here, and refuse in words where no reachable model
507
+ * writes audio. Open by kind (O1).
508
+ * @ruling O6
509
+ */
510
+ outputs: {
511
+ type: 'string[]',
512
+ label: { en: 'Outputs' },
513
+ description: {
514
+ en: 'What the model is asked to write, in order — text, and audio for a spoken reply. Text unless set.',
515
+ },
516
+ default: ['text'],
517
+ },
483
518
  },
484
519
  },
485
520
  },
@@ -498,8 +533,10 @@ export const generateText = pin(describeOracleDefinition({
498
533
  * resolved at bind time.
499
534
  */
500
535
  media: {
501
- accepts: ['image', 'document'],
502
- emits: ['image'],
536
+ // `audio` (O4, 2026-10-21): a voice note a pair that hears is sent.
537
+ accepts: ['image', 'document', 'audio'],
538
+ // `audio` (O6, 2026-10-20): a spoken reply's audio part.
539
+ emits: ['image', 'audio'],
503
540
  },
504
541
  ports: {
505
542
  in: {
@@ -764,6 +801,22 @@ export const generateJson = pin(describeOracleDefinition({
764
801
  description: 'Sequences that end the reply the moment the model writes one. One per line.',
765
802
  },
766
803
  streaming: streamingParam(),
804
+ /**
805
+ * 🚧 An empty answer read as an unreadable one (the Dungeon
806
+ * Crawler 100-turn walk, B7): `json` null and `parseError`
807
+ * saying the model returned nothing, and the step goes on —
808
+ * so a check placed after it can ask once more and then go on
809
+ * without the answer. Off (the default), an empty answer halts
810
+ * the run, as it always has. `@1` evolves in place.
811
+ */
812
+ emptyIsUnreadable: {
813
+ type: 'boolean',
814
+ default: false,
815
+ label: { en: 'Go on after an empty answer' },
816
+ description: {
817
+ en: 'Read an empty answer as one that could not be read, and carry on, instead of stopping the run.',
818
+ },
819
+ },
767
820
  },
768
821
  },
769
822
  },
@@ -796,17 +849,34 @@ export const generateJson = pin(describeOracleDefinition({
796
849
  },
797
850
  },
798
851
  }));
799
- /** @experimental */
852
+ /**
853
+ * 🚧 **Speak** — a line's script in, its audio out (PLAN-speech-connections-
854
+ * and-timbre §10–§11; seam S3, evolved in place and bound 2026-10-28).
855
+ *
856
+ * Reads `cues` (`core:task/cue-lines@1`'s script), groups consecutive cues
857
+ * that share a voice and an inflection, renders each group through the line
858
+ * `template`, and makes one call per group — `speaker` cues in the speaker's
859
+ * voice, `narrator` cues in the session's narrator voice, `silent` cues never
860
+ * sent — joining the audio with a fixed `gapMs` gap. Publishes the audio, the
861
+ * `cueMap` (where each cue sits in it), `spokenAs` (voice, model, applied,
862
+ * ignored) and `meta`, the three assembled as the `SpokenMeta` record
863
+ * `core:outlet/attach-audio@1` keeps on the line. Deterministic: the same line,
864
+ * label and templates make the same requests, byte for byte.
865
+ *
866
+ * Never picks a connection: unset, the `loadout` is the `text->audio`
867
+ * default — the **Narration** loadout, the one global speaking pair (ruled
868
+ * 2026-10-28). `skipCodeBlocks` left with the cue task, which drops code.
869
+ * @experimental
870
+ */
800
871
  export const speak = pin(describeOracleDefinition({
801
872
  id: 'core:oracle/speak@1',
802
873
  i18n: { name: { en: 'Speak' } },
803
874
  shape: S.tts,
804
875
  effects: 'external',
805
- /** Declared, not bound — no handler exists for it yet. */
806
- provisional: true,
807
- /** The words to be spoken may be corrected before the call. */
808
- review: { fields: ['text'] },
809
- timeoutMs: 60000,
876
+ /** The script may be corrected before the call; `text` is the one-release alias. */
877
+ review: { fields: ['cues', 'text'] },
878
+ /** Several group calls on a local TTS server; 60 s was the unbound default. */
879
+ timeoutMs: 180000,
810
880
  slots: {
811
881
  loadout: LOADOUT_SLOT,
812
882
  connection: {
@@ -816,18 +886,173 @@ export const speak = pin(describeOracleDefinition({
816
886
  requires: [tf({ in: [IoKinds.text], out: [IoKinds.audio] })],
817
887
  },
818
888
  sampling: { kind: 'sampling', quick: true, shape: S.tts },
889
+ /**
890
+ * 🚧 The written **direction** — the timbre description, the
891
+ * inflection sentence (`{{ inflectionSentence }}`), the genre's tone
892
+ * line. Rendered only for a model that takes a written direction
893
+ * (`controls.instruction`); any other reports `direction` ignored.
894
+ */
895
+ prompts: {
896
+ kind: 'prompts',
897
+ facet: 'prompts',
898
+ description: 'How the voice is directed — sent only to a voice model that takes written direction.',
899
+ fields: {
900
+ direction: { type: 'text' },
901
+ },
902
+ },
903
+ /** 🚧 The **line template**: renders one group of cues into the text of one call. */
819
904
  template: {
820
905
  kind: 'template',
821
906
  engine: jinja2.id,
822
907
  facet: 'templates',
908
+ variables: SPOKEN_LINE_TEMPLATE_SCOPE,
909
+ description: 'Which parts of a line are spoken, and how each one reads. Whole line, Dialogue only and Narration only ship.',
910
+ },
911
+ /** 🚧 How an inflection reads as a direction and as an inline tag (§11.3). */
912
+ variables: {
913
+ kind: 'variables',
914
+ facet: 'variables',
915
+ description: 'How an inflection reads — as a sentence directing the voice, and as an inline tag.',
916
+ renders: {
917
+ inflectionSentence: 'core:var/inflection-sentence@1',
918
+ inflectionTag: 'core:var/inflection-tag@1',
919
+ },
920
+ },
921
+ /**
922
+ * No `facet`, like the image step's: both decide how the audio is
923
+ * made and joined, not what the voice is asked for.
924
+ */
925
+ params: {
926
+ kind: 'parameters',
927
+ schema: {
928
+ streaming: {
929
+ type: 'boolean',
930
+ default: false,
931
+ label: { en: 'Stream speech' },
932
+ description: {
933
+ en: 'Hand each part of the line on as it is made, where the voice model can (audio_streaming). Off makes the whole line first.',
934
+ },
935
+ },
936
+ gapMs: {
937
+ type: 'number',
938
+ default: 200,
939
+ min: 0,
940
+ max: 2000,
941
+ label: { en: 'Pause between parts (ms)' },
942
+ description: {
943
+ en: 'The silence put between two parts of a line spoken in separate calls — a change of voice or of inflection.',
944
+ },
945
+ },
946
+ },
947
+ },
948
+ },
949
+ ports: {
950
+ in: {
951
+ /** 🚧 The script — `Cue[]` from `core:task/cue-lines@1`. */
952
+ cues: S.cues,
953
+ /** Whose line it is: `speaker` cues speak in this participant's voice. */
954
+ speaker: S.participantRef,
955
+ /** ISO 639-1. Absent: the voice's timbre language, then the session's, then the pub's. */
956
+ language: S.text,
957
+ /**
958
+ * ⏳ The one-release alias: a bare text, read as one cue in the
959
+ * speaker's voice when `cues` is not wired. Expires the release
960
+ * after speech ships.
961
+ */
962
+ text: S.text,
963
+ },
964
+ out: {
965
+ main: S.audio,
966
+ audio: S.audio,
967
+ cueMap: S.cueMap,
968
+ spokenAs: S.spokenAs,
969
+ /** 🚧 `SpokenMeta` — the record attach-audio keeps on the line. */
970
+ meta: S.spokenMeta,
971
+ },
972
+ },
973
+ }));
974
+ /**
975
+ * 🚧 **Transcribe audio** (O9, 2026-10-21) — the explicit step that turns a
976
+ * sound the reply cannot hear into the words it says, BEFORE placement.
977
+ *
978
+ * Reads the transcript's files by message (`core:query/history-attachments@1`)
979
+ * and what the reply's call HEARS — `hears`, the `reads` the context budget
980
+ * publishes off the same pair (`ConnectionReadsV1`). Each audio file within
981
+ * `mediaLookback` messages of the end that the call cannot hear and that has
982
+ * no transcript yet is sent to this step's own model (`audio->text`, the
983
+ * Transcription loadout); the words are cached on the file, so a file is
984
+ * heard once, and handed on as `transcript` (and `text`, when the person gave
985
+ * no description). Placement then names the file with its words:
986
+ * `[audio: note.mp3 — "…"]`.
987
+ *
988
+ * Never silent, never a refusal of the reply: a call that hears audio itself,
989
+ * a transcript with no audio, and a cached transcript send nothing; with no
990
+ * model set up to transcribe, the files pass through untouched and `notes`
991
+ * says so on the receipt. `attachments` is the same record, transcripts
992
+ * filled in — wire it into `place-attachments@1` in place of the query's.
993
+ * ⚠ Not `speak@1` — that one SPEAKS; this one HEARS.
994
+ * @experimental
995
+ * @ruling O9
996
+ */
997
+ export const transcribeAudio = pin(describeOracleDefinition({
998
+ id: 'core:oracle/transcribe-audio@1',
999
+ i18n: { name: { en: 'Transcribe audio' } },
1000
+ shape: S.transcription,
1001
+ effects: 'external',
1002
+ /** It prepares the prompt; a preview stops at the call that sends it. */
1003
+ previewRunsThrough: true,
1004
+ /** The request is the file itself; there is nothing to correct before it is heard. */
1005
+ review: { fields: [] },
1006
+ timeoutMs: 120000,
1007
+ slots: {
1008
+ loadout: LOADOUT_SLOT,
1009
+ connection: {
1010
+ kind: 'connection',
1011
+ quick: true,
1012
+ shape: S.transcription,
1013
+ requires: [tf({ in: [IoKinds.audio], out: [IoKinds.text] })],
1014
+ description: 'Which model hears the audio the reply cannot.',
823
1015
  },
824
1016
  params: {
825
1017
  kind: 'parameters',
826
1018
  facet: 'weights',
827
- schema: { skipCodeBlocks: { type: 'boolean', default: true } },
1019
+ schema: {
1020
+ mediaLookback: {
1021
+ type: 'integer',
1022
+ min: 0,
1023
+ default: 10,
1024
+ label: { en: 'Media lookback (messages)' },
1025
+ description: {
1026
+ en: 'Audio in the last this-many messages is transcribed when the reply cannot hear it; older audio is sent as its name. Match the placement step.',
1027
+ },
1028
+ },
1029
+ language: {
1030
+ type: 'string',
1031
+ label: { en: 'Language' },
1032
+ description: {
1033
+ en: 'The language spoken, as a code such as "en" or "fr". Empty lets the model detect it.',
1034
+ },
1035
+ },
1036
+ },
1037
+ },
1038
+ },
1039
+ ports: {
1040
+ in: {
1041
+ /** The processed lines, for which messages are within the lookback. */
1042
+ messages: S.messages,
1043
+ /** The files by message, from `core:query/history-attachments@1`. */
1044
+ attachments: S.mediaByMessage,
1045
+ /** What the reply's call reads — `context-budget@1`'s `reads`. */
1046
+ hears: S.json,
1047
+ },
1048
+ out: {
1049
+ main: S.mediaByMessage,
1050
+ /** The same files, transcripts filled in. */
1051
+ attachments: S.mediaByMessage,
1052
+ /** Sentences for the receipt: what was transcribed, and what was not and why. */
1053
+ notes: S.json,
828
1054
  },
829
1055
  },
830
- ports: { in: { text: S.text }, out: { main: S.audio, audio: S.audio } },
831
1056
  }));
832
1057
  /**
833
1058
  * Render an image.