@dxos/plugin-debug 0.8.3 → 0.8.4-main.1068cf700f

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 (132) hide show
  1. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
  2. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
  3. package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs +19 -0
  4. package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
  5. package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs +1152 -0
  6. package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
  8. package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-KS3YBEL7.mjs → chunk-4UFQXPP7.mjs} +13 -3
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-A5H5GRV6.mjs +20 -0
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +42 -46
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
  17. package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-FMVC5GPV.mjs +758 -0
  19. package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +7 -0
  20. package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
  21. package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
  22. package/dist/types/src/DebugPlugin.d.ts +2 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  25. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  27. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/index.d.ts +4 -8
  29. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
  31. package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
  33. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  37. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  39. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
  41. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  42. package/dist/types/src/components/DebugGraph.d.ts +9 -0
  43. package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
  44. package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
  45. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  46. package/dist/types/src/components/DebugSettings.d.ts +4 -2
  47. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  48. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +6 -4
  49. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  50. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  51. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  52. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
  53. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  55. package/dist/types/src/components/SpaceGenerator/presets.d.ts +5 -8
  56. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  57. package/dist/types/src/components/Wireframe.d.ts +2 -2
  58. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  59. package/dist/types/src/components/index.d.ts +4 -3
  60. package/dist/types/src/components/index.d.ts.map +1 -1
  61. package/dist/types/src/meta.d.ts +2 -3
  62. package/dist/types/src/meta.d.ts.map +1 -1
  63. package/dist/types/src/translations.d.ts +62 -60
  64. package/dist/types/src/translations.d.ts.map +1 -1
  65. package/dist/types/src/types.d.ts +6 -1
  66. package/dist/types/src/types.d.ts.map +1 -1
  67. package/dist/types/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +79 -71
  69. package/src/DebugPlugin.tsx +19 -34
  70. package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -0
  71. package/src/capabilities/app-graph-builder/index.ts +7 -0
  72. package/src/capabilities/index.ts +4 -6
  73. package/src/capabilities/react-context/index.ts +7 -0
  74. package/src/capabilities/react-context/react-context.tsx +20 -0
  75. package/src/capabilities/react-surface/index.ts +7 -0
  76. package/src/capabilities/react-surface/react-surface.tsx +411 -0
  77. package/src/capabilities/settings/index.ts +7 -0
  78. package/src/capabilities/settings/settings.ts +31 -0
  79. package/src/components/DebugGraph.tsx +15 -0
  80. package/src/components/DebugObjectPanel.tsx +6 -9
  81. package/src/components/DebugSettings.tsx +109 -75
  82. package/src/components/DebugStatus.tsx +2 -2
  83. package/src/components/DevtoolsOverviewContainer.tsx +2 -2
  84. package/src/components/SpaceGenerator/ObjectGenerator.tsx +40 -41
  85. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  86. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +17 -15
  87. package/src/components/SpaceGenerator/SpaceGenerator.tsx +41 -94
  88. package/src/components/SpaceGenerator/draw-util.ts +5 -5
  89. package/src/components/SpaceGenerator/presets.ts +537 -259
  90. package/src/components/Wireframe.tsx +6 -6
  91. package/src/components/index.ts +4 -1
  92. package/src/meta.ts +8 -7
  93. package/src/translations.ts +9 -5
  94. package/src/types.ts +9 -1
  95. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +0 -225
  96. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
  97. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +0 -25
  98. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +0 -7
  99. package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs +0 -1238
  100. package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
  101. package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs +0 -597
  102. package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs.map +0 -7
  103. package/dist/lib/browser/chunk-47JOZTT2.mjs +0 -18
  104. package/dist/lib/browser/chunk-47JOZTT2.mjs.map +0 -7
  105. package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +0 -7
  106. package/dist/lib/browser/react-context-ZQRD2WG2.mjs +0 -16
  107. package/dist/lib/browser/react-context-ZQRD2WG2.mjs.map +0 -7
  108. package/dist/lib/browser/react-surface-UI6OK73H.mjs +0 -768
  109. package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
  110. package/dist/lib/browser/settings-SXQWSIM4.mjs +0 -22
  111. package/dist/lib/browser/settings-SXQWSIM4.mjs.map +0 -7
  112. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  113. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  114. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  115. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  116. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  117. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  118. package/dist/types/src/capabilities/settings.d.ts +0 -4
  119. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  120. package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
  121. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
  122. package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
  123. package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
  124. package/dist/types/src/components/DebugApp/index.d.ts +0 -3
  125. package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
  126. package/src/capabilities/app-graph-builder.ts +0 -457
  127. package/src/capabilities/react-context.tsx +0 -16
  128. package/src/capabilities/react-surface.tsx +0 -397
  129. package/src/capabilities/settings.ts +0 -19
  130. package/src/components/DebugApp/DebugApp.tsx +0 -77
  131. package/src/components/DebugApp/Tree.tsx +0 -103
  132. package/src/components/DebugApp/index.ts +0 -7
