@dxos/plugin-devtools 0.11.1 → 0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d
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/{chunk-types.mjs → Devtools.mjs} +5 -14
- package/dist/lib/Devtools.mjs.map +1 -0
- package/dist/lib/DevtoolsEvents.mjs +15 -0
- package/dist/lib/DevtoolsEvents.mjs.map +1 -0
- package/dist/lib/DevtoolsPlugin.mjs +9 -13
- package/dist/lib/DevtoolsPlugin.mjs.map +1 -1
- package/dist/lib/DevtoolsPlugin.node.mjs +2 -3
- package/dist/lib/DevtoolsPlugin.node.mjs.map +1 -1
- package/dist/lib/DevtoolsPlugin.workerd.mjs +1 -1
- package/dist/lib/DevtoolsPlugin.workerd.mjs.map +1 -1
- package/dist/lib/capabilities.mjs +5 -4
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/chunk-CliPanel.mjs +103 -0
- package/dist/lib/chunk-CliPanel.mjs.map +1 -0
- package/dist/lib/chunk-RegistryPanel.mjs +2 -2
- package/dist/lib/chunk-RegistryPanel.mjs.map +1 -1
- package/dist/lib/chunk-app-graph-builder.mjs +113 -100
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -1
- package/dist/lib/chunk-meta.mjs +1 -1
- package/dist/lib/chunk-meta.mjs.map +1 -1
- package/dist/lib/chunk-react-context.mjs +3 -2
- package/dist/lib/chunk-react-context.mjs.map +1 -1
- package/dist/lib/chunk-react-surface.mjs +43 -36
- package/dist/lib/chunk-react-surface.mjs.map +1 -1
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/containers.mjs +2 -1
- package/dist/lib/containers.mjs.map +1 -1
- package/dist/lib/index.mjs +3 -2
- package/dist/lib/plugin.mjs +1 -1
- package/dist/lib/plugin.mjs.map +1 -1
- package/dist/lib/translations.mjs +1 -0
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/DevtoolsPlugin.d.ts +1 -1
- package/dist/types/src/DevtoolsPlugin.d.ts.map +1 -1
- package/dist/types/src/DevtoolsPlugin.node.d.ts +1 -1
- package/dist/types/src/DevtoolsPlugin.node.d.ts.map +1 -1
- package/dist/types/src/DevtoolsPlugin.workerd.d.ts +1 -1
- package/dist/types/src/DevtoolsPlugin.workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/DevtoolsSurfaces.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/containers/CliPanel/CliPanel.d.ts +6 -0
- package/dist/types/src/containers/CliPanel/CliPanel.d.ts.map +1 -0
- package/dist/types/src/containers/CliPanel/CliPanel.stories.d.ts +91 -0
- package/dist/types/src/containers/CliPanel/CliPanel.stories.d.ts.map +1 -0
- package/dist/types/src/containers/CliPanel/index.d.ts +2 -0
- package/dist/types/src/containers/CliPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/CliPanel/useCliApp.d.ts +27 -0
- package/dist/types/src/containers/CliPanel/useCliApp.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +2 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +1 -0
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +1 -1
- package/dist/types/src/plugin.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Devtools.d.ts +1 -0
- package/dist/types/src/types/Devtools.d.ts.map +1 -1
- package/dist/types/src/types/DevtoolsEvents.d.ts +8 -0
- package/dist/types/src/types/DevtoolsEvents.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +52 -58
- package/src/DevtoolsPlugin.node.ts +2 -6
- package/src/DevtoolsPlugin.test.ts +4 -2
- package/src/DevtoolsPlugin.tsx +20 -18
- package/src/DevtoolsPlugin.workerd.ts +1 -1
- package/src/capabilities/DevtoolsSurfaces.tsx +4 -3
- package/src/capabilities/app-graph-builder.ts +24 -6
- package/src/capabilities/index.ts +9 -4
- package/src/capabilities/react-context.tsx +3 -2
- package/src/capabilities/react-surface.ts +10 -4
- package/src/containers/CliPanel/CliPanel.stories.tsx +74 -0
- package/src/containers/CliPanel/CliPanel.tsx +45 -0
- package/src/containers/CliPanel/index.ts +5 -0
- package/src/containers/CliPanel/useCliApp.ts +97 -0
- package/src/containers/RegistryPanel/RegistryPanel.tsx +1 -1
- package/src/containers/index.ts +1 -0
- package/src/index.ts +2 -1
- package/src/meta.ts +1 -1
- package/src/plugin.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/Devtools.ts +1 -0
- package/src/types/DevtoolsEvents.ts +16 -0
- package/dist/lib/chunk-types.mjs.map +0 -1
- package/dist/lib/types.mjs +0 -2
- package/dist/types/src/types/index.d.ts +0 -2
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/src/types/index.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
4
4
|
"description": "DXOS developer inspector plugin.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -43,11 +43,6 @@
|
|
|
43
43
|
"source": "./src/translations.ts",
|
|
44
44
|
"types": "./dist/types/src/translations.d.ts",
|
|
45
45
|
"default": "./dist/lib/translations.mjs"
|
|
46
|
-
},
|
|
47
|
-
"#types": {
|
|
48
|
-
"source": "./src/types/index.ts",
|
|
49
|
-
"types": "./dist/types/src/types/index.d.ts",
|
|
50
|
-
"default": "./dist/lib/types.mjs"
|
|
51
46
|
}
|
|
52
47
|
},
|
|
53
48
|
"exports": {
|
|
@@ -66,9 +61,30 @@
|
|
|
66
61
|
"source": "./src/translations.ts",
|
|
67
62
|
"types": "./dist/types/src/translations.d.ts",
|
|
68
63
|
"import": "./dist/lib/translations.mjs"
|
|
69
|
-
}
|
|
64
|
+
},
|
|
65
|
+
"./Devtools": {
|
|
66
|
+
"source": "./src/types/Devtools.ts",
|
|
67
|
+
"types": "./dist/types/src/types/Devtools.d.ts",
|
|
68
|
+
"import": "./dist/lib/Devtools.mjs"
|
|
69
|
+
},
|
|
70
|
+
"./DevtoolsEvents": {
|
|
71
|
+
"source": "./src/types/DevtoolsEvents.ts",
|
|
72
|
+
"types": "./dist/types/src/types/DevtoolsEvents.d.ts",
|
|
73
|
+
"import": "./dist/lib/DevtoolsEvents.mjs"
|
|
74
|
+
},
|
|
75
|
+
"./package.json": "./package.json"
|
|
70
76
|
},
|
|
71
77
|
"types": "dist/types/src/index.d.ts",
|
|
78
|
+
"typesVersions": {
|
|
79
|
+
"*": {
|
|
80
|
+
"Devtools": [
|
|
81
|
+
"dist/types/src/types/Devtools.d.ts"
|
|
82
|
+
],
|
|
83
|
+
"DevtoolsEvents": [
|
|
84
|
+
"dist/types/src/types/DevtoolsEvents.d.ts"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
72
88
|
"files": [
|
|
73
89
|
"dist",
|
|
74
90
|
"dx.config.ts",
|
|
@@ -76,64 +92,43 @@
|
|
|
76
92
|
"PLUGIN.mdl"
|
|
77
93
|
],
|
|
78
94
|
"dependencies": {
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/
|
|
99
|
-
"@dxos/
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/plugin-client": "0.11.1",
|
|
102
|
-
"@dxos/plugin-graph": "0.11.1",
|
|
103
|
-
"@dxos/plugin-inbox": "0.11.1",
|
|
104
|
-
"@dxos/plugin-markdown": "0.11.1",
|
|
105
|
-
"@dxos/plugin-script": "0.11.1",
|
|
106
|
-
"@dxos/plugin-sheet": "0.11.1",
|
|
107
|
-
"@dxos/plugin-space": "0.11.1",
|
|
108
|
-
"@dxos/plugin-status-bar": "0.11.1",
|
|
109
|
-
"@dxos/protocols": "0.11.1",
|
|
110
|
-
"@dxos/random": "0.11.1",
|
|
111
|
-
"@dxos/react-client": "0.11.1",
|
|
112
|
-
"@dxos/react-ui-attention": "0.11.1",
|
|
113
|
-
"@dxos/react-ui-canvas-compute": "0.11.1",
|
|
114
|
-
"@dxos/react-ui-canvas-editor": "0.11.1",
|
|
115
|
-
"@dxos/react-ui-form": "0.11.1",
|
|
116
|
-
"@dxos/react-ui-introspect": "0.11.1",
|
|
117
|
-
"@dxos/react-ui-syntax-highlighter": "0.11.1",
|
|
118
|
-
"@dxos/react-ui-table": "0.11.1",
|
|
119
|
-
"@dxos/schema": "0.11.1",
|
|
120
|
-
"@dxos/tracing": "0.11.1",
|
|
121
|
-
"@dxos/types": "0.11.1",
|
|
122
|
-
"@dxos/util": "0.11.1"
|
|
95
|
+
"@effect/cli": "0.75.2",
|
|
96
|
+
"@dxos/app-framework": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
97
|
+
"@dxos/app-toolkit": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
98
|
+
"@dxos/async": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
99
|
+
"@dxos/client": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
100
|
+
"@dxos/client-services": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
101
|
+
"@dxos/compute": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
102
|
+
"@dxos/config": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
103
|
+
"@dxos/cli-util": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
104
|
+
"@dxos/devtools": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
105
|
+
"@dxos/echo": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
106
|
+
"@dxos/effect": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
107
|
+
"@dxos/keys": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
108
|
+
"@dxos/log": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
109
|
+
"@dxos/plugin-graph": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
110
|
+
"@dxos/plugin-script": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
111
|
+
"@dxos/plugin-space": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
112
|
+
"@dxos/react-client": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
113
|
+
"@dxos/react-ui-introspect": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
114
|
+
"@dxos/react-ui-table": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
115
|
+
"@dxos/react-ui-terminal": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
116
|
+
"@dxos/util": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d"
|
|
123
117
|
},
|
|
124
118
|
"devDependencies": {
|
|
125
119
|
"@effect-atom/atom-react": "^0.5.0",
|
|
126
120
|
"@effect/platform": "0.96.2",
|
|
121
|
+
"@storybook/react-vite": "^10.4.2",
|
|
127
122
|
"@types/react": "~19.2.17",
|
|
128
123
|
"@types/react-dom": "~19.2.3",
|
|
129
124
|
"effect": "3.21.4",
|
|
130
125
|
"react": "~19.2.7",
|
|
131
126
|
"react-dom": "~19.2.7",
|
|
132
127
|
"vite": "^8.1.4",
|
|
133
|
-
"@dxos/plugin-
|
|
134
|
-
"@dxos/
|
|
135
|
-
"@dxos/
|
|
136
|
-
"@dxos/ui-theme": "0.
|
|
128
|
+
"@dxos/plugin-client": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
129
|
+
"@dxos/plugin-testing": "0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
130
|
+
"@dxos/react-ui": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
131
|
+
"@dxos/ui-theme": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d"
|
|
137
132
|
},
|
|
138
133
|
"peerDependencies": {
|
|
139
134
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -141,9 +136,8 @@
|
|
|
141
136
|
"effect": "3.21.4",
|
|
142
137
|
"react": "~19.2.7",
|
|
143
138
|
"react-dom": "~19.2.7",
|
|
144
|
-
"@dxos/
|
|
145
|
-
"@dxos/react-ui": "0.
|
|
146
|
-
"@dxos/ui-theme": "0.11.1"
|
|
139
|
+
"@dxos/ui-theme": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d",
|
|
140
|
+
"@dxos/react-ui": "1.0.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d"
|
|
147
141
|
},
|
|
148
142
|
"publishConfig": {
|
|
149
143
|
"access": "public"
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { AppPlugin } from '@dxos/app-toolkit';
|
|
5
|
+
import * as Plugin from '@dxos/app-framework/Plugin';
|
|
7
6
|
|
|
8
7
|
import { AppGraphBuilder } from '#capabilities';
|
|
9
8
|
import { meta } from '#meta';
|
|
10
9
|
|
|
11
|
-
export const DevtoolsPlugin = Plugin.define(meta).pipe(
|
|
12
|
-
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
13
|
-
Plugin.make,
|
|
14
|
-
);
|
|
10
|
+
export const DevtoolsPlugin = Plugin.define(meta).pipe(Plugin.addModule(AppGraphBuilder), Plugin.make);
|
|
15
11
|
|
|
16
12
|
export default DevtoolsPlugin;
|
|
@@ -13,12 +13,14 @@ import { meta } from './meta';
|
|
|
13
13
|
const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
14
14
|
|
|
15
15
|
describe('DevtoolsPlugin', () => {
|
|
16
|
-
|
|
16
|
+
// Boot imports the app-graph-builder body (the harness fires the plugin's start event), which
|
|
17
|
+
// can exceed the default 15s under vite-node transform load.
|
|
18
|
+
test('modules activate on the expected events', { timeout: 60_000 }, async ({ expect }) => {
|
|
17
19
|
await using harness = await createComposerTestApp({
|
|
18
20
|
plugins: [DevtoolsPlugin()],
|
|
19
21
|
});
|
|
20
22
|
|
|
21
|
-
// AppGraphBuilder
|
|
23
|
+
// AppGraphBuilder rides the plugin's start event, fired by the harness after Startup.
|
|
22
24
|
expect(harness.manager.getActive()).toContain(moduleId('AppGraphBuilder'));
|
|
23
25
|
});
|
|
24
26
|
});
|
package/src/DevtoolsPlugin.tsx
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
8
|
+
import * as Plugin from '@dxos/app-framework/Plugin';
|
|
9
|
+
import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
9
10
|
import { type Client } from '@dxos/react-client';
|
|
10
11
|
|
|
11
12
|
import { AppGraphBuilder, ReactContext, ReactSurface } from '#capabilities';
|
|
@@ -15,23 +16,24 @@ import { translations } from '#translations';
|
|
|
15
16
|
// eslint-disable-next-line import/no-relative-packages
|
|
16
17
|
import pluginSpec from '../PLUGIN.mdl?raw';
|
|
17
18
|
|
|
19
|
+
const SetupDevtools = Capability.inlineModule('setup-devtools', { provides: [] }, () =>
|
|
20
|
+
Effect.sync(() => setupDevtools()),
|
|
21
|
+
);
|
|
22
|
+
|
|
18
23
|
export const DevtoolsPlugin = Plugin.define(meta).pipe(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Plugin.addModule(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
AppPlugin.addPluginAssetModule({
|
|
33
|
-
asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
|
|
34
|
-
}),
|
|
24
|
+
Plugin.addModule(AppGraphBuilder),
|
|
25
|
+
Plugin.addModule(ReactContext),
|
|
26
|
+
Plugin.addModule(ReactSurface),
|
|
27
|
+
Plugin.addModule(AppCapability.translations(translations)),
|
|
28
|
+
Plugin.addModule(SetupDevtools),
|
|
29
|
+
Plugin.addModule(
|
|
30
|
+
AppCapability.pluginAsset({
|
|
31
|
+
pluginId: meta.profile.key,
|
|
32
|
+
path: 'PLUGIN.mdl',
|
|
33
|
+
content: pluginSpec,
|
|
34
|
+
mimeType: 'application/x-mdl',
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
35
37
|
Plugin.make,
|
|
36
38
|
);
|
|
37
39
|
|
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
import React, { type ComponentType, useCallback } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
-
import
|
|
10
|
+
import * as GraphPath from '@dxos/app-toolkit/GraphPath';
|
|
11
|
+
import * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';
|
|
11
12
|
import { useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
12
13
|
import { InvocationTraceContainer, SpaceInfoPanel, SpaceListPanel, TestingPanel } from '@dxos/devtools';
|
|
13
14
|
import { Feed } from '@dxos/echo';
|
|
14
15
|
import { log } from '@dxos/log';
|
|
15
|
-
import
|
|
16
|
+
import * as ScriptOperation from '@dxos/plugin-script/ScriptOperation';
|
|
16
17
|
import { SpaceOperation } from '@dxos/plugin-space';
|
|
17
18
|
import { type Space } from '@dxos/react-client/echo';
|
|
18
19
|
|
|
19
|
-
import
|
|
20
|
+
import * as Devtools from '../types/Devtools';
|
|
20
21
|
|
|
21
22
|
export type ActiveSpacePanelProps = {
|
|
22
23
|
/** Stable module-level panel component; the surface passes it through its `props` mapper. */
|
|
@@ -4,17 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
8
|
+
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
9
|
+
import * as AppNode from '@dxos/app-toolkit/AppNode';
|
|
10
|
+
import * as AppNodeMatcher from '@dxos/app-toolkit/AppNodeMatcher';
|
|
11
|
+
import * as GraphPath from '@dxos/app-toolkit/GraphPath';
|
|
9
12
|
import { GraphBuilder, Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
10
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
11
14
|
import { Position } from '@dxos/util';
|
|
12
15
|
|
|
13
16
|
import { meta } from '#meta';
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
import * as Devtools from '../types/Devtools';
|
|
15
19
|
|
|
16
20
|
export default Capability.makeModule(
|
|
17
21
|
Effect.fnUntraced(function* () {
|
|
22
|
+
// Read the app graph through its atom so the extension establishes a reactive dependency
|
|
23
|
+
// and re-evaluates once the capability lands (dependency modules contribute individually,
|
|
24
|
+
// not batched per wave).
|
|
25
|
+
const appGraphAtom = yield* Capability.atom(AppCapabilities.AppGraph);
|
|
26
|
+
|
|
18
27
|
const extensions = yield* Effect.all([
|
|
19
28
|
GraphBuilder.createExtension({
|
|
20
29
|
id: 'root',
|
|
@@ -25,7 +34,7 @@ export default Capability.makeModule(
|
|
|
25
34
|
id: 'resetData',
|
|
26
35
|
data: () =>
|
|
27
36
|
Effect.sync(() => {
|
|
28
|
-
window.location.href = '/reset.html
|
|
37
|
+
window.location.href = '/reset.html';
|
|
29
38
|
}),
|
|
30
39
|
properties: {
|
|
31
40
|
label: ['reset-data.label', { ns: meta.profile.key }],
|
|
@@ -40,7 +49,7 @@ export default Capability.makeModule(
|
|
|
40
49
|
match: NodeMatcher.whenAny(NodeMatcher.whenRoot, AppNodeMatcher.whenNavTreeGroup(GraphPath.GroupTypes.system)),
|
|
41
50
|
connector: (_nodeOrSpace: Node.Node | Space, get) =>
|
|
42
51
|
Effect.gen(function* () {
|
|
43
|
-
const [graph] = get(
|
|
52
|
+
const [graph] = get(appGraphAtom);
|
|
44
53
|
|
|
45
54
|
return [
|
|
46
55
|
Node.make({
|
|
@@ -71,6 +80,15 @@ export default Capability.makeModule(
|
|
|
71
80
|
icon: 'ph--toolbox--regular',
|
|
72
81
|
},
|
|
73
82
|
}),
|
|
83
|
+
Node.make({
|
|
84
|
+
id: Devtools.nodeId(Devtools.Cli),
|
|
85
|
+
data: Devtools.Cli,
|
|
86
|
+
type: Devtools.id,
|
|
87
|
+
properties: {
|
|
88
|
+
label: ['cli.label', { ns: meta.profile.key }],
|
|
89
|
+
icon: 'ph--terminal-window--regular',
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
74
92
|
Node.make({
|
|
75
93
|
id: Devtools.nodeId(Devtools.Client.id),
|
|
76
94
|
data: null,
|
|
@@ -383,6 +401,6 @@ export default Capability.makeModule(
|
|
|
383
401
|
}),
|
|
384
402
|
]);
|
|
385
403
|
|
|
386
|
-
return Capability.
|
|
404
|
+
return Capability.contribute(AppCapabilities.AppGraphBuilder, extensions);
|
|
387
405
|
}),
|
|
388
406
|
);
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
6
|
+
import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
6
7
|
|
|
7
|
-
export const AppGraphBuilder =
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export const AppGraphBuilder = AppCapability.appGraphBuilder(() => import('./app-graph-builder'), {
|
|
9
|
+
requires: [AppCapabilities.AppGraph],
|
|
10
|
+
});
|
|
11
|
+
export const ReactContext = AppCapability.reactContext(() => import('./react-context'));
|
|
12
|
+
export const ReactSurface = AppCapability.surface(() => import('./react-surface'), {
|
|
13
|
+
roles: ['org.dxos.role.article', 'org.dxos.role.deckCompanion.devtoolsOverview'],
|
|
14
|
+
});
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
9
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
9
10
|
import { Surface } from '@dxos/app-framework/ui';
|
|
10
11
|
import { DevtoolsContextProvider } from '@dxos/devtools';
|
|
11
12
|
|
|
@@ -13,7 +14,7 @@ import { meta } from '#meta';
|
|
|
13
14
|
|
|
14
15
|
export default Capability.makeModule(() =>
|
|
15
16
|
Effect.succeed(
|
|
16
|
-
Capability.
|
|
17
|
+
Capability.contribute(Capabilities.ReactContext, {
|
|
17
18
|
id: meta.profile.key,
|
|
18
19
|
context: ({ children }) => (
|
|
19
20
|
<Surface.ProfilerProvider>
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
8
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
8
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
10
11
|
import { EDGE_SERVICE_DEFAULTS, EdgeServiceName } from '@dxos/config';
|
|
@@ -34,9 +35,9 @@ import {
|
|
|
34
35
|
import { type Graph } from '@dxos/plugin-graph';
|
|
35
36
|
import { ToolsExplorer } from '@dxos/react-ui-introspect';
|
|
36
37
|
|
|
37
|
-
import { DebugGraph, DevtoolsOverviewContainer, RegistryPanel } from '#containers';
|
|
38
|
-
import { Devtools } from '#types';
|
|
38
|
+
import { CliPanel, DebugGraph, DevtoolsOverviewContainer, RegistryPanel } from '#containers';
|
|
39
39
|
|
|
40
|
+
import * as Devtools from '../types/Devtools';
|
|
40
41
|
import {
|
|
41
42
|
ActiveSpacePanel,
|
|
42
43
|
EdgeTestingSurface,
|
|
@@ -69,7 +70,7 @@ const isGraphDebug = (data: unknown): data is GraphDebug => {
|
|
|
69
70
|
|
|
70
71
|
export default Capability.makeModule(
|
|
71
72
|
Effect.fnUntraced(function* () {
|
|
72
|
-
return Capability.
|
|
73
|
+
return Capability.contribute(Capabilities.ReactSurface, [
|
|
73
74
|
Surface.create({
|
|
74
75
|
id: 'appGraph',
|
|
75
76
|
filter: AppSurface.subject(AppSurface.Article, isGraphDebug),
|
|
@@ -82,6 +83,11 @@ export default Capability.makeModule(
|
|
|
82
83
|
component: ToolsExplorer,
|
|
83
84
|
props: () => ({ serverUrl: MCP_SERVER_URL }),
|
|
84
85
|
}),
|
|
86
|
+
Surface.create({
|
|
87
|
+
id: 'cli',
|
|
88
|
+
filter: AppSurface.literal(AppSurface.Article, Devtools.Cli),
|
|
89
|
+
component: CliPanel,
|
|
90
|
+
}),
|
|
85
91
|
Surface.create({
|
|
86
92
|
id: 'registry',
|
|
87
93
|
filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Registry),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import { userEvent } from 'storybook/test';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
11
|
+
import { SpacePlugin } from '@dxos/plugin-space/plugin';
|
|
12
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
13
|
+
import { runCommand, waitForTerminal } from '@dxos/react-ui-terminal/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
|
|
16
|
+
import { translations } from '#translations';
|
|
17
|
+
|
|
18
|
+
import { CliPanel } from './CliPanel';
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
21
|
+
title: 'plugins/plugin-devtools/containers/CliPanel',
|
|
22
|
+
component: CliPanel,
|
|
23
|
+
decorators: [
|
|
24
|
+
withLayout({ layout: 'fullscreen' }),
|
|
25
|
+
withTheme(),
|
|
26
|
+
withPluginManager({
|
|
27
|
+
// No setup event: the panel fires `CommandsRequested` itself, which is what pulls the
|
|
28
|
+
// plugins' command modules in — the same path the app takes.
|
|
29
|
+
plugins: [
|
|
30
|
+
...corePlugins(),
|
|
31
|
+
// The identity brings a default space, which is what the commands resolve against.
|
|
32
|
+
ClientPlugin({ onClientInitialized: ({ client }) => Effect.asVoid(initializeIdentity(client)) }),
|
|
33
|
+
StorybookPlugin({}),
|
|
34
|
+
// The real plugin, so the story covers it actually contributing its commands.
|
|
35
|
+
SpacePlugin({}),
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
parameters: {
|
|
40
|
+
layout: 'fullscreen',
|
|
41
|
+
controls: { disable: true },
|
|
42
|
+
translations,
|
|
43
|
+
},
|
|
44
|
+
} satisfies Meta<typeof CliPanel>;
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Drives real `dx` commands against the story's client, so a break in the wiring between the shell
|
|
54
|
+
* and the client surfaces here rather than in the app.
|
|
55
|
+
*/
|
|
56
|
+
export const Spec: Story = {
|
|
57
|
+
play: async ({ canvasElement }) => {
|
|
58
|
+
const keyboard = (text: string) => userEvent.keyboard(text);
|
|
59
|
+
await waitForTerminal(canvasElement, 'dx>');
|
|
60
|
+
|
|
61
|
+
// `space list` reaches the client and reports its space.
|
|
62
|
+
await runCommand(canvasElement, 'space list', keyboard);
|
|
63
|
+
await waitForTerminal(canvasElement, 'SPACE_READY');
|
|
64
|
+
|
|
65
|
+
// `database query` reaches ECHO through the layer the command provides for itself.
|
|
66
|
+
await runCommand(canvasElement, 'database query', keyboard);
|
|
67
|
+
await waitForTerminal(canvasElement, 'org.dxos.type.spaceProperties');
|
|
68
|
+
|
|
69
|
+
// A command from another plugin, whose service arrives via that plugin's contributed layer
|
|
70
|
+
// rather than anything this panel names.
|
|
71
|
+
await runCommand(canvasElement, 'config view', keyboard);
|
|
72
|
+
await waitForTerminal(canvasElement, 'runtime');
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Placeholder } from '@dxos/devtools';
|
|
8
|
+
import { useClient } from '@dxos/react-client';
|
|
9
|
+
import { Panel } from '@dxos/react-ui';
|
|
10
|
+
import { Terminal } from '@dxos/react-ui-terminal';
|
|
11
|
+
|
|
12
|
+
import { useCliApp } from './useCliApp';
|
|
13
|
+
|
|
14
|
+
const BOLD = '\x1b[1m';
|
|
15
|
+
const DIM = '\x1b[2m';
|
|
16
|
+
const RESET = '\x1b[0m';
|
|
17
|
+
|
|
18
|
+
const BANNER = `${BOLD}DXOS CLI${RESET}\n${DIM}The dx commands, running against this client. Type "help" for the list.${RESET}`;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Runs the `dx` CLI against the client backing this app.
|
|
22
|
+
*
|
|
23
|
+
* The command tree is assembled from the commands the installed plugins contribute, and it and its
|
|
24
|
+
* services are built once per client, so state the handlers hold survives between commands the way
|
|
25
|
+
* it does in a long-lived shell.
|
|
26
|
+
*/
|
|
27
|
+
export const CliPanel = () => {
|
|
28
|
+
const client = useClient();
|
|
29
|
+
const cli = useCliApp(client);
|
|
30
|
+
|
|
31
|
+
// No ScrollArea: xterm owns its own viewport and scrollback.
|
|
32
|
+
return (
|
|
33
|
+
<Panel.Root>
|
|
34
|
+
<Panel.Content>
|
|
35
|
+
{cli ? (
|
|
36
|
+
<Terminal command={cli.command} layer={cli.layer} name='dx' banner={BANNER} />
|
|
37
|
+
) : (
|
|
38
|
+
<Placeholder label='No commands' />
|
|
39
|
+
)}
|
|
40
|
+
</Panel.Content>
|
|
41
|
+
</Panel.Root>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
CliPanel.displayName = 'CliPanel';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import { useEffect, useMemo } from 'react';
|
|
10
|
+
|
|
11
|
+
import * as ActivationEvents from '@dxos/app-framework/ActivationEvents';
|
|
12
|
+
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
13
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
14
|
+
import * as Plugin from '@dxos/app-framework/Plugin';
|
|
15
|
+
import { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';
|
|
16
|
+
import { CommandConfig, type CommandServices } from '@dxos/cli-util';
|
|
17
|
+
import { type Client, ClientService, ConfigService } from '@dxos/client';
|
|
18
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
19
|
+
import { EffectEx } from '@dxos/effect';
|
|
20
|
+
|
|
21
|
+
const OPERATIONS_UNAVAILABLE = 'Operations are not available in the devtools terminal.';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Commands that create objects invoke operations, which this surface has no runtime for. Failing
|
|
25
|
+
* with a stated reason beats the bare "Service not found" a missing layer would produce.
|
|
26
|
+
*/
|
|
27
|
+
const operationLayer = Layer.succeed(Operation.Service, {
|
|
28
|
+
invoke: () => Effect.die(OPERATIONS_UNAVAILABLE),
|
|
29
|
+
schedule: () => Effect.die(OPERATIONS_UNAVAILABLE),
|
|
30
|
+
invokePromise: async () => ({ error: new Error(OPERATIONS_UNAVAILABLE) }),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Builds the `dx` command tree and the services its handlers need.
|
|
35
|
+
*
|
|
36
|
+
* Mounting is the demand signal: command modules are gated on `CommandsRequested`, which nothing
|
|
37
|
+
* else in the app fires, so a plugin's commands stay off the critical path until a terminal opens.
|
|
38
|
+
* The capability is read through its atom, so commands appear as they activate and enabling or
|
|
39
|
+
* disabling a plugin later rebuilds the tree rather than leaving the terminal on the set that
|
|
40
|
+
* existed when it mounted.
|
|
41
|
+
*
|
|
42
|
+
* The root mirrors the binary's, minus the options that only mean something on a filesystem
|
|
43
|
+
* (`--config`, `--profile`); everything else resolves the same way, including `--space-id`
|
|
44
|
+
* defaulting to the first available space.
|
|
45
|
+
*
|
|
46
|
+
* Returns `undefined` until something contributes commands — there is no shell to offer yet.
|
|
47
|
+
*/
|
|
48
|
+
export const useCliApp = (client: Client) => {
|
|
49
|
+
const manager = usePluginManager();
|
|
50
|
+
const commands = useCapabilities(Capabilities.Command);
|
|
51
|
+
const contributed = useCapabilities(Capabilities.Layer);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
EffectEx.runDetached(manager.activate(ActivationEvents.CommandsRequested));
|
|
55
|
+
}, [manager]);
|
|
56
|
+
|
|
57
|
+
return useMemo(() => {
|
|
58
|
+
// Destructured rather than passed as an array so the non-empty shape `withSubcommands` requires
|
|
59
|
+
// is carried by the type instead of asserted.
|
|
60
|
+
const [first, ...rest] = commands;
|
|
61
|
+
if (!first) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// `provide` comes after the subcommands so the config reaches them in the type as well as at
|
|
66
|
+
// runtime; applied before, every subcommand still advertises `CommandConfig` as unmet.
|
|
67
|
+
const command = Command.make('dx', {
|
|
68
|
+
json: Options.boolean('json', { ifPresent: true }).pipe(Options.withDescription('JSON output.')),
|
|
69
|
+
verbose: Options.boolean('verbose', { ifPresent: true }).pipe(
|
|
70
|
+
Options.withAlias('v'),
|
|
71
|
+
Options.withDescription('Verbose output.'),
|
|
72
|
+
),
|
|
73
|
+
}).pipe(
|
|
74
|
+
Command.withSubcommands([first, ...rest]),
|
|
75
|
+
Command.provide(({ json, verbose }) =>
|
|
76
|
+
Layer.succeed(CommandConfig, { json, verbose, profile: 'default', logLevel: 'info' }),
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Annotated so a service this host owes is a build error naming it, rather than a
|
|
81
|
+
// "Service not found" the first time someone runs the command that needed it.
|
|
82
|
+
const hostLayer: Layer.Layer<CommandServices, never, never> = Layer.mergeAll(
|
|
83
|
+
ClientService.fromClient(client),
|
|
84
|
+
ConfigService.fromConfig(client.config),
|
|
85
|
+
Layer.succeed(Plugin.Service, manager),
|
|
86
|
+
Layer.succeed(Capability.Service, manager.capabilities),
|
|
87
|
+
operationLayer,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Plugins carry anything further their own commands need. A contributed layer may fail to
|
|
91
|
+
// build, and the shell runs on a fiber with nowhere to report that, so it dies here instead
|
|
92
|
+
// of being smuggled into the terminal as an unhandled error channel.
|
|
93
|
+
const layer = Layer.orDie(Layer.mergeAll(hostLayer, ...contributed));
|
|
94
|
+
|
|
95
|
+
return { command, layer };
|
|
96
|
+
}, [client, manager, commands, contributed]);
|
|
97
|
+
};
|