@dxos/plugin-transcription 0.8.4-main.422d1c7879 → 0.8.4-main.51f1e5ca51

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 (134) hide show
  1. package/dist/lib/browser/blueprints/index.mjs +1 -1
  2. package/dist/lib/browser/blueprints/index.mjs.map +3 -3
  3. package/dist/lib/browser/{chunk-NKIDHR3V.mjs → chunk-3L623EVL.mjs} +1 -1
  4. package/dist/lib/browser/chunk-3L623EVL.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-HOOPZ7EM.mjs → chunk-KAEXRX3Y.mjs} +1 -1
  6. package/dist/lib/browser/{chunk-KOX4WNAR.mjs → chunk-L4HW35L6.mjs} +2 -2
  7. package/dist/lib/browser/chunk-L4HW35L6.mjs.map +7 -0
  8. package/dist/lib/browser/{create-BTWYQ6IM.mjs → create-ULR5DPJZ.mjs} +3 -3
  9. package/dist/lib/browser/create-ULR5DPJZ.mjs.map +7 -0
  10. package/dist/lib/browser/index.mjs +91 -192
  11. package/dist/lib/browser/index.mjs.map +4 -4
  12. package/dist/lib/browser/meta.json +1 -1
  13. package/dist/lib/browser/{open-CYRYIEZI.mjs → open-SFMPLZVW.mjs} +4 -4
  14. package/dist/lib/browser/open-SFMPLZVW.mjs.map +7 -0
  15. package/dist/lib/browser/operations/index.mjs +3 -3
  16. package/dist/lib/browser/operations/index.mjs.map +3 -3
  17. package/dist/lib/browser/{summarize-X2ZYTN7S.mjs → summarize-I3POXUK3.mjs} +4 -4
  18. package/dist/lib/browser/summarize-I3POXUK3.mjs.map +7 -0
  19. package/dist/lib/browser/translations.mjs +22 -0
  20. package/dist/lib/browser/translations.mjs.map +7 -0
  21. package/dist/lib/browser/types/index.mjs +1 -1
  22. package/dist/lib/node-esm/blueprints/index.mjs +1 -1
  23. package/dist/lib/node-esm/blueprints/index.mjs.map +3 -3
  24. package/dist/lib/node-esm/{chunk-MT5I4NH5.mjs → chunk-7UIZWCD4.mjs} +2 -2
  25. package/dist/lib/node-esm/chunk-7UIZWCD4.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-EGFTET5N.mjs → chunk-KO3IOD2O.mjs} +1 -1
  27. package/dist/lib/node-esm/chunk-KO3IOD2O.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-NVM2QUMX.mjs → chunk-O533NBMK.mjs} +1 -1
  29. package/dist/lib/node-esm/{create-MLUFPST2.mjs → create-A5QHNWRF.mjs} +3 -3
  30. package/dist/lib/node-esm/create-A5QHNWRF.mjs.map +7 -0
  31. package/dist/lib/node-esm/index.mjs +91 -192
  32. package/dist/lib/node-esm/index.mjs.map +4 -4
  33. package/dist/lib/node-esm/meta.json +1 -1
  34. package/dist/lib/node-esm/{open-5IOC2U4Z.mjs → open-OI24QNTO.mjs} +4 -4
  35. package/dist/lib/node-esm/open-OI24QNTO.mjs.map +7 -0
  36. package/dist/lib/node-esm/operations/index.mjs +3 -3
  37. package/dist/lib/node-esm/operations/index.mjs.map +3 -3
  38. package/dist/lib/node-esm/{summarize-IORITU7T.mjs → summarize-F3LLJ45P.mjs} +4 -4
  39. package/dist/lib/node-esm/summarize-F3LLJ45P.mjs.map +7 -0
  40. package/dist/lib/node-esm/translations.mjs +23 -0
  41. package/dist/lib/node-esm/translations.mjs.map +7 -0
  42. package/dist/lib/node-esm/types/index.mjs +1 -1
  43. package/dist/types/src/blueprints/transcription-blueprint.d.ts +2 -2
  44. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -1
  45. package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -2
  46. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/index.d.ts +2 -2
  48. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  49. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  50. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  51. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  52. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
  53. package/dist/types/src/components/Transcription/Transcription.d.ts +1 -1
  54. package/dist/types/src/components/Transcription/Transcription.stories.d.ts +7 -7
  55. package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -1
  57. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -1
  58. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  59. package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
  60. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  61. package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
  62. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  63. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  64. package/dist/types/src/model/model.d.ts.map +1 -1
  65. package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -1
  66. package/dist/types/src/normalization/normalization.d.ts +153 -153
  67. package/dist/types/src/normalization/normalization.d.ts.map +1 -1
  68. package/dist/types/src/normalization/utils.d.ts.map +1 -1
  69. package/dist/types/src/operations/create.d.ts +1 -1
  70. package/dist/types/src/operations/create.d.ts.map +1 -1
  71. package/dist/types/src/operations/definitions.d.ts +381 -381
  72. package/dist/types/src/operations/definitions.d.ts.map +1 -1
  73. package/dist/types/src/operations/index.d.ts +1 -1
  74. package/dist/types/src/operations/index.d.ts.map +1 -1
  75. package/dist/types/src/operations/open.d.ts +1 -1
  76. package/dist/types/src/operations/open.d.ts.map +1 -1
  77. package/dist/types/src/operations/summarize.d.ts +1 -1
  78. package/dist/types/src/operations/summarize.d.ts.map +1 -1
  79. package/dist/types/src/stories/FileTranscription.stories.d.ts +2 -2
  80. package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -1
  81. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -1
  82. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
  83. package/dist/types/src/stories/TranscriptionStory.d.ts +12 -1
  84. package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -1
  85. package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -1
  86. package/dist/types/src/testing/testing.d.ts.map +1 -1
  87. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  88. package/dist/types/src/transcriber/transcriber.d.ts +57 -2
  89. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  90. package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
  91. package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
  92. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  93. package/dist/types/src/translations.d.ts +7 -8
  94. package/dist/types/src/translations.d.ts.map +1 -1
  95. package/dist/types/src/types/capabilities.d.ts +1 -0
  96. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  97. package/dist/types/src/util/array.d.ts.map +1 -1
  98. package/dist/types/src/util/get-time-str.d.ts.map +1 -1
  99. package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
  100. package/dist/types/src/util/render-byline.d.ts.map +1 -1
  101. package/dist/types/tsconfig.tsbuildinfo +1 -1
  102. package/package.json +59 -54
  103. package/src/TranscriptionPlugin.tsx +1 -1
  104. package/src/blueprints/transcription-blueprint.ts +2 -3
  105. package/src/capabilities/index.ts +1 -1
  106. package/src/capabilities/operation-handler.ts +1 -1
  107. package/src/capabilities/transcriber.ts +2 -0
  108. package/src/components/Transcription/Transcription.stories.tsx +1 -1
  109. package/src/hooks/useTranscriber.ts +3 -1
  110. package/src/model/model.test.ts +3 -3
  111. package/src/normalization/normalization.ts +1 -1
  112. package/src/operations/create.ts +1 -1
  113. package/src/operations/definitions.ts +1 -1
  114. package/src/operations/index.ts +1 -1
  115. package/src/operations/open.ts +1 -1
  116. package/src/operations/summarize.ts +2 -2
  117. package/src/stories/FileTranscription.stories.tsx +20 -1
  118. package/src/stories/KeyWordRecognition.stories.tsx +30 -28
  119. package/src/stories/TranscriptionStory.tsx +54 -4
  120. package/src/transcriber/transcriber.test.ts +104 -0
  121. package/src/transcriber/transcriber.ts +92 -51
  122. package/src/types/capabilities.ts +1 -0
  123. package/dist/lib/browser/chunk-KOX4WNAR.mjs.map +0 -7
  124. package/dist/lib/browser/chunk-NKIDHR3V.mjs.map +0 -7
  125. package/dist/lib/browser/create-BTWYQ6IM.mjs.map +0 -7
  126. package/dist/lib/browser/open-CYRYIEZI.mjs.map +0 -7
  127. package/dist/lib/browser/summarize-X2ZYTN7S.mjs.map +0 -7
  128. package/dist/lib/node-esm/chunk-EGFTET5N.mjs.map +0 -7
  129. package/dist/lib/node-esm/chunk-MT5I4NH5.mjs.map +0 -7
  130. package/dist/lib/node-esm/create-MLUFPST2.mjs.map +0 -7
  131. package/dist/lib/node-esm/open-5IOC2U4Z.mjs.map +0 -7
  132. package/dist/lib/node-esm/summarize-IORITU7T.mjs.map +0 -7
  133. /package/dist/lib/browser/{chunk-HOOPZ7EM.mjs.map → chunk-KAEXRX3Y.mjs.map} +0 -0
  134. /package/dist/lib/node-esm/{chunk-NVM2QUMX.mjs.map → chunk-O533NBMK.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import "../chunk-J5LGTIGS.mjs";
2
2
 
3
3
  // src/blueprints/transcription-blueprint.ts
4
- import { Blueprint, Template } from "@dxos/blueprints";
4
+ import { Blueprint, Template } from "@dxos/compute";
5
5
  import { trim } from "@dxos/util";
6
6
  import { TranscriptOperation } from "#operations";
7
7
  var BLUEPRINT_KEY = "org.dxos.blueprint.transcription";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/blueprints/transcription-blueprint.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { trim } from '@dxos/util';\n\nimport { TranscriptOperation } from '#operations';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.transcription';\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Transcription',\n tools: Blueprint.toolDefinitions({ operations: [TranscriptOperation.Open, TranscriptOperation.Summarize] }),\n instructions: Template.make({\n source: trim`\n You can open and summarize a meeting transcript.\n `,\n }),\n });\n\nconst blueprint: AppCapabilities.BlueprintDefinition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