@@ -1,397 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { pipe } from 'effect';
6
- import React, { useCallback } from 'react';
7
-
8
- import {
9
- Capabilities,
10
- chain,
11
- contributes,
12
- createIntent,
13
- createSurface,
14
- LayoutAction,
15
- useCapability,
16
- useIntentDispatcher,
17
- type PluginContext,
18
- } from '@dxos/app-framework';
19
- import {
20
- AutomergePanel,
21
- ConfigPanel,
22
- CredentialsPanel,
23
- DeviceListPanel,
24
- DiagnosticsPanel,
25
- EdgeDashboardPanel,
26
- FeedsPanel,
27
- IdentityPanel,
28
- InvocationTraceContainer,
29
- KeyringPanel,
30
- LoggingPanel,
31
- MembersPanel,
32
- MetadataPanel,
33
- NetworkPanel,
34
- ObjectsPanel,
35
- QueuesPanel,
36
- SchemaPanel,
37
- SignalPanel,
38
- SpaceInfoPanel,
39
- SpaceListPanel,
40
- StoragePanel,
41
- SwarmPanel,
42
- TestingPanel,
43
- TracingPanel,
44
- WorkflowPanel,
45
- } from '@dxos/devtools';
46
- import { Obj, Type } from '@dxos/echo';
47
- import { SettingsStore } from '@dxos/local-storage';
48
- import { log } from '@dxos/log';
49
- import { ClientCapabilities } from '@dxos/plugin-client';
50
- import { Graph } from '@dxos/plugin-graph';
51
- import { ScriptAction } from '@dxos/plugin-script/types';
52
- import { SpaceAction } from '@dxos/plugin-space/types';
53
- import { SpaceState, isSpace, type Space, parseId } from '@dxos/react-client/echo';
54
- import { StackItem } from '@dxos/react-ui-stack';
55
- import { DataType } from '@dxos/schema';
56
-
57
- import {
58
- DebugApp,
59
- DebugObjectPanel,
60
- DebugSettings,
61
- DebugStatus,
62
- DevtoolsOverviewContainer,
63
- SpaceGenerator,
64
- Wireframe,
65
- } from '../components';
66
- import { DEBUG_PLUGIN } from '../meta';
67
- import { type DebugSettingsProps, Devtools } from '../types';
68
-
69
- type SpaceDebug = {
70
- type: string;
71
- space: Space;
72
- };
73
-
74
- type GraphDebug = {
75
- graph: Graph;
76
- };
77
-
78
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
79
- const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
80
-
81
- // TODO(wittjosiah): Factor out?
82
- const useCurrentSpace = () => {
83
- const layout = useCapability(Capabilities.Layout);
84
- const client = useCapability(ClientCapabilities.Client);
85
- const { spaceId } = parseId(layout.workspace);
86
- const space = spaceId ? client.spaces.get(spaceId) : undefined;
87
- return space;
88
- };
89
-
90
- export default (context: PluginContext) =>
91
- contributes(Capabilities.ReactSurface, [
92
- createSurface({
93
- id: `${DEBUG_PLUGIN}/plugin-settings`,
94
- role: 'article',
95
- filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
96
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
97
- component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
98
- }),
99
- createSurface({
100
- id: `${DEBUG_PLUGIN}/space`,
101
- role: 'article',
102
- filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
103
- component: ({ data }) => {
104
- const { dispatchPromise: dispatch } = useIntentDispatcher();
105
-
106
- const handleCreateObject = useCallback(
107
- (objects: Obj.Any[]) => {
108
- if (!isSpace(data.subject.space)) {
109
- return;
110
- }
111
-
112
- const collection =
113
- data.subject.space.state.get() === SpaceState.SPACE_READY &&
114
- data.subject.space.properties[Type.getTypename(DataType.Collection)]?.target;
115
- if (!Obj.instanceOf(DataType.Collection, collection)) {
116
- return;
117
- }
118
-
119
- objects.forEach((object) => {
120
- void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
121
- });
122
- },
123
- [data.subject.space],
124
- );
125
-
126
- return (
127
- <StackItem.Content>
128
- <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
129
- </StackItem.Content>
130
- );
131
- },
132
- }),
133
- createSurface({
134
- id: `${DEBUG_PLUGIN}/graph`,
135
- role: 'article',
136
- filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
137
- component: ({ data }) => <DebugApp graph={data.subject.graph} />,
138
- }),
139
- createSurface({
140
- id: `${DEBUG_PLUGIN}/wireframe`,
141
- role: ['article', 'section'],
142
- position: 'hoist',
143
- filter: (data): data is { subject: Obj.Any } => {
144
- const settings = context
145
- .getCapability(Capabilities.SettingsStore)
146
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
147
- return Obj.isObject(data.subject) && !!settings.wireframe;
148
- },
149
- component: ({ data, role }) => (
150
- <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
151
- ),
152
- }),
153
- createSurface({
154
- id: `${DEBUG_PLUGIN}/object-debug`,
155
- role: 'article',
156
- filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
157
- component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
158
- }),
159
- createSurface({
160
- id: `${DEBUG_PLUGIN}/devtools-overview`,
161
- role: 'deck-companion--devtools',
162
- component: () => <DevtoolsOverviewContainer />,
163
- }),
164
- createSurface({
165
- id: `${DEBUG_PLUGIN}/status`,
166
- role: 'status',
167
- component: () => <DebugStatus />,
168
- }),
169
-
170
- //
171
- // Devtools
172
- //
173
-
174
- createSurface({
175
- id: `${DEBUG_PLUGIN}/client/config`,
176
- role: 'article',
177
- filter: (data): data is any => data.subject === Devtools.Client.Config,
178
- component: () => <ConfigPanel vaultSelector={false} />,
179
- }),
180
- createSurface({
181
- id: `${DEBUG_PLUGIN}/client/storage`,
182
- role: 'article',
183
- filter: (data): data is any => data.subject === Devtools.Client.Storage,
184
- component: () => <StoragePanel />,
185
- }),
186
- createSurface({
187
- id: `${DEBUG_PLUGIN}/client/logs`,
188
- role: 'article',
189
- filter: (data): data is any => data.subject === Devtools.Client.Logs,
190
- component: () => <LoggingPanel />,
191
- }),
192
- createSurface({
193
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
194
- role: 'article',
195
- filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
196
- component: () => <DiagnosticsPanel />,
197
- }),
198
- createSurface({
199
- id: `${DEBUG_PLUGIN}/client/tracing`,
200
- role: 'article',
201
- filter: (data): data is any => data.subject === Devtools.Client.Tracing,
202
- component: () => <TracingPanel />,
203
- }),
204
- createSurface({
205
- id: `${DEBUG_PLUGIN}/halo/identity`,
206
- role: 'article',
207
- filter: (data): data is any => data.subject === Devtools.Halo.Identity,
208
- component: () => <IdentityPanel />,
209
- }),
210
- createSurface({
211
- id: `${DEBUG_PLUGIN}/halo/devices`,
212
- role: 'article',
213
- filter: (data): data is any => data.subject === Devtools.Halo.Devices,
214
- component: () => <DeviceListPanel />,
215
- }),
216
- createSurface({
217
- id: `${DEBUG_PLUGIN}/halo/keyring`,
218
- role: 'article',
219
- filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
220
- component: () => <KeyringPanel />,
221
- }),
222
- createSurface({
223
- id: `${DEBUG_PLUGIN}/halo/credentials`,
224
- role: 'article',
225
- filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
226
- component: () => {
227
- const space = useCurrentSpace();
228
- return <CredentialsPanel space={space} />;
229
- },
230
- }),
231
- createSurface({
232
- id: `${DEBUG_PLUGIN}/echo/spaces`,
233
- role: 'article',
234
- filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
235
- component: () => {
236
- const { dispatchPromise: dispatch } = useIntentDispatcher();
237
- const handleSelect = useCallback(
238
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
239
- [dispatch],
240
- );
241
- return <SpaceListPanel onSelect={handleSelect} />;
242
- },
243
- }),
244
- createSurface({
245
- id: `${DEBUG_PLUGIN}/echo/space`,
246
- role: 'article',
247
- filter: (data): data is any => data.subject === Devtools.Echo.Space,
248
- component: () => {
249
- const space = useCurrentSpace();
250
- const { dispatchPromise: dispatch } = useIntentDispatcher();
251
- const handleSelect = useCallback(
252
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
253
- [dispatch],
254
- );
255
- return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
256
- },
257
- }),
258
- createSurface({
259
- id: `${DEBUG_PLUGIN}/echo/feeds`,
260
- role: 'article',
261
- filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
262
- component: () => {
263
- const space = useCurrentSpace();
264
- return <FeedsPanel space={space} />;
265
- },
266
- }),
267
- createSurface({
268
- id: `${DEBUG_PLUGIN}/echo/objects`,
269
- role: 'article',
270
- filter: (data): data is any => data.subject === Devtools.Echo.Objects,
271
- component: () => {
272
- const space = useCurrentSpace();
273
- return <ObjectsPanel space={space} />;
274
- },
275
- }),
276
- createSurface({
277
- id: `${DEBUG_PLUGIN}/echo/schema`,
278
- role: 'article',
279
- filter: (data): data is any => data.subject === Devtools.Echo.Schema,
280
- component: () => {
281
- const space = useCurrentSpace();
282
- return <SchemaPanel space={space} />;
283
- },
284
- }),
285
- createSurface({
286
- id: `${DEBUG_PLUGIN}/echo/automerge`,
287
- role: 'article',
288
- filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
289
- component: () => {
290
- const space = useCurrentSpace();
291
- return <AutomergePanel space={space} />;
292
- },
293
- }),
294
- createSurface({
295
- id: `${DEBUG_PLUGIN}/echo/queues`,
296
- role: 'article',
297
- filter: (data): data is any => data.subject === Devtools.Echo.Queues,
298
- component: () => <QueuesPanel />,
299
- }),
300
- createSurface({
301
- id: `${DEBUG_PLUGIN}/echo/members`,
302
- role: 'article',
303
- filter: (data): data is any => data.subject === Devtools.Echo.Members,
304
- component: () => {
305
- const space = useCurrentSpace();
306
- return <MembersPanel space={space} />;
307
- },
308
- }),
309
- createSurface({
310
- id: `${DEBUG_PLUGIN}/echo/metadata`,
311
- role: 'article',
312
- filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
313
- component: () => <MetadataPanel />,
314
- }),
315
- createSurface({
316
- id: `${DEBUG_PLUGIN}/mesh/signal`,
317
- role: 'article',
318
- filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
319
- component: () => <SignalPanel />,
320
- }),
321
- createSurface({
322
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
323
- role: 'article',
324
- filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
325
- component: () => <SwarmPanel />,
326
- }),
327
- createSurface({
328
- id: `${DEBUG_PLUGIN}/mesh/network`,
329
- role: 'article',
330
- filter: (data): data is any => data.subject === Devtools.Mesh.Network,
331
- component: () => {
332
- const space = useCurrentSpace();
333
- return <NetworkPanel space={space} />;
334
- },
335
- }),
336
- // TODO(wittjosiah): Remove?
337
- // createSurface({
338
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
339
- // role: 'article',
340
- // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
341
- // component: () => <DashboardPanel />,
342
- // }),
343
- createSurface({
344
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
345
- role: 'article',
346
- filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
347
- component: () => <EdgeDashboardPanel />,
348
- }),
349
- createSurface({
350
- id: `${DEBUG_PLUGIN}/edge/workflows`,
351
- role: 'article',
352
- filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
353
- component: () => {
354
- const space = useCurrentSpace();
355
- return <WorkflowPanel space={space} />;
356
- },
357
- }),
358
- createSurface({
359
- id: `${DEBUG_PLUGIN}/edge/traces`,
360
- role: 'article',
361
- filter: (data): data is any => data.subject === Devtools.Edge.Traces,
362
- component: () => {
363
- const space = useCurrentSpace();
364
- return <InvocationTraceContainer space={space} detailAxis='block' />;
365
- },
366
- }),
367
- createSurface({
368
- id: `${DEBUG_PLUGIN}/edge/testing`,
369
- role: 'article',
370
- filter: (data): data is any => data.subject === Devtools.Edge.Testing,
371
- component: () => {
372
- const { dispatchPromise: dispatch } = useIntentDispatcher();
373
- const onSpaceCreate = useCallback(
374
- async (space: Space) => {
375
- await space.waitUntilReady();
376
- await dispatch(createIntent(SpaceAction.Migrate, { space }));
377
- await space.db.flush();
378
- },
379
- [dispatch],
380
- );
381
- const onScriptPluginOpen = useCallback(
382
- async (space: Space) => {
383
- await space.waitUntilReady();
384
- const result = await dispatch(
385
- pipe(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
386
- );
387
- log.info('script created', { result });
388
- await dispatch(
389
- createIntent(LayoutAction.Open, { part: 'main', subject: [`${space.id}:${result.data?.object.id}`] }),
390
- );
391
- },
392
- [dispatch],
393
- );
394
- return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
395
- },
396
- }),
397
- ]);
@@ -1,19 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capabilities, contributes } from '@dxos/app-framework';
6
- import { live } from '@dxos/live-object';
7
-
8
- import { meta } from '../meta';
9
- import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
10
-
11
- export default () => {
12
- const settings = live<DebugSettingsProps>({});
13
-
14
- return contributes(Capabilities.Settings, {
15
- prefix: meta.id,
16
- schema: DebugSettingsSchema,
17
- value: settings,
18
- });
19
- };
@@ -1,77 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { Gauge, Graph as GraphIcon, Gear, Toolbox, Warning } from '@phosphor-icons/react';
6
- import React, { type FC, useEffect, useState } from 'react';
7
-
8
- import { type Graph } from '@dxos/plugin-graph';
9
- import { useClient, useConfig } from '@dxos/react-client';
10
- import { Button, ToggleGroup, ToggleGroupItem, Toolbar } from '@dxos/react-ui';
11
- import { getSize, mx } from '@dxos/react-ui-theme';
12
-
13
- import { Json, Tree } from './Tree';
14
- import { Container } from '../Container';
15
-
16
- export const DebugApp: FC<{ graph: Graph }> = ({ graph }) => {
17
- const [view, setView] = useState<'config' | 'diagnostics' | 'graph'>('graph');
18
- const [data, setData] = useState<any>({});
19
- const client = useClient();
20
- const config = useConfig();
21
- const handleRefresh = async () => {
22
- const data = await client.diagnostics({ truncate: true });
23
- setData(data);
24
- };
25
- useEffect(() => {
26
- void handleRefresh();
27
- }, []);
28
-
29
- const handleResetClient = async (force = false) => {
30
- if (!force && !window.confirm('Reset storage?')) {
31
- return;
32
- }
33
-
34
- // TODO(burdon): Throws exception.
35
- await client.reset();
36
- window.location.href = window.location.origin;
37
- };
38
-
39
- const handleOpenDevtools = () => {
40
- const vaultUrl = config.values?.runtime?.client?.remoteSource;
41
- if (vaultUrl) {
42
- window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);
43
- }
44
- };
45
-
46
- return (
47
- <Container
48
- toolbar={
49
- <Toolbar.Root classNames='p-1'>
50
- <ToggleGroup type='single' value={view}>
51
- <ToggleGroupItem value={'graph'} onClick={() => setView('graph')} title={'Plugin graph'}>
52
- <GraphIcon className={getSize(5)} />
53
- </ToggleGroupItem>
54
- <ToggleGroupItem value={'diagnostics'} onClick={() => setView('diagnostics')} title={'Diagnostics'}>
55
- <Gauge className={getSize(5)} />
56
- </ToggleGroupItem>
57
- <ToggleGroupItem value={'config'} onClick={() => setView('config')} title={'Config'}>
58
- <Gear className={getSize(5)} />
59
- </ToggleGroupItem>
60
- </ToggleGroup>
61
-
62
- <Toolbar.Separator variant='gap' />
63
- <Button onClick={(event) => handleResetClient(event.shiftKey)} title='Reset client'>
64
- <Warning className={mx(getSize(5), 'text-red-700')} />
65
- </Button>
66
- <Button onClick={handleOpenDevtools} title='Open Devtools'>
67
- <Toolbox weight='duotone' className={mx(getSize(5), 'text-700')} />
68
- </Button>
69
- </Toolbar.Root>
70
- }
71
- >
72
- {view === 'graph' && <Tree data={graph.toJSON()} />}
73
- {view === 'config' && <Json data={data.diagnostics?.config} />}
74
- {view === 'diagnostics' && <Json data={data} />}
75
- </Container>
76
- );
77
- };
@@ -1,103 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { type FC, type HTMLAttributes, useState } from 'react';
6
-
7
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
8
- import { mx } from '@dxos/react-ui-theme';
9
- import { arrayToBuffer } from '@dxos/util';
10
-
11
- // TODO(burdon): Copied form devtools.
12
-
13
- export const replacer = (key: any, value: any) => {
14
- if (typeof value === 'object') {
15
- if (value instanceof Uint8Array) {
16
- return arrayToBuffer(value).toString('hex');
17
- }
18
-
19
- if (value?.type === 'Buffer') {
20
- return Buffer.from(value.data).toString('hex');
21
- }
22
-
23
- if (key === 'downloaded') {
24
- return undefined;
25
- }
26
- }
27
-
28
- return value;
29
- };
30
-
31
- export const Json: FC<{ data?: object }> = ({ data }) => {
32
- return <SyntaxHighlighter language='json'>{JSON.stringify(data, replacer, 2)}</SyntaxHighlighter>;
33
- };
34
-
35
- export const Tree: FC<{ data?: object }> = ({ data }) => {
36
- return (
37
- <div className='p-2'>
38
- <Node data={data} root />
39
- </div>
40
- );
41
- };
42
-
43
- export const Node: FC<{ data?: any; root?: boolean }> = ({ data, root }) => {
44
- if (typeof data !== 'object' || data === undefined || data === null) {
45
- return <Scalar value={data} />;
46
- }
47
-
48
- if (Array.isArray(data)) {
49
- return (
50
- <div className='flex flex-col space-y-2'>
51
- {data.map((value, index) => (
52
- <KeyValue key={index} label={String(index)} data={value} className='bg-teal-50' />
53
- ))}
54
- </div>
55
- );
56
- }
57
-
58
- return (
59
- <div className='flex flex-col space-y-2'>
60
- {Object.entries(data).map(([key, value]) => (
61
- <KeyValue key={key} label={key} data={value} className='bg-blue-50' />
62
- ))}
63
- </div>
64
- );
65
- };
66
-
67
- export const KeyValue: FC<{ label: string; data?: any; className?: string }> = ({ label, data, className }) => {
68
- const [open, setOpen] = useState(true);
69
- if (data === undefined) {
70
- return null;
71
- }
72
-
73
- return (
74
- <div className='flex'>
75
- <Box
76
- className={mx('border-blue-200 text-sm select-none cursor-pointer', className)}
77
- onClick={() => setOpen((open) => !open)}
78
- >
79
- {label}
80
- </Box>
81
- {open && <Node data={data} />}
82
- </div>
83
- );
84
- };
85
-
86
- const Scalar: FC<{ value: any }> = ({ value }) => {
87
- return (
88
- <Box className='bg-green-50 border-green-200 rounded-r text-sm font-thin'>
89
- {(value === undefined && 'undefined') ||
90
- (value === null && 'null') ||
91
- (typeof value === 'string' && value) ||
92
- JSON.stringify(value)}
93
- </Box>
94
- );
95
- };
96
-
97
- const Box: FC<HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => {
98
- return (
99
- <div className={mx('flex px-2 border border-l-0 font-mono truncate', className)} {...props}>
100
- {children}
101
- </div>
102
- );
103
- };
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { DebugApp } from './DebugApp';
6
-
7
- export default DebugApp;