@dxos/plugin-transformer 0.8.3 → 0.8.4-main.03d5cd7b56
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/neutral/TransformerPlugin.mjs +25 -0
- package/dist/lib/neutral/TransformerPlugin.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BKDV4JXC.mjs +20 -0
- package/dist/lib/neutral/chunk-BKDV4JXC.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +136 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +339 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +15 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/types/src/TransformerPlugin.d.ts +3 -1
- package/dist/types/src/TransformerPlugin.d.ts.map +1 -1
- package/dist/types/src/TransformerPlugin.test.d.ts +2 -0
- package/dist/types/src/TransformerPlugin.test.d.ts.map +1 -0
- 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 +14 -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/useAudioStream.d.ts.map +1 -1
- package/dist/types/src/hooks/usePipeline.d.ts +1 -16
- package/dist/types/src/hooks/usePipeline.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- 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/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 +5 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -51
- package/src/TransformerPlugin.test.ts +25 -0
- package/src/TransformerPlugin.tsx +16 -27
- package/src/components/{DebugInfo.tsx → Voice/DebugInfo.tsx} +3 -3
- package/src/components/{Voice.stories.tsx → Voice/Voice.stories.tsx} +6 -8
- package/src/components/{Voice.tsx → Voice/Voice.tsx} +3 -2
- package/src/components/Voice/index.ts +6 -0
- package/src/{capabilities → components}/index.ts +2 -0
- package/src/hooks/useAudioStream.ts +2 -2
- package/src/hooks/usePipeline.ts +11 -35
- package/src/index.ts +0 -2
- package/src/meta.ts +8 -6
- package/src/plugin.ts +9 -0
- package/src/translations.ts +7 -5
- package/dist/lib/browser/index.mjs +0 -52
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/types/index.mjs +0 -1
- package/dist/lib/node/index.cjs +0 -71
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/types/index.cjs +0 -2
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -54
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/types/index.mjs +0 -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 +0 -8
- package/dist/types/src/components/Voice.stories.d.ts.map +0 -1
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /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/package.json
CHANGED
|
@@ -1,79 +1,105 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-transformer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.03d5cd7b56",
|
|
4
4
|
"description": "Client transformer",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#components": {
|
|
17
|
+
"source": "./src/components/index.ts",
|
|
18
|
+
"types": "./dist/types/src/components/index.d.ts",
|
|
19
|
+
"default": "./dist/lib/neutral/components/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"#hooks": {
|
|
22
|
+
"source": "./src/hooks/index.ts",
|
|
23
|
+
"types": "./dist/types/src/hooks/index.d.ts",
|
|
24
|
+
"default": "./dist/lib/neutral/hooks/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"#meta": {
|
|
27
|
+
"source": "./src/meta.ts",
|
|
28
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
29
|
+
"default": "./dist/lib/neutral/meta.mjs"
|
|
30
|
+
},
|
|
31
|
+
"#plugin": {
|
|
32
|
+
"source": "./src/TransformerPlugin.tsx",
|
|
33
|
+
"types": "./dist/types/src/TransformerPlugin.d.ts",
|
|
34
|
+
"default": "./dist/lib/neutral/TransformerPlugin.mjs"
|
|
35
|
+
},
|
|
36
|
+
"#translations": {
|
|
37
|
+
"source": "./src/translations.ts",
|
|
38
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
39
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
11
42
|
"exports": {
|
|
12
43
|
".": {
|
|
44
|
+
"source": "./src/index.ts",
|
|
13
45
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"
|
|
15
|
-
|
|
46
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./plugin": {
|
|
49
|
+
"source": "./src/plugin.ts",
|
|
50
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
51
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
16
52
|
},
|
|
17
|
-
"./
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
53
|
+
"./translations": {
|
|
54
|
+
"source": "./src/translations.ts",
|
|
55
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
56
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
21
57
|
}
|
|
22
58
|
},
|
|
23
59
|
"types": "dist/types/src/index.d.ts",
|
|
24
|
-
"typesVersions": {
|
|
25
|
-
"*": {
|
|
26
|
-
"types": [
|
|
27
|
-
"dist/types/src/types/index.d.ts"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
60
|
"files": [
|
|
32
61
|
"dist",
|
|
33
62
|
"src"
|
|
34
63
|
],
|
|
35
64
|
"dependencies": {
|
|
36
|
-
"@huggingface/transformers": "^3.
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"@dxos/app-
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/plugin-client": "0.8.
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/util": "0.8.3"
|
|
65
|
+
"@huggingface/transformers": "^3.8.1",
|
|
66
|
+
"@xenova/transformers": "^2.17.2",
|
|
67
|
+
"date-fns": "^3.6.0",
|
|
68
|
+
"effect": "3.20.0",
|
|
69
|
+
"@dxos/app-framework": "0.8.4-main.03d5cd7b56",
|
|
70
|
+
"@dxos/app-toolkit": "0.8.4-main.03d5cd7b56",
|
|
71
|
+
"@dxos/display-name": "0.8.4-main.03d5cd7b56",
|
|
72
|
+
"@dxos/echo": "0.8.4-main.03d5cd7b56",
|
|
73
|
+
"@dxos/invariant": "0.8.4-main.03d5cd7b56",
|
|
74
|
+
"@dxos/log": "0.8.4-main.03d5cd7b56",
|
|
75
|
+
"@dxos/operation": "0.8.4-main.03d5cd7b56",
|
|
76
|
+
"@dxos/async": "0.8.4-main.03d5cd7b56",
|
|
77
|
+
"@dxos/plugin-graph": "0.8.4-main.03d5cd7b56",
|
|
78
|
+
"@dxos/plugin-client": "0.8.4-main.03d5cd7b56",
|
|
79
|
+
"@dxos/plugin-space": "0.8.4-main.03d5cd7b56",
|
|
80
|
+
"@dxos/react-client": "0.8.4-main.03d5cd7b56",
|
|
81
|
+
"@dxos/react-ui-attention": "0.8.4-main.03d5cd7b56",
|
|
82
|
+
"@dxos/react-ui-stack": "0.8.4-main.03d5cd7b56",
|
|
83
|
+
"@dxos/util": "0.8.4-main.03d5cd7b56"
|
|
56
84
|
},
|
|
57
85
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@types/react": "~
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"react-
|
|
64
|
-
"
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/storybook-utils": "0.8.
|
|
68
|
-
"@dxos/react-ui": "0.8.3"
|
|
86
|
+
"@types/react": "~19.2.7",
|
|
87
|
+
"@types/react-dom": "~19.2.3",
|
|
88
|
+
"react": "~19.2.3",
|
|
89
|
+
"react-dom": "~19.2.3",
|
|
90
|
+
"vite": "^8.0.10",
|
|
91
|
+
"@dxos/react-ui": "0.8.4-main.03d5cd7b56",
|
|
92
|
+
"@dxos/random": "0.8.4-main.03d5cd7b56",
|
|
93
|
+
"@dxos/plugin-testing": "0.8.4-main.03d5cd7b56",
|
|
94
|
+
"@dxos/ui-theme": "0.8.4-main.03d5cd7b56",
|
|
95
|
+
"@dxos/storybook-utils": "0.8.4-main.03d5cd7b56"
|
|
69
96
|
},
|
|
70
97
|
"peerDependencies": {
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"react": "~
|
|
74
|
-
"react-
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui-theme": "0.8.3"
|
|
98
|
+
"effect": "3.20.0",
|
|
99
|
+
"react": "~19.2.3",
|
|
100
|
+
"react-dom": "~19.2.3",
|
|
101
|
+
"@dxos/react-ui": "0.8.4-main.03d5cd7b56",
|
|
102
|
+
"@dxos/ui-theme": "0.8.4-main.03d5cd7b56"
|
|
77
103
|
},
|
|
78
104
|
"publishConfig": {
|
|
79
105
|
"access": "public"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
8
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
9
|
+
|
|
10
|
+
import { TransformerPlugin } from '#plugin';
|
|
11
|
+
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
14
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
15
|
+
|
|
16
|
+
describe('TransformerPlugin', () => {
|
|
17
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
18
|
+
await using harness = await createComposerTestApp({
|
|
19
|
+
plugins: [ClientPlugin({}), TransformerPlugin()],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Modules expected to be active after a normal startup.
|
|
23
|
+
expect(harness.manager.getActive()).toContain(moduleId('schema'));
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -2,33 +2,22 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
|
|
8
8
|
// import { IntentResolver } from './capabilities';
|
|
9
|
-
import { meta } from '
|
|
10
|
-
import translations from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
11
|
|
|
12
|
-
export const TransformerPlugin = ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
defineModule({
|
|
25
|
-
id: `${meta.id}/module/schema`,
|
|
26
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
27
|
-
activate: () => contributes(ClientCapabilities.Schema, []),
|
|
28
|
-
}),
|
|
29
|
-
// defineModule({
|
|
30
|
-
// id: `${meta.id}/module/intent-resolver`,
|
|
31
|
-
// activatesOn: Events.SetupIntentResolver,
|
|
32
|
-
// activate: IntentResolver,
|
|
33
|
-
// }),
|
|
34
|
-
]);
|
|
12
|
+
export const TransformerPlugin = Plugin.define(meta).pipe(
|
|
13
|
+
AppPlugin.addSchemaModule({ schema: [] }),
|
|
14
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
15
|
+
// Plugin.addModule({
|
|
16
|
+
// id: 'intent-resolver',
|
|
17
|
+
// activatesOn: Events.SetupIntentResolver,
|
|
18
|
+
// activate: IntentResolver,
|
|
19
|
+
// }),
|
|
20
|
+
Plugin.make,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default TransformerPlugin;
|
|
@@ -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 w-48 h-5 bg-gray-200 rounded relative'>
|
|
48
|
+
<div className='mt-2 w-48 h-5 bg-gray-200 rounded-sm relative'>
|
|
49
49
|
<div
|
|
50
|
-
className='h-full bg-green-500 transition-all duration-100 rounded'
|
|
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>
|
|
@@ -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
|
|
14
|
-
title: 'plugins/plugin-transformer/Voice',
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'plugins/plugin-transformer/components/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
|
|
|
@@ -2,12 +2,13 @@
|
|
|
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 { useAudioStream, usePipeline } from '#hooks';
|
|
10
|
+
|
|
9
11
|
import { DebugInfo } from './DebugInfo';
|
|
10
|
-
import { useAudioStream, usePipeline } from '../hooks';
|
|
11
12
|
|
|
12
13
|
export type VoiceProps = {
|
|
13
14
|
active?: 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,31 +2,12 @@
|
|
|
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';
|
|
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/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: TRANSFORMER_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.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'],
|
package/src/plugin.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
|
|
9
|
+
export const translations = [
|
|
8
10
|
{
|
|
9
11
|
'en-US': {
|
|
10
|
-
[
|
|
11
|
-
'plugin
|
|
12
|
+
[meta.id]: {
|
|
13
|
+
'plugin.name': 'Transformers',
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
|
-
];
|
|
17
|
+
] as const satisfies Resource[];
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-transformer/src/meta.ts
|
|
2
|
-
var TRANSFORMER_PLUGIN = "dxos.org/plugin/transformer";
|
|
3
|
-
var meta = {
|
|
4
|
-
id: TRANSFORMER_PLUGIN,
|
|
5
|
-
name: "Transformer",
|
|
6
|
-
description: "Run local transformers.",
|
|
7
|
-
icon: "ph--cpu--regular",
|
|
8
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer",
|
|
9
|
-
tags: [
|
|
10
|
-
"labs"
|
|
11
|
-
]
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// packages/plugins/plugin-transformer/src/TransformerPlugin.tsx
|
|
15
|
-
import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
16
|
-
import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
|
|
17
|
-
|
|
18
|
-
// packages/plugins/plugin-transformer/src/translations.ts
|
|
19
|
-
var translations_default = [
|
|
20
|
-
{
|
|
21
|
-
"en-US": {
|
|
22
|
-
[TRANSFORMER_PLUGIN]: {
|
|
23
|
-
"plugin name": "Transformers"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
// packages/plugins/plugin-transformer/src/TransformerPlugin.tsx
|
|
30
|
-
var TransformerPlugin = () => definePlugin(meta, [
|
|
31
|
-
defineModule({
|
|
32
|
-
id: `${meta.id}/module/translations`,
|
|
33
|
-
activatesOn: Events.SetupTranslations,
|
|
34
|
-
activate: () => contributes(Capabilities.Translations, translations_default)
|
|
35
|
-
}),
|
|
36
|
-
defineModule({
|
|
37
|
-
id: `${meta.id}/module/metadata`,
|
|
38
|
-
activatesOn: Events.SetupMetadata,
|
|
39
|
-
activate: () => []
|
|
40
|
-
}),
|
|
41
|
-
defineModule({
|
|
42
|
-
id: `${meta.id}/module/schema`,
|
|
43
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
44
|
-
activate: () => contributes(ClientCapabilities.Schema, [])
|
|
45
|
-
})
|
|
46
|
-
]);
|
|
47
|
-
export {
|
|
48
|
-
TRANSFORMER_PLUGIN,
|
|
49
|
-
TransformerPlugin,
|
|
50
|
-
meta
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/TransformerPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const TRANSFORMER_PLUGIN = 'dxos.org/plugin/transformer';\n\nexport const meta: PluginMeta = {\n id: TRANSFORMER_PLUGIN,\n name: 'Transformer',\n description: 'Run local transformers.',\n icon: 'ph--cpu--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',\n tags: ['labs'],\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\n// import { IntentResolver } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\n\nexport const TransformerPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () => [],\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, []),\n }),\n // defineModule({\n // id: `${meta.id}/module/intent-resolver`,\n // activatesOn: Events.SetupIntentResolver,\n // activate: IntentResolver,\n // }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { TRANSFORMER_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [TRANSFORMER_PLUGIN]: {\n 'plugin name': 'Transformers',\n },\n },\n },\n];\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,qBAAqB;AAE3B,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;;;ACXA,SAASC,cAAcC,aAAaC,cAAcC,cAAcC,cAAc;AAC9E,SAASC,oBAAoBC,oBAAoB;;;ACCjD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,kBAAAA,GAAqB;QACpB,eAAe;MACjB;IACF;EACF;;;;ADFK,IAAMC,oBAAoB,MAC/BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAU,MAAM,CAAA;EAClB,CAAA;EACAL,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,aAAaC;IAC1BP,UAAU,MAAMC,YAAYO,mBAAmBC,QAAQ,CAAA,CAAE;EAC3D,CAAA;CAMD;",
|
|
6
|
-
"names": ["TRANSFORMER_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "Capabilities", "contributes", "defineModule", "definePlugin", "Events", "ClientCapabilities", "ClientEvents", "TRANSFORMER_PLUGIN", "TransformerPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-transformer/src/meta.ts":{"bytes":1546,"imports":[],"format":"esm"},"packages/plugins/plugin-transformer/src/translations.ts":{"bytes":1036,"imports":[{"path":"packages/plugins/plugin-transformer/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-transformer/src/TransformerPlugin.tsx":{"bytes":3915,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-transformer/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-transformer/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-transformer/src/index.ts":{"bytes":580,"imports":[{"path":"packages/plugins/plugin-transformer/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-transformer/src/TransformerPlugin.tsx","kind":"import-statement","original":"./TransformerPlugin"}],"format":"esm"},"packages/plugins/plugin-transformer/src/types/index.ts":{"bytes":393,"imports":[],"format":"esm"}},"outputs":{"packages/plugins/plugin-transformer/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3075},"packages/plugins/plugin-transformer/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"exports":["TRANSFORMER_PLUGIN","TransformerPlugin","meta"],"entryPoint":"packages/plugins/plugin-transformer/src/index.ts","inputs":{"packages/plugins/plugin-transformer/src/meta.ts":{"bytesInOutput":304},"packages/plugins/plugin-transformer/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-transformer/src/TransformerPlugin.tsx":{"bytesInOutput":704},"packages/plugins/plugin-transformer/src/translations.ts":{"bytesInOutput":137}},"bytes":1485},"packages/plugins/plugin-transformer/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-transformer/dist/lib/browser/types/index.mjs":{"imports":[],"exports":[],"entryPoint":"packages/plugins/plugin-transformer/src/types/index.ts","inputs":{"packages/plugins/plugin-transformer/src/types/index.ts":{"bytesInOutput":0}},"bytes":35}}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/lib/node/index.cjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var node_exports = {};
|
|
20
|
-
__export(node_exports, {
|
|
21
|
-
TRANSFORMER_PLUGIN: () => TRANSFORMER_PLUGIN,
|
|
22
|
-
TransformerPlugin: () => TransformerPlugin,
|
|
23
|
-
meta: () => meta
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(node_exports);
|
|
26
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
27
|
-
var import_plugin_client = require("@dxos/plugin-client");
|
|
28
|
-
var TRANSFORMER_PLUGIN = "dxos.org/plugin/transformer";
|
|
29
|
-
var meta = {
|
|
30
|
-
id: TRANSFORMER_PLUGIN,
|
|
31
|
-
name: "Transformer",
|
|
32
|
-
description: "Run local transformers.",
|
|
33
|
-
icon: "ph--cpu--regular",
|
|
34
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer",
|
|
35
|
-
tags: [
|
|
36
|
-
"labs"
|
|
37
|
-
]
|
|
38
|
-
};
|
|
39
|
-
var translations_default = [
|
|
40
|
-
{
|
|
41
|
-
"en-US": {
|
|
42
|
-
[TRANSFORMER_PLUGIN]: {
|
|
43
|
-
"plugin name": "Transformers"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
var TransformerPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
49
|
-
(0, import_app_framework.defineModule)({
|
|
50
|
-
id: `${meta.id}/module/translations`,
|
|
51
|
-
activatesOn: import_app_framework.Events.SetupTranslations,
|
|
52
|
-
activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, translations_default)
|
|
53
|
-
}),
|
|
54
|
-
(0, import_app_framework.defineModule)({
|
|
55
|
-
id: `${meta.id}/module/metadata`,
|
|
56
|
-
activatesOn: import_app_framework.Events.SetupMetadata,
|
|
57
|
-
activate: () => []
|
|
58
|
-
}),
|
|
59
|
-
(0, import_app_framework.defineModule)({
|
|
60
|
-
id: `${meta.id}/module/schema`,
|
|
61
|
-
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
62
|
-
activate: () => (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [])
|
|
63
|
-
})
|
|
64
|
-
]);
|
|
65
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
-
0 && (module.exports = {
|
|
67
|
-
TRANSFORMER_PLUGIN,
|
|
68
|
-
TransformerPlugin,
|
|
69
|
-
meta
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/TransformerPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const TRANSFORMER_PLUGIN = 'dxos.org/plugin/transformer';\n\nexport const meta: PluginMeta = {\n id: TRANSFORMER_PLUGIN,\n name: 'Transformer',\n description: 'Run local transformers.',\n icon: 'ph--cpu--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',\n tags: ['labs'],\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\n// import { IntentResolver } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\n\nexport const TransformerPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () => [],\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, []),\n }),\n // defineModule({\n // id: `${meta.id}/module/intent-resolver`,\n // activatesOn: Events.SetupIntentResolver,\n // activate: IntentResolver,\n // }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { TRANSFORMER_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [TRANSFORMER_PLUGIN]: {\n 'plugin name': 'Transformers',\n },\n },\n },\n];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;ACIA,2BAA8E;AAC9E,2BAAiD;ADC1C,IAAMA,qBAAqB;AAE3B,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;AETA,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACP,kBAAAA,GAAqB;QACpB,eAAe;MACjB;IACF;EACF;;ADFK,IAAMQ,oBAAoB,UAC/BC,mCAAaR,MAAM;MACjBS,mCAAa;IACXR,IAAI,GAAGD,KAAKC,EAAE;IACdS,aAAaC,4BAAOC;IACpBC,UAAU,UAAMC,kCAAYC,kCAAaC,cAAcC,oBAAAA;EACzD,CAAA;MACAR,mCAAa;IACXR,IAAI,GAAGD,KAAKC,EAAE;IACdS,aAAaC,4BAAOO;IACpBL,UAAU,MAAM,CAAA;EAClB,CAAA;MACAJ,mCAAa;IACXR,IAAI,GAAGD,KAAKC,EAAE;IACdS,aAAaS,kCAAaC;IAC1BP,UAAU,UAAMC,kCAAYO,wCAAmBC,QAAQ,CAAA,CAAE;EAC3D,CAAA;CAMD;",
|
|
6
|
-
"names": ["TRANSFORMER_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "TransformerPlugin", "definePlugin", "defineModule", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema"]
|
|
7
|
-
}
|