@dxos/plugin-transformer 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +326 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/TransformerPlugin.mjs +38 -0
  5. package/dist/lib/neutral/TransformerPlugin.mjs.map +7 -0
  6. package/dist/lib/neutral/chunk-SFEKXMAC.mjs +36 -0
  7. package/dist/lib/neutral/chunk-SFEKXMAC.mjs.map +7 -0
  8. package/dist/lib/neutral/components/index.mjs +136 -0
  9. package/dist/lib/neutral/components/index.mjs.map +7 -0
  10. package/dist/lib/neutral/hooks/index.mjs +339 -0
  11. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  12. package/dist/lib/neutral/index.mjs +7 -0
  13. package/dist/lib/neutral/meta.json +1 -0
  14. package/dist/lib/neutral/meta.mjs +7 -0
  15. package/dist/lib/neutral/plugin.mjs +11 -0
  16. package/dist/lib/neutral/plugin.mjs.map +7 -0
  17. package/dist/lib/neutral/translations.mjs +15 -0
  18. package/dist/lib/neutral/translations.mjs.map +7 -0
  19. package/dist/types/src/TransformerPlugin.d.ts +3 -1
  20. package/dist/types/src/TransformerPlugin.d.ts.map +1 -1
  21. package/dist/types/src/TransformerPlugin.test.d.ts +2 -0
  22. package/dist/types/src/TransformerPlugin.test.d.ts.map +1 -0
  23. package/dist/types/src/components/Voice/DebugInfo.d.ts.map +1 -0
  24. package/dist/types/src/components/Voice/Voice.d.ts.map +1 -0
  25. package/dist/types/src/components/Voice/Voice.stories.d.ts +14 -0
  26. package/dist/types/src/components/Voice/Voice.stories.d.ts.map +1 -0
  27. package/dist/types/src/components/Voice/index.d.ts +3 -0
  28. package/dist/types/src/components/Voice/index.d.ts.map +1 -0
  29. package/dist/types/src/components/index.d.ts +2 -0
  30. package/dist/types/src/components/index.d.ts.map +1 -0
  31. package/dist/types/src/hooks/useAudioStream.d.ts.map +1 -1
  32. package/dist/types/src/hooks/usePipeline.d.ts +1 -16
  33. package/dist/types/src/hooks/usePipeline.d.ts.map +1 -1
  34. package/dist/types/src/index.d.ts +0 -1
  35. package/dist/types/src/index.d.ts.map +1 -1
  36. package/dist/types/src/meta.d.ts +2 -3
  37. package/dist/types/src/meta.d.ts.map +1 -1
  38. package/dist/types/src/plugin.d.ts +3 -0
  39. package/dist/types/src/plugin.d.ts.map +1 -0
  40. package/dist/types/src/testing/node-pipeline.d.ts +1 -1
  41. package/dist/types/src/testing/node-pipeline.d.ts.map +1 -1
  42. package/dist/types/src/testing/pipeline.d.ts.map +1 -1
  43. package/dist/types/src/testing/web-pipeline.d.ts +1 -1
  44. package/dist/types/src/testing/web-pipeline.d.ts.map +1 -1
  45. package/dist/types/src/translations.d.ts +2 -3
  46. package/dist/types/src/translations.d.ts.map +1 -1
  47. package/dist/types/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +71 -52
  49. package/src/TransformerPlugin.test.ts +25 -0
  50. package/src/TransformerPlugin.tsx +22 -27
  51. package/src/components/{DebugInfo.tsx → Voice/DebugInfo.tsx} +3 -3
  52. package/src/components/{Voice.stories.tsx → Voice/Voice.stories.tsx} +6 -8
  53. package/src/components/{Voice.tsx → Voice/Voice.tsx} +1 -1
  54. package/src/components/Voice/index.ts +6 -0
  55. package/src/{capabilities → components}/index.ts +2 -0
  56. package/src/hooks/useAudioStream.ts +1 -1
  57. package/src/hooks/usePipeline.ts +9 -33
  58. package/src/index.ts +0 -2
  59. package/src/meta.ts +24 -7
  60. package/src/plugin.ts +9 -0
  61. package/src/translations.ts +2 -2
  62. package/src/vite-env.d.ts +10 -0
  63. package/dist/lib/browser/index.mjs +0 -52
  64. package/dist/lib/browser/index.mjs.map +0 -7
  65. package/dist/lib/browser/meta.json +0 -1
  66. package/dist/lib/browser/types/index.mjs +0 -1
  67. package/dist/lib/node-esm/index.mjs +0 -54
  68. package/dist/lib/node-esm/index.mjs.map +0 -7
  69. package/dist/lib/node-esm/meta.json +0 -1
  70. package/dist/lib/node-esm/types/index.mjs +0 -2
  71. package/dist/types/src/capabilities/index.d.ts +0 -1
  72. package/dist/types/src/capabilities/index.d.ts.map +0 -1
  73. package/dist/types/src/components/DebugInfo.d.ts.map +0 -1
  74. package/dist/types/src/components/Voice.d.ts.map +0 -1
  75. package/dist/types/src/components/Voice.stories.d.ts +0 -8
  76. package/dist/types/src/components/Voice.stories.d.ts.map +0 -1
  77. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  78. /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
  79. /package/dist/types/src/components/{DebugInfo.d.ts → Voice/DebugInfo.d.ts} +0 -0
  80. /package/dist/types/src/components/{Voice.d.ts → Voice/Voice.d.ts} +0 -0