5
- "mappings": ";;;AAKA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,SAASC,2BAA2B;AAEpC,IAAMC,gBAAgB;AAEtB,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKH;EACLI,MAAM;EACNC,OAAOH,UAAUI,gBAAgB;IAAEC,YAAY;MAACC,oBAAoBC;MAAMD,oBAAoBE;;EAAW,CAAA;EACzGC,cAAcC,SAASX,KAAK;IAC1BY,QAAQC;;;EAGV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAiD;EACrDZ,KAAKH;EACLC;AACF;AAEA,IAAA,kCAAec;",
6
- "names": ["Blueprint", "Template", "trim", "TranscriptOperation", "BLUEPRINT_KEY", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "operations", "TranscriptOperation", "Open", "Summarize", "instructions", "Template", "source", "trim", "blueprint"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Blueprint, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport { TranscriptOperation } from '#operations';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.transcription';\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Transcription',\n tools: Blueprint.toolDefinitions({ operations: [TranscriptOperation.Open, TranscriptOperation.Summarize] }),\n instructions: Template.make({\n source: trim`\n You can open and summarize a meeting transcript.\n `,\n }),\n });\n\nconst blueprint: Blueprint.Definition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
5
+ "mappings": ";;;AAIA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,SAASC,2BAA2B;AAEpC,IAAMC,gBAAgB;AAEtB,IAAMC,OAAO,MACXL,UAAUK,KAAK;EACbC,KAAKF;EACLG,MAAM;EACNC,OAAOR,UAAUS,gBAAgB;IAAEC,YAAY;MAACP,oBAAoBQ;MAAMR,oBAAoBS;;EAAW,CAAA;EACzGC,cAAcZ,SAASI,KAAK;IAC1BS,QAAQZ;;;EAGV,CAAA;AACF,CAAA;AAEF,IAAMa,YAAkC;EACtCT,KAAKF;EACLC;AACF;AAEA,IAAA,kCAAeU;",
6
+ "names": ["Blueprint", "Template", "trim", "TranscriptOperation", "BLUEPRINT_KEY", "make", "key", "name", "tools", "toolDefinitions", "operations", "Open", "Summarize", "instructions", "source", "blueprint"]
7
7
  }
