@dxos/plugin-transformer 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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 +8 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +8 -6
- 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 +1 -1
- package/dist/types/src/TransformerPlugin.d.ts.map +1 -1
- package/dist/types/src/components/Voice.d.ts.map +1 -1
- package/dist/types/src/components/Voice.stories.d.ts +9 -3
- package/dist/types/src/components/Voice.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -31
- package/src/TransformerPlugin.tsx +23 -24
- package/src/components/DebugInfo.tsx +2 -2
- package/src/components/Voice.stories.tsx +5 -7
- package/src/components/Voice.tsx +3 -2
- package/src/hooks/useAudioStream.ts +2 -2
- package/src/hooks/usePipeline.ts +2 -2
- package/src/meta.ts +6 -4
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.fffef41",
|
|
4
4
|
"description": "Client transformer",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
17
18
|
"./types": {
|
|
19
|
+
"source": "./src/types/index.ts",
|
|
18
20
|
"types": "./dist/types/src/types/index.d.ts",
|
|
19
21
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
20
22
|
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
@@ -35,43 +37,42 @@
|
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@huggingface/transformers": "^3.3.3",
|
|
37
39
|
"@preact-signals/safe-react": "^0.9.0",
|
|
38
|
-
"@preact/signals-core": "^1.
|
|
40
|
+
"@preact/signals-core": "^1.12.1",
|
|
39
41
|
"date-fns": "^3.3.1",
|
|
40
|
-
"effect": "3.
|
|
41
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
42
|
-
"@dxos/async": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/plugin-
|
|
50
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
55
|
-
"@dxos/util": "0.8.4-main.f9ba587"
|
|
42
|
+
"effect": "3.18.3",
|
|
43
|
+
"@dxos/app-framework": "0.8.4-main.fffef41",
|
|
44
|
+
"@dxos/async": "0.8.4-main.fffef41",
|
|
45
|
+
"@dxos/display-name": "0.8.4-main.fffef41",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.fffef41",
|
|
47
|
+
"@dxos/invariant": "0.8.4-main.fffef41",
|
|
48
|
+
"@dxos/live-object": "0.8.4-main.fffef41",
|
|
49
|
+
"@dxos/log": "0.8.4-main.fffef41",
|
|
50
|
+
"@dxos/plugin-client": "0.8.4-main.fffef41",
|
|
51
|
+
"@dxos/plugin-space": "0.8.4-main.fffef41",
|
|
52
|
+
"@dxos/plugin-graph": "0.8.4-main.fffef41",
|
|
53
|
+
"@dxos/react-client": "0.8.4-main.fffef41",
|
|
54
|
+
"@dxos/react-ui-attention": "0.8.4-main.fffef41",
|
|
55
|
+
"@dxos/util": "0.8.4-main.fffef41",
|
|
56
|
+
"@dxos/react-ui-stack": "0.8.4-main.fffef41"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@types/react": "~
|
|
59
|
-
"@types/react-dom": "~
|
|
59
|
+
"@types/react": "~19.2.2",
|
|
60
|
+
"@types/react-dom": "~19.2.2",
|
|
60
61
|
"@xenova/transformers": "^2.17.2",
|
|
61
|
-
"react": "~
|
|
62
|
-
"react-dom": "~
|
|
63
|
-
"vite": "
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
67
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
62
|
+
"react": "~19.2.0",
|
|
63
|
+
"react-dom": "~19.2.0",
|
|
64
|
+
"vite": "7.1.9",
|
|
65
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
66
|
+
"@dxos/random": "0.8.4-main.fffef41",
|
|
67
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41",
|
|
68
|
+
"@dxos/storybook-utils": "0.8.4-main.fffef41"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"effect": "^3.13.3",
|
|
71
|
-
"react": "
|
|
72
|
-
"react-dom": "
|
|
73
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
74
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
72
|
+
"react": "^19.0.0",
|
|
73
|
+
"react-dom": "^19.0.0",
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
75
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41"
|
|
75
76
|
},
|
|
76
77
|
"publishConfig": {
|
|
77
78
|
"access": "public"
|
|
@@ -2,33 +2,32 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, defineModule, definePlugin
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
7
7
|
|
|
8
8
|
// import { IntentResolver } from './capabilities';
|
|
9
9
|
import { meta } from './meta';
|
|
10
10
|
import { translations } from './translations';
|
|
11
11
|
|
|
12
|
-
export const TransformerPlugin = () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]);
|
|
12
|
+
export const TransformerPlugin = definePlugin(meta, () => [
|
|
13
|
+
defineModule({
|
|
14
|
+
id: `${meta.id}/module/translations`,
|
|
15
|
+
activatesOn: Events.SetupTranslations,
|
|
16
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
17
|
+
}),
|
|
18
|
+
defineModule({
|
|
19
|
+
id: `${meta.id}/module/metadata`,
|
|
20
|
+
activatesOn: Events.SetupMetadata,
|
|
21
|
+
activate: () => [],
|
|
22
|
+
}),
|
|
23
|
+
defineModule({
|
|
24
|
+
id: `${meta.id}/module/schema`,
|
|
25
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
26
|
+
activate: () => contributes(ClientCapabilities.Schema, []),
|
|
27
|
+
}),
|
|
28
|
+
// defineModule({
|
|
29
|
+
// id: `${meta.id}/module/intent-resolver`,
|
|
30
|
+
// activatesOn: Events.SetupIntentResolver,
|
|
31
|
+
// activate: IntentResolver,
|
|
32
|
+
// }),
|
|
33
|
+
]);
|
|
@@ -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 is-48 bs-5 bg-gray-200 rounded relative'>
|
|
49
49
|
<div
|
|
50
|
-
className='
|
|
50
|
+
className='bs-full bg-green-500 transition-all duration-100 rounded'
|
|
51
51
|
style={{ width: `${(audioLevel / 255) * 100}%` }}
|
|
52
52
|
/>
|
|
53
53
|
</div>
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
7
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
10
8
|
|
|
11
9
|
import { Voice } from './Voice';
|
|
12
10
|
|
|
13
|
-
const meta
|
|
11
|
+
const meta = {
|
|
14
12
|
title: 'plugins/plugin-transformer/Voice',
|
|
15
13
|
component: Voice,
|
|
16
|
-
decorators: [withTheme
|
|
14
|
+
decorators: [withTheme],
|
|
17
15
|
parameters: {
|
|
18
16
|
layout: 'centered',
|
|
19
17
|
},
|
|
20
|
-
}
|
|
18
|
+
} satisfies Meta<typeof Voice>;
|
|
21
19
|
|
|
22
20
|
export default meta;
|
|
23
21
|
|
package/src/components/Voice.tsx
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
|
|
9
|
-
import { DebugInfo } from './DebugInfo';
|
|
10
9
|
import { useAudioStream, usePipeline } from '../hooks';
|
|
11
10
|
|
|
11
|
+
import { DebugInfo } from './DebugInfo';
|
|
12
|
+
|
|
12
13
|
export type VoiceProps = {
|
|
13
14
|
active?: boolean;
|
|
14
15
|
debug?: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ export const useAudioStream = ({ active, debug, onAudioData }: AudioStreamConfig
|
|
|
28
28
|
// TODO(burdon): Convert to class.
|
|
29
29
|
const audioContextRef = useRef<AudioContext | null>(null);
|
|
30
30
|
const analyserRef = useRef<AnalyserNode | null>(null);
|
|
31
|
-
const animationFrameRef = useRef<number>();
|
|
31
|
+
const animationFrameRef = useRef<number>(undefined);
|
|
32
32
|
const workletNodeRef = useRef<AudioWorkletNode | null>(null);
|
|
33
33
|
const isProcessingRef = useRef(false);
|
|
34
34
|
const mediaStreamRef = useRef<MediaStream | null>(null);
|
package/src/hooks/usePipeline.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Pipeline,
|
|
6
|
-
import {
|
|
5
|
+
import { type Pipeline, env, pipeline } from '@xenova/transformers';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { log } from '@dxos/log';
|
package/src/meta.ts
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const TRANSFORMER_PLUGIN = 'dxos.org/plugin/transformer';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/transformer',
|
|
11
10
|
name: 'Transformer',
|
|
12
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Execute local machine learning transformers and AI models directly in your browser.
|
|
13
|
+
Run embeddings, classifications, and other ML tasks without server dependencies.
|
|
14
|
+
`,
|
|
13
15
|
icon: 'ph--cpu--regular',
|
|
14
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',
|
|
15
17
|
tags: ['labs'],
|