@dxos/plugin-debug 0.8.3-staging.0fa589b → 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
@@ -0,0 +1,411 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback } from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface, useCapability, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';
10
+ import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
11
+ import { useLayout } from '@dxos/app-toolkit/ui';
12
+ import {
13
+ AutomergePanel,
14
+ ConfigPanel,
15
+ CredentialsPanel,
16
+ DeviceListPanel,
17
+ DiagnosticsPanel,
18
+ EdgeDashboardPanel,
19
+ FeedsPanel,
20
+ IdentityPanel,
21
+ InvocationTraceContainer,
22
+ KeyringPanel,
23
+ LoggingPanel,
24
+ MembersPanel,
25
+ MetadataPanel,
26
+ NetworkPanel,
27
+ ObjectsPanel,
28
+ QueuesPanel,
29
+ SchemaPanel,
30
+ SignalPanel,
31
+ SpaceInfoPanel,
32
+ SpaceListPanel,
33
+ StoragePanel,
34
+ SwarmPanel,
35
+ TestingPanel,
36
+ TracingPanel,
37
+ WorkflowPanel,
38
+ } from '@dxos/devtools';
39
+ import { Obj } from '@dxos/echo';
40
+ import { log } from '@dxos/log';
41
+ import { ClientCapabilities } from '@dxos/plugin-client';
42
+ import { type Graph } from '@dxos/plugin-graph';
43
+ import { ScriptOperation } from '@dxos/plugin-script/types';
44
+ import { SpaceOperation } from '@dxos/plugin-space/types';
45
+ import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
46
+ import { Layout } from '@dxos/react-ui';
47
+ import { Collection } from '@dxos/schema';
48
+
49
+ import {
50
+ DebugGraph,
51
+ DebugObjectPanel,
52
+ DebugSettings,
53
+ DebugStatus,
54
+ DevtoolsOverviewContainer,
55
+ SpaceGenerator,
56
+ Wireframe,
57
+ } from '../../components';
58
+ import { meta } from '../../meta';
59
+ import { DebugCapabilities, type DebugSettingsProps, Devtools } from '../../types';
60
+
61
+ type SpaceDebug = {
62
+ type: string;
63
+ space: Space;
64
+ };
65
+
66
+ type GraphDebug = {
67
+ graph: Graph.Graph;
68
+ root: string;
69
+ };
70
+
71
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
72
+ const isGraphDebug = (data: any): data is GraphDebug => {
73
+ const graph = data?.graph;
74
+ return (
75
+ graph != null && typeof graph === 'object' && typeof graph.json === 'function' && typeof data?.root === 'string'
76
+ );
77
+ };
78
+
79
+ // TODO(wittjosiah): Factor out?
80
+ const useCurrentSpace = () => {
81
+ const layout = useLayout();
82
+ const client = useCapability(ClientCapabilities.Client);
83
+ const { spaceId } = parseId(layout.workspace);
84
+ const space = spaceId ? client.spaces.get(spaceId) : undefined;
85
+ return space;
86
+ };
87
+
88
+ export default Capability.makeModule(
89
+ Effect.fnUntraced(function* () {
90
+ const capabilities = yield* Capability.Service;
91
+ const registry = capabilities.get(Capabilities.AtomRegistry);
92
+ const settingsAtom = capabilities.get(DebugCapabilities.Settings);
93
+
94
+ return Capability.contributes(Capabilities.ReactSurface, [
95
+ Surface.create({
96
+ id: `${meta.id}/plugin-settings`,
97
+ role: 'article',
98
+ filter: (data): data is { subject: AppCapabilities.Settings } =>
99
+ AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
100
+ component: ({ data: { subject } }) => {
101
+ const { settings, updateSettings } = useSettingsState<DebugSettingsProps>(subject.atom);
102
+ return <DebugSettings settings={settings} onSettingsChange={updateSettings} />;
103
+ },
104
+ }),
105
+ Surface.create({
106
+ id: `${meta.id}/space`,
107
+ role: 'article',
108
+ filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
109
+ component: ({ role, data }) => {
110
+ const { invokePromise } = useOperationInvoker();
111
+
112
+ const handleCreateObject = useCallback(
113
+ (objects: Obj.Unknown[]) => {
114
+ if (!isSpace(data.subject.space)) {
115
+ return;
116
+ }
117
+
118
+ const collection =
119
+ data.subject.space.state.get() === SpaceState.SPACE_READY &&
120
+ data.subject.space.properties[Collection.Collection.typename]?.target;
121
+ if (!Obj.instanceOf(Collection.Collection, collection)) {
122
+ return;
123
+ }
124
+
125
+ objects.forEach((object) => {
126
+ void invokePromise(SpaceOperation.AddObject, {
127
+ target: collection,
128
+ object,
129
+ });
130
+ });
131
+ },
132
+ [data.subject.space, invokePromise],
133
+ );
134
+
135
+ return (
136
+ <Layout.Main role={role}>
137
+ <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
138
+ </Layout.Main>
139
+ );
140
+ },
141
+ }),
142
+ Surface.create({
143
+ id: `${meta.id}/app-graph`,
144
+ role: 'article',
145
+ filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
146
+ component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
147
+ }),
148
+ Surface.create({
149
+ id: `${meta.id}/wireframe`,
150
+ role: ['article', 'section'],
151
+ position: 'hoist',
152
+ filter: (data): data is { subject: Obj.Unknown } => {
153
+ const settings = registry.get(settingsAtom);
154
+ return Obj.isObject(data.subject) && !!settings.wireframe;
155
+ },
156
+ component: ({ data, role }) => (
157
+ <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
158
+ ),
159
+ }),
160
+ Surface.create({
161
+ id: `${meta.id}/object-debug`,
162
+ role: 'article',
163
+ filter: (data): data is { companionTo: Obj.Unknown } =>
164
+ data.subject === 'debug' && Obj.isObject(data.companionTo),
165
+ component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
166
+ }),
167
+ Surface.create({
168
+ id: `${meta.id}/devtools-overview`,
169
+ role: 'deck-companion--devtools',
170
+ component: () => <DevtoolsOverviewContainer />,
171
+ }),
172
+ Surface.create({
173
+ id: `${meta.id}/status`,
174
+ role: 'status',
175
+ component: () => <DebugStatus />,
176
+ }),
177
+
178
+ //
179
+ // Devtools
180
+ //
181
+
182
+ Surface.create({
183
+ id: `${meta.id}/client/config`,
184
+ role: 'article',
185
+ filter: (data): data is any => data.subject === Devtools.Client.Config,
186
+ component: () => <ConfigPanel vaultSelector={false} />,
187
+ }),
188
+ Surface.create({
189
+ id: `${meta.id}/client/storage`,
190
+ role: 'article',
191
+ filter: (data): data is any => data.subject === Devtools.Client.Storage,
192
+ component: () => <StoragePanel />,
193
+ }),
194
+ Surface.create({
195
+ id: `${meta.id}/client/logs`,
196
+ role: 'article',
197
+ filter: (data): data is any => data.subject === Devtools.Client.Logs,
198
+ component: () => <LoggingPanel />,
199
+ }),
200
+ Surface.create({
201
+ id: `${meta.id}/client/diagnostics`,
202
+ role: 'article',
203
+ filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
204
+ component: () => <DiagnosticsPanel />,
205
+ }),
206
+ Surface.create({
207
+ id: `${meta.id}/client/tracing`,
208
+ role: 'article',
209
+ filter: (data): data is any => data.subject === Devtools.Client.Tracing,
210
+ component: () => <TracingPanel />,
211
+ }),
212
+ Surface.create({
213
+ id: `${meta.id}/halo/identity`,
214
+ role: 'article',
215
+ filter: (data): data is any => data.subject === Devtools.Halo.Identity,
216
+ component: () => <IdentityPanel />,
217
+ }),
218
+ Surface.create({
219
+ id: `${meta.id}/halo/devices`,
220
+ role: 'article',
221
+ filter: (data): data is any => data.subject === Devtools.Halo.Devices,
222
+ component: () => <DeviceListPanel />,
223
+ }),
224
+ Surface.create({
225
+ id: `${meta.id}/halo/keyring`,
226
+ role: 'article',
227
+ filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
228
+ component: () => <KeyringPanel />,
229
+ }),
230
+ Surface.create({
231
+ id: `${meta.id}/halo/credentials`,
232
+ role: 'article',
233
+ filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
234
+ component: () => {
235
+ const space = useCurrentSpace();
236
+ return <CredentialsPanel space={space} />;
237
+ },
238
+ }),
239
+ Surface.create({
240
+ id: `${meta.id}/echo/spaces`,
241
+ role: 'article',
242
+ filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
243
+ component: () => {
244
+ const { invokePromise } = useOperationInvoker();
245
+ const handleSelect = useCallback(
246
+ () => invokePromise(LayoutOperation.Open, { subject: [Devtools.Echo.Space] }),
247
+ [invokePromise],
248
+ );
249
+ return <SpaceListPanel onSelect={handleSelect} />;
250
+ },
251
+ }),
252
+ Surface.create({
253
+ id: `${meta.id}/echo/space`,
254
+ role: 'article',
255
+ filter: (data): data is any => data.subject === Devtools.Echo.Space,
256
+ component: () => {
257
+ const space = useCurrentSpace();
258
+ const { invokePromise } = useOperationInvoker();
259
+ const handleSelect = useCallback(
260
+ () => invokePromise(LayoutOperation.Open, { subject: [Devtools.Echo.Feeds] }),
261
+ [invokePromise],
262
+ );
263
+ return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
264
+ },
265
+ }),
266
+ Surface.create({
267
+ id: `${meta.id}/echo/feeds`,
268
+ role: 'article',
269
+ filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
270
+ component: () => {
271
+ const space = useCurrentSpace();
272
+ return <FeedsPanel space={space} />;
273
+ },
274
+ }),
275
+ Surface.create({
276
+ id: `${meta.id}/echo/objects`,
277
+ role: 'article',
278
+ filter: (data): data is any => data.subject === Devtools.Echo.Objects,
279
+ component: () => {
280
+ const space = useCurrentSpace();
281
+ return <ObjectsPanel space={space} />;
282
+ },
283
+ }),
284
+ Surface.create({
285
+ id: `${meta.id}/echo/schema`,
286
+ role: 'article',
287
+ filter: (data): data is any => data.subject === Devtools.Echo.Schema,
288
+ component: () => {
289
+ const space = useCurrentSpace();
290
+ return <SchemaPanel space={space} />;
291
+ },
292
+ }),
293
+ Surface.create({
294
+ id: `${meta.id}/echo/automerge`,
295
+ role: 'article',
296
+ filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
297
+ component: () => {
298
+ const space = useCurrentSpace();
299
+ return <AutomergePanel space={space} />;
300
+ },
301
+ }),
302
+ Surface.create({
303
+ id: `${meta.id}/echo/queues`,
304
+ role: 'article',
305
+ filter: (data): data is any => data.subject === Devtools.Echo.Queues,
306
+ component: () => <QueuesPanel />,
307
+ }),
308
+ Surface.create({
309
+ id: `${meta.id}/echo/members`,
310
+ role: 'article',
311
+ filter: (data): data is any => data.subject === Devtools.Echo.Members,
312
+ component: () => {
313
+ const space = useCurrentSpace();
314
+ return <MembersPanel space={space} />;
315
+ },
316
+ }),
317
+ Surface.create({
318
+ id: `${meta.id}/echo/metadata`,
319
+ role: 'article',
320
+ filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
321
+ component: () => <MetadataPanel />,
322
+ }),
323
+ Surface.create({
324
+ id: `${meta.id}/mesh/signal`,
325
+ role: 'article',
326
+ filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
327
+ component: () => <SignalPanel />,
328
+ }),
329
+ Surface.create({
330
+ id: `${meta.id}/mesh/swarm`,
331
+ role: 'article',
332
+ filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
333
+ component: () => <SwarmPanel />,
334
+ }),
335
+ Surface.create({
336
+ id: `${meta.id}/mesh/network`,
337
+ role: 'article',
338
+ filter: (data): data is any => data.subject === Devtools.Mesh.Network,
339
+ component: () => {
340
+ const space = useCurrentSpace();
341
+ return <NetworkPanel space={space} />;
342
+ },
343
+ }),
344
+ // TODO(wittjosiah): Remove?
345
+ // createSurface({
346
+ // id: `${meta.id}/agent/dashboard`,
347
+ // role: 'article',
348
+ // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
349
+ // component: () => <DashboardPanel />,
350
+ // }),
351
+ Surface.create({
352
+ id: `${meta.id}/edge/dashboard`,
353
+ role: 'article',
354
+ filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
355
+ component: () => <EdgeDashboardPanel />,
356
+ }),
357
+ Surface.create({
358
+ id: `${meta.id}/edge/workflows`,
359
+ role: 'article',
360
+ filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
361
+ component: () => {
362
+ const space = useCurrentSpace();
363
+ return <WorkflowPanel space={space} />;
364
+ },
365
+ }),
366
+ Surface.create({
367
+ id: `${meta.id}/edge/traces`,
368
+ role: 'article',
369
+ filter: (data): data is any => data.subject === Devtools.Edge.Traces,
370
+ component: () => {
371
+ const space = useCurrentSpace();
372
+ const queueDxn = space?.properties.invocationTraceQueue?.dxn;
373
+ return <InvocationTraceContainer db={space?.db} queueDxn={queueDxn} detailAxis='block' />;
374
+ },
375
+ }),
376
+ Surface.create({
377
+ id: `${meta.id}/edge/testing`,
378
+ role: 'article',
379
+ filter: (data): data is any => data.subject === Devtools.Edge.Testing,
380
+ component: () => {
381
+ const { invokePromise } = useOperationInvoker();
382
+ const onSpaceCreate = useCallback(
383
+ async (space: Space) => {
384
+ await space.waitUntilReady();
385
+ await invokePromise(SpaceOperation.Migrate, { space });
386
+ await space.db.flush();
387
+ },
388
+ [invokePromise],
389
+ );
390
+ const onScriptPluginOpen = useCallback(
391
+ async (space: Space) => {
392
+ await space.waitUntilReady();
393
+ const createResult = await invokePromise(ScriptOperation.CreateScript, { db: space.db });
394
+ if (createResult.data?.object) {
395
+ await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });
396
+ }
397
+ log.info('script created', { result: createResult });
398
+ if (createResult.data?.object?.id) {
399
+ await invokePromise(LayoutOperation.Open, {
400
+ subject: [`${space.id}:${createResult.data.object.id}`],
401
+ });
402
+ }
403
+ },
404
+ [invokePromise],
405
+ );
406
+ return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
407
+ },
408
+ }),
409
+ ]);
410
+ }),
411
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const DebugSettings = Capability.lazy('DebugSettings', () => import('./settings'));
@@ -0,0 +1,31 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities } from '@dxos/app-toolkit';
9
+ import { createKvsStore } from '@dxos/effect';
10
+
11
+ import { meta } from '../../meta';
12
+ import { DebugCapabilities, DebugSettingsSchema } from '../../types';
13
+
14
+ export default Capability.makeModule(() =>
15
+ Effect.sync(() => {
16
+ const settingsAtom = createKvsStore({
17
+ key: meta.id,
18
+ schema: DebugSettingsSchema,
19
+ defaultValue: () => ({}),
20
+ });
21
+
22
+ return [
23
+ Capability.contributes(DebugCapabilities.Settings, settingsAtom),
24
+ Capability.contributes(AppCapabilities.Settings, {
25
+ prefix: meta.id,
26
+ schema: DebugSettingsSchema,
27
+ atom: settingsAtom,
28
+ }),
29
+ ];
30
+ }),
31
+ );
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { type FC } from 'react';
6
+
7
+ import { Tree } from '@dxos/devtools';
8
+ import { Graph } from '@dxos/plugin-graph';
9
+
10
+ export type DebugGraphProps = { graph: Graph.Graph; root: string };
11
+ export const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {
12
+ return <Tree data={Graph.toJSON(graph, root)} />;
13
+ };
14
+
15
+ export default DebugGraph;
@@ -5,12 +5,11 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { type Obj } from '@dxos/echo';
8
- import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
9
- import { StackItem } from '@dxos/react-ui-stack';
10
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
8
+ import { Clipboard, Input, Layout, Toolbar } from '@dxos/react-ui';
9
+ import { Json } from '@dxos/react-ui-syntax-highlighter';
11
10
 
12
11
  export type DebugObjectPanelProps = {
13
- object: Obj.Any;
12
+ object: Obj.Unknown;
14
13
  };
15
14
 
16
15
  // TODO(burdon): Get schema and traverse references.
@@ -19,17 +18,15 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
19
18
 
20
19
  return (
21
20
  <Clipboard.Provider>
22
- <StackItem.Content toolbar>
21
+ <Layout.Main toolbar>
23
22
  <Toolbar.Root>
24
23
  <Input.Root>
25
24
  <Input.TextInput disabled value={dxn} />
26
25
  <Clipboard.IconButton value={dxn} />
27
26
  </Input.Root>
28
27
  </Toolbar.Root>
29
- <SyntaxHighlighter classNames='flex text-xs' language='json'>
30
- {JSON.stringify(object, null, 2)}
31
- </SyntaxHighlighter>
32
- </StackItem.Content>
28
+ <Json data={object} />
29
+ </Layout.Main>
33
30
  </Clipboard.Provider>
34
31
  );
35
32
  };