@@ -14,4 +14,4 @@ export {
14
14
  TranscriptionCapabilities,
15
15
  TRANSCRIPTION_URL
16
16
  };
17
- //# sourceMappingURL=chunk-NKIDHR3V.mjs.map
17
+ //# sourceMappingURL=chunk-3L623EVL.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/capabilities.ts", "../../../src/types/defs.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\nimport {\n type MediaStreamRecorderProps,\n type Transcriber,\n type TranscriberProps,\n type TranscriptMessageEnricher,\n type TranscriptionManager,\n} from '../transcriber';\n\nexport namespace TranscriptionCapabilities {\n export type GetTranscriberProps = {\n audioStreamTrack: MediaStreamTrack;\n recorderConfig?: Partial<MediaStreamRecorderProps['config']>;\n transcriberConfig?: Partial<TranscriberProps['config']>;\n onSegments: TranscriberProps['onSegments'];\n transcribe?: TranscriberProps['transcribe'];\n };\n\n export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;\n\n export type GetTranscriptionManagerProps = {\n messageEnricher?: TranscriptMessageEnricher;\n };\n\n export type GetTranscriptionManager = (props: GetTranscriptionManagerProps) => TranscriptionManager;\n\n export const Transcriber = Capability.make<GetTranscriber>(`${meta.id}.capability.transcriber`);\n\n export const TranscriptionManager = Capability.make<GetTranscriptionManager>(\n `${meta.id}.capability.transcription-manager`,\n );\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Endpoint to the calls service.\n */\n// TODO(burdon): Reconfigure/move.\nexport const TRANSCRIPTION_URL = 'https://calls-service.dxos.workers.dev';\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAkB;AAE3B,SAASC,YAAY;UAUJC,4BAAAA;6BAiBFC,cAAcH,WAAWI,KAAqB,GAAGH,KAAKI,EAAE,yBAAyB;6BAEjFC,uBAAuBN,WAAWI,KAC7C,GAAGH,KAAKI,EAAE,mCAAmC;AAEjD,GAtBiBH,8BAAAA,4BAAAA,CAAAA,EAAAA;;;;ACRV,IAAMK,oBAAoB;",
6
+ "names": ["Capability", "meta", "TranscriptionCapabilities", "Transcriber", "make", "id", "TranscriptionManager", "TRANSCRIPTION_URL"]
7
+ }
@@ -32,4 +32,4 @@ export {
32
32
  mergeFloat64Arrays,
33
33
  renderByline
34
34
  };
