@dxos/plugin-debug 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca

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 (111) 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-77PKFLYV.mjs +19 -0
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-JXVZVPHN.mjs.map → DevtoolsOverviewContainer-77PKFLYV.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-46TAISVE.mjs → SpaceGenerator-ZHVZWGM7.mjs} +192 -195
  6. package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
  8. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +33 -38
  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-FSWBT3MH.mjs +17 -0
  17. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-W62RJ32U.mjs +757 -0
  19. package/dist/lib/browser/react-surface-W62RJ32U.mjs.map +7 -0
  20. package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
  21. package/dist/lib/browser/settings-KA4GN73K.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 +5 -0
  41. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  42. package/dist/types/src/components/DebugGraph.d.ts +5 -4
  43. package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
  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 +5 -5
  49. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  50. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
  51. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  52. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -4
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  55. package/dist/types/src/components/Wireframe.d.ts +1 -1
  56. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  57. package/dist/types/src/components/index.d.ts +4 -4
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +2 -2
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/types.d.ts +5 -0
  62. package/dist/types/src/types.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +76 -71
  65. package/src/DebugPlugin.tsx +16 -31
  66. package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -0
  67. package/src/capabilities/app-graph-builder/index.ts +7 -0
  68. package/src/capabilities/index.ts +4 -6
  69. package/src/capabilities/react-context/index.ts +7 -0
  70. package/src/capabilities/react-context/react-context.tsx +20 -0
  71. package/src/capabilities/react-surface/index.ts +7 -0
  72. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  73. package/src/capabilities/settings/index.ts +7 -0
  74. package/src/capabilities/settings/settings.ts +30 -0
  75. package/src/components/DebugGraph.tsx +4 -3
  76. package/src/components/DebugObjectPanel.tsx +4 -4
  77. package/src/components/DebugSettings.tsx +10 -5
  78. package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -16
  79. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
  80. package/src/components/SpaceGenerator/SpaceGenerator.tsx +17 -12
  81. package/src/components/SpaceGenerator/presets.ts +151 -37
  82. package/src/components/Wireframe.tsx +2 -2
  83. package/src/components/index.ts +4 -1
  84. package/src/meta.ts +2 -2
  85. package/src/types.ts +8 -0
  86. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  87. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  88. package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
  89. package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +0 -7
  90. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
  91. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  94. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  95. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  96. package/dist/lib/browser/react-surface-2SNVZDEA.mjs +0 -774
  97. package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +0 -7
  98. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  99. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  100. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  101. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  102. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  103. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  104. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  105. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  106. package/dist/types/src/capabilities/settings.d.ts +0 -4
  107. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  108. package/src/capabilities/app-graph-builder.ts +0 -431
  109. package/src/capabilities/react-context.tsx +0 -16
  110. package/src/capabilities/react-surface.tsx +0 -418
  111. package/src/capabilities/settings.ts +0 -19
