@dxos/plugin-debug 0.8.4-main.28f8d3d → 0.8.4-main.2c6827d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-XJJAOTIT.mjs → SpaceGenerator-46TAISVE.mjs} +231 -58
- package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-PXPZIIGY.mjs → app-graph-builder-CRH2HJKT.mjs} +76 -85
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-UNFNQFWK.mjs → react-surface-2SNVZDEA.mjs} +103 -97
- package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- 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-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +6 -3
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -64
- package/src/DebugPlugin.tsx +5 -6
- package/src/capabilities/app-graph-builder.ts +67 -93
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +74 -53
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +101 -72
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +19 -25
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +10 -10
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
- package/src/components/SpaceGenerator/draw-util.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +186 -20
- package/src/components/Wireframe.tsx +4 -4
- package/src/components/index.ts +1 -1
- package/src/meta.ts +6 -5
- package/src/translations.ts +3 -1
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs +0 -228
- package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-XJJAOTIT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-PXPZIIGY.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UNFNQFWK.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -85
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -13,9 +13,8 @@ import {
|
|
|
13
13
|
contributes,
|
|
14
14
|
createIntent,
|
|
15
15
|
createSurface,
|
|
16
|
-
useCapability,
|
|
17
|
-
useIntentDispatcher,
|
|
18
16
|
} from '@dxos/app-framework';
|
|
17
|
+
import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
19
18
|
import {
|
|
20
19
|
AutomergePanel,
|
|
21
20
|
ConfigPanel,
|
|
@@ -52,10 +51,10 @@ import { ScriptAction } from '@dxos/plugin-script/types';
|
|
|
52
51
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
53
52
|
import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
|
|
54
53
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
55
|
-
import {
|
|
54
|
+
import { Collection } from '@dxos/schema';
|
|
56
55
|
|
|
57
56
|
import {
|
|
58
|
-
|
|
57
|
+
DebugGraph,
|
|
59
58
|
DebugObjectPanel,
|
|
60
59
|
DebugSettings,
|
|
61
60
|
DebugStatus,
|
|
@@ -63,7 +62,7 @@ import {
|
|
|
63
62
|
SpaceGenerator,
|
|
64
63
|
Wireframe,
|
|
65
64
|
} from '../components';
|
|
66
|
-
import {
|
|
65
|
+
import { meta } from '../meta';
|
|
67
66
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
68
67
|
|
|
69
68
|
type SpaceDebug = {
|
|
@@ -73,10 +72,11 @@ type SpaceDebug = {
|
|
|
73
72
|
|
|
74
73
|
type GraphDebug = {
|
|
75
74
|
graph: Graph;
|
|
75
|
+
root: string;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${
|
|
79
|
-
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
|
|
78
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
|
|
79
|
+
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
|
|
80
80
|
|
|
81
81
|
// TODO(wittjosiah): Factor out?
|
|
82
82
|
const useCurrentSpace = () => {
|
|
@@ -90,14 +90,14 @@ const useCurrentSpace = () => {
|
|
|
90
90
|
export default (context: PluginContext) =>
|
|
91
91
|
contributes(Capabilities.ReactSurface, [
|
|
92
92
|
createSurface({
|
|
93
|
-
id: `${
|
|
93
|
+
id: `${meta.id}/plugin-settings`,
|
|
94
94
|
role: 'article',
|
|
95
95
|
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
96
|
-
data.subject instanceof SettingsStore && data.subject.prefix ===
|
|
96
|
+
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
97
97
|
component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
|
|
98
98
|
}),
|
|
99
99
|
createSurface({
|
|
100
|
-
id: `${
|
|
100
|
+
id: `${meta.id}/space`,
|
|
101
101
|
role: 'article',
|
|
102
102
|
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
103
103
|
component: ({ data }) => {
|
|
@@ -111,13 +111,18 @@ export default (context: PluginContext) =>
|
|
|
111
111
|
|
|
112
112
|
const collection =
|
|
113
113
|
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
114
|
-
data.subject.space.properties[
|
|
115
|
-
if (!Obj.instanceOf(
|
|
114
|
+
data.subject.space.properties[Collection.Collection.typename]?.target;
|
|
115
|
+
if (!Obj.instanceOf(Collection.Collection, collection)) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
objects.forEach((object) => {
|
|
120
|
-
void dispatch(
|
|
120
|
+
void dispatch(
|
|
121
|
+
createIntent(SpaceAction.AddObject, {
|
|
122
|
+
target: collection,
|
|
123
|
+
object,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
121
126
|
});
|
|
122
127
|
},
|
|
123
128
|
[data.subject.space],
|
|
@@ -131,19 +136,17 @@ export default (context: PluginContext) =>
|
|
|
131
136
|
},
|
|
132
137
|
}),
|
|
133
138
|
createSurface({
|
|
134
|
-
id: `${
|
|
139
|
+
id: `${meta.id}/app-graph`,
|
|
135
140
|
role: 'article',
|
|
136
141
|
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
137
|
-
component: ({ data }) => <
|
|
142
|
+
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
138
143
|
}),
|
|
139
144
|
createSurface({
|
|
140
|
-
id: `${
|
|
145
|
+
id: `${meta.id}/wireframe`,
|
|
141
146
|
role: ['article', 'section'],
|
|
142
147
|
position: 'hoist',
|
|
143
148
|
filter: (data): data is { subject: Obj.Any } => {
|
|
144
|
-
const settings = context
|
|
145
|
-
.getCapability(Capabilities.SettingsStore)
|
|
146
|
-
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
149
|
+
const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
|
|
147
150
|
return Obj.isObject(data.subject) && !!settings.wireframe;
|
|
148
151
|
},
|
|
149
152
|
component: ({ data, role }) => (
|
|
@@ -151,18 +154,18 @@ export default (context: PluginContext) =>
|
|
|
151
154
|
),
|
|
152
155
|
}),
|
|
153
156
|
createSurface({
|
|
154
|
-
id: `${
|
|
157
|
+
id: `${meta.id}/object-debug`,
|
|
155
158
|
role: 'article',
|
|
156
159
|
filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
|
|
157
160
|
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
158
161
|
}),
|
|
159
162
|
createSurface({
|
|
160
|
-
id: `${
|
|
163
|
+
id: `${meta.id}/devtools-overview`,
|
|
161
164
|
role: 'deck-companion--devtools',
|
|
162
165
|
component: () => <DevtoolsOverviewContainer />,
|
|
163
166
|
}),
|
|
164
167
|
createSurface({
|
|
165
|
-
id: `${
|
|
168
|
+
id: `${meta.id}/status`,
|
|
166
169
|
role: 'status',
|
|
167
170
|
component: () => <DebugStatus />,
|
|
168
171
|
}),
|
|
@@ -172,55 +175,55 @@ export default (context: PluginContext) =>
|
|
|
172
175
|
//
|
|
173
176
|
|
|
174
177
|
createSurface({
|
|
175
|
-
id: `${
|
|
178
|
+
id: `${meta.id}/client/config`,
|
|
176
179
|
role: 'article',
|
|
177
180
|
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
178
181
|
component: () => <ConfigPanel vaultSelector={false} />,
|
|
179
182
|
}),
|
|
180
183
|
createSurface({
|
|
181
|
-
id: `${
|
|
184
|
+
id: `${meta.id}/client/storage`,
|
|
182
185
|
role: 'article',
|
|
183
186
|
filter: (data): data is any => data.subject === Devtools.Client.Storage,
|
|
184
187
|
component: () => <StoragePanel />,
|
|
185
188
|
}),
|
|
186
189
|
createSurface({
|
|
187
|
-
id: `${
|
|
190
|
+
id: `${meta.id}/client/logs`,
|
|
188
191
|
role: 'article',
|
|
189
192
|
filter: (data): data is any => data.subject === Devtools.Client.Logs,
|
|
190
193
|
component: () => <LoggingPanel />,
|
|
191
194
|
}),
|
|
192
195
|
createSurface({
|
|
193
|
-
id: `${
|
|
196
|
+
id: `${meta.id}/client/diagnostics`,
|
|
194
197
|
role: 'article',
|
|
195
198
|
filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
|
|
196
199
|
component: () => <DiagnosticsPanel />,
|
|
197
200
|
}),
|
|
198
201
|
createSurface({
|
|
199
|
-
id: `${
|
|
202
|
+
id: `${meta.id}/client/tracing`,
|
|
200
203
|
role: 'article',
|
|
201
204
|
filter: (data): data is any => data.subject === Devtools.Client.Tracing,
|
|
202
205
|
component: () => <TracingPanel />,
|
|
203
206
|
}),
|
|
204
207
|
createSurface({
|
|
205
|
-
id: `${
|
|
208
|
+
id: `${meta.id}/halo/identity`,
|
|
206
209
|
role: 'article',
|
|
207
210
|
filter: (data): data is any => data.subject === Devtools.Halo.Identity,
|
|
208
211
|
component: () => <IdentityPanel />,
|
|
209
212
|
}),
|
|
210
213
|
createSurface({
|
|
211
|
-
id: `${
|
|
214
|
+
id: `${meta.id}/halo/devices`,
|
|
212
215
|
role: 'article',
|
|
213
216
|
filter: (data): data is any => data.subject === Devtools.Halo.Devices,
|
|
214
217
|
component: () => <DeviceListPanel />,
|
|
215
218
|
}),
|
|
216
219
|
createSurface({
|
|
217
|
-
id: `${
|
|
220
|
+
id: `${meta.id}/halo/keyring`,
|
|
218
221
|
role: 'article',
|
|
219
222
|
filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
|
|
220
223
|
component: () => <KeyringPanel />,
|
|
221
224
|
}),
|
|
222
225
|
createSurface({
|
|
223
|
-
id: `${
|
|
226
|
+
id: `${meta.id}/halo/credentials`,
|
|
224
227
|
role: 'article',
|
|
225
228
|
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
226
229
|
component: () => {
|
|
@@ -229,34 +232,46 @@ export default (context: PluginContext) =>
|
|
|
229
232
|
},
|
|
230
233
|
}),
|
|
231
234
|
createSurface({
|
|
232
|
-
id: `${
|
|
235
|
+
id: `${meta.id}/echo/spaces`,
|
|
233
236
|
role: 'article',
|
|
234
237
|
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
235
238
|
component: () => {
|
|
236
239
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
237
240
|
const handleSelect = useCallback(
|
|
238
|
-
() =>
|
|
241
|
+
() =>
|
|
242
|
+
dispatch(
|
|
243
|
+
createIntent(LayoutAction.Open, {
|
|
244
|
+
part: 'main',
|
|
245
|
+
subject: [Devtools.Echo.Space],
|
|
246
|
+
}),
|
|
247
|
+
),
|
|
239
248
|
[dispatch],
|
|
240
249
|
);
|
|
241
250
|
return <SpaceListPanel onSelect={handleSelect} />;
|
|
242
251
|
},
|
|
243
252
|
}),
|
|
244
253
|
createSurface({
|
|
245
|
-
id: `${
|
|
254
|
+
id: `${meta.id}/echo/space`,
|
|
246
255
|
role: 'article',
|
|
247
256
|
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
248
257
|
component: () => {
|
|
249
258
|
const space = useCurrentSpace();
|
|
250
259
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
251
260
|
const handleSelect = useCallback(
|
|
252
|
-
() =>
|
|
261
|
+
() =>
|
|
262
|
+
dispatch(
|
|
263
|
+
createIntent(LayoutAction.Open, {
|
|
264
|
+
part: 'main',
|
|
265
|
+
subject: [Devtools.Echo.Feeds],
|
|
266
|
+
}),
|
|
267
|
+
),
|
|
253
268
|
[dispatch],
|
|
254
269
|
);
|
|
255
270
|
return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
|
|
256
271
|
},
|
|
257
272
|
}),
|
|
258
273
|
createSurface({
|
|
259
|
-
id: `${
|
|
274
|
+
id: `${meta.id}/echo/feeds`,
|
|
260
275
|
role: 'article',
|
|
261
276
|
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
262
277
|
component: () => {
|
|
@@ -265,7 +280,7 @@ export default (context: PluginContext) =>
|
|
|
265
280
|
},
|
|
266
281
|
}),
|
|
267
282
|
createSurface({
|
|
268
|
-
id: `${
|
|
283
|
+
id: `${meta.id}/echo/objects`,
|
|
269
284
|
role: 'article',
|
|
270
285
|
filter: (data): data is any => data.subject === Devtools.Echo.Objects,
|
|
271
286
|
component: () => {
|
|
@@ -274,7 +289,7 @@ export default (context: PluginContext) =>
|
|
|
274
289
|
},
|
|
275
290
|
}),
|
|
276
291
|
createSurface({
|
|
277
|
-
id: `${
|
|
292
|
+
id: `${meta.id}/echo/schema`,
|
|
278
293
|
role: 'article',
|
|
279
294
|
filter: (data): data is any => data.subject === Devtools.Echo.Schema,
|
|
280
295
|
component: () => {
|
|
@@ -283,7 +298,7 @@ export default (context: PluginContext) =>
|
|
|
283
298
|
},
|
|
284
299
|
}),
|
|
285
300
|
createSurface({
|
|
286
|
-
id: `${
|
|
301
|
+
id: `${meta.id}/echo/automerge`,
|
|
287
302
|
role: 'article',
|
|
288
303
|
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
289
304
|
component: () => {
|
|
@@ -292,13 +307,13 @@ export default (context: PluginContext) =>
|
|
|
292
307
|
},
|
|
293
308
|
}),
|
|
294
309
|
createSurface({
|
|
295
|
-
id: `${
|
|
310
|
+
id: `${meta.id}/echo/queues`,
|
|
296
311
|
role: 'article',
|
|
297
312
|
filter: (data): data is any => data.subject === Devtools.Echo.Queues,
|
|
298
313
|
component: () => <QueuesPanel />,
|
|
299
314
|
}),
|
|
300
315
|
createSurface({
|
|
301
|
-
id: `${
|
|
316
|
+
id: `${meta.id}/echo/members`,
|
|
302
317
|
role: 'article',
|
|
303
318
|
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
304
319
|
component: () => {
|
|
@@ -307,25 +322,25 @@ export default (context: PluginContext) =>
|
|
|
307
322
|
},
|
|
308
323
|
}),
|
|
309
324
|
createSurface({
|
|
310
|
-
id: `${
|
|
325
|
+
id: `${meta.id}/echo/metadata`,
|
|
311
326
|
role: 'article',
|
|
312
327
|
filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
|
|
313
328
|
component: () => <MetadataPanel />,
|
|
314
329
|
}),
|
|
315
330
|
createSurface({
|
|
316
|
-
id: `${
|
|
331
|
+
id: `${meta.id}/mesh/signal`,
|
|
317
332
|
role: 'article',
|
|
318
333
|
filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
|
|
319
334
|
component: () => <SignalPanel />,
|
|
320
335
|
}),
|
|
321
336
|
createSurface({
|
|
322
|
-
id: `${
|
|
337
|
+
id: `${meta.id}/mesh/swarm`,
|
|
323
338
|
role: 'article',
|
|
324
339
|
filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
|
|
325
340
|
component: () => <SwarmPanel />,
|
|
326
341
|
}),
|
|
327
342
|
createSurface({
|
|
328
|
-
id: `${
|
|
343
|
+
id: `${meta.id}/mesh/network`,
|
|
329
344
|
role: 'article',
|
|
330
345
|
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
331
346
|
component: () => {
|
|
@@ -335,19 +350,19 @@ export default (context: PluginContext) =>
|
|
|
335
350
|
}),
|
|
336
351
|
// TODO(wittjosiah): Remove?
|
|
337
352
|
// createSurface({
|
|
338
|
-
// id: `${
|
|
353
|
+
// id: `${meta.id}/agent/dashboard`,
|
|
339
354
|
// role: 'article',
|
|
340
355
|
// filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
341
356
|
// component: () => <DashboardPanel />,
|
|
342
357
|
// }),
|
|
343
358
|
createSurface({
|
|
344
|
-
id: `${
|
|
359
|
+
id: `${meta.id}/edge/dashboard`,
|
|
345
360
|
role: 'article',
|
|
346
361
|
filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
|
|
347
362
|
component: () => <EdgeDashboardPanel />,
|
|
348
363
|
}),
|
|
349
364
|
createSurface({
|
|
350
|
-
id: `${
|
|
365
|
+
id: `${meta.id}/edge/workflows`,
|
|
351
366
|
role: 'article',
|
|
352
367
|
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
353
368
|
component: () => {
|
|
@@ -356,7 +371,7 @@ export default (context: PluginContext) =>
|
|
|
356
371
|
},
|
|
357
372
|
}),
|
|
358
373
|
createSurface({
|
|
359
|
-
id: `${
|
|
374
|
+
id: `${meta.id}/edge/traces`,
|
|
360
375
|
role: 'article',
|
|
361
376
|
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
362
377
|
component: () => {
|
|
@@ -365,7 +380,7 @@ export default (context: PluginContext) =>
|
|
|
365
380
|
},
|
|
366
381
|
}),
|
|
367
382
|
createSurface({
|
|
368
|
-
id: `${
|
|
383
|
+
id: `${meta.id}/edge/testing`,
|
|
369
384
|
role: 'article',
|
|
370
385
|
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
371
386
|
component: () => {
|
|
@@ -382,11 +397,17 @@ export default (context: PluginContext) =>
|
|
|
382
397
|
async (space: Space) => {
|
|
383
398
|
await space.waitUntilReady();
|
|
384
399
|
const result = await dispatch(
|
|
385
|
-
pipe(
|
|
400
|
+
Function.pipe(
|
|
401
|
+
createIntent(ScriptAction.CreateScript, { space }),
|
|
402
|
+
chain(SpaceAction.AddObject, { target: space }),
|
|
403
|
+
),
|
|
386
404
|
);
|
|
387
405
|
log.info('script created', { result });
|
|
388
406
|
await dispatch(
|
|
389
|
-
createIntent(LayoutAction.Open, {
|
|
407
|
+
createIntent(LayoutAction.Open, {
|
|
408
|
+
part: 'main',
|
|
409
|
+
subject: [`${space.id}:${result.data?.object.id}`],
|
|
410
|
+
}),
|
|
390
411
|
);
|
|
391
412
|
},
|
|
392
413
|
[dispatch],
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree } from '@dxos/devtools';
|
|
8
|
+
import { type Graph } from '@dxos/plugin-graph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {
|
|
11
|
+
return <Tree data={graph.toJSON(root)} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default DebugGraph;
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
|
|
9
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import {
|
|
10
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
11
|
|
|
12
12
|
export type DebugObjectPanelProps = {
|
|
13
13
|
object: Obj.Any;
|
|
@@ -26,9 +26,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
26
26
|
<Clipboard.IconButton value={dxn} />
|
|
27
27
|
</Input.Root>
|
|
28
28
|
</Toolbar.Root>
|
|
29
|
-
<
|
|
30
|
-
{JSON.stringify(object, null, 2)}
|
|
31
|
-
</SyntaxHighlighter>
|
|
29
|
+
<Json data={object} />
|
|
32
30
|
</StackItem.Content>
|
|
33
31
|
</Clipboard.Provider>
|
|
34
32
|
);
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
9
|
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
13
14
|
import { setDeep } from '@dxos/util';
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
+
import { meta } from '../meta';
|
|
16
17
|
import { type DebugSettingsProps } from '../types';
|
|
17
18
|
|
|
18
19
|
type Toast = {
|
|
@@ -26,7 +27,7 @@ const StorageAdapters = {
|
|
|
26
27
|
} as const;
|
|
27
28
|
|
|
28
29
|
export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {
|
|
29
|
-
const { t } = useTranslation(
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
30
31
|
const [toast, setToast] = useState<Toast>();
|
|
31
32
|
const client = useClient();
|
|
32
33
|
const download = useFileDownload();
|
|
@@ -46,22 +47,30 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
46
47
|
|
|
47
48
|
const handleDownload = async () => {
|
|
48
49
|
const data = await client.diagnostics();
|
|
49
|
-
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
50
|
+
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
51
|
+
type: 'text/plain',
|
|
52
|
+
});
|
|
50
53
|
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
51
54
|
download(file, fileName);
|
|
52
55
|
|
|
53
56
|
if (upload) {
|
|
54
|
-
const info = await upload(new File([file], fileName)
|
|
57
|
+
const info = await upload(client.spaces.default, new File([file], fileName));
|
|
55
58
|
if (!info) {
|
|
56
59
|
log.error('diagnostics failed to upload to IPFS');
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
|
-
handleToast({
|
|
62
|
+
handleToast({
|
|
63
|
+
title: t('settings uploaded'),
|
|
64
|
+
description: t('settings uploaded to clipboard'),
|
|
65
|
+
});
|
|
60
66
|
|
|
61
67
|
// TODO(nf): move to IpfsPlugin?
|
|
62
68
|
const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
|
|
63
69
|
void navigator.clipboard.writeText(url);
|
|
64
|
-
handleToast({
|
|
70
|
+
handleToast({
|
|
71
|
+
title: t('settings uploaded'),
|
|
72
|
+
description: t('settings uploaded to clipboard'),
|
|
73
|
+
});
|
|
65
74
|
log.info('diagnostics', { url });
|
|
66
75
|
}
|
|
67
76
|
};
|
|
@@ -70,74 +79,94 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
70
79
|
try {
|
|
71
80
|
const info = await client.repair();
|
|
72
81
|
setStorageConfig(await Storage());
|
|
73
|
-
handleToast({
|
|
82
|
+
handleToast({
|
|
83
|
+
title: t('settings repair success'),
|
|
84
|
+
description: JSON.stringify(info, undefined, 2),
|
|
85
|
+
});
|
|
74
86
|
} catch (err: any) {
|
|
75
|
-
handleToast({
|
|
87
|
+
handleToast({
|
|
88
|
+
title: t('settings repair failed'),
|
|
89
|
+
description: err.message,
|
|
90
|
+
});
|
|
76
91
|
}
|
|
77
92
|
};
|
|
78
93
|
|
|
79
94
|
return (
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
95
|
+
<ControlPage>
|
|
96
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
97
|
+
<ControlGroup>
|
|
98
|
+
<ControlItemInput title={t('settings wireframe')}>
|
|
99
|
+
<Input.Switch
|
|
100
|
+
checked={settings.wireframe}
|
|
101
|
+
onCheckedChange={(checked) => (settings.wireframe = !!checked)}
|
|
102
|
+
/>
|
|
103
|
+
</ControlItemInput>
|
|
104
|
+
<ControlItemInput title={t('settings download diagnostics')}>
|
|
105
|
+
<IconButton
|
|
106
|
+
icon='ph--download-simple--regular'
|
|
107
|
+
iconOnly
|
|
108
|
+
label={t('settings download diagnostics')}
|
|
109
|
+
onClick={handleDownload}
|
|
110
|
+
/>
|
|
111
|
+
</ControlItemInput>
|
|
112
|
+
<ControlItemInput title={t('settings repair')}>
|
|
113
|
+
<IconButton
|
|
114
|
+
icon='ph--first-aid-kit--regular'
|
|
115
|
+
iconOnly
|
|
116
|
+
label={t('settings repair')}
|
|
117
|
+
onClick={handleRepair}
|
|
118
|
+
/>
|
|
119
|
+
</ControlItemInput>
|
|
120
|
+
|
|
121
|
+
{/* TODO(burdon): Move to layout? */}
|
|
122
|
+
{toast && (
|
|
123
|
+
<Toast.Root>
|
|
124
|
+
<Toast.Body>
|
|
125
|
+
<Toast.Title>
|
|
126
|
+
<Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
|
|
127
|
+
<span>{toast.title}</span>
|
|
128
|
+
</Toast.Title>
|
|
129
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
130
|
+
</Toast.Body>
|
|
131
|
+
</Toast.Root>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
<ControlItemInput title={t('settings choose storage adaptor')}>
|
|
135
|
+
<Select.Root
|
|
136
|
+
value={
|
|
137
|
+
Object.entries(StorageAdapters).find(
|
|
138
|
+
([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
139
|
+
)?.[0]
|
|
140
|
+
}
|
|
141
|
+
onValueChange={(value) => {
|
|
142
|
+
if (confirm(t('settings storage adapter changed alert'))) {
|
|
143
|
+
updateConfig(
|
|
144
|
+
storageConfig,
|
|
145
|
+
setStorageConfig,
|
|
146
|
+
['runtime', 'client', 'storage', 'dataStore'],
|
|
147
|
+
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<Select.TriggerButton placeholder={t('settings data store label')} />
|
|
153
|
+
<Select.Portal>
|
|
154
|
+
<Select.Content>
|
|
155
|
+
<Select.Viewport>
|
|
156
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
157
|
+
<Select.Option key={key} value={key}>
|
|
158
|
+
{t(`settings storage adaptor ${key} label`)}
|
|
159
|
+
</Select.Option>
|
|
160
|
+
))}
|
|
161
|
+
</Select.Viewport>
|
|
162
|
+
<Select.Arrow />
|
|
163
|
+
</Select.Content>
|
|
164
|
+
</Select.Portal>
|
|
165
|
+
</Select.Root>
|
|
166
|
+
</ControlItemInput>
|
|
167
|
+
</ControlGroup>
|
|
168
|
+
</ControlSection>
|
|
169
|
+
</ControlPage>
|
|
141
170
|
);
|
|
142
171
|
};
|
|
143
172
|
|
|
@@ -59,7 +59,7 @@ const _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: numbe
|
|
|
59
59
|
// TODO(burdon): Integrate with Sentry?
|
|
60
60
|
const ErrorIndicator = () => {
|
|
61
61
|
const [, forceUpdate] = useState({});
|
|
62
|
-
const errorRef = useRef<Error>();
|
|
62
|
+
const errorRef = useRef<Error>(null);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
const errorListener = (event: any) => {
|
|
65
65
|
const error: Error = event.error ?? event.reason;
|
|
@@ -83,7 +83,7 @@ const ErrorIndicator = () => {
|
|
|
83
83
|
}, []);
|
|
84
84
|
|
|
85
85
|
const handleReset = () => {
|
|
86
|
-
errorRef.current =
|
|
86
|
+
errorRef.current = null;
|
|
87
87
|
forceUpdate({});
|
|
88
88
|
};
|
|
89
89
|
|