@dxos/plugin-transformer 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.0
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/PLUGIN.mdl +53 -8
- package/dist/lib/TransformerPlugin.mjs +1 -1
- package/dist/lib/capabilities.browser.mjs +17 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.node.mjs +10 -0
- package/dist/lib/capabilities.node.mjs.map +1 -0
- package/dist/lib/capabilities.tauri.mjs +17 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +10 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -0
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/components.mjs.map +1 -1
- package/dist/lib/index.mjs +0 -1
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/plugin.mjs +1 -1
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/capabilities/gen/browser.d.ts +4 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts +4 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts +4 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts +4 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
- package/dist/types/src/components/Voice/Voice.stories.d.ts +1 -1
- package/dist/types/src/components/Voice/Voice.stories.d.ts.map +1 -1
- package/dist/types/src/components/Voice/index.d.ts +2 -2
- package/dist/types/src/components/Voice/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/node-pipeline.d.ts +1 -1
- package/dist/types/src/testing/node-pipeline.d.ts.map +1 -1
- package/dist/types/src/testing/web-pipeline.d.ts +1 -1
- package/dist/types/src/testing/web-pipeline.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -19
- package/src/capabilities/gen/browser.ts +23 -0
- package/src/capabilities/gen/node.ts +15 -0
- package/src/capabilities/gen/tauri.ts +23 -0
- package/src/capabilities/gen/workerd.ts +15 -0
- package/src/components/Voice/Voice.stories.tsx +1 -1
- package/src/components/Voice/Voice.tsx +1 -1
- package/src/components/Voice/index.ts +2 -2
- package/src/components/index.ts +1 -1
- package/src/hooks/index.ts +2 -2
- package/src/index.ts +1 -2
- package/src/meta.ts +1 -1
- package/src/plugin.test.ts +2 -2
- package/src/testing/node-pipeline.ts +1 -1
- package/src/testing/pipeline.test.ts +1 -1
- package/src/testing/web-pipeline.ts +1 -1
- package/src/translations.ts +2 -2
- package/dist/lib/capabilities.mjs +0 -17
- package/dist/lib/capabilities.mjs.map +0 -1
package/PLUGIN.mdl
CHANGED
|
@@ -18,9 +18,10 @@ Each extension is defined in the Appendix or resolved via its URI.
|
|
|
18
18
|
|-------------|--------------------------------|
|
|
19
19
|
| `type` | `org.dxos.mdl.type@1.0` |
|
|
20
20
|
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
21
|
-
| `
|
|
21
|
+
| `scenario` | `org.dxos.mdl.scenario@1.0` |
|
|
22
22
|
| `component` | `org.dxos.mdl.component@1.0` |
|
|
23
23
|
| `op` | `org.dxos.mdl.op@1.0` |
|
|
24
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
24
25
|
|
|
25
26
|
## Types
|
|
26
27
|
|
|
@@ -211,7 +212,7 @@ feat F-4: RAG Embedding Pipeline (Testing)
|
|
|
211
212
|
## Acceptance
|
|
212
213
|
|
|
213
214
|
```mdl
|
|
214
|
-
|
|
215
|
+
scenario T-1: Model loads and transitions isLoaded
|
|
215
216
|
given: Voice component mounts with active = true and model = 'Xenova/whisper-base'
|
|
216
217
|
when: model download and ONNX compilation complete
|
|
217
218
|
then:
|
|
@@ -221,7 +222,7 @@ test T-1: Model loads and transitions isLoaded
|
|
|
221
222
|
```
|
|
222
223
|
|
|
223
224
|
```mdl
|
|
224
|
-
|
|
225
|
+
scenario T-2: Model load failure sets error state
|
|
225
226
|
given: the model download throws a network error
|
|
226
227
|
when: usePipeline attempts to load the model
|
|
227
228
|
then:
|
|
@@ -231,7 +232,7 @@ test T-2: Model load failure sets error state
|
|
|
231
232
|
```
|
|
232
233
|
|
|
233
234
|
```mdl
|
|
234
|
-
|
|
235
|
+
scenario T-3: Microphone capture populates stream state
|
|
235
236
|
given: getUserMedia is granted
|
|
236
237
|
when: useAudioStream activates
|
|
237
238
|
then:
|
|
@@ -240,7 +241,7 @@ test T-3: Microphone capture populates stream state
|
|
|
240
241
|
```
|
|
241
242
|
|
|
242
243
|
```mdl
|
|
243
|
-
|
|
244
|
+
scenario T-4: Audio chunk triggers transcription
|
|
244
245
|
given: model is loaded and stream is active
|
|
245
246
|
when: AudioWorklet posts a 32000-sample chunk
|
|
246
247
|
then:
|
|
@@ -250,7 +251,7 @@ test T-4: Audio chunk triggers transcription
|
|
|
250
251
|
```
|
|
251
252
|
|
|
252
253
|
```mdl
|
|
253
|
-
|
|
254
|
+
scenario T-5: Concurrent transcription calls are dropped
|
|
254
255
|
given: isTranscribing is true
|
|
255
256
|
when: a second audio chunk arrives
|
|
256
257
|
then: the chunk is discarded and no second pipeline call is made
|
|
@@ -258,6 +259,50 @@ test T-5: Concurrent transcription calls are dropped
|
|
|
258
259
|
|
|
259
260
|
---
|
|
260
261
|
|
|
262
|
+
## QA
|
|
263
|
+
|
|
264
|
+
Executable tests. Each step carries a human instruction (`do`) and, where the step maps to an
|
|
265
|
+
invocable operation, an agent binding (`invoke`). Report failures by test and step number.
|
|
266
|
+
|
|
267
|
+
```mdl
|
|
268
|
+
test QA-1: Load the Whisper model and transcribe from the microphone
|
|
269
|
+
desc: |
|
|
270
|
+
plugin-transformer has no user-visible surface at all: it is not wired into
|
|
271
|
+
`plugin-defs.tsx` (searched — no import, no `.make()` call anywhere under
|
|
272
|
+
`packages/apps/composer-app/src`), it contributes no ECHO type and no navtree entry, and it
|
|
273
|
+
registers no `Operation.make` (there is no `operations/` module under `src/`) — `Voice` is a
|
|
274
|
+
plain React component + hooks (`usePipeline`, `useAudioStream`) meant to be composed
|
|
275
|
+
directly into a host app, not something Composer currently mounts. The test below is honest
|
|
276
|
+
about that: every step is blocked at the level of "there is no running application surface
|
|
277
|
+
to drive it from".
|
|
278
|
+
actors: human
|
|
279
|
+
covers: [F-1.1, F-2.1, F-3.1, T-1, T-3, T-4]
|
|
280
|
+
status: blocked
|
|
281
|
+
given:
|
|
282
|
+
- the Voice component is mounted somewhere reachable in a running app, with active = true
|
|
283
|
+
and model = 'Xenova/whisper-base' — NOT currently true of Composer
|
|
284
|
+
steps:
|
|
285
|
+
- name: Load the model
|
|
286
|
+
do: Observe the DebugInfo panel after mounting Voice.
|
|
287
|
+
expect: gpuInfo reports the adapter (or a WASM/CPU fallback message), isLoading transitions
|
|
288
|
+
to false, and isLoaded becomes true
|
|
289
|
+
blocked: |
|
|
290
|
+
No host application in this repo mounts `Voice` — plugin-transformer is not in
|
|
291
|
+
`composer-app`'s plugin registry (`plugin-defs.tsx`, `plugin-defs.production.tsx`, or
|
|
292
|
+
`plugin-defs.mobile.tsx`) under any name. There is nothing running to load a model into.
|
|
293
|
+
- name: Grant microphone access
|
|
294
|
+
do: Accept the browser's microphone permission prompt.
|
|
295
|
+
expect: AudioStreamState.stream becomes a non-null MediaStream and the audio-level meter moves
|
|
296
|
+
blocked: same as above — no reachable UI to grant permission to.
|
|
297
|
+
- name: Speak and observe the transcript
|
|
298
|
+
do: Speak a short sentence into the microphone.
|
|
299
|
+
expect: the transcription text in the DebugInfo panel updates with the recognised words
|
|
300
|
+
blocked: same as above — depends on the two prior steps.
|
|
301
|
+
after: []
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
261
306
|
## Appendix: Extension Definitions
|
|
262
307
|
|
|
263
308
|
Extension block types used in this document are defined below using
|
|
@@ -285,8 +330,8 @@ ext feat
|
|
|
285
330
|
```
|
|
286
331
|
|
|
287
332
|
```mdl
|
|
288
|
-
ext
|
|
289
|
-
uri: org.dxos.mdl.
|
|
333
|
+
ext scenario
|
|
334
|
+
uri: org.dxos.mdl.scenario@1.0
|
|
290
335
|
desc: An acceptance scenario expressed as given / when / then steps.
|
|
291
336
|
fields:
|
|
292
337
|
given?: Step | Step[]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as PLUGIN_default } from "./chunk-PLUGIN.mjs";
|
|
2
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
3
|
+
import { translations } from "#translations";
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
//#region src/capabilities/gen/browser.ts
|
|
6
|
+
var PluginAsset = AppCapability.pluginAsset({
|
|
7
|
+
pluginId: meta.profile.key,
|
|
8
|
+
path: "PLUGIN.mdl",
|
|
9
|
+
content: PLUGIN_default,
|
|
10
|
+
mimeType: "application/x-mdl"
|
|
11
|
+
});
|
|
12
|
+
var Schema = AppCapability.schema([]);
|
|
13
|
+
var Translations = AppCapability.translations(translations);
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PluginAsset, Schema, Translations };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=capabilities.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.browser.mjs","names":[],"sources":["../../src/capabilities/gen/browser.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'browser' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nimport pluginSpec from '../../../PLUGIN.mdl?raw';\n\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\n\nexport const Schema = AppCapability.schema([]);\n\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;AAaA,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AAED,IAAa,SAAS,cAAc,OAAO,CAAC,CAAC;AAE7C,IAAa,eAAe,cAAc,aAAa,YAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
2
|
+
import { translations } from "#translations";
|
|
3
|
+
//#region src/capabilities/gen/node.ts
|
|
4
|
+
var Schema = AppCapability.schema([]);
|
|
5
|
+
var Translations = AppCapability.translations(translations);
|
|
6
|
+
var PluginAsset = void 0;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PluginAsset, Schema, Translations };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=capabilities.node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema([]);\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const PluginAsset = undefined;\n"],"mappings":";;;AAUA,IAAa,SAAS,cAAc,OAAO,CAAC,CAAC;AAE7C,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as PLUGIN_default } from "./chunk-PLUGIN.mjs";
|
|
2
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
3
|
+
import { translations } from "#translations";
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
//#region src/capabilities/gen/tauri.ts
|
|
6
|
+
var PluginAsset = AppCapability.pluginAsset({
|
|
7
|
+
pluginId: meta.profile.key,
|
|
8
|
+
path: "PLUGIN.mdl",
|
|
9
|
+
content: PLUGIN_default,
|
|
10
|
+
mimeType: "application/x-mdl"
|
|
11
|
+
});
|
|
12
|
+
var Schema = AppCapability.schema([]);
|
|
13
|
+
var Translations = AppCapability.translations(translations);
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PluginAsset, Schema, Translations };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=capabilities.tauri.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.tauri.mjs","names":[],"sources":["../../src/capabilities/gen/tauri.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'tauri' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nimport pluginSpec from '../../../PLUGIN.mdl?raw';\n\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\n\nexport const Schema = AppCapability.schema([]);\n\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;AAaA,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AAED,IAAa,SAAS,cAAc,OAAO,CAAC,CAAC;AAE7C,IAAa,eAAe,cAAc,aAAa,YAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
2
|
+
import { translations } from "#translations";
|
|
3
|
+
//#region src/capabilities/gen/workerd.ts
|
|
4
|
+
var Schema = AppCapability.schema([]);
|
|
5
|
+
var Translations = AppCapability.translations(translations);
|
|
6
|
+
var PluginAsset = void 0;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PluginAsset, Schema, Translations };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=capabilities.workerd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema([]);\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const PluginAsset = undefined;\n"],"mappings":";;;AAUA,IAAa,SAAS,cAAc,OAAO,CAAC,CAAC;AAE7C,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region PLUGIN.mdl?raw
|
|
2
|
+
var PLUGIN_default = "---\nid: org.dxos.plugin.transformer\nname: TransformerPlugin\nversion: 0.1.0\n---\n\nA browser-based machine learning plugin for DXOS Composer that runs Hugging Face Transformers.js\nmodels entirely in-browser via WebAssembly and WebGPU. It provides automatic speech recognition\n(Whisper) through a React hook and component layer, enabling real-time voice transcription without\nany server-side inference infrastructure.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `scenario` | `org.dxos.mdl.scenario@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n\n## Types\n\n```mdl\ntype PipelineConfig\n fields:\n model: string # Hugging Face model id, e.g. 'Xenova/whisper-base'\n active?: boolean # whether to load and run the pipeline\n debug?: boolean # enable verbose logging\n```\n\n```mdl\ntype PipelineState\n fields:\n gpuInfo: string # WebGPU adapter description, or fallback message\n isLoaded: boolean # true once the model is fully initialised\n isLoading: boolean # true while the model is being downloaded/compiled\n error: string | null # error message if loading failed\n```\n\n```mdl\ntype AudioStreamConfig\n fields:\n active?: boolean # start/stop microphone capture\n debug?: boolean\n onAudioData?(audioData: Float32Array): Promise<void>\n```\n\n```mdl\ntype AudioStreamState\n fields:\n stream: MediaStream | null # live microphone stream, or null when inactive\n error: string | null # error from getUserMedia or audio processing\n audioLevel: number # 0-255 RMS level for visualisation\n```\n\n```mdl\ntype TranscriptionOptions\n fields:\n sampling_rate: number # audio sample rate in Hz (16000)\n chunk_length_s: number # seconds of audio per chunk\n stride_length_s: number # overlap between adjacent chunks\n return_timestamps: boolean # include word-level timestamps in output\n language: string # target language hint, e.g. 'english'\n```\n\n```mdl\ntype EmbeddingOutput\n fields:\n data: number[] # embedding vector as a flat float array\n```\n\n## Components\n\n```mdl\ncomponent Voice\n desc: |\n Composite component that wires usePipeline and useAudioStream together to provide\n live Whisper transcription from the microphone. Accumulates the running transcript\n in local state and renders a DebugInfo panel showing model status, audio level, and\n the current transcription text.\n props:\n active?: boolean # start/stop the entire pipeline\n debug?: boolean\n model?: string # defaults to 'Xenova/whisper-base'\n state:\n isTranscribing: boolean # true while a transcription call is in-flight\n transcription: string # accumulated transcript text\n layout: |\n ┌──────────────────────────────────────┐\n │ [DebugInfo panel] │\n │ model: Xenova/whisper-base │\n │ gpu: GPU Available │\n │ stream: active / inactive │\n │ level: ███░░░░ (audioLevel bar) │\n │ ────────────────────────────── │\n │ [transcription text] │\n └──────────────────────────────────────┘\n```\n\n## Operations\n\n```mdl\nop LoadModel\n desc: |\n Loads a Transformers.js automatic-speech-recognition pipeline for the given model id.\n Configures ONNX backend to use WebGPU if available, falling back to WASM/CPU.\n Invoked automatically when the Voice component mounts with active = true.\n input: void\n output: void\n effects: [http, fs]\n note: Model weights are cached in ./.cache by the Transformers.js env settings.\n```\n\n```mdl\nop Transcribe\n desc: |\n Runs the loaded ASR pipeline against a Float32Array of 16 kHz mono audio.\n Returns the transcribed text string from the pipeline result.\n input: void\n output: string\n effects: [gpu]\n note: Guarded by isTranscribing flag to prevent concurrent calls.\n```\n\n```mdl\nop CaptureAudio\n desc: |\n Requests microphone permission via getUserMedia and wires an AudioWorklet that\n accumulates 2-second chunks (32000 samples at 16 kHz) before forwarding them to\n the onAudioData callback.\n input: void\n output: void\n effects: [audio]\n note: Cleaned up automatically when the component unmounts or active becomes false.\n```\n\n## Features\n\n```mdl\nfeat F-1: In-Browser ASR Pipeline\n\n req F-1.1:\n when: Voice component mounts with active = true\n then: usePipeline loads the Whisper model via Transformers.js; isLoading is true until complete\n\n req F-1.2:\n when: WebGPU is available in the browser\n then: the ONNX backend is configured for WebGPU execution and gpuInfo reflects the adapter\n\n req F-1.3:\n when: WebGPU is not available\n then: the pipeline falls back to WASM/CPU and gpuInfo is set to a 'not supported' message\n\n req F-1.4:\n when: model loading fails\n then: PipelineState.error contains a human-readable message; isLoading is false\n```\n\n```mdl\nfeat F-2: Microphone Capture\n\n req F-2.1:\n when: useAudioStream is activated\n then: getUserMedia is called with mono 16 kHz audio and echo/noise cancellation enabled\n\n req F-2.2:\n when: audio is captured\n then: an AudioWorklet accumulates samples and emits 2-second chunks via the onAudioData callback\n\n req F-2.3:\n when: active is set to false or the component unmounts\n then: all MediaStream tracks are stopped, AudioContext is closed, and AnimationFrame is cancelled\n\n req F-2.4:\n when: getUserMedia is denied\n then: AudioStreamState.error is set with the underlying error message\n```\n\n```mdl\nfeat F-3: Live Transcription\n\n req F-3.1:\n when: a 2-second audio chunk arrives and the model is loaded\n then: usePipeline.transcribe is called with 16 kHz mono options and the result appended to the transcript\n\n req F-3.2:\n when: transcription is already in progress (isTranscribing = true)\n then: the incoming audio chunk is dropped to avoid concurrent inference\n\n req F-3.3:\n when: transcription returns an empty or whitespace-only string\n then: the transcript state is not updated\n```\n\n```mdl\nfeat F-4: RAG Embedding Pipeline (Testing)\n\n req F-4.1:\n when: RagPipeline.generateCompletions is called with an input and a knowledge base\n then: embeddings are generated for both the input and each knowledge-base entry\n\n req F-4.2:\n when: embeddings are available\n then: cosine similarity is computed and the top-3 most similar contexts are selected\n```\n\n## Acceptance\n\n```mdl\nscenario T-1: Model loads and transitions isLoaded\n given: Voice component mounts with active = true and model = 'Xenova/whisper-base'\n when: model download and ONNX compilation complete\n then:\n - isLoading transitions from true to false\n - isLoaded is true\n - error is null\n```\n\n```mdl\nscenario T-2: Model load failure sets error state\n given: the model download throws a network error\n when: usePipeline attempts to load the model\n then:\n - isLoading is false\n - error contains the error message string\n - isLoaded is false\n```\n\n```mdl\nscenario T-3: Microphone capture populates stream state\n given: getUserMedia is granted\n when: useAudioStream activates\n then:\n - AudioStreamState.stream is a non-null MediaStream\n - AudioStreamState.error is null\n```\n\n```mdl\nscenario T-4: Audio chunk triggers transcription\n given: model is loaded and stream is active\n when: AudioWorklet posts a 32000-sample chunk\n then:\n - isTranscribing becomes true during the pipeline call\n - transcription string is updated with the returned text\n - isTranscribing returns to false after completion\n```\n\n```mdl\nscenario T-5: Concurrent transcription calls are dropped\n given: isTranscribing is true\n when: a second audio chunk arrives\n then: the chunk is discarded and no second pipeline call is made\n```\n\n---\n\n## QA\n\nExecutable tests. Each step carries a human instruction (`do`) and, where the step maps to an\ninvocable operation, an agent binding (`invoke`). Report failures by test and step number.\n\n```mdl\ntest QA-1: Load the Whisper model and transcribe from the microphone\n desc: |\n plugin-transformer has no user-visible surface at all: it is not wired into\n `plugin-defs.tsx` (searched — no import, no `.make()` call anywhere under\n `packages/apps/composer-app/src`), it contributes no ECHO type and no navtree entry, and it\n registers no `Operation.make` (there is no `operations/` module under `src/`) — `Voice` is a\n plain React component + hooks (`usePipeline`, `useAudioStream`) meant to be composed\n directly into a host app, not something Composer currently mounts. The test below is honest\n about that: every step is blocked at the level of \"there is no running application surface\n to drive it from\".\n actors: human\n covers: [F-1.1, F-2.1, F-3.1, T-1, T-3, T-4]\n status: blocked\n given:\n - the Voice component is mounted somewhere reachable in a running app, with active = true\n and model = 'Xenova/whisper-base' — NOT currently true of Composer\n steps:\n - name: Load the model\n do: Observe the DebugInfo panel after mounting Voice.\n expect: gpuInfo reports the adapter (or a WASM/CPU fallback message), isLoading transitions\n to false, and isLoaded becomes true\n blocked: |\n No host application in this repo mounts `Voice` — plugin-transformer is not in\n `composer-app`'s plugin registry (`plugin-defs.tsx`, `plugin-defs.production.tsx`, or\n `plugin-defs.mobile.tsx`) under any name. There is nothing running to load a model into.\n - name: Grant microphone access\n do: Accept the browser's microphone permission prompt.\n expect: AudioStreamState.stream becomes a non-null MediaStream and the audio-level meter moves\n blocked: same as above — no reachable UI to grant permission to.\n - name: Speak and observe the transcript\n do: Speak a short sentence into the microphone.\n expect: the transcription text in the DebugInfo panel updates with the recognised words\n blocked: same as above — depends on the two prior steps.\n after: []\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive — the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next scenario\n uri: org.dxos.mdl.scenario@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { PLUGIN_default as t };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=chunk-PLUGIN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-PLUGIN.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.mjs","names":[],"sources":["../../src/components/Voice/DebugInfo.tsx","../../src/components/Voice/Voice.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nexport type DebugInfoProps = {\n error: string;\n isModelLoading: boolean;\n stream: MediaStream | null;\n isTranscribing: boolean;\n transcription: string;\n audioLevel: number;\n gpuInfo: string;\n model: string;\n debug: boolean;\n};\n\nexport const DebugInfo: FC<Partial<DebugInfoProps>> = ({\n error,\n isModelLoading,\n stream,\n isTranscribing,\n transcription,\n audioLevel,\n gpuInfo,\n model,\n debug = false,\n}) => {\n return (\n <div className='p-4'>\n {error && (\n <div className='mb-4 text-red-600'>\n <strong>Error:</strong> {error}\n </div>\n )}\n {isModelLoading && (\n <div className='mb-4'>\n <div>Loading model...</div>\n <div className='text-sm text-gray-500'>This may take a few moments</div>\n </div>\n )}\n {stream ? (\n <div>\n <div className='mb-2 text-green-600'>\n <strong>Status:</strong> Microphone is active\n {debug && audioLevel && (\n <div className='mt-2 w-48 h-5 bg-gray-200 rounded-sm relative'>\n <div\n className='h-full bg-green-500 transition-all duration-100 rounded-sm'\n style={{ width: `${(audioLevel / 255) * 100}%` }}\n />\n </div>\n )}\n </div>\n {isTranscribing && <div className='mb-2 text-gray-500'>Processing audio...</div>}\n {debug && (\n <div className='mb-4 text-sm text-gray-500 space-y-1'>\n <div>Model: {model}</div>\n <div>Sample Rate: 16000 Hz</div>\n <div>Format: audio/wav</div>\n <div>Chunk Size: 10 seconds</div>\n <div>GPU: {gpuInfo || 'Not available'}</div>\n <div>Backend: WebGPU</div>\n </div>\n )}\n {transcription && (\n <div className='mt-4'>\n <strong>Transcription:</strong>\n <p className='mt-2 p-4 bg-gray-100 rounded-sm whitespace-pre-wrap'>{transcription}</p>\n </div>\n )}\n </div>\n ) : (\n <div>{!isModelLoading && !error && <div className='text-gray-500'>Microphone is inactive</div>}</div>\n )}\n </div>\n );\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useState } from 'react';\n\nimport { log } from '@dxos/log';\n\nimport { useAudioStream, usePipeline } from '#hooks';\n\nimport { DebugInfo } from './DebugInfo';\n\nexport type VoiceProps = {\n active?: boolean;\n debug?: boolean;\n model?: string;\n};\n\nexport const Voice = ({ active, debug, model = 'Xenova/whisper-base' }: VoiceProps) => {\n const [isTranscribing, setIsTranscribing] = useState(false);\n const [transcription, setTranscription] = useState<string>('');\n\n const {\n transcribe,\n gpuInfo,\n isLoaded: isModelLoaded,\n isLoading: isModelLoading,\n error: pipelineError,\n } = usePipeline({ active, debug, model });\n\n const {\n stream,\n error: audioError,\n audioLevel,\n } = useAudioStream({\n active,\n debug,\n // onAudioData: handleAudioData\n });\n\n const handleAudioData = useCallback(\n async (audioData: Float32Array) => {\n if (!isModelLoaded) {\n return;\n }\n\n if (isTranscribing) {\n return;\n }\n\n setIsTranscribing(true);\n try {\n const result = await transcribe(audioData, {\n sampling_rate: 16000,\n chunk_length_s: 5,\n stride_length_s: 1,\n return_timestamps: false,\n language: 'english',\n });\n\n if (result?.text?.trim()) {\n setTranscription((prev) => prev + ' ' + result.text);\n }\n } catch (err) {\n log.error('transcription error', { err });\n throw err;\n } finally {\n setIsTranscribing(false);\n }\n },\n [transcribe, isTranscribing],\n );\n log.info('handleAudioData', { handleAudioData });\n\n useEffect(() => {\n if (debug) {\n log.info('audio state', {\n hasStream: !!stream,\n audioError,\n audioLevel,\n shouldBeActive: active && isModelLoaded,\n });\n }\n }, [debug, stream, audioError, audioLevel, active, isModelLoaded]);\n\n useEffect(() => {\n if (debug) {\n log.info('transcription state', {\n active,\n isModelLoaded,\n isModelLoading,\n isTranscribing,\n pipelineError,\n });\n }\n }, [active, debug, isModelLoaded, isModelLoading, pipelineError, isTranscribing]);\n\n return (\n <DebugInfo\n error={audioError || pipelineError || undefined}\n isModelLoading={isModelLoading}\n stream={stream}\n isTranscribing={isTranscribing}\n transcription={transcription}\n audioLevel={audioLevel}\n gpuInfo={gpuInfo}\n model={model}\n debug={debug}\n />\n );\n};\n"],"mappings":";;;;;AAkBA,IAAa,aAA0C,EACrD,OACA,gBACA,QACA,gBACA,eACA,YACA,SACA,OACA,QAAQ,YACJ;CACJ,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACG,SACC,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,oBAAC,UAAD,EAAA,UAAQ,SAAc,CAAA;KAAC;KAAE;IACtB;;GAEN,kBACC,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,mBAAqB,CAAA,GAC1B,oBAAC,OAAD;KAAK,WAAU;KAAwB,UAA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c,CAAC;CAEhF,OACE,oBAAC,WAAD;EACE,OAAO,cAAc,iBAAiB,KAAA;EACtB;EACR;EACQ;EACD;EACH;EACH;EACF;EACA;CACR,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"components.mjs","names":[],"sources":["../../src/components/Voice/DebugInfo.tsx","../../src/components/Voice/Voice.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nexport type DebugInfoProps = {\n error: string;\n isModelLoading: boolean;\n stream: MediaStream | null;\n isTranscribing: boolean;\n transcription: string;\n audioLevel: number;\n gpuInfo: string;\n model: string;\n debug: boolean;\n};\n\nexport const DebugInfo: FC<Partial<DebugInfoProps>> = ({\n error,\n isModelLoading,\n stream,\n isTranscribing,\n transcription,\n audioLevel,\n gpuInfo,\n model,\n debug = false,\n}) => {\n return (\n <div className='p-4'>\n {error && (\n <div className='mb-4 text-red-600'>\n <strong>Error:</strong> {error}\n </div>\n )}\n {isModelLoading && (\n <div className='mb-4'>\n <div>Loading model...</div>\n <div className='text-sm text-gray-500'>This may take a few moments</div>\n </div>\n )}\n {stream ? (\n <div>\n <div className='mb-2 text-green-600'>\n <strong>Status:</strong> Microphone is active\n {debug && audioLevel && (\n <div className='mt-2 w-48 h-5 bg-gray-200 rounded-sm relative'>\n <div\n className='h-full bg-green-500 transition-all duration-100 rounded-sm'\n style={{ width: `${(audioLevel / 255) * 100}%` }}\n />\n </div>\n )}\n </div>\n {isTranscribing && <div className='mb-2 text-gray-500'>Processing audio...</div>}\n {debug && (\n <div className='mb-4 text-sm text-gray-500 space-y-1'>\n <div>Model: {model}</div>\n <div>Sample Rate: 16000 Hz</div>\n <div>Format: audio/wav</div>\n <div>Chunk Size: 10 seconds</div>\n <div>GPU: {gpuInfo || 'Not available'}</div>\n <div>Backend: WebGPU</div>\n </div>\n )}\n {transcription && (\n <div className='mt-4'>\n <strong>Transcription:</strong>\n <p className='mt-2 p-4 bg-gray-100 rounded-sm whitespace-pre-wrap'>{transcription}</p>\n </div>\n )}\n </div>\n ) : (\n <div>{!isModelLoading && !error && <div className='text-gray-500'>Microphone is inactive</div>}</div>\n )}\n </div>\n );\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useState } from 'react';\n\nimport { log } from '@dxos/log';\n\nimport { useAudioStream, usePipeline } from '#hooks';\n\nimport { DebugInfo } from './DebugInfo.tsx';\n\nexport type VoiceProps = {\n active?: boolean;\n debug?: boolean;\n model?: string;\n};\n\nexport const Voice = ({ active, debug, model = 'Xenova/whisper-base' }: VoiceProps) => {\n const [isTranscribing, setIsTranscribing] = useState(false);\n const [transcription, setTranscription] = useState<string>('');\n\n const {\n transcribe,\n gpuInfo,\n isLoaded: isModelLoaded,\n isLoading: isModelLoading,\n error: pipelineError,\n } = usePipeline({ active, debug, model });\n\n const {\n stream,\n error: audioError,\n audioLevel,\n } = useAudioStream({\n active,\n debug,\n // onAudioData: handleAudioData\n });\n\n const handleAudioData = useCallback(\n async (audioData: Float32Array) => {\n if (!isModelLoaded) {\n return;\n }\n\n if (isTranscribing) {\n return;\n }\n\n setIsTranscribing(true);\n try {\n const result = await transcribe(audioData, {\n sampling_rate: 16000,\n chunk_length_s: 5,\n stride_length_s: 1,\n return_timestamps: false,\n language: 'english',\n });\n\n if (result?.text?.trim()) {\n setTranscription((prev) => prev + ' ' + result.text);\n }\n } catch (err) {\n log.error('transcription error', { err });\n throw err;\n } finally {\n setIsTranscribing(false);\n }\n },\n [transcribe, isTranscribing],\n );\n log.info('handleAudioData', { handleAudioData });\n\n useEffect(() => {\n if (debug) {\n log.info('audio state', {\n hasStream: !!stream,\n audioError,\n audioLevel,\n shouldBeActive: active && isModelLoaded,\n });\n }\n }, [debug, stream, audioError, audioLevel, active, isModelLoaded]);\n\n useEffect(() => {\n if (debug) {\n log.info('transcription state', {\n active,\n isModelLoaded,\n isModelLoading,\n isTranscribing,\n pipelineError,\n });\n }\n }, [active, debug, isModelLoaded, isModelLoading, pipelineError, isTranscribing]);\n\n return (\n <DebugInfo\n error={audioError || pipelineError || undefined}\n isModelLoading={isModelLoading}\n stream={stream}\n isTranscribing={isTranscribing}\n transcription={transcription}\n audioLevel={audioLevel}\n gpuInfo={gpuInfo}\n model={model}\n debug={debug}\n />\n );\n};\n"],"mappings":";;;;;AAkBA,IAAa,aAA0C,EACrD,OACA,gBACA,QACA,gBACA,eACA,YACA,SACA,OACA,QAAQ,YACJ;CACJ,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACG,SACC,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,oBAAC,UAAD,EAAA,UAAQ,SAAc,CAAA;KAAC;KAAE;IACtB;;GAEN,kBACC,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,mBAAqB,CAAA,GAC1B,oBAAC,OAAD;KAAK,WAAU;KAAwB,UAAA;IAAgC,CAAA,CACpE;;GAEN,SACC,qBAAC,OAAD,EAAA,UAAA;IACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,oBAAC,UAAD,EAAA,UAAQ,UAAe,CAAA;MAAC;MACvB,SAAS,cACR,oBAAC,OAAD;OAAK,WAAU;OACb,UAAA,oBAAC,OAAD;QACE,WAAU;QACV,OAAO,EAAE,OAAO,GAAI,aAAa,MAAO,IAAI,GAAG;OAChD,CAAA;MACE,CAAA;KAEJ;;IACJ,kBAAkB,oBAAC,OAAD;KAAK,WAAU;KAAqB,UAAA;IAAwB,CAAA;IAC9E,SACC,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,qBAAC,OAAD,EAAA,UAAA,CAAK,WAAQ,KAAW,EAAA,CAAA;MACxB,oBAAC,OAAD,EAAA,UAAK,wBAA0B,CAAA;MAC/B,oBAAC,OAAD,EAAA,UAAK,oBAAsB,CAAA;MAC3B,oBAAC,OAAD,EAAA,UAAK,yBAA2B,CAAA;MAChC,qBAAC,OAAD,EAAA,UAAA,CA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C7B;CACA,IAAI,KAAK,mBAAmB,EAAE,gBAAgB,GAAA;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA,KAAA;CAAA,CAAC;CAE/C,gBAAgB;EACd,IAAI,OACF,IAAI,KAAK,eAAe;GACtB,WAAW,CAAC,CAAC;GACb;GACA;GACA,gBAAgB,UAAU;EAC5B,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;CAEL,GAAG;EAAC;EAAO;EAAQ;EAAY;EAAY;EAAQ;CAAa,CAAC;CAEjE,gBAAgB;EACd,IAAI,OACF,IAAI,KAAK,uBAAuB;GAC9B;GACA;GACA;GACA;GACA;EACF,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;CAEL,GAAG;EAAC;EAAQ;EAAO;EAAe;EAAgB;EAAe;CAAc,CAAC;CAEhF,OACE,oBAAC,WAAD;EACE,OAAO,cAAc,iBAAiB,KAAA;EACtB;EACR;EACQ;EACD;EACH;EACH;EACF;EACA;CACR,CAAA;AAEL"}
|
package/dist/lib/index.mjs
CHANGED
package/dist/lib/meta.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.transformer',\n name: 'Transformer',\n author: 'DXOS',\n description: trim`\n Browser-based machine learning plugin that runs Hugging Face Transformers.js models\n entirely in-browser via WebAssembly and WebGPU — no server-side inference required.\n\n Provides automatic speech recognition through a Whisper pipeline hook (usePipeline)\n and a microphone capture hook (useAudioStream) that buffers 16 kHz mono audio into\n 2-second chunks before forwarding them to the model.\n\n Exposes a Voice component that wires the two hooks together to deliver live\n transcription, accumulating the running transcript in local state and rendering\n a debug panel with model status, GPU info, and audio level visualisation.\n\n Includes a RAG embedding pipeline base class for retrieval-augmented generation\n experiments, with cosine similarity ranking for selecting the most relevant\n knowledge-base contexts before text generation.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',\n icon: { key: 'ph--cpu--regular' },\n spec: 'PLUGIN.mdl',\n tags: ['labs'],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;;;;;;;;;;CAgBjB,QAAQ;CACR,MAAM,EAAE,KAAK,mBAAmB;CAChC,MAAM;CACN,MAAM,CAAC,MAAM;AACf,EACF,CAAC;;;ACzBD,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
|
|
1
|
+
{"version":3,"file":"meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.transformer',\n name: 'Transformer',\n author: 'DXOS',\n description: trim`\n Browser-based machine learning plugin that runs Hugging Face Transformers.js models\n entirely in-browser via WebAssembly and WebGPU — no server-side inference required.\n\n Provides automatic speech recognition through a Whisper pipeline hook (usePipeline)\n and a microphone capture hook (useAudioStream) that buffers 16 kHz mono audio into\n 2-second chunks before forwarding them to the model.\n\n Exposes a Voice component that wires the two hooks together to deliver live\n transcription, accumulating the running transcript in local state and rendering\n a debug panel with model status, GPU info, and audio level visualisation.\n\n Includes a RAG embedding pipeline base class for retrieval-augmented generation\n experiments, with cosine similarity ranking for selecting the most relevant\n knowledge-base contexts before text generation.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',\n icon: { key: 'ph--cpu--regular' },\n spec: 'PLUGIN.mdl',\n tags: ['labs'],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\n\nimport config from '../dx.config.ts';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;;;;;;;;;;CAgBjB,QAAQ;CACR,MAAM,EAAE,KAAK,mBAAmB;CAChC,MAAM;CACN,MAAM,CAAC,MAAM;AACf,EACF,CAAC;;;ACzBD,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
|
package/dist/lib/plugin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Plugin from "@dxos/app-framework/Plugin";
|
|
2
1
|
import { meta } from "#meta";
|
|
2
|
+
import * as Plugin from "@dxos/app-framework/Plugin";
|
|
3
3
|
import { PluginAsset, Schema, Translations } from "#capabilities";
|
|
4
4
|
//#region src/plugin.tsx
|
|
5
5
|
var TransformerPlugin = Plugin.define(meta).pipe(Plugin.addModule(PluginAsset), Plugin.addModule(Schema), Plugin.addModule(Translations), Plugin.make);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.mjs","names":[],"sources":["../../src/translations.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport
|
|
1
|
+
{"version":3,"file":"translations.mjs","names":[],"sources":["../../src/translations.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport type * as Theme from '@dxos/react-ui/Theme';\n\nimport { meta } from '#meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.profile.key]: {\n 'plugin.name': 'Transformers',\n },\n },\n },\n] as const satisfies Theme.Resource[];\n"],"mappings":";;AAQA,IAAa,eAAe,CAC1B,EACE,SAAS,GACN,KAAK,QAAQ,MAAM,EAClB,eAAe,eACjB,EACF,EACF,CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const PluginAsset: import("@dxos/app-framework/Capability").Module<void>;
|
|
2
|
+
export declare const Schema: import("@dxos/app-framework/Capability").Module<void>;
|
|
3
|
+
export declare const Translations: import("@dxos/app-framework/Capability").Module<void>;
|
|
4
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/gen/browser.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,uDAKtB,CAAC;AAEH,eAAO,MAAM,MAAM,uDAA2B,CAAC;AAE/C,eAAO,MAAM,YAAY,uDAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/gen/node.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM,uDAA2B,CAAC;AAE/C,eAAO,MAAM,YAAY,uDAA2C,CAAC;AAErE,eAAO,MAAM,WAAW,WAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const PluginAsset: import("@dxos/app-framework/Capability").Module<void>;
|
|
2
|
+
export declare const Schema: import("@dxos/app-framework/Capability").Module<void>;
|
|
3
|
+
export declare const Translations: import("@dxos/app-framework/Capability").Module<void>;
|
|
4
|
+
//# sourceMappingURL=tauri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/gen/tauri.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,uDAKtB,CAAC;AAEH,eAAO,MAAM,MAAM,uDAA2B,CAAC;AAE/C,eAAO,MAAM,YAAY,uDAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerd.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/gen/workerd.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM,uDAA2B,CAAC;AAE/C,eAAO,MAAM,YAAY,uDAA2C,CAAC;AAErE,eAAO,MAAM,WAAW,WAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Voice.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Voice/Voice.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Voice.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Voice/Voice.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,QAAA,MAAM,IAAI;;;;;QAKN,MAAM;;CAEoB,CAAC;eAEhB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './DebugInfo';
|
|
2
|
-
export * from './Voice';
|
|
1
|
+
export * from './DebugInfo.tsx';
|
|
2
|
+
export * from './Voice.tsx';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Voice/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Voice/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Voice';
|
|
1
|
+
export * from './Voice/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './useAudioStream';
|
|
2
|
-
export * from './usePipeline';
|
|
1
|
+
export * from './useAudioStream.ts';
|
|
2
|
+
export * from './usePipeline.ts';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,iBAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/testing/node-pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"node-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/testing/node-pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAElE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAS;IAE1B,YAAY,cAAc,SAA4B,EAAE,SAAS,SAAoB,EAIpF;IAED,UAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAIpF;IAED,UAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,kIAM1C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/testing/web-pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"web-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/testing/web-pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAOlE;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAS;IAE1B,YAAY,cAAc,SAA4B,EAAE,SAAS,SAAsB,EAItF;IAED,UAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAOpF;IAED,UAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,kIAS1C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,eAAO,MAAM,YAAY;;QAGnB,SAAA,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;oCACD,cAAc;UAC9B;;
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,eAAO,MAAM,YAAY;;QAGnB,SAAA,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;oCACD,cAAc;UAC9B;;EAG8B,CAAC"}
|