@@ -2,9 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
6
-
7
- export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
8
- export const ReactContext = lazy(() => import('./react-context'));
9
- export const ReactSurface = lazy(() => import('./react-surface'));
10
- export const DebugSettings = lazy(() => import('./settings'));
5
+ export * from './app-graph-builder';
6
+ export * from './react-context';
7
+ export * from './react-surface';
8
+ export * from './settings';
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactContext = Capability.lazy('ReactContext', () => import('./react-context'));
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capability, Common } from '@dxos/app-framework';
9
+ import { DevtoolsContextProvider } from '@dxos/devtools';
10
+
11
+ import { meta } from '../../meta';
12
+
13
+ export default Capability.makeModule(() =>
14
+ Effect.succeed(
15
+ Capability.contributes(Common.Capability.ReactContext, {
16
+ id: meta.id,
17
+ context: ({ children }) => <DevtoolsContextProvider>{children}</DevtoolsContextProvider>,
18
+ }),
19
+ ),
20
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,409 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback } from 'react';
7
+
8
+ import { Capability, Common } from '@dxos/app-framework';
9
+ import { useCapability, useLayout, useOperationInvoker, useSettingsState } from '@dxos/app-framework/react';
10
+ import {
11
+ AutomergePanel,
12
+ ConfigPanel,
13
+ CredentialsPanel,
14
+ DeviceListPanel,
15
+ DiagnosticsPanel,
16
+ EdgeDashboardPanel,
17
+ FeedsPanel,
18
+ IdentityPanel,
19
+ InvocationTraceContainer,
20
+ KeyringPanel,
21
+ LoggingPanel,
22
+ MembersPanel,
23
+ MetadataPanel,
24
+ NetworkPanel,
25
+ ObjectsPanel,
26
+ QueuesPanel,
27
+ SchemaPanel,
28
+ SignalPanel,
29
+ SpaceInfoPanel,
30
+ SpaceListPanel,
31
+ StoragePanel,
32
+ SwarmPanel,
33
+ TestingPanel,
34
+ TracingPanel,
35
+ WorkflowPanel,
36
+ } from '@dxos/devtools';
37
+ import { Obj } from '@dxos/echo';
38
+ import { log } from '@dxos/log';
39
+ import { ClientCapabilities } from '@dxos/plugin-client';
40
+ import { type Graph } from '@dxos/plugin-graph';
41
+ import { ScriptOperation } from '@dxos/plugin-script/types';
42
+ import { SpaceOperation } from '@dxos/plugin-space/types';
43
+ import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
44
+ import { Layout } from '@dxos/react-ui-mosaic';
45
+ import { Collection } from '@dxos/schema';
46
+
47
+ import {
48
+ DebugGraph,
49
+ DebugObjectPanel,
50
+ DebugSettings,
51
+ DebugStatus,
52
+ DevtoolsOverviewContainer,
53
+ SpaceGenerator,
54
+ Wireframe,
55
+ } from '../../components';
56
+ import { meta } from '../../meta';
57
+ import { DebugCapabilities, type DebugSettingsProps, Devtools } from '../../types';
58
+
59
+ type SpaceDebug = {
60
+ type: string;
61
+ space: Space;
62
+ };
63
+
64
+ type GraphDebug = {
65
+ graph: Graph.Graph;
66
+ root: string;
67
+ };
68
+
69
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
70
+ const isGraphDebug = (data: any): data is GraphDebug => {
71
+ const graph = data?.graph;
72
+ return (
73
+ graph != null && typeof graph === 'object' && typeof graph.json === 'function' && typeof data?.root === 'string'
74
+ );
75
+ };
76
+
77
+ // TODO(wittjosiah): Factor out?
78
+ const useCurrentSpace = () => {
79
+ const layout = useLayout();
80
+ const client = useCapability(ClientCapabilities.Client);
81
+ const { spaceId } = parseId(layout.workspace);
82
+ const space = spaceId ? client.spaces.get(spaceId) : undefined;
83
+ return space;
84
+ };
85
+
86
+ export default Capability.makeModule(
87
+ Effect.fnUntraced(function* () {
88
+ const capabilities = yield* Capability.Service;
89
+ const registry = capabilities.get(Common.Capability.AtomRegistry);
90
+ const settingsAtom = capabilities.get(DebugCapabilities.Settings);
91
+
92
+ return Capability.contributes(Common.Capability.ReactSurface, [
93
+ Common.createSurface({
94
+ id: `${meta.id}/plugin-settings`,
95
+ role: 'article',
96
+ filter: (data): data is { subject: Common.Capability.Settings } =>
97
+ Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
98
+ component: ({ data: { subject } }) => {
99
+ const { settings, updateSettings } = useSettingsState<DebugSettingsProps>(subject.atom);
100
+ return <DebugSettings settings={settings} onSettingsChange={updateSettings} />;
101
+ },
102
+ }),
103
+ Common.createSurface({
104
+ id: `${meta.id}/space`,
105
+ role: 'article',
106
+ filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
107
+ component: ({ role, data }) => {
108
+ const { invokePromise } = useOperationInvoker();
109
+
110
+ const handleCreateObject = useCallback(
111
+ (objects: Obj.Unknown[]) => {
112
+ if (!isSpace(data.subject.space)) {
113
+ return;
114
+ }
115
+
116
+ const collection =
117
+ data.subject.space.state.get() === SpaceState.SPACE_READY &&
118
+ data.subject.space.properties[Collection.Collection.typename]?.target;
119
+ if (!Obj.instanceOf(Collection.Collection, collection)) {
120
+ return;
121
+ }
122
+
123
+ objects.forEach((object) => {
124
+ void invokePromise(SpaceOperation.AddObject, {
125
+ target: collection,
126
+ object,
127
+ });
128
+ });
129
+ },
130
+ [data.subject.space, invokePromise],
131
+ );
132
+
133
+ return (
134
+ <Layout.Main role={role}>
135
+ <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
136
+ </Layout.Main>
137
+ );
138
+ },
139
+ }),
140
+ Common.createSurface({
141
+ id: `${meta.id}/app-graph`,
142
+ role: 'article',
143
+ filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
144
+ component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
145
+ }),
146
+ Common.createSurface({
147
+ id: `${meta.id}/wireframe`,
148
+ role: ['article', 'section'],
149
+ position: 'hoist',
150
+ filter: (data): data is { subject: Obj.Unknown } => {
151
+ const settings = registry.get(settingsAtom);
152
+ return Obj.isObject(data.subject) && !!settings.wireframe;
153
+ },
154
+ component: ({ data, role }) => (
155
+ <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
156
+ ),
157
+ }),
158
+ Common.createSurface({
159
+ id: `${meta.id}/object-debug`,
160
+ role: 'article',
161
+ filter: (data): data is { companionTo: Obj.Unknown } =>
162
+ data.subject === 'debug' && Obj.isObject(data.companionTo),
163
+ component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
164
+ }),
165
+ Common.createSurface({
166
+ id: `${meta.id}/devtools-overview`,
167
+ role: 'deck-companion--devtools',
168
+ component: () => <DevtoolsOverviewContainer />,
169
+ }),
170
+ Common.createSurface({
171
+ id: `${meta.id}/status`,
172
+ role: 'status',
173
+ component: () => <DebugStatus />,
174
+ }),
175
+
176
+ //
177
+ // Devtools
178
+ //
179
+
180
+ Common.createSurface({
181
+ id: `${meta.id}/client/config`,
182
+ role: 'article',
183
+ filter: (data): data is any => data.subject === Devtools.Client.Config,
184
+ component: () => <ConfigPanel vaultSelector={false} />,
185
+ }),
186
+ Common.createSurface({
187
+ id: `${meta.id}/client/storage`,
188
+ role: 'article',
189
+ filter: (data): data is any => data.subject === Devtools.Client.Storage,
190
+ component: () => <StoragePanel />,
191
+ }),
192
+ Common.createSurface({
193
+ id: `${meta.id}/client/logs`,
194
+ role: 'article',
195
+ filter: (data): data is any => data.subject === Devtools.Client.Logs,
196
+ component: () => <LoggingPanel />,
197
+ }),
198
+ Common.createSurface({
199
+ id: `${meta.id}/client/diagnostics`,
200
+ role: 'article',
201
+ filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
202
+ component: () => <DiagnosticsPanel />,
203
+ }),
204
+ Common.createSurface({
205
+ id: `${meta.id}/client/tracing`,
206
+ role: 'article',
207
+ filter: (data): data is any => data.subject === Devtools.Client.Tracing,
208
+ component: () => <TracingPanel />,
209
+ }),
210
+ Common.createSurface({
211
+ id: `${meta.id}/halo/identity`,
212
+ role: 'article',
213
+ filter: (data): data is any => data.subject === Devtools.Halo.Identity,
214
+ component: () => <IdentityPanel />,
215
+ }),
216
+ Common.createSurface({
217
+ id: `${meta.id}/halo/devices`,
218
+ role: 'article',
219
+ filter: (data): data is any => data.subject === Devtools.Halo.Devices,
220
+ component: () => <DeviceListPanel />,
221
+ }),
222
+ Common.createSurface({
223
+ id: `${meta.id}/halo/keyring`,
224
+ role: 'article',
225
+ filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
226
+ component: () => <KeyringPanel />,
227
+ }),
228
+ Common.createSurface({
229
+ id: `${meta.id}/halo/credentials`,
230
+ role: 'article',
231
+ filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
232
+ component: () => {
233
+ const space = useCurrentSpace();
234
+ return <CredentialsPanel space={space} />;
235
+ },
236
+ }),
237
+ Common.createSurface({
238
+ id: `${meta.id}/echo/spaces`,
239
+ role: 'article',
240
+ filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
241
+ component: () => {
242
+ const { invokePromise } = useOperationInvoker();
243
+ const handleSelect = useCallback(
244
+ () => invokePromise(Common.LayoutOperation.Open, { subject: [Devtools.Echo.Space] }),
245
+ [invokePromise],
246
+ );
247
+ return <SpaceListPanel onSelect={handleSelect} />;
248
+ },
249
+ }),
250
+ Common.createSurface({
251
+ id: `${meta.id}/echo/space`,
252
+ role: 'article',
253
+ filter: (data): data is any => data.subject === Devtools.Echo.Space,
254
+ component: () => {
255
+ const space = useCurrentSpace();
256
+ const { invokePromise } = useOperationInvoker();
257
+ const handleSelect = useCallback(
258
+ () => invokePromise(Common.LayoutOperation.Open, { subject: [Devtools.Echo.Feeds] }),
259
+ [invokePromise],
260
+ );
261
+ return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
262
+ },
263
+ }),
264
+ Common.createSurface({
265
+ id: `${meta.id}/echo/feeds`,
266
+ role: 'article',
267
+ filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
268
+ component: () => {
269
+ const space = useCurrentSpace();
270
+ return <FeedsPanel space={space} />;
271
+ },
272
+ }),
273
+ Common.createSurface({
274
+ id: `${meta.id}/echo/objects`,
275
+ role: 'article',
276
+ filter: (data): data is any => data.subject === Devtools.Echo.Objects,
277
+ component: () => {
278
+ const space = useCurrentSpace();
279
+ return <ObjectsPanel space={space} />;
280
+ },
281
+ }),
282
+ Common.createSurface({
283
+ id: `${meta.id}/echo/schema`,
284
+ role: 'article',
285
+ filter: (data): data is any => data.subject === Devtools.Echo.Schema,
286
+ component: () => {
287
+ const space = useCurrentSpace();
288
+ return <SchemaPanel space={space} />;
289
+ },
290
+ }),
291
+ Common.createSurface({
292
+ id: `${meta.id}/echo/automerge`,
293
+ role: 'article',
294
+ filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
295
+ component: () => {
296
+ const space = useCurrentSpace();
297
+ return <AutomergePanel space={space} />;
298
+ },
299
+ }),
300
+ Common.createSurface({
301
+ id: `${meta.id}/echo/queues`,
302
+ role: 'article',
303
+ filter: (data): data is any => data.subject === Devtools.Echo.Queues,
304
+ component: () => <QueuesPanel />,
305
+ }),
306
+ Common.createSurface({
307
+ id: `${meta.id}/echo/members`,
308
+ role: 'article',
309
+ filter: (data): data is any => data.subject === Devtools.Echo.Members,
310
+ component: () => {
311
+ const space = useCurrentSpace();
312
+ return <MembersPanel space={space} />;
313
+ },
314
+ }),
315
+ Common.createSurface({
316
+ id: `${meta.id}/echo/metadata`,
317
+ role: 'article',
318
+ filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
319
+ component: () => <MetadataPanel />,
320
+ }),
321
+ Common.createSurface({
322
+ id: `${meta.id}/mesh/signal`,
323
+ role: 'article',
324
+ filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
325
+ component: () => <SignalPanel />,
326
+ }),
327
+ Common.createSurface({
328
+ id: `${meta.id}/mesh/swarm`,
329
+ role: 'article',
330
+ filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
331
+ component: () => <SwarmPanel />,
332
+ }),
333
+ Common.createSurface({
334
+ id: `${meta.id}/mesh/network`,
335
+ role: 'article',
336
+ filter: (data): data is any => data.subject === Devtools.Mesh.Network,
337
+ component: () => {
338
+ const space = useCurrentSpace();
339
+ return <NetworkPanel space={space} />;
340
+ },
341
+ }),
342
+ // TODO(wittjosiah): Remove?
343
+ // createSurface({
344
+ // id: `${meta.id}/agent/dashboard`,
345
+ // role: 'article',
346
+ // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
347
+ // component: () => <DashboardPanel />,
348
+ // }),
349
+ Common.createSurface({
350
+ id: `${meta.id}/edge/dashboard`,
351
+ role: 'article',
352
+ filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
353
+ component: () => <EdgeDashboardPanel />,
354
+ }),
355
+ Common.createSurface({
356
+ id: `${meta.id}/edge/workflows`,
357
+ role: 'article',
358
+ filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
359
+ component: () => {
360
+ const space = useCurrentSpace();
361
+ return <WorkflowPanel space={space} />;
362
+ },
363
+ }),
364
+ Common.createSurface({
365
+ id: `${meta.id}/edge/traces`,
366
+ role: 'article',
367
+ filter: (data): data is any => data.subject === Devtools.Edge.Traces,
368
+ component: () => {
369
+ const space = useCurrentSpace();
370
+ const queueDxn = space?.properties.invocationTraceQueue?.dxn;
371
+ return <InvocationTraceContainer db={space?.db} queueDxn={queueDxn} detailAxis='block' />;
372
+ },
373
+ }),
374
+ Common.createSurface({
375
+ id: `${meta.id}/edge/testing`,
376
+ role: 'article',
377
+ filter: (data): data is any => data.subject === Devtools.Edge.Testing,
378
+ component: () => {
379
+ const { invokePromise } = useOperationInvoker();
380
+ const onSpaceCreate = useCallback(
381
+ async (space: Space) => {
382
+ await space.waitUntilReady();
383
+ await invokePromise(SpaceOperation.Migrate, { space });
384
+ await space.db.flush();
385
+ },
386
+ [invokePromise],
387
+ );
388
+ const onScriptPluginOpen = useCallback(
389
+ async (space: Space) => {
390
+ await space.waitUntilReady();
391
+ const createResult = await invokePromise(ScriptOperation.CreateScript, { db: space.db });
392
+ if (createResult.data?.object) {
393
+ await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });
394
+ }
395
+ log.info('script created', { result: createResult });
396
+ if (createResult.data?.object?.id) {
397
+ await invokePromise(Common.LayoutOperation.Open, {
398
+ subject: [`${space.id}:${createResult.data.object.id}`],
399
+ });
400
+ }
401
+ },
402
+ [invokePromise],
403
+ );
404
+ return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
405
+ },
406
+ }),
407
+ ]);
408
+ }),
409
+ );
@@ -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,30 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability, Common } from '@dxos/app-framework';
8
+ import { createKvsStore } from '@dxos/effect';
9
+
10
+ import { meta } from '../../meta';
11
+ import { DebugCapabilities, DebugSettingsSchema } from '../../types';
12
+
13
+ export default Capability.makeModule(() =>
14
+ Effect.sync(() => {
15
+ const settingsAtom = createKvsStore({
16
+ key: meta.id,
17
+ schema: DebugSettingsSchema,
18
+ defaultValue: () => ({}),
19
+ });
20
+
21
+ return [
22
+ Capability.contributes(DebugCapabilities.Settings, settingsAtom),
23
+ Capability.contributes(Common.Capability.Settings, {
24
+ prefix: meta.id,
25
+ schema: DebugSettingsSchema,
26
+ atom: settingsAtom,
27
+ }),
28
+ ];
29
+ }),
30
+ );
@@ -5,10 +5,11 @@
5
5
  import React, { type FC } from 'react';