35
- //# sourceMappingURL=chunk-HOOPZ7EM.mjs.map
35
+ //# sourceMappingURL=chunk-KAEXRX3Y.mjs.map
@@ -16,8 +16,8 @@ __export(definitions_exports, {
16
16
  import * as Schema from "effect/Schema";
17
17
  import { AiService } from "@dxos/ai";
18
18
  import { SpaceSchema } from "@dxos/client/echo";
19
+ import { Operation } from "@dxos/compute";
19
20
  import { Database, Feed, Ref } from "@dxos/echo";
20
- import { Operation } from "@dxos/operation";
21
21
  import { Message, Transcript } from "@dxos/types";
22
22
  import { meta } from "#meta";
23
23
  var TRANSCRIPT_OPERATION = `${meta.id}.operation`;
@@ -108,4 +108,4 @@ export {
108
108
  Summarize,
109
109
  definitions_exports
110
110
  };
111
- //# sourceMappingURL=chunk-KOX4WNAR.mjs.map
111
+ //# sourceMappingURL=chunk-L4HW35L6.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/operations/definitions.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiService } from '@dxos/ai';\nimport { SpaceSchema } from '@dxos/client/echo';\nimport { Operation } from '@dxos/compute';\nimport { Database, Feed, Ref } from '@dxos/echo';\nimport { Message, Transcript } from '@dxos/types';\n\nimport { meta } from '#meta';\n\nconst TRANSCRIPT_OPERATION = `${meta.id}.operation`;\n\nexport const Create = Operation.make({\n meta: { key: `${TRANSCRIPT_OPERATION}.create`, name: 'Create Transcript' },\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n space: SpaceSchema,\n }),\n output: Schema.Struct({\n object: Transcript.Transcript,\n }),\n});\n\nexport const MessageWithRangeId = Schema.extend(\n Message.Message,\n Schema.Struct({\n rangeId: Schema.optional(Schema.Array(Schema.String)).annotations({\n description: 'The IDs of the messages that contain the sentences.',\n }),\n }),\n);\n\nexport type MessageWithRangeIdType = Schema.Schema.Type<typeof MessageWithRangeId>;\n\nexport const Open = Operation.make({\n meta: {\n key: 'org.dxos.function.transcription.open',\n name: 'Open',\n description: 'Opens and reads the contents of a transcription object.',\n },\n input: Schema.Struct({\n transcript: Ref.Ref(Transcript.Transcript).annotations({\n description: 'The ID of the transcription object.',\n }),\n }),\n output: Schema.Struct({\n content: Schema.String,\n }),\n services: [Database.Service, Feed.FeedService],\n});\n\nexport const Summarize = Operation.make({\n meta: {\n key: 'org.dxos.function.transcription.summarize',\n name: 'Summarize',\n description: 'Summarize a transcript of a meeting.',\n },\n input: Schema.Struct({\n transcript: Schema.String.annotations({\n description: 'The transcript of the meeting.',\n }),\n notes: Schema.optional(Schema.String).annotations({\n description: 'Additional notes from the participants.',\n }),\n }),\n output: Schema.Struct({\n summary: Schema.String.annotations({\n description: 'The summary of the transcript.',\n }),\n }),\n services: [AiService.AiService],\n});\n\nexport const SentenceNormalizationInput = Schema.Struct({\n messages: Schema.Array(MessageWithRangeId).annotations({\n description: 'Messages to normalize into sentences.',\n }),\n});\n\nexport type SentenceNormalizationInputType = Schema.Schema.Type<typeof SentenceNormalizationInput>;\n\nexport const SentenceNormalizationOutput = Schema.Struct({\n sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({\n description: 'The sentences of the transcript.',\n }),\n});\n\nexport const SentenceNormalization = Operation.make({\n meta: {\n key: 'org.dxos.function.transcription.sentence-normalization',\n name: 'Sentence Normalization',\n description: 'Post process of transcription for sentence normalization',\n },\n input: SentenceNormalizationInput,\n output: SentenceNormalizationOutput,\n services: [],\n});\n"],
5
+ "mappings": ";;;;;AAAA;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,MAAMC,WAAW;AACpC,SAASC,SAASC,kBAAkB;AAEpC,SAASC,YAAY;AAErB,IAAMC,uBAAuB,GAAGD,KAAKE,EAAE;AAEhC,IAAMC,SAAST,UAAUU,KAAK;EACnCJ,MAAM;IAAEK,KAAK,GAAGJ,oBAAAA;IAA+BK,MAAM;EAAoB;EACzEC,OAAcC,cAAO;IACnBF,MAAaG,gBAAgBC,aAAM;IACnCC,OAAOlB;EACT,CAAA;EACAmB,QAAeJ,cAAO;IACpBK,QAAQd,WAAWA;EACrB,CAAA;AACF,CAAA;AAEO,IAAMe,qBAA4BC,cACvCjB,QAAQA,SACDU,cAAO;EACZQ,SAAgBP,gBAAgBQ,aAAaP,aAAM,CAAA,EAAGQ,YAAY;IAChEC,aAAa;EACf,CAAA;AACF,CAAA,CAAA;AAKK,IAAMC,OAAO1B,UAAUU,KAAK;EACjCJ,MAAM;IACJK,KAAK;IACLC,MAAM;IACNa,aAAa;EACf;EACAZ,OAAcC,cAAO;IACnBa,YAAYxB,IAAIA,IAAIE,WAAWA,UAAU,EAAEmB,YAAY;MACrDC,aAAa;IACf,CAAA;EACF,CAAA;EACAP,QAAeJ,cAAO;IACpBc,SAAgBZ;EAClB,CAAA;EACAa,UAAU;IAAC5B,SAAS6B;IAAS5B,KAAK6B;;AACpC,CAAA;AAEO,IAAMC,YAAYhC,UAAUU,KAAK;EACtCJ,MAAM;IACJK,KAAK;IACLC,MAAM;IACNa,aAAa;EACf;EACAZ,OAAcC,cAAO;IACnBa,YAAmBX,cAAOQ,YAAY;MACpCC,aAAa;IACf,CAAA;IACAQ,OAAclB,gBAAgBC,aAAM,EAAEQ,YAAY;MAChDC,aAAa;IACf,CAAA;EACF,CAAA;EACAP,QAAeJ,cAAO;IACpBoB,SAAgBlB,cAAOQ,YAAY;MACjCC,aAAa;IACf,CAAA;EACF,CAAA;EACAI,UAAU;IAAC/B,UAAUA;;AACvB,CAAA;AAEO,IAAMqC,6BAAoCrB,cAAO;EACtDsB,UAAiBb,aAAMH,kBAAAA,EAAoBI,YAAY;IACrDC,aAAa;EACf,CAAA;AACF,CAAA;AAIO,IAAMY,8BAAqCvB,cAAO;EACvDwB,WAAkBf,aAAMH,mBAAmBmB,KAAYC,cAAO,CAAA,EAAGD,KAAYC,cAAO,EAAEhB,YAAY;IAChGC,aAAa;EACf,CAAA;AACF,CAAA;AAEO,IAAMgB,wBAAwBzC,UAAUU,KAAK;EAClDJ,MAAM;IACJK,KAAK;IACLC,MAAM;IACNa,aAAa;EACf;EACAZ,OAAOsB;EACPjB,QAAQmB;EACRR,UAAU,CAAA;AACZ,CAAA;",
6
+ "names": ["Schema", "AiService", "SpaceSchema", "Operation", "Database", "Feed", "Ref", "Message", "Transcript", "meta", "TRANSCRIPT_OPERATION", "id", "Create", "make", "key", "name", "input", "Struct", "optional", "String", "space", "output", "object", "MessageWithRangeId", "extend", "rangeId", "Array", "annotations", "description", "Open", "transcript", "content", "services", "Service", "FeedService", "Summarize", "notes", "summary", "SentenceNormalizationInput", "messages", "SentenceNormalizationOutput", "sentences", "pipe", "mutable", "SentenceNormalization"]
7
+ }
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Create
3
- } from "./chunk-KOX4WNAR.mjs";
3
+ } from "./chunk-L4HW35L6.mjs";
4
4
  import "./chunk-J5LGTIGS.mjs";
