@dxos/plugin-transformer 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
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/lib/browser/index.mjs +12 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +12 -9
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/TransformerPlugin.d.ts.map +1 -1
- package/dist/types/src/components/Voice/DebugInfo.d.ts.map +1 -0
- package/dist/types/src/components/Voice/Voice.d.ts.map +1 -0
- package/dist/types/src/components/Voice/Voice.stories.d.ts.map +1 -0
- package/dist/types/src/components/Voice/index.d.ts +3 -0
- package/dist/types/src/components/Voice/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/hooks/usePipeline.d.ts +0 -15
- package/dist/types/src/hooks/usePipeline.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -26
- package/src/TransformerPlugin.tsx +6 -4
- package/src/components/{DebugInfo.tsx → Voice/DebugInfo.tsx} +3 -3
- package/src/components/{Voice.stories.tsx → Voice/Voice.stories.tsx} +2 -2
- package/src/components/{Voice.tsx → Voice/Voice.tsx} +1 -1
- package/src/components/Voice/index.ts +6 -0
- package/src/{capabilities → components}/index.ts +2 -0
- package/src/hooks/usePipeline.ts +9 -33
- package/src/meta.ts +1 -1
- package/src/translations.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +0 -1
- package/dist/types/src/components/DebugInfo.d.ts.map +0 -1
- package/dist/types/src/components/Voice.d.ts.map +0 -1
- package/dist/types/src/components/Voice.stories.d.ts.map +0 -1
- /package/dist/types/src/components/{DebugInfo.d.ts → Voice/DebugInfo.d.ts} +0 -0
- /package/dist/types/src/components/{Voice.d.ts → Voice/Voice.d.ts} +0 -0
- /package/dist/types/src/components/{Voice.stories.d.ts → Voice/Voice.stories.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-transformer",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.9be5663bfe",
|
|
4
4
|
"description": "Client transformer",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#components": "./src/components/index.ts",
|
|
17
|
+
"#hooks": "./src/hooks/index.ts",
|
|
18
|
+
"#meta": "./src/meta.ts",
|
|
19
|
+
"#types": "./src/types/index.ts"
|
|
20
|
+
},
|
|
15
21
|
"exports": {
|
|
16
22
|
".": {
|
|
17
23
|
"source": "./src/index.ts",
|
|
@@ -39,23 +45,24 @@
|
|
|
39
45
|
"src"
|
|
40
46
|
],
|
|
41
47
|
"dependencies": {
|
|
42
|
-
"@huggingface/transformers": "^3.
|
|
43
|
-
"date-fns": "^3.
|
|
44
|
-
"effect": "3.
|
|
45
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
46
|
-
"@dxos/async": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/plugin-
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/react-
|
|
58
|
-
"@dxos/
|
|
48
|
+
"@huggingface/transformers": "^3.8.1",
|
|
49
|
+
"date-fns": "^3.6.0",
|
|
50
|
+
"effect": "3.20.0",
|
|
51
|
+
"@dxos/app-framework": "0.8.4-main.9be5663bfe",
|
|
52
|
+
"@dxos/async": "0.8.4-main.9be5663bfe",
|
|
53
|
+
"@dxos/app-toolkit": "0.8.4-main.9be5663bfe",
|
|
54
|
+
"@dxos/display-name": "0.8.4-main.9be5663bfe",
|
|
55
|
+
"@dxos/invariant": "0.8.4-main.9be5663bfe",
|
|
56
|
+
"@dxos/echo": "0.8.4-main.9be5663bfe",
|
|
57
|
+
"@dxos/log": "0.8.4-main.9be5663bfe",
|
|
58
|
+
"@dxos/plugin-client": "0.8.4-main.9be5663bfe",
|
|
59
|
+
"@dxos/plugin-space": "0.8.4-main.9be5663bfe",
|
|
60
|
+
"@dxos/plugin-graph": "0.8.4-main.9be5663bfe",
|
|
61
|
+
"@dxos/operation": "0.8.4-main.9be5663bfe",
|
|
62
|
+
"@dxos/react-ui-attention": "0.8.4-main.9be5663bfe",
|
|
63
|
+
"@dxos/react-client": "0.8.4-main.9be5663bfe",
|
|
64
|
+
"@dxos/react-ui-stack": "0.8.4-main.9be5663bfe",
|
|
65
|
+
"@dxos/util": "0.8.4-main.9be5663bfe"
|
|
59
66
|
},
|
|
60
67
|
"devDependencies": {
|
|
61
68
|
"@types/react": "~19.2.7",
|
|
@@ -63,18 +70,18 @@
|
|
|
63
70
|
"@xenova/transformers": "^2.17.2",
|
|
64
71
|
"react": "~19.2.3",
|
|
65
72
|
"react-dom": "~19.2.3",
|
|
66
|
-
"vite": "7.1.
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
73
|
+
"vite": "^7.1.11",
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.9be5663bfe",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.9be5663bfe",
|
|
76
|
+
"@dxos/random": "0.8.4-main.9be5663bfe",
|
|
77
|
+
"@dxos/ui-theme": "0.8.4-main.9be5663bfe"
|
|
71
78
|
},
|
|
72
79
|
"peerDependencies": {
|
|
73
|
-
"effect": "3.
|
|
80
|
+
"effect": "3.20.0",
|
|
74
81
|
"react": "~19.2.3",
|
|
75
82
|
"react-dom": "~19.2.3",
|
|
76
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
77
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
83
|
+
"@dxos/react-ui": "0.8.4-main.9be5663bfe",
|
|
84
|
+
"@dxos/ui-theme": "0.8.4-main.9be5663bfe"
|
|
78
85
|
},
|
|
79
86
|
"publishConfig": {
|
|
80
87
|
"access": "public"
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
// import { IntentResolver } from './capabilities';
|
|
8
|
-
import { meta } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
|
|
9
11
|
import { translations } from './translations';
|
|
10
12
|
|
|
11
13
|
export const TransformerPlugin = Plugin.define(meta).pipe(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
AppPlugin.addSchemaModule({ schema: [], id: 'schema' }),
|
|
15
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
14
16
|
// Plugin.addModule({
|
|
15
17
|
// id: 'intent-resolver',
|
|
16
18
|
// activatesOn: Events.SetupIntentResolver,
|
|
@@ -45,9 +45,9 @@ export const DebugInfo: FC<Partial<DebugInfoProps>> = ({
|
|
|
45
45
|
<div className='mb-2 text-green-600'>
|
|
46
46
|
<strong>Status:</strong> Microphone is active
|
|
47
47
|
{debug && audioLevel && (
|
|
48
|
-
<div className='mt-2
|
|
48
|
+
<div className='mt-2 w-48 h-5 bg-gray-200 rounded-sm relative'>
|
|
49
49
|
<div
|
|
50
|
-
className='
|
|
50
|
+
className='h-full bg-green-500 transition-all duration-100 rounded-sm'
|
|
51
51
|
style={{ width: `${(audioLevel / 255) * 100}%` }}
|
|
52
52
|
/>
|
|
53
53
|
</div>
|
|
@@ -67,7 +67,7 @@ export const DebugInfo: FC<Partial<DebugInfoProps>> = ({
|
|
|
67
67
|
{transcription && (
|
|
68
68
|
<div className='mt-4'>
|
|
69
69
|
<strong>Transcription:</strong>
|
|
70
|
-
<p className='mt-2 p-4 bg-gray-100 rounded whitespace-pre-wrap'>{transcription}</p>
|
|
70
|
+
<p className='mt-2 p-4 bg-gray-100 rounded-sm whitespace-pre-wrap'>{transcription}</p>
|
|
71
71
|
</div>
|
|
72
72
|
)}
|
|
73
73
|
</div>
|
|
@@ -9,9 +9,9 @@ import { withTheme } from '@dxos/react-ui/testing';
|
|
|
9
9
|
import { Voice } from './Voice';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title: 'plugins/plugin-transformer/Voice',
|
|
12
|
+
title: 'plugins/plugin-transformer/components/Voice',
|
|
13
13
|
component: Voice,
|
|
14
|
-
decorators: [withTheme],
|
|
14
|
+
decorators: [withTheme()],
|
|
15
15
|
parameters: {
|
|
16
16
|
layout: 'centered',
|
|
17
17
|
},
|
|
@@ -6,7 +6,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
|
|
9
|
-
import { useAudioStream, usePipeline } from '
|
|
9
|
+
import { useAudioStream, usePipeline } from '#hooks';
|
|
10
10
|
|
|
11
11
|
import { DebugInfo } from './DebugInfo';
|
|
12
12
|
|
package/src/hooks/usePipeline.ts
CHANGED
|
@@ -8,25 +8,6 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
|
|
11
|
-
// Add WebGPU types.
|
|
12
|
-
declare global {
|
|
13
|
-
interface Navigator {
|
|
14
|
-
gpu?: {
|
|
15
|
-
requestAdapter(): Promise<GPUAdapter | null>;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface GPUAdapter {
|
|
20
|
-
requestAdapterInfo(): Promise<GPUAdapterInfo>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface GPUAdapterInfo {
|
|
24
|
-
vendor: string;
|
|
25
|
-
architecture: string;
|
|
26
|
-
description: string;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
11
|
// Configure cache and runtime settings.
|
|
31
12
|
env.cacheDir = './.cache';
|
|
32
13
|
env.allowLocalModels = true;
|
|
@@ -87,20 +68,15 @@ export const usePipeline = ({ active, model, debug }: PipelineConfig) => {
|
|
|
87
68
|
throw new Error('No GPU adapter found');
|
|
88
69
|
}
|
|
89
70
|
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
setState((prev) => ({ ...prev, gpuInfo: 'GPU Available (details unknown)' }));
|
|
100
|
-
}
|
|
101
|
-
} catch (err) {
|
|
102
|
-
log.warn('could not get GPU info', { err });
|
|
103
|
-
setState((prev) => ({ ...prev, gpuInfo: 'GPU Available (details unavailable)' }));
|
|
71
|
+
// Get adapter info from the info property (modern WebGPU API).
|
|
72
|
+
const adapterInfo = adapter.info;
|
|
73
|
+
if (adapterInfo) {
|
|
74
|
+
setState((prev) => ({
|
|
75
|
+
...prev,
|
|
76
|
+
gpuInfo: `${adapterInfo.description || 'GPU'} (${adapterInfo.vendor || 'Unknown'})`,
|
|
77
|
+
}));
|
|
78
|
+
} else {
|
|
79
|
+
setState((prev) => ({ ...prev, gpuInfo: 'GPU Available (details unknown)' }));
|
|
104
80
|
}
|
|
105
81
|
} catch (err) {
|
|
106
82
|
log.warn('WebGPU initialization failed', { err });
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.transformer',
|
|
10
10
|
name: 'Transformer',
|
|
11
11
|
description: trim`
|
|
12
12
|
Execute local machine learning transformers and AI models directly in your browser.
|
package/src/translations.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
13
|
+
'plugin.name': 'Transformers',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DebugInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/DebugInfo.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CA4DjD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Voice.d.ts","sourceRoot":"","sources":["../../../../src/components/Voice.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAQhE,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,0BAAkD,UAAU,sBA4FjF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Voice.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Voice.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;CAOoB,CAAC;AAE/B,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|