package/package.json CHANGED
@@ -1,79 +1,98 @@
1
1
  {
2
2
  "name": "@dxos/plugin-transformer",
3
- "version": "0.8.4-main.fd6878d",
3
+ "version": "0.8.4-staging.60fe92afc8",
4
4
  "description": "Client transformer",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
- "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
11
+ "license": "FSL-1.1-Apache-2.0",
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
  ".": {
13
44
  "source": "./src/index.ts",
14
45
  "types": "./dist/types/src/index.d.ts",
15
- "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
46
+ "default": "./dist/lib/neutral/index.mjs"
47
+ },
48
+ "./assets/PLUGIN.mdl": "./PLUGIN.mdl",
49
+ "./plugin": {
50
+ "source": "./src/plugin.ts",
51
+ "types": "./dist/types/src/plugin.d.ts",
52
+ "default": "./dist/lib/neutral/plugin.mjs"
17
53
  },
18
- "./types": {
19
- "source": "./src/types/index.ts",
20
- "types": "./dist/types/src/types/index.d.ts",
21
- "browser": "./dist/lib/browser/types/index.mjs",
22
- "node": "./dist/lib/node-esm/types/index.mjs"
54
+ "./translations": {
55
+ "source": "./src/translations.ts",
56
+ "types": "./dist/types/src/translations.d.ts",
57
+ "default": "./dist/lib/neutral/translations.mjs"
23
58
  }
24
59
  },
25
60
  "types": "dist/types/src/index.d.ts",
26
- "typesVersions": {
27
- "*": {
28
- "types": [
29
- "dist/types/src/types/index.d.ts"
30
- ]
31
- }
32
- },
33
61
  "files": [
34
62
  "dist",
35
- "src"
63
+ "src",
64
+ "PLUGIN.mdl"
36
65
  ],
37
66
  "dependencies": {
38
- "@huggingface/transformers": "^3.3.3",
39
- "@preact-signals/safe-react": "^0.9.0",
40
- "@preact/signals-core": "^1.9.0",
41
- "date-fns": "^3.3.1",
42
- "effect": "3.17.7",
43
- "@dxos/app-framework": "0.8.4-main.fd6878d",
44
- "@dxos/async": "0.8.4-main.fd6878d",
45
- "@dxos/display-name": "0.8.4-main.fd6878d",
46
- "@dxos/echo-schema": "0.8.4-main.fd6878d",
47
- "@dxos/invariant": "0.8.4-main.fd6878d",
48
- "@dxos/echo": "0.8.4-main.fd6878d",
49
- "@dxos/live-object": "0.8.4-main.fd6878d",
50
- "@dxos/log": "0.8.4-main.fd6878d",
51
- "@dxos/plugin-client": "0.8.4-main.fd6878d",
52
- "@dxos/plugin-graph": "0.8.4-main.fd6878d",
53
- "@dxos/plugin-space": "0.8.4-main.fd6878d",
54
- "@dxos/react-ui-attention": "0.8.4-main.fd6878d",
55
- "@dxos/util": "0.8.4-main.fd6878d",
56
- "@dxos/react-client": "0.8.4-main.fd6878d",
57
- "@dxos/react-ui-stack": "0.8.4-main.fd6878d"
67
+ "@huggingface/transformers": "^3.8.1",
68
+ "@xenova/transformers": "^2.17.2",
69
+ "effect": "3.21.3",
70
+ "@dxos/app-framework": "0.8.4-staging.60fe92afc8",
71
+ "@dxos/invariant": "0.8.4-staging.60fe92afc8",
72
+ "@dxos/keys": "0.8.4-staging.60fe92afc8",
73
+ "@dxos/app-toolkit": "0.8.4-staging.60fe92afc8",
74
+ "@dxos/log": "0.8.4-staging.60fe92afc8",
75
+ "@dxos/plugin-client": "0.8.4-staging.60fe92afc8",
76
+ "@dxos/util": "0.8.4-staging.60fe92afc8"
58
77
  },
59
78
  "devDependencies": {
60
- "@types/react": "~18.2.0",
61
- "@types/react-dom": "~18.2.0",
62
- "@xenova/transformers": "^2.17.2",
63
- "react": "~18.2.0",
64
- "react-dom": "~18.2.0",
65
- "vite": "5.4.7",
66
- "@dxos/react-ui": "0.8.4-main.fd6878d",
67
- "@dxos/random": "0.8.4-main.fd6878d",
68
- "@dxos/storybook-utils": "0.8.4-main.fd6878d",
69
- "@dxos/react-ui-theme": "0.8.4-main.fd6878d"
79
+ "@types/react": "~19.2.7",
80
+ "@types/react-dom": "~19.2.3",
81
+ "react": "~19.2.3",
82
+ "react-dom": "~19.2.3",
83
+ "vite": "^8.0.16",
84
+ "@dxos/plugin-testing": "0.8.4-staging.60fe92afc8",
85
+ "@dxos/random": "0.8.4-staging.60fe92afc8",
86
+ "@dxos/storybook-utils": "0.8.4-staging.60fe92afc8",
87
+ "@dxos/react-ui": "0.8.4-staging.60fe92afc8",
88
+ "@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
70
89
  },
71
90
  "peerDependencies": {
72
- "effect": "^3.13.3",
73
- "react": "~18.2.0",
74
- "react-dom": "~18.2.0",
75
- "@dxos/react-ui": "0.8.4-main.fd6878d",
76
- "@dxos/react-ui-theme": "0.8.4-main.fd6878d"
91
+ "effect": "3.21.3",
92
+ "react": "~19.2.3",
93
+ "react-dom": "~19.2.3",
94
+ "@dxos/react-ui": "0.8.4-staging.60fe92afc8",
95
+ "@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
77
96
  },
78
97
  "publishConfig": {
79
98
  "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,28 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
6
- import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
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 './meta';
10
- import { translations } from './translations';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
11
 
12
- export const TransformerPlugin = () =>
13
- definePlugin(meta, [
14
- defineModule({
15
- id: `${meta.id}/module/translations`,
16
- activatesOn: Events.SetupTranslations,
17
- activate: () => contributes(Capabilities.Translations, translations),
18
- }),
19
- defineModule({
20
- id: `${meta.id}/module/metadata`,
21
- activatesOn: Events.SetupMetadata,
22
- activate: () => [],
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
+ // eslint-disable-next-line import/no-relative-packages
13
+ import pluginSpec from '../PLUGIN.mdl?raw';
14
+
15
+ export const TransformerPlugin = Plugin.define(meta).pipe(
16
+ AppPlugin.addSchemaModule({ schema: [] }),
17
+ AppPlugin.addTranslationsModule({ translations }),
18
+ // Plugin.addModule({
19
+ // id: 'intent-resolver',
20
+ // activatesOn: Events.SetupIntentResolver,
21
+ // activate: IntentResolver,
22
+ // }),
23
+ AppPlugin.addPluginAssetModule({
24
+ asset: { pluginId: meta.id, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
25
+ }),
26
+ Plugin.make,
27
+ );
28
+
29
+ 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 '@dxos-theme';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
 
7
- import type { Meta, StoryObj } from '@storybook/react-vite';
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: Meta<typeof Voice> = {
14
- title: 'plugins/plugin-transformer/Voice',
11
+ const meta = {
12
+ title: 'plugins/plugin-transformer/components/Voice',
15
13
  component: Voice,
16
- decorators: [withTheme, withLayout()],
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
 
@@ -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 '../hooks';
9
+ import { useAudioStream, usePipeline } from '#hooks';
10
10
 
11
11
  import { DebugInfo } from './DebugInfo';
12
12
 
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './DebugInfo';
6
+ export * from './Voice';
@@ -1,3 +1,5 @@
1
1
  //
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
+
5
+ export * from './Voice';
@@ -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);
@@ -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
- // Try to get adapter info if available.
91
- try {
92
- const adapterInfo = await adapter.requestAdapterInfo();
93
- if (adapterInfo) {
94
- setState((prev) => ({
95
- ...prev,
96
- gpuInfo: `${adapterInfo.description || 'GPU'} (${adapterInfo.vendor || 'Unknown'})`,
97
- }));
98
- } else {
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
@@ -3,5 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './meta';
6
-
7
- export * from './TransformerPlugin';
package/src/meta.ts CHANGED
@@ -2,15 +2,32 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { DXN } from '@dxos/keys';
7
+ import { trim } from '@dxos/util';
6
8
 
7
- export const TRANSFORMER_PLUGIN = 'dxos.org/plugin/transformer';
8
-
9
- export const meta: PluginMeta = {
10
- id: TRANSFORMER_PLUGIN,
9
+ export const meta = Plugin.makeMeta({
10
+ key: DXN.make('org.dxos.plugin.transformer'),
11
11
  name: 'Transformer',
12
- description: 'Run local transformers.',
12
+ author: 'DXOS',
13
+ spec: 'PLUGIN.mdl',
14
+ description: trim`
15
+ Browser-based machine learning plugin that runs Hugging Face Transformers.js models
16
+ entirely in-browser via WebAssembly and WebGPU — no server-side inference required.
17
+
18
+ Provides automatic speech recognition through a Whisper pipeline hook (usePipeline)
19
+ and a microphone capture hook (useAudioStream) that buffers 16 kHz mono audio into
20
+ 2-second chunks before forwarding them to the model.
21
+
22
+ Exposes a Voice component that wires the two hooks together to deliver live
23
+ transcription, accumulating the running transcript in local state and rendering
24
+ a debug panel with model status, GPU info, and audio level visualisation.
25
+
26
+ Includes a RAG embedding pipeline base class for retrieval-augmented generation
27
+ experiments, with cosine similarity ranking for selecting the most relevant
28
+ knowledge-base contexts before text generation.
29
+ `,
13
30
  icon: 'ph--cpu--regular',
14
31
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer',
15
32
  tags: ['labs'],
16
- };
33
+ });
package/src/plugin.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const TransformerPlugin = Plugin.lazy(meta, () => import('#plugin'));
@@ -4,13 +4,13 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'plugin name': 'Transformers',
13
+ 'plugin.name': 'Transformers',
14
14
  },
15
15
  },
16
16
  },
@@ -0,0 +1,10 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ //
4
+ // Copyright 2026 DXOS.org
5
+ //
6
+
7
+ declare module '*.mdl?raw' {
8
+ const content: string;
9
+ export default content;
10
+ }
@@ -1,52 +0,0 @@
1
- // 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
- // src/TransformerPlugin.tsx
15
- import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
16
- import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
17
-
18
- // src/translations.ts
19
- var translations = [
20
- {
21
- "en-US": {
22
- [meta.id]: {
23
- "plugin name": "Transformers"
24
- }
25
- }
26
- }
27
- ];
28
-
29
- // 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)
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, Events, contributes, defineModule, definePlugin } 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 { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'plugin name': 'Transformers',\n },\n },\n },\n] as const satisfies Resource[];\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,QAAQC,aAAaC,cAAcC,oBAAoB;AAC9E,SAASC,oBAAoBC,oBAAoB;;;ACG1C,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,eAAe;MACjB;IACF;EACF;;;;ADJK,IAAMC,oBAAoB,MAC/BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,YAAAA;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", "Events", "contributes", "defineModule", "definePlugin", "ClientCapabilities", "ClientEvents", "translations", "meta", "id", "TransformerPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":1533,"imports":[],"format":"esm"},"src/translations.ts":{"bytes":1135,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/TransformerPlugin.tsx":{"bytes":3914,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":567,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/TransformerPlugin.tsx","kind":"import-statement","original":"./TransformerPlugin"}],"format":"esm"},"src/types/index.ts":{"bytes":380,"imports":[],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3160},"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":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":304},"src/index.ts":{"bytesInOutput":0},"src/TransformerPlugin.tsx":{"bytesInOutput":696},"src/translations.ts":{"bytesInOutput":118}},"bytes":1314},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/types/index.ts","inputs":{"src/types/index.ts":{"bytesInOutput":0}},"bytes":35}}}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.mjs.map
@@ -1,54 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/meta.ts
4
- var TRANSFORMER_PLUGIN = "dxos.org/plugin/transformer";
5
- var meta = {
6
- id: TRANSFORMER_PLUGIN,
7
- name: "Transformer",
8
- description: "Run local transformers.",
9
- icon: "ph--cpu--regular",
10
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transformer",
11
- tags: [
12
- "labs"
13
- ]
14
- };
15
-
16
- // src/TransformerPlugin.tsx
17
- import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
18
- import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
19
-
20
- // src/translations.ts
21
- var translations = [
22
- {
23
- "en-US": {
24
- [meta.id]: {
25
- "plugin name": "Transformers"
26
- }
27
- }
28
- }
29
- ];
30
-
31
- // src/TransformerPlugin.tsx
32
- var TransformerPlugin = () => definePlugin(meta, [
33
- defineModule({
34
- id: `${meta.id}/module/translations`,
35
- activatesOn: Events.SetupTranslations,
36
- activate: () => contributes(Capabilities.Translations, translations)
37
- }),
38
- defineModule({
39
- id: `${meta.id}/module/metadata`,
40
- activatesOn: Events.SetupMetadata,
41
- activate: () => []
42
- }),
43
- defineModule({
44
- id: `${meta.id}/module/schema`,
45
- activatesOn: ClientEvents.SetupSchema,
46
- activate: () => contributes(ClientCapabilities.Schema, [])
47
- })
48
- ]);
49
- export {
50
- TRANSFORMER_PLUGIN,
51
- TransformerPlugin,
52
- meta
53
- };
54
- //# 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, Events, contributes, defineModule, definePlugin } 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 { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'plugin name': 'Transformers',\n },\n },\n },\n] as const satisfies Resource[];\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,QAAQC,aAAaC,cAAcC,oBAAoB;AAC9E,SAASC,oBAAoBC,oBAAoB;;;ACG1C,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,eAAe;MACjB;IACF;EACF;;;;ADJK,IAAMC,oBAAoB,MAC/BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,YAAAA;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", "Events", "contributes", "defineModule", "definePlugin", "ClientCapabilities", "ClientEvents", "translations", "meta", "id", "TransformerPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":1533,"imports":[],"format":"esm"},"src/translations.ts":{"bytes":1135,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/TransformerPlugin.tsx":{"bytes":3914,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":567,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/TransformerPlugin.tsx","kind":"import-statement","original":"./TransformerPlugin"}],"format":"esm"},"src/types/index.ts":{"bytes":380,"imports":[],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3162},"dist/lib/node-esm/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":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":304},"src/index.ts":{"bytesInOutput":0},"src/TransformerPlugin.tsx":{"bytesInOutput":696},"src/translations.ts":{"bytesInOutput":118}},"bytes":1407},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/types/index.ts","inputs":{"src/types/index.ts":{"bytesInOutput":0}},"bytes":127}}}
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- //# sourceMappingURL=index.mjs.map
@@ -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"}