5
5
 
6
6
  // src/operations/create.ts
7
7
  import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/compute";
8
9
  import { Feed, Ref } from "@dxos/echo";
9
- import { Operation } from "@dxos/operation";
10
10
  import { Transcript } from "@dxos/types";
11
11
  var handler = Create.pipe(Operation.withHandler(Effect.fn(function* ({ space }) {
12
12
  const feed = space.db.add(Feed.make());
@@ -18,4 +18,4 @@ var create_default = handler;
18
18
  export {
19
19
  create_default as default
20
20
  };
21
- //# sourceMappingURL=create-BTWYQ6IM.mjs.map
21
+ //# sourceMappingURL=create-ULR5DPJZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/operations/create.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\nimport { Feed, Ref } from '@dxos/echo';\nimport { Transcript } from '@dxos/types';\n\nimport { Create } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Create> = Create.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ space }) {\n const feed = space.db.add(Feed.make());\n return {\n object: Transcript.make(Ref.make(feed)),\n };\n }),\n ),\n);\n\nexport default handler;\n"],
5
+ "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,MAAMC,WAAW;AAC1B,SAASC,kBAAkB;AAI3B,IAAMC,UAAgDC,OAAOC,KAC3DC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAK,GAAE;AAC5B,QAAMC,OAAOD,MAAME,GAAGC,IAAIC,KAAKC,KAAI,CAAA;AACnC,SAAO;IACLC,QAAQC,WAAWF,KAAKG,IAAIH,KAAKJ,IAAAA,CAAAA;EACnC;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,iBAAeP;",
6
+ "names": ["Effect", "Operation", "Feed", "Ref", "Transcript", "handler", "Create", "pipe", "Operation", "withHandler", "fn", "space", "feed", "db", "add", "Feed", "make", "object", "Transcript", "Ref"]
7
+ }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  TranscriptionCapabilities
3
- } from "./chunk-NKIDHR3V.mjs";
3
+ } from "./chunk-3L623EVL.mjs";
4
4
  import {
5
5
  mergeFloat64Arrays,
6
6
  renderByline
7
- } from "./chunk-HOOPZ7EM.mjs";
7
+ } from "./chunk-KAEXRX3Y.mjs";
8
8
  import "./chunk-J5LGTIGS.mjs";
9
9
 
10
10
  // src/components/Transcription/Transcription.tsx
@@ -43,12 +43,7 @@ var DocumentAdapter = class {
43
43
  from,
44
44
  remove,
45
45
  insert
46
- }, {
47
- F: __dxlog_file,
48
- L: 39,
49
- S: this,
50
- C: (f, a) => f(...a)
51
- });
46
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 19, S: this });
52
47
  const numLines = this._view.state.doc.lines;
53
48
  const posFrom = this._view.state.doc.line(from).from;
54
49
  const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;
@@ -124,15 +119,7 @@ var SerializationModel = class {
124
119
  }
125
120
  updateChunk(chunk) {
126
121
  const index = this._chunks.findIndex((c) => c.id === chunk.id);
127
- invariant(index !== -1, void 0, {
128
- F: __dxlog_file,
129
- L: 147,
130
- S: this,
131
- A: [
132
- "index !== -1",
133
- ""
134
- ]
135
- });
122
+ invariant(index !== -1, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 102, S: this, A: ["index !== -1", ""] });
136
123
  this._chunks[index] = chunk;