6
6
 
7
7
  import { Tree } from '@dxos/devtools';
8
- import { type Graph } from '@dxos/plugin-graph';
8
+ import { Graph } from '@dxos/plugin-graph';
9
9
 
10
- export const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {
11
- return <Tree data={graph.toJSON(root)} />;
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)} />;
12
13
  };
13
14
 
14
15
  export default DebugGraph;
@@ -6,11 +6,11 @@ import React from 'react';
6
6
 
7
7
  import { type Obj } from '@dxos/echo';
8
8
  import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
9
- import { StackItem } from '@dxos/react-ui-stack';
9
+ import { Layout } from '@dxos/react-ui-mosaic';
10
10
  import { Json } from '@dxos/react-ui-syntax-highlighter';
11
11
 
12
12
  export type DebugObjectPanelProps = {
13
- object: Obj.Any;
13
+ object: Obj.Unknown;
14
14
  };
15
15
 
16
16
  // TODO(burdon): Get schema and traverse references.
@@ -19,7 +19,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
19
19
 
20
20
  return (
21
21
  <Clipboard.Provider>
22
- <StackItem.Content toolbar>
22
+ <Layout.Main toolbar>
23
23
  <Toolbar.Root>
24
24
  <Input.Root>
25
25
  <Input.TextInput disabled value={dxn} />
@@ -27,7 +27,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
27
27
  </Input.Root>
28
28
  </Toolbar.Root>
29
29
  <Json data={object} />
30
- </StackItem.Content>
30
+ </Layout.Main>
31
31
  </Clipboard.Provider>
32
32
  );