137
124
  this._changes.push({
138
125
  type: "update",
@@ -144,15 +131,7 @@ var SerializationModel = class {
144
131
  }
145
132
  deleteBlock(id) {
146
133
  const index = this._chunks.findIndex((c) => c.id === id);
147
- invariant(index !== -1, void 0, {
148
- F: __dxlog_file,
149
- L: 156,
150
- S: this,
151
- A: [
152
- "index !== -1",
153
- ""
154
- ]
155
- });
134
+ invariant(index !== -1, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 114, S: this, A: ["index !== -1", ""] });
156
135
  this._chunks.splice(index, 1);
157
136
  this._changes.push({
158
137
  type: "delete",
@@ -168,12 +147,7 @@ var SerializationModel = class {
168
147
  sync(document2) {
169
148
  log("sync", {
170
149
  changes: this._changes
171
- }, {
172
- F: __dxlog_file,
173
- L: 167,
174
- S: this,
175
- C: (f, a) => f(...a)
176
- });
150
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 127, S: this });
177
151
  for (const change of this._changes) {
178
152
  switch (change.type) {
179
153
  case "append": {
@@ -413,10 +387,7 @@ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/ho
413
387
  var useAudioFile = (audioUrl, constraints) => {
414
388
  const [{ audio, stream, track }, setStream] = useState({});
415
389
  useEffect(() => {
416
- const ctx = new Context(void 0, {
417
- F: __dxlog_file2,
418
- L: 20
419
- });
390
+ const ctx = new Context(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 11 });
420
391
  scheduleTask(ctx, async () => {
421
392
  try {
422
393
  const response = await fetch(audioUrl);
@@ -431,12 +402,7 @@ var useAudioFile = (audioUrl, constraints) => {
431
402
  audio2.addEventListener("error", (err) => {
432
403
  log2.error("error", {
433
404
  err
434
- }, {
435
- F: __dxlog_file2,
436
- L: 39,
437
- S: void 0,
438
- C: (f, a) => f(...a)
439
- });
405
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 25, S: void 0 });
440
406
  reject(err);
441
407
  }, {
442
408
  once: true
@@ -458,12 +424,7 @@ var useAudioFile = (audioUrl, constraints) => {
458
424
  source.connect(destination);
459
425
  const track2 = destination.stream.getAudioTracks()[0];
460
426
  if (constraints) {
461
- await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, {
462
- F: __dxlog_file2,
463
- L: 68,
464
- S: void 0,
465
- C: (f, a) => f(...a)
466
- }));
427
+ await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 50, S: void 0 }));
467
428
  }
468
429
  setStream({
469
430
  audio: audio2,
@@ -471,12 +432,7 @@ var useAudioFile = (audioUrl, constraints) => {
471
432
  track: destination.stream.getAudioTracks()[0]
472
433
  });
473
434
  } catch (err) {
474
- log2.catch(err, void 0, {
475
- F: __dxlog_file2,
476
- L: 78,
477
- S: void 0,
478
- C: (f, a) => f(...a)
479
- });
435
+ log2.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 59, S: void 0 });
480
436
  }
481
437
  });
482
438
  return () => {
@@ -574,7 +530,7 @@ var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
574
530
  import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
575
531
  import { useCapabilities } from "@dxos/app-framework/ui";
576
532
  import { TranscriptionCapabilities as TranscriptionCapabilities2 } from "#types";
577
- var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments }) => {
533
+ var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments, transcribe }) => {
578
534
  const [getTranscriber] = useCapabilities(TranscriptionCapabilities2.Transcriber);
579
535
  const transcriber = useMemo2(() => {
580
536
  if (!getTranscriber || !audioStreamTrack || !onSegments) {
@@ -584,14 +540,16 @@ var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onS
584
540
  audioStreamTrack,
585
541
  recorderConfig,
586
542
  transcriberConfig,
587
- onSegments
543
+ onSegments,
544
+ transcribe
588
545
  });
589
546
  }, [
590
547
  getTranscriber,
591
548
  audioStreamTrack,
592
549
  recorderConfig,
593
550
  transcriberConfig,
594
- onSegments
551
+ onSegments,
552
+ transcribe
595
553
  ]);
596
554
  useEffect4(() => {
597
555
  return () => {
@@ -624,31 +582,18 @@ var useVoiceInput = ({ active, onUpdate }) => {
624
582
  onSegments: handleSegments
625
583
  });
626
584
  useEffect5(() => {
627
- const ctx = new Context2(void 0, {
628
- F: __dxlog_file3,
629
- L: 43
630
- });
585
+ const ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 29 });
631
586
  scheduleMicroTask(ctx, async () => {
632
587
  if (active && transcriber) {
633
588
  await transcriber.open();
634
- log3.info("starting...", void 0, {
635
- F: __dxlog_file3,
636
- L: 47,
637
- S: void 0,
638
- C: (f, a) => f(...a)
639
- });
589
+ log3.info("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 33, S: void 0 });
640
590
  setRecording(true);
641
591
  void soundStart.play();
642
592
  transcriber.startChunksRecording();
643
593
  } else if (!active && transcriber?.isOpen) {
644
594
  transcriber?.stopChunksRecording();
645
595
  await transcriber?.close();
646
- log3.info("stopped", void 0, {
647
- F: __dxlog_file3,
648
- L: 54,
649
- S: void 0,
650
- C: (f, a) => f(...a)
651
- });
596
+ log3.info("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 40, S: void 0 });
652
597
  setRecording(false);
653
598
  void soundStop.play();
654
599
  }
@@ -690,13 +635,13 @@ import { synchronized } from "@dxos/async";
690
635
  import { invariant as invariant2 } from "@dxos/invariant";
691
636
  import { log as log4 } from "@dxos/log";
692
637
  import { trace } from "@dxos/tracing";
638
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/media-stream-recorder.ts";
693
639
  function _ts_decorate(decorators, target, key, desc) {
694
640
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
695
641
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
696
642
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
697
643
  return c > 3 && r && Object.defineProperty(target, key, r), r;
698
644
  }
699
- var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/media-stream-recorder.ts";
700
645
  var initializingPromise;
701
646
  var initializeExtendableMediaRecorder = async () => {
702
647
  const { connect } = await import("extendable-media-recorder-wav-encoder");
@@ -732,12 +677,7 @@ var MediaStreamRecorder = class {
732
677
  async start() {
733
678
  await (initializingPromise ??= initializeExtendableMediaRecorder()).catch((err) => log4.info("initializeExtendableMediaRecorder", {
734
679
  err
735
- }, {
736
- F: __dxlog_file4,
737
- L: 69,
738
- S: this,
739
- C: (f, a) => f(...a)
740
- }));
680
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 48, S: this }));
741
681
  if (!this._mediaRecorder) {
742
682
  const stream = new MediaStream([
743
683
  this._mediaStreamTrack
@@ -749,15 +689,7 @@ var MediaStreamRecorder = class {
749
689
  if (this._mediaRecorder.state === "recording") {
750
690
  return;
751
691
  }
752
- invariant2(this._onChunk, "MediaStreamRecorder: onChunk is not set", {
753
- F: __dxlog_file4,
754
- L: 80,
755
- S: this,
756
- A: [
757
- "this._onChunk",
758
- "'MediaStreamRecorder: onChunk is not set'"
759
- ]
760
- });
692
+ invariant2(this._onChunk, "MediaStreamRecorder: onChunk is not set", { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 62, S: this, A: ["this._onChunk", "'MediaStreamRecorder: onChunk is not set'"] });
761
693
  this._mediaRecorder.ondataavailable = (event) => this._ondataavailable(event);
762
694
  this._mediaRecorder.start(this._config.interval);
763
695
  }
@@ -784,12 +716,7 @@ var MediaStreamRecorder = class {
784
716
  ...uint8Array
785
717
  ]));
786
718
  } else {
787
- log4.warn("MediaStreamRecorder: no header", void 0, {
788
- F: __dxlog_file4,
789
- L: 111,
790
- S: this,
791
- C: (f, a) => f(...a)
792
- });
719
+ log4.warn("MediaStreamRecorder: no header", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 90, S: this });
793
720
  return;
794
721
  }
795
722
  this._onChunk({
@@ -812,13 +739,13 @@ import { LifecycleState, Resource } from "@dxos/context";
812
739
  import { log as log5 } from "@dxos/log";
813
740
  import { trace as trace2 } from "@dxos/tracing";
814
741
  import { TRANSCRIPTION_URL } from "#types";
742
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
815
743
  function _ts_decorate2(decorators, target, key, desc) {
816
744
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
817
745
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
818
746
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
819
747
  return c > 3 && r && Object.defineProperty(target, key, r), r;
820
748
  }
821
- var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
822
749
  var Transcriber = class extends Resource {
823
750
  _audioChunks = [];
824
751
  _lastUsedTimestamp = 0;
@@ -828,44 +755,31 @@ var Transcriber = class extends Resource {
828
755
  _config;
829
756
  _recorder;
830
757
  _onSegments;
758
+ _transcribeFn;
831
759
  _recording = false;
832
760
  _transcribeTask = void 0;
833
- constructor({ config, recorder, onSegments }) {
761
+ constructor({ config, recorder, onSegments, transcribe }) {
834
762
  super();
835
763
  this._config = config;
836
764
  this._recorder = recorder;
837
765
  this._onSegments = onSegments;
766
+ this._transcribeFn = transcribe;
838
767
  }
839
768
  async _open(ctx) {
840
- log5.info("opening", void 0, {
841
- F: __dxlog_file5,
842
- L: 102,
843
- S: this,
844
- C: (f, a) => f(...a)
845
- });
769
+ log5.info("opening", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 41, S: this });
846
770
  this._recorder.setOnChunk((chunk) => this._saveAudioChunk(chunk));
847
771
  await this._recorder.start();
848
772
  this._transcribeTask = new DeferredTask(ctx, async () => this._transcribe());
849
773
  this._openTrigger.wake();
850
774
  }
851
775
  async _close() {
852
- log5.info("closing", void 0, {
853
- F: __dxlog_file5,
854
- L: 110,
855
- S: this,
856
- C: (f, a) => f(...a)
857
- });
776
+ log5.info("closing", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 48, S: this });
858
777
  this._recording = false;
859
778
  this._transcribeTask = void 0;
860
779
  await this._recorder.stop();
861
780
  }
862
781
  startChunksRecording() {
863
- log5.info("starting", void 0, {
864
- F: __dxlog_file5,
865
- L: 117,
866
- S: this,
867
- C: (f, a) => f(...a)
868
- });
782
+ log5.info("starting", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 54, S: this });
869
783
  if (this._lifecycleState !== LifecycleState.OPEN) {
870
784
  return;
871
785
  }
@@ -877,22 +791,12 @@ var Transcriber = class extends Resource {
877
791
  }
878
792
  this._recording = false;
879
793
  this._transcribeTask?.schedule();
880
- log5.info("stopped", void 0, {
881
- F: __dxlog_file5,
882
- L: 132,
883
- S: this,
884
- C: (f, a) => f(...a)
885
- });
794
+ log5.info("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 66, S: this });
886
795
  }
887
796
  _saveAudioChunk(chunk) {
888
797
  log5("saving audio chunk", {
889
798
  chunk
890
- }, {
891
- F: __dxlog_file5,
892
- L: 136,
893
- S: this,
894
- C: (f, a) => f(...a)
895
- });
799
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 69, S: this });
896
800
  this._audioChunks.push(chunk);
897
801
  if (!this._recording && (!this._transcribeTask || !this._transcribeTask.scheduled) && this._audioChunks.length >= this._config.prefixBufferChunksAmount) {
898
802
  this._audioChunks = this._dropOldChunks();
@@ -903,12 +807,7 @@ var Transcriber = class extends Resource {
903
807
  async _transcribe() {
904
808
  log5("transcribing", {
905
809
  chunks: this._audioChunks.length
906
- }, {
907
- F: __dxlog_file5,
908
- L: 152,
909
- S: this,
910
- C: (f, a) => f(...a)
911
- });
810
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 81, S: this });
912
811
  const chunks = this._audioChunks;
913
812
  this._audioChunks = this._dropOldChunks();
914
813
  if (chunks.length === 0) {
@@ -935,54 +834,41 @@ var Transcriber = class extends Resource {
935
834
  }
936
835
  async _fetchTranscription(audio) {
937
836
  if (audio.length === 0) {
938
- this._audioChunks = [];
939
837
  throw new Error("No audio to send for transcribing");
940
838
  }
941
- const response = await fetch(`${TRANSCRIPTION_URL}/transcribe`, {
942
- method: "POST",
943
- body: JSON.stringify({
944
- audio
945
- }),
946
- headers: {
947
- "Content-Type": "application/json"
839
+ let segments;
840
+ if (this._transcribeFn) {
841
+ segments = await this._transcribeFn(audio);
842
+ } else {
843
+ const endpoint = this._config.endpoint ?? TRANSCRIPTION_URL;
844
+ const response = await fetch(`${endpoint}/transcribe`, {
845
+ method: "POST",
846
+ body: JSON.stringify({
847
+ audio
848
+ }),
849
+ headers: {
850
+ "Content-Type": "application/json"
851
+ }
852
+ });
853
+ if (!response.ok) {
854
+ throw new Error(`Transcription failed: ${response.statusText}`);
948
855
  }
949
- });
950
- if (!response.ok) {
951
- this._audioChunks = [];
952
- throw new Error(`Transcription failed: ${response.statusText}`);
856
+ ({ segments } = await response.json());
857
+ }
858
+ if (!Array.isArray(segments)) {
859
+ throw new Error("Transcription response payload is invalid");
953
860
  }
954
- const { segments } = await response.json();
955
861
  log5.info("transcription response", {
956
- segments: segments.length,
957
- string: segments.map((segments2) => segments2.text).join(" ")
958
- }, {
959
- F: __dxlog_file5,
960
- L: 216,
961
- S: this,
962
- C: (f, a) => f(...a)
963
- });
862
+ segments: segments.length
863
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 134, S: this });
964
864
  return segments;
965
865
  }
966
866
  _alignSegments(segments, originalChunks) {
967
- const zeroTimestamp = originalChunks.at(0).timestamp;
968
- const filteredSegments = segments.filter((segment) => zeroTimestamp + segment.end * 1e3 >= this._lastUsedTimestamp).map((segment) => {
969
- const words = segment.words.filter((word) => zeroTimestamp + word.start * 1e3 >= this._lastUsedTimestamp);
970
- return {
971
- ...segment,
972
- words,
973
- text: words.map((word) => word.word).join(""),
974
- start: words.at(0)?.start ?? segment.end
975
- };
976
- }).filter((segment) => segment.words.length > 0);
977
- if (filteredSegments.length === 0) {
978
- return [];
867
+ const result = alignWhisperSegments(segments, originalChunks, this._lastUsedTimestamp);
868
+ if (result.lastUsedTimestamp !== void 0) {
869
+ this._lastUsedTimestamp = result.lastUsedTimestamp;
979
870
  }
980
- this._lastUsedTimestamp = zeroTimestamp + filteredSegments.at(-1).end * 1e3;
981
- return filteredSegments.map((segment) => ({
982
- _tag: "transcript",
983
- started: new Date(zeroTimestamp + segment.start * 1e3).toISOString(),
984
- text: segment.text.trim()
985
- }));
871
+ return result.transcripts;
986
872
  }
987
873
  };
988
874
  _ts_decorate2([
@@ -995,6 +881,36 @@ _ts_decorate2([
995
881
  showInBrowserTimeline: true
996
882
  })
997
883
  ], Transcriber.prototype, "_fetchTranscription", null);
884
+ var alignWhisperSegments = (segments, originalChunks, lastUsedTimestamp) => {
885
+ if (originalChunks.length === 0) {
886
+ return {
887
+ transcripts: []
888
+ };
889
+ }
890
+ const zeroTimestamp = originalChunks[0].timestamp;
891
+ const filteredSegments = segments.filter((segment) => zeroTimestamp + segment.end * 1e3 >= lastUsedTimestamp).map((segment) => {
892
+ const words = segment.words.filter((word) => zeroTimestamp + word.start * 1e3 >= lastUsedTimestamp);
893
+ return {
894
+ ...segment,
895
+ words,
896
+ text: words.map((word) => word.word).join(""),
897
+ start: words.at(0)?.start ?? segment.end
898
+ };
899
+ }).filter((segment) => segment.words.length > 0);
900
+ if (filteredSegments.length === 0) {
901
+ return {
902
+ transcripts: []
903
+ };
904
+ }
905
+ return {
906
+ transcripts: filteredSegments.map((segment) => ({
907
+ _tag: "transcript",
908
+ started: new Date(zeroTimestamp + segment.start * 1e3).toISOString(),
909
+ text: segment.text.trim()
910
+ })),
911
+ lastUsedTimestamp: zeroTimestamp + filteredSegments.at(-1).end * 1e3
912
+ };
913
+ };
998
914
 
999
915
  // src/transcriber/transcription-manager.ts
1000
916
  import { Atom } from "@effect-atom/atom-react";
@@ -1139,27 +1055,9 @@ import { Annotation, Feed, Obj as Obj2 } from "@dxos/echo";
1139
1055
  import { getSpace } from "@dxos/react-client/echo";
1140
1056
  import { Message as Message2, Transcript } from "@dxos/types";
1141
1057
  import { BlueprintDefinition, OperationHandler, ReactSurface, Transcriber as Transcriber2 } from "#capabilities";
1142
- import { meta as meta3 } from "#meta";
1143
-
1144
- // src/translations.ts
1145
1058
  import { meta as meta2 } from "#meta";
1146
- var translations = [
1147
- {
1148
- "en-US": {
1149
- [meta2.id]: {
1150
- "plugin.name": "Transcription",
1151
- "transcript-companion.label": "Transcript",
1152
- "delete.button": "Delete",
1153
- "bookmark.button": "Bookmark",
1154
- "scroll-to-end.label": "Scroll to latest",
1155
- "settings.entity-extraction.label": "Entity extraction"
1156
- }
1157
- }
1158
- }
1159
- ];
1160
-
1161
- // src/TranscriptionPlugin.tsx
1162
- var TranscriptionPlugin = Plugin.define(meta3).pipe(AppPlugin.addBlueprintDefinitionModule({
1059
+ import { translations } from "#translations";
1060
+ var TranscriptionPlugin = Plugin.define(meta2).pipe(AppPlugin.addBlueprintDefinitionModule({
1163
1061
  activate: BlueprintDefinition
1164
1062
  }), AppPlugin.addMetadataModule({
1165
1063
  metadata: {
@@ -1202,6 +1100,7 @@ export {
1202
1100
  TranscriptionCapabilities,
1203
1101
  TranscriptionManager,
1204
1102
  TranscriptionPlugin,
1103
+ alignWhisperSegments,
1205
1104
  meta,
1206
1105
  renderByline,
1207
1106
  useAudioFile,