33
33
  };
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { useEffect, useState } from 'react';
6
6
 
7
- import { Capabilities } from '@dxos/app-framework';
7
+ import { Common } from '@dxos/app-framework';
8
8
  import { useCapabilities } from '@dxos/app-framework/react';
9
9
  import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
10
10
  import { log } from '@dxos/log';
@@ -26,14 +26,19 @@ const StorageAdapters = {
26
26
  idb: defs.Runtime.Client.Storage.StorageDriver.IDB,
27
27
  } as const;
28
28
 
29
- export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {
29
+ export type DebugSettingsComponentProps = {
30
+ settings: DebugSettingsProps;
31
+ onSettingsChange: (fn: (current: DebugSettingsProps) => DebugSettingsProps) => void;
32
+ };
33
+
34
+ export const DebugSettings = ({ settings, onSettingsChange }: DebugSettingsComponentProps) => {
30
35
  const { t } = useTranslation(meta.id);
31
36
  const [toast, setToast] = useState<Toast>();
32
37
  const client = useClient();
33
38
  const download = useFileDownload();
34
39
  // TODO(mykola): Get updates from other places that change Config.
35
40
  const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
36
- const [upload] = useCapabilities(Capabilities.FileUploader);
41
+ const [upload] = useCapabilities(Common.Capability.FileUploader);
37
42
 
38
43
  useEffect(() => {
39
44
  void Storage().then((config) => setStorageConfig(config));
@@ -54,7 +59,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
54
59
  download(file, fileName);
55
60
 
56
61
  if (upload) {
57
- const info = await upload(client.spaces.default, new File([file], fileName));
62
+ const info = await upload(client.spaces.default.db, new File([file], fileName));
58
63
  if (!info) {
59
64
  log.error('diagnostics failed to upload to IPFS');
60
65
  return;
@@ -98,7 +103,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
98
103
  <ControlItemInput title={t('settings wireframe')}>
99
104
  <Input.Switch
100
105
  checked={settings.wireframe}
101
- onCheckedChange={(checked) => (settings.wireframe = !!checked)}
106
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, wireframe: !!checked }))}
102
107
  />
103
108
  </ControlItemInput>
104
109
  <ControlItemInput title={t('settings download diagnostics')}>
@@ -2,15 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
5
+ import type * as Schema from 'effect/Schema';
6
+
6
7
  import { addressToA1Notation } from '@dxos/compute';
7
8
  import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
8
- import { DXN, Filter, Key, type Obj, Type } from '@dxos/echo';
9
- import { type TypedObject } from '@dxos/echo/internal';
9
+ import { DXN, Filter, Key, type Type } from '@dxos/echo';
10
+ import { type OperationInvoker } from '@dxos/operation';
10
11
  import { Markdown } from '@dxos/plugin-markdown/types';
11
12
  import { Sheet } from '@dxos/plugin-sheet/types';
12
13
  import { Diagram } from '@dxos/plugin-sketch/types';
13
- import { SpaceAction } from '@dxos/plugin-space/types';
14
+ import { SpaceOperation } from '@dxos/plugin-space/types';
14
15
  import { faker } from '@dxos/random';
15
16
  import { type Client } from '@dxos/react-client';
16
17
  import { type Space } from '@dxos/react-client/echo';
@@ -24,24 +25,24 @@ const findViewByTypename = async (views: View.View[], typename: string) => {
24
25
  return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
25
26
  };
26
27
 
27
- export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
28
+ export type ObjectGenerator<T> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
28
29
 
29
- export const createGenerator = <T extends Obj.Any>(
30
+ export const createGenerator = <S extends Type.Obj.Any>(
30
31
  client: Client,
31
- dispatch: PromiseIntentDispatcher,
32
- schema: TypedObject<T>,
33
- ): ObjectGenerator<T> => {
34
- return async (space: Space, n: number): Promise<T[]> => {
32
+ invokePromise: OperationInvoker.OperationInvoker['invokePromise'],
33
+ schema: S,
34
+ ): ObjectGenerator<Schema.Schema.Type<S>> => {
35
+ return async (space: Space, n: number): Promise<Schema.Schema.Type<S>[]> => {
35
36
  const typename = schema.typename;
36
37
 
37
38
  // Find or create table and view.
38
- const { objects: views } = await space.db.query(Filter.type(View.View)).run();
39
+ const views = await space.db.query(Filter.type(View.View)).run();
39
40
  const view = await findViewByTypename(views, typename);
40
- const staticSchema = client?.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
41
+ const staticSchema = client?.graph.schemaRegistry.query({ typename }).runSync()[0];
41
42
  if (!view && !staticSchema) {
42
- await dispatch(createIntent(SpaceAction.AddSchema, { space, schema, show: false }));
43
+ await invokePromise(SpaceOperation.AddSchema, { db: space.db, schema, show: false });
43
44
  } else if (!view && staticSchema) {
44
- await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename, show: false }));
45
+ await invokePromise(SpaceOperation.UseStaticSchema, { db: space.db, typename, show: false });
45
46
  }
46
47
 
47
48
  // Create objects.
@@ -71,9 +72,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
71
72
  Diagram.Diagram.typename,
72
73
  async (space, n, cb) => {
73
74
  const objects = range(n).map(() => {
74
- // TODO(burdon): Generate diagram.
75
75
  const obj = space.db.add(Diagram.make({ name: faker.commerce.productName() }));
76
-
77
76
  return obj;
78
77
  });
79
78